]> git.alsa-project.org Git - alsa-gobject.git/commitdiff
timer: enums: rename to ALSATimer.EventType.TICK_TIME and REAL_TIME
authorTakashi Sakamoto <o-takashi@sakamocchi.jp>
Wed, 22 Jun 2022 03:05:26 +0000 (12:05 +0900)
committer坂本 貴史 <o-takashi@sakamocchi.jp>
Wed, 22 Jun 2022 03:20:14 +0000 (12:20 +0900)
Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
samples/timer
src/timer/alsatimer-enum-types.h
src/timer/real-time-event.c
src/timer/user-instance.c
tests/alsatimer-enums

index 66acae673e78ae40d71462da43d31daff4de4811..71af177ea1050c05a3f485b3e92e4bf2f018f6e4 100755 (executable)
@@ -13,7 +13,7 @@ instance = ALSATimer.UserInstance.new()
 instance.open(0)
 
 # Choose tstamp type of data for event and register event handler.
-instance.choose_event_type(ALSATimer.EventType.TSTAMP)
+instance.choose_event_type(ALSATimer.EventType.REAL_TIME)
 def handle_real_time_event(instance, event):
     real_time = event.get_time([0, 0])
     print('\nEvent at', real_time)
index 2310280369aa42fc92987e7b94e980091072b070..80be895c743d7e89512f63a637d4d5b3ffee4bf6 100644 (file)
@@ -113,14 +113,14 @@ typedef enum
 
 /**
  * ALSATimerEventType
- * @ALSATIMER_EVENT_TYPE_TICK:      The data for tick event.
- * @ALSATIMER_EVENT_TYPE_TSTAMP:    The data for timestamp event.
+ * @ALSATIMER_EVENT_TYPE_TICK_TIME:     Event for tick time.
+ * @ALSATIMER_EVENT_TYPE_REAL_TIME:     Event for real time.
  *
  * A set of enumerations for the type of event.
  */
 typedef enum {
-    ALSATIMER_EVENT_TYPE_TICK,
-    ALSATIMER_EVENT_TYPE_TSTAMP,
+    ALSATIMER_EVENT_TYPE_TICK_TIME,
+    ALSATIMER_EVENT_TYPE_REAL_TIME,
 } ALSATimerEventType;
 
 /**
index 179e7725008acc7cfc4a3757007d68a02a69fa38..c66cf589a0add1199a7e8488a1696243365f1924 100644 (file)
@@ -43,7 +43,7 @@ void alsatimer_real_time_event_get_event(const ALSATimerRealTimeEvent *self,
  * @real_time: (array fixed-size=2) (inout): The array with two elements for the seconds and
  *             nanoseconds part of timestamp when the instance queues the timestamp event.
  *
- * Get the seconds and nanoseconds part for the timestamp event.
+ * Get the seconds and nanoseconds part for the real time event.
  */
 void alsatimer_real_time_event_get_time(const ALSATimerRealTimeEvent *self,
                                         gint64 *const real_time[2])
index 26d839bc250a2019ec5beea44822df620f567699..0eef521a8858a01bc9f7b7db89e78c56435edd61 100644 (file)
@@ -89,7 +89,7 @@ static void alsatimer_user_instance_class_init(ALSATimerUserInstanceClass *klass
      * @self: A [class@UserInstance].
      * @event: (transfer none): The instance of [struct@TickTimeEvent].
      *
-     * Emitted when tick event occurs.
+     * Emitted when event occurs to notify tick time.
      */
     timer_user_instance_sigs[TIMER_USER_INSTANCE_SIG_HANDLE_TICK_TIME_EVENT] =
         g_signal_new("handle-tick-time-event",
@@ -105,7 +105,7 @@ static void alsatimer_user_instance_class_init(ALSATimerUserInstanceClass *klass
      * @self: A [class@UserInstance].
      * @event: (transfer none): The instance of [struct@RealTimeEvent].
      *
-     * Emitted when timestamp event occurs.
+     * Emitted when event occurs to notify real time.
      */
     timer_user_instance_sigs[TIMER_USER_INSTANCE_SIG_HANDLE_REAL_TIME_EVENT] =
         g_signal_new("handle-real-time-event",
@@ -250,9 +250,11 @@ gboolean alsatimer_user_instance_get_protocol_version(ALSATimerUserInstance *sel
  *
  * Choose the type of event data to receive.
  *
- * The call of function is successful just before the instance is not attached yet.
- * [enum@EventType:TICK] is used as a default if the function is not called for
- * [enum@EventType:TSTAMP] explicitly.
+ * The call of function is successful just before call of [method@UserInstance.attach].
+ * [enum@EventType].TICK_TIME is used as a default if the function is not called for
+ * [enum@EventType].REAL_TIME explicitly. When the former is configured, event for tick time is
+ * available for [signal@UserInstance::handle_tick_time_event]. When the latter is configured,
+ * event for real time is available for [signal@UserInstance::handle_real_time_event].
  *
  * The call of function executes `ioctl(2)` system call with `SNDRV_TIMER_IOCTL_TREAD` command
  * for ALSA timer character device.
@@ -556,10 +558,10 @@ static gboolean timer_user_instance_dispatch_src(GSource *gsrc, GSourceFunc cb,
     }
 
     switch (priv->event_type) {
-    case ALSATIMER_EVENT_TYPE_TICK:
+    case ALSATIMER_EVENT_TYPE_TICK_TIME:
         dispatch_tick_time_events(self, src->buf, (size_t)len);
         break;
-    case ALSATIMER_EVENT_TYPE_TSTAMP:
+    case ALSATIMER_EVENT_TYPE_REAL_TIME:
         dispatch_real_time_events(self, src->buf, (size_t)len);
         break;
     default:
index 142a39908bf8f5f949a34d43a37b8d44dcd49028..487ad87afbbcb2864477d2d4e73df4c6cb549b2b 100644 (file)
@@ -54,8 +54,8 @@ tstamp_event_types = (
 )
 
 event_types = (
-    'TICK',
-    'TSTAMP',
+    'TICK_TIME',
+    'REAL_TIME',
 )
 
 user_instance_error_types = (