Modify the log level
[platform/core/connectivity/bluetooth-frwk.git] / bt-service / services / bt-request-handler.c
index c61e140..5a2f90a 100644 (file)
@@ -24,6 +24,7 @@
 #include <cynara-client.h>
 #include <cynara-creds-gdbus.h>
 #include <systemd/sd-daemon.h>
+#include <aul.h>
 
 #include "bluetooth-api.h"
 #include "bluetooth-audio-api.h"
 #include "bt-service-avrcp-tg.h"
 #include "bt-service-avrcp-ctrl.h"
 #include "bt-service-gatt.h"
+#include "bt-service-mesh-main.h"
 #include "bt-service-mesh-util.h"
 #include "bt-service-mesh-network.h"
-
-#ifdef TIZEN_FEATURE_BT_DPM
+#include "bt-service-mesh-config-client.h"
+#include "bt-service-mesh-model.h"
 #include "bt-service-dpm.h"
-#endif
 #include "bt-service-hidhost.h"
 #include "bt-service-rfcomm.h"
 #include "bt-service-hdp.h"
+#include "bt-service-tds.h"
 
 /*Obex*/
 #include "bt-service-obex-server.h"
@@ -60,6 +62,8 @@
 
 #include "bt-service-battery-monitor.h"
 
+#include "bt-service-l2cap-le.h"
+
 #ifdef TIZEN_FEATURE_BT_PAN_NAP
 #include "bt-service-network.h"
 #endif
 #include "bt-service-ipsp.h"
 #endif
 /* For maintaining Application Sync API call requests */
-GSList *invocation_list = NULL;
+static GSList *invocation_list = NULL;
+
+#ifdef TIZEN_FEATURE_BT_CONTAINER
+struct nspid_t {
+       char *unique_name;
+       gboolean is_container;
+};
+static GSList *nspid_list = NULL;
+#endif
 
 static GDBusConnection *bt_service_conn;
 static guint owner_id = 0;
@@ -77,7 +89,7 @@ static gboolean is_le_intended = FALSE;
 
 static cynara *p_cynara;
 static cynara_configuration *conf;
-const char *requester_unique_creds = NULL;
+static const char *requester_unique_creds = NULL;
 
 static const gchar bt_service_introspection_xml[] =
 "<node name='/org/projectx/bt_service'>"
@@ -96,12 +108,10 @@ static const gchar bt_service_introspection_xml[] =
 "                      <arg type='i' name='output_param1' direction='out' />"
 "                      <arg type='v' name='output_param2' direction='out' />"
 "              </method>"
-#ifdef TIZEN_FEATURE_BT_AVC_TARGET
 "              <method name='get_avc_mode'>"
                        /* Out Parameters */
 "                      <arg type='u' name='avc_mode' direction='out' />"
 "              </method>"
-#endif
 "      </interface>"
 "</node>";
 
@@ -220,7 +230,6 @@ static gboolean __bt_is_sync_function(int service_function)
                        || service_function == BT_START_LE_DISCOVERY
                        || service_function == BT_STOP_LE_DISCOVERY
                        || service_function == BT_GET_CONNECTABLE
-#ifdef TIZEN_GATT_CLIENT
                        || service_function == BT_GATT_CLIENT_REGISTER
                        || service_function == BT_GATT_GET_PRIMARY_SERVICES
                        || service_function == BT_GATT_GET_SERVICE_PROPERTIES
@@ -228,17 +237,22 @@ static gboolean __bt_is_sync_function(int service_function)
                        || service_function == BT_GATT_GET_CHARACTERISTIC_PROPERTIES
                        || service_function == BT_GATT_WATCH_CHARACTERISTIC
                        || service_function == BT_GATT_ACQUIRE_WRITE
-#endif
                        || service_function == BT_AUDIO_SELECT_ROLE
                        /* Mesh API's */
+                       || service_function == BT_MESH_INIT
                        || service_function == BT_MESH_NETWORK_CREATE
+                       || service_function == BT_MESH_NETWORK_DESTROY
+                       || service_function == BT_MESH_NETWORK_LOAD
                        || service_function == BT_MESH_NETWORK_SCAN
                        || service_function == BT_MESH_NETWORK_ADD_NETKEY
                        || service_function == BT_MESH_NETWORK_DELETE_NETKEY
                        || service_function == BT_MESH_NETWORK_UPDATE_NETKEY
                        || service_function == BT_MESH_NETWORK_ADD_APPKEY
                        || service_function == BT_MESH_NETWORK_DELETE_APPKEY
-                       || service_function == BT_MESH_NETWORK_UPDATE_APPKEY)
+                       || service_function == BT_MESH_NETWORK_UPDATE_APPKEY
+                       || service_function == BT_L2CAP_LE_LISTEN_AND_ACCEPT
+                       || service_function == BT_L2CAP_LE_LISTEN
+                       || service_function == BT_REQ_ATT_MTU)
                return TRUE;
        else
                return FALSE;
