return result;
}
+int _bt_get_connectable(void)
+{
+ int result;
+
+ BT_DBG("+");
+
+ result = adapter_get_connectable();
+ if (result != OAL_STATUS_SUCCESS) {
+ BT_ERR("adapter_get_connectable failed: %d", result);
+ result = BLUETOOTH_ERROR_INTERNAL;
+ } else
+ result = BLUETOOTH_ERROR_NONE;
+
+ BT_DBG("-");
+ return result;
+}
+
int _bt_is_service_used(void)
{
int result;
BT_INFO("Adapter discoverable mode:"
" BLUETOOTH_DISCOVERABLE_MODE_NON_CONNECTABLE");
- _bt_send_event(BT_ADAPTER_EVENT,
- BLUETOOTH_EVENT_CONNECTABLE_CHANGED,
- g_variant_new("(b)", connectable));
- _bt_send_event(BT_ADAPTER_EVENT,
- BLUETOOTH_EVENT_DISCOVERABLE_MODE_CHANGED,
- g_variant_new("(in)", result, mode));
+ if (__bt_is_service_request_present(BT_GET_CONNECTABLE)) {
+ __bt_adapter_handle_pending_requests(BT_GET_CONNECTABLE,
+ (void *) &connectable, sizeof(gboolean));
+
+ } else {
+ _bt_send_event(BT_ADAPTER_EVENT,
+ BLUETOOTH_EVENT_CONNECTABLE_CHANGED,
+ g_variant_new("(b)", connectable));
+
+ _bt_send_event(BT_ADAPTER_EVENT,
+ BLUETOOTH_EVENT_DISCOVERABLE_MODE_CHANGED,
+ g_variant_new("(in)", result, mode));
+ }
break;
}
case OAL_EVENT_ADAPTER_MODE_CONNECTABLE: {
BT_INFO("Adapter discoverable mode:"
" BLUETOOTH_DISCOVERABLE_MODE_CONNECTABLE");
- _bt_send_event(BT_ADAPTER_EVENT,
- BLUETOOTH_EVENT_CONNECTABLE_CHANGED,
- g_variant_new("(b)", connectable));
- mode = BLUETOOTH_DISCOVERABLE_MODE_CONNECTABLE;
- _bt_send_event(BT_ADAPTER_EVENT,
- BLUETOOTH_EVENT_DISCOVERABLE_MODE_CHANGED,
- g_variant_new("(in)", result, mode));
+ if (__bt_is_service_request_present(BT_GET_CONNECTABLE)) {
+ __bt_adapter_handle_pending_requests(BT_GET_CONNECTABLE,
+ (void *) &connectable, sizeof(gboolean));
+
+ } else {
+
+ _bt_send_event(BT_ADAPTER_EVENT,
+ BLUETOOTH_EVENT_CONNECTABLE_CHANGED,
+ g_variant_new("(b)", connectable));
+
+ mode = BLUETOOTH_DISCOVERABLE_MODE_CONNECTABLE;
+ _bt_send_event(BT_ADAPTER_EVENT,
+ BLUETOOTH_EVENT_DISCOVERABLE_MODE_CHANGED,
+ g_variant_new("(in)", result, mode));
+ }
break;
}
case OAL_EVENT_ADAPTER_MODE_DISCOVERABLE: {
int mode;
+ gboolean connectable = TRUE;
BT_INFO("Adapter discoverable mode:"
" BLUETOOTH_DISCOVERABLE_MODE_GENERAL_DISCOVERABLE");
- /* Send event to application */
- mode = BLUETOOTH_DISCOVERABLE_MODE_GENERAL_DISCOVERABLE;
- _bt_send_event(BT_ADAPTER_EVENT,
- BLUETOOTH_EVENT_DISCOVERABLE_MODE_CHANGED,
- g_variant_new("(in)", result, mode));
+ if (__bt_is_service_request_present(BT_GET_CONNECTABLE)) {
+ __bt_adapter_handle_pending_requests(BT_GET_CONNECTABLE,
+ (void *) &connectable, sizeof(gboolean));
+ } else {
+ /* Send event to application */
+ mode = BLUETOOTH_DISCOVERABLE_MODE_GENERAL_DISCOVERABLE;
+ _bt_send_event(BT_ADAPTER_EVENT,
+ BLUETOOTH_EVENT_DISCOVERABLE_MODE_CHANGED,
+ g_variant_new("(in)", result, mode));
+ }
break;
}
case OAL_EVENT_ADAPTER_MODE_DISCOVERABLE_TIMEOUT: {
g_array_append_vals(out_param, &done, sizeof(gboolean));
break;
}
+ case BT_GET_CONNECTABLE:
case BT_GET_LOCAL_NAME:
case BT_GET_LOCAL_ADDRESS:
case BT_GET_LOCAL_VERSION:
|| service_function == BT_GATT_SERVER_DELETE_SERVICE
|| service_function == BT_START_LE_DISCOVERY
|| service_function == BT_STOP_LE_DISCOVERY
+ || service_function == BT_GET_CONNECTABLE
#ifdef TIZEN_GATT_CLIENT
|| service_function == BT_GATT_CLIENT_REGISTER
|| service_function == BT_GATT_GET_PRIMARY_SERVICES
g_array_append_vals(*out_param1, &is_connectable, sizeof(gboolean));
break;
}
+ case BT_GET_CONNECTABLE: {
+ result = _bt_get_connectable();
+
+ /* Save invocation */
+ if (result == BLUETOOTH_ERROR_NONE) {
+ sender = (char*)g_dbus_method_invocation_get_sender(context);
+ _bt_save_invocation_context(context, result, sender,
+ function_name, NULL);
+ }
+ break;
+ }
case BT_SET_CONNECTABLE: {
gboolean is_connectable;
case BT_IS_DISCOVERYING:
case BT_IS_LE_DISCOVERYING:
case BT_IS_CONNECTABLE:
+ case BT_GET_CONNECTABLE:
case BT_GET_BONDED_DEVICES:
case BT_GET_PROFILE_CONNECTED_DEVICES:
case BT_GET_BONDED_DEVICE: