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 ******************************************************************/
22 * @file cawifiadapter.h
23 * @brief This file contains the APIs for WiFi Adapter.
25 #ifndef __CA_WIFI_ADAPTER_H__
26 #define __CA_WIFI_ADAPTER_H__
29 #include "caadapterinterface.h"
37 * @brief API to initialize WiFi Interface.
38 * @param registerCallback [IN] To register WIFI interfaces to Connectivity Abstraction Layer
39 * @param reqRespCallback [IN] sending responses and discovery messages from unicast , multicast servers
40 * @param netCallback [IN] Intimate the network additions to Connectivity Abstraction Layer.
41 * @return CA_STATUS_OK or ERROR CODES ( CAResult_t error codes in cacommon.h)
43 CAResult_t CAInitializeWifi(CARegisterConnectivityCallback registerCallback,
44 CANetworkPacketReceivedCallback reqRespCallback, CANetworkChangeCallback netCallback);
47 * @brief Start WiFi Interface adapter.
48 * @return CA_STATUS_OK or ERROR CODES ( CAResult_t error codes in cacommon.h)
50 CAResult_t CAStartWIFI();
53 * @brief Starting listening server for receiving multicast search requests
54 * Transport Specific Behavior:
55 * WIFI Starts Multicast Server on all available IPs and prefixed port number and as per OIC Specification.
56 * @return CA_STATUS_OK or ERROR CODES ( CAResult_t error codes in cacommon.h)
58 CAResult_t CAStartWIFIListeningServer();
61 * @brief for starting discovery servers for receiving multicast advertisements
62 * Transport Specific Behavior:
63 * WIFI Starts Start multicast server on all available IPs and prefixed port number as per OIC Specification
64 * @return CA_STATUS_OK or ERROR CODES ( CAResult_t error codes in cacommon.h)
66 CAResult_t CAStartWIFIDiscoveryServer();
69 * @brief Sends data to the endpoint using the adapter connectivity.
70 * Note: length must be > 0.
71 * @param endpoint [IN] Remote Endpoint information (like ipaddress , port, reference uri and connectivity type) to
72 * which the unicast data has to be sent.
73 * @param data [IN] Data which required to be sent.
74 * @param dataLen [IN] Size of data to be sent.
75 * @return - The number of bytes sent on the network. Return value equal to zero indicates error.
77 uint32_t CASendWIFIUnicastData(const CARemoteEndpoint_t* endpoint, void* data, uint32_t dataLen);
80 * @brief Sends Multicast data to the endpoint using the WIFI connectivity.
81 * Note: length must be > 0.
82 * @param data [IN] Data which required to be sent.
83 * @param dataLen [IN] Size of data to be sent.
84 * @return - The number of bytes sent on the network. Return value equal to zero indicates error.
86 uint32_t CASendWIFIMulticastData(void* data, uint32_t dataLen);
89 * @brief Starts notification server on WIFI adapters.
90 * @return CA_STATUS_OK or ERROR CODES ( CAResult_t error codes in cacommon.h)
92 CAResult_t CAStartWIFINotifyRecvServers();
95 * @brief Send notification information.
96 * Note: length must be > 0.
97 * @param endpoint [IN] Remote Endpoint information (like ipaddress , port, reference uri and connectivity type) to
98 * which the unicast data has to be sent.
99 * @param data [IN] Data which required to be sent.
100 * @param dataLen [IN] Size of data to be sent.
101 * @return - The number of bytes sent on the network. Return value equal to zero indicates error.
103 uint32_t CASendWIFINotification(const CARemoteEndpoint_t* endpoint, void* data, uint32_t dataLen);
105 * @brief Get WIFI Connectivity network information
106 * @param info [OUT] Local connectivity information structures
107 * @param size [OUT] Number of local connectivity structures.
108 * @return CA_STATUS_OK or ERROR CODES ( CAResult_t error codes in cacommon.h)
110 CAResult_t CAGetWIFIInterfaceInformation(CALocalConnectivityt_t** info, uint32_t* size);
113 * @brief Read Synchronous API callback.
114 * @return CA_STATUS_OK or ERROR CODES ( CAResult_t error codes in cacommon.h)
116 CAResult_t CAReadWIFIData();
119 * @brief Stopping the adapters and close socket connections
120 * WIFI Stops all multicast and unicast servers and close sockets.
121 * @return CA_STATUS_OK or ERROR CODES ( CAResult_t error codes in cacommon.h)
123 CAResult_t CAStopWIFI();
126 * @brief Terminate the WIFI connectivity adapter.
127 * Configuration information will be deleted from further use
129 void CATerminateWIfI();
135 #endif//#ifndef __CA_WIFI_ADAPTER_H__