Modifying version number for building on tizen 3.0
[platform/upstream/iotivity.git] / resource / csdk / connectivity / inc / caleadapter.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 caleadapter.h
23  * @brief This file contains the APIs for LE adapters to be implemented
24  */
25 #ifndef _CA_LEADAPTER_H_
26 #define _CA_LEADAPTER_H_
27
28 #include "cacommon.h"
29 #include "caadapterinterface.h"
30
31 /**
32  * BLE Interface APIs.
33  */
34 #ifdef __cplusplus
35 extern "C"
36 {
37 #endif
38
39 /**
40  * @brief Initialize LE connectivity interface.
41  * @param registerCallback [IN] To register LE interfaces to Connectivity Abstraction Layer
42  * @param reqRespCallback [IN] sending responses and discovery messages from unicast , multicast servers
43  * @param netCallback [IN] Intimate the network additions to Connectivity Abstraction Layer.
44  * @return CA_STATUS_OK or ERROR CODES ( CAResult_t error codes in cacommon.h)
45  */
46 CAResult_t CAInitializeLE(CARegisterConnectivityCallback registerCallback,
47         CANetworkPacketReceivedCallback reqRespCallback, CANetworkChangeCallback netCallback);
48 /**
49  * @brief Starting LE connectivity adapters .As its peer to peer it doesnot require to start any servers
50  * @return CA_STATUS_OK or ERROR CODES ( CAResult_t error codes in cacommon.h)
51  */
52 CAResult_t CAStartLE();
53
54 /**
55  * @brief Starting listening server for receiving multicast search requests
56  * Transport Specific Behavior:
57  *   LE  Starts GATT Server with prefixed UUID and Characteristics as per OIC Specification.
58  * @return CA_STATUS_OK or ERROR CODES ( CAResult_t error codes in cacommon.h)
59  */
60 CAResult_t CAStartLEListeningServer();
61
62 /**
63  * @brief for starting discovery servers for receiving multicast advertisements
64  * Transport Specific Behavior:
65  *   LE  Starts GATT Server with prefixed UUID and Characteristics as per OIC Specification.
66  * @return CA_STATUS_OK or ERROR CODES ( CAResult_t error codes in cacommon.h)
67  */
68 CAResult_t CAStartLEDiscoveryServer();
69
70 /**
71  * @brief Sends data to the endpoint using the adapter connectivity.
72  * Note: length must be > 0.
73  * @param   endpoint    [IN]    Remote Endpoint information (like ipaddress , port, reference uri and connectivity type) to
74  *                              which the unicast data has to be sent.
75  * @param   data        [IN]    Data which required to be sent.
76  * @param   dataLen     [IN]    Size of data to be sent.
77  * @return - The number of bytes sent on the network. Return value equal to zero indicates error.
78  */
79 uint32_t CASendLEUnicastData(const CARemoteEndpoint_t* endpoint, void* data, uint32_t dataLen);
80
81 /**
82  * @brief Sends Multicast data to the endpoint using the LE connectivity.
83  * Note: length must be > 0.
84  * @param   data        [IN]    Data which required to be sent.
85  * @param   dataLen     [IN]    Size of data to be sent.
86  * @return - The number of bytes sent on the network. Return value equal to zero indicates error.
87  */
88 uint32_t CASendLEMulticastData(void* data, uint32_t dataLen);
89
90 /**
91  * @brief Starts notification server on EDR adapters.
92  * @return CA_STATUS_OK or ERROR CODES ( CAResult_t error codes in cacommon.h)
93  */
94 CAResult_t CAStartLENotifyServer();
95
96 /**
97  * @brief Send notification information.
98  * Note: length must be > 0.
99  * @param   endpoint    [IN]    Remote Endpoint information (like ipaddress , port, reference uri and connectivity type) to
100  *                              which the unicast data has to be sent.
101  * @param   data        [IN]    Data which required to be sent.
102  * @param   dataLen     [IN]    Size of data to be sent.
103  * @return - The number of bytes sent on the network. Return value equal to zero indicates error.
104  */
105 uint32_t CASendLENotification(const CARemoteEndpoint_t* endpoint, void* data, uint32_t dataLen);
106
107 /**
108  * @brief Get LE Connectivity network information
109  * @param   info        [OUT]   Local connectivity information structures
110  * @param   size        [OUT]   Number of local connectivity structures.
111  * @return CA_STATUS_OK or ERROR CODES ( CAResult_t error codes in cacommon.h)
112  */
113 CAResult_t CAGetLEInterfaceInformation(CALocalConnectivityt_t** info, uint32_t* size);
114
115 /**
116  * @brief Read Synchronous API callback.
117  * @return CA_STATUS_OK or ERROR CODES ( CAResult_t error codes in cacommon.h)
118  */
119 CAResult_t CAReadLEData();
120
121 /**
122  * @brief Stopping the adapters and close socket connections
123  *   LE Stops all GATT servers and close sockets.
124  * @return CA_STATUS_OK or ERROR CODES ( CAResult_t error codes in cacommon.h)
125  */
126 CAResult_t CAStopLE();
127
128 /**
129  * @brief Terminate the LE connectivity adapter.
130  * Configuration information will be deleted from further use
131  */
132 void CATerminateLE();
133
134 #ifdef __cplusplus
135 } /* extern "C" */
136 #endif
137
138 #endif //#ifndef _CA_LEADAPTER_H_