@@ -328,6 +342,7 @@ static void __bt_service_method(GDBusConnection *connection,
                GVariant *temp = NULL;
                int result = 0;
                int request_id = -1;
+               const char *unique_name = NULL;
 
                g_variant_get(parameters, "(iii@ay@ay@ay@ay@ay)", &service_type,
                                &service_function, &request_type,
@@ -335,10 +350,22 @@ static void __bt_service_method(GDBusConnection *connection,
 
                out_param1 = g_array_new(FALSE, FALSE, sizeof(gchar));
 
+#ifdef TIZEN_FEATURE_BT_CONTAINER
+               /* In case of the bt-service in container, only privilege check request is coming
+                * from the bt-service in host. At this time, the original sender's privilege
+                * should be checked not bt-service's privilege */
+               if (_bt_service_is_container() == TRUE)
+                       unique_name = (const char *)g_variant_get_data(param1);
+               else
+                       unique_name = sender;
+#else
+               unique_name = sender;
+#endif
+
                if (service_type == BT_CORE_SERVICE) {
                        BT_DBG("No need to check privilege from bt-core");
                } else if (__bt_service_check_privilege(service_function,
-                                       service_type, (const char *)sender) == FALSE) {
+                                       service_type, unique_name) == FALSE) {
                        BT_ERR("Client don't have the privilege to excute this function");
                        result = BLUETOOTH_ERROR_PERMISSION_DEINED;
                        goto fail;
@@ -435,7 +462,6 @@ fail:
                g_variant_unref(param4);
                g_variant_unref(param5);
        }
-#ifdef TIZEN_FEATURE_BT_AVC_TARGET
        else if (g_strcmp0(method_name, "get_avc_mode") == 0) {
                unsigned int mode = 0;
 
@@ -447,7 +473,6 @@ fail:
                g_dbus_method_invocation_return_value(invocation,
                        g_variant_new("(u)", mode));
        }
-#endif
 
        FN_END;
        return;
@@ -933,7 +958,7 @@ int __bt_bluez_request(int function_name,
               result = _bt_set_le_privacy(set_privacy);
               break;
        }
-       case BT_ADD_WHITE_LIST: {
+       case BT_ADD_ALLOW_LIST: {
                bluetooth_device_address_t address = { {0} };
                int address_type = 0;
                bool is_add = true;
@@ -941,10 +966,10 @@ int __bt_bluez_request(int function_name,
                                &address, sizeof(bluetooth_device_address_t));
                __bt_service_get_parameters(in_param2,
                                &address_type, sizeof(int));
-               result = _bt_set_white_list(&address, address_type, is_add);
+               result = _bt_set_allow_list(&address, address_type, is_add);
                break;
        }
-       case BT_REMOVE_WHITE_LIST: {
+       case BT_REMOVE_ALLOW_LIST: {
                bluetooth_device_address_t address = { {0} };
                int address_type = 0;
                bool is_add = false;
@@ -952,7 +977,7 @@ int __bt_bluez_request(int function_name,
                                &address, sizeof(bluetooth_device_address_t));
                __bt_service_get_parameters(in_param2,
                                &address_type, sizeof(int));
-               result = _bt_set_white_list(&address, address_type, is_add);
+               result = _bt_set_allow_list(&address, address_type, is_add);
                break;
         }
        case BT_UPDATE_LE_CONNECTION_MODE: {
@@ -1150,7 +1175,6 @@ int __bt_bluez_request(int function_name,
                }
                break;
        }
-#ifdef TIZEN_FEATURE_BT_DPM
        case BT_DPM_SET_ALLOW_BT_MODE: {
                dpm_bt_allow_t value = DPM_BT_ERROR;
 
@@ -1199,105 +1223,106 @@ int __bt_bluez_request(int function_name,
                g_array_append_vals(*out_param1, &value, sizeof(int));
                break;
        }
-       case BT_DPM_ADD_DEVICES_BLACKLIST: {
+       case BT_DPM_ADD_DEVICES_BLOCKLIST: {
                bluetooth_device_address_t address = { {0} };
 
                __bt_service_get_parameters(in_param1, &address,
                        sizeof(bluetooth_device_address_t));
 
-               result = _bt_dpm_add_bluetooth_devices_to_blacklist(&address);
+               result = _bt_dpm_add_bluetooth_devices_to_blocklist(&address);
                break;
        }
-       case BT_DPM_ADD_DEVICES_WHITELIST: {
+       case BT_DPM_ADD_DEVICES_ALLOWLIST: {
                bluetooth_device_address_t address = { {0} };
 
                __bt_service_get_parameters(in_param1, &address,
                        sizeof(bluetooth_device_address_t));
 
-               result = _bt_dpm_add_bluetooth_devices_to_whitelist(&address);
+               result = _bt_dpm_add_bluetooth_devices_to_allowlist(&address);
                break;
        }
-       case BT_DPM_ADD_UUIDS_BLACKLIST: {
+       case BT_DPM_ADD_UUIDS_BLOCKLIST: {
                const char *uuid = NULL;
 
                uuid = g_variant_get_data(in_param1);
 
-               result = _bt_dpm_add_bluetooth_uuids_to_blacklist(uuid);
+               result = _bt_dpm_add_bluetooth_uuids_to_blocklist(uuid);
                break;
        }
-       case BT_DPM_ADD_UUIDS_WHITELIST: {
+       case BT_DPM_ADD_UUIDS_ALLOWLIST: {
                const char *uuid = NULL;
 
                uuid = g_variant_get_data(in_param1);
 
-               result = _bt_dpm_add_bluetooth_uuids_to_whitelist(uuid);
+               result = _bt_dpm_add_bluetooth_uuids_to_allowlist(uuid);
                break;
        }
-       case BT_DPM_CLEAR_DEVICES_BLACKLIST: {
-               result = _bt_dpm_clear_bluetooth_devices_from_blacklist();
+       case BT_DPM_CLEAR_DEVICES_BLOCKLIST: {
+               result = _bt_dpm_clear_bluetooth_devices_from_blocklist();
                break;
        }
-       case BT_DPM_CLEAR_DEVICES_WHITELIST: {
-               result = _bt_dpm_clear_bluetooth_devices_from_whitelist();
+       case BT_DPM_CLEAR_DEVICES_ALLOWLIST: {
+               result = _bt_dpm_clear_bluetooth_devices_from_allowlist();
                break;
        }
-       case BT_DPM_CLEAR_UUIDS_BLACKLIST: {
-               result = _bt_dpm_clear_bluetooth_uuids_from_blacklist();
+       case BT_DPM_CLEAR_UUIDS_BLOCKLIST: {
+               result = _bt_dpm_clear_bluetooth_uuids_from_blocklist();
                break;
        }
-       case BT_DPM_CLEAR_UUIDS_WHITELIST: {
-               result = _bt_dpm_clear_bluetooth_uuids_from_whitelist();
+       case BT_DPM_CLEAR_UUIDS_ALLOWLIST: {
+               result = _bt_dpm_clear_bluetooth_uuids_from_allowlist();
                break;
        }
-       case BT_DPM_REMOVE_DEVICE_BLACKLIST: {
+       case BT_DPM_REMOVE_DEVICE_BLOCKLIST: {
                bluetooth_device_address_t address = { {0} };
 
                __bt_service_get_parameters(in_param1, &address,
                        sizeof(bluetooth_device_address_t));
 
-               result = _bt_dpm_remove_bluetooth_devices_from_blacklist(&address);
+               result = _bt_dpm_remove_bluetooth_devices_from_blocklist(&address);
                break;
        }
-       case BT_DPM_REMOVE_DEVICE_WHITELIST: {
+       case BT_DPM_REMOVE_DEVICE_ALLOWLIST: {
                bluetooth_device_address_t address = { {0} };
 
                __bt_service_get_parameters(in_param1, &address,
                        sizeof(bluetooth_device_address_t));
 
-               result = _bt_dpm_remove_bluetooth_devices_from_whitelist(&address);
+               result = _bt_dpm_remove_bluetooth_devices_from_allowlist(&address);
                break;
        }
-       case BT_DPM_REMOVE_UUID_BLACKLIST: {
+       case BT_DPM_REMOVE_UUID_BLOCKLIST: {
                const char *uuid = NULL;
 
                uuid = g_variant_get_data(in_param1);
 
-               result = _bt_dpm_remove_bluetooth_uuids_from_blacklist(uuid);
+               result = _bt_dpm_remove_bluetooth_uuids_from_blocklist(uuid);
                break;
        }
-       case BT_DPM_REMOVE_UUID_WHITELIST: {
+       case BT_DPM_REMOVE_UUID_ALLOWLIST: {
                const char *uuid = NULL;
 
                uuid = g_variant_get_data(in_param1);
 
-               result = _bt_dpm_remove_bluetooth_uuids_from_whitelist(uuid);
+               result = _bt_dpm_remove_bluetooth_uuids_from_allowlist(uuid);
 
                break;
        }
-       case BT_DPM_GET_DEVICES_BLACKLIST: {
-               result = _bt_dpm_get_bluetooth_devices_from_blacklist(out_param1);
+       case BT_DPM_GET_DEVICES_BLOCKLIST: {
+               result = _bt_dpm_get_bluetooth_devices_from_blocklist(out_param1);
                break;
        }
-       case BT_DPM_GET_DEVICES_WHITELIST: {
-               result = _bt_dpm_get_bluetooth_devices_from_whitelist(out_param1);
+       case BT_DPM_GET_DEVICES_ALLOWLIST: {
+               result = _bt_dpm_get_bluetooth_devices_from_allowlist(out_param1);
+
                break;
        }
-       case BT_DPM_GET_UUIDS_BLACKLIST: {
-               result = _bt_dpm_get_bluetooth_uuids_from_blacklist(out_param1);
+       case BT_DPM_GET_UUIDS_BLOCKLIST: {
+               result = _bt_dpm_get_bluetooth_uuids_from_blocklist(out_param1);
                break;
        }
-       case BT_DPM_GET_UUIDS_WHITELIST: {
-               result = _bt_dpm_get_bluetooth_uuids_from_whitelist(out_param1);
+       case BT_DPM_GET_UUIDS_ALLOWLIST: {
+               result = _bt_dpm_get_bluetooth_uuids_from_allowlist(out_param1);
                break;
        }
        case BT_DPM_SET_ALLOW_OUTGOING_CALL: {
@@ -1426,7 +1451,6 @@ int __bt_bluez_request(int function_name,
                g_array_append_vals(*out_param1, &value, sizeof(int));
                break;
        }
-#endif
        case BT_RFCOMM_CLIENT_CONNECT: {
                bluetooth_device_address_t address = { {0} };
                char *input_string;
@@ -1454,6 +1478,7 @@ int __bt_bluez_request(int function_name,
 
                        conn_info.device_role = RFCOMM_ROLE_CLIENT;
                        conn_info.socket_fd = -1;
+                       memcpy(&conn_info.device_addr, &address, sizeof(bluetooth_device_address_t));
                        g_array_append_vals(*out_param1, &conn_info,
                                        sizeof(bluetooth_rfcomm_connection_t));
                } else {
@@ -1526,14 +1551,14 @@ int __bt_bluez_request(int function_name,
                char *address;
 
                address = (char *)g_variant_get_data(in_param1);
-               result = _bt_rfcomm_reply_conn_authorization(address, TRUE);
+               result = _bt_socket_reply_conn_authorization(address, TRUE);
                break;
        }
        case BT_RFCOMM_REJECT_CONNECTION: {
                char *address;
 
                address = (char *)g_variant_get_data(in_param1);
-               result = _bt_rfcomm_reply_conn_authorization(address, FALSE);
+               result = _bt_socket_reply_conn_authorization(address, FALSE);
                break;
        }
        case BT_RFCOMM_REMOVE_SOCKET: {
@@ -1596,7 +1621,6 @@ int __bt_bluez_request(int function_name,
                }
                break;
        }
-#ifdef TIZEN_FEATURE_BT_AVC_TARGET
        case BT_AUDIO_SET_ABSOLUTE_VOLUME: {
                unsigned int volume = 0;
 
@@ -1620,15 +1644,18 @@ int __bt_bluez_request(int function_name,
                g_array_append_vals(*out_param1, &activated, sizeof(bool));
                break;
        }
-#endif
        case BT_AV_CONNECT: {
                bluetooth_device_address_t address = { {0} };
                __bt_service_get_parameters(in_param1,
                                &address, sizeof(bluetooth_device_address_t));
 
-               result = _bt_audio_connect(BT_AUDIO_A2DP, &address);
+               result = _bt_audio_is_profile_connection_in_progress(BT_AV_CONNECT, &address);
+
+               if (result == BLUETOOTH_ERROR_NONE)
+                       result = _bt_audio_connect(BT_AUDIO_A2DP, &address);
 
                if (result != BLUETOOTH_ERROR_NONE) {
+                       BT_ERR("AV Connect Request has failed to execute");
                        char addr[BT_ADDRESS_STRING_SIZE];
                        _bt_convert_addr_type_to_string(addr, address.addr);
                        g_array_append_vals(*out_param1, addr, BT_ADDRESS_STRING_SIZE);
@@ -1646,9 +1673,13 @@ int __bt_bluez_request(int function_name,
                __bt_service_get_parameters(in_param1,
                                &address, sizeof(bluetooth_device_address_t));
 
-               result = _bt_audio_connect(BT_AUDIO_ALL, &address);
+               result = _bt_audio_is_profile_connection_in_progress(BT_AUDIO_CONNECT, &address);
+
+               if (result == BLUETOOTH_ERROR_NONE)
+                       result = _bt_audio_connect(BT_AUDIO_ALL, &address);
 
                if (result != BLUETOOTH_ERROR_NONE) {
+                       BT_ERR("Audio All Connect Request has failed to execute");
                        char addr[BT_ADDRESS_STRING_SIZE];
                        _bt_convert_addr_type_to_string(addr, address.addr);
                        g_array_append_vals(*out_param1, addr, BT_ADDRESS_STRING_SIZE);
@@ -1706,9 +1737,13 @@ int __bt_bluez_request(int function_name,
                __bt_service_get_parameters(in_param1,
                                &address, sizeof(bluetooth_device_address_t));
 
-               result = _bt_audio_connect(BT_AUDIO_HSP, &address);
+               result = _bt_audio_is_profile_connection_in_progress(BT_AG_CONNECT, &address);
+
+               if (result == BLUETOOTH_ERROR_NONE)
+                       result = _bt_audio_connect(BT_AUDIO_HSP, &address);
 
                if (result != BLUETOOTH_ERROR_NONE) {
+                       BT_ERR("AG Connect Request has failed to execute");
                        char addr[BT_ADDRESS_STRING_SIZE];
                        _bt_convert_addr_type_to_string(addr, address.addr);
                        g_array_append_vals(*out_param1, addr, BT_ADDRESS_STRING_SIZE);
@@ -1748,8 +1783,14 @@ int __bt_bluez_request(int function_name,
                __bt_service_get_parameters(in_param1,
                                &address, sizeof(bluetooth_device_address_t));
 
-               result = _bt_audio_connect(BT_AUDIO_A2DP_SOURCE, &address);
+               result = _bt_audio_is_profile_connection_in_progress(BT_AV_SOURCE_CONNECT,
+                               &address);
+
+               if (result == BLUETOOTH_ERROR_NONE)
+                       result = _bt_audio_connect(BT_AUDIO_A2DP_SOURCE, &address);
+
                if (result != BLUETOOTH_ERROR_NONE) {
+                       BT_ERR("A2DP Source Connect Request has failed to execute");
                        char addr[BT_ADDRESS_STRING_SIZE];
                        _bt_convert_addr_type_to_string(addr, address.addr);
                        g_array_append_vals(*out_param1, addr, BT_ADDRESS_STRING_SIZE);
@@ -1788,8 +1829,14 @@ int __bt_bluez_request(int function_name,
                __bt_service_get_parameters(in_param1,
                                &address, sizeof(bluetooth_device_address_t));
 
-               result = _bt_hf_connect(&address);
+               result = _bt_audio_is_profile_connection_in_progress(BT_HF_CONNECT,
+                               &address);
+
+               if (result == BLUETOOTH_ERROR_NONE)
+                       result = _bt_hf_connect(&address);
+
                if (result != BLUETOOTH_ERROR_NONE) {
+                       BT_ERR("HF Connect Request has failed to execute");
                        char addr[BT_ADDRESS_STRING_SIZE];
                        _bt_convert_addr_type_to_string(addr, address.addr);
                        g_array_append_vals(*out_param1, addr, BT_ADDRESS_STRING_SIZE);
@@ -1828,8 +1875,14 @@ int __bt_bluez_request(int function_name,
                __bt_service_get_parameters(in_param1,
                                &address, sizeof(bluetooth_device_address_t));
 
-               result = _bt_audio_connect(BT_AVRCP_TARGET, &address);
+               result = _bt_audio_is_profile_connection_in_progress(BT_AVRCP_TARGET_CONNECT,
+                               &address);
+
+               if (result == BLUETOOTH_ERROR_NONE)
+                       result = _bt_audio_connect(BT_AVRCP_TARGET, &address);
+
                if (result != BLUETOOTH_ERROR_NONE) {
+                       BT_ERR("AVRCP Target Connect Request has failed to execute");
                        char addr[BT_ADDRESS_STRING_SIZE];
                        _bt_convert_addr_type_to_string(addr, address.addr);
                        g_array_append_vals(*out_param1, addr, BT_ADDRESS_STRING_SIZE);
@@ -1868,8 +1921,14 @@ int __bt_bluez_request(int function_name,
                __bt_service_get_parameters(in_param1,
                                &address, sizeof(bluetooth_device_address_t));
 
-               result = _bt_audio_connect(BT_AVRCP, &address);
+               result = _bt_audio_is_profile_connection_in_progress(BT_AVRCP_CONTROL_CONNECT,
+                               &address);
+
+               if (result == BLUETOOTH_ERROR_NONE)
+                       result = _bt_audio_connect(BT_AVRCP, &address);
+
                if (result != BLUETOOTH_ERROR_NONE) {
+                       BT_ERR("AVRCP Control Connect Request has failed to execute");
                        char addr[BT_ADDRESS_STRING_SIZE];
                        _bt_convert_addr_type_to_string(addr, address.addr);
                        g_array_append_vals(*out_param1, addr, BT_ADDRESS_STRING_SIZE);
@@ -1955,7 +2014,7 @@ int __bt_bluez_request(int function_name,
                if (result == BLUETOOTH_ERROR_NONE) {
                        sender = (char*)g_dbus_method_invocation_get_sender(context);
                        _bt_save_invocation_context(context, result, sender,
-                                       function_name, g_memdup(&type, sizeof(int)));
+                                       function_name, g_memdup2(&type, sizeof(int)));
                }
                break;
        }
@@ -2236,7 +2295,9 @@ int __bt_bluez_request(int function_name,
                int *adv_handle;
                bluetooth_advertising_data_t adv = { {0} };
                int length;
-               gboolean use_reserved_slot = FALSE;
+               bluetooth_le_slot_and_adv_type_t rs_at;
+               rs_at.is_legacy = TRUE;
+               rs_at.use_reserved_slot = FALSE;
 
                app = (char *)g_dbus_method_invocation_get_sender(context);
                adv_handle = g_malloc0(sizeof(int));
@@ -2248,9 +2309,9 @@ int __bt_bluez_request(int function_name,
                __bt_service_get_parameters(in_param2,
                                &adv, length);
                __bt_service_get_parameters(in_param4,
-                               &use_reserved_slot, sizeof(gboolean));
+                               &rs_at, sizeof(bluetooth_le_slot_and_adv_type_t));
                result = _bt_set_advertising_data(app, *adv_handle,
-                               &adv, length, use_reserved_slot);
+                               &adv, length, &rs_at);
                if (result != BLUETOOTH_ERROR_NONE) {
                        BT_ERR("Set Advertising data failed!!");
                        g_free(adv_handle);
@@ -2337,7 +2398,7 @@ int __bt_bluez_request(int function_name,
                __bt_service_get_parameters(in_param4, &use_reserved_slot,
                                sizeof(gboolean));
 
-               BT_DBG("bluetooth_advertising_params_t [%f %f %d %d %d]",
+               BT_DBG("bluetooth_advertising_params_t [%d %d %d %d %d]",
                                adv_params.interval_min, adv_params.interval_max,
                                adv_params.filter_policy, adv_params.type, adv_params.tx_power_level);
                result = _bt_set_custom_advertising(app, *adv_handle,
@@ -2566,6 +2627,18 @@ int __bt_bluez_request(int function_name,
                }
                break;
        }
+       case BT_GATT_SERVER_SET_SERVICE_PERSISTENCE: {
+               char *uuid;
+               uuid = (char *)g_variant_get_data(in_param1);
+               result = _bt_gatt_server_set_service_persistence(uuid);
+               break;
+       }
+       case BT_GATT_SERVER_UNSET_SERVICE_PERSISTENCE: {
+               char *uuid;
+               uuid = (char *)g_variant_get_data(in_param1);
+               result = _bt_gatt_server_unset_service_persistence(uuid);
+               break;
+       }
        case BT_GATT_SERVER_SEND_RESPONSE: {
                bluetooth_gatt_server_response_params_t param;
                bluetooth_gatt_att_data_t data;
@@ -2683,6 +2756,68 @@ int __bt_bluez_request(int function_name,
                result = _bt_gatt_server_update_attribute_value(app, instance_id, &param);
                break;
        }
+       case BT_GATT_SERVER_READ_PHY: {
+               bluetooth_device_address_t address = { {0} };
+
+               sender = (char*)g_dbus_method_invocation_get_sender(context);
+
+               __bt_service_get_parameters(in_param1,
+                               &address, sizeof(bluetooth_device_address_t));
+
+               result = _bt_gatt_server_read_phy(&address);
+               break;
+       }
+       case BT_GATT_SERVER_SET_PHY: {
+               bluetooth_device_address_t address = { {0} };
+               int tx_phy;
+               int rx_phy;
+               int phy_options;
+
+               sender = (char*)g_dbus_method_invocation_get_sender(context);
+
+               __bt_service_get_parameters(in_param1,
+                               &address, sizeof(bluetooth_device_address_t));
+               __bt_service_get_parameters(in_param2,
+                               &tx_phy, sizeof(int));
+               __bt_service_get_parameters(in_param3,
+                               &rx_phy, sizeof(int));
+               __bt_service_get_parameters(in_param4,
+                               &phy_options, sizeof(int));
+
+               result = _bt_gatt_server_set_phy(&address, tx_phy, rx_phy, phy_options);
+               break;
+       }
+       case BT_GATT_CLIENT_READ_PHY: {
+               bluetooth_device_address_t address = { {0} };
+
+               sender = (char*)g_dbus_method_invocation_get_sender(context);
+
+               __bt_service_get_parameters(in_param1,
+                               &address, sizeof(bluetooth_device_address_t));
+
+               result = _bt_gatt_client_read_phy(&address);
+               break;
+       }
+       case BT_GATT_CLIENT_SET_PHY: {
+               bluetooth_device_address_t address = { {0} };
+               int tx_phy;
+               int rx_phy;
+               int phy_options;
+
+               sender = (char*)g_dbus_method_invocation_get_sender(context);
+
+               __bt_service_get_parameters(in_param1,
+                               &address, sizeof(bluetooth_device_address_t));
+               __bt_service_get_parameters(in_param2,
+                               &tx_phy, sizeof(int));
+               __bt_service_get_parameters(in_param3,
+                               &rx_phy, sizeof(int));
+               __bt_service_get_parameters(in_param4,
+                               &phy_options, sizeof(int));
+
+               result = _bt_gatt_client_set_phy(&address, tx_phy, rx_phy, phy_options);
+               break;
+       }
        case BT_GET_ATT_MTU: {
                bluetooth_device_address_t address = { {0} };
                unsigned int mtu = 0;
@@ -2750,7 +2885,6 @@ int __bt_bluez_request(int function_name,
 
                break;
        }
-#ifdef TIZEN_GATT_CLIENT
        /* Local Async */
        case BT_GATT_CLIENT_REGISTER: {
                bluetooth_device_address_t address = { {0} };
@@ -2964,7 +3098,7 @@ int __bt_bluez_request(int function_name,
                        /* Save the informations to invocation */
                        _bt_save_invocation_context(context, result, sender,
                                        function_name,
-                                       (gpointer)g_memdup(&param, sizeof(bluetooth_gatt_client_svc_prop_info_t)));
+                                       (gpointer)g_memdup2(&param, sizeof(bluetooth_gatt_client_svc_prop_info_t)));
                }
                break;
        }
@@ -2982,7 +3116,7 @@ int __bt_bluez_request(int function_name,
                        /* Save the informations to invocation */
                        _bt_save_invocation_context(context, result, sender,
                                        function_name,
-                                       (gpointer)g_memdup(&param, sizeof(bluetooth_gatt_client_char_prop_info_t)));
+                                       (gpointer)g_memdup2(&param, sizeof(bluetooth_gatt_client_char_prop_info_t)));
                }
                break;
        }
@@ -3001,7 +3135,7 @@ int __bt_bluez_request(int function_name,
                        /* Save the informations to invocation */
                        _bt_save_invocation_context(context, result, sender,
                                        function_name,
-                                       (gpointer)g_memdup(&param, sizeof(bluetooth_gatt_client_char_prop_info_t)));
+                                       (gpointer)g_memdup2(&param, sizeof(bluetooth_gatt_client_char_prop_info_t)));
                }
                break;
        }
@@ -3020,7 +3154,7 @@ int __bt_bluez_request(int function_name,
                        /* Save the informations to invocation */
                        _bt_save_invocation_context(context, result, sender,
                                        function_name,
-                                       (gpointer)g_memdup(&param, sizeof(bluetooth_gatt_client_desc_prop_info_t)));
+                                       (gpointer)g_memdup2(&param, sizeof(bluetooth_gatt_client_desc_prop_info_t)));
                }
                break;
        }
@@ -3047,7 +3181,7 @@ int __bt_bluez_request(int function_name,
                        /* Save the informations to invocation */
                        _bt_save_invocation_context(context, result, sender,
                                        function_name,
-                                       (gpointer)g_memdup(&param, sizeof(bluetooth_gatt_client_char_prop_info_t)));
+                                       (gpointer)g_memdup2(&param, sizeof(bluetooth_gatt_client_char_prop_info_t)));
                }
                break;
        }
@@ -3073,7 +3207,7 @@ int __bt_bluez_request(int function_name,
                        /* Save the informations to invocation */
                        _bt_save_invocation_context(context, result, sender,
                                        function_name,
-                                       (gpointer)g_memdup(&param, sizeof(bluetooth_gatt_client_desc_prop_info_t)));
+                                       (gpointer)g_memdup2(&param, sizeof(bluetooth_gatt_client_desc_prop_info_t)));
                }
                break;
        }
@@ -3131,7 +3265,7 @@ normal:
                        if (BLUETOOTH_ERROR_NONE == result) {
                                /* Save the informations to invocation */
                                _bt_save_invocation_context(context, result, sender, function_name,
-                                        (gpointer)g_memdup(&param, sizeof(bluetooth_gatt_client_char_prop_info_t)));
+                                        (gpointer)g_memdup2(&param, sizeof(bluetooth_gatt_client_char_prop_info_t)));
                        }
                }
                break;
@@ -3171,7 +3305,6 @@ normal:
                                        parameters.timeout);
                break;
        }
-#endif
        case BT_START_LE_DISCOVERY: {
                uid_t uid = 0;
                pid_t pid = 0;
@@ -3339,6 +3472,28 @@ normal:
                g_array_append_vals(*out_param1, &is_coded_phy_supported, sizeof(gboolean));
                break;
        }
+       case BT_IS_LE_EXTENDED_ADVERTISING_SUPPORTED: {
+               gboolean is_extended_advertising_supported = FALSE;
+
+               is_extended_advertising_supported = _bt_is_le_extended_advertising_supported();
+               g_array_append_vals(*out_param1, &is_extended_advertising_supported,
+                       sizeof(gboolean));
+               break;
+       }
+       case BT_IS_LE_EXTENDED_SCAN_SUPPORTED: {
+               gboolean is_extended_scan_supported = FALSE;
+
+               is_extended_scan_supported = _bt_is_le_extended_scan_supported();
+               g_array_append_vals(*out_param1, &is_extended_scan_supported, sizeof(gboolean));
+               break;
+       }
+       case BT_LE_MAX_ADVERTISING_DATA_LEN: {
+               gint max_advertising_len = 0;
+
+               max_advertising_len = _bt_le_get_maximum_advertising_len();
+               g_array_append_vals(*out_param1, &max_advertising_len, sizeof(gint));
+               break;
+       }
        case BT_DISCONNECT_DEVICE: {
                bluetooth_device_address_t address = { {0} };
 
@@ -3348,6 +3503,24 @@ normal:
                result = _bt_disconnect_device(&address);
                break;
        }
+       case BT_SET_SCANNING_PHY: {
+               int phy = 0;
+               sender = (char*)g_dbus_method_invocation_get_sender(context);
+               __bt_service_get_parameters(in_param1, &phy, sizeof(int));
+
+               result = _bt_set_scan_phy(sender, phy);
+
+               break;
+       }
+       case BT_SET_SCANNING_ROLE: {
+               int role = 0;
+               sender = (char*)g_dbus_method_invocation_get_sender(context);
+               __bt_service_get_parameters(in_param1, &role, sizeof(int));
+
+               result = _bt_set_scan_role(sender, role);
+
+               break;
+       }
        case BT_REGISTER_SCAN_FILTER: {
                bluetooth_le_scan_filter_t scan_filter;
 
@@ -3362,6 +3535,128 @@ normal:
 
                break;
        }
+
+       case BT_TDS_PROVIDER_REGISTER: {
+               char *sender = NULL;
+
+               sender = (char *)g_dbus_method_invocation_get_sender(context);
+               result = _bt_tds_provider_register(sender);
+
+               break;
+       }
+
+       case BT_TDS_PROVIDER_UNREGISTER: {
+               char *sender = NULL;
+
+               sender = (char *)g_dbus_method_invocation_get_sender(context);
+               result = _bt_tds_provider_unregister(sender);
+
+               break;
+       }
+
+       case BT_TDS_PROVIDER_SET_MANUF_DATA: {
+               char *sender = NULL;
+               unsigned int length = 0;
+               bluetooth_advertising_data_t manuf_data;
+
+               __bt_service_get_parameters(in_param1,
+                               &length, sizeof(unsigned int));
+               __bt_service_get_parameters(in_param2,
+                               &manuf_data, sizeof(bluetooth_advertising_data_t));
+               sender = (char *)g_dbus_method_invocation_get_sender(context);
+
+               result = _bt_tds_provider_set_manuf_data(sender, manuf_data.data, length);
+               break;
+       }
+
+       case BT_TDS_PROVIDER_CREATE: {
+               char *sender = NULL;
+               unsigned int tds_handle = 0;
+               int transport;
+
+               __bt_service_get_parameters(in_param1,
+                               &tds_handle, sizeof(unsigned int));
+               __bt_service_get_parameters(in_param2,
+                               &transport, sizeof(int));
+               sender = (char *)g_dbus_method_invocation_get_sender(context);
+               result = _bt_tds_provider_transport_create(sender, transport, tds_handle);
+
+               break;
+       }
+
+       case BT_TDS_PROVIDER_DESTROY: {
+               char *sender = NULL;
+               unsigned int tds_handle = 0;
+
+               __bt_service_get_parameters(in_param1,
+                               &tds_handle, sizeof(unsigned int));
+               sender = (char *)g_dbus_method_invocation_get_sender(context);
+               result = _bt_tds_provider_transport_remove(sender, tds_handle);
+
+               break;
+       }
+
+       case BT_TDS_PROVIDER_SET_TRANSPORT_DATA: {
+               char *sender = NULL;
+               unsigned int tds_handle = 0;
+               int transport_state = 0;
+               bluetooth_tds_data_t tds_data;
+
+               __bt_service_get_parameters(in_param1,
+                               &tds_handle, sizeof(unsigned int));
+               __bt_service_get_parameters(in_param2,
+                               &transport_state, sizeof(int));
+               __bt_service_get_parameters(in_param3,
+                               &tds_data, sizeof(bluetooth_tds_data_t));
+               sender = (char *)g_dbus_method_invocation_get_sender(context);
+
+               result = _bt_tds_provider_set_transport_data(sender, tds_handle,
+                               transport_state, tds_data.data, tds_data.length);
+               break;
+       }
+
+       case BT_TDS_SEND_ACTIVATION_RESPONSE: {
+               bluetooth_device_address_t address = { {0} };
+               bluetooth_tds_data_t tds_data;
+               char *sender = NULL;
+               unsigned int tds_handle = 0;
+               int response;
+
+               __bt_service_get_parameters(in_param1,
+                               &tds_handle, sizeof(unsigned int));
+               __bt_service_get_parameters(in_param2,
+                               &response, sizeof(int));
+               __bt_service_get_parameters(in_param3, &address,
+                       sizeof(bluetooth_device_address_t));
+               __bt_service_get_parameters(in_param4,
+                               &tds_data, sizeof(bluetooth_tds_data_t));
+               sender = (char *)g_dbus_method_invocation_get_sender(context);
+
+               result = _bt_tds_provider_send_activation_response(sender, tds_handle,
+                               &address, response, tds_data.data, tds_data.length);
+               break;
+       }
+
+       case BT_MESH_INIT:
+               sender = (char*)g_dbus_method_invocation_get_sender(context);
+               BT_INFO("Mesh: Init by [%s]", sender);
+               result = _bt_mesh_init(sender);
+               /* Save invocation */
+               if (result == BLUETOOTH_ERROR_NONE) {
+                       BT_INFO("Mesh: Save Invoation");
+                       sender = (char*)g_dbus_method_invocation_get_sender(context);
+                       _bt_save_invocation_context(context,
+                                       result, sender,
+                                       function_name, NULL);
+               }
+               break;
+
+       case BT_MESH_DEINIT:
+               sender = (char*)g_dbus_method_invocation_get_sender(context);
+               BT_INFO("Mesh: De-Init by [%s]", sender);
+               result = _bt_mesh_deinit(sender);
+               break;
+
        case BT_MESH_NETWORK_CREATE: {
                bluetooth_mesh_node_t node;
                GSList *model_list = NULL;
@@ -3377,6 +3672,7 @@ normal:
                __bt_service_get_parameters(in_param1,
                                &node, sizeof(bluetooth_mesh_node_t));
                network_name = (const char *)g_variant_get_data(in_param2);
+
                BT_INFO("MESH: Network name [%s]", network_name);
 
                param3 = g_array_new(TRUE, TRUE, sizeof(gchar));
@@ -3390,7 +3686,7 @@ normal:
                        info = &g_array_index(param3,
                                        bluetooth_mesh_model_t, i);
 
-                       mod = g_memdup(info, sizeof(bluetooth_mesh_model_t));
+                       mod = g_memdup2(info, sizeof(bluetooth_mesh_model_t));
 
                        if (mod)
                                model_list = g_slist_append(model_list,
@@ -3416,10 +3712,12 @@ normal:
                                requester_unique_creds,
                                sizeof(network->app_cred));
                        sender = (char*)g_dbus_method_invocation_get_sender(context);
+                       BT_INFO("Mesh: Network Create by [%s]", sender);
                        _bt_save_invocation_context(context,
                                        result, sender,
                                        function_name, (gpointer)network);
                } else {
+                       g_array_append_vals(*out_param1, &node, sizeof(bluetooth_mesh_node_t));
                        BT_ERR("Mesh: Mesh Network creation schedule failed");
                        g_slist_free_full(model_list, g_free);
                }
@@ -3431,27 +3729,24 @@ normal:
                BT_INFO("Mesh: Cleanup Done");
                break;
        }
-       case BT_MESH_NETWORK_SCAN: {
+       case BT_MESH_NETWORK_DESTROY: {
                bluetooth_mesh_network_t network;
-               bluetooth_mesh_scan_param_t param;
                memset(&network, 0x00, sizeof(bluetooth_mesh_network_t));
-               memset(&param, 0x00, sizeof(bluetooth_mesh_scan_param_t));
 
                __bt_service_get_parameters(in_param1,
                                &network, sizeof(bluetooth_mesh_network_t));
 
-               __bt_service_get_parameters(in_param2,
-                               &param, sizeof(bluetooth_mesh_scan_param_t));
-
-               result = _bt_mesh_network_scan(requester_unique_creds,
-                               sender, &network, &param);
+               BT_INFO("Mesh: Destroy Network");
+               result = _bt_mesh_network_destroy(requester_unique_creds,
+                               sender, &network);
 
                if (result != BLUETOOTH_ERROR_NONE) {
                        g_array_append_vals(*out_param1,
                                &network, sizeof(bluetooth_mesh_network_t));
                } else {
+                       BT_INFO("Mesh: Destroy Network scheduled: add invocation");
                        bluetooth_mesh_network_t *net =  \
-                                       g_memdup(&network, sizeof(bluetooth_mesh_network_t));
+                                       g_memdup2(&network, sizeof(bluetooth_mesh_network_t));
 
                        sender = (char*)g_dbus_method_invocation_get_sender(context);
                        _bt_save_invocation_context(context, result, sender,
@@ -3459,55 +3754,177 @@ normal:
                }
                break;
        }
-       case BT_MESH_NETWORK_CANCEL_SCAN: {
+       case BT_MESH_NETWORK_LOAD: {
+               char *token = NULL;
+               bluetooth_mesh_network_t *network;
+               token = (char *)g_variant_get_data(in_param1);
+               BT_INFO("MESH: Network Load: Token string [%s]", token);
+               result = _bt_mesh_network_load(requester_unique_creds, sender, token);
+               /* Save invocation */
+               if (result == BLUETOOTH_ERROR_NONE) {
+                       network =  g_malloc0(sizeof(bluetooth_mesh_network_t));
+                       g_strlcpy(network->token.token, token,
+                                       BLUETOOTH_MESH_NETWORK_TOKEN_STRING_LENGTH + 1);
+                       g_strlcpy(network->app_cred, requester_unique_creds,
+                                       sizeof(network->app_cred));
+
+                       sender = (char*)g_dbus_method_invocation_get_sender(context);
+                       _bt_save_invocation_context(context, result, sender,
+                                       function_name, (gpointer)network);
+               }
+               g_free((gpointer)requester_unique_creds);
+               break;
+       }
+       case BT_MESH_NETWORK_UNLOAD: {
                bluetooth_mesh_network_t network;
                memset(&network, 0x00, sizeof(bluetooth_mesh_network_t));
 
                __bt_service_get_parameters(in_param1,
                                &network, sizeof(bluetooth_mesh_network_t));
 
-               result = _bt_mesh_network_scan_cancel(requester_unique_creds,
-                       sender, &network);
-
-               if (result != BLUETOOTH_ERROR_NONE)
-                       g_array_append_vals(*out_param1,
-                               &network, sizeof(bluetooth_mesh_network_t));
+               BT_INFO("MESH: Network Unload: Network UUID [%s]", network.uuid);
+               result = _bt_mesh_network_unload(requester_unique_creds,
+                               sender, &network);
                break;
        }
-       case BT_MESH_NETWORK_SET_CAPABILITIES: {
-               bluetooth_mesh_network_t network;
-               bluetooth_mesh_provisioner_caps_t caps;
-               memset(&network, 0x00, sizeof(bluetooth_mesh_network_t));
-               memset(&caps, 0x00, sizeof(bluetooth_mesh_provisioner_caps_t));
+       case BT_MESH_NETWORK_JOIN: {
+               bluetooth_mesh_node_t node;
+               GSList *model_list = NULL;
+               int total_models = 0;
+               GArray *param2;
+               int i = 0;
+
+               memset(&node, 0x00, sizeof(bluetooth_mesh_node_t));
+               sender = (char*)g_dbus_method_invocation_get_sender(context);
 
                __bt_service_get_parameters(in_param1,
-                               &network, sizeof(bluetooth_mesh_network_t));
+                               &node, sizeof(bluetooth_mesh_node_t));
 
-               __bt_service_get_parameters(in_param2,
-                               &caps, sizeof(bluetooth_mesh_provisioner_caps_t));
+               param2 = g_array_new(TRUE, TRUE, sizeof(gchar));
+               __bt_fill_garray_from_variant(in_param2, param2);
 
-               result = _bt_mesh_network_set_provisioner_caps(
-                               requester_unique_creds, sender, &network, &caps);
+               total_models = (param2->len) / sizeof(bluetooth_mesh_model_t);
+               for (i = 0; i < total_models; i++) {
+                       bluetooth_mesh_model_t *info = NULL;
+                       bluetooth_mesh_model_t *mod = NULL;
+                       info = &g_array_index(param2,
+                               bluetooth_mesh_model_t, i);
+                       mod = g_memdup2(info, sizeof(bluetooth_mesh_model_t));
+
+                       if (mod)
+                               model_list = g_slist_append(model_list,
+                                       (gpointer)mod);
+               }
+
+               BT_INFO("MESH: Network Join bt-service");
+               //result = BLUETOOTH_ERROR_NONE;
+               result = _bt_mesh_network_join(requester_unique_creds,
+                               sender, &node, model_list);
+               if (result != BLUETOOTH_ERROR_NONE) {
+                       g_array_append_vals(*out_param1, &node, sizeof(bluetooth_mesh_node_t));
+                       BT_ERR("Mesh: Mesh Join Network schedule failed");
+                       g_slist_free_full(model_list, g_free);
+               }
 
+               BT_INFO("return of _bt_mesh_network_join : [%d]", result);
                break;
        }
-       case BT_MESH_NETWORK_PROVISION_DEVICE: {
-               bluetooth_mesh_provisioning_request_t req;
-               memset(&req, 0x00, sizeof(bluetooth_mesh_provisioning_request_t));
+       case BT_MESH_CANCEL_JOIN: {
+               bluetooth_mesh_node_info_t node;
+               memset(&node, 0x00, sizeof(bluetooth_mesh_node_info_t));
 
                __bt_service_get_parameters(in_param1,
-                               &req, sizeof(bluetooth_mesh_provisioning_request_t));
-
-               result = _bt_mesh_network_provision_device(
-                               requester_unique_creds, sender, &req);
+                               &node, sizeof(bluetooth_mesh_node_info_t));
 
-               /* Save invocation */
+               BT_INFO("Mesh: Cancel Join request");
+               result = _bt_mesh_cancel_join(requester_unique_creds,
+                               sender, &node);
                if (result != BLUETOOTH_ERROR_NONE) {
-                       g_array_append_vals(*out_param1, &req,
-                               sizeof(bluetooth_mesh_provisioning_request_t));
-               } else {
+                       g_array_append_vals(*out_param1,
+                                       &node, sizeof(bluetooth_mesh_node_t));
+               }
+               break;
+       }
+       case BT_MESH_NETWORK_SCAN: {
+               bluetooth_mesh_network_t network;
+               bluetooth_mesh_scan_param_t param;
+               memset(&network, 0x00, sizeof(bluetooth_mesh_network_t));
+               memset(&param, 0x00, sizeof(bluetooth_mesh_scan_param_t));
+
+               __bt_service_get_parameters(in_param1,
+                               &network, sizeof(bluetooth_mesh_network_t));
+
+               __bt_service_get_parameters(in_param2,
+                               &param, sizeof(bluetooth_mesh_scan_param_t));
+
+               result = _bt_mesh_network_scan(requester_unique_creds,
+                               sender, &network, &param);
+
+               if (result != BLUETOOTH_ERROR_NONE) {
+                       g_array_append_vals(*out_param1,
+                               &network, sizeof(bluetooth_mesh_network_t));
+               } else {
+                       bluetooth_mesh_network_t *net =  \
+                                       g_memdup2(&network, sizeof(bluetooth_mesh_network_t));
+
+                       sender = (char*)g_dbus_method_invocation_get_sender(context);
+                       _bt_save_invocation_context(context, result, sender,
+                                       function_name, (gpointer)net);
+               }
+               break;
+       }
+       case BT_MESH_NETWORK_CANCEL_SCAN: {
+               bluetooth_mesh_network_t network;
+               memset(&network, 0x00, sizeof(bluetooth_mesh_network_t));
+
+               __bt_service_get_parameters(in_param1,
+                               &network, sizeof(bluetooth_mesh_network_t));
+
+               result = _bt_mesh_network_scan_cancel(requester_unique_creds,
+                       sender, &network);
+
+               if (result != BLUETOOTH_ERROR_NONE)
+                       g_array_append_vals(*out_param1,
+                               &network, sizeof(bluetooth_mesh_network_t));
+               break;
+       }
+       case BT_MESH_NETWORK_SET_CAPABILITIES: {
+               bluetooth_mesh_network_t network;
+               bluetooth_mesh_provisioner_caps_t caps;
+               memset(&network, 0x00, sizeof(bluetooth_mesh_network_t));
+               memset(&caps, 0x00, sizeof(bluetooth_mesh_provisioner_caps_t));
+
+               __bt_service_get_parameters(in_param1,
+                               &network, sizeof(bluetooth_mesh_network_t));
+
+               __bt_service_get_parameters(in_param2,
+                               &caps, sizeof(bluetooth_mesh_provisioner_caps_t));
+
+               result = _bt_mesh_network_set_provisioner_caps(
+                               requester_unique_creds, sender, &network, &caps);
+
+               break;
+       }
+       case BT_MESH_NETWORK_PROVISION_DEVICE: {
+               bluetooth_mesh_provisioning_request_t req;
+               memset(&req, 0x00, sizeof(bluetooth_mesh_provisioning_request_t));
+
+               __bt_service_get_parameters(in_param1,
+                               &req, sizeof(bluetooth_mesh_provisioning_request_t));
+
+               BT_INFO("Mesh: Provision Device UUID [%s]", req.dev_uuid);
+               BT_INFO("Mesh: Provision Device in network[%s]", req.net_uuid);
+
+               result = _bt_mesh_network_provision_device(
+                               requester_unique_creds, sender, &req);
+
+               /* Save invocation */
+               if (result != BLUETOOTH_ERROR_NONE) {
+                       g_array_append_vals(*out_param1, &req,
+                               sizeof(bluetooth_mesh_provisioning_request_t));
+               } else {
                        bluetooth_mesh_provisioning_request_t *param =  \
-                               g_memdup(&req, sizeof(bluetooth_mesh_provisioning_request_t));
+                               g_memdup2(&req, sizeof(bluetooth_mesh_provisioning_request_t));
 
                        sender = (char*)g_dbus_method_invocation_get_sender(context);
                        _bt_save_invocation_context(context, result, sender,
@@ -3516,6 +3933,7 @@ normal:
                break;
        }
        case BT_MESH_AUTHENTICATION_REPLY: {
+               BT_INFO("Mesh: BT_MESH_AUTHENTICATION_REPLY");
                const char *auth_value = NULL;
                gboolean authentication_reply = FALSE;
                int auth_type;
@@ -3524,6 +3942,9 @@ normal:
                                &authentication_reply, sizeof(gboolean));
                __bt_service_get_parameters(in_param1,
                                &auth_type, sizeof(int));
+               BT_INFO("Mesh: Auth Reply Type [%d]", auth_type);
+               BT_INFO("Mesh: Auth Value [%s]", auth_value);
+               BT_INFO("Mesh: Auth Accept [%d]", authentication_reply);
                result = _bt_mesh_authentication_reply(auth_type,
                                auth_value, authentication_reply);
                break;
@@ -3552,7 +3973,7 @@ normal:
                if (result != BLUETOOTH_ERROR_NONE) {
                        g_array_append_vals(*out_param1, &network, sizeof(bluetooth_mesh_network_t));
                } else {
-                       bluetooth_mesh_network_t *net =  g_memdup(&network, sizeof(bluetooth_mesh_network_t));
+                       bluetooth_mesh_network_t *net =  g_memdup2(&network, sizeof(bluetooth_mesh_network_t));
 
                        sender = (char*)g_dbus_method_invocation_get_sender(context);
                        _bt_save_invocation_context(context, result, sender,
@@ -3577,7 +3998,7 @@ normal:
                if (result != BLUETOOTH_ERROR_NONE) {
                        g_array_append_vals(*out_param1, &network, sizeof(bluetooth_mesh_network_t));
                } else {
-                       bluetooth_mesh_network_t *net =  g_memdup(&network, sizeof(bluetooth_mesh_network_t));
+                       bluetooth_mesh_network_t *net =  g_memdup2(&network, sizeof(bluetooth_mesh_network_t));
 
                        sender = (char*)g_dbus_method_invocation_get_sender(context);
                        _bt_save_invocation_context(context, result, sender,
@@ -3602,7 +4023,7 @@ normal:
                if (result != BLUETOOTH_ERROR_NONE) {
                        g_array_append_vals(*out_param1, &network, sizeof(bluetooth_mesh_network_t));
                } else {
-                       bluetooth_mesh_network_t *net =  g_memdup(&network, sizeof(bluetooth_mesh_network_t));
+                       bluetooth_mesh_network_t *net =  g_memdup2(&network, sizeof(bluetooth_mesh_network_t));
 
                        sender = (char*)g_dbus_method_invocation_get_sender(context);
                        _bt_save_invocation_context(context, result, sender,
@@ -3627,7 +4048,7 @@ normal:
                if (result != BLUETOOTH_ERROR_NONE) {
                        g_array_append_vals(*out_param1, &network, sizeof(bluetooth_mesh_network_t));
                } else {
-                       bluetooth_mesh_network_t *net =  g_memdup(&network, sizeof(bluetooth_mesh_network_t));
+                       bluetooth_mesh_network_t *net =  g_memdup2(&network, sizeof(bluetooth_mesh_network_t));
 
                        sender = (char*)g_dbus_method_invocation_get_sender(context);
                        _bt_save_invocation_context(context, result, sender,
@@ -3653,64 +4074,595 @@ normal:
                                sender, &network, net_idx, app_idx);
 
                if (result != BLUETOOTH_ERROR_NONE) {
-                       g_array_append_vals(*out_param1, &network, sizeof(bluetooth_mesh_network_t));
+                       g_array_append_vals(*out_param1, &network, sizeof(bluetooth_mesh_network_t));
+               } else {
+                       bluetooth_mesh_network_t *net =  g_memdup2(&network, sizeof(bluetooth_mesh_network_t));
+
+                       sender = (char*)g_dbus_method_invocation_get_sender(context);
+                       _bt_save_invocation_context(context, result, sender,
+                                       function_name, (gpointer)net);
+               }
+               break;
+       }
+       case BT_MESH_NETWORK_DELETE_APPKEY: {
+               bluetooth_mesh_network_t network;
+               uint16_t net_idx;
+               uint16_t app_idx;
+
+               memset(&network, 0x00, sizeof(bluetooth_mesh_network_t));
+
+               __bt_service_get_parameters(in_param1,
+                               &network, sizeof(bluetooth_mesh_network_t));
+               __bt_service_get_parameters(in_param2,
+                               &net_idx, sizeof(guint16));
+               __bt_service_get_parameters(in_param3,
+                               &app_idx, sizeof(guint16));
+
+               result = _bt_mesh_network_delete_appkey(requester_unique_creds,
+                               sender, &network, net_idx, app_idx);
+
+               if (result != BLUETOOTH_ERROR_NONE) {
+                       g_array_append_vals(*out_param1, &network, sizeof(bluetooth_mesh_network_t));
+               } else {
+                       bluetooth_mesh_network_t *net =  g_memdup2(&network, sizeof(bluetooth_mesh_network_t));
+
+                       sender = (char*)g_dbus_method_invocation_get_sender(context);
+                       _bt_save_invocation_context(context, result, sender,
+                                       function_name, (gpointer)net);
+               }
+               break;
+       }
+       case BT_MESH_NETWORK_GET_NETKEYS: {
+               bluetooth_mesh_network_t network;
+               memset(&network, 0x00, sizeof(bluetooth_mesh_network_t));
+               __bt_service_get_parameters(in_param1,
+                               &network, sizeof(bluetooth_mesh_network_t));
+               result = _bt_mesh_network_get_netkeys(requester_unique_creds,
+                               sender, &network, out_param1);
+               break;
+       }
+       case BT_MESH_NETWORK_GET_APPKEYS: {
+               bluetooth_mesh_network_t network;
+               uint16_t net_idx;
+
+               memset(&network, 0x00, sizeof(bluetooth_mesh_network_t));
+               __bt_service_get_parameters(in_param1,
+                               &network, sizeof(bluetooth_mesh_network_t));
+               __bt_service_get_parameters(in_param2,
+                               &net_idx, sizeof(guint16));
+               result = _bt_mesh_network_get_appkeys(
+                               requester_unique_creds, sender,
+                                       &network, net_idx, out_param1);
+               break;
+       }
+       case BT_MESH_NETWORK_GET_NODES: {
+               bluetooth_mesh_network_t network;
+               memset(&network, 0x00, sizeof(bluetooth_mesh_network_t));
+               __bt_service_get_parameters(in_param1,
+                               &network, sizeof(bluetooth_mesh_network_t));
+               result = _bt_mesh_network_get_nodes(
+                               requester_unique_creds, sender,
+                                       &network, out_param1);
+               break;
+       }
+       case BT_MESH_ELEMENT_GET_MODELS: {
+               bluetooth_mesh_network_t network;
+               uint16_t node_addr;
+               int elem_idx;
+
+               memset(&network, 0x00, sizeof(bluetooth_mesh_network_t));
+               __bt_service_get_parameters(in_param1,
+                               &network, sizeof(bluetooth_mesh_network_t));
+               __bt_service_get_parameters(in_param2,
+                               &node_addr, sizeof(guint16));
+               __bt_service_get_parameters(in_param3,
+                               &elem_idx, sizeof(int));
+               result = _bt_mesh_element_get_models(requester_unique_creds, sender,
+                               &network, node_addr, elem_idx, out_param1);
+               break;
+       }
+       case BT_MESH_NODE_BROWSE: {
+               bluetooth_mesh_node_discover_t req;
+               memset(&req, 0x00, sizeof(bluetooth_mesh_node_discover_t));
+
+               __bt_service_get_parameters(in_param1,
+                               &req, sizeof(bluetooth_mesh_node_discover_t));
+
+               result = _bt_mesh_browse_remote_node(
+                               requester_unique_creds, sender, &req);
+
+               /* Save invocation */
+               if (result != BLUETOOTH_ERROR_NONE) {
+                       g_array_append_vals(*out_param1, &req,
+                               sizeof(bluetooth_mesh_node_discover_t));
+               } else {
+                       bluetooth_mesh_node_discover_t *param = \
+                               g_memdup2(&req, sizeof(bluetooth_mesh_node_discover_t));
+
+                       sender = (char*)g_dbus_method_invocation_get_sender(context);
+                       _bt_save_invocation_context(context, result, sender,
+                                       function_name, (gpointer)param);
+               }
+               break;
+       }
+       case BT_MESH_NODE_GET_VENDOR_FEATURES: {
+               bluetooth_mesh_node_features_t req;
+               memset(&req, 0x00, sizeof(bluetooth_mesh_node_features_t));
+
+               __bt_service_get_parameters(in_param1,
+                               &req, sizeof(bluetooth_mesh_node_features_t));
+
+               result = _bt_mesh_node_discover_vendor_features(
+                               requester_unique_creds, sender, &req);
+
+               /* Save invocation */
+               if (result != BLUETOOTH_ERROR_NONE) {
+                       g_array_append_vals(*out_param1,
+                               &req, sizeof(bluetooth_mesh_node_features_t));
+               } else {
+                       bluetooth_mesh_node_features_t *param =  \
+                               g_memdup2(&req, sizeof(bluetooth_mesh_node_features_t));
+
+                       sender = (char*)g_dbus_method_invocation_get_sender(context);
+                       _bt_save_invocation_context(context, result, sender,
+                                       function_name, (gpointer)param);
+               }
+               break;
+       }
+       case BT_MESH_NODE_CONFIGURE_KEY: {
+               bluetooth_mesh_key_configure_t req;
+
+               memset(&req, 0x00, sizeof(bluetooth_mesh_key_configure_t));
+
+               __bt_service_get_parameters(in_param1,
+                               &req, sizeof(bluetooth_mesh_key_configure_t));
+
+               result = _bt_mesh_node_configure_key(
+                               requester_unique_creds, sender, &req);
+
+               /* Save invocation */
+               if (result != BLUETOOTH_ERROR_NONE) {
+                       g_array_append_vals(*out_param1,
+                               &req, sizeof(bluetooth_mesh_key_configure_t));
+               } else {
+                       bluetooth_mesh_key_configure_t *param = \
+                               g_memdup2(&req, sizeof(bluetooth_mesh_key_configure_t));
+
+                       sender = (char*)g_dbus_method_invocation_get_sender(context);
+                       _bt_save_invocation_context(context, result, sender,
+                                       function_name, (gpointer)param);
+               }
+               break;
+       }
+       case BT_MESH_NODE_TTL_EXECUTE: {
+               bluetooth_mesh_node_ttl_info_t req;
+
+               memset(&req, 0x00, sizeof(bluetooth_mesh_node_ttl_info_t));
+
+               __bt_service_get_parameters(in_param1,
+                               &req, sizeof(bluetooth_mesh_node_ttl_info_t));
+
+               result = _bt_mesh_ttl_execute_remote_node(
+                               requester_unique_creds, sender, &req);
+
+               /* Save invocation */
+               if (result != BLUETOOTH_ERROR_NONE) {
+                       g_array_append_vals(*out_param1, &req, sizeof(bluetooth_mesh_node_ttl_info_t));
+               } else {
+                       bluetooth_mesh_node_ttl_info_t *param =  \
+                               g_memdup2(&req, sizeof(bluetooth_mesh_node_ttl_info_t));
+
+                       sender = (char*)g_dbus_method_invocation_get_sender(context);
+                       _bt_save_invocation_context(context, result, sender,
+                                       function_name, (gpointer)param);
+               }
+               break;
+       }
+       case BT_MESH_MODEL_CONFIGURE_APPKEY: {
+               bluetooth_mesh_model_configure_t req;
+
+               memset(&req, 0x00, sizeof(bluetooth_mesh_model_configure_t));
+
+               __bt_service_get_parameters(in_param1,
+                               &req, sizeof(bluetooth_mesh_model_configure_t));
+
+               result = _bt_mesh_node_model_appkey_execute(
+                               requester_unique_creds, sender, &req);
+
+               /* Save invocation */
+               if (result != BLUETOOTH_ERROR_NONE) {
+                       g_array_append_vals(*out_param1, &req, sizeof(bluetooth_mesh_model_configure_t));
+               } else {
+                       bluetooth_mesh_model_configure_t *param =  \
+                               g_memdup2(&req, sizeof(bluetooth_mesh_model_configure_t));
+
+                       sender = (char*)g_dbus_method_invocation_get_sender(context);
+                       _bt_save_invocation_context(context, result, sender,
+                                       function_name, (gpointer)param);
+               }
+               break;
+       }
+       case BT_MESH_MODEL_EXECUTE_MSG: {
+               bluetooth_mesh_model_msg_t req;
+
+               memset(&req, 0x00, sizeof(bluetooth_mesh_model_msg_t));
+
+               __bt_service_get_parameters(in_param1,
+                               &req, sizeof(bluetooth_mesh_model_msg_t));
+
+               result = _bt_mesh_model_execute_msg(
+                               requester_unique_creds, sender, &req);
+
+               /* Save invocation */
+               if (result != BLUETOOTH_ERROR_NONE) {
+                       g_array_append_vals(*out_param1, &req, sizeof(bluetooth_mesh_model_msg_t));
+               } else {
+                       bluetooth_mesh_model_msg_t *param =  \
+                               g_memdup2(&req, sizeof(bluetooth_mesh_model_msg_t));
+
+                       sender = (char*)g_dbus_method_invocation_get_sender(context);
+                       _bt_save_invocation_context(context, result, sender,
+                                       function_name, (gpointer)param);
+               }
+               break;
+       }
+       case BT_MESH_MODEL_RESPONSE_MSG: {
+               bluetooth_mesh_model_msg_t req;
+               memset(&req, 0x00, sizeof(bluetooth_mesh_model_msg_t));
+               __bt_service_get_parameters(in_param1,
+                               &req, sizeof(bluetooth_mesh_model_msg_t));
+
+               result = _bt_mesh_model_send_response(
+                               requester_unique_creds, sender, &req);
+               if (result != BLUETOOTH_ERROR_NONE)
+                       g_array_append_vals(*out_param1, &req, sizeof(bluetooth_mesh_model_msg_t));
+               break;
+       }
+       case BT_MESH_NODE_GET_NETKEYS: {
+               bluetooth_mesh_node_discover_t node;
+               memset(&node, 0x00, sizeof(bluetooth_mesh_node_discover_t));
+               __bt_service_get_parameters(in_param1,
+                               &node, sizeof(bluetooth_mesh_node_discover_t));
+               result = _bt_mesh_network_node_get_netkeys(
+                               requester_unique_creds, &node, out_param1);
+               break;
+       }
+       case BT_MESH_NODE_GET_APPKEYS: {
+               bluetooth_mesh_node_discover_t node;
+               memset(&node, 0x00, sizeof(bluetooth_mesh_node_discover_t));
+               __bt_service_get_parameters(in_param1,
+                               &node, sizeof(bluetooth_mesh_node_discover_t));
+               result = _bt_mesh_network_node_get_appkeys(
+                               requester_unique_creds, sender, &node, out_param1);
+               break;
+       }
+       case BT_MESH_NODE_RESET: {
+               bluetooth_mesh_node_info_t node;
+               memset(&node, 0x00, sizeof(bluetooth_mesh_node_info_t));
+
+               __bt_service_get_parameters(in_param1,
+                               &node, sizeof(bluetooth_mesh_node_info_t));
+
+               BT_INFO("Mesh: Reset the Node");
+               result = _bt_mesh_network_reset_node(requester_unique_creds,
+                               sender, &node);
+
+               break;
+       }
+       case BT_MESH_MODEL_GET_APPKEY_LIST: {
+               bluetooth_mesh_model_configure_t req;
+
+               memset(&req, 0x00, sizeof(bluetooth_mesh_model_configure_t));
+
+               __bt_service_get_parameters(in_param1,
+                               &req, sizeof(bluetooth_mesh_model_configure_t));
+
+               result = _bt_mesh_node_model_get_appkey_list(
+                                       requester_unique_creds, sender, &req);
+
+               /* Save invocation */
+               if (result != BLUETOOTH_ERROR_NONE) {
+                       g_array_append_vals(*out_param1, &req, sizeof(bluetooth_mesh_model_configure_t));
+               } else {
+                       bluetooth_mesh_model_configure_t *param = \
+                               g_memdup2(&req, sizeof(bluetooth_mesh_model_configure_t));
+
+                       sender = (char*)g_dbus_method_invocation_get_sender(context);
+                       _bt_save_invocation_context(context, result, sender,
+                                       function_name, (gpointer)param);
+               }
+               break;
+       }
+       case BT_MESH_MODEL_GET_SUBSCRIPTION_LIST: {
+               bluetooth_mesh_model_configure_t req;
+
+               memset(&req, 0x00, sizeof(bluetooth_mesh_model_configure_t));
+
+               __bt_service_get_parameters(in_param1,
+                               &req, sizeof(bluetooth_mesh_model_configure_t));
+
+               result = _bt_mesh_node_model_get_subscription_list(
+                               requester_unique_creds, sender, &req);
+
+               /* Save invocation */
+               if (result != BLUETOOTH_ERROR_NONE) {
+                       g_array_append_vals(*out_param1, &req, sizeof(bluetooth_mesh_model_configure_t));
+               } else {
+                       bluetooth_mesh_model_configure_t *param =  \
+                               g_memdup2(&req, sizeof(bluetooth_mesh_model_configure_t));
+
+                       sender = (char*)g_dbus_method_invocation_get_sender(context);
+                       _bt_save_invocation_context(context, result, sender,
+                                       function_name, (gpointer)param);
+               }
+
+               break;
+       }
+       case BT_MESH_NETWORK_CREATE_GROUP: {
+               bluetooth_mesh_network_t net;
+               bluetooth_mesh_network_group_info_t res;
+               gboolean is_virtual;
+               uint16_t grp_addr;
+
+               memset(&net, 0x00, sizeof(bluetooth_mesh_network_t));
+               memset(&res, 0x00, sizeof(bluetooth_mesh_network_group_info_t));
+
+               __bt_service_get_parameters(in_param1,
+                               &net, sizeof(bluetooth_mesh_network_t));
+               __bt_service_get_parameters(in_param2,
+                               &is_virtual, sizeof(gboolean));
+               __bt_service_get_parameters(in_param3,
+                               &grp_addr, sizeof(guint16));
+
+               result = _bt_mesh_network_create_group(
+                               requester_unique_creds, sender, &net,
+                                       is_virtual, grp_addr, &res);
+
+               if (result == BLUETOOTH_ERROR_NONE)
+                       g_array_append_vals(*out_param1, &res,
+                               sizeof(bluetooth_mesh_network_group_info_t));
+               break;
+       }
+       case BT_MESH_NETWORK_REMOVE_GROUP: {
+               bluetooth_mesh_network_t net;
+               bluetooth_mesh_network_group_info_t req;
+
+               memset(&net, 0x00, sizeof(bluetooth_mesh_network_t));
+               memset(&req, 0x00, sizeof(bluetooth_mesh_network_group_info_t));
+
+               __bt_service_get_parameters(in_param1,
+                               &net, sizeof(bluetooth_mesh_network_t));
+               __bt_service_get_parameters(in_param2,
+                               &req, sizeof(bluetooth_mesh_network_group_info_t));
+
+               result = _bt_mesh_network_remove_group(
+                               requester_unique_creds, sender, &net, &req);
+
+               break;
+       }
+       case BT_MESH_MODEL_CONFIG_GROUP_SUB: {
+               bluetooth_mesh_model_configure_t req;
+
+               memset(&req, 0x00, sizeof(bluetooth_mesh_model_configure_t));
+
+               __bt_service_get_parameters(in_param1,
+                               &req, sizeof(bluetooth_mesh_model_configure_t));
+
+               result = _bt_mesh_model_configure_group_subscription(
+                               requester_unique_creds, sender, &req);
+
+               /* Save invocation */
+               if (result != BLUETOOTH_ERROR_NONE) {
+                       g_array_append_vals(*out_param1,
+                               &req, sizeof(bluetooth_mesh_model_configure_t));
+               } else {
+                       bluetooth_mesh_model_configure_t *param =  \
+                               g_memdup2(&req, sizeof(bluetooth_mesh_model_configure_t));
+
+                       sender = (char*)g_dbus_method_invocation_get_sender(context);
+                       _bt_save_invocation_context(context, result, sender,
+                                       function_name, (gpointer)param);
+               }
+               break;
+       }
+       case BT_MESH_MODEL_CONFIG_VIRTUAL_GROUP_SUB: {
+               bluetooth_mesh_model_configure_t req;
+
+               memset(&req, 0x00, sizeof(bluetooth_mesh_model_configure_t));
+
+               __bt_service_get_parameters(in_param1,
+                               &req, sizeof(bluetooth_mesh_model_configure_t));
+
+               result = _bt_mesh_model_configure_virtual_group_subscription(
+                               requester_unique_creds, sender, &req);
+
+               /* Save invocation */
+               if (result != BLUETOOTH_ERROR_NONE) {
+                       g_array_append_vals(*out_param1, &req, sizeof(bluetooth_mesh_model_configure_t));
+               } else {
+                       bluetooth_mesh_model_configure_t *param =  \
+                               g_memdup2(&req, sizeof(bluetooth_mesh_model_configure_t));
+
+                       sender = (char*)g_dbus_method_invocation_get_sender(context);
+                       _bt_save_invocation_context(context, result, sender,
+                                       function_name, (gpointer)param);
+               }
+               break;
+       }
+       case BT_MESH_MODEL_SET_PUBLICATION: {
+               bluetooth_mesh_model_configure_t req;
+
+               memset(&req, 0x00, sizeof(bluetooth_mesh_model_configure_t));
+
+               __bt_service_get_parameters(in_param1,
+                               &req, sizeof(bluetooth_mesh_model_configure_t));
+
+               result = _bt_mesh_model_set_publication(
+                               requester_unique_creds, sender, &req);
+
+               /* Save invocation */
+               if (result != BLUETOOTH_ERROR_NONE) {
+                       g_array_append_vals(*out_param1, &req, sizeof(bluetooth_mesh_model_configure_t));
                } else {
-                       bluetooth_mesh_network_t *net =  g_memdup(&network, sizeof(bluetooth_mesh_network_t));
+                       bluetooth_mesh_model_configure_t *param = g_memdup2(&req, sizeof(bluetooth_mesh_model_configure_t));
 
                        sender = (char*)g_dbus_method_invocation_get_sender(context);
                        _bt_save_invocation_context(context, result, sender,
-                                       function_name, (gpointer)net);
+                                       function_name, (gpointer)param);
                }
                break;
        }
-       case BT_MESH_NETWORK_DELETE_APPKEY: {
-               bluetooth_mesh_network_t network;
-               uint16_t net_idx;
-               uint16_t app_idx;
+       case BT_MESH_MODEL_GET_PUBLICATION: {
+               bluetooth_mesh_model_configure_t req;
 
-               memset(&network, 0x00, sizeof(bluetooth_mesh_network_t));
+               memset(&req, 0x00, sizeof(bluetooth_mesh_model_configure_t));
 
                __bt_service_get_parameters(in_param1,
-                               &network, sizeof(bluetooth_mesh_network_t));
-               __bt_service_get_parameters(in_param2,
-                               &net_idx, sizeof(guint16));
-               __bt_service_get_parameters(in_param3,
-                               &app_idx, sizeof(guint16));
+                               &req, sizeof(bluetooth_mesh_model_configure_t));
 
-               result = _bt_mesh_network_delete_appkey(requester_unique_creds,
-                               sender, &network, net_idx, app_idx);
+               result = _bt_mesh_model_get_publication(
+                                       requester_unique_creds, sender, &req);
 
+               /* Save invocation */
                if (result != BLUETOOTH_ERROR_NONE) {
-                       g_array_append_vals(*out_param1, &network, sizeof(bluetooth_mesh_network_t));
+                       g_array_append_vals(*out_param1,
+                               &req, sizeof(bluetooth_mesh_model_configure_t));
                } else {
-                       bluetooth_mesh_network_t *net =  g_memdup(&network, sizeof(bluetooth_mesh_network_t));
+                       bluetooth_mesh_model_configure_t *param =  \
+                               g_memdup2(&req, sizeof(bluetooth_mesh_model_configure_t));
 
                        sender = (char*)g_dbus_method_invocation_get_sender(context);
                        _bt_save_invocation_context(context, result, sender,
-                                       function_name, (gpointer)net);
+                                       function_name, (gpointer)param);
                }
                break;
        }
-       case BT_MESH_NETWORK_GET_NETKEYS: {
+       case BT_MESH_NETWORK_GET_GROUPS: {
                bluetooth_mesh_network_t network;
                memset(&network, 0x00, sizeof(bluetooth_mesh_network_t));
                __bt_service_get_parameters(in_param1,
                                &network, sizeof(bluetooth_mesh_network_t));
-               result = _bt_mesh_network_get_netkeys(requester_unique_creds,
-                               sender, &network, out_param1);
+               BT_INFO("Mesh: Request:: Get Groups");
+               result = _bt_mesh_network_get_groups(
+                               requester_unique_creds, sender, &network, out_param1);
                break;
        }
-       case BT_MESH_NETWORK_GET_APPKEYS: {
-               bluetooth_mesh_network_t network;
-               uint16_t net_idx;
+       case BT_L2CAP_LE_CLIENT_CONNECT: {
+               bluetooth_device_address_t address = { {0} };
+               int psm;
 
-               memset(&network, 0x00, sizeof(bluetooth_mesh_network_t));
                __bt_service_get_parameters(in_param1,
-                               &network, sizeof(bluetooth_mesh_network_t));
-               __bt_service_get_parameters(in_param2,
-                               &net_idx, sizeof(guint16));
-               result = _bt_mesh_network_get_appkeys(requester_unique_creds,
-                               sender, &network, net_idx, out_param1);
+                               &address, sizeof(bluetooth_device_address_t));
+
+               __bt_service_get_parameters(in_param2, &psm, sizeof(int));
+
+               result = _bt_l2cap_le_connect_using_psm(&address, psm);
+
+               if (result != BLUETOOTH_ERROR_NONE) {
+                       bluetooth_l2cap_le_connection_t conn_info;
+
+                       BT_ERR("BT_L2CAP_LE_CLIENT_CONNECT failed, send error errcode %d", result);
+                       memset(&conn_info, 0x00, sizeof(bluetooth_l2cap_le_connection_t));
+                       conn_info.device_role = L2CAP_LE_ROLE_CLIENT;
+                       conn_info.socket_fd = -1;
+                       conn_info.psm = psm;
+                       memcpy(&conn_info.device_addr, &address, sizeof(bluetooth_device_address_t));
+                       g_array_append_vals(*out_param1, &conn_info,
+                                       sizeof(bluetooth_l2cap_le_connection_t));
+               } else {
+                       bluetooth_l2cap_le_connection_t *conn_info;
+
+                       BT_INFO("BT_L2CAP_LE_CLIENT_CONNECT success, save context");
+                       sender = (char*)g_dbus_method_invocation_get_sender(context);
+                       conn_info = g_malloc0(sizeof(bluetooth_l2cap_le_connection_t));
+                       conn_info->socket_fd = -1;
+                       conn_info->device_role = L2CAP_LE_ROLE_CLIENT;
+                       conn_info->psm = psm;
+
+                       memcpy(&conn_info->device_addr, &address, sizeof(bluetooth_device_address_t));
+
+                       _bt_save_invocation_context(context, result, sender, function_name, (gpointer)conn_info);
+               }
+               break;
+       }
+       case BT_L2CAP_LE_SOCKET_DISCONNECT: {
+               /*
+                * Bluetooth L2CAP_LE socket disconnection will be done from bt-api, call to bt-service
+                * is only used for privilege check, so return BLUETOOTH_ERROR_NONE from here.
+                */
+               result = BLUETOOTH_ERROR_NONE;
+               break;
+       }
+       case BT_L2CAP_LE_SOCKET_WRITE: {
+               /*
+                * This call to bt-service is only used for privilege check, so return
+                * BLUETOOTH_ERROR_NONE from here.
+                */
+               result = BLUETOOTH_ERROR_NONE;
+               break;
+       }
+       case BT_L2CAP_LE_CREATE_SOCKET: {
+               /*
+                * This call to bt-service is only used for privilege check, so return
+                * BLUETOOTH_ERROR_NONE from here.
+                */
+               result = BLUETOOTH_ERROR_NONE;
+               break;
+       }
+       case BT_L2CAP_LE_LISTEN_AND_ACCEPT: {
+               int socket_fd = -1;
+               int psm;
+
+               __bt_service_get_parameters(in_param1, &psm, sizeof(int));
+
+               socket_fd = _bt_l2cap_le_socket_listen(psm, true);
+               if (socket_fd > 0) {
+                       result = BLUETOOTH_ERROR_NONE;
+                       sender = (char *)g_dbus_method_invocation_get_sender(context);
+                       _bt_save_invocation_context(context,
+                                       result, sender, function_name, NULL);
+               } else {
+                       g_array_append_vals(*out_param1, &socket_fd, sizeof(int));
+               }
+               break;
+       }
+       case BT_L2CAP_LE_LISTEN: {
+               int socket_fd = -1;
+               int psm;
+
+               __bt_service_get_parameters(in_param1, &psm, sizeof(int));
+
+               socket_fd = _bt_l2cap_le_socket_listen(psm, false);
+               if (socket_fd > 0) {
+                       result = BLUETOOTH_ERROR_NONE;
+                       sender = (char *)g_dbus_method_invocation_get_sender(context);
+                       _bt_save_invocation_context(context, result,
+                                       sender, function_name, NULL);
+               } else {
+                       g_array_append_vals(*out_param1, &socket_fd, sizeof(int));
+               }
+               break;
+       }
+       case BT_L2CAP_LE_ACCEPT_CONNECTION: {
+               char *address;
+
+               address = (char *)g_variant_get_data(in_param1);
+               result = _bt_socket_reply_conn_authorization(address, TRUE);
+               break;
+       }
+       case BT_L2CAP_LE_REJECT_CONNECTION: {
+               char *address;
+
+               address = (char *)g_variant_get_data(in_param1);
+               result = _bt_socket_reply_conn_authorization(address, FALSE);
+               break;
+       }
+       case BT_L2CAP_LE_REMOVE_SOCKET: {
+               /*
+                * This call to bt-service is only used for privilege check, so return
+                * BLUETOOTH_ERROR_NONE from here.
+                */
+               result = BLUETOOTH_ERROR_NONE;
                break;
        }
        default:
@@ -4291,6 +5243,180 @@ int __bt_core_request(int function_name,
        return result;
 }
 
+static int __bt_service_get_requester_app_id(const char *unique_name, char *app_id, int len)
+{
+       int ret;
+       pid_t pid = 0;
+
+       retv_if(bt_service_conn == NULL, BLUETOOTH_ERROR_INTERNAL);
+       retv_if(unique_name == NULL, BLUETOOTH_ERROR_INVALID_PARAM);
+
+       ret = __bt_service_get_sender_pid(unique_name, &pid);
+       if (ret != BLUETOOTH_ERROR_NONE) {
+               BT_ERR("Fail to get the sender pid");
+               return ret;
+       }
+
+       ret = aul_app_get_appid_bypid(pid, app_id, len);
+       if (ret != AUL_R_OK) {
+               BT_ERR("app_id not found");
+               return BLUETOOTH_ERROR_NOT_SUPPORT;
+       }
+       BT_DBG("Sender app_id: %s", app_id);
+
+       return BLUETOOTH_ERROR_NONE;
+}
+
+#ifdef TIZEN_FEATURE_BT_CONTAINER
+static void __bt_service_free_nspid(struct nspid_t *nspid)
+{
+       g_free(nspid->unique_name);
+       g_free(nspid);
+}
+
+static void __bt_service_cleanup_nspid_list(const char *unique_name)
+{
+       GSList *l;
+       struct nspid_t *nspid;
+
+       ret_if(unique_name == NULL);
+
+       for (l = nspid_list; l; l = g_slist_next(l)) {
+               nspid = l->data;
+               if (!nspid)
+                       continue;
+               if (!g_strcmp0(nspid->unique_name, unique_name)) {
+                       nspid_list = g_slist_remove(nspid_list, nspid);
+                       __bt_service_free_nspid(nspid);
+                       return;
+               }
+       }
+}
+
+static gboolean __bt_service_is_container_request(const char *unique_name)
+{
+       int ret;
+       pid_t pid;
+       char path[1024], buf[1024];
+       FILE *fp;
+       gboolean is_container = FALSE;
+       GSList *l;
+       struct nspid_t *nspid;
+
+       for (l = nspid_list; l; l = g_slist_next(l)) {
+               nspid = l->data;
+               if (!nspid)
+                       continue;
+               if (!g_strcmp0(nspid->unique_name, unique_name))
+                       return nspid->is_container;
+       }
+
+       ret = __bt_service_get_sender_pid(unique_name, &pid);
+       if (ret != BLUETOOTH_ERROR_NONE)
+               return FALSE;
+
+       sprintf(path, "/proc/%d/status", pid);
+       fp = fopen(path, "r");
+       if (fp == NULL) {
+               BT_ERR("fopen() failed. %d(%s)", errno, strerror(errno));
+               return FALSE;
+       }
+
+       while (fgets(buf, sizeof(buf), fp)) {
+               if (strstr(buf, "NSpid:")) {
+                       char *p = strchr(buf + 7, '\t'); /* find 2nd '\t' */
+                       if (p) {
+                               BT_DBG("caller is container process");
+                               is_container = TRUE;
+                               goto out;
+                       }
+                       break;
+               }
+       }
+
+out:
+       nspid = g_malloc0(sizeof(struct nspid_t));
+       nspid->unique_name = g_strdup(unique_name);
+       nspid->is_container = is_container;
+       nspid_list = g_slist_append(nspid_list, nspid);
+       fclose(fp);
+       return is_container;
+}
+#endif
+
+#ifdef TIZEN_FEATURE_BT_CONTAINER
+static gboolean __bt_service_check_privilege_in_container(int function_name,
+               const char *unique_name)
+{
+       int result = BLUETOOTH_ERROR_NONE;
+       GError *error = NULL;
+       GDBusProxy *proxy;
+       GArray *in_param1, *in_param2, *in_param3, *in_param4, *in_param5;
+       GVariant *param1, *param2, *param3, *param4, *param5, *out_param;
+
+       proxy = _bt_get_container_proxy();
+       if (proxy == NULL) {
+               BT_ERR("container proxy is NULL");
+               return FALSE;
+       }
+
+       in_param1 = g_array_new(TRUE, TRUE, sizeof(gchar));
+       in_param2 = g_array_new(TRUE, TRUE, sizeof(gchar));
+       in_param3 = g_array_new(TRUE, TRUE, sizeof(gchar));
+       in_param4 = g_array_new(TRUE, TRUE, sizeof(gchar));
+       in_param5 = g_array_new(TRUE, TRUE, sizeof(gchar));
+
+       /* The sender's privilege should be checked not bt-service in container */
+       g_array_append_vals(in_param1, unique_name, strlen(unique_name));
+
+       param1 = g_variant_new_from_data((const GVariantType *)"ay",
+                       in_param1->data, in_param1->len, TRUE, NULL, NULL);
+       param2 = g_variant_new_from_data((const GVariantType *)"ay",
+                       in_param2->data, in_param2->len, TRUE, NULL, NULL);
+       param3 = g_variant_new_from_data((const GVariantType *)"ay",
+                       in_param3->data, in_param3->len, TRUE, NULL, NULL);
+       param4 = g_variant_new_from_data((const GVariantType *)"ay",
+                       in_param4->data, in_param4->len, TRUE, NULL, NULL);
+       param5 = g_variant_new_from_data((const GVariantType *)"ay",
+                       in_param5->data, in_param5->len, TRUE, NULL, NULL);
+
+       BT_DBG("This request is from container. Privilege will be checked in container. unique_name: %s", unique_name);
+
+       GVariant *ret = g_dbus_proxy_call_sync(proxy, "service_request",
+                       g_variant_new("(iii@ay@ay@ay@ay@ay)",
+                                       BT_CHECK_PRIVILEGE, function_name,
+                                       BT_SYNC_REQ, param1, param2,
+                                       param3, param4, param5),
+                       G_DBUS_CALL_FLAGS_NONE, -1,
+                       NULL, &error);
+       if (ret == NULL) {
+               BT_ERR("dBUS-RPC is failed");
+
+               if (error != NULL) {
+                       BT_ERR("D-Bus API failure: errCode[%x], message[%s]",
+                                       error->code, error->message);
+                       g_clear_error(&error);
+               } else {
+                       BT_ERR("error returned was NULL");
+               }
+
+               result = BLUETOOTH_ERROR_INTERNAL;
+       } else {
+               g_variant_get(ret, "(iv)", &result, &out_param);
+               g_variant_unref(out_param);
+               g_variant_unref(ret);
+       }
+
+       g_array_free(in_param1, TRUE);
+       g_array_free(in_param2, TRUE);
+       g_array_free(in_param3, TRUE);
+       g_array_free(in_param4, TRUE);
+       g_array_free(in_param5, TRUE);
+
+       return (result == BLUETOOTH_ERROR_NONE) ? TRUE : FALSE;
+}
+#endif
+
 gboolean __bt_service_check_privilege(int function_name,
                                        int service_type,
                                        const char *unique_name)
@@ -4307,6 +5433,12 @@ gboolean __bt_service_check_privilege(int function_name,
        retv_if(unique_name == NULL, FALSE);
        retv_if(bt_service_conn == NULL, FALSE);
 
+#ifdef TIZEN_FEATURE_BT_CONTAINER
+       if (_bt_service_is_container() == FALSE)
+               if (__bt_service_is_container_request(unique_name) == TRUE)
+                       return __bt_service_check_privilege_in_container(function_name, unique_name);
+#endif
+
        ret_val = cynara_creds_get_default_client_method(&client_creds_method);
        if (ret_val != CYNARA_API_SUCCESS) {
                cynara_strerror(ret_val, err_msg, sizeof(err_msg));
@@ -4337,7 +5469,7 @@ gboolean __bt_service_check_privilege(int function_name,
                return FALSE;
        }
 
-//     BT_DBG("%s, %s, %s", unique_name, client_creds, user_creds);
+       BT_INFO("%s, %s, %s", unique_name, client_creds, user_creds);
 
        switch (function_name) {
        case BT_SET_LOCAL_NAME:
@@ -4354,6 +5486,7 @@ gboolean __bt_service_check_privilege(int function_name,
        case BT_STOP_LE_DISCOVERY:
        case BT_SET_SCAN_PARAMETERS:
        case BT_SET_SCAN_TYPE:
+       case BT_UPDATE_LE_CONNECTION_MODE:
 
        case BT_BOND_DEVICE:
        case BT_CANCEL_BONDING:
@@ -4409,11 +5542,9 @@ gboolean __bt_service_check_privilege(int function_name,
        case BT_AVRCP_SET_PROPERTIES:
        case BT_AVRCP_CONTROL_SET_PROPERTY:
 
-#ifdef TIZEN_FEATURE_BT_AVC_TARGET
        case BT_AUDIO_SET_ABSOLUTE_VOLUME:
        case BT_AUDIO_GET_ABSOLUTE_VOLUME:
        case BT_AUDIO_IS_AVC_ACTIVATED:
-#endif
 
        case BT_HF_CONNECT:
        case BT_HF_DISCONNECT:
@@ -4449,22 +5580,22 @@ gboolean __bt_service_check_privilege(int function_name,
        case BT_DPM_GET_DEVICE_RESTRITION:
        case BT_DPM_SET_UUID_RESTRITION:
        case BT_DPM_GET_UUID_RESTRITION:
-       case BT_DPM_ADD_DEVICES_BLACKLIST:
-       case BT_DPM_ADD_DEVICES_WHITELIST:
-       case BT_DPM_ADD_UUIDS_BLACKLIST:
-       case BT_DPM_ADD_UUIDS_WHITELIST:
-       case BT_DPM_CLEAR_DEVICES_BLACKLIST:
-       case BT_DPM_CLEAR_DEVICES_WHITELIST:
-       case BT_DPM_CLEAR_UUIDS_BLACKLIST:
-       case BT_DPM_CLEAR_UUIDS_WHITELIST:
-       case BT_DPM_REMOVE_DEVICE_BLACKLIST:
-       case BT_DPM_REMOVE_DEVICE_WHITELIST:
-       case BT_DPM_REMOVE_UUID_BLACKLIST:
-       case BT_DPM_REMOVE_UUID_WHITELIST:
-       case BT_DPM_GET_DEVICES_BLACKLIST:
-       case BT_DPM_GET_DEVICES_WHITELIST:
-       case BT_DPM_GET_UUIDS_BLACKLIST:
-       case BT_DPM_GET_UUIDS_WHITELIST:
+       case BT_DPM_ADD_DEVICES_BLOCKLIST:
+       case BT_DPM_ADD_DEVICES_ALLOWLIST:
+       case BT_DPM_ADD_UUIDS_BLOCKLIST:
+       case BT_DPM_ADD_UUIDS_ALLOWLIST:
+       case BT_DPM_CLEAR_DEVICES_BLOCKLIST:
+       case BT_DPM_CLEAR_DEVICES_ALLOWLIST:
+       case BT_DPM_CLEAR_UUIDS_BLOCKLIST:
+       case BT_DPM_CLEAR_UUIDS_ALLOWLIST:
+       case BT_DPM_REMOVE_DEVICE_BLOCKLIST:
+       case BT_DPM_REMOVE_DEVICE_ALLOWLIST:
+       case BT_DPM_REMOVE_UUID_BLOCKLIST:
+       case BT_DPM_REMOVE_UUID_ALLOWLIST:
+       case BT_DPM_GET_DEVICES_BLOCKLIST:
+       case BT_DPM_GET_DEVICES_ALLOWLIST:
+       case BT_DPM_GET_UUIDS_BLOCKLIST:
+       case BT_DPM_GET_UUIDS_ALLOWLIST:
        case BT_DPM_SET_ALLOW_OUTGOING_CALL:
        case BT_DPM_GET_ALLOW_OUTGOING_CALL:
        case BT_DPM_SET_PAIRING_STATE:
@@ -4487,15 +5618,12 @@ gboolean __bt_service_check_privilege(int function_name,
        case BT_NETWORK_SERVER_DISCONNECT:
 
        case BT_GATT_GET_PRIMARY_SERVICES:
-#ifdef TIZEN_GATT_CLIENT
        case BT_GATT_GET_SERVICE_PROPERTIES:             /* GATT Client */
        case BT_GATT_GET_CHARACTERISTIC_PROPERTIES:      /* GATT Client */
        case BT_GATT_WATCH_SERVICE_CHANGED_INDICATION:   /* GATT Client */
-#endif
        case BT_GATT_DISCOVER_CHARACTERISTICS:
        case BT_GATT_SET_PROPERTY_REQUEST:
        case BT_GATT_READ_CHARACTERISTIC:
-#ifdef TIZEN_GATT_CLIENT
        case BT_GATT_READ_DESCRIPTOR_VALUE:              /* GATT Client */
        case BT_GATT_WRITE_CHARACTERISTIC_VALUE_BY_TYPE: /* GATT Client */
        case BT_GATT_ACQUIRE_WRITE:
@@ -4503,7 +5631,6 @@ gboolean __bt_service_check_privilege(int function_name,
        case BT_GATT_WATCH_CHARACTERISTIC:               /* GATT Client */
        case BT_GATT_CLIENT_REGISTER:                    /* GATT Client */
        case BT_GATT_CLIENT_UNREGISTER:                   /* GATT Client */
-#endif
        case BT_GATT_DISCOVER_CHARACTERISTICS_DESCRIPTOR:
        case BT_GATT_REGISTER_APPLICATION:
        case BT_GATT_REGISTER_SERVICE:
@@ -4516,6 +5643,8 @@ gboolean __bt_service_check_privilege(int function_name,
        case BT_GATT_SERVER_START_SERVICE:
        case BT_GATT_SERVER_STOP_SERVICE:
        case BT_GATT_SERVER_DELETE_SERVICE:
+       case BT_GATT_SERVER_SET_SERVICE_PERSISTENCE:
+       case BT_GATT_SERVER_UNSET_SERVICE_PERSISTENCE:
        case BT_GATT_SERVER_SEND_RESPONSE:
        case BT_GATT_SERVER_ACQURE_WRITE_RESPONSE:
        case BT_GATT_SERVER_ACQUIRE_NOTIFY_RESPONSE:
@@ -4523,6 +5652,10 @@ gboolean __bt_service_check_privilege(int function_name,
        case BT_GATT_SERVER_UPDATE_VALUE:
        case BT_GATT_SERVER_DEREGISTER:
 #endif
+       case BT_GATT_SERVER_READ_PHY:
+       case BT_GATT_SERVER_SET_PHY:
+       case BT_GATT_CLIENT_READ_PHY:
+       case BT_GATT_CLIENT_SET_PHY:
        case BT_REQ_ATT_MTU:
        case BT_PBAP_CONNECT:
        case BT_PBAP_DISCONNECT:
@@ -4533,21 +5666,17 @@ gboolean __bt_service_check_privilege(int function_name,
        case BT_PBAP_PHONEBOOK_SEARCH:
 
        case BT_RFCOMM_LISTEN_AND_ACCEPT:
-       case BT_MESH_NETWORK_CREATE:
-       case BT_MESH_NETWORK_SCAN:
-       case BT_MESH_NETWORK_CANCEL_SCAN:
-       case BT_MESH_NETWORK_SET_CAPABILITIES:
-       case BT_MESH_NETWORK_PROVISION_DEVICE:
-       case BT_MESH_AUTHENTICATION_REPLY:
-       case BT_MESH_NETWORK_SET_NAME:
-       case BT_MESH_NETWORK_ADD_NETKEY:
-       case BT_MESH_NETWORK_DELETE_NETKEY:
-       case BT_MESH_NETWORK_UPDATE_NETKEY:
-       case BT_MESH_NETWORK_ADD_APPKEY:
-       case BT_MESH_NETWORK_DELETE_APPKEY:
-       case BT_MESH_NETWORK_UPDATE_APPKEY:
-       case BT_MESH_NETWORK_GET_NETKEYS:
-       case BT_MESH_NETWORK_GET_APPKEYS:
+
+       case BT_L2CAP_LE_CLIENT_CONNECT:
+       case BT_L2CAP_LE_CLIENT_CANCEL_CONNECT:
+       case BT_L2CAP_LE_SOCKET_DISCONNECT:
+       case BT_L2CAP_LE_SOCKET_WRITE:
+       case BT_L2CAP_LE_CREATE_SOCKET:
+       case BT_L2CAP_LE_REMOVE_SOCKET:
+       case BT_L2CAP_LE_LISTEN_AND_ACCEPT:
+       case BT_L2CAP_LE_ACCEPT_CONNECTION:
+       case BT_L2CAP_LE_REJECT_CONNECTION:
+       case BT_L2CAP_LE_LISTEN:
 
        ret_val = cynara_check(p_cynara, client_creds, client_session, user_creds,
                                                BT_PRIVILEGE_PUBLIC);
@@ -4580,9 +5709,9 @@ gboolean __bt_service_check_privilege(int function_name,
        case BT_DISABLE_ADAPTER_LE:
        case BT_SET_CONNECTABLE:
        case BT_SET_DISCOVERABLE_MODE:
-       case BT_ADD_WHITE_LIST:
-       case BT_REMOVE_WHITE_LIST:
-       case BT_CLEAR_WHITE_LIST:
+       case BT_ADD_ALLOW_LIST:
+       case BT_REMOVE_ALLOW_LIST:
+       case BT_CLEAR_ALLOW_LIST:
        case BT_SET_MANUFACTURER_DATA:
 
        case BT_CANCEL_SEARCH_SERVICE:
@@ -4595,8 +5724,6 @@ gboolean __bt_service_check_privilege(int function_name,
 
        case BT_HID_ENABLE_BARCODE_FEATURE:
 
-       case BT_AVRCP_CONTROL_GET_PROPERTY:
-       case BT_AVRCP_GET_TRACK_INFO:
        case BT_AVRCP_TRANSPORT_SET_PROPERTY:
        case BT_AVRCP_HANDLE_CONTROL_TO_DEST:
 
@@ -4605,7 +5732,6 @@ gboolean __bt_service_check_privilege(int function_name,
        case BT_SET_LE_PRIVACY:
        case BT_SET_LE_STATIC_RANDOM_ADDRESS:
        case BT_LE_CONN_UPDATE:
-       case BT_UPDATE_LE_CONNECTION_MODE:
        case BT_GET_DEVICE_IDA:
        case BT_LE_READ_MAXIMUM_DATA_LENGTH:
        case BT_LE_WRITE_HOST_SUGGESTED_DATA_LENGTH:
@@ -4660,6 +5786,50 @@ gboolean __bt_service_check_privilege(int function_name,
        case BT_MAP_PUSH_MESSAGE:
        case BT_MAP_GET_MESSAGE:
 
+       case BT_MESH_INIT:
+       case BT_MESH_DEINIT:
+       case BT_MESH_NETWORK_CREATE:
+       case BT_MESH_NETWORK_DESTROY:
+       case BT_MESH_NETWORK_LOAD:
+       case BT_MESH_NETWORK_UNLOAD:
+       case BT_MESH_NETWORK_JOIN:
+       case BT_MESH_CANCEL_JOIN:
+       case BT_MESH_NETWORK_SCAN:
+       case BT_MESH_NETWORK_CANCEL_SCAN:
+       case BT_MESH_NETWORK_SET_CAPABILITIES:
+       case BT_MESH_NETWORK_PROVISION_DEVICE:
+       case BT_MESH_AUTHENTICATION_REPLY:
+       case BT_MESH_NETWORK_SET_NAME:
+       case BT_MESH_NETWORK_ADD_NETKEY:
+       case BT_MESH_NETWORK_DELETE_NETKEY:
+       case BT_MESH_NETWORK_UPDATE_NETKEY:
+       case BT_MESH_NETWORK_ADD_APPKEY:
+       case BT_MESH_NETWORK_DELETE_APPKEY:
+       case BT_MESH_NETWORK_UPDATE_APPKEY:
+       case BT_MESH_NETWORK_GET_NETKEYS:
+       case BT_MESH_NETWORK_GET_APPKEYS:
+       case BT_MESH_NETWORK_GET_NODES:
+       case BT_MESH_ELEMENT_GET_MODELS:
+       case BT_MESH_NODE_BROWSE:
+       case BT_MESH_NODE_GET_VENDOR_FEATURES:
+       case BT_MESH_NODE_CONFIGURE_KEY:
+       case BT_MESH_NODE_TTL_EXECUTE:
+       case BT_MESH_NODE_GET_NETKEYS:
+       case BT_MESH_NODE_GET_APPKEYS:
+       case BT_MESH_NODE_RESET:
+       case BT_MESH_MODEL_CONFIGURE_APPKEY:
+       case BT_MESH_MODEL_GET_APPKEY_LIST:
+       case BT_MESH_MODEL_EXECUTE_MSG:
+       case BT_MESH_MODEL_RESPONSE_MSG:
+       case BT_MESH_NETWORK_CREATE_GROUP:
+       case BT_MESH_NETWORK_REMOVE_GROUP:
+       case BT_MESH_MODEL_CONFIG_GROUP_SUB:
+       case BT_MESH_MODEL_CONFIG_VIRTUAL_GROUP_SUB:
+       case BT_MESH_MODEL_GET_SUBSCRIPTION_LIST:
+       case BT_MESH_MODEL_SET_PUBLICATION:
+       case BT_MESH_MODEL_GET_PUBLICATION:
+       case BT_MESH_NETWORK_GET_GROUPS:
+
        ret_val = cynara_check(p_cynara, client_creds, client_session, user_creds,
                                BT_PRIVILEGE_PLATFORM);
 
@@ -4701,6 +5871,11 @@ gboolean __bt_service_check_privilege(int function_name,
        case BT_IS_ADVERTISING:
        case BT_IS_LE_2M_PHY_SUPPORTED:
        case BT_IS_LE_CODED_PHY_SUPPORTED:
+       case BT_SET_SCANNING_ROLE:
+       case BT_SET_SCANNING_PHY:
+       case BT_IS_LE_EXTENDED_ADVERTISING_SUPPORTED:
+       case BT_IS_LE_EXTENDED_SCAN_SUPPORTED:
+       case BT_LE_MAX_ADVERTISING_DATA_LEN:
        case BT_REGISTER_SCAN_FILTER:
        case BT_IS_SCAN_FILTER_SUPPORTED:
        case BT_GET_ATT_MTU:
@@ -4709,6 +5884,10 @@ gboolean __bt_service_check_privilege(int function_name,
        case BT_OBEX_SERVER_DEALLOCATE:
        case BT_OBEX_SERVER_IS_ACTIVATED:
        case BT_OPP_GET_TRANSFER_PROGRESS:
+       case BT_AVRCP_CONTROL_GET_PROPERTY:
+       case BT_AVRCP_GET_TRACK_INFO:
+
+       case BT_L2CAP_LE_IS_PSM_AVAILABLE:
                /* Non-privilege control */
                break;
        default:
@@ -4717,13 +5896,24 @@ gboolean __bt_service_check_privilege(int function_name,
                break;
        }
 
-       if (client_creds && function_name >= BT_FUNC_MESH_BASE) {
-               BT_INFO("MESH Function called creds [%s]", client_creds);
-               requester_unique_creds = g_strdup(client_creds);
-               free(client_creds);
+       if (function_name >= BT_FUNC_MESH_BASE) {
+               BT_INFO("MESH Function called");
+               char app_id[256] = { 0, };
 
-       } else
+               if (BLUETOOTH_ERROR_NONE == __bt_service_get_requester_app_id(unique_name,
+                                       app_id, sizeof(app_id))) {
+                       requester_unique_creds = g_strdup(app_id);
+               } else {
+                       BT_DBG("Requester app_id not found, use client creds");
+                       requester_unique_creds = g_strdup(client_creds);
+               }
+               BT_DBG("Requester unique_creds: %s", requester_unique_creds);
+       } else {
                BT_INFO("Non MESH Function called client creds [%s]", client_creds);
+       }
+
+       if (client_creds)
+               free(client_creds);
 
        if (user_creds)
                free(user_creds);
@@ -4792,7 +5982,7 @@ static void __name_owner_changed(GDBusConnection *connection,
        const char *new_owner = NULL;
 
        g_variant_get(parameters, "(&s&s&s)", &name, &old_owner, &new_owner);
-       if (*new_owner != '\0')
+       if (new_owner && *new_owner != '\0')
                return;
 
        _bt_check_hdp_app_termination(name);
@@ -4805,6 +5995,17 @@ static void __name_owner_changed(GDBusConnection *connection,
 
        /* Check if RFCOMM app is terminated */
        _bt_rfcomm_check_termination(name);
+
+       /* Mesh App Termination */
+       _bt_check_mesh_app_termination(name);
+
+       /* Stop the Transport Discovery service */
+       _bt_tds_stop_by_terminated_process(name);
+
+#ifdef TIZEN_FEATURE_BT_CONTAINER
+       /* Cleanup the NSpid list */
+       __bt_service_cleanup_nspid_list(name);
+#endif
 }
 
 static void __bt_service_bus_acquired_handler(GDBusConnection *connection,
@@ -4831,6 +6032,11 @@ static void __bt_service_name_acquired_handler(GDBusConnection *connection,
 {
        BT_INFO("name acquired");
        name_acquired = TRUE;
+
+#ifdef TIZEN_FEATURE_BT_CONTAINER
+       if (_bt_service_is_container() == TRUE)
+               __bt_service_bus_acquired_handler(connection, name, user_data);
+#endif
 }
 
 static void __bt_service_name_lost_handler(GDBusConnection *connection,
@@ -4896,6 +6102,56 @@ fail:
        return BLUETOOTH_ERROR_INTERNAL;
 }
 
+#ifdef TIZEN_FEATURE_BT_CONTAINER
+int _bt_service_register_in_container(void)
+{
+       GDBusConnection *conn;
+       GError *err = NULL;
+
+       conn = g_bus_get_sync(G_BUS_TYPE_SYSTEM, NULL, &err);
+       retv_if(conn == NULL, BLUETOOTH_ERROR_INTERNAL);
+
+       /* Register dbus name because systemd will down bt-service
+        * if we don't reigster the dbus name in container */
+       owner_id = g_bus_own_name(G_BUS_TYPE_SYSTEM,
+                               BT_SERVICE_NAME,
+                               G_BUS_NAME_OWNER_FLAGS_NONE,
+                               NULL, NULL, NULL, NULL, NULL);
+       BT_DBG("owner_id is [%d]", owner_id);
+       if (owner_id == 0)
+               goto fail;
+
+       conn = g_dbus_connection_new_for_address_sync(
+                       DBUS_HOST_SYSTEM_BUS_ADDRESS,
+                       G_DBUS_CONNECTION_FLAGS_AUTHENTICATION_CLIENT | G_DBUS_CONNECTION_FLAGS_MESSAGE_BUS_CONNECTION,
+                       NULL, NULL, &err);
+       retv_if(conn == NULL, BLUETOOTH_ERROR_INTERNAL);
+       bt_service_conn = conn;
+
+       /* Register to host dbus connection to call
+        * the method toward container in host bt-service */
+       owner_id = g_bus_own_name_on_connection(conn,
+                               BT_SERVICE_CONTAINER_NAME,
+                               G_BUS_NAME_OWNER_FLAGS_NONE,
+                               __bt_service_name_acquired_handler,
+                               __bt_service_name_lost_handler,
+                               NULL, NULL);
+       BT_DBG("owner_id is [%d]", owner_id);
+       if (owner_id == 0)
+               goto fail;
+
+       return BLUETOOTH_ERROR_NONE;
+
+fail:
+       if (bt_service_conn) {
+               g_object_unref(bt_service_conn);
+               bt_service_conn = NULL;
+       }
+
+       return BLUETOOTH_ERROR_INTERNAL;
+}
+#endif
+
 void _bt_service_unregister(void)
 {
        if (bt_service_conn) {
@@ -4914,6 +6170,13 @@ void _bt_service_unregister(void)
 
                __bt_service_register_object(bt_service_conn, NULL, FALSE);
        }
+
+#ifdef TIZEN_FEATURE_BT_CONTAINER
+       if (nspid_list) {
+               g_slist_free_full(nspid_list, (GDestroyNotify)__bt_service_free_nspid);
+               nspid_list = NULL;
+       }
+#endif
 }
 
 int _bt_service_cynara_init(void)