Mesh: Enable Build & Export Mesh Framework API
authorAnupam Roy <anupam.r@samsung.com>
Fri, 17 Jul 2020 18:23:47 +0000 (23:53 +0530)
committerAnupam Roy <anupam.r@samsung.com>
Fri, 17 Jul 2020 18:23:47 +0000 (23:53 +0530)
Note: This patch also adds Mesh Network load API

Change-Id: Ice94d7932bcb286f87628fea9099639136d43db8
Signed-off-by: Anupam Roy <anupam.r@samsung.com>
bt-api/CMakeLists.txt
bt-api/bt-mesh.c
bt-api/include/bt-common.h
packaging/bluetooth-frwk.spec

index ffc7a98..19d9cb0 100644 (file)
@@ -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}")
index ea9d1ae..5704417 100644 (file)
@@ -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)
index e7bbd8d..0f652b2 100644 (file)
@@ -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;
 
index 155d8fc..aeec88c 100644 (file)
@@ -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