}
}
+static void ad_clear_uuids(void)
+{
+ g_strfreev(ad.uuids);
+ ad.uuids = NULL;
+ ad.uuids_len = 0;
+}
+
void ad_advertise_uuids(DBusConnection *conn, int argc, char *argv[])
{
if (argc < 2 || !strlen(argv[1])) {
return;
}
- g_strfreev(ad.uuids);
- ad.uuids = NULL;
- ad.uuids_len = 0;
+ ad_clear_uuids();
ad.uuids = g_strdupv(&argv[1]);
if (!ad.uuids) {
g_dbus_emit_property_changed(conn, AD_PATH, AD_IFACE, "ServiceUUIDs");
}
+void ad_disable_uuids(DBusConnection *conn)
+{
+ if (!ad.uuids)
+ return;
+
+ ad_clear_uuids();
+ g_dbus_emit_property_changed(conn, AD_PATH, AD_IFACE, "ServiceUUIDs");
+}
+
static void ad_clear_service(void)
{
g_free(ad.service.uuid);
g_dbus_emit_property_changed(conn, AD_PATH, AD_IFACE, "ServiceData");
}
+void ad_disable_service(DBusConnection *conn)
+{
+ if (!ad.service.uuid)
+ return;
+
+ ad_clear_service();
+ g_dbus_emit_property_changed(conn, AD_PATH, AD_IFACE, "ServiceData");
+}
+
static void ad_clear_manufacturer(void)
{
memset(&ad.manufacturer, 0, sizeof(ad.manufacturer));
"ManufacturerData");
}
+void ad_disable_manufacturer(DBusConnection *conn)
+{
+ if (!ad.manufacturer.id && !ad.manufacturer.data.len)
+ return;
+
+ ad_clear_manufacturer();
+ g_dbus_emit_property_changed(conn, AD_PATH, AD_IFACE,
+ "ManufacturerData");
+}
+
void ad_advertise_tx_power(DBusConnection *conn, dbus_bool_t *value)
{
if (!value) {
void ad_unregister(DBusConnection *conn, GDBusProxy *manager);
void ad_advertise_uuids(DBusConnection *conn, int argc, char *argv[]);
+void ad_disable_uuids(DBusConnection *conn);
void ad_advertise_service(DBusConnection *conn, int argc, char *argv[]);
+void ad_disable_service(DBusConnection *conn);
void ad_advertise_manufacturer(DBusConnection *conn, int argc, char *argv[]);
+void ad_disable_manufacturer(DBusConnection *conn);
void ad_advertise_tx_power(DBusConnection *conn, dbus_bool_t *value);
void ad_advertise_name(DBusConnection *conn, bool value);
void ad_advertise_appearance(DBusConnection *conn, bool value);