Hello Nordic Team,
I am currently working with the nRF Connect SDK v2.4.0 to develop applications for custom boards based on the nRF52840 microcontroller. I have included custom GATT Services and Characteristics which include controlling the sensor (ON/OFF). From the below link and few other sources.
As I click on 'WRITE' icon after flashing the code. This is the output I get,

instead of this as given in the link above.

I have added the write functionality as mentioned in the above link.
static ssize_t temp_toggle(struct bt_conn *conn,
const struct bt_gatt_attr *attr,
const void *buf,
uint16_t len, uint16_t offset, uint8_t flags)
{
LOG_DBG("Attribute write, handle: %u, conn: %p", attr->handle, (void *)conn);
if (len != 1U) {
LOG_DBG("Write led: Incorrect data length");
return BT_GATT_ERR(BT_ATT_ERR_INVALID_ATTRIBUTE_LEN);
}
if (offset != 0) {
LOG_DBG("Write led: Incorrect data offset");
return BT_GATT_ERR(BT_ATT_ERR_INVALID_OFFSET);
}
if (scs_cb.temp_wrt_cb) {
//Read the received value
uint8_t val = *((uint8_t *)buf);
if (val == 0x00 || val == 0x01) {
//Call the application callback function to update the LED state
scs_cb.temp_wrt_cb(val ? true : false);
} else {
LOG_DBG("Write led: Incorrect value");
return BT_GATT_ERR(BT_ATT_ERR_VALUE_NOT_ALLOWED);
}
}
return len;
}
Can you provide insights into what might be causing this problem and what changes should I make? Please provide your feedback on the above points at earliest.
Thanks and Regards,
Anmol.
