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 WiFi/Ethernet Adapter.
27 #ifndef __CA_WIFI_ETHERNET_ADAPTER_H__
28 #define __CA_WIFI_ETHERNET_ADAPTER_H__
31 #include "caadapterinterface.h"
39 * @brief API to initialize WiFi Interface.
40 * @param registerCallback to register WIFI interfaces to things communication
41 * @param reqRespCallback for sending responses and discovery messages from unicast , multicast servers
42 * @param netCallback to intimate the network additions to things communication
45 CAResult_t CAInitializeWifi(CARegisterConnectivityCallback registerCallback,
46 CANetworkPacketReceivedCallback reqRespCallback, CANetworkChangeCallback netCallback);
49 * @brief API to Start WiFi Interface.
52 CAResult_t CAStartWIFI();
55 * @brief starting listening server
56 * Transport Specific Behaviour
57 * IP :- Start Multicast Server on all available IPs and prefixed port number and as per OIC Specification.
58 * @return Error Code CAResult_t.
60 CAResult_t CAStartWIFIListeningServer();
63 * @brief for starting discovery servers.
64 * Transport Specific Behaviour
65 * IP :- Start Multicast Server on all available IPs and prefixed port number as per OIC Specification.
67 * CA_STATUS_OK = 0 else ERROR CODES ( CAResult_t error codes in cacommon.h)
69 CAResult_t CAStartWIFIDiscoveryServer();
72 * @brief Send Multicast Data interface API callback.
73 * Note: length must be > 0
74 * @param endpoint - Endpoint information (like ipaddress , port, reference uri and connectivity type) to which the multicast data has to be sent.
75 * @param data - void pointer data which will be sent via client
76 * @param dataLen - size of data to be sent
77 * @return - Will return the number of bytes sent on the network. Return value equal to zero indicates error.
79 uint32_t CASendWIFIUnicastData(const CARemoteEndpoint_t* endpoint, void* data, uint32_t dataLen);
82 * @brief API to send data to a group of remote addresses.
83 * @param endpoint - Endpoint information (like ipaddress , port, reference uri and connectivity type) to which the multicast data has to be sent.
84 * @param data - void pointer data which will be sent via client
85 * @param dataLen - size of data to be sent
86 * @return - size of data sent or -1 on error
88 uint32_t CASendWIFIMulticastData(void* data, uint32_t dataLen);
91 * @brief Start Notification Server interface API callback.
94 * CA_STATUS_OK = 0 else ERROR CODES ( CAResult_t error codes in cacommon.h)
96 CAResult_t CAStartWIFINotifyRecvServers();
99 * @brief Send Notification Data interface API callback.
100 * Note: length must be > 0
101 * @param endpoint - remote endpoint having endpoint details
102 * @param data - data to be sent
103 * @param dataLen - length of data to be sent
104 * @return Will return the number of bytes sent on the network. Return value equal to zero indicates error.
106 uint32_t CASendWIFINotification(const CARemoteEndpoint_t* endpoint, void* data, uint32_t dataLen);
108 * @brief Get Network Information
110 * @return CAResult_t.
111 * CA_STATUS_OK = 0 else ERROR CODES ( CAResult_t error codes in cacommon.h)
113 CAResult_t CAGetWIFIInterfaceInformation(CALocalConnectivityt_t** info, uint32_t* size);
116 * @brief Read Synchronous API callback.
117 * @return Error Code CAResult_t.
118 * @return CAResult_t.
119 * CA_STATUS_OK = 0 else ERROR CODES ( CAResult_t error codes in cacommon.h)
121 CAResult_t CAReadWIFIData();
124 * @brief API to Stop WiFi Interface.
127 CAResult_t CAStopWIFI();
130 * @brief API to terminate WiFi Interface.
133 void CATerminateWifi();