Home | History | Annotate | Download | only in include
      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 
     19 /******************************************************************************
     20  *
     21  *  This file contains the LLCP API definitions
     22  *
     23  ******************************************************************************/
     24 #ifndef LLCP_API_H
     25 #define LLCP_API_H
     26 
     27 #include "llcp_defs.h"
     28 #include "nfc_target.h"
     29 
     30 /*****************************************************************************
     31 **  Constants
     32 *****************************************************************************/
     33 /* Successfully done                */
     34 #define LLCP_STATUS_SUCCESS 0
     35 /* Failed without specific reason   */
     36 #define LLCP_STATUS_FAIL 1
     37 /* Data link is congested           */
     38 #define LLCP_STATUS_CONGESTED 2
     39 
     40 typedef uint8_t tLLCP_STATUS;
     41 
     42 #define LLCP_MIN_OFFSET                                             \
     43   (NCI_MSG_OFFSET_SIZE + NCI_DATA_HDR_SIZE + LLCP_PDU_HEADER_SIZE + \
     44    LLCP_SEQUENCE_SIZE)
     45 
     46 /* indication of failure to allocate data link resource */
     47 #define LLCP_INVALID_SAP 0xFF
     48 
     49 /*****************************************************************************
     50 **  Type Definitions
     51 *****************************************************************************/
     52 typedef struct {
     53   bool is_initiator;        /* TRUE if we are POLL mode */
     54   uint8_t max_payload_size; /* 64, 128, 192 or 254 */
     55   uint8_t waiting_time;
     56   uint8_t* p_gen_bytes;
     57   uint8_t gen_bytes_len;
     58 } tLLCP_ACTIVATE_CONFIG;
     59 
     60 typedef struct {
     61   uint16_t miu;                 /* Local receiving MIU      */
     62   uint8_t rw;                   /* Local receiving window   */
     63   char sn[LLCP_MAX_SN_LEN + 1]; /* Service name to connect  */
     64 } tLLCP_CONNECTION_PARAMS;
     65 
     66 /*********************************
     67 **  Callback Functions Prototypes
     68 **********************************/
     69 
     70 /* Link Management Callback Events */
     71 
     72 /* Fail to activate link    */
     73 #define LLCP_LINK_ACTIVATION_FAILED_EVT 0x00
     74 /* LLCP Link is activated   */
     75 #define LLCP_LINK_ACTIVATION_COMPLETE_EVT 0x01
     76 /* LLCP Link is deactivated */
     77 #define LLCP_LINK_DEACTIVATED_EVT 0x02
     78 /* First LLCP packet received from remote */
     79 #define LLCP_LINK_FIRST_PACKET_RECEIVED_EVT 0x03
     80 
     81 /* Link Management Callback Reasons */
     82 
     83 /* Success                                  */
     84 #define LLCP_LINK_SUCCESS 0x00
     85 /* Failed to agree version                  */
     86 #define LLCP_LINK_VERSION_FAILED 0x01
     87 /* Failed to parse received general bytes   */
     88 #define LLCP_LINK_BAD_GEN_BYTES 0x02
     89 /* internal error                           */
     90 #define LLCP_LINK_INTERNAL_ERROR 0x03
     91 /* Link has been deactivated by local       */
     92 #define LLCP_LINK_LOCAL_INITIATED 0x04
     93 /* Link has been deactivated by remote      */
     94 #define LLCP_LINK_REMOTE_INITIATED 0x05
     95 /* Link has been deactivated by timeout     */
     96 #define LLCP_LINK_TIMEOUT 0x06
     97 /* Link has been deactivated by frame error */
     98 #define LLCP_LINK_FRAME_ERROR 0x07
     99 /* RF link loss without any rx LLC PDU      */
    100 #define LLCP_LINK_RF_LINK_LOSS_NO_RX_LLC 0x08
    101 #define LLCP_LINK_RF_TRANSMISSION_ERR NFC_STATUS_RF_TRANSMISSION_ERR
    102 #define LLCP_LINK_RF_PROTOCOL_ERR NFC_STATUS_RF_PROTOCOL_ERR
    103 #define LLCP_LINK_RF_TIMEOUT NFC_STATUS_TIMEOUT
    104 #define LLCP_LINK_RF_LINK_LOSS_ERR NFC_STATUS_LINK_LOSS
    105 
    106 typedef void(tLLCP_LINK_CBACK)(uint8_t event, uint8_t reason);
    107 
    108 /* Minimum length of Gen Bytes for LLCP */
    109 /* In CE4 low power mode, NFCC can store up to 21 bytes */
    110 #define LLCP_MIN_GEN_BYTES 20
    111 
    112 /* Service Access Point (SAP) Callback Events */
    113 
    114 /* Received data on SAP         */
    115 #define LLCP_SAP_EVT_DATA_IND 0x00
    116 /* Connection request from peer */
    117 #define LLCP_SAP_EVT_CONNECT_IND 0x01
    118 /* Connection accepted by peer  */
    119 #define LLCP_SAP_EVT_CONNECT_RESP 0x02
    120 /* Received disconnect request  */
    121 #define LLCP_SAP_EVT_DISCONNECT_IND 0x03
    122 /* Received disconnect response */
    123 #define LLCP_SAP_EVT_DISCONNECT_RESP 0x04
    124 /* congested status is changed  */
    125 #define LLCP_SAP_EVT_CONGEST 0x05
    126 /* Change of LLCP Link status   */
    127 #define LLCP_SAP_EVT_LINK_STATUS 0x06
    128 /* tx queue is empty and all PDU is acked   */
    129 #define LLCP_SAP_EVT_TX_COMPLETE 0x07
    130 
    131 #define LLCP_LINK_TYPE_LOGICAL_DATA_LINK 0x01
    132 #define LLCP_LINK_TYPE_DATA_LINK_CONNECTION 0x02
    133 
    134 typedef struct {
    135   uint8_t event;      /* LLCP_SAP_EVT_DATA_IND        */
    136   uint8_t local_sap;  /* SAP of local device          */
    137   uint8_t remote_sap; /* SAP of remote device         */
    138   uint8_t link_type;  /* link type                    */
    139 } tLLCP_SAP_DATA_IND;
    140 
    141 typedef struct {
    142   uint8_t event;        /* LLCP_SAP_EVT_CONNECT_IND     */
    143   uint8_t server_sap;   /* SAP of local server          */
    144   uint8_t local_sap;    /* SAP of local device          */
    145   uint8_t remote_sap;   /* SAP of remote device         */
    146   uint16_t miu;         /* MIU of peer device           */
    147   uint8_t rw;           /* RW of peer device            */
    148   char* p_service_name; /* Service name (only for SDP)  */
    149 } tLLCP_SAP_CONNECT_IND;
    150 
    151 typedef struct {
    152   uint8_t event;      /* LLCP_SAP_EVT_CONNECT_RESP    */
    153   uint8_t local_sap;  /* SAP of local device          */
    154   uint8_t remote_sap; /* SAP of remote device         */
    155   uint16_t miu;       /* MIU of peer device           */
    156   uint8_t rw;         /* RW of peer device            */
    157 } tLLCP_SAP_CONNECT_RESP;
    158 
    159 #define LLCP_SAP_DISCONNECT_REASON_TIMEOUT 0x80
    160 typedef struct {
    161   uint8_t event;      /* LLCP_SAP_EVT_DISCONNECT_IND  */
    162   uint8_t local_sap;  /* SAP of local device          */
    163   uint8_t remote_sap; /* SAP of remote device         */
    164 } tLLCP_SAP_DISCONNECT_IND;
    165 
    166 typedef struct {
    167   uint8_t event;      /* LLCP_SAP_EVT_DISCONNECT_RESP */
    168   uint8_t local_sap;  /* SAP of local device          */
    169   uint8_t remote_sap; /* SAP of remote device         */
    170   uint8_t reason;     /* Reason of DM PDU if not timeout */
    171 } tLLCP_SAP_DISCONNECT_RESP;
    172 
    173 typedef struct {
    174   uint8_t event;      /* LLCP_SAP_EVT_CONGEST         */
    175   uint8_t local_sap;  /* SAP of local device          */
    176   uint8_t remote_sap; /* SAP of remote device         */
    177   bool is_congested;  /* TRUE if congested            */
    178   uint8_t link_type;  /* congested link type          */
    179 } tLLCP_SAP_CONGEST;
    180 
    181 typedef struct {
    182   uint8_t event;     /* LLCP_SAP_EVT_LINK_STATUS     */
    183   uint8_t local_sap; /* SAP of local device          */
    184   bool is_activated; /* TRUE if LLCP link is activated  */
    185   bool is_initiator; /* TRUE if local LLCP is initiator */
    186 } tLLCP_SAP_LINK_STATUS;
    187 
    188 typedef struct {
    189   uint8_t event;      /* LLCP_SAP_EVT_TX_COMPLETE     */
    190   uint8_t local_sap;  /* SAP of local device          */
    191   uint8_t remote_sap; /* SAP of remote device         */
    192 } tLLCP_SAP_TX_COMPLETE;
    193 
    194 typedef struct {
    195   uint8_t event;     /* event                        */
    196   uint8_t local_sap; /* SAP of local device          */
    197 } tLLCP_SAP_HEADER;
    198 
    199 typedef union {
    200   tLLCP_SAP_HEADER hdr;                      /* common header                */
    201   tLLCP_SAP_DATA_IND data_ind;               /* LLCP_SAP_EVT_DATA_IND        */
    202   tLLCP_SAP_CONNECT_IND connect_ind;         /* LLCP_SAP_EVT_CONNECT_IND     */
    203   tLLCP_SAP_CONNECT_RESP connect_resp;       /* LLCP_SAP_EVT_CONNECT_RESP    */
    204   tLLCP_SAP_DISCONNECT_IND disconnect_ind;   /* LLCP_SAP_EVT_DISCONNECT_IND  */
    205   tLLCP_SAP_DISCONNECT_RESP disconnect_resp; /* LLCP_SAP_EVT_DISCONNECT_RESP */
    206   tLLCP_SAP_CONGEST congest;                 /* LLCP_SAP_EVT_CONGEST         */
    207   tLLCP_SAP_LINK_STATUS link_status;         /* LLCP_SAP_EVT_LINK_STATUS     */
    208   tLLCP_SAP_TX_COMPLETE tx_complete;         /* LLCP_SAP_EVT_TX_COMPLETE     */
    209 } tLLCP_SAP_CBACK_DATA;
    210 
    211 typedef void(tLLCP_APP_CBACK)(tLLCP_SAP_CBACK_DATA* p_data);
    212 
    213 /* Service Discovery Callback */
    214 
    215 typedef void(tLLCP_SDP_CBACK)(uint8_t tid, uint8_t remote_sap);
    216 
    217 /* LLCP DTA Callback - notify DTA responded SNL for connectionless echo service
    218  */
    219 
    220 typedef void(tLLCP_DTA_CBACK)(void);
    221 
    222 /*****************************************************************************
    223 **  External Function Declarations
    224 *****************************************************************************/
    225 #ifdef __cplusplus
    226 extern "C" {
    227 #endif
    228 
    229 /*******************************************************************************
    230 **
    231 ** Function         LLCP_SetConfig
    232 **
    233 ** Description      Set configuration parameters for LLCP
    234 **                  - Local Link MIU
    235 **                  - Option parameter
    236 **                  - Waiting Time Index
    237 **                  - Local Link Timeout
    238 **                  - Inactivity Timeout as initiator role
    239 **                  - Inactivity Timeout as target role
    240 **                  - Delay SYMM response
    241 **                  - Data link connection timeout
    242 **                  - Delay timeout to send first PDU as initiator
    243 **
    244 ** Returns          void
    245 **
    246 *******************************************************************************/
    247 extern void LLCP_SetConfig(uint16_t link_miu, uint8_t opt, uint8_t wt,
    248                            uint16_t link_timeout, uint16_t inact_timeout_init,
    249                            uint16_t inact_timeout_target, uint16_t symm_delay,
    250                            uint16_t data_link_timeout,
    251                            uint16_t delay_first_pdu_timeout);
    252 
    253 /*******************************************************************************
    254 **
    255 ** Function         LLCP_GetConfig
    256 **
    257 ** Description      Get configuration parameters for LLCP
    258 **                  - Local Link MIU
    259 **                  - Option parameter
    260 **                  - Response Waiting Time Index
    261 **                  - Local Link Timeout
    262 **                  - Inactivity Timeout as initiator role
    263 **                  - Inactivity Timeout as target role
    264 **                  - Delay SYMM response
    265 **                  - Data link connection timeout
    266 **                  - Delay timeout to send first PDU as initiator
    267 **
    268 ** Returns          void
    269 **
    270 *******************************************************************************/
    271 extern void LLCP_GetConfig(uint16_t* p_link_miu, uint8_t* p_opt, uint8_t* p_wt,
    272                            uint16_t* p_link_timeout,
    273                            uint16_t* p_inact_timeout_init,
    274                            uint16_t* p_inact_timeout_target,
    275                            uint16_t* p_symm_delay,
    276                            uint16_t* p_data_link_timeout,
    277                            uint16_t* p_delay_first_pdu_timeout);
    278 
    279 /*******************************************************************************
    280 **
    281 ** Function         LLCP_GetDiscoveryConfig
    282 **
    283 ** Description      Returns discovery config for LLCP MAC link activation
    284 **                  This function is called to get general bytes for
    285 **                  NFC_PMID_ATR_REQ_GEN_BYTES or NFC_PMID_ATR_RES_GEN_BYTES
    286 **                  before starting discovery.
    287 **
    288 **                  wt:Waiting time 0 - 8, only for listen
    289 **                  p_gen_bytes: pointer to store LLCP magic number and
    290 **                               paramters
    291 **                  p_gen_bytes_len: length of buffer for gen bytes as input
    292 **                                   (NOTE:it must be bigger than
    293 **                                   LLCP_MIN_GEN_BYTES) actual gen bytes
    294 **                                   size as output
    295 **
    296 **                  Restrictions on the use of ISO 18092
    297 **                  1. The DID features shall not be used.
    298 **                  2. the NAD features shall not be used.
    299 **                  3. Frame waiting time extentions (WTX) shall not be used.
    300 **
    301 ** Returns          None
    302 **
    303 *******************************************************************************/
    304 extern void LLCP_GetDiscoveryConfig(uint8_t* p_wt, uint8_t* p_gen_bytes,
    305                                     uint8_t* p_gen_bytes_len);
    306 
    307 /*******************************************************************************
    308 **
    309 ** Function         LLCP_ActivateLink
    310 **
    311 ** Description      This function will activate LLCP link with LR, WT and Gen
    312 **                  Bytes in activation NTF from NFCC.
    313 **
    314 **                  LLCP_LINK_ACTIVATION_COMPLETE_EVT will be returned through
    315 **                  callback function if successful.
    316 **                  Otherwise, LLCP_LINK_ACTIVATION_FAILED_EVT will be returned.
    317 **
    318 ** Returns          LLCP_STATUS_SUCCESS if success
    319 **
    320 *******************************************************************************/
    321 extern tLLCP_STATUS LLCP_ActivateLink(tLLCP_ACTIVATE_CONFIG config,
    322                                       tLLCP_LINK_CBACK* p_link_cback);
    323 
    324 /*******************************************************************************
    325 **
    326 ** Function         LLCP_DeactivateLink
    327 **
    328 ** Description      Deactivate LLCP link
    329 **
    330 **                  LLCP_LINK_DEACTIVATED_EVT will be returned through callback
    331 **                  when LLCP link is deactivated. Then NFC link may be
    332 **                  deactivated.
    333 **
    334 ** Returns          LLCP_STATUS_SUCCESS if success
    335 **
    336 *******************************************************************************/
    337 extern tLLCP_STATUS LLCP_DeactivateLink(void);
    338 
    339 /*******************************************************************************
    340 **
    341 ** Function         LLCP_RegisterServer
    342 **
    343 ** Description      Register server and callback function
    344 **
    345 **                  reg_sap : Well-Known SAP except LM and SDP (0x02 - 0x0F)
    346 **                            Advertized by SDP (0x10 - 0x1F)
    347 **                            LLCP_INVALID_SAP, LLCP will allocate between 0x10
    348 **                            and 0x1F
    349 **                  link_type : LLCP_LINK_TYPE_LOGICAL_DATA_LINK
    350 **                              and/or LLCP_LINK_TYPE_DATA_LINK_CONNECTION
    351 **                  p_service_name : Null-terminated string up to
    352 **                                   LLCP_MAX_SN_LEN
    353 **
    354 ** Returns          SAP between 0x02 and 0x1F, if success
    355 **                  LLCP_INVALID_SAP, otherwise
    356 **
    357 *******************************************************************************/
    358 extern uint8_t LLCP_RegisterServer(uint8_t reg_sap, uint8_t link_type,
    359                                    char* p_service_name,
    360                                    tLLCP_APP_CBACK* p_sap_cback);
    361 
    362 /*******************************************************************************
    363 **
    364 ** Function         LLCP_RegisterClient
    365 **
    366 ** Description      Register client and callback function
    367 **
    368 **                  link_type : LLCP_LINK_TYPE_LOGICAL_DATA_LINK
    369 **                              and/or LLCP_LINK_TYPE_DATA_LINK_CONNECTION
    370 **
    371 ** Returns          SAP between 0x20 and 0x3F, if success
    372 **                  LLCP_INVALID_SAP, otherwise
    373 **
    374 *******************************************************************************/
    375 extern uint8_t LLCP_RegisterClient(uint8_t link_type,
    376                                    tLLCP_APP_CBACK* p_sap_cback);
    377 
    378 /*******************************************************************************
    379 **
    380 ** Function         LLCP_Deregister
    381 **
    382 ** Description      Deregister server or client
    383 **
    384 **
    385 ** Returns          LLCP_STATUS_SUCCESS if success
    386 **
    387 *******************************************************************************/
    388 extern tLLCP_STATUS LLCP_Deregister(uint8_t sap);
    389 
    390 /*******************************************************************************
    391 **
    392 ** Function         LLCP_IsLogicalLinkCongested
    393 **
    394 ** Description      Check if logical link is congested
    395 **
    396 **
    397 ** Returns          TRUE if congested
    398 **
    399 *******************************************************************************/
    400 extern bool LLCP_IsLogicalLinkCongested(uint8_t local_sap,
    401                                         uint8_t num_pending_ui_pdu,
    402                                         uint8_t total_pending_ui_pdu,
    403                                         uint8_t total_pending_i_pdu);
    404 
    405 /*******************************************************************************
    406 **
    407 ** Function         LLCP_SendUI
    408 **
    409 ** Description      Send connnectionless data to DSAP
    410 **
    411 **
    412 ** Returns          LLCP_STATUS_SUCCESS if success
    413 **                  LLCP_STATUS_CONGESTED if logical link is congested
    414 **                  LLCP_STATUS_FAIL, otherwise
    415 **
    416 *******************************************************************************/
    417 extern tLLCP_STATUS LLCP_SendUI(uint8_t ssap, uint8_t dsap, NFC_HDR* p_buf);
    418 
    419 /*******************************************************************************
    420 **
    421 ** Function         LLCP_ReadLogicalLinkData
    422 **
    423 ** Description      Read information of UI PDU for local SAP
    424 **
    425 **                  - Remote SAP who sent UI PDU is returned.
    426 **                  - Information of UI PDU up to max_data_len is copied into
    427 **                    p_data.
    428 **                  - Information of next UI PDU is not concatenated.
    429 **                  - Recommended max_data_len is link MIU of local device
    430 **
    431 ** Returns          TRUE if more information of UI PDU or more UI PDU in queue
    432 **
    433 *******************************************************************************/
    434 extern bool LLCP_ReadLogicalLinkData(uint8_t local_sap, uint32_t max_data_len,
    435                                      uint8_t* p_remote_sap,
    436                                      uint32_t* p_data_len, uint8_t* p_data);
    437 
    438 /*******************************************************************************
    439 **
    440 ** Function         LLCP_FlushLogicalLinkRxData
    441 **
    442 ** Description      Discard received data in logical data link of local SAP
    443 **
    444 **
    445 ** Returns          length of data flushed
    446 **
    447 *******************************************************************************/
    448 extern uint32_t LLCP_FlushLogicalLinkRxData(uint8_t local_sap);
    449 
    450 /*******************************************************************************
    451 **
    452 ** Function         LLCP_ConnectReq
    453 **
    454 ** Description      Create data link connection between registered SAP and DSAP
    455 **                  in peer LLCP,
    456 **
    457 **
    458 ** Returns          LLCP_STATUS_SUCCESS if success
    459 **                  LLCP_STATUS_FAIL, otherwise
    460 **
    461 *******************************************************************************/
    462 extern tLLCP_STATUS LLCP_ConnectReq(uint8_t reg_sap, uint8_t dsap,
    463                                     tLLCP_CONNECTION_PARAMS* p_params);
    464 
    465 /*******************************************************************************
    466 **
    467 ** Function         LLCP_ConnectCfm
    468 **
    469 ** Description      Accept connection request from peer LLCP
    470 **
    471 **
    472 ** Returns          LLCP_STATUS_SUCCESS if success
    473 **                  LLCP_STATUS_FAIL, otherwise
    474 **
    475 *******************************************************************************/
    476 extern tLLCP_STATUS LLCP_ConnectCfm(uint8_t local_sap, uint8_t remote_sap,
    477                                     tLLCP_CONNECTION_PARAMS* p_params);
    478 
    479 /*******************************************************************************
    480 **
    481 ** Function         LLCP_ConnectReject
    482 **
    483 ** Description      Reject connection request from peer LLCP
    484 **
    485 **                  reason : LLCP_SAP_DM_REASON_APP_REJECTED
    486 **                           LLCP_SAP_DM_REASON_PERM_REJECT_THIS
    487 **                           LLCP_SAP_DM_REASON_PERM_REJECT_ANY
    488 **                           LLCP_SAP_DM_REASON_TEMP_REJECT_THIS
    489 **                           LLCP_SAP_DM_REASON_TEMP_REJECT_ANY
    490 **
    491 ** Returns          LLCP_STATUS_SUCCESS if success
    492 **                  LLCP_STATUS_FAIL, otherwise
    493 **
    494 *******************************************************************************/
    495 extern tLLCP_STATUS LLCP_ConnectReject(uint8_t local_sap, uint8_t remote_sap,
    496                                        uint8_t reason);
    497 
    498 /*******************************************************************************
    499 **
    500 ** Function         LLCP_IsDataLinkCongested
    501 **
    502 ** Description      Check if data link is congested
    503 **
    504 **
    505 ** Returns          TRUE if congested
    506 **
    507 *******************************************************************************/
    508 extern bool LLCP_IsDataLinkCongested(uint8_t local_sap, uint8_t remote_sap,
    509                                      uint8_t num_pending_i_pdu,
    510                                      uint8_t total_pending_ui_pdu,
    511                                      uint8_t total_pending_i_pdu);
    512 
    513 /*******************************************************************************
    514 **
    515 ** Function         LLCP_SendData
    516 **
    517 ** Description      Send connection-oriented data
    518 **
    519 **
    520 ** Returns          LLCP_STATUS_SUCCESS if success
    521 **                  LLCP_STATUS_CONGESTED if data link is congested
    522 **
    523 *******************************************************************************/
    524 extern tLLCP_STATUS LLCP_SendData(uint8_t local_sap, uint8_t remote_sap,
    525                                   NFC_HDR* p_buf);
    526 
    527 /*******************************************************************************
    528 **
    529 ** Function         LLCP_ReadDataLinkData
    530 **
    531 ** Description      Read information of I PDU for data link connection
    532 **
    533 **                  - Information of I PDU up to max_data_len is copied into
    534 **                    p_data.
    535 **                  - Information of next I PDU is not concatenated.
    536 **                  - Recommended max_data_len is data link connection MIU of
    537 **                    local end point
    538 **
    539 ** Returns          TRUE if more data in queue
    540 **
    541 *******************************************************************************/
    542 extern bool LLCP_ReadDataLinkData(uint8_t local_sap, uint8_t remote_sap,
    543                                   uint32_t max_data_len, uint32_t* p_data_len,
    544                                   uint8_t* p_data);
    545 
    546 /*******************************************************************************
    547 **
    548 ** Function         LLCP_FlushDataLinkRxData
    549 **
    550 ** Description      Discard received data in data link connection
    551 **
    552 **
    553 ** Returns          length of rx data flushed
    554 **
    555 *******************************************************************************/
    556 extern uint32_t LLCP_FlushDataLinkRxData(uint8_t local_sap, uint8_t remote_sap);
    557 
    558 /*******************************************************************************
    559 **
    560 ** Function         LLCP_DisconnectReq
    561 **
    562 ** Description      Disconnect data link
    563 **                  discard any pending data if flush is set to TRUE
    564 **
    565 ** Returns          LLCP_STATUS_SUCCESS if success
    566 **
    567 *******************************************************************************/
    568 extern tLLCP_STATUS LLCP_DisconnectReq(uint8_t local_sap, uint8_t remote_sap,
    569                                        bool flush);
    570 
    571 /*******************************************************************************
    572 **
    573 ** Function         LLCP_SetTxCompleteNtf
    574 **
    575 ** Description      This function is called to get LLCP_SAP_EVT_TX_COMPLETE
    576 **                  when Tx queue is empty and all PDU is acked.
    577 **                  This is one time event, so upper layer shall call this
    578 **                  function again to get next LLCP_SAP_EVT_TX_COMPLETE.
    579 **
    580 ** Returns          LLCP_STATUS_SUCCESS if success
    581 **
    582 *******************************************************************************/
    583 extern tLLCP_STATUS LLCP_SetTxCompleteNtf(uint8_t local_sap,
    584                                           uint8_t remote_sap);
    585 
    586 /*******************************************************************************
    587 **
    588 ** Function         LLCP_SetLocalBusyStatus
    589 **
    590 ** Description      Set local busy status
    591 **
    592 **
    593 ** Returns          LLCP_STATUS_SUCCESS if success
    594 **
    595 *******************************************************************************/
    596 extern tLLCP_STATUS LLCP_SetLocalBusyStatus(uint8_t local_sap,
    597                                             uint8_t remote_sap, bool is_busy);
    598 
    599 /*******************************************************************************
    600 **
    601 ** Function         LLCP_GetRemoteWKS
    602 **
    603 ** Description      Return well-known service bitmap of connected device
    604 **
    605 **
    606 ** Returns          WKS bitmap if success
    607 **
    608 *******************************************************************************/
    609 extern uint16_t LLCP_GetRemoteWKS(void);
    610 
    611 /*******************************************************************************
    612 **
    613 ** Function         LLCP_GetRemoteLSC
    614 **
    615 ** Description      Return link service class of connected device
    616 **
    617 **
    618 ** Returns          link service class
    619 **
    620 *******************************************************************************/
    621 extern uint8_t LLCP_GetRemoteLSC(void);
    622 
    623 /*******************************************************************************
    624 **
    625 ** Function         LLCP_GetRemoteVersion
    626 **
    627 ** Description      Return LLCP version of connected device
    628 **
    629 **
    630 ** Returns          LLCP version
    631 **
    632 *******************************************************************************/
    633 extern uint8_t LLCP_GetRemoteVersion(void);
    634 
    635 /*******************************************************************************
    636 **
    637 ** Function         LLCP_GetLinkMIU
    638 **
    639 ** Description      Return local and remote link MIU
    640 **
    641 **
    642 ** Returns          None
    643 **
    644 *******************************************************************************/
    645 extern void LLCP_GetLinkMIU(uint16_t* p_local_link_miu,
    646                             uint16_t* p_remote_link_miu);
    647 
    648 /*******************************************************************************
    649 **
    650 ** Function         LLCP_DiscoverService
    651 **
    652 ** Description      Return SAP of service name in connected device through
    653 **                  callback
    654 **
    655 ** Returns          LLCP_STATUS_SUCCESS if success
    656 **
    657 *******************************************************************************/
    658 extern tLLCP_STATUS LLCP_DiscoverService(char* p_name, tLLCP_SDP_CBACK* p_cback,
    659                                          uint8_t* p_tid);
    660 
    661 /*******************************************************************************
    662 **
    663 ** Function         LLCP_SetTraceLevel
    664 **
    665 ** Description      This function sets the trace level for LLCP.  If called with
    666 **                  a value of 0xFF, it simply returns the current trace level.
    667 **
    668 ** Returns          The new or current trace level
    669 **
    670 *******************************************************************************/
    671 extern uint8_t LLCP_SetTraceLevel(uint8_t new_level);
    672 
    673 #if (LLCP_TEST_INCLUDED == TRUE)
    674 /*******************************************************************************
    675 **
    676 ** Function         LLCP_SetTestParams
    677 **
    678 ** Description      Set test parameters for LLCP
    679 **
    680 ** Returns          void
    681 **
    682 *******************************************************************************/
    683 extern void LLCP_SetTestParams(uint8_t version, uint16_t wks);
    684 #endif
    685 
    686 #ifdef __cplusplus
    687 }
    688 #endif
    689 
    690 #endif /* LLCP_API_H */
    691