I'm looking at the `peripheral_csc` example to understand how to implement write responses. It seems for the BT_UUID_SC_CONTROL_POINT attribute, `bt_gatt_notify()` is used for the response in the _write callback.
What I don't understand though is how the index of the `csc_svs` is determined. In the example above, here is the response for a BT_UUID_SC_CONTROL_POINT write:
bt_gatt_notify(conn, &csc_svc.attrs[8], buf, sizeof(buf))
And here is the `BT_GATT_SERVICE_DEFINE` macro that defines all the attributes:
BT_GATT_SERVICE_DEFINE(csc_svc, BT_GATT_PRIMARY_SERVICE(BT_UUID_CSC), BT_GATT_CHARACTERISTIC(BT_UUID_CSC_MEASUREMENT, BT_GATT_CHRC_NOTIFY, 0x00, NULL, NULL, NULL), BT_GATT_CCC(csc_meas_ccc_cfg_changed, BT_GATT_PERM_READ | BT_GATT_PERM_WRITE), BT_GATT_CHARACTERISTIC(BT_UUID_SENSOR_LOCATION, BT_GATT_CHRC_READ, BT_GATT_PERM_READ, read_location, NULL, &sensor_location), BT_GATT_CHARACTERISTIC(BT_UUID_CSC_FEATURE, BT_GATT_CHRC_READ, BT_GATT_PERM_READ, read_csc_feature, NULL, NULL), BT_GATT_CHARACTERISTIC(BT_UUID_SC_CONTROL_POINT, BT_GATT_CHRC_WRITE | BT_GATT_CHRC_INDICATE, BT_GATT_PERM_WRITE, NULL, write_ctrl_point, &sensor_location), BT_GATT_CCC(ctrl_point_ccc_cfg_changed, BT_GATT_PERM_READ | BT_GATT_PERM_WRITE), );
I would have expected `csc_svc.attrs[5]`, not `csc_svc.attrs[8]`, given it's position in the `BT_GATT_SERVICE_DEFINE` macro above. Am I missing something?