From 069090e1d9f9a88c31a5a2382a0f2880eab1e4f9 Mon Sep 17 00:00:00 2001 From: Jaroslav Kysela Date: Thu, 7 Aug 2014 17:45:19 +0200 Subject: [PATCH] dbus: SAT>IP - add SAT>IP tuner notifications --- src/input/mpegts/satip/satip.c | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/src/input/mpegts/satip/satip.c b/src/input/mpegts/satip/satip.c index 4ad23648..7c32efee 100644 --- a/src/input/mpegts/satip/satip.c +++ b/src/input/mpegts/satip/satip.c @@ -24,6 +24,7 @@ #include "upnp.h" #include "settings.h" #include "satip_private.h" +#include "dbus.h" #include #include @@ -35,6 +36,25 @@ static void satip_device_discovery_start( void ); +/* + * + */ + +static void +satip_device_dbus_notify( satip_device_t *sd, const char *sig_name ) +{ +#if ENABLE_DBUS_1 + char buf[256]; + + htsmsg_t *msg = htsmsg_create_list(); + htsmsg_add_str(msg, NULL, sd->sd_info.addr); + htsmsg_add_str(msg, NULL, sd->sd_info.location); + htsmsg_add_str(msg, NULL, sd->sd_info.server); + snprintf(buf, sizeof(buf), "/input/mpegts/satip/%s", idnode_uuid_as_str(&sd->th_id)); + dbus_emit_signal(buf, sig_name, msg); +#endif +} + /* * SAT-IP client */ @@ -396,6 +416,8 @@ satip_device_create( satip_device_info_t *info ) htsmsg_destroy(conf); + satip_device_dbus_notify(sd, "start"); + return sd; } @@ -458,6 +480,8 @@ satip_device_destroy( satip_device_t *sd ) while ((lfe = TAILQ_FIRST(&sd->sd_frontends)) != NULL) satip_frontend_delete(lfe); + satip_device_dbus_notify(sd, "stop"); + #define FREEM(x) free(sd->sd_info.x) FREEM(myaddr); FREEM(addr);