#include "bt-service-avrcp.h"
#include "bt-service-avrcp-controller.h"
#include "bt-service-opp-client.h"
-#include "bt-service-map-client.h"
#include "bt-service-obex-server.h"
#include "bt-service-rfcomm-client.h"
#include "bt-service-rfcomm-server.h"
#include "bt-service-dpm.h"
#include "bt-service-agent.h"
#include "bt-service-proximity.h"
-#include "bt-service-tds.h"
-#include "bt-service-otp.h"
static GDBusConnection *bt_service_conn;
static guint owner_id = 0;
" </interface>"
"</node>";
-GDBusNodeInfo *node_info = NULL;
+static gboolean name_acquired = FALSE;
static char *current_sender_playing = NULL;
}
}
- BT_DBG("Service type = %d, fn = %s (0x%x)",
- service_type, _bt_convert_service_function_to_string(service_function),
- service_function);
+ BT_DBG("Service type = %s, fn = %s (0x%x)", __bt_convert_service_type_to_string(service_type),
+ _bt_convert_service_function_to_string(service_function), service_function);
switch (service_type) {
case BT_BLUEZ_SERVICE:
result = __bt_bluez_request(service_function,
GVariant *temp = g_variant_new("(iv)", result, out_var);
g_dbus_method_invocation_return_value(invocation, temp);
-
- g_array_free(out_param1, TRUE);
- out_param1 = NULL;
}
}
- /* TODO: MAP? see the if{}else{} above */
+ g_array_free(out_param1, TRUE);
g_variant_unref(param1);
g_variant_unref(param2);
g_variant_unref(param3);
g_variant_unref(param4);
g_variant_unref(param5);
-// g_free(sender);
FN_END;
return;
fail:
g_variant_unref(param3);
g_variant_unref(param4);
g_variant_unref(param5);
-// g_free(sender);
}
FN_END;
break;
}
case BT_LE_CONN_UPDATE: {
+ char *sender = NULL;
bluetooth_device_address_t local_address = { {0} };
bluetooth_le_connection_param_t parameters = {0};
+ sender = (char *)g_dbus_method_invocation_get_sender(context);
+
__bt_service_get_parameters(in_param1, &local_address,
sizeof(bluetooth_device_address_t));
__bt_service_get_parameters(in_param2, ¶meters,
sizeof(bluetooth_le_connection_param_t));
- result = _bt_le_conn_update(local_address.addr,
+ result = _bt_le_conn_update(sender,
+ local_address.addr,
parameters.interval_min,
parameters.interval_max,
parameters.latency,
break;
}
+ case BT_DISCONNECT_DEVICE: {
+ bluetooth_device_address_t addr = { {0} };
+ char address[BLUETOOTH_ADDRESS_STRING_LENGTH + 1];
+
+ __bt_service_get_parameters(in_param1,
+ &addr, sizeof(bluetooth_device_address_t));
+ _bt_convert_addr_type_to_string(address, addr.addr);
+
+ result = _bt_disconnect_all(address);
+ break;
+ }
case BT_BOND_DEVICE: {
bluetooth_device_address_t address = { {0} };
break;
}
case BT_UPDATE_LE_CONNECTION_MODE: {
+ char *sender = NULL;
bluetooth_device_address_t remote_address = { { 0 } };
bluetooth_le_connection_param_t param = { 0 };
bluetooth_le_connection_mode_t mode = BLUETOOTH_LE_CONNECTION_MODE_BALANCED;
if (result != BLUETOOTH_ERROR_NONE)
break;
- result = _bt_le_conn_update(remote_address.addr,
+ sender = (char *)g_dbus_method_invocation_get_sender(context);
+
+ result = _bt_le_conn_update(sender,
+ remote_address.addr,
param.interval_min,
param.interval_max,
param.latency,
break;
}
- case BT_AUDIO_SELECT_ROLE: {
-
- bluetooth_audio_role_t role;
-
- __bt_service_get_parameters(in_param1,
- &role, sizeof(bluetooth_audio_role_t));
-
- result = _bt_audio_select_role(role);
-
- break;
- }
case BT_OOB_READ_LOCAL_DATA: {
bt_oob_data_t local_oob_data;
}
case BT_OOB_ADD_REMOTE_DATA: {
bluetooth_device_address_t address = { {0} };
- unsigned short address_type;
bt_oob_data_t remote_oob_data;
__bt_service_get_parameters(in_param1,
&address, sizeof(bluetooth_device_address_t));
__bt_service_get_parameters(in_param2,
- &address_type, sizeof(unsigned short));
- __bt_service_get_parameters(in_param3,
&remote_oob_data, sizeof(bt_oob_data_t));
- result = _bt_oob_add_remote_data(&address, address_type, &remote_oob_data);
+ result = _bt_oob_add_remote_data(&address, &remote_oob_data);
break;
}
meta_data.number = data.number;
meta_data.duration = (int64_t) data.duration;
+ if (meta_data.title)
+ BT_INFO("title [%s]", meta_data.title);
+ if (meta_data.artist)
+ BT_INFO("artist [%s]", meta_data.artist);
+ if (meta_data.album)
+ BT_INFO("album [%s]", meta_data.album);
+ if (meta_data.genre)
+ BT_INFO("genre [%s]", meta_data.genre);
+ BT_INFO("total_tracks[%d], number[%d], duration[%d]",
+ meta_data.total_tracks, meta_data.number, meta_data.duration);
+
result = _bt_avrcp_set_track_info(&meta_data);
g_free((gpointer)meta_data.title);
case BT_HID_DEVICE_SEND_REPLY_TO_REPORT:
/* Just call to check the privilege */
break;
+#ifndef GATT_NO_RELAY
+ case BT_GATT_WATCH_CHARACTERISTIC: {
+ char *sender = NULL;
+
+ sender = (char *)g_dbus_method_invocation_get_sender(context);
+
+ result = _bt_insert_gatt_client_sender(sender);
+
+ break;
+ }
+ case BT_GATT_UNWATCH_CHARACTERISTIC: {
+ char *sender = NULL;
+
+ sender = (char *)g_dbus_method_invocation_get_sender(context);
+
+ result = _bt_delete_gatt_client_sender(sender);
+
+ break;
+ }
+#endif
case BT_LE_IPSP_INIT:
result = _bt_initialize_ipsp();
break;
break;
}
case BT_DPM_GET_ALLOW_BT_MODE: {
- int value = DPM_BT_ERROR;
+ dpm_bt_allow_t value = DPM_BT_ERROR;
- result = _bt_dpm_get_allow_bluetooth_mode(&value);
+ value = _bt_dpm_get_allow_bluetooth_mode();
+ result = DPM_RESULT_SUCCESS;
g_array_append_vals(*out_param1, &value, sizeof(int));
+
break;
}
case BT_DPM_SET_DEVICE_RESTRITION: {
- dpm_status_t value = DPM_STATUS_ERROR;
+ dpm_status_t value = DPM_BT_ERROR;
__bt_service_get_parameters(in_param1, &value,
sizeof(int));
break;
}
case BT_DPM_GET_DEVICE_RESTRITION: {
- int value = DPM_STATUS_ERROR;
+ dpm_status_t value = DPM_BT_ERROR;
- result = _bt_dpm_is_bluetooth_device_restriction_active(&value);
+ value = _bt_dpm_is_bluetooth_device_restriction_active();
+ result = DPM_RESULT_SUCCESS;
g_array_append_vals(*out_param1, &value, sizeof(int));
+
break;
}
case BT_DPM_SET_UUID_RESTRITION: {
- dpm_status_t value = DPM_STATUS_ERROR;
+ dpm_status_t value = DPM_BT_ERROR;
__bt_service_get_parameters(in_param1, &value,
sizeof(int));
break;
}
case BT_DPM_GET_UUID_RESTRITION: {
- int value = DPM_STATUS_ERROR;
+ dpm_status_t value = DPM_BT_ERROR;
- result = _bt_dpm_is_bluetooth_uuid_restriction_active(&value);
+ value = _bt_dpm_is_bluetooth_uuid_restriction_active();
+ result = DPM_RESULT_SUCCESS;
g_array_append_vals(*out_param1, &value, sizeof(int));
+
break;
}
case BT_DPM_ADD_DEVICES_BLACKLIST: {
break;
}
case BT_DPM_SET_ALLOW_OUTGOING_CALL: {
- dpm_status_t value = DPM_STATUS_ERROR;
+ dpm_status_t value = DPM_BT_ERROR;
__bt_service_get_parameters(in_param1, &value,
sizeof(int));
break;
}
case BT_DPM_GET_ALLOW_OUTGOING_CALL: {
- int value = DPM_STATUS_ERROR;
+ dpm_status_t value = DPM_BT_ERROR;
- result = _bt_dpm_get_allow_bluetooth_outgoing_call(&value);
+ value = _bt_dpm_get_allow_bluetooth_outgoing_call();
+ result = DPM_RESULT_SUCCESS;
g_array_append_vals(*out_param1, &value, sizeof(int));
+
break;
}
case BT_DPM_SET_PAIRING_STATE: {
- dpm_status_t value = DPM_STATUS_ERROR;
+ dpm_status_t value = DPM_BT_ERROR;
__bt_service_get_parameters(in_param1, &value,
sizeof(int));
break;
}
case BT_DPM_GET_PAIRING_STATE: {
- int value = DPM_STATUS_ERROR;
+ dpm_status_t value = DPM_BT_ERROR;
- result = _bt_dpm_get_bluetooth_pairing_state(&value);
+ value = _bt_dpm_get_bluetooth_pairing_state();
+ result = DPM_RESULT_SUCCESS;
g_array_append_vals(*out_param1, &value, sizeof(int));
+
break;
}
case BT_DPM_SET_PROFILE_STATE: {
- int value = DPM_STATUS_ERROR;
- int profile = DPM_PROFILE_NONE;
+ dpm_status_t value = DPM_BT_ERROR;
+ dpm_profile_t profile = DPM_PROFILE_NONE;
__bt_service_get_parameters(in_param1, &profile,
sizeof(int));
break;
}
case BT_DPM_GET_PROFILE_STATE: {
- int value = DPM_STATUS_ERROR;
- int profile = DPM_PROFILE_NONE;
+ dpm_status_t value = DPM_BT_ERROR;
+ dpm_profile_t profile = DPM_PROFILE_NONE;
- __bt_service_get_parameters(in_param1, &profile,
+ __bt_service_get_parameters(in_param2, &profile,
sizeof(int));
- result = _bt_dpm_get_bluetooth_profile_state(profile, &value);
+ value = _bt_dpm_get_bluetooth_profile_state(profile);
+ result = DPM_RESULT_SUCCESS;
g_array_append_vals(*out_param1, &value, sizeof(int));
+
break;
}
case BT_DPM_SET_DESKROP_CONNECTIVITY_STATE: {
- int value = DPM_BT_ERROR;
+ dpm_status_t value = DPM_BT_ERROR;
__bt_service_get_parameters(in_param1, &value,
sizeof(int));
break;
}
case BT_DPM_GET_DESKROP_CONNECTIVITY_STATE: {
- int value = DPM_STATUS_ERROR;
+ dpm_status_t value = DPM_BT_ERROR;
- result = _bt_dpm_get_bluetooth_desktop_connectivity_state(&value);
+ value = _bt_dpm_get_bluetooth_desktop_connectivity_state();
+ result = DPM_RESULT_SUCCESS;
g_array_append_vals(*out_param1, &value, sizeof(int));
+
break;
}
case BT_DPM_SET_DISCOVERABLE_STATE: {
- int value = DPM_STATUS_ERROR;
+ dpm_status_t value = DPM_BT_ERROR;
__bt_service_get_parameters(in_param1, &value,
sizeof(int));
break;
}
case BT_DPM_GET_DISCOVERABLE_STATE: {
- int value = DPM_STATUS_ERROR;
+ dpm_status_t value = DPM_BT_ERROR;
- result = _bt_dpm_get_bluetooth_discoverable_state(&value);
+ value = _bt_dpm_get_bluetooth_discoverable_state();
+ result = DPM_RESULT_SUCCESS;
g_array_append_vals(*out_param1, &value, sizeof(int));
+
break;
}
case BT_DPM_SET_LIMITED_DISCOVERABLE_STATE: {
- int value = DPM_STATUS_ERROR;
+ dpm_status_t value = DPM_BT_ERROR;
__bt_service_get_parameters(in_param1, &value,
sizeof(int));
break;
}
case BT_DPM_GET_LIMITED_DISCOVERABLE_STATE: {
- int value = DPM_STATUS_ERROR;
+ dpm_status_t value = DPM_BT_ERROR;
- result = _bt_dpm_get_bluetooth_limited_discoverable_state(&value);
+ value = _bt_dpm_get_bluetooth_limited_discoverable_state();
+ result = DPM_RESULT_SUCCESS;
g_array_append_vals(*out_param1, &value, sizeof(int));
+
break;
}
case BT_DPM_SET_DATA_TRANSFER_STATE: {
- int value = DPM_STATUS_ERROR;
+ dpm_status_t value = DPM_BT_ERROR;
__bt_service_get_parameters(in_param1, &value,
sizeof(int));
break;
}
case BT_DPM_GET_DATA_TRANSFER_STATE: {
- int value = DPM_STATUS_ERROR;
+ dpm_status_t value = DPM_BT_ERROR;
- result = _bt_dpm_get_allow_bluetooth_data_transfer_state(&value);
+ value = _bt_dpm_get_allow_bluetooth_data_transfer_state();
+ result = DPM_RESULT_SUCCESS;
g_array_append_vals(*out_param1, &value, sizeof(int));
+
break;
}
- case BT_PXP_MONITOR_SET_PROPERTY: {
+ case BT_PXP_SET_PROPERTY: {
bluetooth_device_address_t address = { {0} };
unsigned int property = 0;
unsigned int value = 0;
__bt_service_get_parameters(in_param3,
&value, sizeof(int));
- result = _bt_proximity_monitor_set_property(&address, property, value);
+ result = bt_set_proximity_property(&address, property, value);
break;
}
- case BT_PXP_MONITOR_GET_PROPERTY: {
+ case BT_PXP_GET_PROPERTY: {
bluetooth_device_address_t address = { {0} };
unsigned int property = 0;
int value = 0;
__bt_service_get_parameters(in_param2,
&property, sizeof(unsigned int));
- result = _bt_proximity_monitor_get_property(&address, property, &value);
+ result = bt_get_proximity_property(&address, property, &value);
if (result == BLUETOOTH_ERROR_NONE) {
g_array_append_vals(*out_param1, &value,
sizeof(int));
}
break;
}
- case BT_PXP_MONITOR_GET_SUPPORTED_SERIVCES: {
+ case BT_PXP_GET_SUPPORTED_SERIVCES: {
bluetooth_device_address_t address = { {0} };
unsigned int property = 0;
__bt_service_get_parameters(in_param1,
&address, sizeof(bluetooth_device_address_t));
- result = _bt_proximity_monitor_get_supported_services(&address, &property);
+ result = bt_get_proximity_supported_services(&address, &property);
if (result == BLUETOOTH_ERROR_NONE) {
g_array_append_vals(*out_param1, &property,
sizeof(int));
}
break;
}
- case BT_PXP_REPORTER_REGISTER: {
- char *sender = NULL;
- sender = (char *)g_dbus_method_invocation_get_sender(context);
- result = _bt_proximity_reporter_register(sender);
- break;
- }
- case BT_PXP_REPORTER_UNREGISTER: {
- char *sender = NULL;
- sender = (char *)g_dbus_method_invocation_get_sender(context);
- result = _bt_proximity_reporter_unregister(sender);
- break;
- }
- case BT_PXP_REPORTER_GET_PROPERTY: {
- bluetooth_device_address_t address = { {0} };
- unsigned int property = 0;
- int value = 0;
-
- __bt_service_get_parameters(in_param1,
- &address, sizeof(bluetooth_device_address_t));
- __bt_service_get_parameters(in_param2,
- &property, sizeof(unsigned int));
-
- result = _bt_proximity_reporter_get_property(&address, property, &value);
- if (result == BLUETOOTH_ERROR_NONE) {
- g_array_append_vals(*out_param1, &value,
- sizeof(int));
- }
- break;
- }
- case BT_TDS_PROVIDER_REGISTER: {
- char *sender = NULL;
-
- sender = (char *)g_dbus_method_invocation_get_sender(context);
- result = _bt_tds_provider_register(sender);
-
- break;
- }
- case BT_TDS_PROVIDER_UNREGISTER: {
- char *sender = NULL;
-
- sender = (char *)g_dbus_method_invocation_get_sender(context);
- result = _bt_tds_provider_unregister(sender);
-
- break;
- }
- case BT_TDS_PROVIDER_SET_MANUF_DATA: {
- char *sender = NULL;
- unsigned int length = 0;
- bluetooth_advertising_data_t manuf_data;
-
- __bt_service_get_parameters(in_param1,
- &length, sizeof(unsigned int));
- __bt_service_get_parameters(in_param2,
- &manuf_data, sizeof(bluetooth_advertising_data_t));
- sender = (char *)g_dbus_method_invocation_get_sender(context);
-
- result = _bt_tds_provider_set_manuf_data(sender, manuf_data.data, length);
- break;
- }
- case BT_TDS_PROVIDER_CREATE: {
- char *sender = NULL;
- unsigned int tds_handle = 0;
- int transport;
-
- __bt_service_get_parameters(in_param1,
- &tds_handle, sizeof(unsigned int));
- __bt_service_get_parameters(in_param2,
- &transport, sizeof(int));
- sender = (char *)g_dbus_method_invocation_get_sender(context);
- result = _bt_tds_provider_transport_create(sender, transport, tds_handle);
-
- break;
- }
- case BT_TDS_PROVIDER_DESTROY: {
- char *sender = NULL;
- unsigned int tds_handle = 0;
-
- __bt_service_get_parameters(in_param1,
- &tds_handle, sizeof(unsigned int));
- sender = (char *)g_dbus_method_invocation_get_sender(context);
- result = _bt_tds_provider_transport_remove(sender, tds_handle);
-
- break;
- }
- case BT_TDS_PROVIDER_SET_TRANSPORT_DATA: {
- char *sender = NULL;
- unsigned int tds_handle = 0;
- int transport_state = 0;
- bluetooth_tds_data_t tds_data;
-
- __bt_service_get_parameters(in_param1,
- &tds_handle, sizeof(unsigned int));
- __bt_service_get_parameters(in_param2,
- &transport_state, sizeof(int));
- __bt_service_get_parameters(in_param3,
- &tds_data, sizeof(bluetooth_tds_data_t));
- sender = (char *)g_dbus_method_invocation_get_sender(context);
-
- result = _bt_tds_provider_set_transport_data(sender, tds_handle,
- transport_state, tds_data.data, tds_data.length);
- break;
- }
- case BT_TDS_SEND_ACTIVATION_RESPONSE: {
- bluetooth_device_address_t address = { {0} };
- bluetooth_tds_data_t tds_data;
- char *sender = NULL;
- unsigned int tds_handle = 0;
- int response;
-
- __bt_service_get_parameters(in_param1,
- &tds_handle, sizeof(unsigned int));
- __bt_service_get_parameters(in_param2,
- &response, sizeof(int));
- __bt_service_get_parameters(in_param3, &address,
- sizeof(bluetooth_device_address_t));
- __bt_service_get_parameters(in_param4,
- &tds_data, sizeof(bluetooth_tds_data_t));
- sender = (char *)g_dbus_method_invocation_get_sender(context);
-
- result = _bt_tds_provider_send_activation_response(sender, tds_handle,
- &address, response, tds_data.data, tds_data.length);
- break;
- }
- case BT_TDS_READ_TRANSPORT_DATA: {
- char *handle;
- char *data = NULL;
- guint data_len = 0;
-
- char *sender = NULL;
- sender = (char *)g_dbus_method_invocation_get_sender(context);
-
- bluetooth_device_address_t address = { {0} };
- __bt_service_get_parameters(in_param2,
- &address, sizeof(bluetooth_device_address_t));
-
- data_len = g_variant_get_size(in_param1);
- data = (char *)g_variant_get_data(in_param1);
-
- handle = g_strndup(data, data_len);
- BT_DBG("Read TDS Transport Block [%s]", handle);
-
- result = _bt_tds_read_transport_data(request_id, sender, &address, handle);
-
- if (result != BLUETOOTH_ERROR_NONE) {
- BT_ERR("Reading TDS Transport data failed result [%d]", result);
- g_array_append_vals(*out_param1, &address,
- sizeof(bluetooth_device_address_t));
- }
- if (handle)
- g_free(handle);
- break;
- }
- case BT_TDS_ENABLE_CONTROL_POINT: {
- char *handle;
- char *data = NULL;
- guint data_len = 0;
- bluetooth_device_address_t address = { {0} };
-
- char *sender = NULL;
- sender = (char *)g_dbus_method_invocation_get_sender(context);
-
- data_len = g_variant_get_size(in_param1);
- data = (char *)g_variant_get_data(in_param1);
- __bt_service_get_parameters(in_param2,
- &address, sizeof(bluetooth_device_address_t));
-
- handle = g_strndup(data, data_len);
- BT_DBG("TDS Control point CCCD handle [%s]", handle);
-
- result = _bt_tds_enable_control_point(request_id, sender, &address, handle);
-
- if (result != BLUETOOTH_ERROR_NONE) {
- BT_ERR("Enabling TDS CCCD failed result [%d]", result);
- g_array_append_vals(*out_param1, &address,
- sizeof(bluetooth_device_address_t));
- }
- if (handle)
- g_free(handle);
- break;
- }
- case BT_TDS_ACTIVATE_CONTROL_POINT: {
- char *handle;
- char *data = NULL;
- guint data_len = 0;
- bluetooth_control_point_data_t tds_data;
- char *sender = NULL;
-
- sender = (char *)g_dbus_method_invocation_get_sender(context);
-
- bluetooth_device_address_t address = { {0} };
-
- data_len = g_variant_get_size(in_param1);
- data = (char *)g_variant_get_data(in_param1);
-
- __bt_service_get_parameters(in_param2,
- &address, sizeof(bluetooth_device_address_t));
-
- __bt_service_get_parameters(in_param3,
- &tds_data, sizeof(bluetooth_control_point_data_t));
-
- handle = g_strndup(data, data_len);
- BT_DBG("TDS Activate Control point handle [%s]", handle);
-
- result = _bt_tds_activate_control_point(request_id, sender, &address, handle,
- tds_data.data, tds_data.length);
-
- if (result != BLUETOOTH_ERROR_NONE) {
- BT_ERR("Activating TDS Control Point request failed result [%d]", result);
- g_array_append_vals(*out_param1, &address,
- sizeof(bluetooth_device_address_t));
- }
- if (handle)
- g_free(handle);
- break;
- }
- case BT_OTP_SERVER_INIT: {
- const char *directory;
- directory = (const char *)g_variant_get_data(in_param1);
- result = bt_otp_server_init(request_id, directory);
+ case BT_PXP_REGISTER_REPORTER: {
+ result = bt_register_proximity_reporter();
break;
}
- case BT_OTP_SERVER_DEINIT: {
- result = bt_otp_server_deinit(request_id);
- break;
- }
- case BT_OTP_READ_VALUE: {
- char *handle;
- char *data = NULL;
- guint data_len = 0;
-
- char *sender = NULL;
- sender = (char *)g_dbus_method_invocation_get_sender(context);
-
- data_len = g_variant_get_size(in_param1);
- data = (char *)g_variant_get_data(in_param1);
-
- handle = g_strndup(data, data_len);
- BT_DBG("Read OTP Characteristic Value [%s]", handle);
-
- result = _bt_otp_read_characteristic_value(request_id, sender, handle);
-
- if (result != BLUETOOTH_ERROR_NONE) {
- BT_ERR("Reading OTP Characteristic Value failed result [%d]", result);
- g_array_append_vals(*out_param1, handle, data_len);
- }
- if (handle)
- g_free(handle);
- break;
- }
- case BT_OTP_ENABLE_NOTIFICATION: {
- char *handle;
- char *data = NULL;
- guint data_len = 0;
-
- char *sender = NULL;
- sender = (char *)g_dbus_method_invocation_get_sender(context);
-
- data_len = g_variant_get_size(in_param1);
- data = (char *)g_variant_get_data(in_param1);
-
- handle = g_strndup(data, data_len);
- BT_DBG("OTP Control point CCCD handle [%s]", handle);
-
- result = _bt_otp_enable_notification(request_id, sender, handle);
-
- if (result != BLUETOOTH_ERROR_NONE) {
- BT_ERR("Enabling OTP CCCD failed result [%d]", result);
- g_array_append_vals(*out_param1, handle, data_len);
- }
- if (handle)
- g_free(handle);
- break;
- }
- case BT_OTP_WRITE_VALUE: {
- char *handle;
- char *data = NULL;
- guint data_len = 0;
- char *sender = NULL;
- bluetooth_otp_charc_data_t otp_charc_data;
- sender = (char *)g_dbus_method_invocation_get_sender(context);
-
- data_len = g_variant_get_size(in_param1);
- data = (char *)g_variant_get_data(in_param1);
-
- handle = g_strndup(data, data_len);
- BT_DBG("OTP Write Characteristic value [%s]", handle);
-
- __bt_service_get_parameters(in_param2,
- &otp_charc_data, sizeof(bluetooth_otp_charc_data_t));
-
- int i;
- for (i = 0; i < otp_charc_data.length; i++)
- BT_DBG("Value[%d] = %u", i, otp_charc_data.data[i]);
-
- result = _bt_otp_write_characteristic_value(request_id, sender, handle,
- otp_charc_data.data, otp_charc_data.length);
-
- if (result != BLUETOOTH_ERROR_NONE) {
- BT_ERR("OTP Write Characteristic failed result [%d]", result);
- g_array_append_vals(*out_param1, handle, data_len);
- }
- if (handle)
- g_free(handle);
- break;
- }
- case BT_LE_OTC_CONNECT: {
- BT_DBG("OTC Connect");
- bluetooth_device_address_t address = { {0} };
- __bt_service_get_parameters(in_param1, &address,
- sizeof(bluetooth_device_address_t));
-
- result = _bt_otp_connect_otc(request_id, &address);
- break;
- }
- case BT_LE_OTC_DISCONNECT: {
- BT_DBG("OTC Disconnect");
- bluetooth_device_address_t address = { {0} };
-
- __bt_service_get_parameters(in_param1, &address,
- sizeof(bluetooth_device_address_t));
- result = _bt_otp_disconnect_otc(&address);
+ case BT_PXP_UNREGISTER_REPORTER: {
+ result = bt_unregister_proximity_reporter();
break;
}
default:
BT_DBG("BT_OPP_PUSH_FILES");
int i;
bluetooth_device_address_t address = { {0} };
- bt_file_path_t path;
+ bt_file_path_t *path;
char **file_path;
int file_count;
GArray *param2;
__bt_fill_garray_from_variant(in_param2, param2);
for (i = 0; i < file_count; i++) {
- path = g_array_index(param2, bt_file_path_t, i);
- file_path[i] = g_strdup(path.path);
+ path = &g_array_index(param2, bt_file_path_t, i);
+ file_path[i] = g_strdup(path->path);
}
BT_DBG("_bt_opp_client_push_files");
result = _bt_opp_client_push_files(request_id, context,
break;
}
-
- case BT_MAP_CREATE_SESSION: {
- BT_DBG("BT_MAP_CREATE_SESSION");
- char *address = (char *)g_variant_get_data(in_param1);
- char *session_id = NULL;
- result = _bt_create_session_sync(address, &session_id);
- if (result == BLUETOOTH_ERROR_NONE)
- g_array_append_vals(*out_param1, session_id, strlen(session_id)+1);
- break;
- }
-
- case BT_MAP_DESTROY_SESSION: {
- BT_DBG("BT_MAP_DESTROY_SESSION");
- char* session_id = (char *)g_variant_get_data(in_param1);
- result = _bt_destroy_session_sync(session_id);
- if (result == BLUETOOTH_ERROR_NONE)
- BT_DBG("successfully destroyed session");
- break;
- }
-
- case BT_MAP_SET_FOLDER: {
- BT_DBG("BT_MAP_SET_FOLDER");
- char *session_id = (char *)g_variant_get_data(in_param1);
- char *name = (char *)g_variant_get_data(in_param2);
- result = _bt_map_client_set_folder(session_id, name);
- break;
- }
-
- case BT_MAP_LIST_FOLDERS: {
- BT_DBG("BT_MAP_LIST_FOLDERS");
-
- char* session_id = (char *)g_variant_get_data(in_param1);
- char* filter_serialized = (char*)g_variant_get_data(in_param2);
-
- result = _bt_map_client_list_folders(request_id, context, session_id, filter_serialized);
- if (result == BLUETOOTH_ERROR_NONE)
- BT_DBG("_bt_map_client_list_folders succeed");
-
- break;
- }
-
- case BT_MAP_LIST_FILTER_FIELDS: {
- BT_DBG("BT_MAP_LIST_FILTER_FIELDS");
-
- char* session_id = (char *)g_variant_get_data(in_param1);
-
- result = _bt_map_client_list_filter_fields(request_id, context, session_id);
- if (result == BLUETOOTH_ERROR_NONE)
- BT_DBG("_bt_map_client_list_filter_fields succeed");
-
- break;
- }
-
- case BT_MAP_LIST_MESSAGES: {
- BT_DBG("BT_MAP_LIST_MESSAGES");
-
- char* session_id = (char*)g_variant_get_data(in_param1);
- char* folder = (char*)g_variant_get_data(in_param2);
- char* filter_serialized = (char*)g_variant_get_data(in_param3);
-
- result = _bt_map_client_list_messages(request_id, context, session_id, folder, filter_serialized);
- if (result == BLUETOOTH_ERROR_NONE)
- BT_DBG("_bt_map_client_list_messages succeed");
- else
- BT_DBG("_bt_map_client_list_messages failed");
-
- break;
- }
-
- case BT_MAP_UPDATE_INBOX: {
- BT_DBG("BT_MAP_UPDATE_INBOX");
- char* session_id = (char *)g_variant_get_data(in_param1);
- result = _bt_map_client_update_inbox(session_id);
- break;
- }
-
- case BT_MAP_PUSH_MESSAGE: {
- BT_DBG("BT_MAP_PUSH_MESSAGE");
-
- char* session_id = (char *)g_variant_get_data(in_param1);
- char* source_file = (char *)g_variant_get_data(in_param2);
- char* folder = (char *)g_variant_get_data(in_param3);
- char* args_serialized = (char *)g_variant_get_data(in_param4);
-
- result = _bt_map_client_push_message(
- request_id, context, session_id, source_file, folder, args_serialized);
- if (result == BLUETOOTH_ERROR_NONE)
- BT_DBG("_bt_map_client_push_message succeed");
- else
- BT_ERR("_bt_map_client_push_message failed");
-
- break;
- }
-
- case BT_MAP_GET_MESSAGE: {
- BT_DBG("BT_MAP_GET_MESSAGE");
- // TODO session currently is not used, but should be valid
- //char* session_id = (char *)g_variant_get_data(in_param1);
- char* message_object = (char *)g_variant_get_data(in_param2);
- char* target_file = (char *)g_variant_get_data(in_param3);
- bool attachment = false;
- __bt_service_get_parameters(in_param4, &attachment, sizeof(bool));
-
- result = _bt_map_client_get_message(request_id, context, message_object,
- target_file, attachment);
- if (result == BLUETOOTH_ERROR_NONE)
- BT_DBG("_bt_map_client_get_message succeed");
-
- break;
- }
-
case BT_OBEX_SERVER_ALLOCATE: {
int app_pid;
gboolean is_native;
char err_msg[256] = {0, };
retv_if(unique_name == NULL, FALSE);
-
- BT_DBG("unique_name: %s", unique_name);
-
retv_if(bt_service_conn == NULL, FALSE);
ret_val = cynara_creds_get_default_client_method(&client_creds_method);
return FALSE;
}
- BT_DBG("client_creds: %s", client_creds);
-
ret_val = cynara_creds_gdbus_get_user(bt_service_conn, unique_name, user_creds_method, &user_creds);
if (ret_val != CYNARA_API_SUCCESS) {
cynara_strerror(ret_val, err_msg, sizeof(err_msg));
return FALSE;
}
- BT_DBG("user_creds: %s", user_creds);
+ BT_DBG("%s, %s, %s", unique_name, client_creds, user_creds);
switch (function_name) {
case BT_SET_LOCAL_NAME:
case BT_OPP_PUSH_FILES:
case BT_OPP_CANCEL_PUSH:
- /* TODO: MAP? MAP functions, see above */
case BT_OBEX_SERVER_ACCEPT_CONNECTION:
case BT_OBEX_SERVER_REJECT_CONNECTION:
case BT_GATT_REGISTER_SERVICE:
case BT_GATT_SEND_RESPONSE:
+ case BT_REQ_ATT_MTU:
case BT_PBAP_CONNECT:
case BT_PBAP_DISCONNECT:
case BT_PBAP_GET_PHONEBOOK_SIZE:
case BT_REMOVE_WHITE_LIST:
case BT_CLEAR_WHITE_LIST:
case BT_SET_MANUFACTURER_DATA:
+ case BT_SET_PASSKEY_NOTIFICATION:
case BT_SET_PROFILE_RESTRICTED:
+ case BT_DISCONNECT_DEVICE:
case BT_CANCEL_SEARCH_SERVICE:
case BT_ENABLE_RSSI:
case BT_RFCOMM_ACCEPT_CONNECTION:
case BT_RFCOMM_REJECT_CONNECTION:
case BT_RFCOMM_LISTEN:
+ case BT_RFCOMM_CREATE_SOCKET_EX:
+ case BT_RFCOMM_REMOVE_SOCKET_EX:
+
+ case BT_HID_ENABLE_BARCODE_FEATURE:
case BT_AVRCP_CONTROL_GET_PROPERTY:
case BT_AVRCP_GET_TRACK_INFO:
+ case BT_AVRCP_TRANSPORT_SET_PROPERTY:
+
case BT_SET_CONTENT_PROTECT:
case BT_BOND_DEVICE_BY_TYPE:
case BT_SET_LE_STATIC_RANDOM_ADDRESS:
case BT_LE_CONN_UPDATE:
case BT_UPDATE_LE_CONNECTION_MODE:
- case BT_REQ_ATT_MTU:
case BT_GET_DEVICE_IDA:
+ case BT_ENABLE_FORCE_HCI_DUMP:
case BT_LE_READ_MAXIMUM_DATA_LENGTH:
case BT_LE_WRITE_HOST_SUGGESTED_DATA_LENGTH:
case BT_LE_READ_HOST_SUGGESTED_DATA_LENGTH:
case BT_LE_SET_DATA_LENGTH:
- case BT_GET_ATT_MTU:
-
case BT_LE_IPSP_INIT:
case BT_LE_IPSP_DEINIT:
case BT_LE_IPSP_CONNECT:
case BT_LE_IPSP_DISCONNECT:
- case BT_PXP_MONITOR_SET_PROPERTY:
- case BT_PXP_MONITOR_GET_PROPERTY:
- case BT_PXP_MONITOR_GET_SUPPORTED_SERIVCES:
- case BT_PXP_REPORTER_REGISTER:
- case BT_PXP_REPORTER_UNREGISTER:
- case BT_PXP_REPORTER_GET_PROPERTY:
-
- /* TDS */
- case BT_TDS_PROVIDER_REGISTER:
- case BT_TDS_PROVIDER_UNREGISTER:
- case BT_TDS_PROVIDER_SET_MANUF_DATA:
- case BT_TDS_PROVIDER_CREATE:
- case BT_TDS_PROVIDER_DESTROY:
- case BT_TDS_PROVIDER_SET_TRANSPORT_DATA:
- case BT_TDS_SEND_ACTIVATION_RESPONSE:
- case BT_TDS_READ_TRANSPORT_DATA:
- case BT_TDS_ENABLE_CONTROL_POINT:
- case BT_TDS_ACTIVATE_CONTROL_POINT:
-
- /* OTP Server */
- case BT_OTP_SERVER_INIT:
- case BT_OTP_SERVER_DEINIT:
- case BT_OTP_READ_VALUE:
- case BT_OTP_ENABLE_NOTIFICATION:
- case BT_OTP_WRITE_VALUE:
- case BT_LE_OTC_CONNECT:
- case BT_LE_OTC_DISCONNECT:
-
- case BT_MAP_CREATE_SESSION:
- case BT_MAP_DESTROY_SESSION:
- case BT_MAP_SET_FOLDER:
- case BT_MAP_LIST_FOLDERS:
- case BT_MAP_LIST_FILTER_FIELDS:
- case BT_MAP_LIST_MESSAGES:
- case BT_MAP_UPDATE_INBOX:
- case BT_MAP_PUSH_MESSAGE:
- case BT_MAP_GET_MESSAGE:
-
+ case BT_PXP_SET_PROPERTY:
+ case BT_PXP_GET_PROPERTY:
+ case BT_PXP_GET_SUPPORTED_SERIVCES:
+ case BT_PXP_REGISTER_REPORTER:
+ case BT_PXP_UNREGISTER_REPORTER:
ret_val = cynara_check(p_cynara, client_creds, client_session, user_creds,
BT_PRIVILEGE_PLATFORM);
case BT_GET_BONDED_DEVICES:
case BT_GET_PROFILE_CONNECTED_DEVICES:
case BT_GET_BONDED_DEVICE:
+ case BT_PASSKEY_REPLY:
+ case BT_PASSKEY_CONFIRMATION_REPLY:
case BT_GET_IS_ALIAS_SET:
case BT_IS_DEVICE_CONNECTED:
case BT_GET_CONNECTED_LINK_TYPE:
case BT_GET_ADVERTISING_DATA:
case BT_GET_SCAN_RESPONSE_DATA:
case BT_IS_ADVERTISING:
- case BT_GET_PROFILE_RESTRICTED:
case BT_REGISTER_SCAN_FILTER:
case BT_UNREGISTER_SCAN_FILTER:
case BT_UNREGISTER_ALL_SCAN_FILTERS:
case BT_IS_SCAN_FILTER_SUPPORTED:
+ case BT_GET_PROFILE_RESTRICTED:
+ case BT_GET_ATT_MTU:
case BT_OBEX_SERVER_ALLOCATE:
case BT_OBEX_SERVER_DEALLOCATE:
return 0;
}
+static void __bt_service_bus_acquired_handler(GDBusConnection *connection,
+ const gchar *name, gpointer user_data)
+{
+ GDBusNodeInfo *node_info = NULL;
+
+ BT_INFO("bus acquired");
+
+ ret_if(connection == NULL);
+
+ node_info = __bt_service_create_method_node_info(
+ bt_service_introspection_xml);
+ ret_if(node_info == NULL);
+
+ __bt_service_register_object(connection, node_info, TRUE);
+ g_dbus_node_info_unref(node_info);
+
+ bt_service_conn = connection;
+}
+
+static void __bt_service_name_acquired_handler(GDBusConnection *connection,
+ const gchar *name, gpointer user_data)
+{
+ BT_INFO("name acquired");
+ name_acquired = TRUE;
+}
+
+static void __bt_service_name_lost_handler(GDBusConnection *connection,
+ const gchar *name, gpointer user_data)
+{
+ BT_INFO("name lost");
+ name_acquired = FALSE;
+}
+
+gboolean _is_name_acquired(void)
+{
+ return name_acquired;
+}
+
int _bt_service_register(void)
{
GDBusConnection *conn;
GError *err = NULL;
- int result;
conn = g_bus_get_sync(G_BUS_TYPE_SYSTEM, NULL, &err);
retv_if(conn == NULL, BLUETOOTH_ERROR_INTERNAL);
+ bt_service_conn = conn;
owner_id = g_bus_own_name(G_BUS_TYPE_SYSTEM,
BT_SERVICE_NAME,
G_BUS_NAME_OWNER_FLAGS_NONE,
- NULL, NULL, NULL,
+ __bt_service_bus_acquired_handler,
+ __bt_service_name_acquired_handler,
+ __bt_service_name_lost_handler,
NULL, NULL);
BT_DBG("owner_id is [%d]", owner_id);
if (owner_id == 0)
goto fail;
- node_info = __bt_service_create_method_node_info(
- bt_service_introspection_xml);
-
- if (node_info == NULL)
- goto fail;
-
- result = __bt_service_register_object(conn, node_info, TRUE);
- g_dbus_node_info_unref(node_info);
- node_info = NULL;
-
- if (result != BLUETOOTH_ERROR_NONE)
- goto fail;
-
- bt_service_conn = conn;
-
return BLUETOOTH_ERROR_NONE;
fail:
g_object_unref(bt_service_conn);
bt_service_conn = NULL;
}
- if (node_info) {
- g_dbus_node_info_unref(node_info);
- node_info = NULL;
- }
if (owner_id > 0) {
g_bus_unown_name(owner_id);
owner_id = 0;