/**
* @internal
* @ingroup CAPI_NETWORK_BLUETOOTH_MESH_MODULE
+ * @brief Resets the remote node identified by the node handle
+ *
+ * @remarks: Resetting local node is not allowed
+ * @remarks: If reset is successful, node handle will become invalid. Application
+ * should not use the node handle after resetting the node.
+ *
+ * @see bt_mesh_network_provision_device()
+ * @see bt_mesh_network_discover_node()
+ *
+ * @since_tizen 6.0
+ * @privlevel platform
+ */
+int bt_mesh_node_reset(bt_mesh_node_h node_handle);
+
+/**
+ * @internal
+ * @ingroup CAPI_NETWORK_BLUETOOTH_MESH_MODULE
* @brief API to create a mesh element. In case of Mesh Provisioner,
* it will serve as a element of the local node of a Mesh Provisioner.
*
return BT_ERROR_NONE;
}
+int bt_mesh_node_reset(bt_mesh_node_h node_handle)
+{
+ FUNC_ENTRY;
+
+ bt_mesh_network_s *network_s;
+ bt_mesh_node_s *node_s;
+ bluetooth_mesh_node_info_t node;
+ int error_code = BT_ERROR_NONE;
+
+ BT_CHECK_MESH_SUPPORT();
+ BT_CHECK_MESH_INIT_STATUS();
+ BT_CHECK_INPUT_PARAMETER(node_handle);
+
+ node_s = (bt_mesh_node_s*)node_handle;
+ BT_MESH_VALIDATE_HANDLE(node_s, node_list);
+
+ network_s = node_s->parent;
+ BT_CHECK_INPUT_PARAMETER(network_s);
+ BT_MESH_VALIDATE_HANDLE(network_s, networks);
+
+ /* Resetting a local node is not allowed */
+ BT_CHECK_MESH_REMOTE(node_s);
+
+ /* Only attached remote nodes can be resetted */
+ if (!node_s->is_attached)
+ return BT_ERROR_INVALID_PARAMETER;
+
+ BT_INFO("Mesh: Reset the node [0x%2.2x]", node_s->unicast);
+
+ /* Fill node */
+ memset(&node, 0x00, sizeof(bluetooth_mesh_node_t));
+ g_strlcpy(node.net_uuid, network_s->uuid, 33);
+ node.primary_unicast = node_s->unicast;
+ node.num_elements = g_slist_length(node_s->elements);
+
+ error_code = _bt_get_error_code(bluetooth_mesh_node_reset(&node));
+ if (error_code != BT_ERROR_NONE) {
+ BT_ERR("%s(0x%08x)", _bt_convert_error_to_string(error_code), error_code);
+ return error_code;
+ }
+
+ /* Cleanup the Node handles */
+ node_list = g_slist_remove(node_list, node_s);
+ g_slist_free_full(node_s->elements, __bt_mesh_free_elements);
+ g_free(node_s);
+
+ FUNC_EXIT;
+ return error_code;
+}
+
int bt_mesh_node_destroy(bt_mesh_node_h node_handle)
{
FUNC_ENTRY;