Skip to content

Commit 27750d5

Browse files
committed
add STK errors
1 parent d0c7887 commit 27750d5

File tree

1 file changed

+17
-1
lines changed

1 file changed

+17
-1
lines changed

error_sd.go

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ package bluetooth
44

55
// #include "nrf_error.h"
66
// #include "nrf_error_sdm.h"
7+
// #include "ble_err.h"
78
import "C"
89

910
// Error is an error from within the SoftDevice.
@@ -74,7 +75,22 @@ func (e Error) Error() string {
7475
return "other SoC error"
7576
case e >= C.NRF_ERROR_STK_BASE_NUM && e < 0x4000:
7677
// STK errors.
77-
return "other STK error"
78+
switch e {
79+
case C.BLE_ERROR_NOT_ENABLED:
80+
return "sd_ble_enable has not been called"
81+
case C.BLE_ERROR_INVALID_CONN_HANDLE:
82+
return "invalid connection handle"
83+
case C.BLE_ERROR_INVALID_ATTR_HANDLE:
84+
return "invalid attribute handle"
85+
case C.BLE_ERROR_INVALID_ADV_HANDLE:
86+
return "invalid advertising handle"
87+
case C.BLE_ERROR_INVALID_ROLE:
88+
return "invalid role"
89+
case C.BLE_ERROR_BLOCKED_BY_OTHER_LINKS:
90+
return "the attempt to change link settings failed due to the scheduling of other links"
91+
default:
92+
return "other STK error"
93+
}
7894
default:
7995
// Other errors.
8096
return "other error"

0 commit comments

Comments
 (0)