#include <sys/types.h>
#include <ifaddrs.h>
#include <linux/if_link.h>
+#include <app_control.h>
+#include <system_info.h>
#include "bluetooth.h"
#include "bluetooth_internal.h"
{"PBAP Client"
, BT_UNIT_TEST_TABLE_PBAP_CLIENT},
#endif
- {"Automated test"
- , BT_UNIT_TEST_TABLE_AUTOMATED_TEST},
+ {"etc.(Automated test, AppControl)"
+ , BT_UNIT_TEST_TABLE_ETC},
{"Initialize All"
, BT_UNIT_TEST_FUNCTION_INITIALIZE_ALL},
{"FINISH"
tc_table_t tc_automated_test[] = {
/* Automated test Functions*/
- {"BACK"
- , BT_UNIT_TEST_FUNCTION_BACK},
- {"On/Off repeat test()"
- , BT_UNIT_TEST_FUNCTION_ON_OFF_REPEAT_TEST},
- {"On/Off repeat(1sec delay) test()"
- , BT_UNIT_TEST_FUNCTION_ON_OFF_REPEAT_TEST_1_SEC_DELAY},
- {"On/Off repeat(Nsec delay) test()"
- , BT_UNIT_TEST_FUNCTION_ON_OFF_REPEAT_TEST_N_SEC_DELAY},
+ {"BACK" , BT_UNIT_TEST_FUNCTION_BACK},
+ {"On/Off repeat test()" , BT_UNIT_TEST_FUNCTION_ON_OFF_REPEAT_TEST},
+ {"On/Off repeat(1sec delay) test()" , BT_UNIT_TEST_FUNCTION_ON_OFF_REPEAT_TEST_1_SEC_DELAY},
+ {"On/Off repeat(Nsec delay) test()" , BT_UNIT_TEST_FUNCTION_ON_OFF_REPEAT_TEST_N_SEC_DELAY},
+ {"AppControl 2.3 BT onoff" , BT_UNIT_TEST_FUNCTION_APP_CONTROL_2_3_BT_ONOFF},
+ {"AppControl 2.3 BT Visibility" , BT_UNIT_TEST_FUNCTION_APP_CONTROL_2_3_BT_VISIBILITY},
+ {"AppControl 2.4 BT onoff" , BT_UNIT_TEST_FUNCTION_APP_CONTROL_2_4_BT_ONOFF},
+ {"AppControl 2.4 BT Visibility" , BT_UNIT_TEST_FUNCTION_APP_CONTROL_2_4_BT_VISIBILITY},
+ {"Check feature(ex.tizen.org/feature/network.bluetooth)" , BT_UNIT_TEST_FUNCTION_CHECK_FEATURE},
+
+ {"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 = tc_pbap_client;
break;
#endif
- case BT_UNIT_TEST_TABLE_AUTOMATED_TEST:
+ case BT_UNIT_TEST_TABLE_ETC:
if (input_automated_test_delay == true) {
TC_PRT("Input the delay for automated"
"test.(e.g., 10)\n\n");
return;
}
+ TC_PRT(" ");
TC_PRT("%s Adv %d Scan resp %d RSSI %d Addr_type %d",
info->remote_address, info->adv_data_len,
info->scan_data_len, info->rssi,
}
case BT_UNIT_TEST_TABLE_SOCKET: {
switch (test_id) {
+ case BT_UNIT_TEST_FUNCTION_SOCKET_CREATE_RFCOMM_CUSTOM_UUID: {
+ 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_STRING;
+ }
+
+ 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';
+ strcpy(g_test_param.params[param_index - 1], param);
+ }
+
+ if (param_index == g_test_param.param_count) {
+ need_to_set_params = false;
+ test_input_callback((void *)test_id);
+ param_index = 0;
+ return 0;
+ }
+
+ TC_PRT("Input param(%d) type:%s", param_index + 1, param_type);
+ param_index++;
+ break;
+ }
+ case BT_UNIT_TEST_FUNCTION_SOCKET_CONNECT_RFCOMM_CUSTOM_UUID: {
+ 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_STRING;
+ }
+
+ 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';
+ strcpy(g_test_param.params[param_index - 1], param);
+ }
+
+ if (param_index == g_test_param.param_count) {
+ need_to_set_params = false;
+ test_input_callback((void *)test_id);
+ param_index = 0;
+ return 0;
+ }
+
+ TC_PRT("Input param(%d) type:%s", param_index + 1, param_type);
+ param_index++;
+ break;
+ }
case BT_UNIT_TEST_FUNCTION_SOCKET_SEND_DATA: {
if (param_index == 0) {
g_test_param.param_count = 1;
break;
}
#endif
+ case BT_UNIT_TEST_TABLE_ETC: {
+ switch (test_id) {
+ case BT_UNIT_TEST_FUNCTION_CHECK_FEATURE: {
+ 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_STRING;
+ }
+
+ 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';
+ strcpy(g_test_param.params[param_index - 1], param);
+ }
+
+ if (param_index == g_test_param.param_count) {
+ need_to_set_params = false;
+ test_input_callback((void *)test_id);
+ param_index = 0;
+ return 0;
+ }
+
+ TC_PRT("Input feature string(ex. tizen.org/feature/network.bluetooth)");
+ param_index++;
+ break;
+ }
+ default:
+ TC_PRT("There is no param to set\n");
+ need_to_set_params = false;
+ break;
+ }
+
+ break;
+ }
default:
TC_PRT("There is no param to set\n");
need_to_set_params = false;
case BT_UNIT_TEST_FUNCTION_SOCKET_CREATE_RFCOMM_CUSTOM_UUID: {
int socket_fd = 0;
- ret = bt_socket_create_rfcomm(custom_uuid, &socket_fd);
+ if (g_test_param.param_count > 0) {
+ ret = bt_socket_create_rfcomm(g_test_param.params[0], &socket_fd);
+
+ __bt_free_test_param(&g_test_param);
+ } else {
+ ret = bt_socket_create_rfcomm(custom_uuid, &socket_fd);
+ }
+
if (ret < BT_ERROR_NONE) {
TC_PRT("returns %s\n", __bt_get_error_message(ret));
} else {
TC_PRT("returns %s\n", __bt_get_error_message(ret));
break;
case BT_UNIT_TEST_FUNCTION_SOCKET_CONNECT_RFCOMM_CUSTOM_UUID: {
- ret = bt_socket_connect_rfcomm(remote_addr, custom_uuid);
+ if (g_test_param.param_count > 0) {
+ ret = bt_socket_connect_rfcomm(remote_addr, g_test_param.params[0]);
+
+ __bt_free_test_param(&g_test_param);
+ } else {
+ ret = bt_socket_connect_rfcomm(remote_addr, custom_uuid);
+ }
+
TC_PRT("returns %s\n", __bt_get_error_message(ret));
break;
}
break;
}
#endif
- case BT_UNIT_TEST_TABLE_AUTOMATED_TEST: {
+ case BT_UNIT_TEST_TABLE_ETC: {
static unsigned int delay = 0;
bt_onoff_cnt = 0;
bt_onoff_cnt_success = 0;
bt_adapter_disable();
break;
}
+ case BT_UNIT_TEST_FUNCTION_APP_CONTROL_2_3_BT_ONOFF: {
+ app_control_h service = NULL;
+
+ app_control_create(&service);
+ app_control_set_operation(service, APP_CONTROL_OPERATION_EDIT);
+ app_control_set_mime(service, "application/x-bluetooth-on-off");
+
+ ret = app_control_send_launch_request(service, NULL, NULL);
+ TC_PRT("returns %d", ret);
+
+ app_control_destroy(service);
+
+ break;
+ }
+ case BT_UNIT_TEST_FUNCTION_APP_CONTROL_2_3_BT_VISIBILITY: {
+ app_control_h service = NULL;
+
+ app_control_create(&service);
+ app_control_set_operation(service, APP_CONTROL_OPERATION_EDIT);
+ app_control_set_mime(service, "application/x-bluetooth-visibility");
+
+ ret = app_control_send_launch_request(service, NULL, NULL);
+ TC_PRT("returns %d", ret);
+
+ app_control_destroy(service);
+
+ break;
+ }
+ case BT_UNIT_TEST_FUNCTION_APP_CONTROL_2_4_BT_ONOFF: {
+ app_control_h service = NULL;
+
+ app_control_create(&service);
+ app_control_set_operation(service, APP_CONTROL_OPERATION_SETTING_BT_ENABLE);
+
+ ret = app_control_send_launch_request(service, NULL, NULL);
+ TC_PRT("returns %d", ret);
+
+ app_control_destroy(service);
+
+ break;
+ }
+ case BT_UNIT_TEST_FUNCTION_APP_CONTROL_2_4_BT_VISIBILITY: {
+ app_control_h service = NULL;
+
+ app_control_create(&service);
+ app_control_set_operation(service, APP_CONTROL_OPERATION_SETTING_BT_VISIBILITY);
+
+ ret = app_control_send_launch_request(service, NULL, NULL);
+ TC_PRT("returns %d", ret);
+
+ app_control_destroy(service);
+
+ break;
+ }
+ case BT_UNIT_TEST_FUNCTION_CHECK_FEATURE: {
+ int ret;
+ bool is_supported = false;
+
+ if (g_test_param.param_count > 0) {
+ ret = system_info_get_custom_bool(
+ g_test_param.params[0], &is_supported);
+ if (ret != 0)
+ TC_PRT("returns %d", ret);
+ TC_PRT("%s is %s", g_test_param.params[0],
+ is_supported ? "true" : "false");
+ __bt_free_test_param(&g_test_param);
+ } else {
+ ret = system_info_get_custom_bool(
+ "tizen.org/feature/network.bluetooth", &is_supported);
+ if (ret != 0)
+ TC_PRT("returns %d", ret);
+ TC_PRT("tizen.org/feature/network.bluetooth is %s",
+ is_supported ? "true" : "false");
+ }
+
+ 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;
}
} else {
if (buf[0] == '0' && buf[2] == 0) {
current_tc_table = BT_UNIT_TEST_TABLE_MAIN;
- } else if (current_tc_table == BT_UNIT_TEST_TABLE_AUTOMATED_TEST
+ } else if (current_tc_table == BT_UNIT_TEST_TABLE_ETC
&& test_id == BT_UNIT_TEST_FUNCTION_ON_OFF_REPEAT_TEST_N_SEC_DELAY
&& input_automated_test_delay == false) {
input_automated_test_delay = true;
BT_UNIT_TEST_TABLE_HF,
BT_UNIT_TEST_TABLE_PBAP_CLIENT,
#endif
- BT_UNIT_TEST_TABLE_AUTOMATED_TEST,
+ BT_UNIT_TEST_TABLE_ETC,
BT_UNIT_TEST_FUNCTION_INITIALIZE_ALL,
BT_UNIT_TEST_TABLE_FINISH = 0xFF,
} bt_unit_test_table_e;
BT_UNIT_TEST_FUNCTION_ON_OFF_REPEAT_TEST = 1,
BT_UNIT_TEST_FUNCTION_ON_OFF_REPEAT_TEST_1_SEC_DELAY,
BT_UNIT_TEST_FUNCTION_ON_OFF_REPEAT_TEST_N_SEC_DELAY,
+ BT_UNIT_TEST_FUNCTION_APP_CONTROL_2_3_BT_ONOFF,
+ BT_UNIT_TEST_FUNCTION_APP_CONTROL_2_3_BT_VISIBILITY,
+ 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_ACTIVATE_FLAG_TO_SET_PARAMETERS = 0XFF,
} bt_unit_test_function_e;
+/**
+ * AMS EntityID type.
+ */
+typedef enum {
+ BT_AMS_ENTITY_ID_PLAYER = 0x00, /**< Player */
+ BT_AMS_ENTITY_ID_QUEUE = 0x01, /**< Queue */
+ BT_AMS_ENTITY_ID_TRACK = 0x02 /**< Track */
+} bt_ams_entity_id_type_e;
+
+/**
+ * AMS Entity Player's Attribute IDs type.
+ */
+typedef enum {
+ BT_AMS_PLAYER_ATTR_ID_NAME = 0x00, /**< PlayerAttributeIDName */
+ BT_AMS_PLAYER_ATTR_ID_PLAYBACK_INFO = 0x01, /**< PlayerAttributeIDPlaybackInfo */
+ BT_AMS_PLAYER_ATTR_ID_VOLUME = 0x02 /**< PlayerAttributeIDVolume */
+} bt_ams_player_attr_id_type_e;
+
+/**
+ * AMS Entity Queue's Attribute IDs type.
+ */
+typedef enum {
+ BT_AMS_QUEUE_ATTR_ID_INDEX = 0x00, /**< QueueAttributeIDIndex */
+ BT_AMS_QUEUE_ATTR_ID_COUNT = 0x01, /**< QueueAttributeIDCount */
+ BT_AMS_QUEUE_ATTR_ID_SHUFFLE_MODE = 0x02, /**< QueueAttributeIDShuffleMode */
+ BT_AMS_QUEUE_ATTR_ID_REPEAT_MODE = 0x03 /**< QueueAttributeIDRepeatMode */
+} bt_ams_queue_attr_id_type_e;
+
+/**
+ * AMS Entity Track's Attribute IDs type.
+ */
+typedef enum {
+ BT_AMS_TRACK_ATTR_ID_ARTIST = 0x00, /**< TrackAttributeIDArtist */
+ BT_AMS_TRACK_ATTR_ID_ALBUM = 0x01, /**< TrackAttributeIDAlbum */
+ BT_AMS_TRACK_ATTR_ID_TITLE = 0x02, /**< TrackAttributeIDTitle */
+ BT_AMS_TRACK_ATTR_ID_DURATION = 0x03 /**< TrackAttributeIDDuration */
+} bt_ams_track_attr_id_type_e;
+
typedef struct {
const char *tc_name;
int tc_code;