This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts
This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

How to get data from different characteristics

Hello,

i have a BLE device running with a service with three writable characteristics. At the moment I have one data handler function. If there is any characteristic written, the software will jump to this data handler. My question is, how can I differ, which charcteristic was written??

void memory_data_handler(ble_memory_t * p_com, uint8_t * p_data, uint16_t length){
	dbg_printf("*** Mem service data written:\r");
	for (uint32_t i = 0; i < length; i++)
{
			memContent[i] = p_data[i];
			dbg_printf("data[%d] = 0x%x\r", i, memContent[i]);
}}

Is there a opportunity to get a switch case into the datahandler? Or do I have to write a data_handler function for every characteristic? Then I would have to call the right data_handler function in the

static void on_write(ble_memory_t * p_com, ble_evt_t * p_ble_evt)

function...

Thanks for any help!

Regards, BTprogrammer