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 ******************************************************************/
24 * This file contains the APIs for LE adapters to be implemented.
27 #ifndef _CA_LEADAPTER_H_
28 #define _CA_LEADAPTER_H_
31 #include "caadapterinterface.h"
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)
48 CAResult_t CAInitializeLE(CARegisterConnectivityCallback registerCallback,
49 CANetworkPacketReceivedCallback reqRespCallback, CANetworkChangeCallback netCallback);
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)
54 CAResult_t CAStartLE();
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)
62 CAResult_t CAStartLEListeningServer();
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)
70 CAResult_t CAStartLEDiscoveryServer();
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.
81 uint32_t CASendLEUnicastData(const CARemoteEndpoint_t* endpoint, void* data, uint32_t dataLen);
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.
90 uint32_t CASendLEMulticastData(void* data, uint32_t dataLen);
93 * @brief Starts notification server on EDR adapters.
94 * @return CA_STATUS_OK or ERROR CODES ( CAResult_t error codes in cacommon.h)
96 CAResult_t CAStartLENotifyServer();
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.
107 uint32_t CASendLENotification(const CARemoteEndpoint_t* endpoint, void* data, uint32_t dataLen);
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)
115 CAResult_t CAGetLEInterfaceInformation(CALocalConnectivityt_t** info, uint32_t* size);
118 * @brief Read Synchronous API callback.
119 * @return CA_STATUS_OK or ERROR CODES ( CAResult_t error codes in cacommon.h)
121 CAResult_t CAReadLEData();
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)
128 CAResult_t CAStopLE();
131 * @brief Terminate the LE connectivity adapter.
132 * Configuration information will be deleted from further use
134 void CATerminateLE();
140 #endif //#ifndef _CA_LEADAPTER_H_