Correct the privilege check for BT_UPDATE_LE_CONNECTION_MODE
[platform/core/connectivity/bluetooth-frwk.git] / bt-service / services / bt-request-handler.c
index ad3562b..318aa25 100644 (file)
@@ -3643,6 +3643,64 @@ normal:
                                sender, &network);
                break;
        }
+       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,
+                               &node, sizeof(bluetooth_mesh_node_t));
+
+               param2 = g_array_new(TRUE, TRUE, sizeof(gchar));
+               __bt_fill_garray_from_variant(in_param2, param2);
+
+               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_memdup(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_CANCEL_JOIN: {
+               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: Cancel Join request");
+               result = _bt_mesh_cancel_join(requester_unique_creds,
+                               sender, &node);
+               if (result != BLUETOOTH_ERROR_NONE) {
+                       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;
@@ -4998,6 +5056,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:
@@ -5226,7 +5285,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:
@@ -5287,6 +5345,8 @@ gboolean __bt_service_check_privilege(int function_name,
        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: