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 ******************************************************************/
21 * @file cainterfacecontroller_singlethread.h
22 * @brief This file contains the APIs for the interface controller
25 #ifndef __CA_INTERFACE_CONTROLLER_SINGLETHREAD_H_
26 #define __CA_INTERFACE_CONTROLLER_SINGLETHREAD_H_
28 #include "caadapterinterface.h"
37 * @brief Initializes different adapters based on the compilation flags.
38 * @param handle [IN] thread pool handle created by message handler for different adapters.
41 void CAInitializeAdapters();
44 * @brief Set the received packets callback for message handler
45 * @param callback [IN] message handler callback to receive packets from different adapters.
48 void CASetPacketReceivedCallback(CANetworkPacketReceivedCallback callback);
51 * @brief Set the network status changed callback for message handler
52 * @param callback [IN] message handler network status callback to receive network changes.
55 void CASetNetworkChangeCallback(CANetworkChangeCallback callback);
58 * @brief Starting different connectivity adapters based on the network selection.
59 * @param connectivity [IN] interested network for starting
62 void CAStartAdapter(CAConnectivityType_t connectivity);
65 * @brief Stopping different connectivity adapters based on the network un-selection.
66 * @param callback [IN] un selected network for stopping the packets transfer
69 void CAStopAdapter(CAConnectivityType_t connectivity);
72 * @brief Get network information such as ipaddress and mac information
73 * @param info [OUT] connectivity information such as ipaddress and mac information
74 * @param size [OUT] number of connectivity information structures
75 * @return CA_STATUS_OK or ERROR CODES ( CAResult_t error codes in cacommon.h)
77 CAResult_t CAGetNetworkInfo(CALocalConnectivity_t **info, uint32_t *size);
80 * @brief Sends unicast data to the remote endpoint
81 * @param endpoint [IN] endpoint information where the data has to be sent
82 * @param data [IN] data that needs to be sent
83 * @param length [IN] length of the data that needs to be sent
84 * @return CA_STATUS_OK or ERROR CODES ( CAResult_t error codes in cacommon.h)
86 CAResult_t CASendUnicastData(const CARemoteEndpoint_t *endpoint, void *data, uint32_t length);
89 * @brief Sends multicast data to all endpoints in the network.
90 * @param data [IN] data that needs to be sent
91 * @param length [IN] length of the data that needs to be sent
92 * @return CA_STATUS_OK or ERROR CODES ( CAResult_t error codes in cacommon.h)
94 CAResult_t CASendMulticastData(void *data, uint32_t length);
97 * @brief Start listening servers to receive search requests from clients
98 * @return CA_STATUS_OK or ERROR CODES ( CAResult_t error codes in cacommon.h)
100 CAResult_t CAStartListeningServerAdapters();
103 * @brief Start discovery servers to receive advertisements from server
104 * @return CA_STATUS_OK or ERROR CODES ( CAResult_t error codes in cacommon.h)
106 CAResult_t CAStartDiscoveryServerAdapters();
109 * @brief Terminates the adapters which are initialized during the initialization
112 void CATerminateAdapters();
115 * @brief Checks for available data and reads it
116 * @return CA_STATUS_OK or ERROR CODES ( CAResult_t error codes in cacommon.h)
118 CAResult_t CAReadData();
124 #endif //#ifndef __CA_INTERFACE_CONTROLLER_H_