+ case BT_LE_SET_DATA_LENGTH: {
+ int max_tx_Octets = 0;
+ int max_tx_Time = 0;
+ bluetooth_device_address_t address = { {0} };
+
+ __bt_service_get_parameters(in_param1, &address,
+ sizeof(bluetooth_device_address_t));
+ __bt_service_get_parameters(in_param2,
+ &max_tx_Octets, sizeof(int));
+ __bt_service_get_parameters(in_param3,
+ &max_tx_Time, sizeof(int));
+
+ result = _bt_le_set_data_length(&address, max_tx_Octets, max_tx_Time);
+ break;
+ }
+ case BT_DPM_SET_ALLOW_BT_MODE: {
+ dpm_bt_allow_t value = DPM_BT_ERROR;
+
+ __bt_service_get_parameters(in_param1, &value,
+ sizeof(int));
+
+ result = _bt_dpm_set_allow_bluetooth_mode(value);
+ break;
+ }
+ case BT_DPM_GET_ALLOW_BT_MODE: {
+ dpm_bt_allow_t value = DPM_BT_ERROR;
+
+ 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_BT_ERROR;
+
+ __bt_service_get_parameters(in_param1, &value,
+ sizeof(int));
+
+ result = _bt_dpm_activate_bluetooth_device_restriction(value);
+ break;
+ }
+ case BT_DPM_GET_DEVICE_RESTRITION: {
+ dpm_status_t value = DPM_BT_ERROR;
+
+ 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_BT_ERROR;
+
+ __bt_service_get_parameters(in_param1, &value,
+ sizeof(int));
+
+ result = _bt_dpm_activate_bluetoooth_uuid_restriction(value);
+ break;
+ }
+ case BT_DPM_GET_UUID_RESTRITION: {
+ dpm_status_t value = DPM_BT_ERROR;
+
+ 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: {
+ bluetooth_device_address_t address = { {0} };
+
+ __bt_service_get_parameters(in_param1, &address,
+ sizeof(bluetooth_device_address_t));
+
+ result = _bt_dpm_add_bluetooth_devices_to_blacklist(&address);
+ break;
+ }
+ case BT_DPM_ADD_DEVICES_WHITELIST: {
+ bluetooth_device_address_t address = { {0} };
+
+ __bt_service_get_parameters(in_param1, &address,
+ sizeof(bluetooth_device_address_t));
+
+ result = _bt_dpm_add_bluetooth_devices_to_whitelist(&address);
+ break;
+ }
+ case BT_DPM_ADD_UUIDS_BLACKLIST: {
+ const char *uuid = NULL;
+
+ uuid = g_variant_get_data(in_param1);
+
+ result = _bt_dpm_add_bluetooth_uuids_to_blacklist(uuid);
+ break;
+ }
+ case BT_DPM_ADD_UUIDS_WHITELIST: {
+ const char *uuid = NULL;
+
+ uuid = g_variant_get_data(in_param1);
+
+ result = _bt_dpm_add_bluetooth_uuids_to_whitelist(uuid);
+ break;
+ }
+ case BT_DPM_CLEAR_DEVICES_BLACKLIST: {
+ result = _bt_dpm_clear_bluetooth_devices_from_blacklist();
+ break;
+ }
+ case BT_DPM_CLEAR_DEVICES_WHITELIST: {
+ result = _bt_dpm_clear_bluetooth_devices_from_whitelist();
+ break;
+ }
+ case BT_DPM_CLEAR_UUIDS_BLACKLIST: {
+ result = _bt_dpm_clear_bluetooth_uuids_from_blacklist();
+ break;
+ }
+ case BT_DPM_CLEAR_UUIDS_WHITELIST: {
+ result = _bt_dpm_clear_bluetooth_uuids_from_whitelist();
+ break;
+ }
+ case BT_DPM_REMOVE_DEVICE_BLACKLIST: {
+ bluetooth_device_address_t address = { {0} };
+
+ __bt_service_get_parameters(in_param1, &address,
+ sizeof(bluetooth_device_address_t));
+
+ result = _bt_dpm_remove_bluetooth_devices_from_blacklist(&address);
+ break;
+ }
+ case BT_DPM_REMOVE_DEVICE_WHITELIST: {
+ bluetooth_device_address_t address = { {0} };
+
+ __bt_service_get_parameters(in_param1, &address,
+ sizeof(bluetooth_device_address_t));
+
+ result = _bt_dpm_remove_bluetooth_devices_from_whitelist(&address);
+ break;
+ }
+ case BT_DPM_REMOVE_UUID_BLACKLIST: {
+ const char *uuid = NULL;
+
+ uuid = g_variant_get_data(in_param1);
+
+ result = _bt_dpm_remove_bluetooth_uuids_from_blacklist(uuid);
+ break;
+ }
+ case BT_DPM_REMOVE_UUID_WHITELIST: {
+ const char *uuid = NULL;
+
+ uuid = g_variant_get_data(in_param1);
+
+ result = _bt_dpm_remove_bluetooth_uuids_from_whitelist(uuid);
+
+ break;
+ }
+ case BT_DPM_GET_DEVICES_BLACKLIST: {
+ result = _bt_dpm_get_bluetooth_devices_from_blacklist(out_param1);
+ break;
+ }
+ case BT_DPM_GET_DEVICES_WHITELIST: {
+ result = _bt_dpm_get_bluetooth_devices_from_whitelist(out_param1);
+ break;
+ }
+ case BT_DPM_GET_UUIDS_BLACKLIST: {
+ result = _bt_dpm_get_bluetooth_uuids_from_blacklist(out_param1);
+ break;
+ }
+ case BT_DPM_GET_UUIDS_WHITELIST: {
+ result = _bt_dpm_get_bluetooth_uuids_from_whitelist(out_param1);
+ break;
+ }
+ case BT_DPM_SET_ALLOW_OUTGOING_CALL: {
+ dpm_status_t value = DPM_BT_ERROR;
+
+ __bt_service_get_parameters(in_param1, &value,
+ sizeof(int));
+
+ result = _bt_dpm_set_allow_bluetooth_outgoing_call(value);
+
+ break;
+ }
+ case BT_DPM_GET_ALLOW_OUTGOING_CALL: {
+ dpm_status_t value = DPM_BT_ERROR;
+
+ 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_BT_ERROR;
+
+ __bt_service_get_parameters(in_param1, &value,
+ sizeof(int));
+
+ result = _bt_dpm_set_bluetooth_pairing_state(value);
+
+ break;
+ }
+ case BT_DPM_GET_PAIRING_STATE: {
+ dpm_status_t value = DPM_BT_ERROR;
+
+ 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: {
+ dpm_status_t value = DPM_BT_ERROR;
+ dpm_profile_t profile = DPM_PROFILE_NONE;
+
+ __bt_service_get_parameters(in_param1, &profile,
+ sizeof(int));
+ __bt_service_get_parameters(in_param2, &value,
+ sizeof(int));
+
+ result = _bt_dpm_set_bluetooth_profile_state(profile, value);
+
+ break;
+ }
+ case BT_DPM_GET_PROFILE_STATE: {
+ dpm_status_t value = DPM_BT_ERROR;
+ dpm_profile_t profile = DPM_PROFILE_NONE;
+
+ __bt_service_get_parameters(in_param2, &profile,
+ sizeof(int));
+
+ 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: {
+ dpm_status_t value = DPM_BT_ERROR;
+
+ __bt_service_get_parameters(in_param1, &value,
+ sizeof(int));
+
+ result = _bt_dpm_set_bluetooth_desktop_connectivity_state(value);
+
+ break;
+ }
+ case BT_DPM_GET_DESKROP_CONNECTIVITY_STATE: {
+ dpm_status_t value = DPM_BT_ERROR;
+
+ 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: {
+ dpm_status_t value = DPM_BT_ERROR;
+
+ __bt_service_get_parameters(in_param1, &value,
+ sizeof(int));
+
+ result = _bt_dpm_set_bluetooth_discoverable_state(value);
+
+ break;
+ }
+ case BT_DPM_GET_DISCOVERABLE_STATE: {
+ dpm_status_t value = DPM_BT_ERROR;
+
+ 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: {
+ dpm_status_t value = DPM_BT_ERROR;
+
+ __bt_service_get_parameters(in_param1, &value,
+ sizeof(int));
+
+ result = _bt_dpm_set_bluetooth_limited_discoverable_state(value);
+
+ break;
+ }
+ case BT_DPM_GET_LIMITED_DISCOVERABLE_STATE: {
+ dpm_status_t value = DPM_BT_ERROR;
+
+ 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: {
+ dpm_status_t value = DPM_BT_ERROR;
+
+ __bt_service_get_parameters(in_param1, &value,
+ sizeof(int));
+
+ result = _bt_dpm_set_bluetooth_data_transfer_state(value);
+
+ break;
+ }
+ case BT_DPM_GET_DATA_TRANSFER_STATE: {
+ dpm_status_t value = DPM_BT_ERROR;
+
+ 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_SET_PROPERTY: {
+ bluetooth_device_address_t address = { {0} };
+ unsigned int property = 0;
+ unsigned int value = 0;
+
+ __bt_service_get_parameters(in_param1,
+ &address, sizeof(bluetooth_device_address_t));
+ __bt_service_get_parameters(in_param2,
+ &property, sizeof(int));
+ __bt_service_get_parameters(in_param3,
+ &value, sizeof(int));
+
+ result = bt_set_proximity_property(&address, property, value);
+ break;
+ }
+ case BT_PXP_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_get_proximity_property(&address, property, &value);
+ if (result == BLUETOOTH_ERROR_NONE) {
+ g_array_append_vals(*out_param1, &value,
+ sizeof(int));
+ }
+ break;
+ }
+ 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_get_proximity_supported_services(&address, &property);
+ if (result == BLUETOOTH_ERROR_NONE) {
+ g_array_append_vals(*out_param1, &property,
+ sizeof(int));
+ }
+ break;
+ }
+ case BT_PXP_REGISTER_REPORTER: {
+ result = bt_register_proximity_reporter();
+ break;
+ }
+ case BT_PXP_UNREGISTER_REPORTER: {
+ result = bt_unregister_proximity_reporter();
+ break;
+ }
+ default:
+ result = BLUETOOTH_ERROR_INTERNAL;
+ break;
+ }
+
+ return result;
+}
+
+int __bt_obexd_request(int function_name,
+ int request_type,
+ int request_id,
+ GDBusMethodInvocation *context,
+ GVariant *in_param1,
+ GVariant *in_param2,
+ GVariant *in_param3,
+ GVariant *in_param4,
+ GArray **out_param1)
+{
+ BT_DBG("+");
+
+ int result;
+
+ BT_DBG("function_name : %x", function_name);
+
+ switch (function_name) {
+ case BT_OPP_PUSH_FILES: {
+ BT_DBG("BT_OPP_PUSH_FILES");
+ int i;
+ bluetooth_device_address_t address = { {0} };
+ bt_file_path_t *path;
+ char **file_path;
+ int file_count;
+ GArray *param2;
+
+ __bt_service_get_parameters(in_param1, &address,
+ sizeof(bluetooth_device_address_t));
+ __bt_service_get_parameters(in_param3, &file_count,
+ sizeof(int));
+
+ file_path = g_new0(char *, file_count + 1);
+
+ param2 = g_array_new(TRUE, TRUE, sizeof(gchar));
+ __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);
+ }
+ BT_DBG("_bt_opp_client_push_files");
+ result = _bt_opp_client_push_files(request_id, context,
+ &address, file_path,
+ file_count);
+
+ for (i = 0; i < file_count; i++)
+ g_free(file_path[i]);
+
+ g_free(file_path);
+ g_array_free(param2, TRUE);
+
+ break;
+ }
+ case BT_OPP_CANCEL_PUSH: {
+ result = _bt_opp_client_cancel_push();
+
+ break;
+ }
+ case BT_OPP_IS_PUSHING_FILES: {
+ gboolean is_sending = FALSE;
+
+ result = _bt_opp_client_is_sending(&is_sending);
+
+ g_array_append_vals(*out_param1, &is_sending,
+ sizeof(gboolean));
+ break;
+ }
+ case BT_OPP_GET_TRANSFER_PROGRESS: {
+ int direction;
+ int transfer_id;
+ guint8 progress = 0;
+
+ __bt_service_get_parameters(in_param1, &direction,
+ sizeof(int));
+ __bt_service_get_parameters(in_param2, &transfer_id,
+ sizeof(int));
+ if (direction)
+ result = _bt_opp_get_client_progress(&progress);
+ else
+ result = _bt_opp_get_server_progress(transfer_id, &progress);
+
+ g_array_append_vals(*out_param1, &progress,
+ sizeof(guint8));
+
+ break;
+ }
+ case BT_OBEX_SERVER_ALLOCATE: {
+ int app_pid;
+ gboolean is_native;
+ char *path;