json_object_object_add(jresp, "HFPConnected", jstring);
}
+ if (BD_UUID_PROFILES & filter)
+ {
+ GList *list = BDdevice->uuids;
+
+ if (list)
+ {
+ json_object *jarray = json_object_new_array();
+
+ for (;list;list=list->next)
+ {
+ jstring = json_object_new_string(list->data);
+ json_object_array_add(jarray, jstring);
+ }
+ json_object_object_add(jresp, "UUIDs", jarray);
+ }
+ }
+
return jresp;
}
struct btd_device *BDdevice = tmp->data;
//LOGD("\n%s\t%s\n",BDdevice->bdaddr,BDdevice->name);
- unsigned int filter = BD_ADDER|BD_NAME|BD_PAIRED|BD_ACLCONNECTED|BD_AVCONNECTED|BD_HFPCONNECTED;
+ unsigned int filter = BD_ADDER|BD_NAME|BD_PAIRED|BD_ACLCONNECTED|BD_AVCONNECTED|BD_HFPCONNECTED|BD_UUID_PROFILES;
json_object *jresp = new_json_object_from_device(BDdevice, filter);
*/
void bt_broadcast_device_added(struct btd_device *BDdevice)
{
- unsigned int filter = BD_ADDER|BD_NAME|BD_PAIRED|BD_ACLCONNECTED|BD_AVCONNECTED|BD_HFPCONNECTED;
+ unsigned int filter = BD_ADDER|BD_NAME|BD_PAIRED|BD_ACLCONNECTED|BD_AVCONNECTED|BD_HFPCONNECTED|BD_UUID_PROFILES;
int ret;
json_object *jresp = new_json_object_from_device(BDdevice, filter);
void bt_broadcast_device_properties_change(struct btd_device *BDdevice)
{
- unsigned int filter = BD_ADDER|BD_NAME|BD_PAIRED|BD_ACLCONNECTED|BD_AVCONNECTED|BD_HFPCONNECTED|BD_AVRCP_TITLE|BD_AVRCP_ARTIST|BD_AVRCP_STATUS|BD_AVRCP_DURATION|BD_AVRCP_POSITION|BD_TRANSPORT_STATE|BD_TRANSPORT_VOLUME;
+ unsigned int filter = BD_ADDER|BD_NAME|BD_PAIRED|BD_ACLCONNECTED|BD_AVCONNECTED|BD_HFPCONNECTED|BD_AVRCP_TITLE|BD_AVRCP_ARTIST|BD_AVRCP_STATUS|BD_AVRCP_DURATION|BD_AVRCP_POSITION|BD_TRANSPORT_STATE|BD_TRANSPORT_VOLUME|BD_UUID_PROFILES;
int ret;
json_object *jresp = new_json_object_from_device(BDdevice, filter);
#define BD_AVRCP_POSITION LEFT_SHIFT(16)
#define BD_TRANSPORT_STATE LEFT_SHIFT(17)
#define BD_TRANSPORT_VOLUME LEFT_SHIFT(18)
+#define BD_UUID_PROFILES LEFT_SHIFT(19)
/* -------------- PLUGIN DEFINITIONS ----------------- */
temp->connected = device->connected;
temp->avconnected = device->avconnected;
temp->hfpconnected = device->hfpconnected;
+ temp->uuids = g_list_copy_deep(device->uuids, g_strdup, NULL);
return temp;
}
device->transport_state = NULL;
}
+ if (device->uuids) {
+ D_PRINTF("uuids: xxx\n");
+ g_list_free_full(device->uuids, g_free);
+ device->uuids = NULL;
+ }
+
g_free(device);
}
temp->trusted = device->trusted;
temp->connected = device->connected;
temp->avconnected = device->avconnected;
+ temp->uuids = g_list_copy_deep(device->uuids, g_strdup, NULL);
return temp;
}
gboolean connected;
gboolean avconnected;
gboolean hfpconnected;
+ GList *uuids;
};
typedef struct {
temp->avconnected = device->avconnected;
temp->legacypairing = device->legacypairing;
temp->rssi = device->rssi;
- temp->uuids = g_variant_ref(device->uuids);
+ temp->uuids = g_list_copy(device->uuids);
return temp;
}
if (device->uuids){
D_PRINTF("uuids xxx\n");
- g_variant_unref(device->uuids);
+ g_list_free_full(device->uuids, g_free);
device->uuids = NULL;
}
device->rssi = value_n;
}else if (0==g_strcmp0(key,"UUIDs")) {
- //g_print ("type '%s'\n", g_variant_get_type_string (subValue));
- if (device->uuids)
- g_variant_unref(device->uuids);
- device->uuids = g_variant_new_variant(subValue);
+ GVariantIter iter;
+ gchar *val;
+ //g_print ("type '%s'\n", g_variant_get_type_string (subValue));
+ if (device->uuids) {
+ g_list_free_full(device->uuids, g_free);
+ }
+
+ g_variant_iter_init (&iter, subValue);
+ while (g_variant_iter_next (&iter, "s", &val))
+ {
+ device->uuids = g_list_append(device->uuids, g_strdup(val));
+ }
}
}
gboolean avconnected;
gboolean legacypairing;
gint16 rssi;
- GVariant *uuids;
+ GList *uuids;
};
typedef struct {