1 /******************************************************************
3 * Copyright 2014 Samsung Electronics All Rights Reserved.
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
11 * http://www.apache.org/licenses/LICENSE-2.0
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.
19 ******************************************************************/
23 * @brief This file contains the APIs for LE adapters to be implemented
25 #ifndef _CA_LEADAPTER_H_
26 #define _CA_LEADAPTER_H_
29 #include "caadapterinterface.h"
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)
46 CAResult_t CAInitializeLE(CARegisterConnectivityCallback registerCallback,
47 CANetworkPacketReceivedCallback reqRespCallback, CANetworkChangeCallback netCallback);
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)
52 CAResult_t CAStartLE();
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)
60 CAResult_t CAStartLEListeningServer();
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)
68 CAResult_t CAStartLEDiscoveryServer();
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.
79 uint32_t CASendLEUnicastData(const CARemoteEndpoint_t* endpoint, void* data, uint32_t dataLen);
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.
88 uint32_t CASendLEMulticastData(void* data, uint32_t dataLen);
91 * @brief Starts notification server on EDR adapters.
92 * @return CA_STATUS_OK or ERROR CODES ( CAResult_t error codes in cacommon.h)
94 CAResult_t CAStartLENotifyServer();
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.
105 uint32_t CASendLENotification(const CARemoteEndpoint_t* endpoint, void* data, uint32_t dataLen);
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)
113 CAResult_t CAGetLEInterfaceInformation(CALocalConnectivityt_t** info, uint32_t* size);
116 * @brief Read Synchronous API callback.
117 * @return CA_STATUS_OK or ERROR CODES ( CAResult_t error codes in cacommon.h)
119 CAResult_t CAReadLEData();
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)
126 CAResult_t CAStopLE();
129 * @brief Terminate the LE connectivity adapter.
130 * Configuration information will be deleted from further use
132 void CATerminateLE();
138 #endif //#ifndef _CA_LEADAPTER_H_