2 * Open Adaptation Layer (OAL)
4 * Copyright (c) 2020 Samsung Electronics Co., Ltd.
6 * @author: Anupam Roy <anupam.r@samsung.com>
8 * Licensed under the Apache License, Version 2.0 (the "License");
9 * you may not use this file except in compliance with the License.
10 * You may obtain a copy of the License at
12 * http://www.apache.org/licenses/LICENSE-2.0
14 * Unless required by applicable law or agreed to in writing, software
15 * distributed under the License is distributed on an "AS IS" BASIS,
16 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17 * See the License for the specific language governing permissions and
18 * limitations under the License.
22 #include <bluetooth.h>
25 #include "oal-event.h"
26 #include "oal-internal.h"
27 #include "oal-manager.h"
28 #include "oal-adapter-mgr.h"
29 #include "oal-utils.h"
31 #include "oal-common.h"
34 static const bt_interface_t *blued_api;
35 static const btmesh_interface_t *mesh_api;
37 #define CHECK_OAL_MESH_ENABLED() \
39 if (mesh_api == NULL) { \
40 BT_ERR("Mesh Not Enabled"); \
41 return OAL_STATUS_NOT_READY; \
45 /* Forward declaration: Callbacks from HAL */
46 static void mesh_network_proxy_added_callback(bt_status_t status);
47 static void mesh_network_attached_callback(bt_status_t status,
48 bool is_prov, bt_mesh_token_t *token, bt_uuid_t *uuid);
49 static void mesh_network_destroyed_callback(bt_status_t status,
50 bt_mesh_token_t *token, bt_uuid_t *uuid);
51 static void mesh_network_scan_status_callback(bt_mesh_scan_state_t scan_state,
52 bt_status_t status, bt_uuid_t *net_uuid);
53 static void mesh_network_scan_result_callback(bt_status_t status,
54 bt_uuid_t *net_uuid, bt_mesh_scan_result_t *result);
55 static void mesh_network_provisioning_status_callback(bt_status_t status,
56 bt_uuid_t *net_uuid, bt_uuid_t *dev_uuid);
57 static void mesh_network_provisioning_finished_callback(bt_status_t status,
58 int reason, bt_uuid_t *net_uuid,
59 bt_uuid_t *dev_uuid, uint16_t unicast, uint8_t count);
60 static void mesh_network_provisioning_data_requested_callback(
61 bt_uuid_t *net_uuid, uint8_t count);
62 static void mesh_network_authentication_requested_callback(bt_uuid_t *net_uuid,
63 bt_hal_mesh_auth_variant_e auth_type, char auth_value[]);
64 static void mesh_network_netkey_execute_callback(bt_status_t status,
65 bt_uuid_t *net_uuid, uint8_t key_event, uint16_t netkey_idx);
66 static void mesh_network_appkey_execute_callback(bt_status_t status,
67 bt_uuid_t *net_uuid, uint8_t key_event, uint16_t netkey_idx, uint16_t appkey_idx);
68 static void mesh_network_appkey_execute_callback(bt_status_t status,
69 bt_uuid_t *net_uuid, uint8_t key_event, uint16_t netkey_idx, uint16_t appkey_idx);
70 static void mesh_devkey_message_received_callback(bt_uuid_t *net_uuid,
71 uint16_t source_addr, bool is_remote_devkey,
72 uint16_t netkey_idx, uint16_t ata_len, uint8_t *data);
73 static void mesh_message_received_callback(bt_uuid_t *net_uuid, bool is_prov,
74 uint16_t source_addr, uint16_t dest_addr,
75 uint16_t key_idx, uint16_t data_len, uint8_t *data);
78 static btmesh_callbacks_t sBluetoothMeshCallbacks = {
79 .size = sizeof(sBluetoothMeshCallbacks),
80 .network_proxy_added_cb = mesh_network_proxy_added_callback,
81 .network_attached_cb = mesh_network_attached_callback,
82 .network_destroyed_cb = mesh_network_destroyed_callback,
83 .scan_status_cb = mesh_network_scan_status_callback,
84 .scan_result_cb = mesh_network_scan_result_callback,
85 .provisioning_status_cb = mesh_network_provisioning_status_callback,
86 .provisioning_finished_cb = mesh_network_provisioning_finished_callback,
87 .provisioning_data_requested_cb = mesh_network_provisioning_data_requested_callback,
88 .authentication_requested_cb = mesh_network_authentication_requested_callback,
89 .netkey_execute_cb = mesh_network_netkey_execute_callback,
90 .appkey_execute_cb = mesh_network_appkey_execute_callback,
91 .devkey_msg_cb = mesh_devkey_message_received_callback,
92 .msg_cb = mesh_message_received_callback,
95 /* Mesh HAL event handlers */
96 static void mesh_network_proxy_added_callback(bt_status_t status)
98 event_mesh_network_proxy_added_t *event = g_new0(event_mesh_network_proxy_added_t, 1);
100 event->status = convert_to_oal_status(status);
101 BT_INFO("Mesh Event: Network Proxy Added, status: [%s]",
102 status2string(status));
104 send_event_bda_trace(OAL_EVENT_MESH_NETWORK_PROXY_ADDED,
105 event, sizeof(event_mesh_network_proxy_added_t), NULL);
108 static void mesh_network_attached_callback(bt_status_t status, bool is_prov,
109 bt_mesh_token_t *token, bt_uuid_t *uuid)
111 event_mesh_network_attached_t *event = g_new0(event_mesh_network_attached_t, 1);
113 event->status = convert_to_oal_status(status);
114 BT_INFO("Mesh Event: Network Attached, status: [%s]",
115 status2string(status));
117 memcpy(event->token, token->token, sizeof(bt_mesh_token_t));
118 memcpy(event->uuid.uuid, uuid->uu, sizeof(bt_uuid_t));
119 event->is_prov = is_prov;
121 send_event_bda_trace(OAL_EVENT_MESH_NETWORK_ATTACHED,
122 event, sizeof(event_mesh_network_attached_t), NULL);
125 static void mesh_network_destroyed_callback(bt_status_t status,
126 bt_mesh_token_t *token, bt_uuid_t *uuid)
128 event_mesh_network_attached_t *event = g_new0(event_mesh_network_attached_t, 1);
130 event->status = convert_to_oal_status(status);
131 BT_INFO("Mesh Event: Network Destroyed, status: [%s]",
132 status2string(status));
134 memcpy(event->token, token->token, sizeof(bt_mesh_token_t));
135 memcpy(event->uuid.uuid, uuid->uu, sizeof(bt_uuid_t));
137 send_event_bda_trace(OAL_EVENT_MESH_NETWORK_DESTROYED,
138 event, sizeof(event_mesh_network_destroyed_t), NULL);
141 static void mesh_network_scan_status_callback(bt_mesh_scan_state_t scan_state,
142 bt_status_t status, bt_uuid_t *net_uuid)
144 event_mesh_scan_status_t *event_data = g_new0(event_mesh_scan_status_t, 1);
147 event_data->status = convert_to_oal_status(status);
148 BT_INFO("Mesh Event: Scan status: [%s] state [%d]",
149 status2string(status), scan_state);
151 memcpy(event_data->net_uuid.uuid, net_uuid->uu, sizeof(bt_uuid_t));
153 event = (BT_MESH_SCAN_STARTED == scan_state) ? \
154 OAL_EVENT_MESH_SCAN_STARTED : OAL_EVENT_MESH_SCAN_FINISHED;
155 send_event_bda_trace(event, event_data,
156 sizeof(event_mesh_scan_status_t), NULL);
159 static void mesh_network_provisioning_status_callback(bt_status_t status,
160 bt_uuid_t *net_uuid, bt_uuid_t *dev_uuid)
162 event_mesh_provisioning_status_t *event = g_new0(event_mesh_provisioning_status_t, 1);
164 event->status = convert_to_oal_status(status);
165 BT_INFO("Mesh Event: Provisioning status: [%s]",
166 status2string(status));
168 memcpy(event->net_uuid.uuid, net_uuid->uu, sizeof(bt_uuid_t));
169 memcpy(event->dev_uuid.uuid, dev_uuid->uu, sizeof(bt_uuid_t));
171 if (event->status == OAL_STATUS_SUCCESS)
172 send_event_bda_trace(OAL_EVENT_MESH_PROVISIONING_STARTED,
173 event, sizeof(event_mesh_provisioning_status_t), NULL);
175 send_event_bda_trace(OAL_EVENT_MESH_PROVISIONING_FAILED,
176 event, sizeof(event_mesh_provisioning_status_t), NULL);
179 static void mesh_network_provisioning_finished_callback(bt_status_t status,
180 int reason, bt_uuid_t *net_uuid,
181 bt_uuid_t *dev_uuid, uint16_t unicast, uint8_t count)
183 event_mesh_provisioning_finished_t *event = \
184 g_new0(event_mesh_provisioning_finished_t, 1);
186 event->status = convert_to_oal_status(status);
187 event->reason = reason;
188 BT_INFO("Mesh Event: Provisioning Completed Result: [%s]",
189 status2string(status));
191 memcpy(event->net_uuid.uuid, net_uuid->uu, sizeof(bt_uuid_t));
192 memcpy(event->dev_uuid.uuid, dev_uuid->uu, sizeof(bt_uuid_t));
193 event->unicast = unicast;
194 event->count = count;
196 send_event_bda_trace(OAL_EVENT_MESH_PROVISIONING_FINISHED,
197 event, sizeof(event_mesh_provisioning_finished_t), NULL);
200 static void mesh_network_provisioning_data_requested_callback(
201 bt_uuid_t *net_uuid, uint8_t count)
203 event_mesh_provisioning_data_requested_t *event = \
204 g_new0(event_mesh_provisioning_data_requested_t, 1);
206 BT_INFO("Mesh Event: Provisioning Data requested");
208 memcpy(event->net_uuid.uuid, net_uuid->uu, sizeof(bt_uuid_t));
209 event->count = count;
211 send_event_bda_trace(OAL_EVENT_MESH_PROVISIONING_DATA_REQUESTED,
212 event, sizeof(event_mesh_provisioning_data_requested_t), NULL);
215 static void mesh_network_authentication_requested_callback(bt_uuid_t *net_uuid,
216 bt_hal_mesh_auth_variant_e auth_type,
219 event_mesh_authentication_requested_t *event = \
220 g_new0(event_mesh_authentication_requested_t, 1);
222 BT_INFO("Mesh Event: Authentication requested");
224 memcpy(event->net_uuid.uuid, net_uuid->uu, sizeof(bt_uuid_t));
225 event->auth_type = auth_type;
226 g_strlcpy(event->auth_value, auth_value, sizeof(event->auth_value));
228 send_event_bda_trace(OAL_EVENT_MESH_AUTHENTICATION_REQUESTED,
229 event, sizeof(event_mesh_provisioning_data_requested_t), NULL);
232 static void mesh_network_netkey_execute_callback(bt_status_t status,
233 bt_uuid_t *net_uuid, uint8_t key_event, uint16_t index)
235 event_mesh_netkey_operation_t *event = \
236 g_new0(event_mesh_netkey_operation_t, 1);
238 event->status = convert_to_oal_status(status);
239 BT_INFO("Mesh Event: NetKey Execute Event");
241 memcpy(event->net_uuid.uuid, net_uuid->uu, sizeof(bt_uuid_t));
242 event->op = (oal_mesh_key_op_e)key_event;
243 event->key_idx = index;
245 send_event_bda_trace(OAL_EVENT_MESH_NETKEY_EXECUTE_EVENT,
246 event, sizeof(event_mesh_netkey_operation_t), NULL);
249 static void mesh_network_appkey_execute_callback(bt_status_t status,
250 bt_uuid_t *net_uuid, uint8_t key_event,
251 uint16_t net_idx, uint16_t app_idx)
253 event_mesh_appkey_operation_t *event = \
254 g_new0(event_mesh_appkey_operation_t, 1);
256 event->status = convert_to_oal_status(status);
257 BT_INFO("Mesh Event: AppKey Execute Event");
259 memcpy(event->net_uuid.uuid, net_uuid->uu, sizeof(bt_uuid_t));
260 event->op = (oal_mesh_key_op_e)key_event;
261 event->net_idx = net_idx;
262 event->app_idx = app_idx;
264 send_event_bda_trace(OAL_EVENT_MESH_APPKEY_EXECUTE_EVENT,
265 event, sizeof(event_mesh_appkey_operation_t), NULL);
268 static void mesh_network_scan_result_callback(bt_status_t status,
269 bt_uuid_t *net_uuid, bt_mesh_scan_result_t *result)
271 event_mesh_scan_result_t *event = g_new0(event_mesh_scan_result_t, 1);
273 event->status = convert_to_oal_status(status);
274 BT_INFO("Mesh Event: Scan Result status: [%s]",
275 status2string(status));
277 memcpy(event->net_uuid.uuid, net_uuid->uu, sizeof(bt_uuid_t));
278 memcpy(&event->result, result, sizeof(bt_mesh_scan_result_t));
280 send_event_bda_trace(OAL_EVENT_MESH_SCAN_RESULT,
281 event, sizeof(event_mesh_scan_result_t), NULL);
284 static void mesh_devkey_message_received_callback(bt_uuid_t *net_uuid,
285 uint16_t source_addr,
286 bool is_remote_devkey, uint16_t netkey_idx,
287 uint16_t data_len, uint8_t *data)
289 event_mesh_devkey_message_t *event = g_new0(event_mesh_devkey_message_t, 1);
291 BT_INFO("Mesh Event: Dev Key Message Received");
292 event->source = source_addr;
293 event->remote = is_remote_devkey;
294 event->subnet = netkey_idx;
295 event->data_len = data_len;
296 memcpy(event->net_uuid.uuid, net_uuid->uu, sizeof(bt_uuid_t));
297 memcpy(event->data, data, data_len);
299 send_event_bda_trace(OAL_EVENT_MESH_DEVKEY_MESSAGE_RECEIVED, event,
300 sizeof(event_mesh_devkey_message_t), NULL);
303 static void mesh_message_received_callback(bt_uuid_t *net_uuid, bool is_prov,
304 uint16_t source_addr, uint16_t dest_addr, uint16_t key_idx,
305 uint16_t data_len, uint8_t *data)
307 event_mesh_message_t *event = g_new0(event_mesh_message_t, 1);
309 BT_INFO("Mesh Event: Model Message Received");
310 event->source = source_addr;
311 event->is_prov = is_prov;
312 event->dest = dest_addr;
313 event->key_idx = key_idx;
314 event->data_len = data_len;
315 memcpy(event->net_uuid.uuid, net_uuid->uu, sizeof(bt_uuid_t));
316 memcpy(event->data, data, data_len);
318 send_event_bda_trace(OAL_EVENT_MESH_MODEL_MESSAGE_RECEIVED, event,
319 sizeof(event_mesh_message_t), NULL);
322 oal_status_t mesh_enable(void)
327 /* Get stack interface */
328 blued_api = (const bt_interface_t *) adapter_get_stack_interface();
330 if (blued_api == NULL) {
331 BT_ERR("Stack is not initialized");
332 return OAL_STATUS_NOT_READY;
336 BT_WARN("MESH Interface is already initialized...");
337 return OAL_STATUS_ALREADY_DONE;
340 mesh_api = (const btmesh_interface_t *)blued_api->get_profile_interface(BT_PROFILE_MESH_ID);
341 if (mesh_api == NULL) {
342 BT_ERR("MESH interface failed");
343 return OAL_STATUS_INTERNAL_ERROR;
346 if ((ret = mesh_api->init(&sBluetoothMeshCallbacks)) != BT_STATUS_SUCCESS) {
347 BT_ERR("Error: Unable to initialise MESH :%s", status2string(ret));
350 return convert_to_oal_status(ret);
353 BT_INFO("MESH successfully initialized");
354 return OAL_STATUS_SUCCESS;
357 oal_status_t mesh_disable(void)
360 CHECK_OAL_MESH_ENABLED();
365 return OAL_STATUS_SUCCESS;
368 oal_status_t mesh_register_node(oal_mesh_node_t *node,
369 GSList *model_list, bool is_provisioner)
371 int ret = BT_STATUS_SUCCESS;
373 CHECK_OAL_MESH_ENABLED();
375 if (is_provisioner) {
376 BT_INFO("Mesh: Send create network request to stack");
377 ret = mesh_api->create((bt_hal_mesh_node_t*)node, model_list, is_provisioner);
378 if (ret != BT_STATUS_SUCCESS) {
379 BT_ERR("MESH: Create Network failed :failed: %s", status2string(ret));
380 return convert_to_oal_status(ret);
383 BT_INFO("Mesh: Send join network request to stack");
384 ret = mesh_api->join((bt_hal_mesh_node_t*)node, model_list);
385 if (ret != BT_STATUS_SUCCESS) {
386 return convert_to_oal_status(ret);
390 BT_INFO("Mesh: Request sent to stack");
391 return OAL_STATUS_SUCCESS;
394 oal_status_t mesh_cancel_join(oal_uuid_t* node_uuid)
396 int ret = BT_STATUS_SUCCESS;
398 CHECK_OAL_MESH_ENABLED();
400 BT_INFO("Mesh: Send cancel join request to stack");
401 ret = mesh_api->cancel((bt_uuid_t*)node_uuid);
402 if (ret != BT_STATUS_SUCCESS) {
403 BT_ERR("MESH: cancel join failed: %s", status2string(ret));
404 return convert_to_oal_status(ret);
407 return OAL_STATUS_SUCCESS;
410 oal_status_t mesh_network_release(oal_uuid_t* network_uuid)
412 int ret = BT_STATUS_SUCCESS;
414 CHECK_OAL_MESH_ENABLED();
416 BT_INFO("Mesh: Send Release Network request to stack");
417 ret = mesh_api->release((bt_uuid_t*)network_uuid);
418 if (ret != BT_STATUS_SUCCESS) {
419 BT_ERR("MESH: Network Leave failed: %s", status2string(ret));
420 return convert_to_oal_status(ret);
423 return OAL_STATUS_SUCCESS;
426 oal_status_t mesh_network_destroy(oal_uuid_t* network_uuid)
428 int ret = BT_STATUS_SUCCESS;
430 CHECK_OAL_MESH_ENABLED();
432 ret = mesh_api->destroy((bt_uuid_t*)network_uuid);
433 if (ret != BT_STATUS_SUCCESS) {
434 BT_ERR("MESH: Network Leave failed: %s", status2string(ret));
435 return convert_to_oal_status(ret);
438 return OAL_STATUS_SUCCESS;
441 oal_status_t mesh_delete_remote_node(oal_uuid_t* network_uuid,
442 uint16_t unicast, uint16_t num_elements)
444 int ret = BT_STATUS_SUCCESS;
446 CHECK_OAL_MESH_ENABLED();
448 ret = mesh_api->delete_node((bt_uuid_t*)network_uuid, unicast, num_elements);
449 if (ret != BT_STATUS_SUCCESS) {
450 BT_ERR("Mesh: Remote Node Deletion failed: %s", status2string(ret));
451 return convert_to_oal_status(ret);
454 return OAL_STATUS_SUCCESS;
457 oal_status_t mesh_network_start_scan(oal_uuid_t* network_uuid,
458 oal_mesh_scan_params_t *params)
460 int ret = BT_STATUS_SUCCESS;
462 CHECK_OAL_MESH_ENABLED();
464 ret = mesh_api->scan((bt_uuid_t*)network_uuid,
465 (bt_hal_mesh_scan_param_t*)params);
466 if (ret != BT_STATUS_SUCCESS) {
467 BT_ERR("MESH: Start Scan failed: %s", status2string(ret));
468 return convert_to_oal_status(ret);
471 return OAL_STATUS_SUCCESS;
474 oal_status_t mesh_network_scan_cancel(oal_uuid_t* network_uuid)
476 int ret = BT_STATUS_SUCCESS;
478 CHECK_OAL_MESH_ENABLED();
480 ret = mesh_api->scan_cancel((bt_uuid_t*)network_uuid);
481 if (ret != BT_STATUS_SUCCESS) {
482 BT_ERR("MESH: Scan Cancel failed: %s", status2string(ret));
483 return convert_to_oal_status(ret);
486 return OAL_STATUS_SUCCESS;
489 oal_status_t mesh_network_set_provisioning_capabilities(
490 oal_uuid_t *network_uuid,
491 oal_mesh_capabilities_t *caps)
493 int ret = BT_STATUS_SUCCESS;
495 CHECK_OAL_MESH_ENABLED();
497 ret = mesh_api->capability((bt_uuid_t*)network_uuid,
498 (bt_hal_mesh_prov_caps_t*)caps);
499 if (ret != BT_STATUS_SUCCESS) {
500 BT_ERR("MESH: Set Provisioning capabilities :failed: %s",
502 return convert_to_oal_status(ret);
505 return OAL_STATUS_SUCCESS;
508 oal_status_t mesh_conf_send_message(oal_uuid_t *network_uuid,
509 uint16_t dest, bool is_devkey_remote,
510 uint16_t netkey_idx, uint8_t *buf, int len)
512 int ret = BT_STATUS_SUCCESS;
514 CHECK_OAL_MESH_ENABLED();
516 ret = mesh_api->config_send((bt_uuid_t*)network_uuid,
517 dest, is_devkey_remote, netkey_idx, buf, len);
518 if (ret != BT_STATUS_SUCCESS) {
519 BT_ERR("MESH: Configuration Message sending failed: %s",
521 return convert_to_oal_status(ret);
524 return OAL_STATUS_SUCCESS;
527 oal_status_t mesh_conf_send_key_message(oal_uuid_t *network_uuid,
528 uint16_t dest, bool is_netkey,
529 bool is_update, int key_idx, int netkey_idx)
531 int ret = BT_STATUS_SUCCESS;
533 CHECK_OAL_MESH_ENABLED();
535 ret = mesh_api->key_send((bt_uuid_t*)network_uuid, dest,
536 is_netkey, is_update, key_idx, netkey_idx);
537 if (ret != BT_STATUS_SUCCESS) {
538 BT_ERR("MESH: Key Configuration Message sending failed: %s",
540 return convert_to_oal_status(ret);
543 return OAL_STATUS_SUCCESS;
546 oal_status_t mesh_model_send_message(oal_uuid_t *network_uuid,
547 uint16_t dest, uint16_t appkey_idx,
548 uint8_t *buf, int len)
550 int ret = BT_STATUS_SUCCESS;
552 CHECK_OAL_MESH_ENABLED();
554 ret = mesh_api->msg_execute((bt_uuid_t*)network_uuid,
555 dest, appkey_idx, buf, len);
556 if (ret != BT_STATUS_SUCCESS) {
557 BT_ERR("MESH: Model Message sending failed: %s",
559 return convert_to_oal_status(ret);
562 return OAL_STATUS_SUCCESS;
565 oal_status_t mesh_network_provision_device(oal_uuid_t* network_uuid,
566 oal_uuid_t *dev_uuid)
568 int ret = BT_STATUS_SUCCESS;
570 CHECK_OAL_MESH_ENABLED();
572 ret = mesh_api->provision((bt_uuid_t*)network_uuid, (bt_uuid_t *)dev_uuid);
573 if (ret != BT_STATUS_SUCCESS) {
574 BT_ERR("MESH: Device Provisioning :failed: %s",
576 return convert_to_oal_status(ret);
579 return OAL_STATUS_SUCCESS;
582 oal_status_t mesh_network_send_provisioning_data(oal_uuid_t* network_uuid,
583 uint16_t netkey_idx, uint16_t unicast)
585 int ret = BT_STATUS_SUCCESS;
587 CHECK_OAL_MESH_ENABLED();
589 ret = mesh_api->provision_data((bt_uuid_t*)network_uuid, netkey_idx, unicast);
590 if (ret != BT_STATUS_SUCCESS) {
591 BT_ERR("MESH: Device Provisioning :failed: %s",
593 return convert_to_oal_status(ret);
596 return OAL_STATUS_SUCCESS;
599 oal_status_t mesh_network_subnet_execute(oal_uuid_t* network_uuid,
600 oal_mesh_key_op_e operation, uint16_t net_index)
602 int ret = BT_STATUS_SUCCESS;
604 CHECK_OAL_MESH_ENABLED();
606 ret = mesh_api->subnet_execute((bt_uuid_t*)network_uuid,
607 (bt_mesh_key_op_e)operation, net_index);
608 if (ret != BT_STATUS_SUCCESS) {
609 BT_ERR("MESH: Create Subnet :failed: %s", status2string(ret));
610 return convert_to_oal_status(ret);
613 return OAL_STATUS_SUCCESS;
616 oal_status_t mesh_network_appkey_execute(oal_uuid_t* network_uuid,
617 oal_mesh_key_op_e operation,
618 uint16_t net_index, uint16_t app_index)
620 int ret = BT_STATUS_SUCCESS;
622 CHECK_OAL_MESH_ENABLED();
624 ret = mesh_api->appkey_execute((bt_uuid_t*)network_uuid,
625 (bt_mesh_key_op_e)operation,
626 net_index, app_index);
627 if (ret != BT_STATUS_SUCCESS) {
628 BT_ERR("MESH: Create Subnet :failed: %s",
630 return convert_to_oal_status(ret);
633 return OAL_STATUS_SUCCESS;
636 oal_status_t mesh_authentication_reply(
637 oal_mesh_variant_authentication_e auth_type,
638 const char* auth_value)
640 int ret = BT_STATUS_SUCCESS;
642 CHECK_OAL_MESH_ENABLED();
644 ret = mesh_api->auth_reply((bt_hal_mesh_auth_variant_e)auth_type,
646 if (ret != BT_STATUS_SUCCESS) {
647 BT_ERR("MESH: Device Provisioning :failed: %s",
649 return convert_to_oal_status(ret);
652 return OAL_STATUS_SUCCESS;