This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

How can we receive more than 20 bytes of data in NRF52 from a phone ?

Hi,

How can we receive more than 20 bytes of data from the phone? We are using s132 and SDK 12.3. I know how to send more than 20 bytes of data from the NRF52 to the phone but I am not sure how to receive more than 20 bytes of data from the phone. 

Looking forward to some help on this. 

Parents Reply Children
  • Hi all,
    I'm using s132 and SDK14.2.

    I need to understand how to manage more 1 byte of data from the phone.

    When I receive the event BLE_GATTS_EVT_WRITE, I call the relative function on_write() where the first code line is:


    ble_gatts_evt_write_t const * p_evt_write = &p_ble_evt->evt.gatts_evt.params.write;


    The structure ble_gatts_evt_write_t is the following:

    /**@brief Event structure for @ref BLE_GATTS_EVT_WRITE. */
    typedef struct
    {
      uint16_t                    handle;             /**< Attribute Handle. */
      ble_uuid_t                  uuid;               /**< Attribute UUID. */
      uint8_t                     op;                 /**< Type of write operation, see @ref BLE_GATTS_OPS. */
      uint8_t                     auth_required;      /**< Writing operation deferred due to authorization requirement. Application may use @ref sd_ble_gatts_value_set to finalize the writing operation. */
      uint16_t                    offset;             /**< Offset for the write operation. */
      uint16_t                    len;                /**< Length of the received data. */
      /* !SG! */
      uint8_t                     data[1];            /**< Received data. @note This is a variable length array. The size of 1 indicated is only a placeholder for compilation.
                                                           See @ref sd_ble_evt_get for more information on how to use event structures with variable length array members. */
    } ble_gatts_evt_write_t;

    To manage more one byte, is it correct to modify the data[1] of trhis structure from 1 to X length of interest?

    Thank you in advance

Related