on_write() can only handle 1 byte of data, how to handle multiple bytes?

Hi All,

I am currently implementing Write communication, referring to ble_app_blinky in example.

When the phone gives the command, the program will run this function, as shown below.

The data will be stored in p_evt_write->data[0], and the structure type of data[0] in ble_gatts_evt_write_t is uint8_t data[1];

If the command under my phone is an array, how should I modify it to receive all the information?

Best regards,

Kai

Parents
  • does the characteristic you are writing to have a big enough max len? (if you add the char there are some settings in the struct you're passing to 

    sd_ble_gatts_characteristic_add() and these should be altered accordingly. Afterwards you should be able to access all the data in the array

    I always debug these things with breakpoints so I can take a close look at whats inside the struct and array
Reply
  • does the characteristic you are writing to have a big enough max len? (if you add the char there are some settings in the struct you're passing to 

    sd_ble_gatts_characteristic_add() and these should be altered accordingly. Afterwards you should be able to access all the data in the array

    I always debug these things with breakpoints so I can take a close look at whats inside the struct and array
Children
Related