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;