replace : iotivity -> iotivity-sec
[platform/upstream/iotivity.git] / resource / csdk / connectivity / inc / canfcinterface.h
1 /* *****************************************************************\r
2  *\r
3  * Copyright 2015 Samsung Electronics All Rights Reserved.\r
4  *\r
5  *\r
6  *\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
10  *\r
11  *      http://www.apache.org/licenses/LICENSE-2.0\r
12  *\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
18  *\r
19  ******************************************************************/\r
20 \r
21 /**\r
22  * @file\r
23  * This file provides APIs NFC client/server/network monitor modules.\r
24  */\r
25 \r
26 #ifndef CA_NFC_INTERFACE_H_\r
27 #define CA_NFC_INTERFACE_H_\r
28 \r
29 #include <stdbool.h>\r
30 \r
31 #include "cacommon.h"\r
32 #include "cathreadpool.h"\r
33 #include "uarraylist.h"\r
34 \r
35 #ifdef __cplusplus\r
36 extern "C"\r
37 {\r
38 #endif\r
39 \r
40 /**\r
41  * CAAdapterServerType_t.\r
42  * Enum for defining different server types.\r
43  */\r
44 typedef enum\r
45 {\r
46     CA_NFC_SERVER = 0, /**< Listening Server */\r
47 } CAAdapterServerType_t;\r
48 \r
49 /**\r
50  * Callback to be notified on reception of any data from remote OIC devices.\r
51  *\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
56  */\r
57 typedef CAResult_t (*CANFCPacketReceivedCallback)(const CASecureEndpoint_t *endpoint,\r
58                                                   const void *data, uint32_t dataLength);\r
59 \r
60 /**\r
61   * Callback to notify error in the NFC adapter.\r
62   *\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
67   */\r
68 typedef void (*CANFCErrorHandleCallback)(const CAEndpoint_t *endpoint, const void *data,\r
69                                          uint32_t dataLength, CAResult_t result);\r
70 \r
71 /**\r
72  * Callback to be notified when exception occures on multicast/unicast server.\r
73  * @param[in]  type    Type of server(::CAAdapterServerType_t).\r
74  */\r
75 typedef void (*CANFCExceptionCallback)(CAAdapterServerType_t type);\r
76 \r
77 /**\r
78  * Initialize Nfc server.\r
79  *\r
80  * @return  ::CA_STATUS_OK, if success or Appropriate error code.\r
81  */\r
82 CAResult_t CAInitializeNfcServer();\r
83 \r
84 /**\r
85  * Starts Nfc server.\r
86  *\r
87  * @return  ::CA_STATUS_OK, if success or Appropriate error code.\r
88  */\r
89 CAResult_t CANFCStartServer();\r
90 \r
91 /**\r
92  * Stop Nfc server.\r
93  */\r
94 void CANFCStopServer();\r
95 \r
96 /**\r
97  * Set this callback for receiving data packets from peer devices.\r
98  *\r
99  * @param[in]  callback   Callback to be notified when data received.\r
100  */\r
101 void CANFCSetPacketReceiveCallback(CANFCPacketReceivedCallback callback);\r
102 \r
103 /**\r
104  * Set this callback for receiving exception notifications.\r
105  *\r
106  * @param[in]  callback    Callback to be notified in case of exception.\r
107  */\r
108 void CANFCSetExceptionCallback(CANFCExceptionCallback callback);\r
109 \r
110 /**\r
111  * API to send Data.\r
112  *\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
116  */\r
117 void CANFCSendData(const CAEndpoint_t *endpoint, const void *data, uint32_t dataLength);\r
118 \r
119 /**\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
123  */\r
124 u_arraylist_t *CANFCGetInterfaceInformation(int desiredIndex);\r
125 \r
126 /**\r
127  * Set callback for error handling.\r
128  *\r
129  * @param[in] nfcErrorCallback    callback to notify error to the nfcadapter.\r
130  */\r
131 void CANFCSetErrorHandleCallback(CANFCErrorHandleCallback nfcErrorCallback);\r
132 \r
133 #ifdef __cplusplus\r
134 }\r
135 #endif\r
136 \r
137 #endif /* CA_NFC_INTERFACE_H_ */\r