1/*
2 * Copyright (C) 2010 NXP Semiconductors
3 *
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
7 *
8 *      http://www.apache.org/licenses/LICENSE-2.0
9 *
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.
15 */
16
17/**
18 * \file  phFriNfc_LlcpTransport_Connectionless.h
19 * \brief
20 *
21 * Project: NFC-FRI
22 *
23 */
24#ifndef PHFRINFC_LLCP_TRANSPORT_CONNECTIONLESS_H
25#define PHFRINFC_LLCP_TRANSPORT_CONNECTIONLESS_H
26/*include files*/
27#include <phNfcTypes.h>
28#include <phNfcStatus.h>
29#include <phFriNfc.h>
30
31#include <phFriNfc_Llcp.h>
32
33
34void Handle_Connectionless_IncommingFrame(phFriNfc_LlcpTransport_t      *pLlcpTransport,
35                                          phNfc_sData_t                 *psData,
36                                          uint8_t                       dsap,
37                                          uint8_t                       ssap);
38
39NFCSTATUS phFriNfc_LlcpTransport_Connectionless_HandlePendingOperations(phFriNfc_LlcpTransport_Socket_t *pSocket);
40
41/**
42* \ingroup grp_fri_nfc
43* \brief <b>Close a socket on a LLCP-connectionless device</b>.
44*
45* This function closes a LLCP socket previously created using phFriNfc_LlcpTransport_Socket.
46*
47* \param[in]  pLlcpSocket                    A pointer to a phFriNfc_LlcpTransport_Socket_t.
48
49* \retval NFCSTATUS_SUCCESS                  Operation successful.
50* \retval NFCSTATUS_INVALID_PARAMETER        One or more of the supplied parameters
51*                                            could not be properly interpreted.
52* \retval NFCSTATUS_FAILED                   Operation failed.
53*/
54NFCSTATUS phFriNfc_LlcpTransport_Connectionless_Close(phFriNfc_LlcpTransport_Socket_t*   pLlcpSocket);
55
56/**
57* \ingroup grp_fri_nfc
58* \brief <b>Send data on a socket to a given destination SAP</b>.
59*
60* This function is used to write data on a socket to a given destination SAP.
61* This function can only be called on a connectionless socket.
62*
63*
64* \param[in]  pLlcpSocket        A pointer to a LlcpSocket created.
65* \param[in]  nSap               The destination SAP.
66* \param[in]  psBuffer           The buffer containing the data to send.
67* \param[in]  pSend_RspCb        The callback to be called when the
68*                                operation is completed.
69* \param[in]  pContext           Upper layer context to be returned in
70*                                the callback.
71*
72* \retval NFCSTATUS_SUCCESS                  Operation successful.
73* \retval NFCSTATUS_INVALID_PARAMETER        One or more of the supplied parameters
74*                                            could not be properly interpreted.
75* \retval NFCSTATUS_PENDING                  Reception operation is in progress,
76*                                            pSend_RspCb will be called upon completion.
77* \retval NFCSTATUS_INVALID_STATE            The socket is not in a valid state, or not of
78*                                            a valid type to perform the requsted operation.
79* \retval NFCSTATUS_NOT_INITIALISED          Indicates stack is not yet initialized.
80* \retval NFCSTATUS_SHUTDOWN                 Shutdown in progress.
81* \retval NFCSTATUS_FAILED                   Operation failed.
82*/
83NFCSTATUS phFriNfc_LlcpTransport_Connectionless_SendTo(phFriNfc_LlcpTransport_Socket_t             *pLlcpSocket,
84                                                       uint8_t                                     nSap,
85                                                       phNfc_sData_t*                              psBuffer,
86                                                       pphFriNfc_LlcpTransportSocketSendCb_t       pSend_RspCb,
87                                                       void*                                       pContext);
88
89 /**
90* \ingroup grp_lib_nfc
91* \brief <b>Read data on a socket and get the source SAP</b>.
92*
93* This function is the same as phLibNfc_Llcp_Recv, except that the callback includes
94* the source SAP. This functions can only be called on a connectionless socket.
95*
96*
97* \param[in]  pLlcpSocket        A pointer to a LlcpSocket created.
98* \param[in]  psBuffer           The buffer receiving the data.
99* \param[in]  pRecv_RspCb        The callback to be called when the
100*                                operation is completed.
101* \param[in]  pContext           Upper layer context to be returned in
102*                                the callback.
103*
104* \retval NFCSTATUS_SUCCESS                  Operation successful.
105* \retval NFCSTATUS_INVALID_PARAMETER        One or more of the supplied parameters
106*                                            could not be properly interpreted.
107* \retval NFCSTATUS_PENDING                  Reception operation is in progress,
108*                                            pRecv_RspCb will be called upon completion.
109* \retval NFCSTATUS_INVALID_STATE            The socket is not in a valid state, or not of
110*                                            a valid type to perform the requsted operation.
111* \retval NFCSTATUS_NOT_INITIALISED          Indicates stack is not yet initialized.
112* \retval NFCSTATUS_SHUTDOWN                 Shutdown in progress.
113* \retval NFCSTATUS_FAILED                   Operation failed.
114*/
115NFCSTATUS phLibNfc_LlcpTransport_Connectionless_RecvFrom(phFriNfc_LlcpTransport_Socket_t                   *pLlcpSocket,
116                                                         phNfc_sData_t*                                    psBuffer,
117                                                         pphFriNfc_LlcpTransportSocketRecvFromCb_t         pRecv_Cb,
118                                                         void*                                             pContext);
119
120#endif /* PHFRINFC_LLCP_TRANSPORT_CONNECTIONLESS_H */
121