Home | History | Annotate | Download | only in src
      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 
     34 void Handle_Connectionless_IncommingFrame(phFriNfc_LlcpTransport_t      *pLlcpTransport,
     35                                           phNfc_sData_t                 *psData,
     36                                           uint8_t                       dsap,
     37                                           uint8_t                       ssap);
     38 
     39 /**
     40 * \ingroup grp_fri_nfc
     41 * \brief <b>Close a socket on a LLCP-connectionless device</b>.
     42 *
     43 * This function closes a LLCP socket previously created using phFriNfc_LlcpTransport_Socket.
     44 *
     45 * \param[in]  pLlcpSocket                    A pointer to a phFriNfc_LlcpTransport_Socket_t.
     46 
     47 * \retval NFCSTATUS_SUCCESS                  Operation successful.
     48 * \retval NFCSTATUS_INVALID_PARAMETER        One or more of the supplied parameters
     49 *                                            could not be properly interpreted.
     50 * \retval NFCSTATUS_FAILED                   Operation failed.
     51 */
     52 NFCSTATUS phFriNfc_LlcpTransport_Connectionless_Close(phFriNfc_LlcpTransport_Socket_t*   pLlcpSocket);
     53 
     54 /**
     55 * \ingroup grp_fri_nfc
     56 * \brief <b>Send data on a socket to a given destination SAP</b>.
     57 *
     58 * This function is used to write data on a socket to a given destination SAP.
     59 * This function can only be called on a connectionless socket.
     60 *
     61 *
     62 * \param[in]  pLlcpSocket        A pointer to a LlcpSocket created.
     63 * \param[in]  nSap               The destination SAP.
     64 * \param[in]  psBuffer           The buffer containing the data to send.
     65 * \param[in]  pSend_RspCb        The callback to be called when the
     66 *                                operation is completed.
     67 * \param[in]  pContext           Upper layer context to be returned in
     68 *                                the callback.
     69 *
     70 * \retval NFCSTATUS_SUCCESS                  Operation successful.
     71 * \retval NFCSTATUS_INVALID_PARAMETER        One or more of the supplied parameters
     72 *                                            could not be properly interpreted.
     73 * \retval NFCSTATUS_PENDING                  Reception operation is in progress,
     74 *                                            pSend_RspCb will be called upon completion.
     75 * \retval NFCSTATUS_INVALID_STATE            The socket is not in a valid state, or not of
     76 *                                            a valid type to perform the requsted operation.
     77 * \retval NFCSTATUS_NOT_INITIALISED          Indicates stack is not yet initialized.
     78 * \retval NFCSTATUS_SHUTDOWN                 Shutdown in progress.
     79 * \retval NFCSTATUS_FAILED                   Operation failed.
     80 */
     81 NFCSTATUS phFriNfc_LlcpTransport_Connectionless_SendTo(phFriNfc_LlcpTransport_Socket_t             *pLlcpSocket,
     82                                                        uint8_t                                     nSap,
     83                                                        phNfc_sData_t*                              psBuffer,
     84                                                        pphFriNfc_LlcpTransportSocketSendCb_t       pSend_RspCb,
     85                                                        void*                                       pContext);
     86 
     87  /**
     88 * \ingroup grp_lib_nfc
     89 * \brief <b>Read data on a socket and get the source SAP</b>.
     90 *
     91 * This function is the same as phLibNfc_Llcp_Recv, except that the callback includes
     92 * the source SAP. This functions can only be called on a connectionless socket.
     93 *
     94 *
     95 * \param[in]  pLlcpSocket        A pointer to a LlcpSocket created.
     96 * \param[in]  psBuffer           The buffer receiving the data.
     97 * \param[in]  pRecv_RspCb        The callback to be called when the
     98 *                                operation is completed.
     99 * \param[in]  pContext           Upper layer context to be returned in
    100 *                                the callback.
    101 *
    102 * \retval NFCSTATUS_SUCCESS                  Operation successful.
    103 * \retval NFCSTATUS_INVALID_PARAMETER        One or more of the supplied parameters
    104 *                                            could not be properly interpreted.
    105 * \retval NFCSTATUS_PENDING                  Reception operation is in progress,
    106 *                                            pRecv_RspCb will be called upon completion.
    107 * \retval NFCSTATUS_INVALID_STATE            The socket is not in a valid state, or not of
    108 *                                            a valid type to perform the requsted operation.
    109 * \retval NFCSTATUS_NOT_INITIALISED          Indicates stack is not yet initialized.
    110 * \retval NFCSTATUS_SHUTDOWN                 Shutdown in progress.
    111 * \retval NFCSTATUS_FAILED                   Operation failed.
    112 */
    113 NFCSTATUS phLibNfc_LlcpTransport_Connectionless_RecvFrom(phFriNfc_LlcpTransport_Socket_t                   *pLlcpSocket,
    114                                                          phNfc_sData_t*                                    psBuffer,
    115                                                          pphFriNfc_LlcpTransportSocketRecvFromCb_t         pRecv_Cb,
    116                                                          void*                                             pContext);
    117 
    118 #endif /* PHFRINFC_LLCP_TRANSPORT_CONNECTIONLESS_H */