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 cawifiethernetadapter.h
23 * @brief This file contains the APIs for WiFi/Ethernet Adapter.
25 #ifndef __CA_WIFI_ETHERNET_ADAPTER_H__
26 #define __CA_WIFI_ETHERNET_ADAPTER_H__
29 #include "caadapterinterface.h"
37 * @brief API to initialize WiFi Interface.
38 * @param registerCallback to register WIFI interfaces to things communication
39 * @param reqRespCallback for sending responses and discovery messages from unicast , multicast servers
40 * @param netCallback to intimate the network additions to things communication
43 CAResult_t CAInitializeWifi(CARegisterConnectivityCallback registerCallback,
44 CANetworkPacketReceivedCallback reqRespCallback, CANetworkChangeCallback netCallback);
47 * @brief API to Start WiFi Interface.
50 CAResult_t CAStartWIFI();
53 * @brief starting listening server
54 * Transport Specific Behaviour
55 * IP :- Start Multicast Server on all available IPs and prefixed port number and as per OIC Specification.
56 * @return Error Code CAResult_t.
58 CAResult_t CAStartWIFIListeningServer();
61 * @brief for starting discovery servers.
62 * Transport Specific Behaviour
63 * IP :- Start Multicast Server on all available IPs and prefixed port number as per OIC Specification.
65 * CA_STATUS_OK = 0 else ERROR CODES ( CAResult_t error codes in cacommon.h)
67 CAResult_t CAStartWIFIDiscoveryServer();
70 * @brief Send Multicast Data interface API callback.
71 * Note: length must be > 0
72 * @param endpoint - Endpoint information (like ipaddress , port, reference uri and connectivity type) to which the multicast data has to be sent.
73 * @param data - void pointer data which will be sent via client
74 * @param dataLen - size of data to be sent
75 * @return - Will 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 API to send data to a group of remote addresses.
81 * @param endpoint - Endpoint information (like ipaddress , port, reference uri and connectivity type) to which the multicast data has to be sent.
82 * @param data - void pointer data which will be sent via client
83 * @param dataLen - size of data to be sent
84 * @return - size of data sent or -1 on error
86 uint32_t CASendWIFIMulticastData(void* data, uint32_t dataLen);
89 * @brief Start Notification Server interface API callback.
92 * CA_STATUS_OK = 0 else ERROR CODES ( CAResult_t error codes in cacommon.h)
94 CAResult_t CAStartWIFINotifyRecvServers();
97 * @brief Send Notification Data interface API callback.
98 * Note: length must be > 0
99 * @param endpoint - remote endpoint having endpoint details
100 * @param data - data to be sent
101 * @param dataLen - length of data to be sent
102 * @return Will return the number of bytes sent on the network. Return value equal to zero indicates error.
104 uint32_t CASendWIFINotification(const CARemoteEndpoint_t* endpoint, void* data, uint32_t dataLen);
106 * @brief Get Network Information
108 * @return CAResult_t.
109 * CA_STATUS_OK = 0 else ERROR CODES ( CAResult_t error codes in cacommon.h)
111 CAResult_t CAGetWIFIInterfaceInformation(CALocalConnectivityt_t** info, uint32_t* size);
114 * @brief Read Synchronous API callback.
115 * @return Error Code CAResult_t.
116 * @return CAResult_t.
117 * CA_STATUS_OK = 0 else ERROR CODES ( CAResult_t error codes in cacommon.h)
119 CAResult_t CAReadWIFIData();
122 * @brief API to Stop WiFi Interface.
125 CAResult_t CAStopWIFI();
128 * @brief API to terminate WiFi Interface.
131 void CATerminateWifi();