feat(bluetooth): Initial nRF52 BSIM based test support.

Co-authored-by: Cem Aksoylar <caksoylar@users.noreply.github.com>
This commit is contained in:
Peter Johanson
2023-06-20 09:31:55 -07:00
committed by Pete Johanson
parent da15564d0e
commit 693530c2f1
34 changed files with 1054 additions and 1 deletions

View File

@@ -0,0 +1,2 @@
./ble_test_central.exe -d=2 -halt_after_bonding
./ble_test_central.exe -d=3 -wait_on_start=1300

View File

@@ -0,0 +1,2 @@
s/^d_02: @[0-9][0-9]:[0-9][0-9]:[0-9][0-9].[0-9][0-9][0-9][0-9][0-9][0-9] .{19}/profile 0 /p
s/^d_03: @[0-9][0-9]:[0-9][0-9]:[0-9][0-9].[0-9][0-9][0-9][0-9][0-9][0-9] .{19}/profile 1 /p

View File

@@ -0,0 +1,25 @@
#include <behaviors.dtsi>
#include <dt-bindings/zmk/bt.h>
#include <dt-bindings/zmk/keys.h>
#include <dt-bindings/zmk/kscan_mock.h>
&kscan {
events =
<ZMK_MOCK_PRESS(1,1,5000)
ZMK_MOCK_RELEASE(1,1,200)
ZMK_MOCK_PRESS(0,0,10)
ZMK_MOCK_RELEASE(0,0,2000)>;
};
/ {
keymap {
compatible = "zmk,keymap";
label = "Default keymap";
default_layer {
bindings = <
&kp A &kp B
&bt BT_SEL 0 &bt BT_CLR>;
};
};
};

View File

@@ -0,0 +1,33 @@
profile 0 <wrn> bt_id: No static addresses stored in controller
profile 0 <dbg> ble_central: _posix_zephyr_main: [Bluetooth initialized]
profile 0 <dbg> ble_central: start_scan: [Scanning successfully started]
profile 0 <dbg> ble_central: device_found: [DEVICE]: ED:3B:20:15:18:12 (random), AD evt type 0, AD data len 15, RSSI -59
profile 0 <dbg> ble_central: eir_found: [AD]: 9 data_len 0
profile 0 <dbg> ble_central: eir_found: [AD]: 25 data_len 2
profile 0 <dbg> ble_central: eir_found: [AD]: 1 data_len 1
profile 0 <dbg> ble_central: eir_found: [AD]: 2 data_len 4
profile 0 <dbg> ble_central: connected: [Connected]: ED:3B:20:15:18:12 (random)
profile 0 <dbg> ble_central: connected: [Setting the security for the connection]
profile 0 <dbg> ble_central: pairing_complete: Pairing complete
profile 1 <wrn> bt_id: No static addresses stored in controller
profile 1 <dbg> ble_central: _posix_zephyr_main: [Bluetooth initialized]
profile 1 <dbg> ble_central: start_scan: [Scanning successfully started]
profile 1 <dbg> ble_central: device_found: [DEVICE]: ED:3B:20:15:18:12 (random), AD evt type 0, AD data len 15, RSSI -59
profile 1 <dbg> ble_central: eir_found: [AD]: 9 data_len 0
profile 1 <dbg> ble_central: eir_found: [AD]: 25 data_len 2
profile 1 <dbg> ble_central: eir_found: [AD]: 1 data_len 1
profile 1 <dbg> ble_central: eir_found: [AD]: 2 data_len 4
profile 1 <dbg> ble_central: connected: [Connected]: ED:3B:20:15:18:12 (random)
profile 1 <dbg> ble_central: connected: [Setting the security for the connection]
profile 1 <dbg> ble_central: pairing_complete: Pairing complete
profile 1 <dbg> ble_central: discover_conn: [Discovery started for conn]
profile 1 <dbg> ble_central: discover_func: [ATTRIBUTE] handle 23
profile 1 <dbg> ble_central: discover_func: [ATTRIBUTE] handle 28
profile 1 <dbg> ble_central: discover_func: [ATTRIBUTE] handle 30
profile 1 <dbg> ble_central: discover_func: [SUBSCRIBED]
profile 1 <dbg> ble_central: notify_func: payload
profile 1 00 00 04 00 00 00 00 00 |........
profile 1 <dbg> ble_central: notify_func: payload
profile 1 00 00 00 00 00 00 00 00 |........
profile 1 <dbg> ble_central: notify_func: payload
profile 1 00 00 00 00 00 00 00 00 |........

