]> git.alsa-project.org Git - alsa-gobject.git/commitdiff
timer: user_instance: add an API to stop event emission
authorTakashi Sakamoto <o-takashi@sakamocchi.jp>
Sun, 9 Feb 2020 03:20:53 +0000 (12:20 +0900)
committer坂本 貴史 <o-takashi@sakamocchi.jp>
Tue, 11 Feb 2020 04:28:18 +0000 (13:28 +0900)
Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
src/timer/alsatimer.map
src/timer/user-instance.c
src/timer/user-instance.h
tests/alsatimer-user-instance

index d34158cb54807be7ad7ad8a013d25c77f664aa2c..d50a33fb50416afbdc73b97600ecc78b573fd170 100644 (file)
@@ -38,6 +38,7 @@ ALSA_GOBJECT_0_0_0 {
     "alsatimer_user_instance_get_status";
     "alsatimer_user_instance_create_source";
     "alsatimer_user_instance_start";
+    "alsatimer_user_instance_stop";
 
     "alsatimer_instance_info_get_type";
 
index 2d6d22953ea1ca0bb2d3eff502ec30dd8e11ba57..d9886d9f6ddb2c2789a55632bf052242f52548cd 100644 (file)
@@ -462,3 +462,21 @@ void alsatimer_user_instance_start(ALSATimerUserInstance *self, GError **error)
     if (ioctl(priv->fd, SNDRV_TIMER_IOCTL_START) < 0)
         generate_error(error, errno);
 }
+
+/**
+ * alsatimer_user_instance_stop:
+ * @self: A #ALSATimerUserInstance.
+ * @error: A #GError.
+ *
+ * Stop event emission.
+ */
+void alsatimer_user_instance_stop(ALSATimerUserInstance *self, GError **error)
+{
+    ALSATimerUserInstancePrivate *priv;
+
+    g_return_if_fail(ALSATIMER_IS_USER_INSTANCE(self));
+    priv = alsatimer_user_instance_get_instance_private(self);
+
+    if (ioctl(priv->fd, SNDRV_TIMER_IOCTL_STOP) < 0)
+        generate_error(error, errno);
+}
index ba91e2d143ce95af3a4b26a4432fd2b71663be38..c4e4da7ef7c0210c0b1d7878bcff2a45ea8bf263 100644 (file)
@@ -104,6 +104,8 @@ void alsatimer_user_instance_create_source(ALSATimerUserInstance *self,
 
 void alsatimer_user_instance_start(ALSATimerUserInstance *self, GError **error);
 
+void alsatimer_user_instance_stop(ALSATimerUserInstance *self, GError **error);
+
 G_END_DECLS
 
 #endif
index f86cf55244533b34f52ca23c917a7ce403b24cdd..acc04c44d274e477f249823e076f85118b4a5155 100644 (file)
@@ -23,6 +23,7 @@ methods = (
     'do_handle_event',
     'do_handle_disconnection',
     'start',
+    'stop',
 )
 signals = (
     'handle-event',