src/bluetooth-gatt.c
src/bluetooth-ipsp.c
src/bluetooth-dpm.c
+src/bluetooth-proximity.c
)
IF (TIZEN_PROFILE_WEARABLE OR TIZEN_PROFILE_IVI)
LIST(APPEND SOURCES src/bluetooth-pbap.c)
BT_EVENT_GET_RSSI_EVENT, /**< Get RSSI Strength callback */
BT_EVENT_LE_READ_MAXIMUM_DATA_LENGTH, /**< Read maximun LE data length callback */
BT_EVENT_SUPPORTED_TRUSTED_PROFILE_EVENT, /**< Trusted Profile callback */
+ BT_EVENT_PROXIMITY_PROPERTY_CHANGED, /**< Proximity property changed */
#if defined(TIZEN_PROFILE_WEARABLE) || defined(TIZEN_PROFILE_IVI)
BT_EVENT_PBAP_CONNECTION_STATUS, /**< PBAP connection status callback */
BT_EVENT_PBAP_PHONEBOOK_SIZE, /**< PBAP Phonebook Size status callback */
*/
int bt_pbap_client_is_connected(const char *address, bool *connected_status);
+/**
+ * @internal
+ * @brief Register the Proximity Profile.
+ */
+int bt_proximity_register(bt_proximity_role_t role, bt_proximity_property_changed_cb callback, void *user_data);
+
+/**
+ * @internal
+ * @brief Unregister the Proximity Profile.
+ */
+int bt_proximity_unregister(bt_proximity_role_t role);
+
+/**
+ * @internal
+ * @brief Set the Proximity Profile property value.
+ */
+int bt_proximity_set_property(const char *remote_address, bt_proximity_property_t property, int value);
+
+/**
+ * @internal
+ * @brief Read the Proximity Profile property value.
+ */
+int bt_proximity_get_property(const char *remote_address, bt_proximity_property_t property, int *value);
+
+/**
+ * @internal
+ * @brief Lists the Proximity Profile property/service supported.
+ */
+int bt_proximity_get_supported_services(const char *remote_address, int *supported_services);
/**
* @}
*/
BT_AUTH_PASSKEY_CONFIRM_REQUEST, /**< PASSKEY confirmation event to match PASSKEY in remote device */
} bt_authentication_type_info_e;
+/**
+ * @ingroup CAPI_NETWORK_BLUETOOTH_PROXIMITY_MODULE
+ * @brief Proximity Profile Role
+ * @since_tizen 3.0
+ */
+typedef enum {
+ BT_PROXIMITY_REPORTER, /**< Proximity Profile Reporter role. */
+ BT_PROXIMITY_MONITOR, /**< Proximity Profile Monitor role. */
+} bt_proximity_role_t;
+
+/**
+ * @ingroup CAPI_NETWORK_BLUETOOTH_PROXIMITY_MODULE
+ * @brief Proximity Profile Role
+ * @since_tizen 3.0
+ */
+typedef enum {
+ BT_PROXIMITY_LINKLOSS_ALERT = 0x01, /**< Proximity profile Link Loss alert property */
+ BT_PROXIMITY_IMMEDIATE_ALERT = 0x02, /**< Proximity Profile Immediate alert property */
+ BT_PROXIMITY_TX_POWER = 0x04, /**< Proximity Profile Immediate alert property */
+} bt_proximity_property_t;
+
/**
* @ingroup CAPI_NETWORK_BLUETOOTH_DEVICE_MODULE
* @brief Called when Trusted Profiles is changed.
typedef void (*bt_ipsp_connection_state_changed_cb)
(int result, bool connected, const char *remote_address, const char *iface_name, void *user_data);
+/**
+ * @internal
+ * @brief Proximity profile property changed callback
+ */
+typedef void (*bt_proximity_property_changed_cb)
+ (int result, const char *remote_address, int role, int service_type, int prop_value, void *user_data);
/**
* @internal
*/
int bt_pbap_client_is_connected(const char *address, bool *connected_status);
+/**
+ * @internal
+ * @brief Register the Proximity Profile.
+ */
+int bt_proximity_register(bt_proximity_role_t role, bt_proximity_property_changed_cb callback, void *user_data);
+
+/**
+ * @internal
+ * @brief Unregister the Proximity Profile.
+ */
+int bt_proximity_unregister(bt_proximity_role_t role);
+
+/**
+ * @internal
+ * @brief Set the Proximity Profile property value.
+ */
+int bt_proximity_set_property(const char *remote_address, bt_proximity_property_t property, int value);
+
+/**
+ * @internal
+ * @brief Read the Proximity Profile property value.
+ */
+int bt_proximity_get_property(const char *remote_address, bt_proximity_property_t property, int *value);
+
+/**
+ * @internal
+ * @brief Lists the Proximity Profile property/service supported.
+ */
+int bt_proximity_get_supported_services(const char *remote_address, int *supported_services);
/**
* @}
*/
BT_AUTH_PASSKEY_CONFIRM_REQUEST, /**< PASSKEY confirmation event to match PASSKEY in remote device */
} bt_authentication_type_info_e;
+/**
+ * @ingroup CAPI_NETWORK_BLUETOOTH_PROXIMITY_MODULE
+ * @brief Proximity Profile Role
+ * @since_tizen 3.0
+ */
+typedef enum {
+ BT_PROXIMITY_REPORTER, /**< Proximity Profile Reporter role. */
+ BT_PROXIMITY_MONITOR, /**< Proximity Profile Monitor role. */
+} bt_proximity_role_t;
+
+/**
+ * @ingroup CAPI_NETWORK_BLUETOOTH_PROXIMITY_MODULE
+ * @brief Proximity Profile Role
+ * @since_tizen 3.0
+ */
+typedef enum {
+ BT_PROXIMITY_LINKLOSS_ALERT = 0x01, /**< Proximity profile Link Loss alert property */
+ BT_PROXIMITY_IMMEDIATE_ALERT = 0x02, /**< Proximity Profile Immediate alert property */
+ BT_PROXIMITY_TX_POWER = 0x04, /**< Proximity Profile Immediate alert property */
+} bt_proximity_property_t;
+
/**
* @ingroup CAPI_NETWORK_BLUETOOTH_DEVICE_MODULE
* @brief Called when Trusted Profiles is changed.
char *device_name, char *remote_addr,
char *pass_key, void *user_data);
+/**
+ * @brief Proximity profile property changed callback
+ */
+typedef void (*bt_proximity_property_changed_cb)
+ (int result, const char *remote_address, int role, int service_type, int prop_value, void *user_data);
+
/**
* @}
*/
int bt_hid_device_send_custom_event(const char *remote_address,
unsigned char report_id, const char *data, unsigned int data_len);
+/**
+ * @internal
+ * @brief Register the Proximity Profile.
+ */
+int bt_proximity_register(bt_proximity_role_t role, bt_proximity_property_changed_cb callback, void *user_data);
+
+/**
+ * @internal
+ * @brief Unregister the Proximity Profile.
+ */
+int bt_proximity_unregister(bt_proximity_role_t role);
+
+/**
+ * @internal
+ * @brief Set the Proximity Profile property value.
+ */
+int bt_proximity_set_property(const char *remote_address, bt_proximity_property_t property, int value);
+
+/**
+ * @internal
+ * @brief Read the Proximity Profile property value.
+ */
+int bt_proximity_get_property(const char *remote_address, bt_proximity_property_t property, int *value);
+
+/**
+ * @internal
+ * @brief Lists the Proximity Profile property/service supported.
+ */
+int bt_proximity_get_supported_services(const char *remote_address, int *supported_services);
/**
* @}
*/
BT_AUTH_PASSKEY_CONFIRM_REQUEST, /**< PASSKEY confirmation event to match PASSKEY in remote device */
} bt_authentication_type_info_e;
+/**
+ * @ingroup CAPI_NETWORK_BLUETOOTH_PROXIMITY_MODULE
+ * @brief Proximity Profile Role
+ * @since_tizen 3.0
+ */
+typedef enum {
+ BT_PROXIMITY_REPORTER, /**< Proximity Profile Reporter role. */
+ BT_PROXIMITY_MONITOR, /**< Proximity Profile Monitor role. */
+} bt_proximity_role_t;
+
+/**
+ * @ingroup CAPI_NETWORK_BLUETOOTH_PROXIMITY_MODULE
+ * @brief Proximity Profile Role
+ * @since_tizen 3.0
+ */
+typedef enum {
+ BT_PROXIMITY_LINKLOSS_ALERT = 0x01, /**< Proximity profile Link Loss alert property */
+ BT_PROXIMITY_IMMEDIATE_ALERT = 0x02, /**< Proximity Profile Immediate alert property */
+ BT_PROXIMITY_TX_POWER = 0x04, /**< Proximity Profile Immediate alert property */
+} bt_proximity_property_t;
+
/**
* @ingroup CAPI_NETWORK_BLUETOOTH_DEVICE_MODULE
* @brief Called when Trusted Profiles is changed.
char *device_name, char *remote_addr,
char *pass_key, void *user_data);
+/**
+ * @brief Proximity profile property changed callback
+ */
+typedef void (*bt_proximity_property_changed_cb)
+ (int result, const char *remote_address, int role, int service_type, int prop_value, void *user_data);
+
/**
* @}
*/
bluetooth_authentication_request_info_t *auth_information = NULL;
bt_le_data_length_params_t *data_length_info = NULL;
bt_ipsp_connection_info_t *bt_ipsp_iface_info = NULL;
+ bt_pxp_property_changed_params_t *bt_pxp_property_info = NULL;
if (!__bt_need_to_handle(event))
return;
bt_event_slot_container[event_index].user_data);
break;
}
+ case BLUETOOTH_EVENT_PXP_PROPERTY_CHANGED: {
+ BT_DBG("BLUETOOTH_EVENT_PXP_PROPERTY_CHANGED"); /* LCOV_EXCL_LINE */
+ bt_pxp_property_info = (bt_pxp_property_changed_params_t *)(param->param_data);
+ _bt_convert_address_to_string(&device_addr, &bt_pxp_property_info->device_address);
+
+ ((bt_proximity_property_changed_cb)bt_event_slot_container[event_index].callback) /* LCOV_EXCL_LINE */
+ (_bt_get_error_code(param->result), device_addr,
+ bt_pxp_property_info->role, bt_pxp_property_info->service_type,
+ bt_pxp_property_info->alert_lvl, bt_event_slot_container[event_index].user_data);
+
+ if (device_addr != NULL)
+ free(device_addr); /* LCOV_EXCL_STOP */
+ break;
+ }
default:
break;
}
#endif
case BLUETOOTH_EVENT_IPSP_INIT_STATE_CHANGED:
return BT_EVENT_IPSP_INIT_STATE_CHANGED;
+ case BLUETOOTH_EVENT_PXP_PROPERTY_CHANGED:
+ return BT_EVENT_PROXIMITY_PROPERTY_CHANGED;
default:
return -1;
}
--- /dev/null
+/*
+ * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the License);
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an AS IS BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include <glib.h>
+#include <dlog.h>
+#include <string.h>
+#include <stdio.h>
+#include <stdbool.h>
+#include <string.h>
+#include <bluetooth-api.h>
+
+#include "bluetooth.h"
+#include "bluetooth_internal.h"
+#include "bluetooth_private.h"
+
+static int role_registered = -1;
+
+int bt_proximity_register(bt_proximity_role_t role, bt_proximity_property_changed_cb callback, void *user_data)
+{
+ int error_code = BT_ERROR_NONE;
+
+ BT_CHECK_SUPPORTED_FEATURE(BT_FEATURE_COMMON);
+ BT_CHECK_INIT_STATUS();
+ BT_CHECK_INPUT_PARAMETER(callback); /* LCOV_EXCL_LINE */
+
+ if (role == BT_PROXIMITY_REPORTER) {
+ /* register Reporter Role Here */
+ error_code = _bt_get_error_code(bluetooth_register_proximity_reporter());
+ if (error_code != BT_ERROR_NONE)
+ BT_ERR("%s(0x%08x)", _bt_convert_error_to_string(error_code), error_code);
+ }
+ role_registered = role;
+
+ /* register the callback, common for both reporter and monitor roles */
+ _bt_set_cb(BT_EVENT_PROXIMITY_PROPERTY_CHANGED, callback, user_data);
+
+ return error_code;
+}
+
+int bt_proximity_unregister(bt_proximity_role_t role)
+{
+ int error_code = BT_ERROR_NONE;
+
+ BT_CHECK_SUPPORTED_FEATURE(BT_FEATURE_COMMON);
+ BT_CHECK_INIT_STATUS();
+
+ if (role == BT_PROXIMITY_REPORTER) {
+ /* Unregister Reporter Role Here */
+ error_code = _bt_get_error_code(bluetooth_unregister_proximity_reporter());
+ if (error_code != BT_ERROR_NONE)
+ BT_ERR("%s(0x%08x)", _bt_convert_error_to_string(error_code), error_code);
+ }
+
+ /* unregister the callback, common for both reporter and monitor roles */
+ _bt_unset_cb(BT_EVENT_PROXIMITY_PROPERTY_CHANGED);
+ role_registered = -1;
+
+ return error_code;
+}
+
+int bt_proximity_set_property(const char *remote_address, bt_proximity_property_t property, int value)
+{
+ int error_code = BT_ERROR_NONE;
+ bluetooth_device_address_t addr_hex = { {0,} };
+
+ BT_CHECK_SUPPORTED_FEATURE(BT_FEATURE_COMMON);
+ BT_CHECK_INIT_STATUS();
+ BT_CHECK_INPUT_PARAMETER(remote_address); /* LCOV_EXCL_LINE */
+
+ if (role_registered != BT_PROXIMITY_MONITOR)
+ return BT_ERROR_NOT_SUPPORTED;
+
+ _bt_convert_address_to_hex(&addr_hex, remote_address); /* LCOV_EXCL_LINE */
+
+ error_code = _bt_get_error_code(bluetooth_set_proximity_property(&addr_hex, property, value));
+ if (error_code != BT_ERROR_NONE)
+ BT_ERR("%s(0x%08x)", _bt_convert_error_to_string(error_code), error_code);
+
+ return error_code;
+}
+
+int bt_proximity_get_property(const char *remote_address, bt_proximity_property_t property, int *value)
+{
+ int error_code = BT_ERROR_NONE;
+ bluetooth_device_address_t addr_hex = { {0,} };
+
+ BT_CHECK_SUPPORTED_FEATURE(BT_FEATURE_COMMON);
+ BT_CHECK_INIT_STATUS();
+ BT_CHECK_INPUT_PARAMETER(remote_address); /* LCOV_EXCL_LINE */
+
+ if (role_registered != BT_PROXIMITY_MONITOR)
+ return BT_ERROR_NOT_SUPPORTED;
+
+ _bt_convert_address_to_hex(&addr_hex, remote_address); /* LCOV_EXCL_LINE */
+
+ error_code = _bt_get_error_code(bluetooth_get_proximity_property(&addr_hex, property, value));
+
+ if (error_code != BT_ERROR_NONE)
+ BT_ERR("%s(0x%08x)", _bt_convert_error_to_string(error_code), error_code);
+
+
+ return error_code;
+}
+
+int bt_proximity_get_supported_services(const char *remote_address, int *supported_services)
+{
+ int error_code = BT_ERROR_NONE;
+ bluetooth_device_address_t addr_hex = { {0,} };
+
+ BT_CHECK_SUPPORTED_FEATURE(BT_FEATURE_COMMON);
+ BT_CHECK_INIT_STATUS();
+ BT_CHECK_INPUT_PARAMETER(remote_address); /* LCOV_EXCL_LINE */
+
+ if (role_registered != BT_PROXIMITY_MONITOR)
+ return BT_ERROR_NOT_SUPPORTED;
+
+ _bt_convert_address_to_hex(&addr_hex, remote_address); /* LCOV_EXCL_LINE */
+
+ error_code = _bt_get_error_code(bluetooth_get_proximity_supported_services(&addr_hex, supported_services));
+
+ if (error_code != BT_ERROR_NONE)
+ BT_ERR("%s(0x%08x)", _bt_convert_error_to_string(error_code), error_code);
+
+
+ return error_code;
+}
+
+/* LCOV_EXCL_STOP */
, BT_UNIT_TEST_TABLE_HDP},
{"DPM"
, BT_UNIT_TEST_TABLE_DPM},
+ {"PXP"
+ , BT_UNIT_TEST_TABLE_PXP},
#if defined(TIZEN_PROFILE_WEARABLE) || defined(TIZEN_PROFILE_IVI)
{"HF Role"
, BT_UNIT_TEST_TABLE_HF},
{NULL , 0x0000},
};
+tc_table_t tc_pxp[] = {
+ /* HPS functions */
+ {"BACK"
+ , BT_UNIT_TEST_FUNCTION_BACK},
+ {"Proximity (Register)"
+ , BT_UNIT_TEST_FUNCTION_PXP_REGISTER},
+ {"Proximity (Unregister)"
+ , BT_UNIT_TEST_FUNCTION_PXP_UNREGISTER},
+ {"Proximity (Connect as Monitor)"
+ , BT_UNIT_TEST_FUNCTION_PXP_MONITOR_CONNECT},
+ {"Proximity (Disconnect Monitor)"
+ , BT_UNIT_TEST_FUNCTION_PXP_MONITOR_DISCONNECT},
+ {"Proximity (Write Alert Level)"
+ , BT_UNIT_TEST_FUNCTION_PXP_WRITE_ALERT_LEVEL},
+ {"Proximity (Read Alert Level)"
+ , BT_UNIT_TEST_FUNCTION_PXP_READ_ALERT_LEVEL},
+ {"Proximity (Get Supported Services)"
+ , BT_UNIT_TEST_FUNCTION_PXP_GET_SUPPORTED_SERVICES},
+ {"Select this menu to set parameters and then select the function again."
+ , BT_UNIT_TEST_FUNCTION_ACTIVATE_FLAG_TO_SET_PARAMETERS},
+ {NULL , 0x0000},
+};
tc_table_t tc_avrcp[] = {
/* AVRCP functions */
case BT_UNIT_TEST_TABLE_DPM:
tc_table = tc_DPM;
break;
+ case BT_UNIT_TEST_TABLE_PXP:
+ tc_table = tc_pxp;
+ break;
#if defined(TIZEN_PROFILE_WEARABLE) || defined(TIZEN_PROFILE_IVI)
case BT_UNIT_TEST_TABLE_HF:
tc_table = tc_hf;
return;
}
+void __bt_pxp_montior_connection_state_changed_cb(int result,
+ bool connected, const char *remote_address, void *user_data)
+{
+ int ret;
+ TC_PRT("result: %s", __bt_get_error_message(result));
+ if (connected) {
+ int property = 0;
+
+ TC_PRT("PXP Monitor connected(address = %s)", remote_address);
+
+ ret = bt_proximity_get_supported_services(remote_addr, &property);
+ TC_PRT("bt_proximity_get_supported_service returns %s\n",
+ __bt_get_error_message(ret));
+ if (ret == BT_ERROR_NONE) {
+ TC_PRT("PXP Monitor supported Service\n");
+ if (property & BT_PROXIMITY_LINKLOSS_ALERT)
+ TC_PRT("BT_PROXIMITY_LINKLOSS_ALERT\n");
+ if (property & BT_PROXIMITY_IMMEDIATE_ALERT)
+ TC_PRT("BT_PROXIMITY_IMMEDIATE_ALERT\n");
+ if (property & BT_PROXIMITY_TX_POWER)
+ TC_PRT("BT_PROXIMITY_TX_POWER\n");
+ }
+ } else {
+ TC_PRT("PXP Monitor DISconnected");
+ ret = bt_gatt_unset_connection_state_changed_cb();
+ }
+}
+
+void __bt_proximity_property_changed_cb(int result, const char *remote_address,
+ int role, int service_type,
+ int prop_value, void *user_data)
+{
+ TC_PRT("result [%s]", __bt_get_error_message(result));
+ TC_PRT("remote_address : %s", remote_address);
+ TC_PRT("Role : %d", role);
+ TC_PRT("service_type : %d", service_type);
+ TC_PRT("prop_value : %d", prop_value);
+}
+
void __bt_gatt_server_notification_sent_cb(int result,
const char *remote_address, bt_gatt_server_h server,
bt_gatt_h characteristic, bool completed, void *user_data)
break;
}
+ case BT_UNIT_TEST_TABLE_PXP: {
+ switch (test_id) {
+ case BT_UNIT_TEST_FUNCTION_PXP_REGISTER:
+ case BT_UNIT_TEST_FUNCTION_PXP_UNREGISTER: {
+ if (param_index == 0) {
+ g_test_param.param_count = 1;
+ g_test_param.params = g_malloc0(sizeof(char *) *g_test_param.param_count);
+ param_type = BT_UNIT_TEST_PARAM_TYPE_INT;
+ }
+
+ if (param_index > 0) {
+ g_test_param.params[param_index - 1] = g_malloc0(strlen(param) + 1);
+ strncpy(g_test_param.params[param_index - 1], param, strlen(param));
+ }
+
+ if (param_index == g_test_param.param_count) {
+ need_to_set_params = false;
+#ifdef ARCH64
+ test_input_callback((void *)(uintptr_t)test_id);
+#else
+ test_input_callback((void *)test_id);
+#endif
+ param_index = 0;
+ return 0;
+ }
+ switch (param_index) {
+ case 0:
+ TC_PRT("Input Value Type (avail. : \n0.BT_PROXIMITY_REPORTER, \n1.BT_PROXIMITY_MONITOR");
+ break;
+ }
+
+ TC_PRT("Input param(%d) type:%s",
+ param_index + 1, param_type);
+ param_index++;
+
+ break;
+ }
+ case BT_UNIT_TEST_FUNCTION_PXP_WRITE_ALERT_LEVEL: {
+ if (param_index == 0) {
+ g_test_param.param_count = 2;
+ g_test_param.params = g_malloc0(sizeof(char *) *g_test_param.param_count);
+ param_type = BT_UNIT_TEST_PARAM_TYPE_INT;
+ }
+
+ if (param_index > 0) {
+ int len = strlen(param);
+ g_test_param.params[param_index - 1] = g_malloc0(len + 1);
+ /* Remove new line character */
+ param[len - 1] = '\0';
+ strncpy(g_test_param.params[param_index - 1], param, strlen(param));
+ }
+
+ if (param_index == g_test_param.param_count) {
+ need_to_set_params = false;
+#ifdef ARCH64
+ test_input_callback((void *)(uintptr_t)test_id);
+#else
+ test_input_callback((void *)test_id);
+#endif
+ param_index = 0;
+ return 0;
+ }
+
+ switch (param_index) {
+ case 0:
+ TC_PRT("Input Value Type (avail. : \n1.BT_PROXIMITY_LINKLOSS_ALERT, \n2.BT_PROXIMITY_IMMEDIATE_ALERT");
+ break;
+ case 1:
+ TC_PRT("Input Value Type (avail. : \n0.NONE, \n1.MILD, \n2.HIGH");
+ break;
+ }
+
+ param_index++;
+
+ break;
+ }
+ case BT_UNIT_TEST_FUNCTION_PXP_READ_ALERT_LEVEL: {
+ if (param_index == 0) {
+ g_test_param.param_count = 1;
+ g_test_param.params = g_malloc0(sizeof(char *) *g_test_param.param_count);
+ param_type = BT_UNIT_TEST_PARAM_TYPE_INT;
+ }
+
+ if (param_index > 0) {
+ int len = strlen(param);
+ g_test_param.params[param_index - 1] = g_malloc0(len + 1);
+ /* Remove new line character */
+ param[len - 1] = '\0';
+ strncpy(g_test_param.params[param_index - 1], param, strlen(param));
+ }
+
+ if (param_index == g_test_param.param_count) {
+ need_to_set_params = false;
+#ifdef ARCH64
+ test_input_callback((void *)(uintptr_t)test_id);
+#else
+ test_input_callback((void *)test_id);
+#endif
+ param_index = 0;
+ return 0;
+ }
+
+ switch (param_index) {
+ case 0:
+ TC_PRT("Input Value Type (avail. : \n1.BT_PROXIMITY_LINKLOSS_ALERT, \n2.BT_PROXIMITY_IMMEDIATE_ALERT");
+ break;
+ }
+
+ TC_PRT("Input param(%d) type:%s",
+ param_index + 1, param_type);
+ param_index++;
+
+ break;
+ }
+
+ default:
+ TC_PRT("There is no param to set\n");
+ need_to_set_params = false;
+ break;
+ }
+ break;
+ }
+
case BT_UNIT_TEST_TABLE_AVRCP: {
switch (test_id) {
default:
}
break;
}
+
+ case BT_UNIT_TEST_TABLE_PXP: {
+ switch (test_id) {
+ case BT_UNIT_TEST_FUNCTION_PXP_REGISTER: {
+ int role;
+ if (g_test_param.param_count < 1) {
+ TC_PRT("Input parameters first");
+ break;
+ }
+ role = atoi(g_test_param.params[0]);
+ ret = bt_proximity_register(role, __bt_proximity_property_changed_cb, NULL);
+ TC_PRT("returns %s\n", __bt_get_error_message(ret));
+ break;
+ }
+ case BT_UNIT_TEST_FUNCTION_PXP_UNREGISTER: {
+ int role;
+ if (g_test_param.param_count < 1) {
+ TC_PRT("Input parameters first");
+ break;
+ }
+ role = atoi(g_test_param.params[0]);
+ ret = bt_proximity_unregister(role);
+ TC_PRT("returns %s\n", __bt_get_error_message(ret));
+ break;
+ }
+ case BT_UNIT_TEST_FUNCTION_PXP_MONITOR_CONNECT: {
+ bool auto_connect = false;
+
+ ret = bt_gatt_connect(remote_addr, auto_connect);
+ TC_PRT("returns %s\n", __bt_get_error_message(ret));
+ ret = bt_gatt_set_connection_state_changed_cb(
+ __bt_pxp_montior_connection_state_changed_cb,
+ NULL);
+ TC_PRT("returns %s\n", __bt_get_error_message(ret));
+
+ break;
+ }
+ case BT_UNIT_TEST_FUNCTION_PXP_MONITOR_DISCONNECT: {
+ ret = bt_gatt_disconnect(remote_addr);
+ TC_PRT("returns %s\n", __bt_get_error_message(ret));
+ break;
+ }
+ case BT_UNIT_TEST_FUNCTION_PXP_WRITE_ALERT_LEVEL: {
+ int property, alert_value;
+ if (g_test_param.param_count < 2) {
+ TC_PRT("Input parameters first");
+ break;
+ }
+ property = atoi(g_test_param.params[0]);
+ alert_value = atoi(g_test_param.params[1]);
+ ret = bt_proximity_set_property(remote_addr, property, alert_value);
+ TC_PRT("returns %s\n", __bt_get_error_message(ret));
+ break;
+ }
+ case BT_UNIT_TEST_FUNCTION_PXP_READ_ALERT_LEVEL: {
+ int alert_level = 0;
+ int property;
+ if (g_test_param.param_count < 1) {
+ TC_PRT("Input parameters first");
+ break;
+ }
+ property = atoi(g_test_param.params[0]);
+ ret = bt_proximity_get_property(remote_addr, property, &alert_level);
+ TC_PRT("returns %s, alert_level: %d\n", __bt_get_error_message(ret), alert_level);
+ break;
+ }
+ case BT_UNIT_TEST_FUNCTION_PXP_GET_SUPPORTED_SERVICES: {
+ int property = 0;
+
+ ret = bt_proximity_get_supported_services(remote_addr, &property);
+ TC_PRT("returns %s\n", __bt_get_error_message(ret));
+ if (ret == BT_ERROR_NONE) {
+ if (property & BT_PROXIMITY_LINKLOSS_ALERT)
+ TC_PRT("BT_PROXIMITY_LINKLOSS_ALERT");
+ if (property & BT_PROXIMITY_IMMEDIATE_ALERT)
+ TC_PRT("BT_PROXIMITY_IMMEDIATE_ALERT");
+ if (property & BT_PROXIMITY_TX_POWER)
+ TC_PRT("BT_PROXIMITY_TX_POWER");
+ }
+ break;
+ }
+ case BT_UNIT_TEST_FUNCTION_ACTIVATE_FLAG_TO_SET_PARAMETERS:
+ need_to_set_params = true;
+ TC_PRT("Select the function again");
+ break;
+
+ default:
+ break;
+ }
+ break;
+ }
+
#if defined(TIZEN_PROFILE_WEARABLE) || defined(TIZEN_PROFILE_IVI)
case BT_UNIT_TEST_TABLE_HF: {
switch (test_id) {
BT_UNIT_TEST_TABLE_IPSP,
BT_UNIT_TEST_TABLE_HDP,
BT_UNIT_TEST_TABLE_DPM,
+ BT_UNIT_TEST_TABLE_PXP,
#if defined(TIZEN_PROFILE_WEARABLE) || defined(TIZEN_PROFILE_IVI)
BT_UNIT_TEST_TABLE_HF,
BT_UNIT_TEST_TABLE_PBAP_CLIENT,
BT_UNIT_TEST_FUNCTION_APP_CONTROL_2_4_BT_ONOFF,
BT_UNIT_TEST_FUNCTION_APP_CONTROL_2_4_BT_VISIBILITY,
BT_UNIT_TEST_FUNCTION_CHECK_FEATURE,
+ BT_UNIT_TEST_FUNCTION_PXP_REGISTER = 1,
+ BT_UNIT_TEST_FUNCTION_PXP_UNREGISTER,
+ BT_UNIT_TEST_FUNCTION_PXP_MONITOR_CONNECT,
+ BT_UNIT_TEST_FUNCTION_PXP_MONITOR_DISCONNECT,
+ BT_UNIT_TEST_FUNCTION_PXP_WRITE_ALERT_LEVEL,
+ BT_UNIT_TEST_FUNCTION_PXP_READ_ALERT_LEVEL,
+ BT_UNIT_TEST_FUNCTION_PXP_GET_SUPPORTED_SERVICES,
BT_UNIT_TEST_FUNCTION_ACTIVATE_FLAG_TO_SET_PARAMETERS = 0XFF,
} bt_unit_test_function_e;