Skip to content

Commit e5b9a89

Browse files
ysoldakdeadprogram
authored andcommitted
nrf528xx: handle BLE_GAP_EVT_PHY_UPDATE_REQUEST
and explicitly ignore some other events
1 parent 113f5fa commit e5b9a89

File tree

2 files changed

+18
-0
lines changed

2 files changed

+18
-0
lines changed

adapter_nrf528xx-full.go

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,13 @@ func handleEvent() {
9999
// We need to respond with sd_ble_gap_data_length_update. Setting
100100
// both parameters to nil will make sure we send the default values.
101101
C.sd_ble_gap_data_length_update(gapEvent.conn_handle, nil, nil)
102+
case C.BLE_GAP_EVT_DATA_LENGTH_UPDATE:
103+
// ignore confirmation of data length successfully updated
104+
case C.BLE_GAP_EVT_PHY_UPDATE_REQUEST:
105+
phyUpdateRequest := gapEvent.params.unionfield_phy_update_request()
106+
C.sd_ble_gap_phy_update(gapEvent.conn_handle, &phyUpdateRequest.peer_preferred_phys)
107+
case C.BLE_GAP_EVT_PHY_UPDATE:
108+
// ignore confirmation of phy successfully updated
102109
default:
103110
if debug {
104111
println("unknown GAP event:", id)
@@ -129,6 +136,8 @@ func handleEvent() {
129136
// This event is generated by some devices. While we could support
130137
// larger MTUs, this default MTU is supported everywhere.
131138
C.sd_ble_gatts_exchange_mtu_reply(gattsEvent.conn_handle, C.BLE_GATT_ATT_MTU_DEFAULT)
139+
case C.BLE_GATTS_EVT_HVN_TX_COMPLETE:
140+
// ignore confirmation of a notification successfully sent
132141
default:
133142
if debug {
134143
println("unknown GATTS event:", id, id-C.BLE_GATTS_EVT_BASE)

adapter_nrf528xx-peripheral.go

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,13 @@ func handleEvent() {
5454
// We need to respond with sd_ble_gap_data_length_update. Setting
5555
// both parameters to nil will make sure we send the default values.
5656
C.sd_ble_gap_data_length_update(gapEvent.conn_handle, nil, nil)
57+
case C.BLE_GAP_EVT_DATA_LENGTH_UPDATE:
58+
// ignore confirmation of data length successfully updated
59+
case C.BLE_GAP_EVT_PHY_UPDATE_REQUEST:
60+
phyUpdateRequest := gapEvent.params.unionfield_phy_update_request()
61+
C.sd_ble_gap_phy_update(gapEvent.conn_handle, &phyUpdateRequest.peer_preferred_phys)
62+
case C.BLE_GAP_EVT_PHY_UPDATE:
63+
// ignore confirmation of phy successfully updated
5764
default:
5865
if debug {
5966
println("unknown GAP event:", id)
@@ -84,6 +91,8 @@ func handleEvent() {
8491
// This event is generated by some devices. While we could support
8592
// larger MTUs, this default MTU is supported everywhere.
8693
C.sd_ble_gatts_exchange_mtu_reply(gattsEvent.conn_handle, C.BLE_GATT_ATT_MTU_DEFAULT)
94+
case C.BLE_GATTS_EVT_HVN_TX_COMPLETE:
95+
// ignore confirmation of a notification successfully sent
8796
default:
8897
if debug {
8998
println("unknown GATTS event:", id, id-C.BLE_GATTS_EVT_BASE)

0 commit comments

Comments
 (0)