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