From 6f9f11dbac1bf3e1a0d74bb0cca083d6486b6ca0 Mon Sep 17 00:00:00 2001 From: Ayke van Laethem Date: Sat, 23 May 2020 20:25:03 +0200 Subject: [PATCH] Fix timeout when reading Generic Attribute --- adapter_sd.go | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/adapter_sd.go b/adapter_sd.go index 852bddf..a691ebb 100644 --- a/adapter_sd.go +++ b/adapter_sd.go @@ -141,6 +141,16 @@ func handleEvent() { if handler != nil { handler.callback(Connection(gattsEvent.conn_handle), int(writeEvent.offset), data) } + case C.BLE_GATTS_EVT_SYS_ATTR_MISSING: + // This event is generated when reading the Generic Attribute + // service. It appears to be necessary for bonded devices. + // From the docs: + // > If the pointer is NULL, the system attribute info is + // > initialized, assuming that the application does not have any + // > previously saved system attribute data for this device. + // Maybe we should look at the error, but as there's not really a + // way to handle it, ignore it. + C.sd_ble_gatts_sys_attr_set(gattsEvent.conn_handle, nil, 0, 0) } } }