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 Adapter.
27 #ifndef __CA_WIFI_ADAPTER_SINGLETHREAD_H__
28 #define __CA_WIFI_ADAPTER_SINGLETHREAD_H__
31 #include "caadapterinterface.h"
39 * @brief Initialize WIFI Interface.
40 * @param registerCallback [IN] Callback to register WIFI interfaces to Connectivity
42 * @param networkPacketCallback [IN] Callback to notify request and response messages from server(s)
43 * started at Connectivity Abstraction Layer.
44 * @param netCallback [IN] Callback to notify the network additions to Connectivity
46 * @return #CA_STATUS_OK or Appropriate error code
48 CAResult_t CAInitializeWIFI(CARegisterConnectivityCallback registerCallback,
49 CANetworkPacketReceivedCallback networkPacketCallback,
50 CANetworkChangeCallback netCallback);
53 * @brief Start WIFI Interface adapter.
54 * @return #CA_STATUS_OK or Appropriate error code
56 CAResult_t CAStartWIFI();
59 * @brief Starting listening server for receiving multicast search requests
60 * Transport Specific Behavior:
61 * WIFI Starts Multicast Server on all available IPs and prefixed port number and
62 * as per OIC Specification.
63 * @return #CA_STATUS_OK or Appropriate error code
65 CAResult_t CAStartWIFIListeningServer();
68 * @brief Start WIFI Discovery Server for receiving multicast advertisements
69 * Transport Specific Behavior:
70 * WIFI Starts Start multicast server on all available IPs and prefixed port
71 * number as per OIC Specification
72 * @return #CA_STATUS_OK or Appropriate error code
74 CAResult_t CAStartWIFIDiscoveryServer();
77 * @brief Sends data to the endpoint using the adapter connectivity.
78 * @param endpoint [IN] Remote Endpoint information (like ipaddress, port, reference uri and
79 * connectivity type) to which the unicast data has to be sent.
80 * @param data [IN] Data to be sent.
81 * @param dataLen [IN] Size of data to be sent.
82 * @return The number of bytes sent on the network. Returns -1 on error.
83 * @remarks dataLen must be > 0.
85 int32_t CASendWIFIUnicastData(const CARemoteEndpoint_t *endpoint, const void *data,
89 * @brief Sends Multicast data to the endpoint using the WIFI connectivity.
90 * @param data [IN] Data which required to be sent.
91 * @param dataLen [IN] Size of data to be sent.
92 * @return - The number of bytes sent on the network. Returns -1 on error.
93 * @remarks dataLen must be > 0.
95 int32_t CASendWIFIMulticastData(const void *data, uint32_t dataLen);
98 * @brief Get WIFI Connectivity network information
99 * @param info [OUT] Local connectivity information structures
100 * @param size [OUT] Number of local connectivity structures.
101 * @return #CA_STATUS_OK or Appropriate error code
102 * @remarks info is allocated in this API and should be freed by the caller.
104 CAResult_t CAGetWIFIInterfaceInformation(CALocalConnectivity_t **info, uint32_t *size);
107 * @brief Read Synchronous API callback.
108 * @return #CA_STATUS_OK or Appropriate error code
110 CAResult_t CAReadWIFIData();
113 * @brief WIFI Stops Unicast, Multicast servers and close the sockets.
114 * @return #CA_STATUS_OK or Appropriate error code
116 CAResult_t CAStopWIFI();
119 * @brief Terminate the WIFI connectivity adapter.
120 * Configuration information will be deleted from further use
123 void CATerminateWIFI();
129 #endif // #ifndef __CA_WIFI_ADAPTER_SINGLETHREAD_H__