From: Anupam Roy Date: Fri, 17 Jul 2020 18:23:47 +0000 (+0530) Subject: Mesh: Enable Build & Export Mesh Framework API X-Git-Tag: submit/tizen/20200724.011403~7 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=3c8245eed8704668b661650f3795ca840ca4c7cb;p=platform%2Fcore%2Fconnectivity%2Fbluetooth-frwk.git Mesh: Enable Build & Export Mesh Framework API Note: This patch also adds Mesh Network load API Change-Id: Ice94d7932bcb286f87628fea9099639136d43db8 Signed-off-by: Anupam Roy --- diff --git a/bt-api/CMakeLists.txt b/bt-api/CMakeLists.txt index ffc7a98..19d9cb0 100644 --- a/bt-api/CMakeLists.txt +++ b/bt-api/CMakeLists.txt @@ -30,7 +30,8 @@ bt-ipsp.c bt-dpm.c bt-proximity.c bt-tds.c -bt-otp.c) +bt-otp.c +bt-mesh.c) SET(HEADERS bluetooth-api.h @@ -41,7 +42,8 @@ bluetooth-media-control.h bluetooth-scmst-api.h bluetooth-ipsp-api.h bluetooth-gatt-server-api.h -bluetooth-gatt-client-api.h) +bluetooth-gatt-client-api.h +bluetooth-mesh-api.h) SET(PREFIX ${CMAKE_INSTALL_PREFIX}) SET(EXEC_PREFIX "\${prefix}") diff --git a/bt-api/bt-mesh.c b/bt-api/bt-mesh.c index ea9d1ae..5704417 100644 --- a/bt-api/bt-mesh.c +++ b/bt-api/bt-mesh.c @@ -108,6 +108,35 @@ BT_EXPORT_API int bluetooth_mesh_network_create( return result; } +BT_EXPORT_API int bluetooth_mesh_network_load( + const char *token, + bluetooth_mesh_network_t *network) +{ + int result; + char token_string[BLUETOOTH_MESH_TOKEN_STRING_MAX + 1]; + + BT_CHECK_PARAMETER(token, return); + BT_CHECK_PARAMETER(network, return); + + BT_INIT_PARAMS(); + BT_ALLOC_PARAMS(in_param1, in_param2, in_param3, in_param4, out_param); + + g_strlcpy(token_string, token, sizeof(token_string)); + g_array_append_vals(in_param1, token_string, BLUETOOTH_MESH_TOKEN_STRING_MAX); + + result = _bt_send_request(BT_BLUEZ_SERVICE, BT_MESH_NETWORK_LOAD, + in_param1, in_param2, in_param3, in_param4, &out_param); + + if (result == BLUETOOTH_ERROR_NONE) { + *network = g_array_index(out_param, + bluetooth_mesh_network_t, 0); + } + + BT_FREE_PARAMS(in_param1, in_param2, in_param3, in_param4, out_param); + + return result; +} + BT_EXPORT_API int bluetooth_mesh_network_scan( bluetooth_mesh_network_t *network, bluetooth_mesh_scan_param_t *scan_param) diff --git a/bt-api/include/bt-common.h b/bt-api/include/bt-common.h index e7bbd8d..0f652b2 100644 --- a/bt-api/include/bt-common.h +++ b/bt-api/include/bt-common.h @@ -263,6 +263,7 @@ typedef enum { #ifdef TIZEN_GATT_CLIENT BT_GATT_CLIENT, #endif + BT_MESH, BT_MAX_USER_INFO } bt_user_info_type_t; diff --git a/packaging/bluetooth-frwk.spec b/packaging/bluetooth-frwk.spec index 155d8fc..aeec88c 100644 --- a/packaging/bluetooth-frwk.spec +++ b/packaging/bluetooth-frwk.spec @@ -451,6 +451,7 @@ ln -s ../bluetooth-frwk.service %{buildroot}%{_unitdir}/starter.target.wants/blu %{_includedir}/bt-service/bluetooth-ipsp-api.h %{_includedir}/bt-service/bluetooth-gatt-server-api.h %{_includedir}/bt-service/bluetooth-gatt-client-api.h +%{_includedir}/bt-service/bluetooth-mesh-api.h %{_libdir}/pkgconfig/bluetooth-api.pc %{_libdir}/libbluetooth-api.so