Use GATT server's get mtu size API instead of GATT client API 29/210029/2
authorDoHyun Pyun <dh79.pyun@samsung.com>
Mon, 17 Jun 2019 09:20:47 +0000 (18:20 +0900)
committerSudipto Bal <sudipto.bal@samsung.com>
Mon, 15 Jul 2019 06:20:32 +0000 (11:50 +0530)
GATT server's get mtu size API is added on Tizen 5.5 public.
So we also add Tizen BLE 5.5 build option for the compatibility.

https://github.sec.samsung.net/RS7-IOTIVITY/IoTivity/pull/524/commits/6b31a4840ddceaeb699293dff833353d39901675
(cherry-picked from 6b31a4840ddceaeb699293dff833353d39901675)

Change-Id: I96137ae7382d189460edc7427f4f2d6add212817
Signed-off-by: DoHyun Pyun <dh79.pyun@samsung.com>
Signed-off-by: Sudipto Bal <sudipto.bal@samsung.com>
build_common/SConscript
packaging/snapshot_history.txt
resource/csdk/connectivity/src/bt_le_adapter/tizen/SConscript
resource/csdk/connectivity/src/bt_le_adapter/tizen/caleserver_mcd.c
resource/csdk/connectivity/src/bt_le_adapter/tizen/caleserver_vd.c
tools/tizen/iotivity.spec

index f0322ee..9ca277d 100755 (executable)
@@ -134,6 +134,7 @@ help_vars.Add(EnumVariable('BLE_CUSTOM_ADV', 'Build with CUSTOM Advertisement',
 help_vars.Add(EnumVariable('BLE_DIVISION', 'BLE Build with division code', 'OFF', allowed_values=('OFF', 'MCD', 'VD')))
 help_vars.Add(EnumVariable('BLE_TIZEN_30', 'Build with tizen 3.0 BLE api', 'False', allowed_values=('True', 'False')))
 help_vars.Add(EnumVariable('BLE_TIZEN_40', 'Build with tizen 4.0 BLE api', 'False', allowed_values=('True', 'False')))
+help_vars.Add(EnumVariable('BLE_TIZEN_55', 'Build with tizen 5.5 BLE api', 'False', allowed_values=('True', 'False')))
 help_vars.Add(PathVariable('TIZENRT_OS_DIR', 'Absolute Path to TizenRT OS directory', None, PathVariable.PathAccept))
 help_vars.Add(EnumVariable('PLATFORM_TLS', 'Use platform tls instead of local mbedtls', '0', allowed_values=('0', '1')))
 help_vars.Add(EnumVariable('OIC_SUPPORT_TIZEN_TRACE', 'Tizen Trace(T-trace) api availability', 'False', allowed_values=('True', 'False')))
index fbb81fd..1d33909 100755 (executable)
@@ -1,3 +1,9 @@
+http://suprem.sec.samsung.net/jira/browse/CONPRO-1461
+
+commit_info_2019-07-11.txt
+
+commit_id: 6b31a4840ddceaeb699293dff833353d39901675 
+---------------------------------------------------------------------------------------------------------------------------------
 http://suprem.sec.samsung.net/jira/browse/CONPRO-1456
 
 commit_info_2019-06-27.txt
index 4558380..2166547 100644 (file)
@@ -9,6 +9,7 @@ root_dir = os.pardir
 division = env.get('BLE_DIVISION')
 tizen30 = env.get('BLE_TIZEN_30')
 tizen40 = env.get('BLE_TIZEN_40')
+tizen55 = env.get('BLE_TIZEN_55')
 
 env.PrependUnique(CPPPATH = [ os.path.join(src_dir, 'tizen')])
 
@@ -18,7 +19,12 @@ if 'MCD' in division:
     env.AppendUnique(CPPDEFINES = ['BLE_MCD'])
     print "BLE for MCD"
 
-if tizen40 == 'True':
+if tizen55 == 'True':
+    env.AppendUnique(CPPDEFINES = ['BLE_TIZEN_30'])
+    env.AppendUnique(CPPDEFINES = ['BLE_TIZEN_40'])
+    env.AppendUnique(CPPDEFINES = ['BLE_TIZEN_55'])
+    print "Build using Tizen 5.5 BLE API"
+elif tizen40 == 'True':
     env.AppendUnique(CPPDEFINES = ['BLE_TIZEN_30'])
     env.AppendUnique(CPPDEFINES = ['BLE_TIZEN_40'])
     print "Build using Tizen 4.0 BLE API"
index 5c36a03..9f3791f 100644 (file)
@@ -1185,6 +1185,15 @@ uint16_t CALEServerGetMtuSize(const char* address)
     unsigned int mtu = CA_DEFAULT_BLE_MTU_SIZE;
     int ret = 0;
 
+#ifdef BLE_TIZEN_55
+    ret = bt_gatt_server_get_device_mtu(address, &mtu);
+    if (0 != ret)
+    {
+        OIC_LOG_V(ERROR, TAG,
+                  "bt_gatt_server_get_device_mtu failed with return [%s]", CALEGetErrorMsg(ret));
+        return CA_DEFAULT_BLE_MTU_SIZE;
+    }
+#else
 #ifdef BLE_TIZEN_40
     bt_gatt_client_h client = NULL;
     ret = bt_gatt_client_create(address, &client);
@@ -1219,6 +1228,7 @@ uint16_t CALEServerGetMtuSize(const char* address)
         return CA_DEFAULT_BLE_MTU_SIZE;
     }
 #endif // BLE_TIZEN_40
+#endif // BLE_TIZEN_55
 
     OIC_LOG_V(INFO, TAG, "mtu size(including header) from bt_device_get_att_mtu is %d", mtu);
     OIC_LOG(DEBUG, TAG, "OUT");
index bcfe6d4..bcd5d0d 100644 (file)
@@ -1047,6 +1047,15 @@ uint16_t CALEServerGetMtuSize(const char* address)
     unsigned int mtu = CA_DEFAULT_BLE_MTU_SIZE;
     int ret = 0;
 
+#ifdef BLE_TIZEN_55
+    ret = bt_gatt_server_get_device_mtu(address, &mtu);
+    if (0 != ret)
+    {
+        OIC_LOG_V(ERROR, TAG,
+                  "bt_gatt_server_get_device_mtu failed with return [%s]", CALEGetErrorMsg(ret));
+        return CA_DEFAULT_BLE_MTU_SIZE;
+    }
+#else
 #ifdef BLE_TIZEN_40
     bt_gatt_client_h client = NULL;
     ret = bt_gatt_client_create(address, &client);
@@ -1081,6 +1090,7 @@ uint16_t CALEServerGetMtuSize(const char* address)
         return CA_DEFAULT_BLE_MTU_SIZE;
     }
 #endif // BLE_TIZEN_40
