Skip to content

Commit a34a646

Browse files
committed
nrf528xx: improve debug loggin with the bledebug build tag
It prints for a number of cases that weren't logged before, which is useful while debugging.
1 parent 3639f8e commit a34a646

1 file changed

Lines changed: 22 additions & 0 deletions

File tree

adapter_nrf528xx-full.go

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,10 @@ func handleEvent() {
4343
connectionAttempt.connectionHandle = gapEvent.conn_handle
4444
connectionAttempt.state.Set(2) // connection was successful
4545
DefaultAdapter.connectHandler(device, true)
46+
default:
47+
if debug {
48+
println("evt: connected in unknown role")
49+
}
4650
}
4751
case C.BLE_GAP_EVT_DISCONNECTED:
4852
if debug {
@@ -105,15 +109,27 @@ func handleEvent() {
105109
// > will be rejected
106110
C.sd_ble_gap_conn_param_update(gapEvent.conn_handle, nil)
107111
case C.BLE_GAP_EVT_DATA_LENGTH_UPDATE_REQUEST:
112+
if debug {
113+
println("evt: gap data length update request")
114+
}
108115
// We need to respond with sd_ble_gap_data_length_update. Setting
109116
// both parameters to nil will make sure we send the default values.
110117
C.sd_ble_gap_data_length_update(gapEvent.conn_handle, nil, nil)
111118
case C.BLE_GAP_EVT_DATA_LENGTH_UPDATE:
119+
if debug {
120+
println("evt: gap data length updated")
121+
}
112122
// ignore confirmation of data length successfully updated
113123
case C.BLE_GAP_EVT_PHY_UPDATE_REQUEST:
124+
if debug {
125+
println("evt: gap phy update request")
126+
}
114127
// Tell the Bluetooth stack to update the PHY as it sees fit.
115128
C.sd_ble_gap_phy_update(gapEvent.conn_handle, &phyUpdateResponse)
116129
case C.BLE_GAP_EVT_PHY_UPDATE:
130+
if debug {
131+
println("evt: gap phy update")
132+
}
117133
// ignore confirmation of phy successfully updated
118134
case C.BLE_GAP_EVT_TIMEOUT:
119135
timeoutEvt := gapEvent.params.unionfield_timeout()
@@ -254,7 +270,13 @@ func handleEvent() {
254270
break
255271
}
256272
}
273+
default:
274+
if debug {
275+
println("evt: unknown HVX")
276+
}
257277
}
278+
case C.BLE_GATTC_EVT_WRITE_CMD_TX_COMPLETE:
279+
// not handled at the moment
258280
default:
259281
if debug {
260282
println("unknown GATTC event:", id, id-C.BLE_GATTC_EVT_BASE)

0 commit comments

Comments
 (0)