From: Hyuk Lee Date: Mon, 18 Sep 2017 04:57:01 +0000 (+0900) Subject: Add the function for checking model name of Target X-Git-Tag: accepted/tizen/unified/20171123.065901~3 X-Git-Url: http://review.tizen.org/git/?p=platform%2Fcore%2Fconnectivity%2Fbluetooth-agent.git;a=commitdiff_plain;h=3b8805e12311da8f2516f918d9dd2fd37d3e3aaa Add the function for checking model name of Target Change-Id: I1b4ad87a7e0bdc02a866db2153df61b8e35ef1b2 Signed-off-by: Hyuk Lee --- diff --git a/ag-agent/bluetooth-ag-agent.c b/ag-agent/bluetooth-ag-agent.c index c1d9595..fe6bb3e 100644 --- a/ag-agent/bluetooth-ag-agent.c +++ b/ag-agent/bluetooth-ag-agent.c @@ -1633,10 +1633,14 @@ static bt_hfp_agent_error_t __bt_hfp_send_bcs_command(bt_ag_info_t *hs, uint32_t codec; struct ag_codec *data = NULL;; - if (hs->codec_info.remote_codecs & BT_MSBC_CODEC_MASK) - codec = BT_MSBC_CODEC_ID; - else + if (TIZEN_MODEL_NAME_TM1) { codec = BT_CVSD_CODEC_ID; + } else { + if (hs->codec_info.remote_codecs & BT_MSBC_CODEC_MASK) + codec = BT_MSBC_CODEC_ID; + else + codec = BT_CVSD_CODEC_ID; + } if (wbs_opts.wbs_enable == FALSE) codec = BT_CVSD_CODEC_ID; @@ -4364,12 +4368,22 @@ static void __bt_ag_agent_dbus_init(void) static uint32_t __bt_ag_agent_get_ag_features(void) { - uint32_t ag_features = BT_AG_FEATURE_EC_AND_NR | + uint32_t ag_features; + + if (TIZEN_MODEL_NAME_TM1) { + ag_features = BT_AG_FEATURE_EC_AND_NR | + BT_AG_FEATURE_REJECT_CALL | + BT_AG_FEATURE_ENHANCED_CALL_STATUS | + BT_AG_FEATURE_THREE_WAY_CALL | + BT_AG_FEATURE_EXTENDED_ERROR_RESULT_CODES; + } else { + ag_features = BT_AG_FEATURE_EC_AND_NR | BT_AG_FEATURE_REJECT_CALL | BT_AG_FEATURE_ENHANCED_CALL_STATUS | BT_AG_FEATURE_THREE_WAY_CALL | BT_AG_FEATURE_VOICE_RECOGNITION | BT_AG_FEATURE_EXTENDED_ERROR_RESULT_CODES; + } wbs_en = TRUE; #if defined(TIZEN_FEATURE_BT_HFP_AG) @@ -4411,7 +4425,7 @@ int main(void) int i; uint32_t ag_features; struct sigaction sa; - pthread_t thread_id; + pthread_t thread_id = 0; INFO_C("### Starting Bluetooth AG agent"); diff --git a/include/bluetooth-agent-profile.c b/include/bluetooth-agent-profile.c index fe1aeca..6a3d07b 100644 --- a/include/bluetooth-agent-profile.c +++ b/include/bluetooth-agent-profile.c @@ -24,3 +24,4 @@ #include "bluetooth-agent-profile.h" tizen_profile_t profile = _PROFILE_UNKNOWN; +tizen_model_name_t model_name = _MODEL_UNKNOWN; diff --git a/include/bluetooth-agent-profile.h b/include/bluetooth-agent-profile.h index d25af2f..56c35dc 100644 --- a/include/bluetooth-agent-profile.h +++ b/include/bluetooth-agent-profile.h @@ -28,6 +28,7 @@ #include #include #include +#include typedef enum { _PROFILE_UNKNOWN = 0, @@ -82,9 +83,54 @@ static inline tizen_profile_t get_tizen_profile() return profile; } +typedef enum { + _MODEL_UNKNOWN = 0, + _MODEL_TM1 = 0x1, + _MODEL_TM2 = 0x2, + _MODEL_TW1 = 0x4, + _MODEL_TW2 = 0x8, +} tizen_model_name_t; + +extern tizen_model_name_t model_name; + +static inline tizen_model_name_t get_tizen_model_name() +{ + char *modelName = NULL; + + if (__builtin_expect(model_name != _MODEL_UNKNOWN, 1)) + return profile; + + system_info_get_platform_string("http://tizen.org/system/model_name", &modelName); + + /* To pass the checking of g_ir */ + if (!modelName) + return _MODEL_UNKNOWN; + + if (g_strcmp0(modelName, "TM1") == 0) { + model_name = _MODEL_TM1; + } else if (g_strcmp0(modelName, "TM2") == 0) { + model_name = _MODEL_TM2; + } else if (g_strcmp0(modelName, "TW1") == 0) { + model_name = _MODEL_TW1; + } else if (g_strcmp0(modelName, "TW2") == 0) { + model_name = _MODEL_TW2; + } else { + model_name = _MODEL_UNKNOWN; + } + + free(modelName); + + return model_name; +} + #define TIZEN_PROFILE_WEARABLE (get_tizen_profile() == _PROFILE_WEARABLE) #define TIZEN_PROFILE_IVI (get_tizen_profile() == _PROFILE_IVI) #define TIZEN_PROFILE_TV (get_tizen_profile() == _PROFILE_TV) #define TIZEN_PROFILE_MOBILE (get_tizen_profile() == _PROFILE_MOBILE) +#define TIZEN_MODEL_NAME_TM1 (get_tizen_model_name() == _MODEL_TM1) +#define TIZEN_MODEL_NAME_TM2 (get_tizen_model_name() == _MODEL_TM2) +#define TIZEN_MODEL_NAME_TW1 (get_tizen_model_name() == _MODEL_TW1) +#define TIZEN_MODEL_NAME_TW2 (get_tizen_model_name() == _MODEL_TW2) + #endif /* __DEF_BT_AGENT_PROFILE_H_ */