Hello
I'm working on my ble central that is based on nRF52832 and it's connecting to nRF52832 peripheral setup with Enviromental sensing service[0x181A]
This is log from nRF USB dongle when connect to it
19:20:02.630 Connecting to device
19:20:02.769 Connected to device DD:D0:AC:5A:46:34
19:20:02.971 Attribute value read, handle: 0x0B, value (0x): 73-62-6C-65-54-41-47
19:20:07.839 Connection parameters updated for device DD:D0:AC:5A:46:34: interval 30ms, timeout 420ms, latency: 0
and here is screenshoot
From central I can connect to peripheral and when I try to discover all for Environmental sensing I get
[19:24:58:990] <debug> ble_scan: Adding filter on sbleTAG name [19:24:58:994] <info> app: App started [19:24:58:997] <info> app: Start scanning for device name: sbleTAG. [19:24:59:002] <debug> ble_scan: Scanning [19:24:59:004] <info> app: Enter main loop [19:24:59:428] <debug> ble_scan: Connecting [19:24:59:431] <debug> ble_scan: Connection status: 0 [19:25:00:433] BLE evt_id: BLE_GAP_EVT_CONNECTED=16 [19:25:00:436] Connected to address: DD D0 AC 5A 46 34 [19:25:00:442] <debug> nrf_ble_gq: Registering connection handle: 0x0000 [19:25:00:450] <debug> ble_db_disc: Starting discovery of service with UUID 0x181A on connection handle 0x0. [19:25:00:870] <info> app: BLE DB Discovery complete. Discovered UUID:0x181A, Type: 1 [19:25:00:878] <info> app: 0: uuid: 2A6E handle value:0023 [19:25:00:882] <info> app: 1: uuid: 2A6F handle value:0026 [19:25:00:887] <info> app: 2: uuid: 2A6D handle value:0029
as from screenshot up I read correct data and saving all service characteristics (based from ble_app_interactive sample)
if (p_evt->params.discovered_db.srv_uuid.uuid == ENVIRONMENTAL_SENSING_SERVICE) { // Save characteristics data. for (uint8_t i = 0; i < p_evt->params.discovered_db.char_count; i++) { m_srv_char.count = i; m_srv_char.char_data[i].handle_decl = p_evt->params.discovered_db.charateristics[i].characteristic.handle_decl; m_srv_char.char_data[i].handle_value = p_evt->params.discovered_db.charateristics[i].characteristic.handle_value; m_srv_char.char_data[i].uuid = p_evt->params.discovered_db.charateristics[i].characteristic.uuid; m_srv_char.char_data[i].char_props = p_evt->params.discovered_db.charateristics[i].characteristic.char_props; m_srv_char.char_data[i].handle_cccd_desc = 0; NRF_LOG_INFO("%d: uuid: %04X handle value:%04X", i, m_srv_char.char_data[i].uuid.uuid, m_srv_char.char_data[i].handle_value); } }
But issue now is how to get value from that characteristics???
I have tried
// sd_ble_gattc_read err_code = sd_ble_gattc_read(conn_handle, &m_srv_char.char_data[0].handle_value, 0); // sd_ble_gattc_char_value_by_uuid_read err_code = sd_ble_gattc_char_value_by_uuid_read(conn_handle, &c_uuid, &p_handle_range);
and not sure that I'm doing it correctly
1) I'm calling it now after db discovery is done and have all data for Environmental service is that OK?
2) How to get data? (ble_evt_handler under BLE_GATTC_EVT_READ_RSP and BLE_GATTC_EVT_CHAR_VAL_BY_UUID_READ_RSP)
3) Is there anything else I can do to get it easy (as values are integers no big data or strings)?
I'm bit lost in all this events any help would be super nice...thanks