return BT_STATUS_SUCCESS;
}
+/*sets the privacy functionality of the adapter*/
+int _bt_hal_adapter_le_set_privacy(uint8_t set_privacy)
+{
+ GDBusProxy *proxy;
+ GError *error = NULL;
+ GVariant *result = NULL;
+ proxy = _bt_hal_get_adapter_proxy();
+ if (proxy == NULL)
+ return BT_STATUS_FAIL;
+
+ result = g_dbus_proxy_call_sync(proxy,
+ "SetLePrivacy",
+ g_variant_new("(b)", set_privacy),
+ G_DBUS_CALL_FLAGS_NONE,
+ -1,
+ NULL,
+ &error);
+
+ if (!result) {
+ if (error != NULL) {
+ ERR("Failed to SetLePrivacy (Error: %s)", error->message);
+ g_clear_error(&error);
+ } else
+ ERR("Failed to SetLePrivacy");
+ return BT_STATUS_FAIL;
+ }
+
+ g_variant_unref(result);
+ INFO("SetLePrivacy as %d", set_privacy);
+ return BT_STATUS_SUCCESS;
+}
int _bt_hal_adapter_le_set_scan_parameters(
int scan_type, int scan_interval, int scan_window)
int _bt_hal_le_init(void);
void _bt_hal_le_deinit(void);
+int _bt_hal_adapter_le_set_privacy(uint8_t set_privacy);
+
int _bt_hal_adapter_le_set_white_list(bt_bdaddr_t *device_address, bt_dev_addr_type_t address_type, bool is_add);
#ifdef __cplusplus
}
.set_hal_adapter_request_state = set_hal_adapter_request_state,
.set_hal_le_request_state = set_hal_le_request_state,
.adapter_le_set_white_list = _bt_hal_adapter_le_set_white_list,
+ .adapter_le_set_privacy = _bt_hal_adapter_le_set_privacy,
#endif
};
* adds/removes the remote device address to/from the white list
*/
int (*adapter_le_set_white_list)(bt_bdaddr_t *device_address, bt_dev_addr_type_t address_type, bool is_add);
+
+ /*
+ * Sets the privacy functionality of the adapter
+ */
+ int (*adapter_le_set_privacy)(uint8_t set_privacy);
#endif
} bt_interface_t;
* @pre Adapter must be enabled with adapter_enable() followed by OAL_EVENT_ADAPTER_ENABLED
*/
oal_status_t adapter_set_white_list(bt_address_t* device_address, int address_type, bool is_add);
+
+/**
+ * @brief Set the privacy functionality of the adapter
+ *
+ * @param privacy mode
+ *
+ * @details Set the privacy functionality of the adaptor.
+ *
+ * @return OAL_STATUS_SUCCESS on success, otherwise a non-zero error value.
+ * @retval #OAL_STATUS_SUCCESS Successful
+ *
+ * @pre Adapter must be enabled with adapter_enable() followed by OAL_EVENT_ADAPTER_ENABLED
+ */
+oal_status_t adapter_ble_set_privacy(int set_privacy);
#ifdef __cplusplus
}
#endif /* __cplusplus */
return ret;
}
+oal_status_t adapter_ble_set_privacy(int set_privacy)
+{
+ int res;
+
+ CHECK_OAL_INITIALIZED();
+ API_TRACE();
+
+ res = blued_api->adapter_le_set_privacy(set_privacy);
+ if (res != BT_STATUS_SUCCESS)
+ BT_ERR("Setting LE Privacy Failed: [%s]", status2string(res));
+ res = convert_to_oal_status(res);
+
+ return res;
+}
+
static void cb_adapter_properties(bt_status_t status,
int num_properties,
bt_property_t *properties)
return FALSE;
}
+int _bt_set_le_privacy(gboolean set_privacy)
+{
+ int result = BLUETOOTH_ERROR_NONE;
+
+ if (__bt_is_factory_test_mode()) {
+ BT_ERR("Unable to set le privacy in factory binary !!");
+ return BLUETOOTH_ERROR_NOT_SUPPORT;
+ }
+
+ if (_bt_adapter_get_status() != BT_ACTIVATED &&
+ _bt_adapter_get_le_status() != BT_LE_ACTIVATED) {
+ return BLUETOOTH_ERROR_DEVICE_NOT_ENABLED;
+ }
+
+ result = adapter_ble_set_privacy(set_privacy);
+ if (result != OAL_STATUS_SUCCESS) {
+ BT_ERR("adapter_set_le_privacy failed: %d", result);
+ result = BLUETOOTH_ERROR_INTERNAL;
+ }
+
+ return result;
+}
+
+
int _bt_set_white_list(bluetooth_device_address_t *device_address, int address_type, bool is_add)
{
int result = BLUETOOTH_ERROR_NONE;
result = _bt_set_authorization(&address, authorize);
break;
}
+ case BT_SET_LE_PRIVACY: {
+ gboolean set_privacy;
+ __bt_service_get_parameters(in_param1, &set_privacy,
+ sizeof(gboolean));
+ result = _bt_set_le_privacy(set_privacy);
+ break;
+ }
case BT_ADD_WHITE_LIST: {
bluetooth_device_address_t address = { {0} };
int address_type = 0;
int _bt_set_le_static_random_address(gboolean is_enable);
+int _bt_set_le_privacy(gboolean set_privacy);
+
int _bt_set_white_list(bluetooth_device_address_t *device_address, int address_type, bool is_add);
#ifdef __cplusplus
}