I have been uing nRF9160 as ble gateway for uploading data from two nRF52832. The nRF9160 has subscribed to the nRF52832 gatt and hence receive updates automatically. Now I have been trying to read the nRF52832 data through the bt_gatt_read function but the value read has always been 0 instead? can anyone tell me where my problem is? here are the part of the code on nRF9160.
static struct bt_gatt_read_params read_param = {
.func = read_func,
.handle_count = 1,
};
desc = bt_gatt_dm_desc_by_uuid(disc, chrc, BT_UUID_GATT_CCC);
read_param.handles = desc->handle;
err = bt_gatt_read(bt_gatt_dm_conn_get(disc), &read_param);
if (err) {
printk("Read failed (err %d)\n", err);
}
I am assuming one of this is cause of the problem
- I am not using the right handle, if that is the case can anyone point me in the right direction?
- gatt read is not enabled in nRF52832 and needs to be for this function to work. Can anyone explain to me how to do that?
- any other reason?