ia = condev->adapter;
+#ifndef TIZEN_FEATURE_BLUEZ_MODIFY
if (condev->callback_id && condev->device)
btd_device_remove_attio_callback(condev->device,
condev->callback_id);
+#endif
if (condev->device)
btd_device_unref(condev->device);
condev = g_new0(struct connected_device, 1);
condev->device = btd_device_ref(device);
condev->adapter = ia;
- condev->callback_id = btd_device_add_attio_callback(device,
- NULL, imm_alert_disc_cb, condev);
ia->connected_devices = g_slist_append(ia->connected_devices,
condev);
DBG("added connected dev %p", device);
la = condev->adapter;
+#ifndef TIZEN_FEATURE_BLUEZ_MODIFY
if (condev->callback_id && condev->device)
btd_device_remove_attio_callback(condev->device,
condev->callback_id);
+#endif
if (condev->local_disc_id && condev->device)
device_remove_disconnect_watch(condev->device,
g_free(condev);
}
+#ifndef TIZEN_FEATURE_BLUEZ_MODIFY
static void link_loss_disc_cb(gpointer user_data)
{
struct connected_device *condev = user_data;
/* we are open for more changes now */
link_loss_remove_condev(condev);
}
+#endif
static void link_loss_local_disc(struct btd_device *device,
gboolean removal, void *user_data)
condev = g_new0(struct connected_device, 1);
condev->device = btd_device_ref(device);
condev->adapter = la;
- condev->callback_id = btd_device_add_attio_callback(device,
- NULL, link_loss_disc_cb, condev);
condev->local_disc_id = device_add_disconnect_watch(device,
link_loss_local_disc, condev, NULL);
.findme = TRUE,
};
+#ifdef TIZEN_FEATURE_BLUEZ_MODIFY
+static int pxp_profile_accept(struct btd_service *service)
+{
+ struct btd_device *device = btd_service_get_device(service);
+ GAttrib *attrib = btd_device_get_attrib(device);
+
+ pxp_monitor_connected(attrib, device);
+
+ btd_service_connecting_complete(service, 0);
+
+ return 0;
+}
+
+static int pxp_profile_disconnected(struct btd_service *service)
+{
+ struct btd_device *device = btd_service_get_device(service);
+
+ pxp_monitor_disconnected(device);
+
+ btd_service_disconnecting_complete(service, 0);
+
+ return 0;
+}
+#endif
+
static int monitor_linkloss_probe(struct btd_service *service)
{
struct btd_device *device = btd_service_get_device(service);
.remote_uuid = LINK_LOSS_UUID,
.device_probe = monitor_linkloss_probe,
.device_remove = monitor_linkloss_remove,
+#ifdef TIZEN_FEATURE_BLUEZ_MODIFY
+ .accept = pxp_profile_accept,
+ .disconnect = pxp_profile_disconnected,
+#endif
};
static struct btd_profile pxp_monitor_immediate_profile = {
.remote_uuid = IMMEDIATE_ALERT_UUID,
.device_probe = monitor_immediate_probe,
.device_remove = monitor_immediate_remove,
+#ifdef TIZEN_FEATURE_BLUEZ_MODIFY
+ .accept = pxp_profile_accept,
+ .disconnect = pxp_profile_disconnected,
+#endif
};
static struct btd_profile pxp_monitor_txpower_profile = {
.remote_uuid = TX_POWER_UUID,
.device_probe = monitor_txpower_probe,
.device_remove = monitor_txpower_remove,
+#ifdef TIZEN_FEATURE_BLUEZ_MODIFY
+ .accept = pxp_profile_accept,
+ .disconnect = pxp_profile_disconnected,
+#endif
};
static struct btd_profile pxp_reporter_profile = {
&uuid, immediate_handle_cb, monitor);
}
+#ifndef TIZEN_FEATURE_BLUEZ_MODIFY
static void attio_connected_cb(GAttrib *attrib, gpointer user_data)
{
struct monitor *monitor = user_data;
g_dbus_emit_property_changed(btd_get_dbus_connection(), path,
PROXIMITY_INTERFACE, "ImmediateAlertLevel");
}
+#else
+void pxp_monitor_connected(GAttrib *attrib, struct btd_device *device)
+{
+ struct monitor *monitor;
+
+ monitor = find_monitor(device);
+ if (monitor == NULL)
+ return;
+
+ monitor->attrib = g_attrib_ref(attrib);
+
+ if (monitor->enabled.linkloss)
+ write_alert_level(monitor);
+
+ if (monitor->enabled.pathloss)
+ read_tx_power(monitor);
+
+ if (monitor->immediatehandle == 0) {
+ if(monitor->enabled.pathloss || monitor->enabled.findme)
+ discover_immediate_handle(monitor);
+ } else if (monitor->fallbacklevel)
+ write_immediate_alert(monitor);
+}
+
+void pxp_monitor_disconnected(struct btd_device *device)
+{
+ struct monitor *monitor;
+ const char *path = device_get_path(device);
+
+ monitor = find_monitor(device);
+ if (monitor == NULL)
+ return;
+
+ g_attrib_unref(monitor->attrib);
+ monitor->attrib = NULL;
+
+ if (monitor->immediateto == 0)
+ return;
+
+ g_source_remove(monitor->immediateto);
+ monitor->immediateto = 0;
+
+ if (g_strcmp0(monitor->immediatelevel, "none") == 0)
+ return;
+
+ g_free(monitor->immediatelevel);
+ monitor->immediatelevel = g_strdup("none");
+
+ g_dbus_emit_property_changed(btd_get_dbus_connection(), path,
+ PROXIMITY_INTERFACE, "ImmediateAlertLevel");
+}
+#endif
static gboolean level_is_valid(const char *level)
{
* If enabled, Path Loss always registers a connection callback
* when the Proximity Monitor starts.
*/
+#ifndef TIZEN_FEATURE_BLUEZ_MODIFY
if (monitor->attioid == 0)
monitor->attioid = btd_device_add_attio_callback(device,
attio_connected_cb,
attio_disconnected_cb,
monitor);
else if (monitor->attrib)
+#else
+ if (monitor->attrib)
+#endif
write_immediate_alert(monitor);
done:
if (!monitor->enabled.linkloss && !monitor->enabled.pathloss)
return;
+#ifndef TIZEN_FEATURE_BLUEZ_MODIFY
if (monitor->attioid != 0)
return;
attio_connected_cb,
attio_disconnected_cb,
monitor);
+#endif
}
int monitor_register_linkloss(struct btd_device *device,
if (monitor->linkloss != NULL)
return;
+#ifndef TIZEN_FEATURE_BLUEZ_MODIFY
if (monitor->attioid != 0) {
btd_device_remove_attio_callback(device, monitor->attioid);
monitor->attioid = 0;
}
+#endif
if (monitor->attrib != NULL) {
g_attrib_unref(monitor->attrib);
struct enabled *enabled,
struct gatt_primary *immediate);
+#ifdef TIZEN_FEATURE_BLUEZ_MODIFY
+void pxp_monitor_connected(GAttrib *attrib, struct btd_device *device);
+void pxp_monitor_disconnected(struct btd_device *device);
+#endif
+
void monitor_unregister_linkloss(struct btd_device *device);
void monitor_unregister_txpower(struct btd_device *device);
void monitor_unregister_immediate(struct btd_device *device);
update_gatt_uuids(req, device->primaries, services);
#endif
+#ifndef TIZEN_FEATURE_BLUEZ_MODIFY
+ /* do not delete existing primary list,
+ * just append the new primary uuids,
+ * the list will be modifed when service changed
+ * indication is received during connection */
g_slist_free_full(device->primaries, g_free);
device->primaries = NULL;
+#endif
device_register_primaries(device, services, -1);
return;
}
+#ifndef TIZEN_FEATURE_BLUEZ_MODIFY
+ /* Register the services after setting the client is ready
+ * and exporting all the services and characteristics paths.
+ */
register_gatt_services(device);
+#endif
btd_gatt_client_ready(device->client_dbus);
+#ifdef TIZEN_FEATURE_BLUEZ_MODIFY
+ register_gatt_services(device);
+#endif
device_svc_resolved(device, device->bdaddr_type, 0);