INSTALL(TARGETS ${PROJECT_NAME} DESTINATION bin)
-#ADD_SUBDIRECTORY(media-control)
-#ADD_SUBDIRECTORY(telephony)
ADD_SUBDIRECTORY(gatt-test)
-#ADD_SUBDIRECTORY(handsfree)
ADD_SUBDIRECTORY(le-adv)
+++ /dev/null
-CMAKE_MINIMUM_REQUIRED(VERSION 2.6)
-PROJECT(bluetooth-hf-test C)
-
-SET(SRCS bluetooth-hf-test.c)
-
-SET(PREFIX ${CMAKE_INSTALL_PREFIX})
-
-INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/bt-api/)
-
-INCLUDE(FindPkgConfig)
-pkg_check_modules(package REQUIRED dlog dbus-1 glib-2.0 gthread-2.0 gobject-2.0)
-
-FOREACH(flag ${package_CFLAGS})
- SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} ${flag}")
-ENDFOREACH(flag)
-
-SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${EXTRA_CFLAGS}")
-
-FIND_PROGRAM(UNAME NAMES uname)
-EXEC_PROGRAM("${UNAME}" ARGS "-m" OUTPUT_VARIABLE "ARCH")
-IF("${ARCH}" STREQUAL "arm")
- ADD_DEFINITIONS("-DTARGET")
- MESSAGE("add -DTARGET")
-ENDIF("${ARCH}" STREQUAL "arm")
-
-ADD_DEFINITIONS("-DPREFIX=\"${CMAKE_INSTALL_PREFIX}\"")
-ADD_DEFINITIONS("-DFACTORYFS=\"$ENV{FACTORYFS}\"")
-
-ADD_EXECUTABLE(${PROJECT_NAME} ${SRCS})
-TARGET_LINK_LIBRARIES(${PROJECT_NAME} ${package_LDFLAGS} -L${CMAKE_SOURCE_DIR}/bt-api/ -lbluetooth-api)
-
-INSTALL(TARGETS ${PROJECT_NAME} DESTINATION bin)
+++ /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.
- *
- */
-
-/**
- * @file bluetooth-telephony-test.c
- * @brief This is the source file for bluetooth telephony test suite.
- */
-
-#include <stdio.h>
-#include <string.h>
-#include <glib.h>
-#include <dbus/dbus-glib.h>
-#include <pthread.h>
-
-#include "bluetooth-audio-api.h"
-#include "bluetooth-api.h"
-
-#define PRT(format, args...) printf("%s:%d() "format, \
- __FUNCTION__, __LINE__, ##args)
-#define TC_PRT(format, args...) PRT(format"\n", ##args)
-
-GMainLoop *main_loop = NULL;
-static int timeout_status = 0;
-#define DEFAULT_CALL_ID 1
-/*Change this number with Testing SIM*/
-#define TEST_NUMBER "9980785507"
-#define BLUETOOTH_HF_SPEAKER_GAIN 2
-
-typedef struct {
- const char *tc_name;
- int tc_code;
-} tc_table_t;
-
-tc_table_t tc_table[] = {
- /*HF Application*/
- {"bluetooth_hf_init", 1},
- {"bluetooth_hf_deinit", 2},
- {"Answer Call", 3},
- {"Terminate Call", 4},
- {"Initiate Call", 5},
- {"Last number Redial ", 6},
- {"(PTS) Connect last bonded device", 7},
- {"Disconnect", 8},
- {"(PTS) Voice Recognition Enable", 9},
- {"Voice RecognitionDisable", 10},
- {"SCO disconnect", 11},
- {"Speaker gain", 12},
- {"Dual Tone mulitple frequency", 13},
- {"Send AT+XSAT=appid command", 14},
- {"Release All Call(CHLD=0)", 15},
- {"Release and Accept(CHLD=1)", 16},
- {"Swap call (CHLD=2)", 17},
- {"Join Call (CHLD=3)", 18},
- {"(PTS) Initiate Codec based SCO", 19},
- {"(PTS) Unbond all devices", 20},
- {"Get Current Codec", 21},
- {"Get Call List", 22},
- {"Get Audio Connected Status", 23},
- {"Is Handsfree Connected?", 24},
-
- /* -----------------------------------------*/
- {"Finish", 0x00ff},
- {NULL, 0x0000},
-
-};
-
-#define tc_result(success, tc_index) \
- TC_PRT("Test case [%d - %s] %s", tc_table[tc_index].tc_code, \
- tc_table[tc_index].tc_name, \
- ((success == TC_PASS) ? "Success" : "Failed"));
-
-void tc_usage_print(void)
-{
- int i = 0;
-
- while (tc_table[i].tc_name) {
- if (tc_table[i].tc_code != 0x00ff) {
- TC_PRT("Key %d : usage %s", tc_table[i].tc_code,
- tc_table[i].tc_name);
- } else {
- TC_PRT("Key %d : usage %s\n\n", 0x00ff,
- tc_table[i].tc_name);
- }
-
- i++;
- }
-}
-void bt_event_callback(int event, bluetooth_event_param_t *param, void *user_data)
-{
-
-}
-
-void hf_event_handler(int event, void *data, void *user_data)
-{
- bt_hf_event_param_t *hf_event;
-
- if (data == NULL)
- return;
- hf_event = data;
-
- TC_PRT("HF event : [0x%04x]", event);
-
- switch (event) {
- case BLUETOOTH_EVENT_HF_CONNECTED:
- TC_PRT("BLUETOOTH_EVENT_HF_CONNECTED");
- break;
-
- case BLUETOOTH_EVENT_HF_DISCONNECTED:
- TC_PRT("BLUETOOTH_EVENT_HF_DISCONNECTED");
- break;
-
- case BLUETOOTH_EVENT_HF_AUDIO_CONNECTED:
- TC_PRT("BLUETOOTH_EVENT_HF_AUDIO_CONNECTED");
- break;
-
- case BLUETOOTH_EVENT_HF_AUDIO_DISCONNECTED:
- TC_PRT("BLUETOOTH_EVENT_HF_AUDIO_DISCONNECTED");
- break;
-
- case BLUETOOTH_EVENT_HF_RING_INDICATOR:
- TC_PRT("BLUETOOTH_EVENT_HF_RING_INDICATOR");
- if (hf_event->param_data)
- TC_PRT("Phone number %s", hf_event->param_data);
- break;
-
- case BLUETOOTH_EVENT_HF_CALL_WAITING:
- TC_PRT("BLUETOOTH_EVENT_HF_CALL_WAITING");
- if (hf_event->param_data)
- TC_PRT("Waiting Phone number %s", hf_event->param_data);
- break;
-
- case BLUETOOTH_EVENT_HF_CALL_TERMINATED:
- TC_PRT("BLUETOOTH_EVENT_HF_CALL_TERMINATED");
- break;
-
- case BLUETOOTH_EVENT_HF_CALL_STARTED:
- TC_PRT("BLUETOOTH_EVENT_HF_CALL_STARTED");
- break;
-
- case BLUETOOTH_EVENT_HF_CALL_ENDED:
- TC_PRT("BLUETOOTH_EVENT_HF_CALL_ENDED");
- break;
-
- case BLUETOOTH_EVENT_HF_CALL_UNHOLD:
- TC_PRT("BLUETOOTH_EVENT_HF_CALL_UNHOLD");
- break;
-
- case BLUETOOTH_EVENT_HF_CALL_SWAPPED:
- TC_PRT("BLUETOOTH_EVENT_HF_CALL_SWAPPED");
- break;
-
- case BLUETOOTH_EVENT_HF_CALL_ON_HOLD:
- TC_PRT("BLUETOOTH_EVENT_HF_CALL_ON_HOLD");
- break;
-
- case BLUETOOTH_EVENT_HF_CALL_STATUS:
- {
- TC_PRT("BLUETOOTH_EVENT_HF_CALL_STATUS");
- int i;
- bt_hf_call_list_s * call_list = hf_event->param_data;
- bt_hf_call_status_info_t **call_info;
- TC_PRT("call_list length : %d ", call_list->count);
- call_info = g_malloc0(sizeof(bt_hf_call_status_info_t *) *
- call_list->count);
- bluetooth_hf_get_call_list(call_list->list, call_info);
-
- for (i = 0; i < call_list->count; i++) {
- TC_PRT("Phone Number : %s ", call_info[i]->number);
- TC_PRT("Direction (in -1, out 0 : %d ", call_info[i]->direction);
- TC_PRT("Call status : %d ", call_info[i]->status);
- TC_PRT("MultyParty : %d ", call_info[i]->mpart);
- TC_PRT("Call ID : %d ", call_info[i]->idx);
- }
- g_free(call_info);
- break;
- }
- case BLUETOOTH_EVENT_HF_VOICE_RECOGNITION_ENABLED:
- TC_PRT("BLUETOOTH_EVENT_HF_VOICE_RECOGNITION_ENABLED");
- break;
-
- case BLUETOOTH_EVENT_HF_VOICE_RECOGNITION_DISABLED:
- TC_PRT("BLUETOOTH_EVENT_HF_VOICE_RECOGNITION_DISABLED");
- break;
-
- case BLUETOOTH_EVENT_HF_VOLUME_SPEAKER:
- {
- unsigned int *value;
- value = hf_event->param_data;
- TC_PRT("BLUETOOTH_EVENT_HF_VOLUME_SPEAKER - value = %d", *value);
- break;
- }
- case BLUETOOTH_EVENT_HF_VENDOR_DEP_CMD:
- {
- bluetooth_vendor_dep_at_cmd_t *cmd = hf_event->param_data;
- TC_PRT("BLUETOOTH_EVENT_HF_VENDOR_DEP_CMD - appid = %d, msg = %s",
- cmd->app_id, cmd->message);
- break;
- }
-
- default:
- break;
- }
-}
-
-static int __bt_unbond_all_bonded_devices(void)
-{
- int ret;
- int i;
- bluetooth_device_info_t *ptr;
-
- GPtrArray *dev_list = NULL;
- dev_list = g_ptr_array_new();
- TC_PRT("g pointer arrary count : [%d]", dev_list->len);
-
- ret = bluetooth_get_bonded_device_list(&dev_list);
- if (ret < 0) {
- TC_PRT("failed bluetooth_get_bonded_device_list");
- g_ptr_array_free(dev_list, TRUE);
- return 1;
- }
- TC_PRT("g pointer arrary count : [%d]", dev_list->len);
-
- if (dev_list->len == 0) {
- TC_PRT("No paired device found");
- g_ptr_array_free(dev_list, TRUE);
- return 1;
- }
-
- for (i = 0; i < dev_list->len; i++) {
- ptr = g_ptr_array_index(dev_list, i);
- if (ptr == NULL)
- continue;
- TC_PRT("[%d] Unbond %2.2X:%2.2X:%2.2X:%2.2X:%2.2X:%2.2X", i + 1,
- ptr->device_address.addr[0], ptr->device_address.addr[1],
- ptr->device_address.addr[2], ptr->device_address.addr[3],
- ptr->device_address.addr[4], ptr->device_address.addr[5]);
- bluetooth_unbond_device(&ptr->device_address);
-
- }
- g_ptr_array_foreach(dev_list, (GFunc)g_free, NULL);
- g_ptr_array_free(dev_list, TRUE);
- return 0;
-
-}
-static int __bt_get_last_bonded_device(bluetooth_device_address_t *device_address)
-{
- int ret;
- int i;
- bluetooth_device_info_t *ptr;
-
- GPtrArray *dev_list = NULL;
- dev_list = g_ptr_array_new();
- TC_PRT("g pointer arrary count : [%d]", dev_list->len);
-
- ret = bluetooth_get_bonded_device_list(&dev_list);
- if (ret < 0) {
- TC_PRT("failed bluetooth_get_bonded_device_list");
- g_ptr_array_free(dev_list, TRUE);
- return 1;
- }
- TC_PRT("g pointer arrary count : [%d]", dev_list->len);
-
- if (dev_list->len == 0) {
- TC_PRT("No paired device found");
- g_ptr_array_free(dev_list, TRUE);
- return 1;
- }
-
- for (i = 0; i < dev_list->len; i++) {
- ptr = g_ptr_array_index(dev_list, i);
- if (ptr == NULL)
- continue;
- TC_PRT("[%d] %2.2X:%2.2X:%2.2X:%2.2X:%2.2X:%2.2X", i + 1,
- ptr->device_address.addr[0], ptr->device_address.addr[1],
- ptr->device_address.addr[2], ptr->device_address.addr[3],
- ptr->device_address.addr[4], ptr->device_address.addr[5]);
- memcpy(device_address->addr, ptr->device_address.addr,
- sizeof(bluetooth_device_address_t));
- }
- g_ptr_array_foreach(dev_list, (GFunc)g_free, NULL);
- g_ptr_array_free(dev_list, TRUE);
- return 0;
-
-}
-
-int test_input_callback(void *data)
-{
- int ret;
- int test_id = (int)data;
-
- switch (test_id) {
- case 0x00ff:
- TC_PRT("Finished");
- g_main_loop_quit(main_loop);
- break;
-
- case 1:
- bluetooth_hf_init(hf_event_handler, NULL);
- break;
- case 2:
- bluetooth_hf_deinit();
- break;
- case 3:
- bluetooth_hf_answer_call();
- break;
- case 4:
- bluetooth_hf_terminate_call();
- break;
- case 5:
- ret = bluetooth_hf_initiate_call(TEST_NUMBER);
- TC_PRT("ret = %d", ret);
- break;
- case 6:
- bluetooth_hf_initiate_call(NULL);
- break;
- case 7:
- { bluetooth_device_address_t device_address = { {0} };
- ret = __bt_get_last_bonded_device(&device_address);
- if (ret != 0) {
- TC_PRT("Error in getting last bonded device.....");
- return FALSE;
- }
-
- bluetooth_hf_connect(&device_address);
- break;
- }
- case 8:
- {
- bluetooth_device_address_t device_address = { {0} };
- ret = __bt_get_last_bonded_device(&device_address);
- if (ret != 0) {
- TC_PRT("Error in getting last bonded device.....");
- return FALSE;
- }
-
- bluetooth_hf_disconnect(&device_address);
- break;
- }
- case 9:
- bluetooth_hf_voice_recognition(1);
- break;
-
- case 10:
- bluetooth_hf_voice_recognition(0);
- break;
- case 11:
- bluetooth_hf_audio_disconnect();
- break;
- case 12:
- bluetooth_hf_set_speaker_gain(BLUETOOTH_HF_SPEAKER_GAIN);
- break;
- case 13:
- bluetooth_hf_send_dtmf("1");
- break;
- case 14:
- /* get the Call Time from AG for DC lauch */
- bluetooth_hf_send_xsat_cmd(11, "Q_CT,1,01025561613");
- break;
- case 15:
- bluetooth_hf_release_all_call();
- break;
- case 16:
- bluetooth_hf_release_and_accept();
- break;
- case 17:
- bluetooth_hf_swap_call();
- break;
- case 18:
- bluetooth_hf_join_call();
- break;
- case 19:
- system("dbus-send --system --print-reply --dest=org.bluez.hf_agent /org/bluez/handsfree_agent org.tizen.HfApp.SendAtCmd string:AT+BCC");
- break;
- case 20:
- {
- ret = bluetooth_register_callback(bt_event_callback, NULL);
- ret = __bt_unbond_all_bonded_devices();
- if (ret != 0) {
- TC_PRT("Error in getting last bonded device.....");
- return FALSE;
- }
-
- break;
- }
- case 21:
- {
- unsigned int current_codec;
- bluetooth_hf_get_codec(¤t_codec);
- if (current_codec == BLUETOOTH_CODEC_ID_CVSD)
- TC_PRT("current_codec is CVSD");
- else
- TC_PRT("current_codec is. MSBC");
- break;
- }
- case 22:
- {
- int i;
- bt_hf_call_list_s * call_list = NULL;
- bt_hf_call_status_info_t **call_info = NULL;
- bluetooth_hf_request_call_list(&call_list);
- if (call_list == NULL) {
- TC_PRT("call_list is NULL");
- break;
- }
- TC_PRT("call_list length : %d ", call_list->count);
- call_info = g_malloc0(sizeof(bt_hf_call_status_info_t *) *
- call_list->count);
- bluetooth_hf_get_call_list(call_list->list, call_info);
-
- for (i = 0; i < call_list->count; i++) {
- TC_PRT("Phone Number : %s ", call_info[i]->number);
- TC_PRT("Direction (in -1, out 0 : %d ", call_info[i]->direction);
- TC_PRT("Call status : %d ", call_info[i]->status);
- TC_PRT("MultyParty : %d ", call_info[i]->mpart);
- TC_PRT("Call ID : %d ", call_info[i]->idx);
- }
- g_free(call_info);
- bluetooth_hf_free_call_list(call_list);
- break;
- }
- case 23:
- {
- unsigned int sco_audio_connected;
- bluetooth_hf_get_audio_connected(&sco_audio_connected);
- if (sco_audio_connected == BLUETOOTH_HF_AUDIO_CONNECTED)
- TC_PRT("SCO Audio is connected");
- else
- TC_PRT("SCO Audio is disconnected");
- break;
- }
- case 24:
- {
- gboolean hf_connected;
- bluetooth_hf_is_connected(&hf_connected);
- if (hf_connected == BLUETOOTH_HF_AUDIO_CONNECTED)
- TC_PRT("HF is connected");
- else
- TC_PRT("HF is disconnected");
- break;
- }
- default:
- break;
- }
-
- return 0;
-}
-
-void startup()
-{
- TC_PRT("bluetooth framework TC startup");
-
- dbus_threads_init_default();
-
- main_loop = g_main_loop_new(NULL, FALSE);
-}
-
-void cleanup()
-{
- TC_PRT("bluetooth framework TC cleanup");
- if (main_loop != NULL) {
- g_main_loop_unref(main_loop);
- }
-}
-
-static gboolean key_event_cb(GIOChannel *chan, GIOCondition cond ,
- gpointer data)
-{
- char buf[10] = {0};
-
- unsigned int len = 0;
- int test_id;
- memset(buf, 0, sizeof(buf));
-
- if (g_io_channel_read(chan, buf, sizeof(buf), &len) !=
- G_IO_ERROR_NONE) {
-
- printf("IO Channel read error");
- return FALSE;
-
- }
- printf("%s\n", buf);
- tc_usage_print();
-
- test_id = atoi(buf);
-
- if (test_id)
- g_idle_add(test_input_callback, (void *)test_id);
-
- return TRUE;
-}
-
-int main()
-{
- startup();
-
- GIOChannel *key_io;
- key_io = g_io_channel_unix_new(fileno(stdin));
-
- g_io_add_watch(key_io, G_IO_IN | G_IO_HUP | G_IO_ERR | G_IO_NVAL,
- key_event_cb, NULL);
- g_io_channel_unref(key_io);
-
-
- g_main_loop_run(main_loop);
-
- cleanup();
- return 0;
-}
+++ /dev/null
-CMAKE_MINIMUM_REQUIRED(VERSION 2.6)
-PROJECT(bluetooth-media-control-test C)
-
-SET(SRCS bluetooth-media-control-test.c)
-
-SET(PREFIX ${CMAKE_INSTALL_PREFIX})
-
-INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/bt-api)
-
-INCLUDE(FindPkgConfig)
-pkg_check_modules(package REQUIRED dlog dbus-1 glib-2.0 gthread-2.0 gobject-2.0)
-
-FOREACH(flag ${package_CFLAGS})
- SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} ${flag}")
-ENDFOREACH(flag)
-
-SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${EXTRA_CFLAGS}")
-
-FIND_PROGRAM(UNAME NAMES uname)
-EXEC_PROGRAM("${UNAME}" ARGS "-m" OUTPUT_VARIABLE "ARCH")
-IF("${ARCH}" STREQUAL "arm")
- ADD_DEFINITIONS("-DTARGET")
- MESSAGE("add -DTARGET")
-ENDIF("${ARCH}" STREQUAL "arm")
-
-ADD_DEFINITIONS("-DPREFIX=\"${CMAKE_INSTALL_PREFIX}\"")
-ADD_DEFINITIONS("-DFACTORYFS=\"$ENV{FACTORYFS}\"")
-
-ADD_EXECUTABLE(${PROJECT_NAME} ${SRCS})
-TARGET_LINK_LIBRARIES(${PROJECT_NAME} ${package_LDFLAGS} -L${CMAKE_SOURCE_DIR}/bt-api -lbluetooth-api)
-
-INSTALL(TARGETS ${PROJECT_NAME} DESTINATION bin)
+++ /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 <stdio.h>
-#include <stdlib.h>
-#include "bluetooth-media-control.h"
-
-#include <glib.h>
-#include <dbus/dbus-glib.h>
-#include <dbus/dbus-glib-lowlevel.h>
-
-#define MEDIA_ATRRIBUTE_LENGTH 256
-
-media_player_settings_t player_settings = {0x00, 0x00, 0x00, 0x00, 0x01, 1111};
-media_metadata_attributes_t metadata = {"Test Track", "Chethan", "TNC", "Tumkur", 1, 1, 14400};
-
-void static __choose_metadata_settings(void)
-{
- int cmd;
- media_metadata_attributes_t metadata = {0,};
-
- while (1) {
- printf("\nPlease enter\n");
- printf("\t0: return to main menu\n");
- printf("\t1: Meta data settings\n");
- printf("\tEnter your choice [ ]\b\b");
-
- scanf("%d", &cmd);
-
- switch (cmd) {
- case 0:
- return;
- case 1: /* Title */
-
- metadata.title = calloc(1, MEDIA_ATRRIBUTE_LENGTH);
- metadata.artist = calloc(1, MEDIA_ATRRIBUTE_LENGTH);
- metadata.album = calloc(1, MEDIA_ATRRIBUTE_LENGTH);
- metadata.genre = calloc(1, MEDIA_ATRRIBUTE_LENGTH);
-
- printf("Enter the \"Track\" name\n");
- scanf("%s", (char *)metadata.title);
-
- printf(" Enter the \"Artist\" name\n");
- scanf("%s", (char *)metadata.artist);
-
- printf(" Enter the \"Album\" name\n");
- scanf("%s", (char *)metadata.album);
-
- printf(" Enter the \"Genre\" \n");
- scanf("%s", (char *)metadata.genre);
-
- printf(" Enter the \" Totol NumberOfTracks\" \n");
- scanf("%d", &metadata.total_tracks);
-
- printf(" Enter the \" Track Number\" \n");
- scanf("%d", &metadata.number);
-
- printf(" Enter the \"Duration\" \n");
- scanf("%d", &metadata.duration);
- break;
- default:
- break;
- }
- bluetooth_media_player_change_track(&metadata);
-
- if (NULL != metadata.title) {
- free((void *)metadata.title);
- metadata.title = NULL;
- }
- if (NULL != metadata.artist) {
- free((void *)metadata.artist);
- metadata.artist = NULL;
- }
- if (NULL != metadata.album) {
- free((void *)metadata.album);
- metadata.album = NULL;
- }
- if (NULL != metadata.genre) {
- free((void *)metadata.genre);
- metadata.genre = NULL;
- }
- }
-}
-
-void static __choose_player_settings(void)
-{
- int cmd;
- media_player_property_type type;
-
- while (1) {
- printf("\nPlease choose player settings\n");
- printf("\t0: return to main menu\n");
- printf("\t1. Equalizer\n");
- printf("\t2. Repeat\n");
- printf("\t3. Shuffle\n");
- printf("\t4. Scan \n");
- printf("\t5. Status \n");
- printf("\t6. Position \n");
- printf("\tEnter your choice [ ]\b\b");
-
- scanf("%d", &cmd);
-
- switch (cmd) {
- case 0:
- return;
- case 1: /* Equalizer */
- {
- printf("Possible Values - EQUALIZER_OFF = 0x00 and EQUALIZER_ON = 0x01,\n");
- scanf("%d", &player_settings.equalizer);
- type = EQUALIZER;
-
- bluetooth_media_player_change_property(type,
- (unsigned int)player_settings.equalizer);
-
- break;
- }
- case 2: /*Repeat */
- {
- printf(" Possible Values - REPEAT_MODE_OFF = 0x00, REPEAT_SINGLE_TRACK = 0x01 , \
- REPEAT_ALL_TRACK = 0x02, REPEAT_GROUP = 0x03\n");
- scanf("%d", &player_settings.repeat);
- type = REPEAT;
-
- bluetooth_media_player_change_property(type,
- (unsigned int)player_settings.repeat);
- break;
- }
- case 3: /* Shuffle */
- {
- printf(" Possible Values - SHUFFLE_MODE_OFF = 0x00, SHUFFLE_ALL_TRACK = 0x01 , \
- SHUFFLE_GROUP = 0x02\n");
- scanf("%d", &player_settings.shuffle);
- type = SHUFFLE;
-
- bluetooth_media_player_change_property(type,
- (unsigned int)player_settings.shuffle);
- break;
- }
- case 4: /* Scan */
- {
- printf(" Possible Values - SCAN_MODE_OFF = 0x00, SCAN_ALL_TRACK = 0x01 , \
- SCAN_GROUP = 0x02\n");
- scanf("%d", &player_settings.scan);
- type = SCAN;
-
- bluetooth_media_player_change_property(type,
- (unsigned int)player_settings.scan);
- break;
- }
- case 5: /* Status */
- {
- printf(" Possible Values - STATUS_PLAYING = 0x00, STATUS_STOPPED = 0x01 , \
- STATUS_PAUSED = 0x02,STATUS_FORWARD_SEEK = 0x03 \
- STATUS_REVERSE_SEEK = 0x04 STATUS_ERROR = 0x05\n");
- scanf("%d", &player_settings.status);
- type = STATUS;
-
- bluetooth_media_player_change_property(type,
- (unsigned int)player_settings.status);
- break;
- }
- case 6: /* Position */
- {
- printf("Enter the possible value: ");
- scanf("%d", &player_settings.position);
- type = POSITION;
-
- bluetooth_media_player_change_property(type,
- player_settings.position);
- break;
- }
- default:
- break;
- }
- }
-}
-
-int main()
-{
- GMainLoop *agent_loop;
- int cmd;
-
- agent_loop = g_main_loop_new(NULL, FALSE);
-
- printf("MP-AV test application started\n");
- while (1) {
- printf("\n\n\t0. Exit\n");
- printf("\t1. bluetooth_media_player_property_changed\n");
- printf("\t2. bluetooth_media_player_track_changed\n");
- printf("\tEnter your choice [ ]\b\b");
-
- scanf("%d", &cmd);
-
- switch (cmd) {
- case 0: /* exit the application */
- {
- exit(0);
- break;
- }
- case 1:
- {
- __choose_player_settings();
- break;
- }
- case 2:
- {
- __choose_metadata_settings();
- break;
- }
- }
- }
- printf("gmain loop enter\n");
- g_main_loop_run(agent_loop);
- printf("gmain loop leave\n");
- return 0;
-}
+++ /dev/null
-CMAKE_MINIMUM_REQUIRED(VERSION 2.6)
-PROJECT(bluetooth-telephony-test C)
-
-SET(SRCS bluetooth-telephony-test.c)
-
-SET(PREFIX ${CMAKE_INSTALL_PREFIX})
-
-INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/bt-api/)
-
-INCLUDE(FindPkgConfig)
-pkg_check_modules(package REQUIRED dlog dbus-glib-1 glib-2.0 gthread-2.0)
-
-FOREACH(flag ${package_CFLAGS})
- SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} ${flag}")
-ENDFOREACH(flag)
-
-SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${EXTRA_CFLAGS}")
-
-FIND_PROGRAM(UNAME NAMES uname)
-EXEC_PROGRAM("${UNAME}" ARGS "-m" OUTPUT_VARIABLE "ARCH")
-IF("${ARCH}" STREQUAL "arm")
- ADD_DEFINITIONS("-DTARGET")
- MESSAGE("add -DTARGET")
-ENDIF("${ARCH}" STREQUAL "arm")
-
-ADD_DEFINITIONS("-DPREFIX=\"${CMAKE_INSTALL_PREFIX}\"")
-ADD_DEFINITIONS("-DFACTORYFS=\"$ENV{FACTORYFS}\"")
-
-ADD_EXECUTABLE(${PROJECT_NAME} ${SRCS})
-TARGET_LINK_LIBRARIES(${PROJECT_NAME} ${package_LDFLAGS} -L${CMAKE_SOURCE_DIR}/bt-api/ -lbluetooth-api)
-
-INSTALL(TARGETS ${PROJECT_NAME} DESTINATION bin)
+++ /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.
- *
- */
-
-/**
- * @file bluetooth-telephony-test.c
- * @brief This is the source file for bluetooth telephony test suite.
- */
-
-#include <stdio.h>
-#include <string.h>
-#include <glib.h>
-#include <dbus/dbus-glib.h>
-#include <pthread.h>
-
-#include "bluetooth-telephony-api.h"
-
-
-#define PRT(format, args...) printf("%s:%d() "format, \
- __FUNCTION__, __LINE__, ##args)
-#define TC_PRT(format, args...) PRT(format"\n", ##args)
-
-GMainLoop *main_loop = NULL;
-static int timeout_status = 0;
-#define DEFAULT_CALL_ID 1
-/*Change this number with Testing SIM*/
-#define TEST_NUMBER "9986008917"
-
-typedef struct {
- const char *tc_name;
- int tc_code;
-} tc_table_t;
-
-tc_table_t tc_table[] = {
- /*Telephony Application*/
- {"bluetooth_telephony_init", 70},
- {"bluetooth_telephony_deinit", 71},
- {"Indicate Outgoing call", 72},
- {"Indicate Incoming call", 73},
- {"Speaker to Headphone", 74},
- {"Headphone to Speaker ", 75},
- {"Call End/Release", 76},
- {"Call Hold", 77},
- {"bluetooth_telephony_call_remote_ringing", 78},
- {"Call Swap", 79},
- {"Call Reject", 80},
- {"Call Answer", 81},
- {"Is SCO channel connected", 82},
- {"Voice Recognition Start", 83},
- {"Voice Recognition Stop", 84},
- {"NREC Status", 85},
- {"WBS Status", 86},
- {"Vendor dep AT CMD [+XSAT: 11,DUAL,DUAL]", 87},
-
- /* -----------------------------------------*/
- {"Finish", 0x00ff},
- {NULL, 0x0000},
-
-};
-
-#define tc_result(success, tc_index) \
- TC_PRT("Test case [%d - %s] %s", tc_table[tc_index].tc_code, \
- tc_table[tc_index].tc_name, \
- ((success == TC_PASS) ? "Success" : "Failed"));
-
-void tc_usage_print(void)
-{
- int i = 0;
-
- while (tc_table[i].tc_name) {
- if (tc_table[i].tc_code != 0x00ff) {
- TC_PRT("Key %d : usage %s", tc_table[i].tc_code,
- tc_table[i].tc_name);
- } else {
- TC_PRT("Key %d : usage %s\n\n", 0x00ff,
- tc_table[i].tc_name);
- }
-
- i++;
- }
-}
-
-void telephony_event_handler(int event, void *data, void *user_data)
-{
- telephony_event_param_t *bt_event;
-
- if (data == NULL)
- return;
- bt_event = data;
-
- TC_PRT("AG event : [0x%04x]", event);
-
- switch (event) {
- case BLUETOOTH_EVENT_TELEPHONY_ANSWER_CALL:
- TC_PRT("BLUETOOTH_EVENT_TELEPHONY_ANSWER_CALL");
- bluetooth_telephony_call_answered(DEFAULT_CALL_ID, TRUE);
- break;
-
- case BLUETOOTH_EVENT_TELEPHONY_RELEASE_CALL:
- TC_PRT("BLUETOOTH_EVENT_TELEPHONY_RELEASE_CALL");
- bluetooth_telephony_call_end(DEFAULT_CALL_ID);
- break;
-
- case BLUETOOTH_EVENT_TELEPHONY_REJECT_CALL:
- bluetooth_telephony_call_end(DEFAULT_CALL_ID);
- break;
-
- case BLUETOOTH_EVENT_TELEPHONY_CHLD_0_RELEASE_ALL_HELD_CALL:
- TC_PRT("BLUETOOTH_EVENT_TELEPHONY_CHLD_0_RELEASE_ALL_HELD_CALL");
- break;
-
- case BLUETOOTH_EVENT_TELEPHONY_CHLD_1_RELEASE_ALL_ACTIVE_CALL:
- TC_PRT("BLUETOOTH_EVENT_TELEPHONY_CHLD_1_RELEASE_ALL_ACTIVE_CALL");
- break;
-
- case BLUETOOTH_EVENT_TELEPHONY_CHLD_3_MERGE_CALL:
- TC_PRT("BLUETOOTH_EVENT_TELEPHONY_CHLD_3_MERGE_CALL");
- break;
-
- case BLUETOOTH_EVENT_TELEPHONY_CHLD_2_ACTIVE_HELD_CALL:
- TC_PRT("BLUETOOTH_EVENT_TELEPHONY_CHLD_2_ACTIVE_HELD_CALL");
- break;
-
- case BLUETOOTH_EVENT_TELEPHONY_SEND_DTMF:
- TC_PRT("BLUETOOTH_EVENT_TELEPHONY_SEND_DTMF");
- break;
-
- case BLUETOOTH_EVENT_TELEPHONY_CHLD_4_EXPLICIT_CALL_TRANSFER:
- TC_PRT("BLUETOOTH_EVENT_TELEPHONY_CHLD_4_EXPLICIT_CALL_TRANSFER");
- break;
-
- case BLUETOOTH_EVENT_TELEPHONY_NREC_CHANGED: {
- gboolean *nrec;
- TC_PRT("BLUETOOTH_EVENT_TELEPHONY_NREC_CHANGED");
- nrec = bt_event->param_data;
- TC_PRT("NREC status = [%d]", *nrec);
- break;
- case BLUETOOTH_EVENT_TELEPHONY_VENDOR_AT_CMD:
- TC_PRT("BLUETOOTH_EVENT_TELEPHONY_VENDOR_AT_CMD %s", bt_event->param_data);
- break;
- }
-
- default:
- break;
- }
-}
-
-int test_input_callback(void *data)
-{
- int test_id = (int)data;
-
- switch (test_id) {
- case 0x00ff:
- TC_PRT("Finished");
- g_main_loop_quit(main_loop);
- break;
-
- case 70:
- bluetooth_telephony_init(telephony_event_handler, NULL);
- break;
- case 71:
- bluetooth_telephony_deinit();
- break;
-
- case 72:
- bluetooth_telephony_indicate_outgoing_call(
- TEST_NUMBER, DEFAULT_CALL_ID, TRUE);
- break;
- case 73:
- bluetooth_telephony_indicate_incoming_call(
- TEST_NUMBER, TRUE);
- break;
- case 74:
- bluetooth_telephony_audio_open();
- break;
- case 75:
- bluetooth_telephony_audio_close();
- break;
- case 76:
- bluetooth_telephony_call_end(DEFAULT_CALL_ID);
- break;
- case 77:
- bluetooth_telephony_call_held(DEFAULT_CALL_ID);
- break;
- case 78:
- bluetooth_telephony_call_remote_ringing(
- DEFAULT_CALL_ID);
- break;
- case 79:
- TC_PRT("bluetooth_telephony_call_swapped \n");
- break;
- case 80:
- bluetooth_telephony_call_answered(
- DEFAULT_CALL_ID, FALSE);
- break;
- case 81:
- bluetooth_telephony_call_answered(
- DEFAULT_CALL_ID, TRUE);
- break;
-
- case 82: {
- int state;
-
- state = bluetooth_telephony_is_sco_connected();
-
- TC_PRT("State = %d \n", state);
- break;
- }
-
- case 83: {
- int ret = 0;
-
- TC_PRT("**********************\n");
- TC_PRT(" PLEASE SPEAK \n");
- TC_PRT("**********************\n");
-
- ret = bluetooth_telephony_start_voice_recognition();
-
- if (ret == BLUETOOTH_TELEPHONY_ERROR_NONE) {
- TC_PRT("No error\n");
- bluetooth_telephony_audio_open();
- }
- break;
- }
-
- case 84: {
- TC_PRT("Rcognition finished \n");
- bluetooth_telephony_audio_close();
- bluetooth_telephony_stop_voice_recognition();
- break;
- }
-
- case 85: {
- int ret;
- gboolean status = FALSE;
-
- ret = bluetooth_telephony_is_nrec_enabled(&status);
-
- if (ret != BLUETOOTH_TELEPHONY_ERROR_NONE)
- TC_PRT("Error getting NREC Status\n");
-
- TC_PRT("NREC status = %d\n", status);
- break;
- }
-
- case 86: {
- int ret;
- gboolean status = FALSE;
-
- ret = bluetooth_telephony_is_wbs_mode(&status);
-
- if (ret != BLUETOOTH_TELEPHONY_ERROR_NONE)
- TC_PRT("Error getting WBS Status\n");
-
- TC_PRT("WBS status = %d\n", status);
- break;
- }
- case 87: {
- int ret = 0;
-
- TC_PRT("Vendor dependent AT Command\n");
-
- ret = bluetooth_telephony_send_vendor_cmd("+XSAT: 11,DUAL,DUAL");
-
- if (ret == BLUETOOTH_TELEPHONY_ERROR_NONE) {
- TC_PRT("No error\n");
- }
- break;
- }
- default:
- break;
- }
-
- return 0;
-}
-
-void startup()
-{
- TC_PRT("bluetooth framework TC startup");
-
- dbus_threads_init_default();
-
- main_loop = g_main_loop_new(NULL, FALSE);
-}
-
-void cleanup()
-{
- TC_PRT("bluetooth framework TC cleanup");
- if (main_loop != NULL) {
- g_main_loop_unref(main_loop);
- }
-}
-
-static gboolean key_event_cb(GIOChannel *chan, GIOCondition cond ,
- gpointer data)
-{
- char buf[10] = {0};
-
- unsigned int len = 0;
- int test_id;
- memset(buf, 0, sizeof(buf));
-
- if (g_io_channel_read(chan, buf, sizeof(buf), &len) !=
- G_IO_ERROR_NONE) {
-
- printf("IO Channel read error");
- return FALSE;
-
- }
- printf("%s\n", buf);
- tc_usage_print();
-
- test_id = atoi(buf);
-
- if (test_id)
- g_idle_add(test_input_callback, (void *)test_id);
-
- return TRUE;
-}
-
-int main()
-{
- startup();
-
- GIOChannel *key_io;
- key_io = g_io_channel_unix_new(fileno(stdin));
-
- g_io_add_watch(key_io, G_IO_IN | G_IO_HUP | G_IO_ERR | G_IO_NVAL,
- key_event_cb, NULL);
- g_io_channel_unref(key_io);
-
-
- g_main_loop_run(main_loop);
-
- cleanup();
- return 0;
-}