/**
* SECTION: event-data-tick
* @Title: ALSATimerEventDataTick
- * @Short_description: A GObject-derived object to represent event of timer with
- * tick count
+ * @Short_description: A boxed object to represent event of timer with tick
+ * count
*
- * A #ALSATimerEventDataTick is a GObject-derived object to represent event of
- * timer with tick count. The instance of object is passed to handler for
- * 'handle-event' GObject signal in ALSATimerUserInstance when it's available.
- * The object inherits properties of #ALSATimerEventData.
+ * A #ALSATimerEventDataTick is a boxed object to represent event of timer with
+ * tick count.
*
* The object wraps 'struct snd_timer_read' in UAPI of Linux sound subsystem.
*/
-struct _ALSATimerEventDataTickPrivate {
- struct snd_timer_read event;
-};
-G_DEFINE_TYPE_WITH_PRIVATE(ALSATimerEventDataTick, alsatimer_event_data_tick, ALSATIMER_TYPE_EVENT_DATA)
-
-enum timer_event_data_tick_prop_type{
- TIMER_EVENT_DATA_TICK_PROP_RESOLUTION = 1,
- TIMER_EVENT_DATA_TICK_PROP_TICKS,
- TIMER_EVENT_DATA_TICK_PROP_COUNT,
-};
-static GParamSpec *timer_event_data_tick_props[TIMER_EVENT_DATA_TICK_PROP_COUNT] = { NULL, };
-
-static void timer_event_data_tick_get_property(GObject *obj, guint id, GValue *val, GParamSpec *spec)
-{
- ALSATimerEventDataTick *self = ALSATIMER_EVENT_DATA_TICK(obj);
- ALSATimerEventDataTickPrivate *priv = alsatimer_event_data_tick_get_instance_private(self);
-
- switch (id) {
- case TIMER_EVENT_DATA_TICK_PROP_RESOLUTION:
- g_value_set_uint(val, priv->event.resolution);
- break;
- case TIMER_EVENT_DATA_TICK_PROP_TICKS:
- g_value_set_uint(val, priv->event.ticks);
- break;
- default:
- G_OBJECT_WARN_INVALID_PROPERTY_ID(obj, id, spec);
- break;
- }
-}
-
-static void alsatimer_event_data_tick_class_init(ALSATimerEventDataTickClass *klass)
-{
- GObjectClass *gobject_class = G_OBJECT_CLASS(klass);
-
- gobject_class->get_property = timer_event_data_tick_get_property;
-
- timer_event_data_tick_props[TIMER_EVENT_DATA_TICK_PROP_RESOLUTION] =
- g_param_spec_uint("resolution", "resolution",
- "The resolution of tick.",
- 0, G_MAXUINT,
- 0,
- G_PARAM_READABLE);
-
- timer_event_data_tick_props[TIMER_EVENT_DATA_TICK_PROP_TICKS] =
- g_param_spec_uint("ticks", "ticks",
- "The ticks since the latest event.",
- 0, G_MAXUINT,
- 0,
- G_PARAM_READABLE);
-
- g_object_class_install_properties(gobject_class, TIMER_EVENT_DATA_TICK_PROP_COUNT,
- timer_event_data_tick_props);
-}
-
-static void alsatimer_event_data_tick_init(ALSATimerEventDataTick *self)
+ALSATimerEventDataTick *timer_event_data_tick_copy(const ALSATimerEventDataTick *self)
{
- return;
+ return g_memdup(self, sizeof(*self));
}
-void timer_event_data_tick_set_data(ALSATimerEventDataTick *self,
- struct snd_timer_read *data)
-{
- ALSATimerEventDataTickPrivate *priv =
- alsatimer_event_data_tick_get_instance_private(self);
-
- priv->event = *data;
-}
+G_DEFINE_BOXED_TYPE(ALSATimerEventDataTick, alsatimer_event_data_tick, timer_event_data_tick_copy, g_free)
#include <glib.h>
#include <glib-object.h>
-#include <timer/event-data.h>
+#include <sound/asound.h>
G_BEGIN_DECLS
#define ALSATIMER_TYPE_EVENT_DATA_TICK (alsatimer_event_data_tick_get_type())
-#define ALSATIMER_EVENT_DATA_TICK(obj) \
- (G_TYPE_CHECK_INSTANCE_CAST((obj), \
- ALSATIMER_TYPE_EVENT_DATA_TICK, \
- ALSATimerEventDataTick))
-#define ALSATIMER_IS_EVENT_DATA_TICK(obj) \
- (G_TYPE_CHECK_INSTANCE_TYPE((obj), \
- ALSATIMER_TYPE_EVENT_DATA_TICK))
-
-#define ALSATIMER_EVENT_DATA_TICK_CLASS(klass) \
- (G_TYPE_CHECK_CLASS_CAST((klass), \
- ALSATIMER_TYPE_EVENT_DATA_TICK, \
- ALSATimerEventDataTickClass))
-#define ALSATIMER_IS_EVENT_DATA_TICK_CLASS(klass) \
- (G_TYPE_CHECK_CLASS_TYPE((klass), \
- ALSATIMER_TYPE_EVENT_DATA_TICK))
-#define ALSATIMER_EVENT_DATA_TICK_GET_CLASS(obj) \
- (G_TYPE_INSTANCE_GET_CLASS((obj), \
- ALSATIMER_TYPE_EVENT_DATA_TICK, \
- ALSATimerEventDataTickkClass))
-
-typedef struct _ALSATimerEventDataTick ALSATimerEventDataTick;
-typedef struct _ALSATimerEventDataTickClass ALSATimerEventDataTickClass;
-typedef struct _ALSATimerEventDataTickPrivate ALSATimerEventDataTickPrivate;
-
-struct _ALSATimerEventDataTick {
- ALSATimerEventData parent_instance;
-
- ALSATimerEventDataTickPrivate *priv;
-};
-
-struct _ALSATimerEventDataTickClass {
- ALSATimerEventDataClass parent_class;
-};
+typedef struct snd_timer_read ALSATimerEventDataTick;
GType alsatimer_event_data_tick_get_type() G_GNUC_CONST;
#include <glib.h>
#include <glib-object.h>
-#include <sound/asound.h>
+#include <timer/event-data-tick.h>
G_BEGIN_DECLS
#define ALSATIMER_TYPE_EVENT (alsatimer_event_get_type())
typedef union {
- struct snd_timer_read tick;
+ ALSATimerEventDataTick tick;
struct snd_timer_tread timestamp;
} ALSATimerEvent;
#include "instance-info.h"
#include "instance-params.h"
#include "instance-status.h"
-#include "event-data-tick.h"
#include "event-data-timestamp.h"
#include <sound/asound.h>
void timer_instance_status_refer_private(ALSATimerInstanceStatus *self,
struct snd_timer_status **status);
-void timer_event_data_tick_set_data(ALSATimerEventDataTick *self,
- struct snd_timer_read *data);
-
void timer_event_data_timestamp_set_data(ALSATimerEventDataTimestamp *self,
struct snd_timer_tread *data);
+++ /dev/null
-#!/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.EventDataTick()
-props = (
- 'resolution',
- 'ticks',
-)
-methods = ()
-signals = ()
-
-if not test(target, props, methods, signals):
- exit(ENXIO)
'alsatimer-instance-params',
'alsatimer-instance-status',
'alsatimer-event-data',
- 'alsatimer-event-data-tick',
'alsatimer-event-data-timestamp',
],
'seq': [