+#endif // BLE_TIZEN_55
 
     OIC_LOG_V(INFO, TAG, "mtu size(including header) from bt_device_get_att_mtu is %d", mtu);
     OIC_LOG(DEBUG, TAG, "OUT");
index 46e8332..ea47eee 100644 (file)
@@ -88,7 +88,7 @@ Source1002: %{name}-test.manifest
 %{!?BLE_DIVISION: %define BLE_DIVISION VD}
 %{!?DISABLE_BLE_SERVER: %define DISABLE_BLE_SERVER 0}
 %{!?MULTIPLE_OWNER: %define MULTIPLE_OWNER 1}
-%{!?BLE_TIZEN_40: %define BLE_TIZEN_40 True}
+%{!?BLE_TIZEN_55: %define BLE_TIZEN_55 True}
 
 BuildRequires:  expat-devel
 BuildRequires:  python, libcurl-devel
@@ -184,7 +184,7 @@ scons %{JOB} --prefix=%{_prefix} \
     RD_MODE=%{RD_MODE} \
     BLE_CUSTOM_ADV=%{BLE_CUSTOM_ADV} \
     BLE_DIVISION=%{BLE_DIVISION} \
-    BLE_TIZEN_40=%{BLE_TIZEN_40} \
+    BLE_TIZEN_55=%{BLE_TIZEN_55}
     DISABLE_BLE_SERVER=%{DISABLE_BLE_SERVER} \
     MULTIPLE_OWNER=%{MULTIPLE_OWNER} \
     LOG_LEVEL=%{log_level} \