View File

@@ -0,0 +1,2 @@
./ble_test_central.exe -d=2 -halt_after_bonding
./ble_test_central.exe -d=3 -wait_on_start=1300

View File

@@ -0,0 +1,2 @@
s/^d_02: @[0-9][0-9]:[0-9][0-9]:[0-9][0-9].[0-9][0-9][0-9][0-9][0-9][0-9] .{19}/profile 0 /p
s/^d_03: @[0-9][0-9]:[0-9][0-9]:[0-9][0-9].[0-9][0-9][0-9][0-9][0-9][0-9] .{19}/profile 1 /p

View File

@@ -0,0 +1,25 @@
#include <behaviors.dtsi>
#include <dt-bindings/zmk/bt.h>
#include <dt-bindings/zmk/keys.h>
#include <dt-bindings/zmk/kscan_mock.h>
&kscan {
events =
<ZMK_MOCK_PRESS(1,1,1000)
ZMK_MOCK_RELEASE(1,1,2000)
ZMK_MOCK_PRESS(0,0,100)
ZMK_MOCK_RELEASE(0,0,1000)>;
};
/ {
keymap {
compatible = "zmk,keymap";
label = "Default keymap";
default_layer {
bindings = <
&kp A &kp B
&bt BT_SEL 0 &bt BT_CLR>;
};
};
};

View File

@@ -0,0 +1,33 @@
profile 0 <wrn> bt_id: No static addresses stored in controller
profile 0 <dbg> ble_central: _posix_zephyr_main: [Bluetooth initialized]
profile 0 <dbg> ble_central: start_scan: [Scanning successfully started]
profile 0 <dbg> ble_central: device_found: [DEVICE]: ED:3B:20:15:18:12 (random), AD evt type 0, AD data len 15, RSSI -59
profile 0 <dbg> ble_central: eir_found: [AD]: 9 data_len 0
profile 0 <dbg> ble_central: eir_found: [AD]: 25 data_len 2
profile 0 <dbg> ble_central: eir_found: [AD]: 1 data_len 1
profile 0 <dbg> ble_central: eir_found: [AD]: 2 data_len 4
profile 0 <dbg> ble_central: connected: [Connected]: ED:3B:20:15:18:12 (random)
profile 0 <dbg> ble_central: connected: [Setting the security for the connection]
profile 0 <dbg> ble_central: pairing_complete: Pairing complete
profile 1 <wrn> bt_id: No static addresses stored in controller
profile 1 <dbg> ble_central: _posix_zephyr_main: [Bluetooth initialized]
profile 1 <dbg> ble_central: start_scan: [Scanning successfully started]
profile 1 <dbg> ble_central: device_found: [DEVICE]: ED:3B:20:15:18:12 (random), AD evt type 0, AD data len 15, RSSI -59
profile 1 <dbg> ble_central: eir_found: [AD]: 9 data_len 0
profile 1 <dbg> ble_central: eir_found: [AD]: 25 data_len 2
profile 1 <dbg> ble_central: eir_found: [AD]: 1 data_len 1
profile 1 <dbg> ble_central: eir_found: [AD]: 2 data_len 4
profile 1 <dbg> ble_central: connected: [Connected]: ED:3B:20:15:18:12 (random)
profile 1 <dbg> ble_central: connected: [Setting the security for the connection]
profile 1 <dbg> ble_central: pairing_complete: Pairing complete
profile 1 <dbg> ble_central: discover_conn: [Discovery started for conn]
profile 1 <dbg> ble_central: discover_func: [ATTRIBUTE] handle 23
profile 1 <dbg> ble_central: discover_func: [ATTRIBUTE] handle 28
profile 1 <dbg> ble_central: discover_func: [ATTRIBUTE] handle 30
profile 1 <dbg> ble_central: discover_func: [SUBSCRIBED]
profile 1 <dbg> ble_central: notify_func: payload
profile 1 00 00 04 00 00 00 00 00 |........
profile 1 <dbg> ble_central: notify_func: payload
profile 1 00 00 00 00 00 00 00 00 |........
profile 1 <dbg> ble_central: notify_func: payload
profile 1 00 00 00 00 00 00 00 00 |........

