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