static GMainLoop *gmain_loop = NULL;
static GDBusProxy *service_gproxy;
-static int owner_sig_id = -1;
-static int name_owner_sig_id = -1;
+static guint interface_added_sig_id = 0;
+static guint interface_removed_sig_id = 0;
+static guint name_owner_sig_id = 0;
GDBusConnection *ag_dbus_conn = NULL;
gchar *remote_dev_path = NULL;
gboolean wbs_en;
static guint hs_bluez_id;
static guint app_id;
#ifdef TIZEN_FEATURE_BT_MEDIA_ENHANCE
-static int media_sig_id = -1;
-static int media_state_sig_id = -1;
+static guint media_sig_id = 0;
+static guint media_state_sig_id = 0;
static bt_ag_media_transport_state_t transport_state;
#endif
if (dtmf == NULL || path == NULL || sender == NULL) {
ERR("Invalid Argument");
- return FALSE;
+ return BT_HFP_AGENT_ERROR_INVALID_PARAM;
}
DBG("Dtmf = %s", dtmf);
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;
int num_of_secure_command = 4;
static const char* secure_command[] = {"CLCC", "CLIP", "CPBR", "CCWA"};
-void __bt_ag_agent_print_at_buffer(char *message, const char *buf)
+static void __bt_ag_agent_print_at_buffer(char *message, const char *buf)
{
int i = 0;
GVariant *optional_param = NULL;
if (strcasecmp(signal_name, "InterfacesAdded") == 0) {
-
- g_variant_get(parameters, "(&o@a{sa{sv}})",
- &path, &optional_param);
+ g_variant_get(parameters, "(&o@a{sa{sv}})", &path, &optional_param);
if (!path) {
if (optional_param)
g_variant_unref(optional_param);
INFO("Adapter Path = [%s]", path);
if (strcasecmp(path, DEFAULT_ADAPTER_OBJECT_PATH) == 0) {
- gchar *path = g_strdup(BT_AG_AGENT_OBJECT_PATH);
- __bt_ag_agent_register(path, hfp_ver,
+ gchar *obj_path = g_strdup(BT_AG_AGENT_OBJECT_PATH);
+ __bt_ag_agent_register(obj_path, hfp_ver,
HFP_AG_UUID, "Hands-Free Audio Gateway");
- path = g_strdup(BT_HS_AG_AGENT_OBJECT_PATH);
- __bt_ag_agent_register(path, hsp_ver,
+ obj_path = g_strdup(BT_HS_AG_AGENT_OBJECT_PATH);
+ __bt_ag_agent_register(obj_path, hsp_ver,
HSP_AG_UUID, "Headset Audio Gateway");
}
} else if (strcasecmp(signal_name, "InterfacesRemoved") == 0) {
INFO("Adapter Path = [%s]", path);
if (strcasecmp(path, DEFAULT_ADAPTER_OBJECT_PATH) == 0) {
- gchar *path = g_strdup(BT_AG_AGENT_OBJECT_PATH);
- __bt_ag_agent_unregister(path);
+ gchar *obj_path = g_strdup(BT_AG_AGENT_OBJECT_PATH);
+ __bt_ag_agent_unregister(obj_path);
- path = g_strdup(BT_HS_AG_AGENT_OBJECT_PATH);
- __bt_ag_agent_unregister(path);
+ obj_path = g_strdup(BT_HS_AG_AGENT_OBJECT_PATH);
+ __bt_ag_agent_unregister(obj_path);
}
}
if (ag_dbus_conn) {
__bt_ag_unregister_profile_methods();
- if (owner_sig_id != -1)
+ if (interface_added_sig_id)
+ g_dbus_connection_signal_unsubscribe(ag_dbus_conn,
+ interface_added_sig_id);
+
+ if (interface_removed_sig_id)
g_dbus_connection_signal_unsubscribe(ag_dbus_conn,
- owner_sig_id);
+ interface_removed_sig_id);
- if (name_owner_sig_id != -1)
+ if (name_owner_sig_id)
g_dbus_connection_signal_unsubscribe(ag_dbus_conn,
name_owner_sig_id);
#ifdef TIZEN_FEATURE_BT_MEDIA_ENHANCE
- if (media_sig_id != -1)
+ if (media_sig_id)
g_dbus_connection_signal_unsubscribe(ag_dbus_conn,
media_sig_id);
+ media_sig_id = 0;
- if (media_state_sig_id != -1)
+ if (media_state_sig_id)
g_dbus_connection_signal_unsubscribe(ag_dbus_conn,
media_state_sig_id);
+ media_state_sig_id = 0;
#endif
- name_owner_sig_id = -1;
+
+ interface_added_sig_id = 0;
+ interface_removed_sig_id = 0;
+ name_owner_sig_id = 0;
g_free(sco_owner);
sco_owner = NULL;
HSP_AG_UUID, "Headset Audio Gateway");
}
- owner_sig_id = g_dbus_connection_signal_subscribe(ag_dbus_conn,
- NULL, BT_MANAGER_INTERFACE, NULL, NULL, NULL, 0,
+ interface_added_sig_id = g_dbus_connection_signal_subscribe(ag_dbus_conn,
+ NULL, BT_MANAGER_INTERFACE,
+ BT_INTERFACES_ADDED, NULL, NULL, 0,
+ __bt_ag_agent_filter_cb, NULL, NULL);
+
+ interface_removed_sig_id = g_dbus_connection_signal_subscribe(ag_dbus_conn,
+ NULL, BT_MANAGER_INTERFACE,
+ BT_INTERFACES_REMOVED, NULL, NULL, 0,
__bt_ag_agent_filter_cb, NULL, NULL);
+
#ifdef TIZEN_FEATURE_BT_MEDIA_ENHANCE
media_sig_id = g_dbus_connection_signal_subscribe(ag_dbus_conn,
NULL, BT_PROPERTIES_INTERFACE, NULL, NULL,
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)
int i;
uint32_t ag_features;
struct sigaction sa;
- pthread_t thread_id;
+ pthread_t thread_id = 0;
INFO_C("### Starting Bluetooth AG agent");