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

index ee3ac32d63f50df88ff3e1203492c7843ca161dc..4293a54eb4504ae9cf50b93b82684638be5cebb7 100644 (file)
@@ -35,6 +35,9 @@ ALSA_GOBJECT_0_0_0 {
     "alsatimer_user_instance_get_info";
 
     "alsatimer_instance_info_get_type";
+
+    "alsatimer_instance_params_get_type";
+    "alsatimer_instance_params_new";
   local:
     *;
 };
diff --git a/src/timer/instance-params.c b/src/timer/instance-params.c
new file mode 100644 (file)
index 0000000..ee1339f
--- /dev/null
@@ -0,0 +1,25 @@
+// SPDX-License-Identifier: LGPL-3.0-or-later
+#include "instance-params.h"
+
+G_DEFINE_TYPE(ALSATimerInstanceParams, alsatimer_instance_params, G_TYPE_OBJECT)
+
+static void alsatimer_instance_params_class_init(ALSATimerInstanceParamsClass *klass)
+{
+    return;
+
+}
+
+static void alsatimer_instance_params_init(ALSATimerInstanceParams *self)
+{
+    return;
+}
+
+/**
+ * alsatimer_instance_params_new:
+ *
+ * Allocate and return an instance of ALSATimerInstanceParams.
+ */
+ALSATimerInstanceParams *alsatimer_instance_params_new()
+{
+    return g_object_new(ALSATIMER_TYPE_INSTANCE_PARAMS, NULL);
+}
diff --git a/src/timer/instance-params.h b/src/timer/instance-params.h
new file mode 100644 (file)
index 0000000..f7be8f4
--- /dev/null
@@ -0,0 +1,49 @@
+// SPDX-License-Identifier: LGPL-3.0-or-later
+#ifndef __ALSA_GOBJECT_ALSATIMER_INSTANCE_PARAMS__H__
+#define __ALSA_GOBJECT_ALSATIMER_INSTANCE_PARAMS__H__
+
+#include <glib.h>
+#include <glib-object.h>
+
+G_BEGIN_DECLS
+
+#define ALSATIMER_TYPE_INSTANCE_PARAMS  (alsatimer_instance_params_get_type())
+
+#define ALSATIMER_INSTANCE_PARAMS(obj)                          \
+    (G_TYPE_CHECK_INSTANCE_CAST((obj),                          \
+                                ALSATIMER_TYPE_INSTANCE_PARAMS, \
+                                ALSATimerInstanceParams))
+#define ALSATIMER_IS_INSTANCE_PARAMS(obj)                       \
+    (G_TYPE_CHECK_INSTANCE_TYPE((obj),                          \
+                                ALSATIMER_TYPE_INSTANCE_PARAMS))
+
+#define ALSATIMER_INSTANCE_PARAMS_CLASS(klass)                  \
+    (G_TYPE_CHECK_CLASS_CAST((klass),                           \
+                             ALSATIMER_TYPE_INSTANCE_PARAMS,    \
+                             ALSATimerInstanceParamsClass))
+#define ALSATIMER_IS_INSTANCE_PARAMS_CLASS(klass)               \
+    (G_TYPE_CHECK_CLASS_TYPE((klass),                           \
+                             ALSATIMER_TYPE_INSTANCE_PARAMS))
+#define ALSATIMER_INSTANCE_PARAMS_GET_CLASS(obj)                \
+    (G_TYPE_INSTANCE_GET_CLASS((obj),                           \
+                               ALSATIMER_TYPE_INSTANCE_PARAMS,  \
+                               ALSATimerInstanceParamsClass))
+
+typedef struct _ALSATimerInstanceParams         ALSATimerInstanceParams;
+typedef struct _ALSATimerInstanceParamsClass    ALSATimerInstanceParamsClass;
+
+struct _ALSATimerInstanceParams {
+    GObject parent_instance;
+};
+
+struct _ALSATimerInstanceParamsClass {
+    GObjectClass parent_class;
+};
+
+GType alsatimer_instance_params_get_type() G_GNUC_CONST;
+
+ALSATimerInstanceParams *alsatimer_instance_params_new();
+
+G_END_DECLS
+
+#endif
index 6cd10c19532d7023a7be101e51ca83f9423f5c59..082956add033bb448fcc3d6b4d4baa0f4b73a18a 100644 (file)
@@ -16,6 +16,7 @@ sources = files(
   'device-params.c',
   'user-instance.c',
   'instance-info.c',
+  'instance-params.c',
 )
 
 headers = files(
@@ -26,6 +27,7 @@ headers = files(
   'device-params.h',
   'user-instance.h',
   'instance-info.h',
+  'instance-params.h',
 )
 
 privates = files(
diff --git a/tests/alsatimer-instance-params b/tests/alsatimer-instance-params
new file mode 100644 (file)
index 0000000..dbc576c
--- /dev/null
@@ -0,0 +1,20 @@
+#!/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.InstanceParams()
+props = ()
+methods = (
+    'new',
+)
+signals = ()
+
+if not test(target, props, methods, signals):
+    exit(ENXIO)
index dd4e7769cfe1b7293f1ae6d739c1b09f708a2b58..a7d461c5d57103329f55189df0319ff7b45d4cf6 100644 (file)
@@ -22,6 +22,7 @@ tests = {
     'alsatimer-device-params',
     'alsatimer-user-instance',
     'alsatimer-instance-info',
+    'alsatimer-instance-params',
   ],
 }