2025-12-10 5:14 AM - edited 2025-12-10 5:15 AM
I want to use STM32CubeMonitor-RF's scripting feature to automate BLE tests, but I'm having troubles right from the start:
Send(ACI_GAP_CREATE_CONNECTION;0x01D0;0x01D0;0x00;<client address>;0x00;0x0040;0x0040;0x0000;0x015E;0x0015;0x0015)
Wait(500)
Send(ACI_GATT_DISC_ALL_PRIMARY_SERVICES;<connection handle>)
ACI_GATT_DISC_ALL_PRIMARY_SERVICES needs a connection handle, which is only known at runtime, it would need to be extracted from a response to the ACI_GAP_CREATE_CONNECTION command. is this possible, or is it possible to set the handle to a constant value?
2025-12-10 7:51 AM
Hello @connoisseur_de_mimi, no possibility to extract handle from response nor to set in a constant value. In most cases, handle does not change in between script executions loop, need to get it value at first execution and use this value in script.
2026-01-28 1:39 AM - edited 2026-01-28 1:40 AM
Unfortunately this seems not to work. Consider this simple script:
# Script recording starts on 11/12/2025 19:25:34
Send(ACI_GAP_CREATE_CONNECTION;0x0004;0x0004;0x00;0x000000000000;0x00;0x0006;0x0006;0x0000;0x000A;0x0000;0x0000)
Wait(500)
Send(ACI_GATT_DISC_ALL_PRIMARY_SERVICES;0x080A)
Wait(1000)
Send(ACI_GAP_TERMINATE;0x080A;0x13)
# Script recording ends on 11/12/2025 19:26:40The first run is successful:
SCRIPT REPORT
Script name : myScript2.txt
Test date : 28/01/2026 10:35:20
Verdict : SUCCESS No error detected
Command | Sent | ACI status | ACI raw result
ACI_GAP_CREATE_CONNECTION | OK | 0x00 | [0x04,0x3E,0x1F,0x0A,0x00,0x0A,0x08,0x00,0x00,0x4E,0x81,0x26,0xE1,0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x06,0x00,0x00,0x00,0x0A,0x00,0x00]
ACI_GATT_DISC_ALL_PRIMARY_SERVICES | OK | 0x00 | [0x04,0x0F,0x04,0x00,0x01,0x12,0xFD]
ACI_GAP_TERMINATE | OK | 0x00 | [0x04,0x0F,0x04,0x00,0x01,0x93,0xFC]
END of reportruns after that fail:
SCRIPT REPORT
Script name : myScript2.txt
Test date : 28/01/2026 10:35:25
Verdict : FAILED Some error have been detected
Command | Sent | ACI status | ACI raw result
ACI_GAP_CREATE_CONNECTION | OK | 0x00 | [0x04,0x3E,0x1F,0x0A,0x00,0x0B,0x08,0x00,0x00,0x4E,0x81,0x26,0xE1,0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x06,0x00,0x00,0x00,0x0A,0x00,0x00]
ACI_GATT_DISC_ALL_PRIMARY_SERVICES | OK | 0x0C | [0x04,0x0F,0x04,0x0C,0x01,0x12,0xFD]
ACI_GAP_TERMINATE | OK | 0x00 | [0x04,0x0F,0x04,0x00,0x01,0x93,0xFC]
END of reportunless the connection handle is manually incremented.
CubeMon-RF log file attached.
2026-01-28 6:43 AM - edited 2026-01-28 6:44 AM
You can use Loop to increment the connection handle
Loop (CHandle, 0x080a, 0x0EFF)
Send(ACI_GAP_CREATE_CONNECTION;0x0004;0x0004;0x00;0x000000000000;0x00;0x0006;0x0006;0x0000;0x000A;0x0000;0x0000)
Wait(500)
Send(ACI_GATT_DISC_ALL_PRIMARY_SERVICES;[CHandle])
Wait(1000)
Send(ACI_GAP_TERMINATE;[CHandle];0x13)
Pause("Validate for next loop")
EndLoop
I don't know the the exact condition to avoid ConnectionHandle increment on remote device.