]> git.alsa-project.org Git - alsa-gobject.git/commitdiff
seq: port_info: add object to represent information of port for ALSA Sequencer
authorTakashi Sakamoto <o-takashi@sakamocchi.jp>
Wed, 1 Apr 2020 09:13:28 +0000 (18:13 +0900)
committer坂本 貴史 <o-takashi@sakamocchi.jp>
Fri, 3 Apr 2020 13:06:25 +0000 (22:06 +0900)
Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
src/seq/alsaseq.map
src/seq/meson.build
src/seq/port-info.c [new file with mode: 0644]
src/seq/port-info.h [new file with mode: 0644]
tests/alsaseq-port-info [new file with mode: 0644]
tests/meson.build

index 798d74a408ae7cc0461e04c9ba6a0be8b201dd17..96d1858d7587b9697e96283c114bb9d753981f9f 100644 (file)
@@ -40,6 +40,9 @@ ALSA_GOBJECT_0_0_0 {
     "alsaseq_addr_new";
     "alsaseq_addr_get_client_id";
     "alsaseq_addr_get_port_id";
+
+    "alsaseq_port_info_get_type";
+    "alsaseq_port_info_new";
   local:
     *;
 };
index d5fc3b6808ca0a8b45a9721b0b9eca51abfb90fe..cea2452fbe72ee6a0d3c0131c46abcfa36f984ed 100644 (file)
@@ -14,6 +14,7 @@ sources = files(
   'client-info.c',
   'user-client.c',
   'addr.c',
+  'port-info.c',
 )
 
 headers = files(
@@ -22,6 +23,7 @@ headers = files(
   'client-info.h',
   'user-client.h',
   'addr.h',
+  'port-info.h',
 )
 
 privates = files(
diff --git a/src/seq/port-info.c b/src/seq/port-info.c
new file mode 100644 (file)
index 0000000..65e8553
--- /dev/null
@@ -0,0 +1,24 @@
+// SPDX-License-Identifier: LGPL-3.0-or-later
+#include "port-info.h"
+
+G_DEFINE_TYPE(ALSASeqPortInfo, alsaseq_port_info, G_TYPE_OBJECT)
+
+static void alsaseq_port_info_class_init(ALSASeqPortInfoClass *klass)
+{
+    return;
+}
+
+static void alsaseq_port_info_init(ALSASeqPortInfo *self)
+{
+    return;
+}
+
+/**
+ * alsaseq_port_info_new:
+ *
+ * Allocate and return an instance of ALSASeqPortInfo class.
+ */
+ALSASeqPortInfo *alsaseq_port_info_new()
+{
+    return g_object_new(ALSASEQ_TYPE_PORT_INFO, NULL);
+}
diff --git a/src/seq/port-info.h b/src/seq/port-info.h
new file mode 100644 (file)
index 0000000..2925278
--- /dev/null
@@ -0,0 +1,47 @@
+// SPDX-License-Identifier: LGPL-3.0-or-later
+#ifndef __ALSA_GOBJECT_ALSASEQ_PORT_INFO__H__
+#define __ALSA_GOBJECT_ALSASEQ_PORT_INFO__H__
+
+#include <glib.h>
+#include <glib-object.h>
+
+G_BEGIN_DECLS
+
+#define ALSASEQ_TYPE_PORT_INFO      (alsaseq_port_info_get_type())
+
+#define ALSASEQ_PORT_INFO(obj)                              \
+    (G_TYPE_CHECK_INSTANCE_CAST((obj),                      \
+                                ALSASEQ_TYPE_PORT_INFO,     \
+                                ALSASeqPortInfo))
+#define ALSASEQ_IS_PORT_INFO(obj)                           \
+    (G_TYPE_CHECK_INSTANCE_TYPE((obj),                      \
+                                ALSASEQ_TYPE_PORT_INFO))
+
+#define ALSASEQ_PORT_INFO_CLASS(klass)                      \
+    (G_TYPE_CHECK_CLASS_CAST((klass),                       \
+                             ALSASEQ_TYPE_PORT_INFO,        \
+                             ALSASeqPortInfoClass))
+#define ALSASEQ_IS_PORT_INFO_CLASS(klass)                   \
+    (G_TYPE_CHECK_CLASS_TYPE((klass),                       \
+                             ALSASEQ_TYPE_PORT_INFO))
+#define ALSASEQ_PORT_INFO_GET_CLASS(obj)                    \
+    (G_TYPE_INSTANCE_GET_CLASS((obj),                       \
+                               ALSASEQ_TYPE_PORT_INFO,      \
+                               ALSASeqPortInfoClass))
+
+typedef struct _ALSASeqPortInfo         ALSASeqPortInfo;
+typedef struct _ALSASeqPortInfoClass    ALSASeqPortInfoClass;
+
+struct _ALSASeqPortInfo {
+    GObject parent_instance;
+};
+
+struct _ALSASeqPortInfoClass {
+    GObjectClass parent_class;
+};
+
+GType alsaseq_port_info_get_type() G_GNUC_CONST;
+
+ALSASeqPortInfo *alsaseq_port_info_new();
+
+#endif
diff --git a/tests/alsaseq-port-info b/tests/alsaseq-port-info
new file mode 100644 (file)
index 0000000..4c6a576
--- /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('ALSASeq', '0.0')
+from gi.repository import ALSASeq
+
+target = ALSASeq.PortInfo()
+props = ()
+methods = (
+    'new',
+)
+signals = ()
+
+if not test(target, props, methods, signals):
+    exit(ENXIO)
index 4f81e3cce4d3f6db913e19994b9de571e9fb1f8e..a682172d58236564d678f489ce47f3445a87128e 100644 (file)
@@ -33,6 +33,7 @@ tests = {
     'alsaseq-system-info',
     'alsaseq-client-info',
     'alsaseq-user-client',
+    'alsaseq-port-info',
   ],
 }