BT_FREE_PARAMS(in_param1, in_param2, in_param3, in_param4, out_param);
- if (ret != BLUETOOTH_ERROR_NONE) {
+ if (ret != BLUETOOTH_ERROR_NONE &&
+ ret != BLUETOOTH_ERROR_ALREADY_INITIALIZED) {
BT_ERR("Fail to init the mesh in bt-service");
return ret;
}
return BLUETOOTH_ERROR_NONE;
}
+BT_EXPORT_API int bluetooth_mesh_network_unload(bluetooth_mesh_network_t *network)
+{
+ int result;
+
+ BT_CHECK_PARAMETER(network, return);
+
+ BT_INIT_PARAMS();
+ BT_ALLOC_PARAMS(in_param1, in_param2, in_param3, in_param4, out_param);
+
+ g_array_append_vals(in_param1, network, sizeof(bluetooth_mesh_network_t));
+
+ BT_INFO("Mesh: Network Unload");
+ result = _bt_send_request(BT_BLUEZ_SERVICE, BT_MESH_NETWORK_UNLOAD,
+ in_param1, in_param2, in_param3, in_param4, &out_param);
+ BT_FREE_PARAMS(in_param1, in_param2, in_param3, in_param4, out_param);
+
+ return result;
+}
+
+BT_EXPORT_API int bluetooth_mesh_network_destroy(bluetooth_mesh_network_t *network)
+{
+ int result;
+
+ BT_CHECK_PARAMETER(network, return);
+
+ BT_INIT_PARAMS();
+ BT_ALLOC_PARAMS(in_param1, in_param2, in_param3, in_param4, out_param);
+
+ g_array_append_vals(in_param1, network, sizeof(bluetooth_mesh_network_t));
+
+ BT_INFO("Mesh: Network Destroy");
+ result = _bt_send_request(BT_BLUEZ_SERVICE, BT_MESH_NETWORK_DESTROY,
+ in_param1, in_param2, in_param3, in_param4, &out_param);
+ BT_FREE_PARAMS(in_param1, in_param2, in_param3, in_param4, out_param);
+
+ return result;
+}
+
+BT_EXPORT_API int bluetooth_mesh_node_reset(bluetooth_mesh_node_info_t *node)
+{
+ int result;
+
+ BT_CHECK_PARAMETER(node, return);
+
+ BT_INIT_PARAMS();
+ BT_ALLOC_PARAMS(in_param1, in_param2, in_param3, in_param4, out_param);
+
+ g_array_append_vals(in_param1, node, sizeof(bluetooth_mesh_node_info_t));
+
+ BT_INFO("Mesh: Reset the Node");
+ result = _bt_send_request(BT_BLUEZ_SERVICE, BT_MESH_NODE_RESET,
+ in_param1, in_param2, in_param3, in_param4, &out_param);
+ BT_FREE_PARAMS(in_param1, in_param2, in_param3, in_param4, out_param);
+
+ return result;
+}
+
BT_EXPORT_API int bluetooth_mesh_network_create(
const char *net_name, bluetooth_mesh_node_t *node,
uint16_t total_models, bluetooth_mesh_model_t **models,