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 provides APIs NFC client/server/network monitor modules.
\r
26 #ifndef CA_NFC_INTERFACE_H_
\r
27 #define CA_NFC_INTERFACE_H_
\r
29 #include <stdbool.h>
\r
31 #include "cacommon.h"
\r
32 #include "cathreadpool.h"
\r
33 #include "uarraylist.h"
\r
41 * CAAdapterServerType_t.
\r
42 * Enum for defining different server types.
\r
46 CA_NFC_SERVER = 0, /**< Listening Server */
\r
47 } CAAdapterServerType_t;
\r
50 * Callback to be notified on reception of any data from remote OIC devices.
\r
52 * @param[in] endpoint network endpoint description
\r
53 * @param[in] data Data received from remote OIC device.
\r
54 * @param[in] dataLength Length of data in bytes.
\r
56 typedef void (*CANFCPacketReceivedCallback)(const CASecureEndpoint_t *endpoint, const void *data,
\r
57 uint32_t dataLength);
\r
60 * Callback to notify error in the NFC adapter.
\r
62 * @param[in] endpoint network endpoint description.
\r
63 * @param[in] data Data sent/received.
\r
64 * @param[in] dataLength Length of data in bytes.
\r
65 * @param[in] result result of request.
\r
67 typedef void (*CANFCErrorHandleCallback)(const CAEndpoint_t *endpoint, const void *data,
\r
68 uint32_t dataLength, CAResult_t result);
\r
71 * Callback to be notified when exception occures on multicast/unicast server.
\r
72 * @param[in] type Type of server(::CAAdapterServerType_t).
\r
74 typedef void (*CANFCExceptionCallback)(CAAdapterServerType_t type);
\r
77 * Initialize Nfc server.
\r
79 * @return ::CA_STATUS_OK, if success or Appropriate error code.
\r
81 CAResult_t CAInitializeNfcServer();
\r
84 * Starts Nfc server.
\r
86 * @return ::CA_STATUS_OK, if success or Appropriate error code.
\r
88 CAResult_t CANFCStartServer();
\r
93 void CANFCStopServer();
\r
96 * Set this callback for receiving data packets from peer devices.
\r
98 * @param[in] callback Callback to be notified when data received.
\r
100 void CANFCSetPacketReceiveCallback(CANFCPacketReceivedCallback callback);
\r
103 * Set this callback for receiving exception notifications.
\r
105 * @param[in] callback Callback to be notified in case of exception.
\r
107 void CANFCSetExceptionCallback(CANFCExceptionCallback callback);
\r
110 * API to send Data.
\r
112 * @param[in] endpoint Remote End point.
\r
113 * @param[in] data Data to be send.
\r
114 * @param[in] dataLength Length of data in bytes.
\r
116 void CANFCSendData(const CAEndpoint_t *endpoint, const void *data, uint32_t dataLength);
\r
119 * Get a list of CAInterface_t items.
\r
120 * @param[in] desiredIndex Get interface information for the given index.
\r
121 * @return List of CAInterface_t items if success, NULL pointer if failed.
\r
123 u_arraylist_t *CANFCGetInterfaceInformation(int desiredIndex);
\r
126 * Set callback for error handling.
\r
128 * @param[in] nfcErrorCallback callback to notify error to the nfcadapter.
\r
130 void CANFCSetErrorHandleCallback(CANFCErrorHandleCallback nfcErrorCallback);
\r
136 #endif /* CA_NFC_INTERFACE_H_ */
\r