nxpandroid | c761165 | 2015-09-23 16:42:05 +0530 | [diff] [blame] | 1 | /****************************************************************************** |
| 2 | * |
| 3 | * Copyright (C) 2010-2014 Broadcom Corporation |
| 4 | * |
| 5 | * Licensed under the Apache License, Version 2.0 (the "License"); |
| 6 | * you may not use this file except in compliance with the License. |
| 7 | * You may obtain a copy of the License at: |
| 8 | * |
| 9 | * http://www.apache.org/licenses/LICENSE-2.0 |
| 10 | * |
| 11 | * Unless required by applicable law or agreed to in writing, software |
| 12 | * distributed under the License is distributed on an "AS IS" BASIS, |
| 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 14 | * See the License for the specific language governing permissions and |
| 15 | * limitations under the License. |
| 16 | * |
| 17 | ******************************************************************************/ |
| 18 | |
nxpandroid | c761165 | 2015-09-23 16:42:05 +0530 | [diff] [blame] | 19 | /****************************************************************************** |
| 20 | * |
| 21 | * This is the public interface file for NFA P2P, Broadcom's NFC |
| 22 | * application layer for mobile phones. |
| 23 | * |
| 24 | ******************************************************************************/ |
| 25 | #ifndef NFA_P2P_API_H |
| 26 | #define NFA_P2P_API_H |
| 27 | |
| 28 | #include "llcp_api.h" |
| 29 | #include "nfa_api.h" |
| 30 | |
| 31 | /***************************************************************************** |
| 32 | ** Constants and data types |
| 33 | *****************************************************************************/ |
| 34 | |
| 35 | /* NFA P2P Reason of disconnection */ |
nxpandroid | 8f6d053 | 2017-07-12 18:25:30 +0530 | [diff] [blame] | 36 | #define NFA_P2P_DISC_REASON_REMOTE_INITIATE \ |
| 37 | 0x00 /* remote initiated to disconnect */ |
| 38 | #define NFA_P2P_DISC_REASON_LOCAL_INITITATE \ |
| 39 | 0x01 /* local initiated to disconnect */ |
| 40 | #define NFA_P2P_DISC_REASON_NO_SERVICE \ |
| 41 | 0x02 /* no service bound in remote */ |
| 42 | #define NFA_P2P_DISC_REASON_REMOTE_REJECT \ |
| 43 | 0x03 /* remote rejected connection */ |
nxpandroid | 8f6d053 | 2017-07-12 18:25:30 +0530 | [diff] [blame] | 44 | #define NFA_P2P_DISC_REASON_LLCP_DEACTIVATED \ |
| 45 | 0x05 /* LLCP link deactivated */ |
nxpandroid | 8f6d053 | 2017-07-12 18:25:30 +0530 | [diff] [blame] | 46 | #define NFA_P2P_DISC_REASON_NO_INFORMATION \ |
| 47 | 0x80 /* Without information */ |
nxpandroid | c761165 | 2015-09-23 16:42:05 +0530 | [diff] [blame] | 48 | |
| 49 | /* NFA P2P callback events */ |
nxpandroid | 8f6d053 | 2017-07-12 18:25:30 +0530 | [diff] [blame] | 50 | /* Server is registered */ |
| 51 | #define NFA_P2P_REG_SERVER_EVT 0x00 |
| 52 | /* Client is registered */ |
| 53 | #define NFA_P2P_REG_CLIENT_EVT 0x01 |
| 54 | /* LLCP Link has been activated */ |
| 55 | #define NFA_P2P_ACTIVATED_EVT 0x02 |
| 56 | #define NFA_P2P_DEACTIVATED_EVT \ |
| 57 | 0x03 /* LLCP Link has been deactivated */ |
| 58 | /* Data link connection request from peer */ |
| 59 | #define NFA_P2P_CONN_REQ_EVT 0x04 |
| 60 | /* Data link connection has been established */ |
| 61 | #define NFA_P2P_CONNECTED_EVT 0x05 |
| 62 | /* Data link connection has been disconnected */ |
| 63 | #define NFA_P2P_DISC_EVT 0x06 |
| 64 | /* Data received from peer */ |
| 65 | #define NFA_P2P_DATA_EVT 0x07 |
| 66 | /* Status indication of outgoing data */ |
| 67 | #define NFA_P2P_CONGEST_EVT 0x08 |
| 68 | /* link MIU and Well-Known Service list */ |
| 69 | #define NFA_P2P_LINK_INFO_EVT 0x09 |
nxf24591 | c1cbeab | 2018-02-21 17:32:26 +0530 | [diff] [blame] | 70 | #define NFA_P2P_SDP_EVT 0x0A /* Remote SAP of SDP result */ |
nxpandroid | c761165 | 2015-09-23 16:42:05 +0530 | [diff] [blame] | 71 | |
nxpandroid | 8f6d053 | 2017-07-12 18:25:30 +0530 | [diff] [blame] | 72 | typedef uint8_t tNFA_P2P_EVT; |
nxpandroid | c761165 | 2015-09-23 16:42:05 +0530 | [diff] [blame] | 73 | |
| 74 | /* NFA allocates a SAP for server */ |
nxpandroid | 8f6d053 | 2017-07-12 18:25:30 +0530 | [diff] [blame] | 75 | #define NFA_P2P_ANY_SAP LLCP_INVALID_SAP |
| 76 | #define NFA_P2P_INVALID_SAP LLCP_INVALID_SAP |
nxpandroid | c761165 | 2015-09-23 16:42:05 +0530 | [diff] [blame] | 77 | |
nxpandroid | 8f6d053 | 2017-07-12 18:25:30 +0530 | [diff] [blame] | 78 | #define NFA_P2P_LLINK_TYPE LLCP_LINK_TYPE_LOGICAL_DATA_LINK |
| 79 | #define NFA_P2P_DLINK_TYPE LLCP_LINK_TYPE_DATA_LINK_CONNECTION |
| 80 | typedef uint8_t tNFA_P2P_LINK_TYPE; |
nxpandroid | c761165 | 2015-09-23 16:42:05 +0530 | [diff] [blame] | 81 | |
| 82 | /* Data for NFA_P2P_REG_SERVER_EVT */ |
nxpandroid | 8f6d053 | 2017-07-12 18:25:30 +0530 | [diff] [blame] | 83 | typedef struct { |
| 84 | tNFA_HANDLE server_handle; /* NFA_HANDLE_INVALID if failed */ |
| 85 | char service_name[LLCP_MAX_SN_LEN + 1]; |
| 86 | uint8_t server_sap; |
nxpandroid | c761165 | 2015-09-23 16:42:05 +0530 | [diff] [blame] | 87 | } tNFA_P2P_REG_SERVER; |
| 88 | |
| 89 | /* Data for NFA_P2P_REG_CLIENT_EVT */ |
nxpandroid | 8f6d053 | 2017-07-12 18:25:30 +0530 | [diff] [blame] | 90 | typedef struct { |
| 91 | tNFA_HANDLE client_handle; /* NFA_HANDLE_INVALID if failed */ |
nxpandroid | c761165 | 2015-09-23 16:42:05 +0530 | [diff] [blame] | 92 | } tNFA_P2P_REG_CLIENT; |
| 93 | |
| 94 | /* Data for NFA_P2P_ACTIVATED_EVT */ |
nxpandroid | 8f6d053 | 2017-07-12 18:25:30 +0530 | [diff] [blame] | 95 | typedef struct { |
| 96 | tNFA_HANDLE handle; |
| 97 | uint16_t local_link_miu; |
| 98 | uint16_t remote_link_miu; |
nxpandroid | c761165 | 2015-09-23 16:42:05 +0530 | [diff] [blame] | 99 | } tNFA_P2P_ACTIVATED; |
| 100 | |
| 101 | /* Data for NFA_P2P_DEACTIVATED_EVT */ |
nxpandroid | 8f6d053 | 2017-07-12 18:25:30 +0530 | [diff] [blame] | 102 | typedef struct { tNFA_HANDLE handle; } tNFA_P2P_DEACTIVATED; |
nxpandroid | c761165 | 2015-09-23 16:42:05 +0530 | [diff] [blame] | 103 | |
| 104 | /* Data for NFA_P2P_CONN_REQ_EVT */ |
nxpandroid | 8f6d053 | 2017-07-12 18:25:30 +0530 | [diff] [blame] | 105 | typedef struct { |
| 106 | tNFA_HANDLE server_handle; |
| 107 | tNFA_HANDLE conn_handle; |
| 108 | uint8_t remote_sap; |
| 109 | uint16_t remote_miu; |
| 110 | uint8_t remote_rw; |
nxpandroid | c761165 | 2015-09-23 16:42:05 +0530 | [diff] [blame] | 111 | } tNFA_P2P_CONN_REQ; |
| 112 | |
| 113 | /* Data for NFA_P2P_CONNECTED_EVT */ |
nxpandroid | 8f6d053 | 2017-07-12 18:25:30 +0530 | [diff] [blame] | 114 | typedef struct { |
| 115 | tNFA_HANDLE client_handle; |
| 116 | tNFA_HANDLE conn_handle; |
| 117 | uint8_t remote_sap; |
| 118 | uint16_t remote_miu; |
| 119 | uint8_t remote_rw; |
nxpandroid | c761165 | 2015-09-23 16:42:05 +0530 | [diff] [blame] | 120 | } tNFA_P2P_CONN; |
| 121 | |
| 122 | /* Data for NFA_P2P_DISC_EVT */ |
nxpandroid | 8f6d053 | 2017-07-12 18:25:30 +0530 | [diff] [blame] | 123 | typedef struct { |
| 124 | tNFA_HANDLE handle; |
| 125 | uint8_t reason; |
nxpandroid | c761165 | 2015-09-23 16:42:05 +0530 | [diff] [blame] | 126 | } tNFA_P2P_DISC; |
| 127 | |
| 128 | /* Data for NFA_P2P_DATA_EVT */ |
nxpandroid | 8f6d053 | 2017-07-12 18:25:30 +0530 | [diff] [blame] | 129 | typedef struct { |
| 130 | tNFA_HANDLE handle; |
| 131 | uint8_t remote_sap; |
| 132 | tNFA_P2P_LINK_TYPE link_type; |
nxpandroid | c761165 | 2015-09-23 16:42:05 +0530 | [diff] [blame] | 133 | } tNFA_P2P_DATA; |
| 134 | |
| 135 | /* Data for NFA_P2P_CONGEST_EVT */ |
nxpandroid | 8f6d053 | 2017-07-12 18:25:30 +0530 | [diff] [blame] | 136 | typedef struct { |
| 137 | tNFA_HANDLE handle; |
| 138 | bool is_congested; |
| 139 | tNFA_P2P_LINK_TYPE link_type; |
nxpandroid | c761165 | 2015-09-23 16:42:05 +0530 | [diff] [blame] | 140 | } tNFA_P2P_CONGEST; |
| 141 | |
| 142 | /* Data for NFA_P2P_LINK_INFO_EVT */ |
nxpandroid | 8f6d053 | 2017-07-12 18:25:30 +0530 | [diff] [blame] | 143 | typedef struct { |
| 144 | tNFA_HANDLE handle; |
| 145 | uint16_t wks; /* well-known service */ |
| 146 | uint16_t local_link_miu; |
| 147 | uint16_t remote_link_miu; |
nxpandroid | c761165 | 2015-09-23 16:42:05 +0530 | [diff] [blame] | 148 | } tNFA_P2P_LINK_INFO; |
| 149 | |
| 150 | /* Data for NFA_P2P_SDP_EVT */ |
nxpandroid | 8f6d053 | 2017-07-12 18:25:30 +0530 | [diff] [blame] | 151 | typedef struct { |
| 152 | tNFA_HANDLE handle; |
| 153 | uint8_t remote_sap; /* 0x00 if failed */ |
nxpandroid | c761165 | 2015-09-23 16:42:05 +0530 | [diff] [blame] | 154 | } tNFA_P2P_SDP; |
| 155 | |
| 156 | /* Union of all P2P callback structures */ |
nxpandroid | 8f6d053 | 2017-07-12 18:25:30 +0530 | [diff] [blame] | 157 | typedef union { |
| 158 | tNFA_P2P_REG_SERVER reg_server; /* NFA_P2P_REG_SERVER_EVT */ |
| 159 | tNFA_P2P_REG_CLIENT reg_client; /* NFA_P2P_REG_CLIENT_EVT */ |
| 160 | tNFA_P2P_ACTIVATED activated; /* NFA_P2P_ACTIVATED_EVT */ |
| 161 | tNFA_P2P_DEACTIVATED deactivated; /* NFA_P2P_DEACTIVATED_EVT */ |
| 162 | tNFA_P2P_CONN_REQ conn_req; /* NFA_P2P_CONN_REQ_EVT */ |
| 163 | tNFA_P2P_CONN connected; /* NFA_P2P_CONNECTED_EVT */ |
| 164 | tNFA_P2P_DISC disc; /* NFA_P2P_DISC_EVT */ |
| 165 | tNFA_P2P_DATA data; /* NFA_P2P_DATA_EVT */ |
| 166 | tNFA_P2P_CONGEST congest; /* NFA_P2P_CONGEST_EVT */ |
| 167 | tNFA_P2P_LINK_INFO link_info; /* NFA_P2P_LINK_INFO_EVT */ |
| 168 | tNFA_P2P_SDP sdp; /* NFA_P2P_SDP_EVT */ |
nxpandroid | c761165 | 2015-09-23 16:42:05 +0530 | [diff] [blame] | 169 | } tNFA_P2P_EVT_DATA; |
| 170 | |
| 171 | /* NFA P2P callback */ |
nxpandroid | 8f6d053 | 2017-07-12 18:25:30 +0530 | [diff] [blame] | 172 | typedef void(tNFA_P2P_CBACK)(tNFA_P2P_EVT event, tNFA_P2P_EVT_DATA* p_data); |
nxpandroid | c761165 | 2015-09-23 16:42:05 +0530 | [diff] [blame] | 173 | |
| 174 | /***************************************************************************** |
| 175 | ** External Function Declarations |
| 176 | *****************************************************************************/ |
nxpandroid | c761165 | 2015-09-23 16:42:05 +0530 | [diff] [blame] | 177 | |
| 178 | /******************************************************************************* |
| 179 | ** |
| 180 | ** Function NFA_P2pRegisterServer |
| 181 | ** |
nxpandroid | 8f6d053 | 2017-07-12 18:25:30 +0530 | [diff] [blame] | 182 | ** Description This function is called to listen to a SAP as server on |
| 183 | ** LLCP. |
nxpandroid | c761165 | 2015-09-23 16:42:05 +0530 | [diff] [blame] | 184 | ** |
nxpandroid | 8f6d053 | 2017-07-12 18:25:30 +0530 | [diff] [blame] | 185 | ** NFA_P2P_REG_SERVER_EVT will be returned with status and |
| 186 | ** handle. |
nxpandroid | c761165 | 2015-09-23 16:42:05 +0530 | [diff] [blame] | 187 | ** |
nxpandroid | 8f6d053 | 2017-07-12 18:25:30 +0530 | [diff] [blame] | 188 | ** If server_sap is set to NFA_P2P_ANY_SAP, then NFA will |
| 189 | ** allocate a SAP between LLCP_LOWER_BOUND_SDP_SAP and |
| 190 | ** LLCP_UPPER_BOUND_SDP_SAP Otherwise, server_sap must be |
| 191 | ** between (LLCP_SDP_SAP + 1) and LLCP_UPPER_BOUND_SDP_SAP |
nxpandroid | c761165 | 2015-09-23 16:42:05 +0530 | [diff] [blame] | 192 | ** |
| 193 | ** link_type : NFA_P2P_LLINK_TYPE and/or NFA_P2P_DLINK_TYPE |
| 194 | ** |
nxpandroid | 8f6d053 | 2017-07-12 18:25:30 +0530 | [diff] [blame] | 195 | ** Note: If RF discovery is started, |
| 196 | ** NFA_StopRfDiscovery()/NFA_RF_DISCOVERY_STOPPED_EVT should |
| 197 | ** happen before calling this function |
nxpandroid | c761165 | 2015-09-23 16:42:05 +0530 | [diff] [blame] | 198 | ** |
| 199 | ** Returns NFA_STATUS_OK if successfully initiated |
| 200 | ** NFA_STATUS_FAILED otherwise |
| 201 | ** |
| 202 | *******************************************************************************/ |
nxpandroid | 8f6d053 | 2017-07-12 18:25:30 +0530 | [diff] [blame] | 203 | extern tNFA_STATUS NFA_P2pRegisterServer(uint8_t server_sap, |
| 204 | tNFA_P2P_LINK_TYPE link_type, |
| 205 | char* p_service_name, |
| 206 | tNFA_P2P_CBACK* p_cback); |
nxpandroid | c761165 | 2015-09-23 16:42:05 +0530 | [diff] [blame] | 207 | |
| 208 | /******************************************************************************* |
| 209 | ** |
| 210 | ** Function NFA_P2pRegisterClient |
| 211 | ** |
nxpandroid | 8f6d053 | 2017-07-12 18:25:30 +0530 | [diff] [blame] | 212 | ** Description This function is called to register a client service on |
| 213 | ** LLCP. |
nxpandroid | c761165 | 2015-09-23 16:42:05 +0530 | [diff] [blame] | 214 | ** |
nxpandroid | 8f6d053 | 2017-07-12 18:25:30 +0530 | [diff] [blame] | 215 | ** NFA_P2P_REG_CLIENT_EVT will be returned with status and |
| 216 | ** handle. |
nxpandroid | c761165 | 2015-09-23 16:42:05 +0530 | [diff] [blame] | 217 | ** |
| 218 | ** link_type : NFA_P2P_LLINK_TYPE and/or NFA_P2P_DLINK_TYPE |
| 219 | ** |
| 220 | ** Returns NFA_STATUS_OK if successfully initiated |
| 221 | ** NFA_STATUS_FAILED otherwise |
| 222 | ** |
| 223 | *******************************************************************************/ |
nxpandroid | 8f6d053 | 2017-07-12 18:25:30 +0530 | [diff] [blame] | 224 | extern tNFA_STATUS NFA_P2pRegisterClient(tNFA_P2P_LINK_TYPE link_type, |
| 225 | tNFA_P2P_CBACK* p_cback); |
nxpandroid | c761165 | 2015-09-23 16:42:05 +0530 | [diff] [blame] | 226 | |
| 227 | /******************************************************************************* |
| 228 | ** |
| 229 | ** Function NFA_P2pDeregister |
| 230 | ** |
| 231 | ** Description This function is called to stop listening to a SAP as server |
| 232 | ** or stop client service on LLCP. |
| 233 | ** |
nxpandroid | 8f6d053 | 2017-07-12 18:25:30 +0530 | [diff] [blame] | 234 | ** Note: If this function is called to de-register a server and RF |
| 235 | ** discovery is started, |
| 236 | ** NFA_StopRfDiscovery()/NFA_RF_DISCOVERY_STOPPED_EVT should |
| 237 | ** happen before calling this function |
nxpandroid | c761165 | 2015-09-23 16:42:05 +0530 | [diff] [blame] | 238 | ** |
| 239 | ** Returns NFA_STATUS_OK if successfully initiated |
| 240 | ** NFA_STATUS_BAD_HANDLE if handle is not valid |
| 241 | ** NFA_STATUS_FAILED otherwise |
| 242 | ** |
| 243 | *******************************************************************************/ |
nxpandroid | 8f6d053 | 2017-07-12 18:25:30 +0530 | [diff] [blame] | 244 | extern tNFA_STATUS NFA_P2pDeregister(tNFA_HANDLE handle); |
nxpandroid | c761165 | 2015-09-23 16:42:05 +0530 | [diff] [blame] | 245 | |
| 246 | /******************************************************************************* |
| 247 | ** |
| 248 | ** Function NFA_P2pAcceptConn |
| 249 | ** |
| 250 | ** Description This function is called to accept a request of data link |
| 251 | ** connection to a listening SAP on LLCP after receiving |
| 252 | ** NFA_P2P_CONN_REQ_EVT. |
| 253 | ** |
| 254 | ** Returns NFA_STATUS_OK if successfully initiated |
| 255 | ** NFA_STATUS_BAD_HANDLE if handle is not valid |
| 256 | ** NFA_STATUS_FAILED otherwise |
| 257 | ** |
| 258 | *******************************************************************************/ |
nxpandroid | 8f6d053 | 2017-07-12 18:25:30 +0530 | [diff] [blame] | 259 | extern tNFA_STATUS NFA_P2pAcceptConn(tNFA_HANDLE conn_handle, uint16_t miu, |
| 260 | uint8_t rw); |
nxpandroid | c761165 | 2015-09-23 16:42:05 +0530 | [diff] [blame] | 261 | |
| 262 | /******************************************************************************* |
| 263 | ** |
| 264 | ** Function NFA_P2pRejectConn |
| 265 | ** |
| 266 | ** Description This function is called to reject a request of data link |
| 267 | ** connection to a listening SAP on LLCP after receiving |
| 268 | ** NFA_P2P_CONN_REQ_EVT. |
| 269 | ** |
| 270 | ** Returns NFA_STATUS_OK if successfully initiated |
| 271 | ** NFA_STATUS_BAD_HANDLE if handle is not valid |
| 272 | ** NFA_STATUS_FAILED otherwise |
| 273 | ** |
| 274 | *******************************************************************************/ |
nxpandroid | 8f6d053 | 2017-07-12 18:25:30 +0530 | [diff] [blame] | 275 | extern tNFA_STATUS NFA_P2pRejectConn(tNFA_HANDLE conn_handle); |
nxpandroid | c761165 | 2015-09-23 16:42:05 +0530 | [diff] [blame] | 276 | |
| 277 | /******************************************************************************* |
| 278 | ** |
| 279 | ** Function NFA_P2pDisconnect |
| 280 | ** |
| 281 | ** Description This function is called to disconnect an existing or |
| 282 | ** connecting data link connection. |
| 283 | ** |
nxpandroid | 8f6d053 | 2017-07-12 18:25:30 +0530 | [diff] [blame] | 284 | ** discard any pending data on data link connection if flush is |
nxf24591 | c1cbeab | 2018-02-21 17:32:26 +0530 | [diff] [blame] | 285 | ** set to TRUE |
nxpandroid | c761165 | 2015-09-23 16:42:05 +0530 | [diff] [blame] | 286 | ** |
nxpandroid | 8f6d053 | 2017-07-12 18:25:30 +0530 | [diff] [blame] | 287 | ** NFA_P2P_DISC_EVT will be returned after data link connection |
| 288 | ** is disconnected |
nxpandroid | c761165 | 2015-09-23 16:42:05 +0530 | [diff] [blame] | 289 | ** |
| 290 | ** Returns NFA_STATUS_OK if successfully initiated |
| 291 | ** NFA_STATUS_BAD_HANDLE if handle is not valid |
| 292 | ** NFA_STATUS_FAILED otherwise |
| 293 | ** |
| 294 | *******************************************************************************/ |
nxpandroid | 8f6d053 | 2017-07-12 18:25:30 +0530 | [diff] [blame] | 295 | extern tNFA_STATUS NFA_P2pDisconnect(tNFA_HANDLE conn_handle, bool flush); |
nxpandroid | c761165 | 2015-09-23 16:42:05 +0530 | [diff] [blame] | 296 | |
| 297 | /******************************************************************************* |
| 298 | ** |
| 299 | ** Function NFA_P2pConnectByName |
| 300 | ** |
nxpandroid | 8f6d053 | 2017-07-12 18:25:30 +0530 | [diff] [blame] | 301 | ** Description This function is called to create a connection-oriented |
| 302 | ** transport by a service name. |
nxpandroid | c761165 | 2015-09-23 16:42:05 +0530 | [diff] [blame] | 303 | ** NFA_P2P_CONNECTED_EVT if success |
| 304 | ** NFA_P2P_DISC_EVT if failed |
| 305 | ** |
| 306 | ** Returns NFA_STATUS_OK if successfully initiated |
| 307 | ** NFA_STATUS_BAD_HANDLE if client is not registered |
| 308 | ** NFA_STATUS_FAILED otherwise |
| 309 | ** |
| 310 | *******************************************************************************/ |
nxpandroid | 8f6d053 | 2017-07-12 18:25:30 +0530 | [diff] [blame] | 311 | extern tNFA_STATUS NFA_P2pConnectByName(tNFA_HANDLE client_handle, |
| 312 | char* p_service_name, uint16_t miu, |
| 313 | uint8_t rw); |
nxpandroid | c761165 | 2015-09-23 16:42:05 +0530 | [diff] [blame] | 314 | |
| 315 | /******************************************************************************* |
| 316 | ** |
| 317 | ** Function NFA_P2pConnectBySap |
| 318 | ** |
nxpandroid | 8f6d053 | 2017-07-12 18:25:30 +0530 | [diff] [blame] | 319 | ** Description This function is called to create a connection-oriented |
| 320 | ** transport by a SAP. |
nxpandroid | c761165 | 2015-09-23 16:42:05 +0530 | [diff] [blame] | 321 | ** NFA_P2P_CONNECTED_EVT if success |
| 322 | ** NFA_P2P_DISC_EVT if failed |
| 323 | ** |
| 324 | ** Returns NFA_STATUS_OK if successfully initiated |
| 325 | ** NFA_STATUS_BAD_HANDLE if client is not registered |
| 326 | ** NFA_STATUS_FAILED otherwise |
| 327 | ** |
| 328 | *******************************************************************************/ |
nxpandroid | 8f6d053 | 2017-07-12 18:25:30 +0530 | [diff] [blame] | 329 | extern tNFA_STATUS NFA_P2pConnectBySap(tNFA_HANDLE client_handle, uint8_t dsap, |
| 330 | uint16_t miu, uint8_t rw); |
nxpandroid | c761165 | 2015-09-23 16:42:05 +0530 | [diff] [blame] | 331 | |
| 332 | /******************************************************************************* |
| 333 | ** |
| 334 | ** Function NFA_P2pSendUI |
| 335 | ** |
| 336 | ** Description This function is called to send data on connectionless |
| 337 | ** transport. |
| 338 | ** |
| 339 | ** Returns NFA_STATUS_OK if successfully initiated |
| 340 | ** NFA_STATUS_BAD_HANDLE if handle is not valid |
nxpandroid | 8f6d053 | 2017-07-12 18:25:30 +0530 | [diff] [blame] | 341 | ** NFA_STATUS_BAD_LENGTH if data length is more than remote |
| 342 | ** link MIU |
nxpandroid | c761165 | 2015-09-23 16:42:05 +0530 | [diff] [blame] | 343 | ** NFA_STATUS_CONGESTED if congested |
| 344 | ** NFA_STATUS_FAILED otherwise |
| 345 | ** |
| 346 | *******************************************************************************/ |
nxpandroid | 8f6d053 | 2017-07-12 18:25:30 +0530 | [diff] [blame] | 347 | extern tNFA_STATUS NFA_P2pSendUI(tNFA_HANDLE handle, uint8_t dsap, |
| 348 | uint16_t length, uint8_t* p_data); |
nxpandroid | c761165 | 2015-09-23 16:42:05 +0530 | [diff] [blame] | 349 | |
| 350 | /******************************************************************************* |
| 351 | ** |
| 352 | ** Function NFA_P2pReadUI |
| 353 | ** |
| 354 | ** Description This function is called to read data on connectionless |
nxpandroid | 8f6d053 | 2017-07-12 18:25:30 +0530 | [diff] [blame] | 355 | ** transport when receiving NFA_P2P_DATA_EVT with |
| 356 | ** NFA_P2P_LLINK_TYPE. |
nxpandroid | c761165 | 2015-09-23 16:42:05 +0530 | [diff] [blame] | 357 | ** |
| 358 | ** - Remote SAP who sent UI PDU is returned. |
nxpandroid | 8f6d053 | 2017-07-12 18:25:30 +0530 | [diff] [blame] | 359 | ** - Information of UI PDU up to max_data_len is copied into |
| 360 | ** p_data. |
| 361 | ** - If more information of UI PDU or more UI PDU in queue then |
nxf24591 | c1cbeab | 2018-02-21 17:32:26 +0530 | [diff] [blame] | 362 | ** more is returned to TRUE. |
nxpandroid | c761165 | 2015-09-23 16:42:05 +0530 | [diff] [blame] | 363 | ** - Information of next UI PDU is not concatenated. |
| 364 | ** |
| 365 | ** Returns NFA_STATUS_OK if successfully initiated |
| 366 | ** NFA_STATUS_BAD_HANDLE if handle is not valid |
| 367 | ** |
| 368 | *******************************************************************************/ |
nxpandroid | 8f6d053 | 2017-07-12 18:25:30 +0530 | [diff] [blame] | 369 | extern tNFA_STATUS NFA_P2pReadUI(tNFA_HANDLE handle, uint32_t max_data_len, |
| 370 | uint8_t* p_remote_sap, uint32_t* p_data_len, |
| 371 | uint8_t* p_data, bool* p_more); |
nxpandroid | c761165 | 2015-09-23 16:42:05 +0530 | [diff] [blame] | 372 | |
| 373 | /******************************************************************************* |
| 374 | ** |
| 375 | ** Function NFA_P2pFlushUI |
| 376 | ** |
| 377 | ** Description This function is called to flush data on connectionless |
| 378 | ** transport. |
| 379 | ** |
| 380 | ** Returns NFA_STATUS_OK if successfully initiated |
| 381 | ** NFA_STATUS_BAD_HANDLE if handle is not valid |
| 382 | ** |
| 383 | *******************************************************************************/ |
nxpandroid | 8f6d053 | 2017-07-12 18:25:30 +0530 | [diff] [blame] | 384 | extern tNFA_STATUS NFA_P2pFlushUI(tNFA_HANDLE handle, uint32_t* p_length); |
nxpandroid | c761165 | 2015-09-23 16:42:05 +0530 | [diff] [blame] | 385 | |
| 386 | /******************************************************************************* |
| 387 | ** |
| 388 | ** Function NFA_P2pSendData |
| 389 | ** |
| 390 | ** Description This function is called to send data on connection-oriented |
| 391 | ** transport. |
| 392 | ** |
| 393 | ** Returns NFA_STATUS_OK if successfully initiated |
| 394 | ** NFA_STATUS_BAD_HANDLE if handle is not valid |
| 395 | ** NFA_STATUS_BAD_LENGTH if data length is more than remote MIU |
| 396 | ** NFA_STATUS_CONGESTED if congested |
| 397 | ** NFA_STATUS_FAILED otherwise |
| 398 | ** |
| 399 | *******************************************************************************/ |
nxpandroid | 8f6d053 | 2017-07-12 18:25:30 +0530 | [diff] [blame] | 400 | extern tNFA_STATUS NFA_P2pSendData(tNFA_HANDLE conn_handle, uint16_t length, |
| 401 | uint8_t* p_data); |
nxpandroid | c761165 | 2015-09-23 16:42:05 +0530 | [diff] [blame] | 402 | |
| 403 | /******************************************************************************* |
| 404 | ** |
| 405 | ** Function NFA_P2pReadData |
| 406 | ** |
| 407 | ** Description This function is called to read data on connection-oriented |
nxpandroid | 8f6d053 | 2017-07-12 18:25:30 +0530 | [diff] [blame] | 408 | ** transport when receiving NFA_P2P_DATA_EVT with |
| 409 | ** NFA_P2P_DLINK_TYPE. |
nxpandroid | c761165 | 2015-09-23 16:42:05 +0530 | [diff] [blame] | 410 | ** |
nxpandroid | 8f6d053 | 2017-07-12 18:25:30 +0530 | [diff] [blame] | 411 | ** - Information of I PDU is copied into p_data up to |
| 412 | ** max_data_len. |
| 413 | ** - If more information of I PDU or more I PDU in queue, then |
nxf24591 | c1cbeab | 2018-02-21 17:32:26 +0530 | [diff] [blame] | 414 | ** more is returned to TRUE. |
nxpandroid | c761165 | 2015-09-23 16:42:05 +0530 | [diff] [blame] | 415 | ** - Information of next I PDU is not concatenated. |
| 416 | ** |
| 417 | ** Returns NFA_STATUS_OK if successfully initiated |
| 418 | ** NFA_STATUS_BAD_HANDLE if handle is not valid |
| 419 | ** |
| 420 | *******************************************************************************/ |
nxpandroid | 8f6d053 | 2017-07-12 18:25:30 +0530 | [diff] [blame] | 421 | extern tNFA_STATUS NFA_P2pReadData(tNFA_HANDLE handle, uint32_t max_data_len, |
| 422 | uint32_t* p_data_len, uint8_t* p_data, |
| 423 | bool* p_more); |
nxpandroid | c761165 | 2015-09-23 16:42:05 +0530 | [diff] [blame] | 424 | |
| 425 | /******************************************************************************* |
| 426 | ** |
| 427 | ** Function NFA_P2pFlushData |
| 428 | ** |
| 429 | ** Description This function is called to flush data on connection-oriented |
| 430 | ** transport. |
| 431 | ** |
| 432 | ** Returns NFA_STATUS_OK if successfully initiated |
| 433 | ** NFA_STATUS_BAD_HANDLE if handle is not valid |
| 434 | ** |
| 435 | *******************************************************************************/ |
nxpandroid | 8f6d053 | 2017-07-12 18:25:30 +0530 | [diff] [blame] | 436 | extern tNFA_STATUS NFA_P2pFlushData(tNFA_HANDLE handle, uint32_t* p_length); |
nxpandroid | c761165 | 2015-09-23 16:42:05 +0530 | [diff] [blame] | 437 | |
| 438 | /******************************************************************************* |
| 439 | ** |
| 440 | ** Function NFA_P2pSetLocalBusy |
| 441 | ** |
| 442 | ** Description This function is called to stop or resume incoming data on |
| 443 | ** connection-oriented transport. |
| 444 | ** |
| 445 | ** Returns NFA_STATUS_OK if successfully initiated |
| 446 | ** NFA_STATUS_BAD_HANDLE if handle is not valid |
| 447 | ** NFA_STATUS_FAILED otherwise |
| 448 | ** |
| 449 | *******************************************************************************/ |
nxpandroid | 8f6d053 | 2017-07-12 18:25:30 +0530 | [diff] [blame] | 450 | extern tNFA_STATUS NFA_P2pSetLocalBusy(tNFA_HANDLE conn_handle, bool is_busy); |
nxpandroid | c761165 | 2015-09-23 16:42:05 +0530 | [diff] [blame] | 451 | |
| 452 | /******************************************************************************* |
| 453 | ** |
| 454 | ** Function NFA_P2pGetLinkInfo |
| 455 | ** |
| 456 | ** Description This function is called to get local/remote link MIU and |
nxpandroid | 8f6d053 | 2017-07-12 18:25:30 +0530 | [diff] [blame] | 457 | ** Well-Known Service list encoded as a 16-bit field of |
| 458 | ** connected LLCP. NFA_P2P_LINK_INFO_EVT will be returned. |
nxpandroid | c761165 | 2015-09-23 16:42:05 +0530 | [diff] [blame] | 459 | ** |
| 460 | ** Returns NFA_STATUS_OK if successfully initiated |
| 461 | ** NFA_STATUS_BAD_HANDLE if server or client is not registered |
| 462 | ** NFA_STATUS_FAILED otherwise |
| 463 | ** |
| 464 | *******************************************************************************/ |
nxpandroid | 8f6d053 | 2017-07-12 18:25:30 +0530 | [diff] [blame] | 465 | extern tNFA_STATUS NFA_P2pGetLinkInfo(tNFA_HANDLE handle); |
nxpandroid | c761165 | 2015-09-23 16:42:05 +0530 | [diff] [blame] | 466 | |
| 467 | /******************************************************************************* |
| 468 | ** |
| 469 | ** Function NFA_P2pGetRemoteSap |
| 470 | ** |
nxpandroid | 8f6d053 | 2017-07-12 18:25:30 +0530 | [diff] [blame] | 471 | ** Description This function is called to get SAP associated by service |
| 472 | ** name on connected remote LLCP. |
nxpandroid | c761165 | 2015-09-23 16:42:05 +0530 | [diff] [blame] | 473 | ** NFA_P2P_SDP_EVT will be returned. |
| 474 | ** |
| 475 | ** Returns NFA_STATUS_OK if successfully initiated |
| 476 | ** NFA_STATUS_BAD_HANDLE if server or client is not registered |
| 477 | ** NFA_STATUS_FAILED otherwise |
| 478 | ** |
| 479 | *******************************************************************************/ |
nxpandroid | 8f6d053 | 2017-07-12 18:25:30 +0530 | [diff] [blame] | 480 | extern tNFA_STATUS NFA_P2pGetRemoteSap(tNFA_HANDLE handle, |
| 481 | char* p_service_name); |
nxpandroid | c761165 | 2015-09-23 16:42:05 +0530 | [diff] [blame] | 482 | |
| 483 | /******************************************************************************* |
| 484 | ** |
| 485 | ** Function NFA_P2pSetLLCPConfig |
| 486 | ** |
| 487 | ** Description This function is called to change LLCP config parameters. |
| 488 | ** Application must call while LLCP is not activated. |
| 489 | ** |
| 490 | ** Parameters descriptions (default value) |
| 491 | ** - Local Link MIU (LLCP_MIU) |
| 492 | ** - Option parameter (LLCP_OPT_VALUE) |
| 493 | ** - Response Waiting Time Index (LLCP_WAITING_TIME) |
| 494 | ** - Local Link Timeout (LLCP_LTO_VALUE) |
nxpandroid | 8f6d053 | 2017-07-12 18:25:30 +0530 | [diff] [blame] | 495 | ** - Inactivity Timeout as initiator role |
| 496 | ** (LLCP_INIT_INACTIVITY_TIMEOUT) |
| 497 | ** - Inactivity Timeout as target role |
| 498 | ** (LLCP_TARGET_INACTIVITY_TIMEOUT) |
nxpandroid | c761165 | 2015-09-23 16:42:05 +0530 | [diff] [blame] | 499 | ** - Delay SYMM response (LLCP_DELAY_RESP_TIME) |
nxpandroid | 8f6d053 | 2017-07-12 18:25:30 +0530 | [diff] [blame] | 500 | ** - Data link connection timeout |
| 501 | ** (LLCP_DATA_LINK_CONNECTION_TOUT) |
| 502 | ** - Delay timeout to send first PDU as initiator |
| 503 | ** (LLCP_DELAY_TIME_TO_SEND_FIRST_PDU) |
nxpandroid | c761165 | 2015-09-23 16:42:05 +0530 | [diff] [blame] | 504 | ** |
| 505 | ** Returns NFA_STATUS_OK if successfully initiated |
| 506 | ** NFA_STATUS_FAILED otherwise |
| 507 | ** |
| 508 | *******************************************************************************/ |
nxpandroid | 8f6d053 | 2017-07-12 18:25:30 +0530 | [diff] [blame] | 509 | extern tNFA_STATUS NFA_P2pSetLLCPConfig(uint16_t link_miu, uint8_t opt, |
| 510 | uint8_t wt, uint16_t link_timeout, |
| 511 | uint16_t inact_timeout_init, |
| 512 | uint16_t inact_timeout_target, |
| 513 | uint16_t symm_delay, |
| 514 | uint16_t data_link_timeout, |
| 515 | uint16_t delay_first_pdu_timeout); |
nxpandroid | c761165 | 2015-09-23 16:42:05 +0530 | [diff] [blame] | 516 | |
| 517 | /******************************************************************************* |
| 518 | ** |
| 519 | ** Function NFA_P2pGetLLCPConfig |
| 520 | ** |
| 521 | ** Description This function is called to read LLCP config parameters. |
| 522 | ** |
| 523 | ** Parameters descriptions |
| 524 | ** - Local Link MIU |
| 525 | ** - Option parameter |
| 526 | ** - Response Waiting Time Index |
| 527 | ** - Local Link Timeout |
| 528 | ** - Inactivity Timeout as initiator role |
| 529 | ** - Inactivity Timeout as target role |
| 530 | ** - Delay SYMM response |
| 531 | ** - Data link connection timeout |
| 532 | ** - Delay timeout to send first PDU as initiator |
| 533 | ** |
| 534 | ** Returns None |
| 535 | ** |
| 536 | *******************************************************************************/ |
nxpandroid | 8f6d053 | 2017-07-12 18:25:30 +0530 | [diff] [blame] | 537 | extern void NFA_P2pGetLLCPConfig(uint16_t* p_link_miu, uint8_t* p_opt, |
| 538 | uint8_t* p_wt, uint16_t* p_link_timeout, |
| 539 | uint16_t* p_inact_timeout_init, |
| 540 | uint16_t* p_inact_timeout_target, |
| 541 | uint16_t* p_symm_delay, |
| 542 | uint16_t* p_data_link_timeout, |
| 543 | uint16_t* p_delay_first_pdu_timeout); |
nxpandroid | c761165 | 2015-09-23 16:42:05 +0530 | [diff] [blame] | 544 | |
nxpandroid | c761165 | 2015-09-23 16:42:05 +0530 | [diff] [blame] | 545 | #endif /* NFA_P2P_API_H */ |