]> git.alsa-project.org Git - alsa-gobject.git/commitdiff
timer: device_status: add object to represent status of timer device
authorTakashi Sakamoto <o-takashi@sakamocchi.jp>
Sun, 9 Feb 2020 03:20:53 +0000 (12:20 +0900)
committer坂本 貴史 <o-takashi@sakamocchi.jp>
Tue, 11 Feb 2020 04:28:18 +0000 (13:28 +0900)
Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
src/timer/alsatimer.map
src/timer/device-status.c [new file with mode: 0644]
src/timer/device-status.h [new file with mode: 0644]
src/timer/meson.build
tests/alsatimer-device-status [new file with mode: 0644]
tests/meson.build

index ab4a22a398812630de8b3328fc0cd7a3e04eeab5..ed05263b1368a6aa25d5df8bb9b574c5a3df0cf0 100644 (file)
@@ -20,6 +20,8 @@ ALSA_GOBJECT_0_0_0 {
     "alsatimer_device_id_get_subdevice_id";
 
     "alsatimer_device_info_get_type";
+
+    "alsatimer_device_status_get_type";
   local:
     *;
 };
diff --git a/src/timer/device-status.c b/src/timer/device-status.c
new file mode 100644 (file)
index 0000000..0cb5928
--- /dev/null
@@ -0,0 +1,13 @@
+// SPDX-License-Identifier: LGPL-3.0-or-later
+#include "device-status.h"
+
+G_DEFINE_TYPE(ALSATimerDeviceStatus, alsatimer_device_status, G_TYPE_OBJECT)
+
+static void alsatimer_device_status_class_init(ALSATimerDeviceStatusClass *klass)
+{
+}
+
+static void alsatimer_device_status_init(ALSATimerDeviceStatus *self)
+{
+    return;
+}
diff --git a/src/timer/device-status.h b/src/timer/device-status.h
new file mode 100644 (file)
index 0000000..70b4e09
--- /dev/null
@@ -0,0 +1,47 @@
+// SPDX-License-Identifier: LGPL-3.0-or-later
+#ifndef __ALSA_GOBJECT_ALSATIMER_DEVICE_STATUS__H__
+#define __ALSA_GOBJECT_ALSATIMER_DEVICE_STATUS__H__
+
+#include <glib.h>
+#include <glib-object.h>
+
+G_BEGIN_DECLS
+
+#define ALSATIMER_TYPE_DEVICE_STATUS    (alsatimer_device_status_get_type())
+
+#define ALSATIMER_DEVICE_STATUS(obj)                            \
+    (G_TYPE_CHECK_INSTANCE_CAST((obj),                          \
+                                ALSATIMER_TYPE_DEVICE_STATUS,   \
+                                ALSATimerDeviceStatus))
+#define ALSATIMER_IS_DEVICE_STATUS(obj)                         \
+    (G_TYPE_CHECK_INSTANCE_TYPE((obj),                          \
+                                ALSATIMER_TYPE_DEVICE_STATUS))
+
+#define ALSATIMER_DEVICE_STATUS_CLASS(klass)                    \
+    (G_TYPE_CHECK_CLASS_CAST((klass),                           \
+                             ALSATIMER_TYPE_DEVICE_STATUS,      \
+                             ALSATimerDeviceStatusClass))
+#define ALSATIMER_IS_DEVICE_STATUS_CLASS(klass)                 \
+    (G_TYPE_CHECK_CLASS_TYPE((klass),                           \
+                             ALSATIMER_TYPE_DEVICE_STATUS))
+#define ALSATIMER_DEVICE_STATUS_GET_CLASS(obj)                  \
+    (G_TYPE_INSTANCE_GET_CLASS((obj),                           \
+                               ALSATIMER_TYPE_DEVICE_STATUS,    \
+                               ALSATimerDeviceStatusClass))
+
+typedef struct _ALSATimerDeviceStatus           ALSATimerDeviceStatus;
+typedef struct _ALSATimerDeviceStatusClass      ALSATimerDeviceStatusClass;
+
+struct _ALSATimerDeviceStatus {
+    GObject parent_instance;
+};
+
+struct _ALSATimerDeviceStatusClass {
+    GObjectClass parent_class;
+};
+
+GType alsatimer_device_status_get_type() G_GNUC_CONST;
+
+G_END_DECLS
+
+#endif
index 077eef24701a71db4051588a4bcae4a1b38317ce..131b7bce74b7e8ea9428da121dfe26babe71d07a 100644 (file)
@@ -12,12 +12,14 @@ sources = files(
   'query.c',
   'device-id.c',
   'device-info.c',
+  'device-status.c',
 )
 
 headers = files(
   'query.h',
   'device-id.h',
   'device-info.h',
+  'device-status.h',
 )
 
 privates = files(
diff --git a/tests/alsatimer-device-status b/tests/alsatimer-device-status
new file mode 100644 (file)
index 0000000..cfa1ce9
--- /dev/null
@@ -0,0 +1,18 @@
+#!/usr/bin/env python3
+
+from sys import exit
+from errno import ENXIO
+
+from helper import test
+
+import gi
+gi.require_version('ALSATimer', '0.0')
+from gi.repository import ALSATimer
+
+target = ALSATimer.DeviceStatus()
+props = ()
+methods = ()
+signals = ()
+
+if not test(target, props, methods, signals):
+    exit(ENXIO)
index d9fe90d303f1408b56f7fcbe381f5ed4280600af..86ded7ee6712f187f5172aaf600d4f1e91f51f3a 100644 (file)
@@ -18,6 +18,7 @@ tests = {
   'timer': [
     'alsatimer-enums',
     'alsatimer-device-info',
+    'alsatimer-device-status',
   ],
 }