replace : iotivity -> iotivity-sec
[platform/upstream/iotivity.git] / resource / csdk / connectivity / src / bt_le_adapter / tizen / caleserver.h
index 0d934b0..f310885 100644 (file)
 #ifndef TZ_BLE_SERVER_H_
 #define TZ_BLE_SERVER_H_
 
+#include <bluetooth.h>
+#include <bluetooth_type.h>
+#include <bluetooth_internal.h>
+#ifdef BLE_MCD
+#include <bluetooth_product.h>
+#endif
 #include "caadapterinterface.h"
 #include "logger.h"
 #include "cathreadpool.h"
 #include "caleinterface.h"
 
+#if defined(__TIZEN__) && defined(LE_ADAPTER) && defined(BLE_CUSTOM_ADVERTISE)
 /**
- * This is thread which will be used for creating ble service and advertise ble service.
- * 1. Create New OIC Service 2. Add read & write characteristics to service.
- * 3. Register Service       4. Advertise service.
- *
- * @param[in] data  Currently it will be NULL.
+ * Used to Start Server advertise send data
+ */
+CAResult_t CAsetServerAdvertisementData(const char *data, int length);
+
+
+/**
+ * Used to Start Server  send  response data
  */
-void CAStartLEGattServerThread(void *data);
+CAResult_t CAsetServerSanResponseData(const char *data, int length);
+#endif
 
 /**
  * Used to initialize gatt server.
@@ -83,7 +93,17 @@ CAResult_t CAInitGattServerMutexVariables();
  * @retval  ::CA_STATUS_INVALID_PARAM  Invalid input arguments.
  * @retval  ::CA_STATUS_FAILED Operation failed.
  */
-CAResult_t CALEStartAdvertise(const char *serviceUUID);
+CAResult_t CALEStartAdvertise();
+
+/**
+ * Used to start advertising with service UUID.
+ *
+ * @return  ::CA_STATUS_OK or Appropriate error code.
+ * @retval  ::CA_STATUS_OK  Successful.
+ * @retval  ::CA_STATUS_INVALID_PARAM  Invalid input arguments.
+ * @retval  ::CA_STATUS_FAILED Operation failed.
+ */
+CAResult_t CALEStartAdvertiseImpl(const char *serviceUUID);
 
 /**
  * Used to stop advertising.
@@ -150,18 +170,16 @@ CAResult_t CAAddNewCharacteristicsToGattServer(const bt_gatt_h svcPath, const ch
  * @param[in] len            The length of @a value
  * @param[in] user_data      The user data passed from the registration function
  */
+#ifdef BLE_TIZEN_30
+void CALEGattRemoteCharacteristicWriteCb(const char *remoteAddress, int request_id,
+                                         bt_gatt_server_h server, bt_gatt_h gatt_handle,
+                                         bool response_needed, int offset, const char *charValue,
+                                         int charLen, void *userData);
+#else
 void CALEGattRemoteCharacteristicWriteCb(char *remoteAddress, bt_gatt_server_h server,
-                                         bt_gatt_h charPath, int offset, char *charValue,
-                                         int charValueLen, void *userData);
-
-/**
- * This is the callback which will be called whenever there is change in gatt connection
- * with Client(Connected/Disconnected).
- *
- * @param[in]  connected      State of connection.
- * @param[in]  remoteAddress  Mac address of the remote device in which we made connection.
- */
-void CALEGattServerConnectionStateChanged(bool connected, const char *remoteAddress);
+                                         bt_gatt_h gatt_handle, int offset, char *charValue,
+                                         int charLen, void *userData);
+#endif
 
 /**
  * Setting the connection state changed callback.
@@ -169,5 +187,19 @@ void CALEGattServerConnectionStateChanged(bool connected, const char *remoteAddr
  */
 void CASetLEConnectionStateChangedCallback(CALEConnectionStateChangedCallback connStateCb);
 
+/**
+ * check connection status.
+ * @param[in] address      the address of the remote device.
+ * @return  true or false.
+ */
+bool CALEServerIsConnected(const char* address);
+
+/**
+ * get MTU size.
+ * @param[in] address      the address of the remote device.
+ * @return  mtu size negotiated from remote device.
+ */
+uint16_t CALEServerGetMtuSize(const char* address);
+
 #endif /* TZ_BLE_SERVER_H_ */