View File

@@ -0,0 +1 @@
./ble_test_central.exe -d=2

View File

@@ -0,0 +1 @@
s/^d_02: @[0-9][0-9]:[0-9][0-9]:[0-9][0-9].[0-9][0-9][0-9][0-9][0-9][0-9] .{19}//p

View File

@@ -0,0 +1,25 @@
#include <behaviors.dtsi>
#include <dt-bindings/zmk/bt.h>
#include <dt-bindings/zmk/keys.h>
#include <dt-bindings/zmk/kscan_mock.h>
&kscan {
events =
<ZMK_MOCK_PRESS(0,0,10000)
ZMK_MOCK_RELEASE(0,0,2000)
ZMK_MOCK_PRESS(0,1,100)
ZMK_MOCK_RELEASE(0,1,1000)>;
};
/ {
keymap {
compatible = "zmk,keymap";
label = "Default keymap";
default_layer {
bindings = <
&kp A &kp B
&bt BT_SEL 0 &bt BT_SEL 1>;
};
};
};

View File

@@ -0,0 +1,26 @@
<wrn> bt_id: No static addresses stored in controller
<dbg> ble_central: _posix_zephyr_main: [Bluetooth initialized]
<dbg> ble_central: start_scan: [Scanning successfully started]
<dbg> ble_central: device_found: [DEVICE]: ED:3B:20:15:18:12 (random), AD evt type 0, AD data len 15, RSSI -59
<dbg> ble_central: eir_found: [AD]: 9 data_len 0
<dbg> ble_central: eir_found: [AD]: 25 data_len 2
<dbg> ble_central: eir_found: [AD]: 1 data_len 1
<dbg> ble_central: eir_found: [AD]: 2 data_len 4
<dbg> ble_central: connected: [Connected]: ED:3B:20:15:18:12 (random)
<dbg> ble_central: connected: [Setting the security for the connection]
<dbg> ble_central: pairing_complete: Pairing complete
<dbg> ble_central: discover_conn: [Discovery started for conn]
<dbg> ble_central: discover_func: [ATTRIBUTE] handle 23
<dbg> ble_central: discover_func: [ATTRIBUTE] handle 28
<dbg> ble_central: discover_func: [ATTRIBUTE] handle 30
<dbg> ble_central: discover_func: [SUBSCRIBED]
<dbg> ble_central: notify_func: payload
00 00 04 00 00 00 00 00 |........
<dbg> ble_central: notify_func: payload
00 00 00 00 00 00 00 00 |........
<dbg> ble_central: notify_func: payload
00 00 05 00 00 00 00 00 |........
<dbg> ble_central: notify_func: payload
00 00 00 00 00 00 00 00 |........
<dbg> ble_central: notify_func: payload
00 00 00 00 00 00 00 00 |........

View File

@@ -0,0 +1,2 @@
./ble_test_central.exe -d=2 -halt_after_bonding
./ble_test_central.exe -d=3 -wait_on_start=1300

View File

