From: Takashi Sakamoto Date: Wed, 27 Nov 2019 06:44:05 +0000 (+0900) Subject: hwdep: device_info: add object to represent information of hwdep device X-Git-Tag: v0.1.0~200 X-Git-Url: https://git.alsa-project.org/?a=commitdiff_plain;h=37f25e263e971f4cb6cac9ef9817b98a4a89e85f;p=alsa-gobject.git hwdep: device_info: add object to represent information of hwdep device Signed-off-by: Takashi Sakamoto --- diff --git a/src/hwdep/alsahwdep.map b/src/hwdep/alsahwdep.map index 5b5eb5b..58b4aac 100644 --- a/src/hwdep/alsahwdep.map +++ b/src/hwdep/alsahwdep.map @@ -5,6 +5,8 @@ ALSA_GOBJECT_0_0_0 { "alsahwdep_get_device_id_list"; "alsahwdep_get_hwdep_sysname"; "alsahwdep_get_hwdep_devnode"; + + "alsahwdep_device_info_get_type"; local: *; }; diff --git a/src/hwdep/device-info.c b/src/hwdep/device-info.c new file mode 100644 index 0000000..a79513a --- /dev/null +++ b/src/hwdep/device-info.c @@ -0,0 +1,14 @@ +// SPDX-License-Identifier: LGPL-3.0-or-later +#include "device-info.h" + +G_DEFINE_TYPE(ALSAHwdepDeviceInfo, alsahwdep_device_info, G_TYPE_OBJECT) + +static void alsahwdep_device_info_class_init(ALSAHwdepDeviceInfoClass *klass) +{ + return; +} + +static void alsahwdep_device_info_init(ALSAHwdepDeviceInfo *self) +{ + return; +} diff --git a/src/hwdep/device-info.h b/src/hwdep/device-info.h new file mode 100644 index 0000000..45b4830 --- /dev/null +++ b/src/hwdep/device-info.h @@ -0,0 +1,47 @@ +// SPDX-License-Identifier: LGPL-3.0-or-later +#ifndef __ALSA_GOBJECT_ALSAHWDEP_DEVICE_INFO__H__ +#define __ALSA_GOBJECT_ALSAHWDEP_DEVICE_INFO__H__ + +#include +#include + +G_BEGIN_DECLS + +#define ALSAHWDEP_TYPE_DEVICE_INFO (alsahwdep_device_info_get_type()) + +#define ALSAHWDEP_DEVICE_INFO(obj) \ + (G_TYPE_CHECK_INSTANCE_CAST((obj), \ + ALSAHWDEP_TYPE_DEVICE_INFO, \ + ALSAHwdepDeviceInfo)) +#define ALSAHWDEP_IS_DEVICE_INFO(obj) \ + (G_TYPE_CHECK_INSTANCE_TYPE((obj), \ + ALSAHWDEP_TYPE_DEVICE_INFO)) + +#define ALSAHWDEP_DEVICE_INFO_CLASS(klass) \ + (G_TYPE_CHECK_CLASS_CAST((klass), \ + ALSAHWDEP_TYPE_DEVICE_INFO, \ + ALSAHwdepDeviceInfoClass)) +#define ALSAHWDEP_IS_DEVICE_INFO_CLASS(klass) \ + (G_TYPE_CHECK_CLASS_TYPE((klass), \ + ALSAHWDEP_TYPE_DEVICE_INFO)) +#define ALSAHWDEP_DEVICE_INFO_GET_CLASS(obj) \ + (G_TYPE_INSTANCE_GET_CLASS((obj), \ + ALSAHWDEP_TYPE_DEVICE_INFO, \ + ALSAHwdepDeviceInfoClass)) + +typedef struct _ALSAHwdepDeviceInfo ALSAHwdepDeviceInfo; +typedef struct _ALSAHwdepDeviceInfoClass ALSAHwdepDeviceInfoClass; + +struct _ALSAHwdepDeviceInfo { + GObject parent_instance; +}; + +struct _ALSAHwdepDeviceInfoClass { + GObjectClass parent_class; +}; + +GType alsahwdep_device_info_get_type() G_GNUC_CONST; + +G_END_DECLS + +#endif diff --git a/src/hwdep/meson.build b/src/hwdep/meson.build index 9dd65b4..0e25cd2 100644 --- a/src/hwdep/meson.build +++ b/src/hwdep/meson.build @@ -10,10 +10,12 @@ has_marshaller = false sources = files( 'query.c', + 'device-info.c', ) headers = files( 'query.h', + 'device-info.h', ) privates = files( diff --git a/tests/alsahwdep-device-info b/tests/alsahwdep-device-info new file mode 100644 index 0000000..74cf01b --- /dev/null +++ b/tests/alsahwdep-device-info @@ -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('ALSAHwdep', '0.0') +from gi.repository import ALSAHwdep + +target = ALSAHwdep.DeviceInfo() +props = () +methods = () +signals = () + +if not test(target, props, methods, signals): + exit(ENXIO) diff --git a/tests/meson.build b/tests/meson.build index 74d2c82..ac5096a 100644 --- a/tests/meson.build +++ b/tests/meson.build @@ -47,6 +47,7 @@ tests = { ], 'hwdep': [ 'alsahwdep-enums', + 'alsahwdep-device-info', ], }