/* Forward declaration: Callbacks from HAL */
static void mesh_network_attached_callback(bt_status_t status,
bt_mesh_token_t *token, bt_uuid_t *uuid);
+static void mesh_network_destroyed_callback(bt_status_t status,
+ bt_mesh_token_t *token, bt_uuid_t *uuid);
static void mesh_network_scan_status_callback(bt_mesh_scan_state_t scan_state,
bt_status_t status, bt_uuid_t *net_uuid);
static void mesh_network_scan_result_callback(bt_status_t status,
static btmesh_callbacks_t sBluetoothMeshCallbacks = {
.size = sizeof(sBluetoothMeshCallbacks),
.network_attached_cb = mesh_network_attached_callback,
+ .network_destroyed_cb = mesh_network_destroyed_callback,
.scan_status_cb = mesh_network_scan_status_callback,
.scan_result_cb = mesh_network_scan_result_callback,
.provisioning_status_cb = mesh_network_provisioning_status_callback,
event, sizeof(event_mesh_network_attached_t), NULL);
}
+static void mesh_network_destroyed_callback(bt_status_t status,
+ bt_mesh_token_t *token, bt_uuid_t *uuid)
+{
+ event_mesh_network_attached_t *event = g_new0(event_mesh_network_attached_t, 1);
+
+ event->status = convert_to_oal_status(status);
+ BT_INFO("Mesh Event: Network Destroyed, status: [%s]",
+ status2string(status));
+
+ memcpy(event->token, token->token, sizeof(bt_mesh_token_t));
+ memcpy(event->uuid.uuid, uuid->uu, sizeof(bt_uuid_t));
+
+ send_event_bda_trace(OAL_EVENT_MESH_NETWORK_DESTROYED,
+ event, sizeof(event_mesh_network_destroyed_t), NULL);
+}
+
static void mesh_network_scan_status_callback(bt_mesh_scan_state_t scan_state,
bt_status_t status, bt_uuid_t *net_uuid)
{
return OAL_STATUS_SUCCESS;
}
+oal_status_t mesh_network_destroy(oal_uuid_t* network_uuid)
+{
+ int ret = BT_STATUS_SUCCESS;
+ API_TRACE();
+ CHECK_OAL_MESH_ENABLED();
+
+ ret = mesh_api->destroy((bt_uuid_t*)network_uuid);
+ if (ret != BT_STATUS_SUCCESS) {
+ BT_ERR("MESH: Network Leave failed: %s", status2string(ret));
+ return convert_to_oal_status(ret);
+ }
+
+ return OAL_STATUS_SUCCESS;
+}
+
+oal_status_t mesh_delete_remote_node(oal_uuid_t* network_uuid,
+ uint16_t unicast, uint16_t num_elements)
+{
+ int ret = BT_STATUS_SUCCESS;
+ API_TRACE();
+ CHECK_OAL_MESH_ENABLED();
+
+ ret = mesh_api->delete_node((bt_uuid_t*)network_uuid, unicast, num_elements);
+ if (ret != BT_STATUS_SUCCESS) {
+ BT_ERR("Mesh: Remote Node Deletion failed: %s", status2string(ret));
+ return convert_to_oal_status(ret);
+ }
+
+ return OAL_STATUS_SUCCESS;
+}
+
oal_status_t mesh_network_start_scan(oal_uuid_t* network_uuid,
oal_mesh_scan_params_t *params)
{