@@ -0,0 +1,2 @@
s/^d_02: @[0-9][0-9]:[0-9][0-9]:[0-9][0-9].[0-9][0-9][0-9][0-9][0-9][0-9] .{19}/profile 0 /p
s/^d_03: @[0-9][0-9]:[0-9][0-9]:[0-9][0-9].[0-9][0-9][0-9][0-9][0-9][0-9] .{19}/profile 1 /p

View File

@@ -0,0 +1,25 @@
#include <behaviors.dtsi>
#include <dt-bindings/zmk/bt.h>
#include <dt-bindings/zmk/keys.h>
#include <dt-bindings/zmk/kscan_mock.h>
&kscan {
events =
<ZMK_MOCK_PRESS(0,0,10000)
ZMK_MOCK_RELEASE(0,0,2000)
ZMK_MOCK_PRESS(0,1,100)
ZMK_MOCK_RELEASE(0,1,1000)>;
};
/ {
keymap {
compatible = "zmk,keymap";
label = "Default keymap";
default_layer {
bindings = <
&kp A &kp B
&bt BT_SEL 0 &bt BT_SEL 1>;
};
};
};

View File

@@ -0,0 +1,23 @@
profile 0 <wrn> bt_id: No static addresses stored in controller
profile 0 <dbg> ble_central: _posix_zephyr_main: [Bluetooth initialized]
profile 0 <dbg> ble_central: start_scan: [Scanning successfully started]
profile 0 <dbg> ble_central: device_found: [DEVICE]: ED:3B:20:15:18:12 (random), AD evt type 0, AD data len 15, RSSI -59
profile 0 <dbg> ble_central: eir_found: [AD]: 9 data_len 0
profile 0 <dbg> ble_central: eir_found: [AD]: 25 data_len 2
profile 0 <dbg> ble_central: eir_found: [AD]: 1 data_len 1
profile 0 <dbg> ble_central: eir_found: [AD]: 2 data_len 4
profile 0 <dbg> ble_central: connected: [Connected]: ED:3B:20:15:18:12 (random)
profile 0 <dbg> ble_central: connected: [Setting the security for the connection]
profile 0 <dbg> ble_central: pairing_complete: Pairing complete
profile 1 <wrn> bt_id: No static addresses stored in controller
profile 1 <dbg> ble_central: _posix_zephyr_main: [Bluetooth initialized]
profile 1 <dbg> ble_central: start_scan: [Scanning successfully started]
profile 1 <dbg> ble_central: device_found: [DEVICE]: ED:3B:20:15:18:12 (random), AD evt type 0, AD data len 15, RSSI -59
profile 1 <dbg> ble_central: eir_found: [AD]: 9 data_len 0
profile 1 <dbg> ble_central: eir_found: [AD]: 25 data_len 2
profile 1 <dbg> ble_central: eir_found: [AD]: 1 data_len 1
profile 1 <dbg> ble_central: eir_found: [AD]: 2 data_len 4
profile 1 <dbg> ble_central: connected: [Connected]: ED:3B:20:15:18:12 (random)
profile 1 <dbg> ble_central: connected: [Setting the security for the connection]
profile 1 <err> bt_smp: reason 0x8
profile 1 <dbg> ble_central: security_changed: [Security Change Failed]

View File

@@ -0,0 +1,2 @@
./ble_test_central.exe -d=2
./ble_test_central.exe -d=3 -wait_on_start=1300

View File

@@ -0,0 +1,2 @@
s/^d_02: @[0-9][0-9]:[0-9][0-9]:[0-9][0-9].[0-9][0-9][0-9][0-9][0-9][0-9] .{19}/profile 0 /p
s/^d_03: @[0-9][0-9]:[0-9][0-9]:[0-9][0-9].[0-9][0-9][0-9][0-9][0-9][0-9] .{19}/profile 1 /p

View File

