2 * Copyright (C) 2010 NXP Semiconductors
\r
4 * Licensed under the Apache License, Version 2.0 (the "License");
\r
5 * you may not use this file except in compliance with the License.
\r
6 * You may obtain a copy of the License at
\r
8 * http://www.apache.org/licenses/LICENSE-2.0
\r
10 * Unless required by applicable law or agreed to in writing, software
\r
11 * distributed under the License is distributed on an "AS IS" BASIS,
\r
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
\r
13 * See the License for the specific language governing permissions and
\r
14 * limitations under the License.
\r
18 * \file phFriNfc_LlcpTransport.h
\r
25 #ifndef PHFRINFC_LLCP_TRANSPORT_H
\r
26 #define PHFRINFC_LLCP_TRANSPORT_H
\r
27 #include <phNfcHalTypes.h>
\r
28 #include <phNfcLlcpTypes.h>
\r
29 #include <phNfcTypes.h>
\r
30 #include <phLibNfcStatus.h>
\r
31 #include <phFriNfc_Llcp.h>
\r
32 #include <phFriNfc_LlcpUtils.h>
\r
38 typedef uint32_t phFriNfc_Socket_Handle;
\r
41 * \ingroup grp_fri_nfc_llcp_mac
\r
42 * \brief Declaration of a TRANSPORT type
\r
44 struct phFriNfc_LlcpTransport;
\r
45 typedef struct phFriNfc_LlcpTransport phFriNfc_LlcpTransport_t;
\r
47 struct phFriNfc_LlcpTransport_Socket;
\r
48 typedef struct phFriNfc_LlcpTransport_Socket phFriNfc_LlcpTransport_Socket_t;
\r
50 /*========== ENUMERATES ===========*/
\r
52 /* Enum reperesents the different LLCP Link status*/
\r
53 typedef enum phFriNfc_LlcpTransportSocket_eSocketState
\r
55 phFriNfc_LlcpTransportSocket_eSocketDefault,
\r
56 phFriNfc_LlcpTransportSocket_eSocketCreated,
\r
57 phFriNfc_LlcpTransportSocket_eSocketBound,
\r
58 phFriNfc_LlcpTransportSocket_eSocketRegistered,
\r
59 phFriNfc_LlcpTransportSocket_eSocketConnected,
\r
60 phFriNfc_LlcpTransportSocket_eSocketConnecting,
\r
61 phFriNfc_LlcpTransportSocket_eSocketAccepted,
\r
62 phFriNfc_LlcpTransportSocket_eSocketDisconnected,
\r
63 phFriNfc_LlcpTransportSocket_eSocketDisconnecting,
\r
64 phFriNfc_LlcpTransportSocket_eSocketRejected,
\r
65 }phFriNfc_LlcpTransportSocket_eSocketState_t;
\r
69 /*========== CALLBACKS ===========*/
\r
72 *\ingroup grp_fri_nfc
\r
74 * \brief LLCP socket error notification callback definition
\r
76 typedef void (*pphFriNfc_LlcpTransportSocketErrCb_t) ( void* pContext,
\r
81 *\ingroup grp_fri_nfc
\r
83 * \brief LLCP socket listen callback definition
\r
85 typedef void (*pphFriNfc_LlcpTransportSocketListenCb_t) (void* pContext,
\r
86 phFriNfc_LlcpTransport_Socket_t *IncomingSocket);
\r
89 *\ingroup grp_fri_nfc
\r
91 * \brief LLCP socket connect callback definition
\r
93 typedef void (*pphFriNfc_LlcpTransportSocketConnectCb_t) ( void* pContext,
\r
98 *\ingroup grp_fri_nfc
\r
100 * \brief LLCP socket disconnect callback definition
\r
102 typedef void (*pphFriNfc_LlcpTransportSocketDisconnectCb_t) (void* pContext,
\r
106 *\ingroup grp_fri_nfc
\r
108 * \brief LLCP socket accept callback definition
\r
110 typedef void (*pphFriNfc_LlcpTransportSocketAcceptCb_t) (void* pContext,
\r
114 *\ingroup grp_fri_nfc
\r
116 * \brief LLCP socket reject callback definition
\r
118 typedef void (*pphFriNfc_LlcpTransportSocketRejectCb_t) (void* pContext,
\r
122 *\ingroup grp_fri_nfc
\r
124 * \brief LLCP socket reception callback definition
\r
126 typedef void (*pphFriNfc_LlcpTransportSocketRecvCb_t) (void* pContext,
\r
130 *\ingroup grp_fri_nfc
\r
132 * \brief LLCP socket reception with SSAP callback definition
\r
134 typedef void (*pphFriNfc_LlcpTransportSocketRecvFromCb_t) (void* pContext,
\r
139 *\ingroup grp_fri_nfc
\r
141 * \brief LLCP socket emission callback definition
\r
143 typedef void (*pphFriNfc_LlcpTransportSocketSendCb_t) (void* pContext,
\r
147 /*========== STRUCTURES ===========*/
\r
149 * \ingroup grp_fri_nfc_llcp_mac
\r
150 * \brief Declaration of a SOCKET type
\r
152 struct phFriNfc_LlcpTransport_Socket
\r
154 phFriNfc_LlcpTransportSocket_eSocketState_t eSocket_State;
\r
155 phFriNfc_LlcpTransport_eSocketType_t eSocket_Type;
\r
156 phFriNfc_LlcpTransport_sSocketOptions_t sSocketOption;
\r
157 pphFriNfc_LlcpTransportSocketErrCb_t pSocketErrCb;
\r
159 /* Remote and local socket info */
\r
160 uint8_t socket_sSap;
\r
161 uint8_t socket_dSap;
\r
162 // TODO: copy service name (could be deallocated by upper layer)
\r
163 phNfc_sData_t sServiceName;
\r
166 uint16_t remoteMIU;
\r
167 uint16_t localMIUX;
\r
170 /* Information Flags */
\r
171 bool_t bSocketRecvPending;
\r
172 bool_t bSocketSendPending;
\r
173 bool_t bSocketListenPending;
\r
174 bool_t bSocketDiscPending;
\r
175 bool_t bSocketConnectPending;
\r
176 bool_t bSocketAcceptPending;
\r
177 bool_t bSocketRRPending;
\r
178 bool_t bSocketRNRPending;
\r
181 phNfc_sData_t sSocketSendBuffer;
\r
182 phNfc_sData_t sSocketLinearBuffer;
\r
183 phNfc_sData_t* sSocketRecvBuffer;
\r
184 uint32_t *receivedLength;
\r
185 uint32_t bufferLinearLength;
\r
186 uint32_t bufferSendMaxLength;
\r
187 uint32_t bufferRwMaxLength;
\r
188 bool_t ReceiverBusyCondition;
\r
189 bool_t RemoteBusyConditionInfo;
\r
190 UTIL_FIFO_BUFFER sCyclicFifoBuffer;
\r
191 uint32_t indexRwRead;
\r
192 uint32_t indexRwWrite;
\r
194 /* Construction Frame */
\r
195 phFriNfc_Llcp_sPacketHeader_t sLlcpHeader;
\r
196 phFriNfc_Llcp_sPacketSequence_t sSequence;
\r
198 uint8_t socket_VSA;
\r
200 uint8_t socket_VRA;
\r
203 pphFriNfc_LlcpTransportSocketAcceptCb_t pfSocketAccept_Cb;
\r
204 pphFriNfc_LlcpTransportSocketSendCb_t pfSocketSend_Cb;
\r
205 pphFriNfc_LlcpTransportSocketRecvFromCb_t pfSocketRecvFrom_Cb;
\r
206 pphFriNfc_LlcpTransportSocketRecvCb_t pfSocketRecv_Cb;
\r
207 pphFriNfc_LlcpTransportSocketListenCb_t pfSocketListen_Cb;
\r
208 pphFriNfc_LlcpTransportSocketConnectCb_t pfSocketConnect_Cb;
\r
209 pphFriNfc_LlcpTransportSocketDisconnectCb_t pfSocketDisconnect_Cb;
\r
211 /* Table of PHFRINFC_LLCP_RW_MAX Receive Windows Buffers */
\r
212 phNfc_sData_t sSocketRwBufferTable[PHFRINFC_LLCP_RW_MAX];
\r
214 /* Pointer a the socket table */
\r
215 phFriNfc_LlcpTransport_t *psTransport;
\r
217 void *pListenContext;
\r
218 void *pAcceptContext;
\r
219 void *pRejectContext;
\r
220 void *pConnectContext;
\r
221 void *pDisonnectContext;
\r
222 void *pSendContext;
\r
223 void *pRecvContext;
\r
228 * \ingroup grp_fri_nfc_llcp_mac
\r
229 * \brief Declaration of a TRANSPORT Type with a table of PHFRINFC_LLCP_NB_SOCKET_DEFAULT sockets
\r
230 * and a pointer a Llcp layer
\r
232 struct phFriNfc_LlcpTransport
\r
234 phFriNfc_LlcpTransport_Socket_t pSocketTable[PHFRINFC_LLCP_NB_SOCKET_MAX];
\r
235 phFriNfc_Llcp_t *pLlcp;
\r
236 bool_t bSendPending;
\r
237 bool_t bRecvPending;
\r
239 bool_t bFrmrPending;
\r
241 uint8_t socketIndex;
\r
243 /**< Info field of pending FRMR packet*/
\r
244 uint8_t FrmrInfoBuffer[4];
\r
245 phFriNfc_Llcp_sPacketHeader_t sLlcpHeader;
\r
246 phFriNfc_Llcp_sPacketSequence_t sSequence;
\r
248 /**< Info field of pending DM packet*/
\r
249 phFriNfc_Llcp_sPacketHeader_t sDmHeader;
\r
250 phNfc_sData_t sDmPayload;
\r
251 uint8_t DmInfoBuffer[3];
\r
253 uint8_t LinkStatusError;
\r
257 ################################################################################
\r
258 ********************** TRANSPORT Interface Function Prototype *****************
\r
259 ################################################################################
\r
263 * \ingroup grp_fri_nfc
\r
264 * \brief <b>Create a socket on a LLCP-connected device</b>.
\r
267 NFCSTATUS phFriNfc_LlcpTransport_Reset (phFriNfc_LlcpTransport_t *pLlcpSocketTable,
\r
268 phFriNfc_Llcp_t *pLlcp);
\r
272 * \ingroup grp_fri_nfc
\r
273 * \brief <b>Close all existing sockets</b>.
\r
276 NFCSTATUS phFriNfc_LlcpTransport_CloseAll (phFriNfc_LlcpTransport_t *pLlcpSocketTable);
\r
280 * \ingroup grp_lib_nfc
\r
281 * \brief <b>Get the local options of a socket</b>.
\r
283 * This function returns the local options (maximum packet size and receive window size) used
\r
284 * for a given connection-oriented socket. This function shall not be used with connectionless
\r
287 * \param[out] pLlcpSocket A pointer to a phFriNfc_LlcpTransport_Socket_t.
\r
288 * \param[in] psLocalOptions A pointer to be filled with the local options of the socket.
\r
290 * \retval NFCSTATUS_SUCCESS Operation successful.
\r
291 * \retval NFCSTATUS_INVALID_PARAMETER One or more of the supplied parameters
\r
292 * could not be properly interpreted.
\r
293 * \retval NFCSTATUS_INVALID_STATE The socket is not in a valid state, or not of
\r
294 * a valid type to perform the requsted operation.
\r
295 * \retval NFCSTATUS_NOT_INITIALISED Indicates stack is not yet initialized.
\r
296 * \retval NFCSTATUS_SHUTDOWN Shutdown in progress.
\r
297 * \retval NFCSTATUS_FAILED Operation failed.
\r
299 NFCSTATUS phFriNfc_LlcpTransport_SocketGetLocalOptions(phFriNfc_LlcpTransport_Socket_t *pLlcpSocket,
\r
300 phLibNfc_Llcp_sSocketOptions_t *psLocalOptions);
\r
304 * \ingroup grp_lib_nfc
\r
305 * \brief <b>Get the local options of a socket</b>.
\r
307 * This function returns the remote options (maximum packet size and receive window size) used
\r
308 * for a given connection-oriented socket. This function shall not be used with connectionless
\r
311 * \param[out] pLlcpSocket A pointer to a phFriNfc_LlcpTransport_Socket_t.
\r
312 * \param[in] psRemoteOptions A pointer to be filled with the remote options of the socket.
\r
314 * \retval NFCSTATUS_SUCCESS Operation successful.
\r
315 * \retval NFCSTATUS_INVALID_PARAMETER One or more of the supplied parameters
\r
316 * could not be properly interpreted.
\r
317 * \retval NFCSTATUS_INVALID_STATE The socket is not in a valid state, or not of
\r
318 * a valid type to perform the requsted operation.
\r
319 * \retval NFCSTATUS_NOT_INITIALISED Indicates stack is not yet initialized.
\r
320 * \retval NFCSTATUS_SHUTDOWN Shutdown in progress.
\r
321 * \retval NFCSTATUS_FAILED Operation failed.
\r
323 NFCSTATUS phFriNfc_LlcpTransport_SocketGetRemoteOptions(phFriNfc_LlcpTransport_Socket_t* pLlcpSocket,
\r
324 phLibNfc_Llcp_sSocketOptions_t* psRemoteOptions);
\r
328 * \ingroup grp_fri_nfc
\r
329 * \brief <b>Create a socket on a LLCP-connected device</b>.
\r
331 * This function creates a socket for a given LLCP link. Sockets can be of two types :
\r
332 * connection-oriented and connectionless. If the socket is connection-oriented, the caller
\r
333 * must provide a working buffer to the socket in order to handle incoming data. This buffer
\r
334 * must be large enough to fit the receive window (RW * MIU), the remaining space being
\r
335 * used as a linear buffer to store incoming data as a stream. Data will be readable later
\r
336 * using the phLibNfc_LlcpTransport_Recv function.
\r
337 * The options and working buffer are not required if the socket is used as a listening socket,
\r
338 * since it cannot be directly used for communication.
\r
340 * \param[in] pLlcpSocketTable A pointer to a table of PHFRINFC_LLCP_NB_SOCKET_DEFAULT sockets.
\r
341 * \param[in] eType The socket type.
\r
342 * \param[in] psOptions The options to be used with the socket.
\r
343 * \param[in] psWorkingBuffer A working buffer to be used by the library.
\r
344 * \param[out] pLlcpSocket A pointer to a socket pointer to be filled with a
\r
345 socket found on the socket table.
\r
346 * \param[in] pErr_Cb The callback to be called each time the socket
\r
348 * \param[in] pContext Upper layer context to be returned in the callback.
\r
350 * \retval NFCSTATUS_SUCCESS Operation successful.
\r
351 * \retval NFCSTATUS_INVALID_PARAMETER One or more of the supplied parameters
\r
352 * could not be properly interpreted.
\r
353 * \retval NFCSTATUS_BUFFER_TOO_SMALL The working buffer is too small for the MIU and RW
\r
354 * declared in the options.
\r
355 * \retval NFCSTATUS_INSUFFICIENT_RESOURCES No more socket handle available.
\r
356 * \retval NFCSTATUS_FAILED Operation failed.
\r
358 NFCSTATUS phFriNfc_LlcpTransport_Socket(phFriNfc_LlcpTransport_t *pLlcpSocketTable,
\r
359 phFriNfc_LlcpTransport_eSocketType_t eType,
\r
360 phFriNfc_LlcpTransport_sSocketOptions_t* psOptions,
\r
361 phNfc_sData_t* psWorkingBuffer,
\r
362 phFriNfc_LlcpTransport_Socket_t **pLlcpSocket,
\r
363 pphFriNfc_LlcpTransportSocketErrCb_t pErr_Cb,
\r
367 * \ingroup grp_fri_nfc
\r
368 * \brief <b>Close a socket on a LLCP-connected device</b>.
\r
370 * This function closes a LLCP socket previously created using phFriNfc_LlcpTransport_Socket.
\r
371 * If the socket was connected, it is first disconnected, and then closed.
\r
373 * \param[in] pLlcpSocket A pointer to a phFriNfc_LlcpTransport_Socket_t.
\r
375 * \retval NFCSTATUS_SUCCESS Operation successful.
\r
376 * \retval NFCSTATUS_INVALID_PARAMETER One or more of the supplied parameters
\r
377 * could not be properly interpreted.
\r
378 * \retval NFCSTATUS_FAILED Operation failed.
\r
380 NFCSTATUS phFriNfc_LlcpTransport_Close(phFriNfc_LlcpTransport_Socket_t* pLlcpSocket);
\r
384 * \ingroup grp_fri_nfc
\r
385 * \brief <b>Bind a socket to a local SAP</b>.
\r
387 * This function binds the socket to a local Service Access Point.
\r
389 * \param[out] pLlcpSocket A pointer to a phFriNfc_LlcpTransport_Socket_t.
\r
390 * \param[in] pConfigInfo A port number for a specific socket
\r
392 * \retval NFCSTATUS_SUCCESS Operation successful.
\r
393 * \retval NFCSTATUS_INVALID_PARAMETER One or more of the supplied parameters
\r
394 * could not be properly interpreted.
\r
395 * \retval NFCSTATUS_INVALID_STATE The socket is not in a valid state, or not of
\r
396 * a valid type to perform the requsted operation.
\r
397 * \retval NFCSTATUS_ALREADY_REGISTERED The selected SAP is already bound to another
\r
399 * \retval NFCSTATUS_FAILED Operation failed.
\r
401 NFCSTATUS phFriNfc_LlcpTransport_Bind(phFriNfc_LlcpTransport_Socket_t *pLlcpSocket,
\r
405 * \ingroup grp_fri_nfc
\r
406 * \brief <b>Listen for incoming connection requests on a socket</b>.
\r
408 * This function switches a socket into a listening state and registers a callback on
\r
409 * incoming connection requests. In this state, the socket is not able to communicate
\r
410 * directly. The listening state is only available for connection-oriented sockets
\r
411 * which are still not connected. The socket keeps listening until it is closed, and
\r
412 * thus can trigger several times the pListen_Cb callback.
\r
415 * \param[in] pLlcpSocket A pointer to a phFriNfc_LlcpTransport_Socket_t.
\r
416 * \param[in] psServiceName A pointer to a Service Name
\r
417 * \param[in] pListen_Cb The callback to be called each time the
\r
418 * socket receive a connection request.
\r
419 * \param[in] pContext Upper layer context to be returned in
\r
422 * \retval NFCSTATUS_SUCCESS Operation successful.
\r
423 * \retval NFCSTATUS_INVALID_PARAMETER One or more of the supplied parameters
\r
424 * could not be properly interpreted.
\r
425 * \retval NFCSTATUS_INVALID_STATE The socket is not in a valid state to switch
\r
426 * to listening state.
\r
427 * \retval NFCSTATUS_FAILED Operation failed.
\r
429 NFCSTATUS phFriNfc_LlcpTransport_Listen(phFriNfc_LlcpTransport_Socket_t* pLlcpSocket,
\r
430 phNfc_sData_t *psServiceName,
\r
431 pphFriNfc_LlcpTransportSocketListenCb_t pListen_Cb,
\r
434 * \ingroup grp_fri_nfc
\r
435 * \brief <b>Accept an incoming connection request for a socket</b>.
\r
437 * This functions allows the client to accept an incoming connection request.
\r
438 * It must be used with the socket provided within the listen callback. The socket
\r
439 * is implicitly switched to the connected state when the function is called.
\r
441 * \param[in] pLlcpSocket A pointer to a phFriNfc_LlcpTransport_Socket_t.
\r
442 * \param[in] psOptions The options to be used with the socket.
\r
443 * \param[in] psWorkingBuffer A working buffer to be used by the library.
\r
444 * \param[in] pErr_Cb The callback to be called each time the accepted socket
\r
446 * \param[in] pAccept_RspCb The callback to be called when the Accept operation is completed
\r
447 * \param[in] pContext Upper layer context to be returned in the callback.
\r
449 * \retval NFCSTATUS_SUCCESS Operation successful.
\r
450 * \retval NFCSTATUS_INVALID_PARAMETER One or more of the supplied parameters
\r
451 * could not be properly interpreted.
\r
452 * \retval NFCSTATUS_BUFFER_TOO_SMALL The working buffer is too small for the MIU and RW
\r
453 * declared in the options.
\r
454 * \retval NFCSTATUS_FAILED Operation failed.
\r
456 NFCSTATUS phFriNfc_LlcpTransport_Accept(phFriNfc_LlcpTransport_Socket_t* pLlcpSocket,
\r
457 phFriNfc_LlcpTransport_sSocketOptions_t* psOptions,
\r
458 phNfc_sData_t* psWorkingBuffer,
\r
459 pphFriNfc_LlcpTransportSocketErrCb_t pErr_Cb,
\r
460 pphFriNfc_LlcpTransportSocketAcceptCb_t pAccept_RspCb,
\r
464 * \ingroup grp_fri_nfc
\r
465 * \brief <b>Reject an incoming connection request for a socket</b>.
\r
467 * This functions allows the client to reject an incoming connection request.
\r
468 * It must be used with the socket provided within the listen callback. The socket
\r
469 * is implicitly closed when the function is called.
\r
471 * \param[in] pLlcpSocket A pointer to a phFriNfc_LlcpTransport_Socket_t.
\r
472 * \param[in] pReject_RspCb The callback to be called when the Reject operation is completed
\r
473 * \param[in] pContext Upper layer context to be returned in the callback.
\r
475 * \retval NFCSTATUS_SUCCESS Operation successful.
\r
476 * \retval NFCSTATUS_INVALID_PARAMETER One or more of the supplied parameters
\r
477 * could not be properly interpreted.
\r
478 * \retval NFCSTATUS_FAILED Operation failed.
\r
480 NFCSTATUS phFriNfc_LlcpTransport_Reject( phFriNfc_LlcpTransport_Socket_t* pLlcpSocket,
\r
481 pphFriNfc_LlcpTransportSocketRejectCb_t pReject_RspCb,
\r
484 * \ingroup grp_fri_nfc
\r
485 * \brief <b>Try to establish connection with a socket on a remote SAP</b>.
\r
487 * This function tries to connect to a given SAP on the remote peer. If the
\r
488 * socket is not bound to a local SAP, it is implicitly bound to a free SAP.
\r
490 * \param[in] pLlcpSocket A pointer to a phFriNfc_LlcpTransport_Socket_t.
\r
491 * \param[in] nSap The destination SAP to connect to.
\r
492 * \param[in] pConnect_RspCb The callback to be called when the connection
\r
493 * operation is completed.
\r
494 * \param[in] pContext Upper layer context to be returned in
\r
497 * \retval NFCSTATUS_SUCCESS Operation successful.
\r
498 * \retval NFCSTATUS_INVALID_PARAMETER One or more of the supplied parameters
\r
499 * could not be properly interpreted.
\r
500 * \retval NFCSTATUS_PENDING Connection operation is in progress,
\r
501 * pConnect_RspCb will be called upon completion.
\r
502 * \retval NFCSTATUS_INVALID_STATE The socket is not in a valid state, or not of
\r
503 * a valid type to perform the requsted operation.
\r
504 * \retval NFCSTATUS_FAILED Operation failed.
\r
506 NFCSTATUS phFriNfc_LlcpTransport_Connect( phFriNfc_LlcpTransport_Socket_t* pLlcpSocket,
\r
508 pphFriNfc_LlcpTransportSocketConnectCb_t pConnect_RspCb,
\r
512 * \ingroup grp_fri_nfc
\r
513 * \brief <b>Try to establish connection with a socket on a remote service, given its URI</b>.
\r
515 * This function tries to connect to a SAP designated by an URI. If the
\r
516 * socket is not bound to a local SAP, it is implicitly bound to a free SAP.
\r
518 * \param[in] pLlcpSocket A pointer to a phFriNfc_LlcpTransport_Socket_t.
\r
519 * \param[in] psUri The URI corresponding to the destination SAP to connect to.
\r
520 * \param[in] pConnect_RspCb The callback to be called when the connection
\r
521 * operation is completed.
\r
522 * \param[in] pContext Upper layer context to be returned in
\r
525 * \retval NFCSTATUS_SUCCESS Operation successful.
\r
526 * \retval NFCSTATUS_INVALID_PARAMETER One or more of the supplied parameters
\r
527 * could not be properly interpreted.
\r
528 * \retval NFCSTATUS_PENDING Connection operation is in progress,
\r
529 * pConnect_RspCb will be called upon completion.
\r
530 * \retval NFCSTATUS_INVALID_STATE The socket is not in a valid state, or not of
\r
531 * a valid type to perform the requsted operation.
\r
532 * \retval NFCSTATUS_NOT_INITIALISED Indicates stack is not yet initialized.
\r
533 * \retval NFCSTATUS_SHUTDOWN Shutdown in progress.
\r
534 * \retval NFCSTATUS_FAILED Operation failed.
\r
536 NFCSTATUS phFriNfc_LlcpTransport_ConnectByUri(phFriNfc_LlcpTransport_Socket_t* pLlcpSocket,
\r
537 phNfc_sData_t* psUri,
\r
538 pphFriNfc_LlcpTransportSocketConnectCb_t pConnect_RspCb,
\r
542 * \ingroup grp_lib_nfc
\r
543 * \brief <b>Disconnect a currently connected socket</b>.
\r
545 * This function initiates the disconnection of a previously connected socket.
\r
547 * \param[in] pLlcpSocket A pointer to a phFriNfc_LlcpTransport_Socket_t.
\r
548 * \param[in] pDisconnect_RspCb The callback to be called when the
\r
549 * operation is completed.
\r
550 * \param[in] pContext Upper layer context to be returned in
\r
553 * \retval NFCSTATUS_SUCCESS Operation successful.
\r
554 * \retval NFCSTATUS_INVALID_PARAMETER One or more of the supplied parameters
\r
555 * could not be properly interpreted.
\r
556 * \retval NFCSTATUS_PENDING Disconnection operation is in progress,
\r
557 * pDisconnect_RspCb will be called upon completion.
\r
558 * \retval NFCSTATUS_INVALID_STATE The socket is not in a valid state, or not of
\r
559 * a valid type to perform the requsted operation.
\r
560 * \retval NFCSTATUS_NOT_INITIALISED Indicates stack is not yet initialized.
\r
561 * \retval NFCSTATUS_SHUTDOWN Shutdown in progress.
\r
562 * \retval NFCSTATUS_FAILED Operation failed.
\r
564 NFCSTATUS phFriNfc_LlcpTransport_Disconnect(phFriNfc_LlcpTransport_Socket_t* pLlcpSocket,
\r
565 pphLibNfc_LlcpSocketDisconnectCb_t pDisconnect_RspCb,
\r
569 * \ingroup grp_fri_nfc
\r
570 * \brief <b>Send data on a socket</b>.
\r
572 * This function is used to write data on a socket. This function
\r
573 * can only be called on a connection-oriented socket which is already
\r
574 * in a connected state.
\r
577 * \param[in] hSocket Socket handle obtained during socket creation.
\r
578 * \param[in] psBuffer The buffer containing the data to send.
\r
579 * \param[in] pSend_RspCb The callback to be called when the
\r
580 * operation is completed.
\r
581 * \param[in] pContext Upper layer context to be returned in
\r
584 * \retval NFCSTATUS_SUCCESS Operation successful.
\r
585 * \retval NFCSTATUS_INVALID_PARAMETER One or more of the supplied parameters
\r
586 * could not be properly interpreted.
\r
587 * \retval NFCSTATUS_PENDING Reception operation is in progress,
\r
588 * pSend_RspCb will be called upon completion.
\r
589 * \retval NFCSTATUS_INVALID_STATE The socket is not in a valid state, or not of
\r
590 * a valid type to perform the requsted operation.
\r
591 * \retval NFCSTATUS_FAILED Operation failed.
\r
593 NFCSTATUS phFriNfc_LlcpTransport_Send(phFriNfc_LlcpTransport_Socket_t* pLlcpSocket,
\r
594 phNfc_sData_t* psBuffer,
\r
595 pphFriNfc_LlcpTransportSocketSendCb_t pSend_RspCb,
\r
599 * \ingroup grp_fri_nfc
\r
600 * \brief <b>Read data on a socket</b>.
\r
602 * This function is used to read data from a socket. It reads at most the
\r
603 * size of the reception buffer, but can also return less bytes if less bytes
\r
604 * are available. If no data is available, the function will be pending until
\r
605 * more data comes, and the response will be sent by the callback. This function
\r
606 * can only be called on a connection-oriented socket.
\r
609 * \param[in] hSocket Socket handle obtained during socket creation.
\r
610 * \param[in] psBuffer The buffer receiving the data.
\r
611 * \param[in] pRecv_RspCb The callback to be called when the
\r
612 * operation is completed.
\r
613 * \param[in] pContext Upper layer context to be returned in
\r
616 * \retval NFCSTATUS_SUCCESS Operation successful.
\r
617 * \retval NFCSTATUS_INVALID_PARAMETER One or more of the supplied parameters
\r
618 * could not be properly interpreted.
\r
619 * \retval NFCSTATUS_PENDING Reception operation is in progress,
\r
620 * pRecv_RspCb will be called upon completion.
\r
621 * \retval NFCSTATUS_INVALID_STATE The socket is not in a valid state, or not of
\r
622 * a valid type to perform the requsted operation.
\r
623 * \retval NFCSTATUS_FAILED Operation failed.
\r
625 NFCSTATUS phFriNfc_LlcpTransport_Recv( phFriNfc_LlcpTransport_Socket_t* pLlcpSocket,
\r
626 phNfc_sData_t* psBuffer,
\r
627 pphFriNfc_LlcpTransportSocketRecvCb_t pRecv_RspCb,
\r
633 * \ingroup grp_lib_nfc
\r
634 * \brief <b>Read data on a socket and get the source SAP</b>.
\r
636 * This function is the same as phLibNfc_Llcp_Recv, except that the callback includes
\r
637 * the source SAP. This functions can only be called on a connectionless socket.
\r
640 * \param[in] pLlcpSocket A pointer to a LlcpSocket created.
\r
641 * \param[in] psBuffer The buffer receiving the data.
\r
642 * \param[in] pRecv_RspCb The callback to be called when the
\r
643 * operation is completed.
\r
644 * \param[in] pContext Upper layer context to be returned in
\r
647 * \retval NFCSTATUS_SUCCESS Operation successful.
\r
648 * \retval NFCSTATUS_INVALID_PARAMETER One or more of the supplied parameters
\r
649 * could not be properly interpreted.
\r
650 * \retval NFCSTATUS_PENDING Reception operation is in progress,
\r
651 * pRecv_RspCb will be called upon completion.
\r
652 * \retval NFCSTATUS_INVALID_STATE The socket is not in a valid state, or not of
\r
653 * a valid type to perform the requsted operation.
\r
654 * \retval NFCSTATUS_NOT_INITIALISED Indicates stack is not yet initialized.
\r
655 * \retval NFCSTATUS_SHUTDOWN Shutdown in progress.
\r
656 * \retval NFCSTATUS_FAILED Operation failed.
\r
658 NFCSTATUS phFriNfc_LlcpTransport_RecvFrom( phFriNfc_LlcpTransport_Socket_t *pLlcpSocket,
\r
659 phNfc_sData_t* psBuffer,
\r
660 pphFriNfc_LlcpTransportSocketRecvFromCb_t pRecv_Cb,
\r
664 * \ingroup grp_fri_nfc
\r
665 * \brief <b>Send data on a socket to a given destination SAP</b>.
\r
667 * This function is used to write data on a socket to a given destination SAP.
\r
668 * This function can only be called on a connectionless socket.
\r
671 * \param[in] pLlcpSocket A pointer to a LlcpSocket created.
\r
672 * \param[in] nSap The destination SAP.
\r
673 * \param[in] psBuffer The buffer containing the data to send.
\r
674 * \param[in] pSend_RspCb The callback to be called when the
\r
675 * operation is completed.
\r
676 * \param[in] pContext Upper layer context to be returned in
\r
679 * \retval NFCSTATUS_SUCCESS Operation successful.
\r
680 * \retval NFCSTATUS_INVALID_PARAMETER One or more of the supplied parameters
\r
681 * could not be properly interpreted.
\r
682 * \retval NFCSTATUS_PENDING Reception operation is in progress,
\r
683 * pSend_RspCb will be called upon completion.
\r
684 * \retval NFCSTATUS_INVALID_STATE The socket is not in a valid state, or not of
\r
685 * a valid type to perform the requsted operation.
\r
686 * \retval NFCSTATUS_NOT_INITIALISED Indicates stack is not yet initialized.
\r
687 * \retval NFCSTATUS_SHUTDOWN Shutdown in progress.
\r
688 * \retval NFCSTATUS_FAILED Operation failed.
\r
690 NFCSTATUS phFriNfc_LlcpTransport_SendTo( phFriNfc_LlcpTransport_Socket_t *pLlcpSocket,
\r
692 phNfc_sData_t* psBuffer,
\r
693 pphFriNfc_LlcpTransportSocketSendCb_t pSend_RspCb,
\r
695 #endif /* PHFRINFC_LLCP_TRANSPORT_H */
\r