From: Amit Purwar Date: Fri, 7 Aug 2020 09:38:46 +0000 (+0530) Subject: Fix the failed GTEST for mesh framework X-Git-Tag: submit/tizen/20200811.230110~3^2 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=c98831781ee3d691fdc0f8bba4f58879fb07c251;p=platform%2Fcore%2Fapi%2Fbluetooth.git Fix the failed GTEST for mesh framework Change-Id: Ia3be0ee2b66ccd67d87a8c9490f2e0f9655a2e31 Signed-off-by: Amit Purwar --- diff --git a/tests/unittest/tct-bluetooth-core_mobile.h b/tests/unittest/tct-bluetooth-core_mobile.h index 9a9912e..02765fb 100644 --- a/tests/unittest/tct-bluetooth-core_mobile.h +++ b/tests/unittest/tct-bluetooth-core_mobile.h @@ -505,7 +505,6 @@ extern int utc_bluetooth_bt_avrcp_control_get_track_info_n(void); extern int utc_bluetooth_bt_avrcp_control_free_track_info_n(void); extern int utc_bluetooth_bt_device_create_bond_p(void); extern int utc_bluetooth_bt_device_destroy_bond_p(void); -/* temporary build fix extern void utc_bluetooth_mesh_network_positive_startup(void); extern void utc_bluetooth_mesh_network_positive_cleanup(void); extern int utc_bluetooth_bt_mesh_initialize_p(void); @@ -587,7 +586,6 @@ extern int utc_bluetooth_bt_mesh_network_provision_device_n(void); extern int utc_bluetooth_bt_mesh_authentication_set_request_cb_n(void); extern int utc_bluetooth_bt_mesh_authentication_reply_n(void); extern int utc_bluetooth_bt_mesh_network_set_provisioning_capabilities_n(void); -*/ testcase tc_array[] = { @@ -1024,7 +1022,6 @@ testcase tc_array[] = { {"utc_bluetooth_bt_avrcp_control_free_track_info_n",utc_bluetooth_bt_avrcp_control_free_track_info_n,utc_bluetooth_avrcp_control_negative_startup,utc_bluetooth_avrcp_control_negative_cleanup}, {"utc_bluetooth_bt_device_create_bond_p",utc_bluetooth_bt_device_create_bond_p,utc_bluetooth_device_positive_startup,utc_bluetooth_device_positive_cleanup}, {"utc_bluetooth_bt_device_destroy_bond_p",utc_bluetooth_bt_device_destroy_bond_p,utc_bluetooth_device_positive_startup,utc_bluetooth_device_positive_cleanup}, -/* temporary build fix {"utc_bluetooth_bt_mesh_initialize_p", utc_bluetooth_bt_mesh_initialize_p, utc_bluetooth_mesh_network_positive_startup, utc_bluetooth_mesh_network_positive_cleanup}, {"utc_bluetooth_bt_mesh_deinitialize_p",utc_bluetooth_bt_mesh_deinitialize_p,utc_bluetooth_mesh_network_positive_startup, utc_bluetooth_mesh_network_positive_cleanup}, {"utc_bluetooth_bt_mesh_create_node_p",utc_bluetooth_bt_mesh_create_node_p,utc_bluetooth_mesh_network_positive_startup, utc_bluetooth_mesh_network_positive_cleanup}, @@ -1101,7 +1098,7 @@ testcase tc_array[] = { {"utc_bluetooth_bt_mesh_network_provision_device_n",utc_bluetooth_bt_mesh_network_provision_device_n,utc_bluetooth_mesh_network_negative_startup,utc_bluetooth_mesh_network_negative_cleanup}, {"utc_bluetooth_bt_mesh_authentication_set_request_cb_n",utc_bluetooth_bt_mesh_authentication_set_request_cb_n,utc_bluetooth_mesh_network_negative_startup,utc_bluetooth_mesh_network_negative_cleanup}, {"utc_bluetooth_bt_mesh_authentication_reply_n",utc_bluetooth_bt_mesh_authentication_reply_n,utc_bluetooth_mesh_network_negative_startup,utc_bluetooth_mesh_network_negative_cleanup}, - {"utc_bluetooth_bt_mesh_network_set_provisioning_capabilities_n",utc_bluetooth_bt_mesh_network_set_provisioning_capabilities_n,utc_bluetooth_mesh_network_negative_startup,utc_bluetooth_mesh_network_negative_cleanup}, */ + {"utc_bluetooth_bt_mesh_network_set_provisioning_capabilities_n",utc_bluetooth_bt_mesh_network_set_provisioning_capabilities_n,utc_bluetooth_mesh_network_negative_startup,utc_bluetooth_mesh_network_negative_cleanup}, {NULL, NULL} }; diff --git a/tests/unittest/utc_bluetooth_mesh_network_negative.c b/tests/unittest/utc_bluetooth_mesh_network_negative.c index bc5463f..161d08a 100644 --- a/tests/unittest/utc_bluetooth_mesh_network_negative.c +++ b/tests/unittest/utc_bluetooth_mesh_network_negative.c @@ -29,6 +29,11 @@ static GMainLoop *mainloop = NULL; static int ret = BT_ERROR_NONE; static bool bt_supported = false; static bool mesh_supported = false; +static bt_mesh_network_h network = NULL; +static char *token; +static char *network_name = "test-mesh"; +static bt_mesh_netkey_h netkey_h = NULL; +static bt_mesh_appkey_h appkey_h = NULL; static bool __bt_mesh_node_foreach_elem_cb(int result, bt_mesh_node_h node, int total, @@ -49,7 +54,7 @@ static bool __bt_mesh_network_netkey_info_cb(int result, bt_mesh_network_h netwo return true; } -static void __bt_mesh_network_scan_unprovisioned_device_result_cb(int result, bt_mesh_network_h network, +static void __bt_mesh_network_scan_unprovisioned_device_result_cb_n(int result, bt_mesh_network_h network, bt_mesh_scanning_state_e state, bt_mesh_scan_result_s *scan_res, void *user_data) { if (mainloop) @@ -456,10 +461,6 @@ int utc_bluetooth_bt_mesh_network_create_n(void) bt_mesh_node_features_s features; bt_mesh_node_h node_h = NULL; bt_mesh_element_h elem_h = NULL; - bt_mesh_model_h model_h = NULL; - bt_mesh_model_id_s mod_id; - char *network_name = "test-mesh"; - bt_mesh_network_h network; if (mesh_supported) { assert_eq(startup_flag, BT_ERROR_NONE); @@ -469,11 +470,6 @@ int utc_bluetooth_bt_mesh_network_create_n(void) ret = bt_mesh_node_create(&features, &node_h); ret = bt_mesh_node_create_element(node_h, &elem_h); - - mod_id.model_id = BT_MESH_MODEL_ID_GEN_LEVEL_SRV; - mod_id.company_id = 0xFFFF; - ret = bt_mesh_element_create_model(elem_h, &mod_id, &model_h); - ret = bt_mesh_network_create(node_h, (const char*)network_name, &network, NULL); assert_eq(ret, BT_ERROR_INVALID_PARAMETER); } else { @@ -492,9 +488,6 @@ int utc_bluetooth_bt_mesh_network_load_n(void) bt_mesh_element_h elem_h = NULL; bt_mesh_model_h model_h = NULL; bt_mesh_model_id_s mod_id; - char *network_name = "test-mesh"; - char *token; - bt_mesh_network_h network; if (mesh_supported) { assert_eq(startup_flag, BT_ERROR_NONE); @@ -523,29 +516,10 @@ int utc_bluetooth_bt_mesh_network_load_n(void) int utc_bluetooth_bt_mesh_network_set_name_n(void) { int ret = BT_ERROR_NONE; - bt_mesh_node_features_s features; - bt_mesh_node_h node_h = NULL; - bt_mesh_element_h elem_h = NULL; - bt_mesh_model_h model_h = NULL; - bt_mesh_model_id_s mod_id; - char *network_name = "test-mesh"; - char *token; - bt_mesh_network_h network = NULL; if (mesh_supported) { assert_eq(startup_flag, BT_ERROR_NONE); - features.features = BT_MESH_FEATURE_RELAY; - features.features |= BT_MESH_FEATURE_LOWPOWER; - ret = bt_mesh_node_create(&features, &node_h); - ret = bt_mesh_node_create_element(node_h, &elem_h); - - - mod_id.model_id = BT_MESH_MODEL_ID_GEN_LEVEL_SRV; - mod_id.company_id = 0xFFFF; - ret = bt_mesh_element_create_model(elem_h, &mod_id, &model_h); - ret = bt_mesh_network_create(node_h, (const char*)network_name, &network, &token); - ret = bt_mesh_network_set_name(network, NULL); assert_eq(ret, BT_ERROR_INVALID_PARAMETER); } else { @@ -559,29 +533,10 @@ int utc_bluetooth_bt_mesh_network_set_name_n(void) int utc_bluetooth_bt_mesh_network_get_name_n(void) { int ret = BT_ERROR_NONE; - bt_mesh_node_features_s features; - bt_mesh_node_h node_h = NULL; - bt_mesh_element_h elem_h = NULL; - bt_mesh_model_h model_h = NULL; - bt_mesh_model_id_s mod_id; - char *network_name = "test-mesh"; - char *token; - bt_mesh_network_h network = NULL; if (mesh_supported) { assert_eq(startup_flag, BT_ERROR_NONE); - features.features = BT_MESH_FEATURE_RELAY; - features.features |= BT_MESH_FEATURE_LOWPOWER; - ret = bt_mesh_node_create(&features, &node_h); - ret = bt_mesh_node_create_element(node_h, &elem_h); - - - mod_id.model_id = BT_MESH_MODEL_ID_GEN_LEVEL_SRV; - mod_id.company_id = 0xFFFF; - ret = bt_mesh_element_create_model(elem_h, &mod_id, &model_h); - ret = bt_mesh_network_create(node_h, (const char*)network_name, &network, &token); - ret = bt_mesh_network_get_name(network, NULL); assert_eq(ret, BT_ERROR_INVALID_PARAMETER); } else { @@ -595,33 +550,14 @@ int utc_bluetooth_bt_mesh_network_get_name_n(void) int utc_bluetooth_bt_mesh_network_add_netkey_n(void) { int ret = BT_ERROR_NONE; - bt_mesh_node_features_s features; - bt_mesh_node_h node_h = NULL; - bt_mesh_element_h elem_h = NULL; - bt_mesh_model_h model_h = NULL; - bt_mesh_model_id_s mod_id; - char *network_name = "test-mesh"; - char *token; - bt_mesh_network_h network = NULL; - bt_mesh_netkey_h n_h = NULL; if (mesh_supported) { assert_eq(startup_flag, BT_ERROR_NONE); - features.features = BT_MESH_FEATURE_RELAY; - features.features |= BT_MESH_FEATURE_LOWPOWER; - ret = bt_mesh_node_create(&features, &node_h); - ret = bt_mesh_node_create_element(node_h, &elem_h); - - mod_id.model_id = BT_MESH_MODEL_ID_GEN_LEVEL_SRV; - mod_id.company_id = 0xFFFF; - ret = bt_mesh_element_create_model(elem_h, &mod_id, &model_h); - ret = bt_mesh_network_create(node_h, (const char*)network_name, &network, &token); - - ret = bt_mesh_network_add_netkey(NULL, &n_h); + ret = bt_mesh_network_add_netkey(NULL, &netkey_h); assert_eq(ret, BT_ERROR_INVALID_PARAMETER); } else { - ret = bt_mesh_network_add_netkey(network, &n_h); + ret = bt_mesh_network_add_netkey(network, &netkey_h); assert_eq(ret, BT_ERROR_NOT_SUPPORTED); } @@ -631,30 +567,10 @@ int utc_bluetooth_bt_mesh_network_add_netkey_n(void) int utc_bluetooth_bt_mesh_network_foreach_netkeys_n(void) { int ret = BT_ERROR_NONE; - bt_mesh_node_features_s features; - bt_mesh_node_h node_h = NULL; - bt_mesh_element_h elem_h = NULL; - bt_mesh_model_h model_h = NULL; - bt_mesh_model_id_s mod_id; - char *network_name = "test-mesh"; - char *token; - bt_mesh_network_h network = NULL; - bt_mesh_netkey_h n_h = NULL; if (mesh_supported) { assert_eq(startup_flag, BT_ERROR_NONE); - features.features = BT_MESH_FEATURE_RELAY; - features.features |= BT_MESH_FEATURE_LOWPOWER; - ret = bt_mesh_node_create(&features, &node_h); - ret = bt_mesh_node_create_element(node_h, &elem_h); - - mod_id.model_id = BT_MESH_MODEL_ID_GEN_LEVEL_SRV; - mod_id.company_id = 0xFFFF; - ret = bt_mesh_element_create_model(elem_h, &mod_id, &model_h); - ret = bt_mesh_network_create(node_h, (const char*)network_name, &network, &token); - ret = bt_mesh_network_add_netkey(network, &n_h); - ret = bt_mesh_network_foreach_netkeys(NULL, __bt_mesh_network_netkey_info_cb, NULL); assert_eq(ret, BT_ERROR_INVALID_PARAMETER); } else { @@ -668,31 +584,11 @@ int utc_bluetooth_bt_mesh_network_foreach_netkeys_n(void) int utc_bluetooth_bt_mesh_netkey_get_index_n(void) { int ret = BT_ERROR_NONE; - bt_mesh_node_features_s features; - bt_mesh_node_h node_h = NULL; - bt_mesh_element_h elem_h = NULL; - bt_mesh_model_h model_h = NULL; - bt_mesh_model_id_s mod_id; - char *network_name = "test-mesh"; - char *token; - bt_mesh_network_h network = NULL; - bt_mesh_netkey_h netkey_h = NULL; uint16_t indx = 0xFFFF; if (mesh_supported) { assert_eq(startup_flag, BT_ERROR_NONE); - features.features = BT_MESH_FEATURE_RELAY; - features.features |= BT_MESH_FEATURE_LOWPOWER; - ret = bt_mesh_node_create(&features, &node_h); - ret = bt_mesh_node_create_element(node_h, &elem_h); - - mod_id.model_id = BT_MESH_MODEL_ID_GEN_LEVEL_SRV; - mod_id.company_id = 0xFFFF; - ret = bt_mesh_element_create_model(elem_h, &mod_id, &model_h); - ret = bt_mesh_network_create(node_h, (const char*)network_name, &network, &token); - ret = bt_mesh_network_add_netkey(network, &netkey_h); - ret = bt_mesh_netkey_get_index(NULL, &indx); assert_eq(ret, BT_ERROR_INVALID_PARAMETER); } else { @@ -706,30 +602,10 @@ int utc_bluetooth_bt_mesh_netkey_get_index_n(void) int utc_bluetooth_bt_mesh_netkey_update_n(void) { int ret = BT_ERROR_NONE; - bt_mesh_node_features_s features; - bt_mesh_node_h node_h = NULL; - bt_mesh_element_h elem_h = NULL; - bt_mesh_model_h model_h = NULL; - bt_mesh_model_id_s mod_id; - char *network_name = "test-mesh"; - char *token; - bt_mesh_network_h network = NULL; - bt_mesh_netkey_h netkey_h = NULL; if (mesh_supported) { assert_eq(startup_flag, BT_ERROR_NONE); - features.features = BT_MESH_FEATURE_RELAY; - features.features |= BT_MESH_FEATURE_LOWPOWER; - ret = bt_mesh_node_create(&features, &node_h); - ret = bt_mesh_node_create_element(node_h, &elem_h); - - mod_id.model_id = BT_MESH_MODEL_ID_GEN_LEVEL_SRV; - mod_id.company_id = 0xFFFF; - ret = bt_mesh_element_create_model(elem_h, &mod_id, &model_h); - ret = bt_mesh_network_create(node_h, (const char*)network_name, &network, &token); - ret = bt_mesh_network_add_netkey(network, &netkey_h); - ret = bt_mesh_netkey_update(NULL); assert_eq(ret, BT_ERROR_INVALID_PARAMETER); } else { @@ -744,30 +620,10 @@ int utc_bluetooth_bt_mesh_netkey_update_n(void) int utc_bluetooth_bt_mesh_netkey_delete_n(void) { int ret = BT_ERROR_NONE; - bt_mesh_node_features_s features; - bt_mesh_node_h node_h = NULL; - bt_mesh_element_h elem_h = NULL; - bt_mesh_model_h model_h = NULL; - bt_mesh_model_id_s mod_id; - char *network_name = "test-mesh"; - char *token; - bt_mesh_network_h network = NULL; - bt_mesh_netkey_h netkey_h = NULL; if (mesh_supported) { assert_eq(startup_flag, BT_ERROR_NONE); - features.features = BT_MESH_FEATURE_RELAY; - features.features |= BT_MESH_FEATURE_LOWPOWER; - ret = bt_mesh_node_create(&features, &node_h); - ret = bt_mesh_node_create_element(node_h, &elem_h); - - mod_id.model_id = BT_MESH_MODEL_ID_GEN_LEVEL_SRV; - mod_id.company_id = 0xFFFF; - ret = bt_mesh_element_create_model(elem_h, &mod_id, &model_h); - ret = bt_mesh_network_create(node_h, (const char*)network_name, &network, &token); - ret = bt_mesh_network_add_netkey(network, &netkey_h); - ret = bt_mesh_netkey_delete(NULL); assert_eq(ret, BT_ERROR_INVALID_PARAMETER); } else { @@ -781,31 +637,10 @@ int utc_bluetooth_bt_mesh_netkey_delete_n(void) int utc_bluetooth_bt_mesh_netkey_add_appkey_n(void) { int ret = BT_ERROR_NONE; - bt_mesh_node_features_s features; - bt_mesh_node_h node_h = NULL; - bt_mesh_element_h elem_h = NULL; - bt_mesh_model_h model_h = NULL; - bt_mesh_model_id_s mod_id; - char *network_name = "test-mesh"; - char *token; - bt_mesh_network_h network; - bt_mesh_netkey_h netkey_h = NULL; - bt_mesh_appkey_h appkey_h; if (mesh_supported) { assert_eq(startup_flag, BT_ERROR_NONE); - features.features = BT_MESH_FEATURE_RELAY; - features.features |= BT_MESH_FEATURE_LOWPOWER; - ret = bt_mesh_node_create(&features, &node_h); - ret = bt_mesh_node_create_element(node_h, &elem_h); - - mod_id.model_id = BT_MESH_MODEL_ID_GEN_LEVEL_SRV; - mod_id.company_id = 0xFFFF; - ret = bt_mesh_element_create_model(elem_h, &mod_id, &model_h); - ret = bt_mesh_network_create(node_h, (const char*)network_name, &network, &token); - ret = bt_mesh_network_add_netkey(network, &netkey_h); - ret = bt_mesh_netkey_add_appkey(NULL, &appkey_h); assert_eq(ret, BT_ERROR_INVALID_PARAMETER); } else { @@ -819,30 +654,10 @@ int utc_bluetooth_bt_mesh_netkey_add_appkey_n(void) int utc_bluetooth_bt_mesh_netkey_foreach_appkeys_n(void) { int ret = BT_ERROR_NONE; - bt_mesh_node_features_s features; - bt_mesh_node_h node_h = NULL; - bt_mesh_element_h elem_h = NULL; - bt_mesh_model_h model_h = NULL; - bt_mesh_model_id_s mod_id; - char *network_name = "test-mesh"; - char *token = NULL; - bt_mesh_network_h network = NULL; - bt_mesh_netkey_h netkey_h = NULL; if (mesh_supported) { assert_eq(startup_flag, BT_ERROR_NONE); - features.features = BT_MESH_FEATURE_RELAY; - features.features |= BT_MESH_FEATURE_LOWPOWER; - ret = bt_mesh_node_create(&features, &node_h); - ret = bt_mesh_node_create_element(node_h, &elem_h); - - mod_id.model_id = BT_MESH_MODEL_ID_GEN_LEVEL_SRV; - mod_id.company_id = 0xFFFF; - ret = bt_mesh_element_create_model(elem_h, &mod_id, &model_h); - ret = bt_mesh_network_create(node_h, (const char*)network_name, &network, &token); - ret = bt_mesh_network_add_netkey(network, &netkey_h); - ret = bt_mesh_netkey_foreach_appkeys(netkey_h, NULL, NULL); assert_eq(ret, BT_ERROR_INVALID_PARAMETER); } else { @@ -856,33 +671,11 @@ int utc_bluetooth_bt_mesh_netkey_foreach_appkeys_n(void) int utc_bluetooth_bt_mesh_appkey_get_index_n(void) { int ret = BT_ERROR_NONE; - bt_mesh_node_features_s features; - bt_mesh_node_h node_h = NULL; - bt_mesh_element_h elem_h = NULL; - bt_mesh_model_h model_h = NULL; - bt_mesh_model_id_s mod_id; - char *network_name = "test-mesh"; - char *token = NULL; - bt_mesh_network_h network = NULL; - bt_mesh_netkey_h netkey_h = NULL; uint16_t index = 0xFFFF; - bt_mesh_appkey_h appkey_h = NULL; if (mesh_supported) { assert_eq(startup_flag, BT_ERROR_NONE); - features.features = BT_MESH_FEATURE_RELAY; - features.features |= BT_MESH_FEATURE_LOWPOWER; - ret = bt_mesh_node_create(&features, &node_h); - ret = bt_mesh_node_create_element(node_h, &elem_h); - - mod_id.model_id = BT_MESH_MODEL_ID_GEN_LEVEL_SRV; - mod_id.company_id = 0xFFFF; - ret = bt_mesh_element_create_model(elem_h, &mod_id, &model_h); - ret = bt_mesh_network_create(node_h, (const char*)network_name, &network, &token); - ret = bt_mesh_network_add_netkey(network, &netkey_h); - ret = bt_mesh_netkey_add_appkey(netkey_h, &appkey_h); - ret = bt_mesh_appkey_get_index(NULL, &index); assert_eq(ret, BT_ERROR_INVALID_PARAMETER); } else { @@ -896,32 +689,10 @@ int utc_bluetooth_bt_mesh_appkey_get_index_n(void) int utc_bluetooth_bt_mesh_appkey_update_n(void) { int ret = BT_ERROR_NONE; - bt_mesh_node_features_s features; - bt_mesh_node_h node_h = NULL; - bt_mesh_element_h elem_h = NULL; - bt_mesh_model_h model_h = NULL; - bt_mesh_model_id_s mod_id; - char *network_name = "test-mesh"; - char *token = NULL; - bt_mesh_network_h network = NULL; - bt_mesh_netkey_h netkey_h = NULL; - bt_mesh_appkey_h appkey_h = NULL; if (mesh_supported) { assert_eq(startup_flag, BT_ERROR_NONE); - features.features = BT_MESH_FEATURE_RELAY; - features.features |= BT_MESH_FEATURE_LOWPOWER; - ret = bt_mesh_node_create(&features, &node_h); - ret = bt_mesh_node_create_element(node_h, &elem_h); - - mod_id.model_id = BT_MESH_MODEL_ID_GEN_LEVEL_SRV; - mod_id.company_id = 0xFFFF; - ret = bt_mesh_element_create_model(elem_h, &mod_id, &model_h); - ret = bt_mesh_network_create(node_h, (const char*)network_name, &network, &token); - ret = bt_mesh_network_add_netkey(network, &netkey_h); - ret = bt_mesh_netkey_add_appkey(netkey_h, &appkey_h); - ret = bt_mesh_appkey_update(NULL); assert_eq(ret, BT_ERROR_INVALID_PARAMETER); } else { @@ -935,32 +706,10 @@ int utc_bluetooth_bt_mesh_appkey_update_n(void) int utc_bluetooth_bt_mesh_appkey_delete_n(void) { int ret = BT_ERROR_NONE; - bt_mesh_node_features_s features; - bt_mesh_node_h node_h = NULL; - bt_mesh_element_h elem_h = NULL; - bt_mesh_model_h model_h = NULL; - bt_mesh_model_id_s mod_id; - char *network_name = "test-mesh"; - char *token = NULL; - bt_mesh_network_h network = NULL; - bt_mesh_netkey_h netkey_h = NULL; - bt_mesh_appkey_h appkey_h = NULL; if (mesh_supported) { assert_eq(startup_flag, BT_ERROR_NONE); - features.features = BT_MESH_FEATURE_RELAY; - features.features |= BT_MESH_FEATURE_LOWPOWER; - ret = bt_mesh_node_create(&features, &node_h); - ret = bt_mesh_node_create_element(node_h, &elem_h); - - mod_id.model_id = BT_MESH_MODEL_ID_GEN_LEVEL_SRV; - mod_id.company_id = 0xFFFF; - ret = bt_mesh_element_create_model(elem_h, &mod_id, &model_h); - ret = bt_mesh_network_create(node_h, (const char*)network_name, &network, &token); - ret = bt_mesh_network_add_netkey(network, &netkey_h); - ret = bt_mesh_netkey_add_appkey(netkey_h, &appkey_h); - ret = bt_mesh_appkey_delete(NULL); assert_eq(ret, BT_ERROR_INVALID_PARAMETER); } else { @@ -974,32 +723,10 @@ int utc_bluetooth_bt_mesh_appkey_delete_n(void) int utc_bluetooth_bt_mesh_network_foreach_devices_n(void) { int ret = BT_ERROR_NONE; - bt_mesh_node_features_s features; - bt_mesh_node_h node_h = NULL; - bt_mesh_element_h elem_h = NULL; - bt_mesh_model_h model_h = NULL; - bt_mesh_model_id_s mod_id; - char *network_name = "test-mesh"; - char *token = NULL; - bt_mesh_network_h network = NULL; - bt_mesh_netkey_h netkey_h = NULL; - bt_mesh_appkey_h appkey_h = NULL; if (mesh_supported) { assert_eq(startup_flag, BT_ERROR_NONE); - features.features = BT_MESH_FEATURE_RELAY; - features.features |= BT_MESH_FEATURE_LOWPOWER; - ret = bt_mesh_node_create(&features, &node_h); - ret = bt_mesh_node_create_element(node_h, &elem_h); - - mod_id.model_id = BT_MESH_MODEL_ID_GEN_LEVEL_SRV; - mod_id.company_id = 0xFFFF; - ret = bt_mesh_element_create_model(elem_h, &mod_id, &model_h); - ret = bt_mesh_network_create(node_h, (const char*)network_name, &network, &token); - ret = bt_mesh_network_add_netkey(network, &netkey_h); - ret = bt_mesh_netkey_add_appkey(netkey_h, &appkey_h); - ret = bt_mesh_network_foreach_devices(network, NULL, NULL); assert_eq(ret, BT_ERROR_INVALID_PARAMETER); } else { @@ -1013,34 +740,12 @@ int utc_bluetooth_bt_mesh_network_foreach_devices_n(void) int utc_bluetooth_bt_mesh_network_create_group_n(void) { int ret = BT_ERROR_NONE; - bt_mesh_node_features_s features; - bt_mesh_node_h node_h = NULL; - bt_mesh_element_h elem_h = NULL; - bt_mesh_model_h model_h = NULL; - bt_mesh_model_id_s mod_id; - char *network_name = "test-mesh"; - char *token = NULL; - bt_mesh_network_h network = NULL; - bt_mesh_netkey_h netkey_h = NULL; - bt_mesh_appkey_h appkey_h = NULL; uint16_t group_addr = 0xc001; bt_mesh_group_h group_h = NULL; if (mesh_supported) { assert_eq(startup_flag, BT_ERROR_NONE); - features.features = BT_MESH_FEATURE_RELAY; - features.features |= BT_MESH_FEATURE_LOWPOWER; - ret = bt_mesh_node_create(&features, &node_h); - ret = bt_mesh_node_create_element(node_h, &elem_h); - - mod_id.model_id = BT_MESH_MODEL_ID_GEN_LEVEL_SRV; - mod_id.company_id = 0xFFFF; - ret = bt_mesh_element_create_model(elem_h, &mod_id, &model_h); - ret = bt_mesh_network_create(node_h, (const char*)network_name, &network, &token); - ret = bt_mesh_network_add_netkey(network, &netkey_h); - ret = bt_mesh_netkey_add_appkey(netkey_h, &appkey_h); - ret = bt_mesh_network_create_group(NULL, group_addr, &group_h); assert_eq(ret, BT_ERROR_INVALID_PARAMETER); } else { @@ -1054,33 +759,11 @@ int utc_bluetooth_bt_mesh_network_create_group_n(void) int utc_bluetooth_bt_mesh_network_create_virtual_group_n(void) { int ret = BT_ERROR_NONE; - bt_mesh_node_features_s features; - bt_mesh_node_h node_h = NULL; - bt_mesh_element_h elem_h = NULL; - bt_mesh_model_h model_h = NULL; - bt_mesh_model_id_s mod_id; - char *network_name = "test-mesh"; - char *token = NULL; - bt_mesh_network_h network = NULL; - bt_mesh_netkey_h netkey_h = NULL; - bt_mesh_appkey_h appkey_h = NULL; bt_mesh_group_h group_h = NULL; if (mesh_supported) { assert_eq(startup_flag, BT_ERROR_NONE); - features.features = BT_MESH_FEATURE_RELAY; - features.features |= BT_MESH_FEATURE_LOWPOWER; - ret = bt_mesh_node_create(&features, &node_h); - ret = bt_mesh_node_create_element(node_h, &elem_h); - - mod_id.model_id = BT_MESH_MODEL_ID_GEN_LEVEL_SRV; - mod_id.company_id = 0xFFFF; - ret = bt_mesh_element_create_model(elem_h, &mod_id, &model_h); - ret = bt_mesh_network_create(node_h, (const char*)network_name, &network, &token); - ret = bt_mesh_network_add_netkey(network, &netkey_h); - ret = bt_mesh_netkey_add_appkey(netkey_h, &appkey_h); - ret = bt_mesh_network_create_virtual_group(NULL, &group_h); assert_eq(ret, BT_ERROR_INVALID_PARAMETER); } else { @@ -1094,35 +777,11 @@ int utc_bluetooth_bt_mesh_network_create_virtual_group_n(void) int utc_bluetooth_bt_mesh_network_remove_group_n(void) { int ret = BT_ERROR_NONE; - bt_mesh_node_features_s features; - bt_mesh_node_h node_h = NULL; - bt_mesh_element_h elem_h = NULL; - bt_mesh_model_h model_h = NULL; - bt_mesh_model_id_s mod_id; - char *network_name = "test-mesh"; - char *token = NULL; - bt_mesh_network_h network = NULL; - bt_mesh_netkey_h netkey_h = NULL; - bt_mesh_appkey_h appkey_h = NULL; bt_mesh_group_h group_h = NULL; - uint16_t group_addr = 0xc001; if (mesh_supported) { assert_eq(startup_flag, BT_ERROR_NONE); - features.features = BT_MESH_FEATURE_RELAY; - features.features |= BT_MESH_FEATURE_LOWPOWER; - ret = bt_mesh_node_create(&features, &node_h); - ret = bt_mesh_node_create_element(node_h, &elem_h); - - mod_id.model_id = BT_MESH_MODEL_ID_GEN_LEVEL_SRV; - mod_id.company_id = 0xFFFF; - ret = bt_mesh_element_create_model(elem_h, &mod_id, &model_h); - ret = bt_mesh_network_create(node_h, (const char*)network_name, &network, &token); - ret = bt_mesh_network_add_netkey(network, &netkey_h); - ret = bt_mesh_netkey_add_appkey(netkey_h, &appkey_h); - ret = bt_mesh_network_create_group(network, group_addr, &group_h); - ret = bt_mesh_network_remove_group(NULL); assert_eq(ret, BT_ERROR_INVALID_PARAMETER); } else { @@ -1136,35 +795,10 @@ int utc_bluetooth_bt_mesh_network_remove_group_n(void) int utc_bluetooth_bt_mesh_network_foreach_groups_n(void) { int ret = BT_ERROR_NONE; - bt_mesh_node_features_s features; - bt_mesh_node_h node_h = NULL; - bt_mesh_element_h elem_h = NULL; - bt_mesh_model_h model_h = NULL; - bt_mesh_model_id_s mod_id; - char *network_name = "test-mesh"; - char *token = NULL; - bt_mesh_network_h network = NULL; - bt_mesh_netkey_h netkey_h = NULL; - bt_mesh_appkey_h appkey_h = NULL; - bt_mesh_group_h group_h = NULL; - uint16_t group_addr = 0xc001; if (mesh_supported) { assert_eq(startup_flag, BT_ERROR_NONE); - features.features = BT_MESH_FEATURE_RELAY; - features.features |= BT_MESH_FEATURE_LOWPOWER; - ret = bt_mesh_node_create(&features, &node_h); - ret = bt_mesh_node_create_element(node_h, &elem_h); - - mod_id.model_id = BT_MESH_MODEL_ID_GEN_LEVEL_SRV; - mod_id.company_id = 0xFFFF; - ret = bt_mesh_element_create_model(elem_h, &mod_id, &model_h); - ret = bt_mesh_network_create(node_h, (const char*)network_name, &network, &token); - ret = bt_mesh_network_add_netkey(network, &netkey_h); - ret = bt_mesh_netkey_add_appkey(netkey_h, &appkey_h); - ret = bt_mesh_network_create_group(network, group_addr, &group_h); - ret = bt_mesh_network_foreach_groups(network, NULL, NULL); assert_eq(ret, BT_ERROR_INVALID_PARAMETER); } else { @@ -1178,18 +812,6 @@ int utc_bluetooth_bt_mesh_network_foreach_groups_n(void) int utc_bluetooth_bt_mesh_network_unprovisioned_device_scan_n(void) { int ret = BT_ERROR_NONE; - bt_mesh_node_features_s features; - bt_mesh_node_h node_h = NULL; - bt_mesh_element_h elem_h = NULL; - bt_mesh_model_h model_h = NULL; - bt_mesh_model_id_s mod_id; - char *network_name = "test-mesh"; - char *token = NULL; - bt_mesh_network_h network = NULL; - bt_mesh_netkey_h netkey_h = NULL; - bt_mesh_appkey_h appkey_h = NULL; - bt_mesh_group_h group_h = NULL; - uint16_t group_addr = 0xc001; bt_mesh_scan_params_s scan_params; memset(&scan_params, 0x00, sizeof(bt_mesh_scan_params_s)); @@ -1197,19 +819,6 @@ int utc_bluetooth_bt_mesh_network_unprovisioned_device_scan_n(void) if (mesh_supported) { assert_eq(startup_flag, BT_ERROR_NONE); - features.features = BT_MESH_FEATURE_RELAY; - features.features |= BT_MESH_FEATURE_LOWPOWER; - ret = bt_mesh_node_create(&features, &node_h); - ret = bt_mesh_node_create_element(node_h, &elem_h); - - mod_id.model_id = BT_MESH_MODEL_ID_GEN_LEVEL_SRV; - mod_id.company_id = 0xFFFF; - ret = bt_mesh_element_create_model(elem_h, &mod_id, &model_h); - ret = bt_mesh_network_create(node_h, (const char*)network_name, &network, &token); - ret = bt_mesh_network_add_netkey(network, &netkey_h); - ret = bt_mesh_netkey_add_appkey(netkey_h, &appkey_h); - ret = bt_mesh_network_create_group(network, group_addr, &group_h); - ret = bt_mesh_network_unprovisioned_device_scan(network, &scan_params, NULL, NULL); assert_eq(ret, BT_ERROR_INVALID_PARAMETER); @@ -1226,18 +835,6 @@ int utc_bluetooth_bt_mesh_network_unprovisioned_device_scan_n(void) int utc_bluetooth_bt_mesh_stop_unprovisioned_device_scan_n(void) { int ret = BT_ERROR_NONE; - bt_mesh_node_features_s features; - bt_mesh_node_h node_h = NULL; - bt_mesh_element_h elem_h = NULL; - bt_mesh_model_h model_h = NULL; - bt_mesh_model_id_s mod_id; - char *network_name = "test-mesh"; - char *token = NULL; - bt_mesh_network_h network = NULL; - bt_mesh_netkey_h netkey_h = NULL; - bt_mesh_appkey_h appkey_h = NULL; - bt_mesh_group_h group_h = NULL; - uint16_t group_addr = 0xc001; bt_mesh_scan_params_s scan_params; memset(&scan_params, 0x00, sizeof(bt_mesh_scan_params_s)); @@ -1245,23 +842,10 @@ int utc_bluetooth_bt_mesh_stop_unprovisioned_device_scan_n(void) if (mesh_supported) { assert_eq(startup_flag, BT_ERROR_NONE); - features.features = BT_MESH_FEATURE_RELAY; - features.features |= BT_MESH_FEATURE_LOWPOWER; - ret = bt_mesh_node_create(&features, &node_h); - ret = bt_mesh_node_create_element(node_h, &elem_h); - - mod_id.model_id = BT_MESH_MODEL_ID_GEN_LEVEL_SRV; - mod_id.company_id = 0xFFFF; - ret = bt_mesh_element_create_model(elem_h, &mod_id, &model_h); - ret = bt_mesh_network_create(node_h, (const char*)network_name, &network, &token); - ret = bt_mesh_network_add_netkey(network, &netkey_h); - ret = bt_mesh_netkey_add_appkey(netkey_h, &appkey_h); - ret = bt_mesh_network_create_group(network, group_addr, &group_h); - ret = bt_mesh_network_unprovisioned_device_scan(network, &scan_params, - __bt_mesh_network_scan_unprovisioned_device_result_cb, NULL); - wait_for_async(); + __bt_mesh_network_scan_unprovisioned_device_result_cb_n, NULL); + wait_for_async(); ret = bt_mesh_stop_unprovisioned_device_scan(NULL); assert_eq(ret, BT_ERROR_INVALID_PARAMETER); @@ -1277,36 +861,11 @@ int utc_bluetooth_bt_mesh_stop_unprovisioned_device_scan_n(void) int utc_bluetooth_bt_mesh_network_provision_device_n(void) { int ret = BT_ERROR_NONE; - bt_mesh_node_features_s features; - bt_mesh_node_h node_h = NULL; - bt_mesh_element_h elem_h = NULL; - bt_mesh_model_h model_h = NULL; - bt_mesh_model_id_s mod_id; - char *network_name = "test-mesh"; - char *token = NULL; - bt_mesh_network_h network = NULL; - bt_mesh_netkey_h netkey_h = NULL; - bt_mesh_appkey_h appkey_h = NULL; - bt_mesh_group_h group_h = NULL; - uint16_t group_addr = 0xc001; char *dev_uuid = "abababababababababababababababab"; if (mesh_supported) { assert_eq(startup_flag, BT_ERROR_NONE); - features.features = BT_MESH_FEATURE_RELAY; - features.features |= BT_MESH_FEATURE_LOWPOWER; - ret = bt_mesh_node_create(&features, &node_h); - ret = bt_mesh_node_create_element(node_h, &elem_h); - - mod_id.model_id = BT_MESH_MODEL_ID_GEN_LEVEL_SRV; - mod_id.company_id = 0xFFFF; - ret = bt_mesh_element_create_model(elem_h, &mod_id, &model_h); - ret = bt_mesh_network_create(node_h, (const char*)network_name, &network, &token); - ret = bt_mesh_network_add_netkey(network, &netkey_h); - ret = bt_mesh_netkey_add_appkey(netkey_h, &appkey_h); - ret = bt_mesh_network_create_group(network, group_addr, &group_h); - ret = bt_mesh_network_provision_device(network, dev_uuid, NULL, NULL); assert_eq(ret, BT_ERROR_INVALID_PARAMETER); } else { @@ -1337,18 +896,6 @@ int utc_bluetooth_bt_mesh_authentication_set_request_cb_n(void) int utc_bluetooth_bt_mesh_authentication_reply_n(void) { int ret = BT_ERROR_NONE; - bt_mesh_node_features_s features; - bt_mesh_node_h node_h = NULL; - bt_mesh_element_h elem_h = NULL; - bt_mesh_model_h model_h = NULL; - bt_mesh_model_id_s mod_id; - char *network_name = "test-mesh"; - char *token = NULL; - bt_mesh_network_h network = NULL; - bt_mesh_netkey_h netkey_h = NULL; - bt_mesh_appkey_h appkey_h = NULL; - bt_mesh_group_h group_h = NULL; - uint16_t group_addr = 0xc001; char *dev_uuid = "abababababababababababababababab"; static bt_mesh_authentication_type_e request_type = BT_MESH_AUTH_ALPHANUMERIC_DISPLAY; char* value = "authentication_reply"; @@ -1357,18 +904,6 @@ int utc_bluetooth_bt_mesh_authentication_reply_n(void) if (mesh_supported) { assert_eq(startup_flag, BT_ERROR_NONE); - features.features = BT_MESH_FEATURE_RELAY; - features.features |= BT_MESH_FEATURE_LOWPOWER; - ret = bt_mesh_node_create(&features, &node_h); - ret = bt_mesh_node_create_element(node_h, &elem_h); - - mod_id.model_id = BT_MESH_MODEL_ID_GEN_LEVEL_SRV; - mod_id.company_id = 0xFFFF; - ret = bt_mesh_element_create_model(elem_h, &mod_id, &model_h); - ret = bt_mesh_network_create(node_h, (const char*)network_name, &network, &token); - ret = bt_mesh_network_add_netkey(network, &netkey_h); - ret = bt_mesh_netkey_add_appkey(netkey_h, &appkey_h); - ret = bt_mesh_network_create_group(network, group_addr, &group_h); ret = bt_mesh_network_provision_device(network, dev_uuid, __bt_mesh_network_device_provision_cb, NULL); wait_for_async(); @@ -1386,36 +921,11 @@ int utc_bluetooth_bt_mesh_authentication_reply_n(void) int utc_bluetooth_bt_mesh_network_set_provisioning_capabilities_n(void) { int ret = BT_ERROR_NONE; - bt_mesh_node_features_s features; - bt_mesh_node_h node_h = NULL; - bt_mesh_element_h elem_h = NULL; - bt_mesh_model_h model_h = NULL; - bt_mesh_model_id_s mod_id; - char *network_name = "test-mesh"; - char *token = NULL; - bt_mesh_network_h network = NULL; - bt_mesh_netkey_h netkey_h = NULL; - bt_mesh_appkey_h appkey_h = NULL; - bt_mesh_group_h group_h = NULL; - uint16_t group_addr = 0xc001; bt_mesh_provisioner_capabilities_s capabilities; if (mesh_supported) { assert_eq(startup_flag, BT_ERROR_NONE); - features.features = BT_MESH_FEATURE_RELAY; - features.features |= BT_MESH_FEATURE_LOWPOWER; - ret = bt_mesh_node_create(&features, &node_h); - ret = bt_mesh_node_create_element(node_h, &elem_h); - - mod_id.model_id = BT_MESH_MODEL_ID_GEN_LEVEL_SRV; - mod_id.company_id = 0xFFFF; - ret = bt_mesh_element_create_model(elem_h, &mod_id, &model_h); - ret = bt_mesh_network_create(node_h, (const char*)network_name, &network, &token); - ret = bt_mesh_network_add_netkey(network, &netkey_h); - ret = bt_mesh_netkey_add_appkey(netkey_h, &appkey_h); - ret = bt_mesh_network_create_group(network, group_addr, &group_h); - capabilities.public_oob = FALSE; capabilities.static_oob = FALSE; capabilities.out_oob = BT_MESH_OUT_OOB_METHOD_BLINK; diff --git a/tests/unittest/utc_bluetooth_mesh_network_positive.c b/tests/unittest/utc_bluetooth_mesh_network_positive.c index a0fc66a..6908fdb 100644 --- a/tests/unittest/utc_bluetooth_mesh_network_positive.c +++ b/tests/unittest/utc_bluetooth_mesh_network_positive.c @@ -29,6 +29,11 @@ static GMainLoop *mainloop = NULL; static int ret = BT_ERROR_NONE; static bool bt_supported = false; static bool mesh_supported = false; +static bt_mesh_network_h network = NULL; +static char *token; +static char *network_name = "test-mesh"; +static bt_mesh_netkey_h netkey_h = NULL; +static bt_mesh_appkey_h appkey_h = NULL; static bool __bt_mesh_elem_foreach_model_cb(int result, bt_mesh_element_h element, int total, bt_mesh_model_h model, bt_mesh_model_id_s *model_id, void *user_data) @@ -66,7 +71,7 @@ static bool __bt_mesh_network_group_info_cb(int result, bt_mesh_network_h networ return true; } -static void __bt_mesh_network_scan_unprovisioned_device_result_cb(int result, bt_mesh_network_h network, +static void __bt_mesh_network_scan_unprovisioned_device_result_cb_p(int result, bt_mesh_network_h network, bt_mesh_scanning_state_e state, bt_mesh_scan_result_s *scan_res, void *user_data) { if (mainloop) @@ -503,9 +508,6 @@ int utc_bluetooth_bt_mesh_network_create_p(void) bt_mesh_element_h elem_h = NULL; bt_mesh_model_h model_h = NULL; bt_mesh_model_id_s mod_id; - char *network_name = "test-mesh"; - char *token; - bt_mesh_network_h network; if (mesh_supported) { assert_eq(startup_flag, BT_ERROR_NONE); @@ -533,28 +535,10 @@ int utc_bluetooth_bt_mesh_network_create_p(void) int utc_bluetooth_bt_mesh_network_load_p(void) { int ret = BT_ERROR_NONE; - bt_mesh_node_features_s features; - bt_mesh_node_h node_h = NULL; - bt_mesh_element_h elem_h = NULL; - bt_mesh_model_h model_h = NULL; - bt_mesh_model_id_s mod_id; - char *network_name = "test-mesh"; - char *token = NULL; - bt_mesh_network_h network = NULL; if (mesh_supported) { assert_eq(startup_flag, BT_ERROR_NONE); - features.features = BT_MESH_FEATURE_RELAY; - features.features |= BT_MESH_FEATURE_LOWPOWER; - ret = bt_mesh_node_create(&features, &node_h); - ret = bt_mesh_node_create_element(node_h, &elem_h); - - mod_id.model_id = BT_MESH_MODEL_ID_GEN_LEVEL_SRV; - mod_id.company_id = 0xFFFF; - ret = bt_mesh_element_create_model(elem_h, &mod_id, &model_h); - ret = bt_mesh_network_create(node_h, (const char*)network_name, &network, &token); - ret = bt_mesh_network_load(token, &network); assert_eq(ret, BT_ERROR_NONE); } else { @@ -569,28 +553,10 @@ int utc_bluetooth_bt_mesh_network_load_p(void) int utc_bluetooth_bt_mesh_network_set_name_p(void) { int ret = BT_ERROR_NONE; - bt_mesh_node_features_s features; - bt_mesh_node_h node_h = NULL; - bt_mesh_element_h elem_h = NULL; - bt_mesh_model_h model_h = NULL; - bt_mesh_model_id_s mod_id; - char *network_name = "test-mesh"; - char *token = NULL; - bt_mesh_network_h network = NULL; if (mesh_supported) { assert_eq(startup_flag, BT_ERROR_NONE); - features.features = BT_MESH_FEATURE_RELAY; - features.features |= BT_MESH_FEATURE_LOWPOWER; - ret = bt_mesh_node_create(&features, &node_h); - ret = bt_mesh_node_create_element(node_h, &elem_h); - - mod_id.model_id = BT_MESH_MODEL_ID_GEN_LEVEL_SRV; - mod_id.company_id = 0xFFFF; - ret = bt_mesh_element_create_model(elem_h, &mod_id, &model_h); - ret = bt_mesh_network_create(node_h, (const char*)network_name, &network, &token); - ret = bt_mesh_network_set_name(network, network_name); assert_eq(ret, BT_ERROR_NONE); } else { @@ -604,29 +570,10 @@ int utc_bluetooth_bt_mesh_network_set_name_p(void) int utc_bluetooth_bt_mesh_network_get_name_p(void) { int ret = BT_ERROR_NONE; - bt_mesh_node_features_s features; - bt_mesh_node_h node_h = NULL; - bt_mesh_element_h elem_h = NULL; - bt_mesh_model_h model_h = NULL; - bt_mesh_model_id_s mod_id; - char *network_name = "test-mesh"; - char *token = NULL; - bt_mesh_network_h network = NULL; if (mesh_supported) { assert_eq(startup_flag, BT_ERROR_NONE); - features.features = BT_MESH_FEATURE_RELAY; - features.features |= BT_MESH_FEATURE_LOWPOWER; - ret = bt_mesh_node_create(&features, &node_h); - ret = bt_mesh_node_create_element(node_h, &elem_h); - - - mod_id.model_id = BT_MESH_MODEL_ID_GEN_LEVEL_SRV; - mod_id.company_id = 0xFFFF; - ret = bt_mesh_element_create_model(elem_h, &mod_id, &model_h); - ret = bt_mesh_network_create(node_h, (const char*)network_name, &network, &token); - ret = bt_mesh_network_get_name(network, &network_name); assert_eq(ret, BT_ERROR_NONE); } else { @@ -640,33 +587,14 @@ int utc_bluetooth_bt_mesh_network_get_name_p(void) int utc_bluetooth_bt_mesh_network_add_netkey_p(void) { int ret = BT_ERROR_NONE; - bt_mesh_node_features_s features; - bt_mesh_node_h node_h = NULL; - bt_mesh_element_h elem_h = NULL; - bt_mesh_model_h model_h = NULL; - bt_mesh_model_id_s mod_id; - char *network_name = "test-mesh"; - char *token = NULL; - bt_mesh_network_h network = NULL; - bt_mesh_netkey_h n_h = NULL; if (mesh_supported) { assert_eq(startup_flag, BT_ERROR_NONE); - features.features = BT_MESH_FEATURE_RELAY; - features.features |= BT_MESH_FEATURE_LOWPOWER; - ret = bt_mesh_node_create(&features, &node_h); - ret = bt_mesh_node_create_element(node_h, &elem_h); - - mod_id.model_id = BT_MESH_MODEL_ID_GEN_LEVEL_SRV; - mod_id.company_id = 0xFFFF; - ret = bt_mesh_element_create_model(elem_h, &mod_id, &model_h); - ret = bt_mesh_network_create(node_h, (const char*)network_name, &network, &token); - - ret = bt_mesh_network_add_netkey(network, &n_h); + ret = bt_mesh_network_add_netkey(network, &netkey_h); assert_eq(ret, BT_ERROR_NONE); } else { - ret = bt_mesh_network_add_netkey(network, &n_h); + ret = bt_mesh_network_add_netkey(network, &netkey_h); assert_eq(ret, BT_ERROR_NOT_SUPPORTED); } @@ -676,30 +604,10 @@ int utc_bluetooth_bt_mesh_network_add_netkey_p(void) int utc_bluetooth_bt_mesh_network_foreach_netkeys_p(void) { int ret = BT_ERROR_NONE; - bt_mesh_node_features_s features; - bt_mesh_node_h node_h = NULL; - bt_mesh_element_h elem_h = NULL; - bt_mesh_model_h model_h = NULL; - bt_mesh_model_id_s mod_id; - char *network_name = "test-mesh"; - char *token = NULL; - bt_mesh_network_h network = NULL; - bt_mesh_netkey_h n_h = NULL; if (mesh_supported) { assert_eq(startup_flag, BT_ERROR_NONE); - features.features = BT_MESH_FEATURE_RELAY; - features.features |= BT_MESH_FEATURE_LOWPOWER; - ret = bt_mesh_node_create(&features, &node_h); - ret = bt_mesh_node_create_element(node_h, &elem_h); - - mod_id.model_id = BT_MESH_MODEL_ID_GEN_LEVEL_SRV; - mod_id.company_id = 0xFFFF; - ret = bt_mesh_element_create_model(elem_h, &mod_id, &model_h); - ret = bt_mesh_network_create(node_h, (const char*)network_name, &network, &token); - ret = bt_mesh_network_add_netkey(network, &n_h); - ret = bt_mesh_network_foreach_netkeys(network, __bt_mesh_network_netkey_info_cb, NULL); assert_eq(ret, BT_ERROR_NONE); } else { @@ -713,31 +621,11 @@ int utc_bluetooth_bt_mesh_network_foreach_netkeys_p(void) int utc_bluetooth_bt_mesh_netkey_get_index_p(void) { int ret = BT_ERROR_NONE; - bt_mesh_node_features_s features; - bt_mesh_node_h node_h = NULL; - bt_mesh_element_h elem_h = NULL; - bt_mesh_model_h model_h = NULL; - bt_mesh_model_id_s mod_id; - char *network_name = "test-mesh"; - char *token = NULL; - bt_mesh_network_h network = NULL; - bt_mesh_netkey_h netkey_h = NULL; uint16_t indx = 0xFFFF; if (mesh_supported) { assert_eq(startup_flag, BT_ERROR_NONE); - features.features = BT_MESH_FEATURE_RELAY; - features.features |= BT_MESH_FEATURE_LOWPOWER; - ret = bt_mesh_node_create(&features, &node_h); - ret = bt_mesh_node_create_element(node_h, &elem_h); - - mod_id.model_id = BT_MESH_MODEL_ID_GEN_LEVEL_SRV; - mod_id.company_id = 0xFFFF; - ret = bt_mesh_element_create_model(elem_h, &mod_id, &model_h); - ret = bt_mesh_network_create(node_h, (const char*)network_name, &network, &token); - ret = bt_mesh_network_add_netkey(network, &netkey_h); - ret = bt_mesh_netkey_get_index(netkey_h, &indx); assert_eq(ret, BT_ERROR_NONE); } else { @@ -751,30 +639,10 @@ int utc_bluetooth_bt_mesh_netkey_get_index_p(void) int utc_bluetooth_bt_mesh_netkey_update_p(void) { int ret = BT_ERROR_NONE; - bt_mesh_node_features_s features; - bt_mesh_node_h node_h = NULL; - bt_mesh_element_h elem_h = NULL; - bt_mesh_model_h model_h = NULL; - bt_mesh_model_id_s mod_id; - char *network_name = "test-mesh"; - char *token = NULL; - bt_mesh_network_h network = NULL; - bt_mesh_netkey_h netkey_h = NULL; if (mesh_supported) { assert_eq(startup_flag, BT_ERROR_NONE); - features.features = BT_MESH_FEATURE_RELAY; - features.features |= BT_MESH_FEATURE_LOWPOWER; - ret = bt_mesh_node_create(&features, &node_h); - ret = bt_mesh_node_create_element(node_h, &elem_h); - - mod_id.model_id = BT_MESH_MODEL_ID_GEN_LEVEL_SRV; - mod_id.company_id = 0xFFFF; - ret = bt_mesh_element_create_model(elem_h, &mod_id, &model_h); - ret = bt_mesh_network_create(node_h, (const char*)network_name, &network, &token); - ret = bt_mesh_network_add_netkey(network, &netkey_h); - ret = bt_mesh_netkey_update(netkey_h); assert_eq(ret, BT_ERROR_NONE); } else { @@ -789,30 +657,10 @@ int utc_bluetooth_bt_mesh_netkey_update_p(void) int utc_bluetooth_bt_mesh_netkey_delete_p(void) { int ret = BT_ERROR_NONE; - bt_mesh_node_features_s features; - bt_mesh_node_h node_h = NULL; - bt_mesh_element_h elem_h = NULL; - bt_mesh_model_h model_h = NULL; - bt_mesh_model_id_s mod_id; - char *network_name = "test-mesh"; - char *token = NULL; - bt_mesh_network_h network = NULL; - bt_mesh_netkey_h netkey_h = NULL; if (mesh_supported) { assert_eq(startup_flag, BT_ERROR_NONE); - features.features = BT_MESH_FEATURE_RELAY; - features.features |= BT_MESH_FEATURE_LOWPOWER; - ret = bt_mesh_node_create(&features, &node_h); - ret = bt_mesh_node_create_element(node_h, &elem_h); - - mod_id.model_id = BT_MESH_MODEL_ID_GEN_LEVEL_SRV; - mod_id.company_id = 0xFFFF; - ret = bt_mesh_element_create_model(elem_h, &mod_id, &model_h); - ret = bt_mesh_network_create(node_h, (const char*)network_name, &network, &token); - ret = bt_mesh_network_add_netkey(network, &netkey_h); - ret = bt_mesh_netkey_delete(netkey_h); assert_eq(ret, BT_ERROR_NONE); } else { @@ -826,29 +674,10 @@ int utc_bluetooth_bt_mesh_netkey_delete_p(void) int utc_bluetooth_bt_mesh_netkey_add_appkey_p(void) { int ret = BT_ERROR_NONE; - bt_mesh_node_features_s features; - bt_mesh_node_h node_h = NULL; - bt_mesh_element_h elem_h = NULL; - bt_mesh_model_h model_h = NULL; - bt_mesh_model_id_s mod_id; - char *network_name = "test-mesh"; - char *token = NULL; - bt_mesh_network_h network = NULL; - bt_mesh_netkey_h netkey_h = NULL; - bt_mesh_appkey_h appkey_h = NULL; if (mesh_supported) { assert_eq(startup_flag, BT_ERROR_NONE); - features.features = BT_MESH_FEATURE_RELAY; - features.features |= BT_MESH_FEATURE_LOWPOWER; - ret = bt_mesh_node_create(&features, &node_h); - ret = bt_mesh_node_create_element(node_h, &elem_h); - - mod_id.model_id = BT_MESH_MODEL_ID_GEN_LEVEL_SRV; - mod_id.company_id = 0xFFFF; - ret = bt_mesh_element_create_model(elem_h, &mod_id, &model_h); - ret = bt_mesh_network_create(node_h, (const char*)network_name, &network, &token); ret = bt_mesh_network_add_netkey(network, &netkey_h); ret = bt_mesh_netkey_add_appkey(netkey_h, &appkey_h); @@ -865,32 +694,10 @@ int utc_bluetooth_bt_mesh_netkey_add_appkey_p(void) int utc_bluetooth_bt_mesh_netkey_foreach_appkeys_p(void) { int ret = BT_ERROR_NONE; - bt_mesh_node_features_s features; - bt_mesh_node_h node_h = NULL; - bt_mesh_element_h elem_h = NULL; - bt_mesh_model_h model_h = NULL; - bt_mesh_model_id_s mod_id; - char *network_name = "test-mesh"; - char *token = NULL; - bt_mesh_network_h network = NULL; - bt_mesh_netkey_h netkey_h = NULL; - bt_mesh_appkey_h appkey_h = NULL; if (mesh_supported) { assert_eq(startup_flag, BT_ERROR_NONE); - features.features = BT_MESH_FEATURE_RELAY; - features.features |= BT_MESH_FEATURE_LOWPOWER; - ret = bt_mesh_node_create(&features, &node_h); - ret = bt_mesh_node_create_element(node_h, &elem_h); - - mod_id.model_id = BT_MESH_MODEL_ID_GEN_LEVEL_SRV; - mod_id.company_id = 0xFFFF; - ret = bt_mesh_element_create_model(elem_h, &mod_id, &model_h); - ret = bt_mesh_network_create(node_h, (const char*)network_name, &network, &token); - ret = bt_mesh_network_add_netkey(network, &netkey_h); - ret = bt_mesh_netkey_add_appkey(netkey_h, &appkey_h); - ret = bt_mesh_netkey_foreach_appkeys(netkey_h, __bt_mesh_appkey_info_cb, NULL); assert_eq(ret, BT_ERROR_NONE); } else { @@ -904,33 +711,11 @@ int utc_bluetooth_bt_mesh_netkey_foreach_appkeys_p(void) int utc_bluetooth_bt_mesh_appkey_get_index_p(void) { int ret = BT_ERROR_NONE; - bt_mesh_node_features_s features; - bt_mesh_node_h node_h = NULL; - bt_mesh_element_h elem_h = NULL; - bt_mesh_model_h model_h = NULL; - bt_mesh_model_id_s mod_id; - char *network_name = "test-mesh"; - char *token = NULL; - bt_mesh_network_h network = NULL; - bt_mesh_netkey_h netkey_h = NULL; uint16_t index = 0xFFFF; - bt_mesh_appkey_h appkey_h = NULL; if (mesh_supported) { assert_eq(startup_flag, BT_ERROR_NONE); - features.features = BT_MESH_FEATURE_RELAY; - features.features |= BT_MESH_FEATURE_LOWPOWER; - ret = bt_mesh_node_create(&features, &node_h); - ret = bt_mesh_node_create_element(node_h, &elem_h); - - mod_id.model_id = BT_MESH_MODEL_ID_GEN_LEVEL_SRV; - mod_id.company_id = 0xFFFF; - ret = bt_mesh_element_create_model(elem_h, &mod_id, &model_h); - ret = bt_mesh_network_create(node_h, (const char*)network_name, &network, &token); - ret = bt_mesh_network_add_netkey(network, &netkey_h); - ret = bt_mesh_netkey_add_appkey(netkey_h, &appkey_h); - ret = bt_mesh_appkey_get_index(appkey_h, &index); assert_eq(ret, BT_ERROR_NONE); } else { @@ -945,32 +730,10 @@ int utc_bluetooth_bt_mesh_appkey_get_index_p(void) int utc_bluetooth_bt_mesh_appkey_update_p(void) { int ret = BT_ERROR_NONE; - bt_mesh_node_features_s features; - bt_mesh_node_h node_h = NULL; - bt_mesh_element_h elem_h = NULL; - bt_mesh_model_h model_h = NULL; - bt_mesh_model_id_s mod_id; - char *network_name = "test-mesh"; - char *token = NULL; - bt_mesh_network_h network = NULL; - bt_mesh_netkey_h netkey_h = NULL; - bt_mesh_appkey_h appkey_h = NULL; if (mesh_supported) { assert_eq(startup_flag, BT_ERROR_NONE); - features.features = BT_MESH_FEATURE_RELAY; - features.features |= BT_MESH_FEATURE_LOWPOWER; - ret = bt_mesh_node_create(&features, &node_h); - ret = bt_mesh_node_create_element(node_h, &elem_h); - - mod_id.model_id = BT_MESH_MODEL_ID_GEN_LEVEL_SRV; - mod_id.company_id = 0xFFFF; - ret = bt_mesh_element_create_model(elem_h, &mod_id, &model_h); - ret = bt_mesh_network_create(node_h, (const char*)network_name, &network, &token); - ret = bt_mesh_network_add_netkey(network, &netkey_h); - ret = bt_mesh_netkey_add_appkey(netkey_h, &appkey_h); - ret = bt_mesh_appkey_update(appkey_h); assert_eq(ret, BT_ERROR_NONE); } else { @@ -985,32 +748,10 @@ int utc_bluetooth_bt_mesh_appkey_update_p(void) int utc_bluetooth_bt_mesh_appkey_delete_p(void) { int ret = BT_ERROR_NONE; - bt_mesh_node_features_s features; - bt_mesh_node_h node_h = NULL; - bt_mesh_element_h elem_h = NULL; - bt_mesh_model_h model_h = NULL; - bt_mesh_model_id_s mod_id; - char *network_name = "test-mesh"; - char *token = NULL; - bt_mesh_network_h network = NULL; - bt_mesh_netkey_h netkey_h = NULL; - bt_mesh_appkey_h appkey_h = NULL; if (mesh_supported) { assert_eq(startup_flag, BT_ERROR_NONE); - features.features = BT_MESH_FEATURE_RELAY; - features.features |= BT_MESH_FEATURE_LOWPOWER; - ret = bt_mesh_node_create(&features, &node_h); - ret = bt_mesh_node_create_element(node_h, &elem_h); - - mod_id.model_id = BT_MESH_MODEL_ID_GEN_LEVEL_SRV; - mod_id.company_id = 0xFFFF; - ret = bt_mesh_element_create_model(elem_h, &mod_id, &model_h); - ret = bt_mesh_network_create(node_h, (const char*)network_name, &network, &token); - ret = bt_mesh_network_add_netkey(network, &netkey_h); - ret = bt_mesh_netkey_add_appkey(netkey_h, &appkey_h); - ret = bt_mesh_appkey_delete(appkey_h); assert_eq(ret, BT_ERROR_NONE); } else { @@ -1025,30 +766,9 @@ int utc_bluetooth_bt_mesh_appkey_delete_p(void) int utc_bluetooth_bt_mesh_network_foreach_devices_p(void) { int ret = BT_ERROR_NONE; - bt_mesh_node_features_s features; - bt_mesh_node_h node_h = NULL; - bt_mesh_element_h elem_h = NULL; - bt_mesh_model_h model_h = NULL; - bt_mesh_model_id_s mod_id; - char *network_name = "test-mesh"; - char *token = NULL; - bt_mesh_network_h network = NULL; - bt_mesh_netkey_h netkey_h = NULL; - bt_mesh_appkey_h appkey_h = NULL; if (mesh_supported) { assert_eq(startup_flag, BT_ERROR_NONE); - - features.features = BT_MESH_FEATURE_RELAY; - features.features |= BT_MESH_FEATURE_LOWPOWER; - ret = bt_mesh_node_create(&features, &node_h); - ret = bt_mesh_node_create_element(node_h, &elem_h); - - mod_id.model_id = BT_MESH_MODEL_ID_GEN_LEVEL_SRV; - mod_id.company_id = 0xFFFF; - ret = bt_mesh_element_create_model(elem_h, &mod_id, &model_h); - ret = bt_mesh_network_create(node_h, (const char*)network_name, &network, &token); - ret = bt_mesh_network_add_netkey(network, &netkey_h); ret = bt_mesh_netkey_add_appkey(netkey_h, &appkey_h); ret = bt_mesh_network_foreach_devices(network, __bt_mesh_network_device_info_cb, NULL); @@ -1065,34 +785,12 @@ int utc_bluetooth_bt_mesh_network_foreach_devices_p(void) int utc_bluetooth_bt_mesh_network_create_group_p(void) { int ret = BT_ERROR_NONE; - bt_mesh_node_features_s features; - bt_mesh_node_h node_h = NULL; - bt_mesh_element_h elem_h = NULL; - bt_mesh_model_h model_h = NULL; - bt_mesh_model_id_s mod_id; - char *network_name = "test-mesh"; - char *token = NULL; - bt_mesh_network_h network = NULL; - bt_mesh_netkey_h netkey_h = NULL; - bt_mesh_appkey_h appkey_h = NULL; uint16_t group_addr = 0xc001; bt_mesh_group_h group_h = NULL; if (mesh_supported) { assert_eq(startup_flag, BT_ERROR_NONE); - features.features = BT_MESH_FEATURE_RELAY; - features.features |= BT_MESH_FEATURE_LOWPOWER; - ret = bt_mesh_node_create(&features, &node_h); - ret = bt_mesh_node_create_element(node_h, &elem_h); - - mod_id.model_id = BT_MESH_MODEL_ID_GEN_LEVEL_SRV; - mod_id.company_id = 0xFFFF; - ret = bt_mesh_element_create_model(elem_h, &mod_id, &model_h); - ret = bt_mesh_network_create(node_h, (const char*)network_name, &network, &token); - ret = bt_mesh_network_add_netkey(network, &netkey_h); - ret = bt_mesh_netkey_add_appkey(netkey_h, &appkey_h); - ret = bt_mesh_network_create_group(network, group_addr, &group_h); assert_eq(ret, BT_ERROR_NONE); } else { @@ -1107,33 +805,11 @@ int utc_bluetooth_bt_mesh_network_create_group_p(void) int utc_bluetooth_bt_mesh_network_create_virtual_group_p(void) { int ret = BT_ERROR_NONE; - bt_mesh_node_features_s features; - bt_mesh_node_h node_h = NULL; - bt_mesh_element_h elem_h = NULL; - bt_mesh_model_h model_h = NULL; - bt_mesh_model_id_s mod_id; - char *network_name = "test-mesh"; - char *token = NULL; - bt_mesh_network_h network = NULL; - bt_mesh_netkey_h netkey_h = NULL; - bt_mesh_appkey_h appkey_h = NULL; bt_mesh_group_h group_h = NULL; if (mesh_supported) { assert_eq(startup_flag, BT_ERROR_NONE); - features.features = BT_MESH_FEATURE_RELAY; - features.features |= BT_MESH_FEATURE_LOWPOWER; - ret = bt_mesh_node_create(&features, &node_h); - ret = bt_mesh_node_create_element(node_h, &elem_h); - - mod_id.model_id = BT_MESH_MODEL_ID_GEN_LEVEL_SRV; - mod_id.company_id = 0xFFFF; - ret = bt_mesh_element_create_model(elem_h, &mod_id, &model_h); - ret = bt_mesh_network_create(node_h, (const char*)network_name, &network, &token); - ret = bt_mesh_network_add_netkey(network, &netkey_h); - ret = bt_mesh_netkey_add_appkey(netkey_h, &appkey_h); - ret = bt_mesh_network_create_virtual_group(network, &group_h); assert_eq(ret, BT_ERROR_NONE); } else { @@ -1148,33 +824,12 @@ int utc_bluetooth_bt_mesh_network_create_virtual_group_p(void) int utc_bluetooth_bt_mesh_network_remove_group_p(void) { int ret = BT_ERROR_NONE; - bt_mesh_node_features_s features; - bt_mesh_node_h node_h = NULL; - bt_mesh_element_h elem_h = NULL; - bt_mesh_model_h model_h = NULL; - bt_mesh_model_id_s mod_id; - char *network_name = "test-mesh"; - char *token = NULL; - bt_mesh_network_h network = NULL; - bt_mesh_netkey_h netkey_h = NULL; - bt_mesh_appkey_h appkey_h = NULL; bt_mesh_group_h group_h = NULL; uint16_t group_addr = 0xc001; if (mesh_supported) { assert_eq(startup_flag, BT_ERROR_NONE); - features.features = BT_MESH_FEATURE_RELAY; - features.features |= BT_MESH_FEATURE_LOWPOWER; - ret = bt_mesh_node_create(&features, &node_h); - ret = bt_mesh_node_create_element(node_h, &elem_h); - - mod_id.model_id = BT_MESH_MODEL_ID_GEN_LEVEL_SRV; - mod_id.company_id = 0xFFFF; - ret = bt_mesh_element_create_model(elem_h, &mod_id, &model_h); - ret = bt_mesh_network_create(node_h, (const char*)network_name, &network, &token); - ret = bt_mesh_network_add_netkey(network, &netkey_h); - ret = bt_mesh_netkey_add_appkey(netkey_h, &appkey_h); ret = bt_mesh_network_create_group(network, group_addr, &group_h); ret = bt_mesh_network_remove_group(group_h); @@ -1191,33 +846,12 @@ int utc_bluetooth_bt_mesh_network_remove_group_p(void) int utc_bluetooth_bt_mesh_network_foreach_groups_p(void) { int ret = BT_ERROR_NONE; - bt_mesh_node_features_s features; - bt_mesh_node_h node_h = NULL; - bt_mesh_element_h elem_h = NULL; - bt_mesh_model_h model_h = NULL; - bt_mesh_model_id_s mod_id; - char *network_name = "test-mesh"; - char *token = NULL; - bt_mesh_network_h network = NULL; - bt_mesh_netkey_h netkey_h = NULL; - bt_mesh_appkey_h appkey_h = NULL; bt_mesh_group_h group_h = NULL; uint16_t group_addr = 0xc001; if (mesh_supported) { assert_eq(startup_flag, BT_ERROR_NONE); - features.features = BT_MESH_FEATURE_RELAY; - features.features |= BT_MESH_FEATURE_LOWPOWER; - ret = bt_mesh_node_create(&features, &node_h); - ret = bt_mesh_node_create_element(node_h, &elem_h); - - mod_id.model_id = BT_MESH_MODEL_ID_GEN_LEVEL_SRV; - mod_id.company_id = 0xFFFF; - ret = bt_mesh_element_create_model(elem_h, &mod_id, &model_h); - ret = bt_mesh_network_create(node_h, (const char*)network_name, &network, &token); - ret = bt_mesh_network_add_netkey(network, &netkey_h); - ret = bt_mesh_netkey_add_appkey(netkey_h, &appkey_h); ret = bt_mesh_network_create_group(network, group_addr, &group_h); ret = bt_mesh_network_foreach_groups(network, __bt_mesh_network_group_info_cb, NULL); @@ -1234,18 +868,6 @@ int utc_bluetooth_bt_mesh_network_foreach_groups_p(void) int utc_bluetooth_bt_mesh_network_unprovisioned_device_scan_p(void) { int ret = BT_ERROR_NONE; - bt_mesh_node_features_s features; - bt_mesh_node_h node_h = NULL; - bt_mesh_element_h elem_h = NULL; - bt_mesh_model_h model_h = NULL; - bt_mesh_model_id_s mod_id; - char *network_name = "test-mesh"; - char *token = NULL; - bt_mesh_network_h network = NULL; - bt_mesh_netkey_h netkey_h = NULL; - bt_mesh_appkey_h appkey_h = NULL; - bt_mesh_group_h group_h = NULL; - uint16_t group_addr = 0xc001; bt_mesh_scan_params_s scan_params; memset(&scan_params, 0x00, sizeof(bt_mesh_scan_params_s)); @@ -1253,27 +875,14 @@ int utc_bluetooth_bt_mesh_network_unprovisioned_device_scan_p(void) if (mesh_supported) { assert_eq(startup_flag, BT_ERROR_NONE); - features.features = BT_MESH_FEATURE_RELAY; - features.features |= BT_MESH_FEATURE_LOWPOWER; - ret = bt_mesh_node_create(&features, &node_h); - ret = bt_mesh_node_create_element(node_h, &elem_h); - - mod_id.model_id = BT_MESH_MODEL_ID_GEN_LEVEL_SRV; - mod_id.company_id = 0xFFFF; - ret = bt_mesh_element_create_model(elem_h, &mod_id, &model_h); - ret = bt_mesh_network_create(node_h, (const char*)network_name, &network, &token); - ret = bt_mesh_network_add_netkey(network, &netkey_h); - ret = bt_mesh_netkey_add_appkey(netkey_h, &appkey_h); - ret = bt_mesh_network_create_group(network, group_addr, &group_h); - ret = bt_mesh_network_unprovisioned_device_scan(network, &scan_params, - __bt_mesh_network_scan_unprovisioned_device_result_cb, NULL); + __bt_mesh_network_scan_unprovisioned_device_result_cb_p, NULL); assert_eq(ret, BT_ERROR_NONE); wait_for_async(); } else { ret = bt_mesh_network_unprovisioned_device_scan(network, &scan_params, - __bt_mesh_network_scan_unprovisioned_device_result_cb, NULL); + __bt_mesh_network_scan_unprovisioned_device_result_cb_p, NULL); assert_eq(ret, BT_ERROR_NOT_SUPPORTED); } @@ -1284,18 +893,6 @@ int utc_bluetooth_bt_mesh_network_unprovisioned_device_scan_p(void) int utc_bluetooth_bt_mesh_stop_unprovisioned_device_scan_p(void) { int ret = BT_ERROR_NONE; - bt_mesh_node_features_s features; - bt_mesh_node_h node_h = NULL; - bt_mesh_element_h elem_h = NULL; - bt_mesh_model_h model_h = NULL; - bt_mesh_model_id_s mod_id; - char *network_name = "test-mesh"; - char *token = NULL; - bt_mesh_network_h network = NULL; - bt_mesh_netkey_h netkey_h = NULL; - bt_mesh_appkey_h appkey_h = NULL; - bt_mesh_group_h group_h = NULL; - uint16_t group_addr = 0xc001; bt_mesh_scan_params_s scan_params; memset(&scan_params, 0x00, sizeof(bt_mesh_scan_params_s)); @@ -1303,21 +900,8 @@ int utc_bluetooth_bt_mesh_stop_unprovisioned_device_scan_p(void) if (mesh_supported) { assert_eq(startup_flag, BT_ERROR_NONE); - features.features = BT_MESH_FEATURE_RELAY; - features.features |= BT_MESH_FEATURE_LOWPOWER; - ret = bt_mesh_node_create(&features, &node_h); - ret = bt_mesh_node_create_element(node_h, &elem_h); - - mod_id.model_id = BT_MESH_MODEL_ID_GEN_LEVEL_SRV; - mod_id.company_id = 0xFFFF; - ret = bt_mesh_element_create_model(elem_h, &mod_id, &model_h); - ret = bt_mesh_network_create(node_h, (const char*)network_name, &network, &token); - ret = bt_mesh_network_add_netkey(network, &netkey_h); - ret = bt_mesh_netkey_add_appkey(netkey_h, &appkey_h); - ret = bt_mesh_network_create_group(network, group_addr, &group_h); - ret = bt_mesh_network_unprovisioned_device_scan(network, &scan_params, - __bt_mesh_network_scan_unprovisioned_device_result_cb, NULL); + __bt_mesh_network_scan_unprovisioned_device_result_cb_p, NULL); wait_for_async(); ret = bt_mesh_stop_unprovisioned_device_scan(network); @@ -1335,42 +919,16 @@ int utc_bluetooth_bt_mesh_stop_unprovisioned_device_scan_p(void) int utc_bluetooth_bt_mesh_network_provision_device_p(void) { int ret = BT_ERROR_NONE; - bt_mesh_node_features_s features; - bt_mesh_node_h node_h = NULL; - bt_mesh_element_h elem_h = NULL; - bt_mesh_model_h model_h = NULL; - bt_mesh_model_id_s mod_id; - char *network_name = "test-mesh"; - char *token = NULL; - bt_mesh_network_h network = NULL; - bt_mesh_netkey_h netkey_h = NULL; - bt_mesh_appkey_h appkey_h = NULL; - bt_mesh_group_h group_h = NULL; - uint16_t group_addr = 0xc001; char *dev_uuid = "abababababababababababababababab"; if (mesh_supported) { assert_eq(startup_flag, BT_ERROR_NONE); - features.features = BT_MESH_FEATURE_RELAY; - features.features |= BT_MESH_FEATURE_LOWPOWER; - ret = bt_mesh_node_create(&features, &node_h); - ret = bt_mesh_node_create_element(node_h, &elem_h); - - mod_id.model_id = BT_MESH_MODEL_ID_GEN_LEVEL_SRV; - mod_id.company_id = 0xFFFF; - ret = bt_mesh_element_create_model(elem_h, &mod_id, &model_h); - ret = bt_mesh_network_create(node_h, (const char*)network_name, &network, &token); - ret = bt_mesh_network_add_netkey(network, &netkey_h); - ret = bt_mesh_netkey_add_appkey(netkey_h, &appkey_h); - ret = bt_mesh_network_create_group(network, group_addr, &group_h); - ret = bt_mesh_network_provision_device(network, dev_uuid, __bt_mesh_network_device_provision_cb, NULL); assert_eq(ret, BT_ERROR_NONE); wait_for_async(); - } else { ret = bt_mesh_network_provision_device(network, dev_uuid, __bt_mesh_network_device_provision_cb, NULL); @@ -1402,19 +960,6 @@ int utc_bluetooth_bt_mesh_authentication_set_request_cb_p(void) int utc_bluetooth_bt_mesh_authentication_reply_p(void) { int ret = BT_ERROR_NONE; - bt_mesh_node_features_s features; - bt_mesh_node_h node_h = NULL; - bt_mesh_element_h elem_h = NULL; - bt_mesh_model_h model_h = NULL; - bt_mesh_model_id_s mod_id; - char *network_name = "test-mesh"; - char *token = NULL; - bt_mesh_network_h network = NULL; - bt_mesh_netkey_h netkey_h = NULL; - bt_mesh_appkey_h appkey_h = NULL; - bt_mesh_group_h group_h = NULL; - uint16_t group_addr = 0xc001; - char *dev_uuid = "abababababababababababababababab"; static bt_mesh_authentication_type_e request_type = BT_MESH_AUTH_ALPHANUMERIC_DISPLAY; char* value = "authentication_reply"; bool auth_reply = TRUE; @@ -1422,22 +967,6 @@ int utc_bluetooth_bt_mesh_authentication_reply_p(void) if (mesh_supported) { assert_eq(startup_flag, BT_ERROR_NONE); - features.features = BT_MESH_FEATURE_RELAY; - features.features |= BT_MESH_FEATURE_LOWPOWER; - ret = bt_mesh_node_create(&features, &node_h); - ret = bt_mesh_node_create_element(node_h, &elem_h); - - mod_id.model_id = BT_MESH_MODEL_ID_GEN_LEVEL_SRV; - mod_id.company_id = 0xFFFF; - ret = bt_mesh_element_create_model(elem_h, &mod_id, &model_h); - ret = bt_mesh_network_create(node_h, (const char*)network_name, &network, &token); - ret = bt_mesh_network_add_netkey(network, &netkey_h); - ret = bt_mesh_netkey_add_appkey(netkey_h, &appkey_h); - ret = bt_mesh_network_create_group(network, group_addr, &group_h); - ret = bt_mesh_network_provision_device(network, dev_uuid, - __bt_mesh_network_device_provision_cb, NULL); - wait_for_async(); - ret = bt_mesh_authentication_reply(request_type, (const char*)value, auth_reply); assert_eq(ret, BT_ERROR_NONE); } else { @@ -1452,36 +981,11 @@ int utc_bluetooth_bt_mesh_authentication_reply_p(void) int utc_bluetooth_bt_mesh_network_set_provisioning_capabilities_p(void) { int ret = BT_ERROR_NONE; - bt_mesh_node_features_s features; - bt_mesh_node_h node_h = NULL; - bt_mesh_element_h elem_h = NULL; - bt_mesh_model_h model_h = NULL; - bt_mesh_model_id_s mod_id; - char *network_name = "test-mesh"; - char *token = NULL; - bt_mesh_network_h network = NULL; - bt_mesh_netkey_h netkey_h = NULL; - bt_mesh_appkey_h appkey_h = NULL; - bt_mesh_group_h group_h = NULL; - uint16_t group_addr = 0xc001; bt_mesh_provisioner_capabilities_s capabilities; if (mesh_supported) { assert_eq(startup_flag, BT_ERROR_NONE); - features.features = BT_MESH_FEATURE_RELAY; - features.features |= BT_MESH_FEATURE_LOWPOWER; - ret = bt_mesh_node_create(&features, &node_h); - ret = bt_mesh_node_create_element(node_h, &elem_h); - - mod_id.model_id = BT_MESH_MODEL_ID_GEN_LEVEL_SRV; - mod_id.company_id = 0xFFFF; - ret = bt_mesh_element_create_model(elem_h, &mod_id, &model_h); - ret = bt_mesh_network_create(node_h, (const char*)network_name, &network, &token); - ret = bt_mesh_network_add_netkey(network, &netkey_h); - ret = bt_mesh_netkey_add_appkey(netkey_h, &appkey_h); - ret = bt_mesh_network_create_group(network, group_addr, &group_h); - capabilities.public_oob = FALSE; capabilities.static_oob = FALSE; capabilities.out_oob = BT_MESH_OUT_OOB_METHOD_BLINK;