6 Replies Latest reply on Mar 18, 2015 3:29 AM by user_2195381

    Could you tell me how to use the leatt_sendErrResponse ?

    user_2195381

      Could you tell how to use the api : void leatt_sendErrResponse(INT32 errCode, INT32 reqOpcode, INT32 handleInError ) ( be defined

      in the leatt.h)

       

      I don't know errCode, reqOpcode, handleInError ? no any description in leatt.h.

      I quess

      errCode =

      #define LEATT_ERR_CODE_INVALID_HANDLE                      0x01

      #define LEATT_ERR_CODE_READ_NOT_PERMITTED                  0x02

      ...........

      reqOpcode =

      #define LEATT_OPCODE_ERR_RSP                                 0x1

      #define LEATT_OPCODE_EXCHANGE_MTU_REQ                        0x2

      .........

       

      but whis is handleInError ??????


      In our production need a read gatt character call back function

      and a error response.

       

       

       

      xxx_create(void)

      {

      .....

           lel2cap_regConnLessHandler(4, homedoor_l2cap_att_data_handler); /* home_door_l2cap_att_data_handler is l2cap att data access call                                                                                                               back function */

      ...........

      }

      static void homedoor_l2cap_att_data_handler(UINT8 *l2capHdr)

      {

          uint8 opcode = (LEATT_PDU_HDR*) (l2capHdr + 4);

          UINT16 *handle = (UINT16 *)(l2capHdr + 5);

          UINT8 status = 0;

       

          switch(opcode)

          {

              case LEATT_OPCODE_READ_REQ:

                  status = SystemUtilsReadAttrCB(handle); // is my private GATT sevice and character read call back function

                  break;

          }  

          if (status == LEATT_ERR_CODE_NO_ERROR)

          {

              leatt_l2capHandler(l2capHdr); // continue to process GATT service

          }

          else

          {    // status = LEATT_ERR_CODE_REQ_NOT_SUPPORTED

              leatt_sendErrResponse(status , LEATT_OPCODE_READ_REQ,  ??????);                                                                                       }

      }