From: Takashi Sakamoto Date: Sun, 9 Feb 2020 03:20:53 +0000 (+0900) Subject: timer: instance_params: add object to represent parameter of instance X-Git-Tag: v0.1.0~343 X-Git-Url: https://git.alsa-project.org/?a=commitdiff_plain;h=8c20d51498662db3905b9bb0a044ea629a0b6122;p=alsa-gobject.git timer: instance_params: add object to represent parameter of instance Signed-off-by: Takashi Sakamoto --- diff --git a/src/timer/alsatimer.map b/src/timer/alsatimer.map index ee3ac32..4293a54 100644 --- a/src/timer/alsatimer.map +++ b/src/timer/alsatimer.map @@ -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 index 0000000..ee1339f --- /dev/null +++ b/src/timer/instance-params.c @@ -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 index 0000000..f7be8f4 --- /dev/null +++ b/src/timer/instance-params.h @@ -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 +#include + +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 diff --git a/src/timer/meson.build b/src/timer/meson.build index 6cd10c1..082956a 100644 --- a/src/timer/meson.build +++ b/src/timer/meson.build @@ -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 index 0000000..dbc576c --- /dev/null +++ b/tests/alsatimer-instance-params @@ -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) diff --git a/tests/meson.build b/tests/meson.build index dd4e776..a7d461c 100644 --- a/tests/meson.build +++ b/tests/meson.build @@ -22,6 +22,7 @@ tests = { 'alsatimer-device-params', 'alsatimer-user-instance', 'alsatimer-instance-info', + 'alsatimer-instance-params', ], }