peripheral/src/main.c
/*
 * callback function passed to ble sstate_service
 * code which get executed if some data is received by the central
 */
callback function passed to ble sstate_service
code which get executed if some data is received by the central
callback function passed to ble sstate_service code which get executed if some data is received by the central
void on_data_received(struct bt_conn *conn, const uint8_t *const data, uint16_t len)
{
	uint8_t recv = *data;
	LOG_DBG("Received data on conn %p. Len: %d", (void *)conn, len);
	LOG_INF("Received State: %d", recv);
	if (recv >= 0 && recv <= 3)
	{
		state = recv;
		int err = trailer_light_update(state);
		if (err)
		{
			LOG_ERR("Failed to update trailer light for action id: %d\n", state);
		}
	}
	else
	{
		LOG_WRN("Received out of range signal code from central");
	}
}
void on_data_received ( struct bt_conn * conn , const uint8_t * const data , uint16_t len ) { uint8_t recv = * data ; LOG_DBG ( " " , ( void * ) conn , len ) ; LOG_INF ( " " , recv ) ; if ( recv >= 0 && recv <= 3 ) { state = recv ; int err = trailer_light_update ( state ) ; if ( err ) { LOG_ERR ( " \n " , state ) ; } } else { LOG_WRN ( " " ) ; } }
callback function passed to ble sstate_service
 code which get executed if some data is received by the central
callback function passed to ble sstate_service code which get executed if some data is received by the central