This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

LAUNCHXL-CC26X2R1: BLE multi role example how to get write response data ?

Part Number: LAUNCHXL-CC26X2R1

HI, this is vadivelan,

I'm using BLE multirole example in that imported serial socket example for transferring 16 bytes of data's

I want to after sending data response data which function or structure containing that information help mee

using sdk is  simplelink_cc13x2_26x2_sdk_5_200_00_52 

  • Hey Vadivelan,

    If you take a look at multi_role.c, you will find multi_role_procesGATTMsg(), which is triggered when the stack processes a GATT message. Below is an excerpt of our example code that showcases what I believe you are looking for. Specifically, see the ATT_WRITE_RSP else if statement.

    // Messages from GATT server
      if (linkDB_Up(pMsg->connHandle))
      {
        if ((pMsg->method == ATT_READ_RSP)   ||
            ((pMsg->method == ATT_ERROR_RSP) &&
             (pMsg->msg.errorRsp.reqOpcode == ATT_READ_REQ)))
        {
          if (pMsg->method == ATT_ERROR_RSP)
          {
            Display_printf(dispHandle, MR_ROW_CUR_CONN, 0, "Read Error %d", pMsg->msg.errorRsp.errCode);
          }
          else
          {
            // After a successful read, display the read value
            Display_printf(dispHandle, MR_ROW_CUR_CONN, 0, "Read rsp: %d", pMsg->msg.readRsp.pValue[0]);
          }
    
        }
        else if ((pMsg->method == ATT_WRITE_RSP)  ||
                 ((pMsg->method == ATT_ERROR_RSP) &&
                  (pMsg->msg.errorRsp.reqOpcode == ATT_WRITE_REQ)))
        {

  • After sending data using the bellow function I'm gonna get ATT_WRITE_RSP?

    SimpleStreamClient_sendData(connHandle, &SendDdatatoBand, len);

    I have doubt because of  this  function call inside transmit node ret = GATT_WriteNoRsp( node->connHandle, &req ); 

    static bStatus_t SimpleStreamClient_transmitNode( SimpleStreamNode_t* node)
    {
        bStatus_t ret = SUCCESS;
        linkDBInfo_t connInfo;
        attWriteReq_t req;
    
        // Find out what the maximum MTU size is
        ret = linkDB_GetInfo(node->connHandle, &connInfo);
    
        // Queue up as many notification slots as possible
        if ( (ret == SUCCESS) && (node != NULL) ) {
    
            // Determine allocation size
            uint16_t allocLen = (node->len - node->offset);
            if ( allocLen > (connInfo.MTU - ATT_WRITE_REQ_HDR_SIZE) )
            {
                allocLen = connInfo.MTU - ATT_WRITE_REQ_HDR_SIZE;
            }
    
            req.pValue = (uint8 *)GATT_bm_alloc( node->connHandle, ATT_WRITE_CMD,
                                                  allocLen, &req.len );
    
            // If allocation was successful, copy out data out of the buffer and send it
            if (NULL != req.pValue) {
    
                req.handle = streamServiceHandle.chars[0].handle;
                memcpy(req.pValue, (void ) ((uint8_t ) node->payload + node->offset), req.len);
                req.cmd = TRUE;
                req.sig = FALSE;
    
                ret = GATT_WriteNoRsp( node->connHandle, &req );
    
                // If unable to send the message, free allocated buffers and return
                if ( ret != SUCCESS )
                {
                    GATT_bm_free( (gattMsg_t *)&req, ATT_WRITE_CMD );
                }
                else
                {
                    // Increment node data offset
                    node->offset += req.len;
                }
            }
            else
            {
                // Unable to allocate space for a notification, return failure
                ret = bleMemAllocError;
            }
        }
    
        return ret;
    }

  • You are correct. Looking at gatt.h, see the below excerpt from the GATT_WriteNoRsp function:

    * @note No response will be sent to the calling task for this
    * sub-procedure. If the Characteristic Value write request is the
    * wrong size, or has an invalid value as defined by the profile,
    * then the write will not succeed and no error will be generated
    * by the server.

    You will have to modify this to a different write function (see GATT APIs for available functions) if you'd like a callback from the stack.

  • Ok, thank you. I have one doubt can I be able to more than 16 bytes of data at a single short to the connected device?

    without using a serial socket example?

     ble gatt below function can i use for sending single short 16 byte of data sending purpose in a central role example?

    bStatus_t GATT_WriteCharValue ( uint16  connHandle,
    attWriteReq_t  pReq,
    uint8  taskId 
    )

    uint8  cmd
      Command Flag.
     
    uint16  handle
      Handle of the attribute to be written (must be first field)
     
    uint16  len
      Length of value.
     
    uint8 *  pValue
      Value of the attribute to be written (0 to ATT_MTU_SIZE-3)
     
    uint8  sig
      Authentication Signature status (not included (0), valid (1), invalid 

  • one more thing  

    Gapscan_enable(0,1500,15);

    what will happen  above function I'm enabling once in device initialing time and after that again gap termination event inside enabling 

    give me some brief about that function 

    Gapscan_enable(0,0,15); means what will happen ( as per my knowledge it will scan infinite times until gapscan_disable() )

    Gapscan_enable(0,1500,15); and this one (limited time 1.5 s it will scan ?)

  • Hey Vad,

    I would recommend going through our Simplelink Academy modules here. Most of your questions should be answered there (with regards to scanning and advertising).

    can I be able to more than 16 bytes of data at a single short to the connected device?

    This should be possible.