@@ -0,0 +1,27 @@
#include <behaviors.dtsi>
#include <dt-bindings/zmk/bt.h>
#include <dt-bindings/zmk/keys.h>
#include <dt-bindings/zmk/kscan_mock.h>
&kscan {
events =
<ZMK_MOCK_PRESS(0,0,5000)
ZMK_MOCK_RELEASE(0,0,200)
ZMK_MOCK_PRESS(1,1,10)
ZMK_MOCK_RELEASE(1,1,2000)
ZMK_MOCK_PRESS(0,1,1000)
ZMK_MOCK_RELEASE(0,1,1000)>;
};
/ {
keymap {
compatible = "zmk,keymap";
label = "Default keymap";
default_layer {
bindings = <
&kp A &kp B
&bt BT_SEL 0 &bt BT_SEL 1>;
};
};
};

View File

@@ -0,0 +1,42 @@
profile 0 <wrn> bt_id: No static addresses stored in controller
profile 0 <dbg> ble_central: _posix_zephyr_main: [Bluetooth initialized]
profile 0 <dbg> ble_central: start_scan: [Scanning successfully started]
profile 0 <dbg> ble_central: device_found: [DEVICE]: ED:3B:20:15:18:12 (random), AD evt type 0, AD data len 15, RSSI -59
profile 0 <dbg> ble_central: eir_found: [AD]: 9 data_len 0
profile 0 <dbg> ble_central: eir_found: [AD]: 25 data_len 2
profile 0 <dbg> ble_central: eir_found: [AD]: 1 data_len 1
profile 0 <dbg> ble_central: eir_found: [AD]: 2 data_len 4
profile 0 <dbg> ble_central: connected: [Connected]: ED:3B:20:15:18:12 (random)
profile 0 <dbg> ble_central: connected: [Setting the security for the connection]
profile 0 <dbg> ble_central: pairing_complete: Pairing complete
profile 0 <dbg> ble_central: discover_conn: [Discovery started for conn]
profile 0 <dbg> ble_central: discover_func: [ATTRIBUTE] handle 23
profile 1 <wrn> bt_id: No static addresses stored in controller
profile 1 <dbg> ble_central: _posix_zephyr_main: [Bluetooth initialized]
profile 1 <dbg> ble_central: start_scan: [Scanning successfully started]
profile 0 <dbg> ble_central: discover_func: [ATTRIBUTE] handle 28
profile 0 <dbg> ble_central: discover_func: [ATTRIBUTE] handle 30
profile 0 <dbg> ble_central: discover_func: [SUBSCRIBED]
profile 0 <dbg> ble_central: notify_func: payload
profile 0 00 00 04 00 00 00 00 00 |........
profile 0 <dbg> ble_central: notify_func: payload
profile 0 00 00 00 00 00 00 00 00 |........
profile 1 <dbg> ble_central: device_found: [DEVICE]: ED:3B:20:15:18:12 (random), AD evt type 0, AD data len 15, RSSI -59
profile 1 <dbg> ble_central: eir_found: [AD]: 9 data_len 0
profile 1 <dbg> ble_central: eir_found: [AD]: 25 data_len 2
profile 1 <dbg> ble_central: eir_found: [AD]: 1 data_len 1
profile 1 <dbg> ble_central: eir_found: [AD]: 2 data_len 4
profile 1 <dbg> ble_central: connected: [Connected]: ED:3B:20:15:18:12 (random)
profile 1 <dbg> ble_central: connected: [Setting the security for the connection]
profile 1 <dbg> ble_central: pairing_complete: Pairing complete
profile 1 <dbg> ble_central: discover_conn: [Discovery started for conn]
profile 1 <dbg> ble_central: discover_func: [ATTRIBUTE] handle 23
profile 1 <dbg> ble_central: discover_func: [ATTRIBUTE] handle 28
profile 1 <dbg> ble_central: discover_func: [ATTRIBUTE] handle 30
profile 1 <dbg> ble_central: discover_func: [SUBSCRIBED]
profile 1 <dbg> ble_central: notify_func: payload
profile 1 00 00 05 00 00 00 00 00 |........
profile 1 <dbg> ble_central: notify_func: payload
profile 1 00 00 00 00 00 00 00 00 |........
profile 1 <dbg> ble_central: notify_func: payload
profile 1 00 00 00 00 00 00 00 00 |........

