1 /* *****************************************************************
\r
3 * Copyright 2015 Samsung Electronics All Rights Reserved.
\r
7 * Licensed under the Apache License, Version 2.0 (the "License");
\r
8 * you may not use this file except in compliance with the License.
\r
9 * You may obtain a copy of the License at
\r
11 * http://www.apache.org/licenses/LICENSE-2.0
\r
13 * Unless required by applicable law or agreed to in writing, software
\r
14 * distributed under the License is distributed on an "AS IS" BASIS,
\r
15 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
\r
16 * See the License for the specific language governing permissions and
\r
17 * limitations under the License.
\r
19 ******************************************************************/
\r
23 * This file contains the APIs for NFC Adapter.
\r
25 #ifndef CA_NFC_ADAPTER_H_
\r
26 #define CA_NFC_ADAPTER_H_
\r
28 #include "cacommon.h"
\r
29 #include "caadapterinterface.h"
\r
30 #include "cathreadpool.h"
\r
38 * API to initialize NFC Interface.
\r
39 * @param[in] registerCallback Callback to register NFC interfaces to Connectivity
\r
41 * @param[in] networkPacketCallback Callback to notify request and response messages from server(s)
\r
42 * started at Connectivity Abstraction Layer.
\r
43 * @param[in] netCallback Callback to notify the network additions to Connectivity
\r
44 * Abstraction Layer.
\r
45 * @param[in] errorCallback Callback to notify the network errors to Connectivity
\r
47 * @param[in] handle Threadpool Handle
\r
48 * @return ::CA_STATUS_OK, if success or Appropriate error code
\r
50 CAResult_t CAInitializeNFC(CARegisterConnectivityCallback registerCallback,
\r
51 CANetworkPacketReceivedCallback networkPacketCallback,
\r
52 CANetworkChangeCallback netCallback,
\r
53 CAErrorHandleCallback errorCallback, ca_thread_pool_t handle);
\r
56 * Start NFC Interface adapter.
\r
57 * @return ::CA_STATUS_OK, if success or Appropriate error code
\r
59 CAResult_t CAStartNFC();
\r
62 * Start listening server for receiving multicast search requests.
\r
63 * @return ::CA_STATUS_OK, if success or Appropriate error code
\r
65 CAResult_t CAStartNFCListeningServer();
\r
68 * Start listening server for receiving multicast search requests.
\r
69 * @return ::CA_STATUS_OK, if success or Appropriate error code
\r
71 CAResult_t CAStopNFCListeningServer();
\r
74 * Start discovery servers for receiving multicast advertisements.
\r
75 * @return ::CA_STATUS_OK, if success or Appropriate error code.
\r
77 CAResult_t CAStartNFCDiscoveryServer();
\r
80 * Sends data to the endpoint using the adapter connectivity.
\r
81 * @param[in] endpoint Remote Endpoint information.
\r
82 * @param[in] data data to be sent.
\r
83 * @param[in] dataLen Size of data to be sent.
\r
84 * @return number of bytes sent on the network. Return value equal to -1 indicates error.
\r
85 * @remark dataLen must be > 0.
\r
87 int32_t CASendNFCUnicastData(const CAEndpoint_t *endpoint, const void *data,
\r
91 * Send Multicast data to the endpoint using the NFC connectivity.
\r
92 * @param[in] endpoint Remote Endpoint information.
\r
93 * @param[in] data Data which is required to be sent.
\r
94 * @param[in] dataLen Size of data to be sent.
\r
95 * @return number of bytes sent on the network. Return value equal to -1 indicates error.
\r
96 * @remark dataLen must be > 0.
\r
98 int32_t CASendNFCMulticastData(const CAEndpoint_t *endpoint, const void *data, uint32_t dataLen);
\r
101 * Get NFC Connectivity network information
\r
102 * @param[out] info Local connectivity information structures.
\r
103 * @param[out] size Number of local connectivity structures.
\r
104 * @return ::CA_STATUS_OK, if success or Appropriate error code.
\r
105 * @remarks info is allocated in this API and must be freed by the caller.
\r
107 CAResult_t CAGetNFCInterfaceInformation(CAEndpoint_t **info, uint32_t *size);
\r
110 * Read Synchronous API callback.
\r
111 * @return ::CA_STATUS_OK, if success or Appropriate error code.
\r
113 CAResult_t CAReadNFCData();
\r
116 * Stops stop servers and close the sockets.
\r
117 * @return ::CA_STATUS_OK, if success or Appropriate error code.
\r
119 CAResult_t CAStopNFC();
\r
122 * Terminate the NFC connectivity adapter.
\r
123 * Configuration information will be deleted from further use
\r
125 void CATerminateNFC();
\r
131 #endif /* CA_NFC_ADAPTER_H_ */
\r