Imported Upstream version 0.9.1
[platform/upstream/iotivity.git] / resource / csdk / connectivity / src / bt_le_adapter / arduino / cableserver.h
1 /* ****************************************************************
2 *
3 * Copyright 2014 Samsung Electronics All Rights Reserved.
4 *
5 *
6 *
7 * Licensed under the Apache License, Version 2.0 (the "License");
8 * you may not use this file except in compliance with the License.
9 * You may obtain a copy of the License at
10 *
11 *      http://www.apache.org/licenses/LICENSE-2.0
12 *
13 * Unless required by applicable law or agreed to in writing, software
14 * distributed under the License is distributed on an "AS IS" BASIS,
15 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 * See the License for the specific language governing permissions and
17 * limitations under the License.
18 *
19 ******************************************************************/
20
21 /**
22  * @file
23  *
24  * This file contains the APIs related to the GATT Server functionalities.
25  * Creation of the GATT Server with the characteristics. Enabling the
26  * advertisement and updating the characteristics for the response and
27  * notifying the change of characteristcs for the request will be done here.
28  */
29
30 #ifndef BLE_ADAPTER_ARDUINO_H_
31 #define BLE_ADAPTER_ARDUINO_H_
32
33 #include "cacommon.h"
34 #include "caadapterinterface.h"
35
36 #ifdef __cplusplus
37 extern "C"
38 {
39 #endif
40
41 /**
42  * @brief API to initialize Arduino BLE module and advertise the service
43  * @return #CA_STATUS_OK or Appropriate error code
44  */
45 CAResult_t CAInitializeBle();
46
47 /**
48  * @brief API to Terminate Arduino BLE module and advertise the service
49  * @return #CA_STATUS_OK or Appropriate error code
50  */
51 CAResult_t CATerminateBle();
52
53 /**
54  * @brief Send the received data to Connectivity Abstraction layer.
55  * @param data       [IN] Data received from BLE characteristics
56  * @param dataLen    [IN] Received data Length
57  * @param senderAdrs [IN] Sender Address.
58  * @param senderPort [IN] Sender port
59  * @return #CA_STATUS_OK or Appropriate error code
60  */
61 void CANotifyCallback(const void *data, int32_t dataLen, const char *senderAdrs,
62                       int32_t senderPort);
63
64 /**
65  * @brief API to check whether data is available in BLE shield
66  * @return - Received buffer length
67  */
68 unsigned char CAIsBleDataAvailable();
69
70 /**
71  * @brief API to check whether client is connected with BLE Shield
72  * @return - Connection state
73  */
74 unsigned char CAIsBleConnected();
75
76 /**
77  * @brief API to read data from BLE shield
78  * @return - Data read
79  */
80 char CAReadBleData();
81
82 /**
83  * @brief API to perform BLE events
84  * @return #CA_STATUS_OK or Appropriate error code
85  */
86 CAResult_t CABleDoEvents();
87
88 #ifdef __cplusplus
89 } /* extern "C" */
90 #endif
91
92 #endif /* BLE_ADAPTER_ARDUINO_H_ */
93