]> git.alsa-project.org Git - alsa-gobject.git/commitdiff
timer: device_info: add object to represent information of timer
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-info.c [new file with mode: 0644]
src/timer/device-info.h [new file with mode: 0644]
src/timer/meson.build
tests/alsatimer-device-info [new file with mode: 0644]
tests/meson.build

index 9ae39db6bdb4950c34953cb6c06e2bc782fa06ae..088b9b598656c87d82e2a04d5545a820ac6fd656 100644 (file)
@@ -17,6 +17,8 @@ ALSA_GOBJECT_0_0_0 {
     "alsatimer_device_id_get_card_id";
     "alsatimer_device_id_get_device_id";
     "alsatimer_device_id_get_subdevice_id";
+
+    "alsatimer_device_info_get_type";
   local:
     *;
 };
diff --git a/src/timer/device-info.c b/src/timer/device-info.c
new file mode 100644 (file)
index 0000000..0f98404
--- /dev/null
@@ -0,0 +1,15 @@
+// SPDX-License-Identifier: LGPL-3.0-or-later
+#include "device-info.h"
+
+#include <sound/asound.h>
+
+G_DEFINE_TYPE(ALSATimerDeviceInfo, alsatimer_device_info, G_TYPE_OBJECT)
+
+static void alsatimer_device_info_class_init(ALSATimerDeviceInfoClass *klass)
+{
+}
+
+static void alsatimer_device_info_init(ALSATimerDeviceInfo *self)
+{
+    return;
+}
diff --git a/src/timer/device-info.h b/src/timer/device-info.h
new file mode 100644 (file)
index 0000000..f3de19c
--- /dev/null
@@ -0,0 +1,47 @@
+// SPDX-License-Identifier: LGPL-3.0-or-later
+#ifndef __ALSA_GOBJECT_ALSATIMER_DEVICE_INFO__H__
+#define __ALSA_GOBJECT_ALSATIMER_DEVICE_INFO__H__
+
+#include <glib.h>
+#include <glib-object.h>
+
+G_BEGIN_DECLS
+
+#define ALSATIMER_TYPE_DEVICE_INFO   (alsatimer_device_info_get_type())
+
+#define ALSATIMER_DEVICE_INFO(obj)                              \
+    (G_TYPE_CHECK_INSTANCE_CAST((obj),                          \
+                                ALSATIMER_TYPE_DEVICE_INFO,     \
+                                ALSATimerDeviceInfo))
+#define ALSATIMER_IS_DEVICE_INFO(obj)                           \
+    (G_TYPE_CHECK_INSTANCE_TYPE((obj),                          \
+                                ALSATIMER_TYPE_DEVICE_INFO))
+
+#define ALSATIMER_DEVICE_INFO_CLASS(klass)                      \
+    (G_TYPE_CHECK_CLASS_CAST((klass),                           \
+                             ALSATIMER_TYPE_DEVICE_INFO,        \
+                             ALSATimerDeviceInfoClass))
+#define ALSATIMER_IS_DEVICE_INFO_CLASS(klass)                   \
+    (G_TYPE_CHECK_CLASS_TYPE((klass),                           \
+                             ALSATIMER_TYPE_DEVICE_INFO))
+#define ALSATIMER_DEVICE_INFO_GET_CLASS(obj)                    \
+    (G_TYPE_INSTANCE_GET_CLASS((obj),                           \
+                               ALSATIMER_TYPE_DEVICE_INFO,      \
+                               ALSATimerDeviceInfoClass))
+
+typedef struct _ALSATimerDeviceInfo         ALSATimerDeviceInfo;
+typedef struct _ALSATimerDeviceInfoClass    ALSATimerDeviceInfoClass;
+
+struct _ALSATimerDeviceInfo {
+    GObject parent_instance;
+};
+
+struct _ALSATimerDeviceInfoClass {
+    GObjectClass parent_class;
+};
+
+GType alsatimer_device_info_get_type() G_GNUC_CONST;
+
+G_END_DECLS
+
+#endif
index 96ae71af61a13cd65a75becea6489586b241bfd7..077eef24701a71db4051588a4bcae4a1b38317ce 100644 (file)
@@ -11,11 +11,13 @@ has_marshaller = false
 sources = files(
   'query.c',
   'device-id.c',
+  'device-info.c',
 )
 
 headers = files(
   'query.h',
   'device-id.h',
+  'device-info.h',
 )
 
 privates = files(
diff --git a/tests/alsatimer-device-info b/tests/alsatimer-device-info
new file mode 100644 (file)
index 0000000..d76fae1
--- /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.DeviceInfo()
+props = ()
+methods = ()
+signals = ()
+
+if not test(target, props, methods, signals):
+    exit(ENXIO)
index fb1e8b1146b16286f87698108e38b7972c3ef618..d9fe90d303f1408b56f7fcbe381f5ed4280600af 100644 (file)
@@ -17,6 +17,7 @@ tests = {
   ],
   'timer': [
     'alsatimer-enums',
+    'alsatimer-device-info',
   ],
 }