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
55 * @return ::CA_STATUS_OK or ERROR CODES (::CAResult_t error codes in cacommon.h).
\r
57 typedef CAResult_t (*CANFCPacketReceivedCallback)(const CASecureEndpoint_t *endpoint,
\r
58 const void *data, uint32_t dataLength);
\r
61 * Callback to notify error in the NFC adapter.
\r
63 * @param[in] endpoint network endpoint description.
\r
64 * @param[in] data Data sent/received.
\r
65 * @param[in] dataLength Length of data in bytes.
\r
66 * @param[in] result result of request.
\r
68 typedef void (*CANFCErrorHandleCallback)(const CAEndpoint_t *endpoint, const void *data,
\r
69 uint32_t dataLength, CAResult_t result);
\r
72 * Callback to be notified when exception occures on multicast/unicast server.
\r
73 * @param[in] type Type of server(::CAAdapterServerType_t).
\r
75 typedef void (*CANFCExceptionCallback)(CAAdapterServerType_t type);
\r
78 * Initialize Nfc server.
\r
80 * @return ::CA_STATUS_OK, if success or Appropriate error code.
\r
82 CAResult_t CAInitializeNfcServer();
\r
85 * Starts Nfc server.
\r
87 * @return ::CA_STATUS_OK, if success or Appropriate error code.
\r
89 CAResult_t CANFCStartServer();
\r
94 void CANFCStopServer();
\r
97 * Set this callback for receiving data packets from peer devices.
\r
99 * @param[in] callback Callback to be notified when data received.
\r
101 void CANFCSetPacketReceiveCallback(CANFCPacketReceivedCallback callback);
\r
104 * Set this callback for receiving exception notifications.
\r
106 * @param[in] callback Callback to be notified in case of exception.
\r
108 void CANFCSetExceptionCallback(CANFCExceptionCallback callback);
\r
111 * API to send Data.
\r
113 * @param[in] endpoint Remote End point.
\r
114 * @param[in] data Data to be send.
\r
115 * @param[in] dataLength Length of data in bytes.
\r
117 void CANFCSendData(const CAEndpoint_t *endpoint, const void *data, uint32_t dataLength);
\r
120 * Get a list of CAInterface_t items.
\r
121 * @param[in] desiredIndex Get interface information for the given index.
\r
122 * @return List of CAInterface_t items if success, NULL pointer if failed.
\r
124 u_arraylist_t *CANFCGetInterfaceInformation(int desiredIndex);
\r
127 * Set callback for error handling.
\r
129 * @param[in] nfcErrorCallback callback to notify error to the nfcadapter.
\r
131 void CANFCSetErrorHandleCallback(CANFCErrorHandleCallback nfcErrorCallback);
\r
137 #endif /* CA_NFC_INTERFACE_H_ */
\r