View File

@@ -0,0 +1 @@
./ble_test_central.exe -d=2 -disconnect_and_reconnect

View File

@@ -0,0 +1 @@
s/^d_02: @[0-9][0-9]:[0-9][0-9]:[0-9][0-9].[0-9][0-9][0-9][0-9][0-9][0-9] .{19}//p

View File

@@ -0,0 +1,25 @@
#include <behaviors.dtsi>
#include <dt-bindings/zmk/bt.h>
#include <dt-bindings/zmk/keys.h>
#include <dt-bindings/zmk/kscan_mock.h>
&kscan {
events =
<ZMK_MOCK_PRESS(0,0,10000)
ZMK_MOCK_RELEASE(0,0,2000)
ZMK_MOCK_PRESS(0,1,100)
ZMK_MOCK_RELEASE(0,1,1000)>;
};
/ {
keymap {
compatible = "zmk,keymap";
label = "Default keymap";
default_layer {
bindings = <
&kp A &kp B
&bt BT_SEL 0 &bt BT_SEL 1>;
};
};
};

View File

@@ -0,0 +1,35 @@
<wrn> bt_id: No static addresses stored in controller
<dbg> ble_central: _posix_zephyr_main: [Bluetooth initialized]
<dbg> ble_central: start_scan: [Scanning successfully started]
<dbg> ble_central: device_found: [DEVICE]: ED:3B:20:15:18:12 (random), AD evt type 0, AD data len 15, RSSI -59
<dbg> ble_central: eir_found: [AD]: 9 data_len 0
<dbg> ble_central: eir_found: [AD]: 25 data_len 2
<dbg> ble_central: eir_found: [AD]: 1 data_len 1
<dbg> ble_central: eir_found: [AD]: 2 data_len 4
<dbg> ble_central: connected: [Connected]: ED:3B:20:15:18:12 (random)
<dbg> ble_central: connected: [Setting the security for the connection]
<dbg> ble_central: pairing_complete: Pairing complete
<dbg> ble_central: disconnected: [Disconnected]: ED:3B:20:15:18:12 (random) (reason 0x16)
<dbg> ble_central: start_scan: [Scanning successfully started]
<dbg> ble_central: device_found: [DEVICE]: ED:3B:20:15:18:12 (random), AD evt type 0, AD data len 15, RSSI -59
<dbg> ble_central: eir_found: [AD]: 9 data_len 0
<dbg> ble_central: eir_found: [AD]: 25 data_len 2
<dbg> ble_central: eir_found: [AD]: 1 data_len 1
<dbg> ble_central: eir_found: [AD]: 2 data_len 4
<dbg> ble_central: connected: [Connected]: ED:3B:20:15:18:12 (random)
<dbg> ble_central: connected: [Setting the security for the connection]
<dbg> ble_central: discover_conn: [Discovery started for conn]
<dbg> ble_central: discover_func: [ATTRIBUTE] handle 23
<dbg> ble_central: discover_func: [ATTRIBUTE] handle 28
<dbg> ble_central: discover_func: [ATTRIBUTE] handle 30
<dbg> ble_central: discover_func: [SUBSCRIBED]
<dbg> ble_central: notify_func: payload
00 00 04 00 00 00 00 00 |........
<dbg> ble_central: notify_func: payload
00 00 00 00 00 00 00 00 |........
<dbg> ble_central: notify_func: payload
00 00 05 00 00 00 00 00 |........
<dbg> ble_central: notify_func: payload
00 00 00 00 00 00 00 00 |........
<dbg> ble_central: notify_func: payload
00 00 00 00 00 00 00 00 |........