ble gatt - GATT-level BLE Tests

Perform GATT-level BLE interactions with the DUT.

Usage:

- command: ble gatt connect addr:<address> [<timeout> [<minRSSI>]]
  [retry: <retryCount>]

- command: ble gatt connect name:<name> [<timeout> [<minRSSI>]]
  [retry: <retryCount>]

- command: ble gatt disconnect
  [retry: <retryCount>]

- command: ble gatt discover
  [retry: <retryCount>]

- command: ble gatt match char:<charUUID> <matchHex>
  [retry: <retryCount>]

- command: ble gatt read char:<charUUID> <matchHex>
  [retry: <retryCount>]

- command: ble gatt sub char:<charUUID>
  [retry: <retryCount>]

- command: ble gatt write char:<charUUID> <valueHex>
  [retry: <retryCount>]

Argument

Description

name

GAP name advertised by the DUT, given as name:<name>.

address

DUT’s BLE MAC address (XX:XX:XX:XX:XX:XX), given as addr:<address>.

timeout

Connect timeout, in seconds (default: 5s).

minRSSI

Minimum RSSI, in dBm, required to accept an advertisement during connect (optional; default: no filtering).

connect

Connect to the GATT peripheral, by address or by advertised name.

disconnect

Disconnect from the GATT peripheral. Succeeds (result not connected) even if no connection is active.

discover

Discover GATT services and characteristics on the connected peripheral. Fails if no services are found.

match

Poll a characteristic, waiting up to matchTimeout for its value to equal matchHex. Does not require a prior sub.

read

Read a GATT characteristic’s current value.

sub

Subscribe to notifications from a GATT characteristic.

write

Write to a GATT characteristic.

charUUID

Characteristic UUID (16-bit short form or full 128-bit UUID), given as char:<charUUID>.

matchHex

For match: hex-encoded bytes the characteristic’s value must equal. For read: an optional hex-encoded prefix; the step fails if the characteristic’s value (as hex) does not start with this prefix.

matchTimeout

Timeout, in seconds, for match to wait for the expected value (optional; default: 5s).

valueHex

Hex-encoded bytes to write to the characteristic.

retryCount

Number of times to retry the test step (optional)

match accepts an optional timeout as a third argument (ble gatt match char:<charUUID> <matchHex> [<matchTimeout>]); connect accepts optional timeout and minRSSI as shown above.

Examples

Note

Using the ble gatt command on a PLT-300A requires a supported BLE test dongle.

Note

Use ble gatt to exercise the DUT’s application-level BLE stack (GATT services and characteristics). This is a way to perform a functional test of a product’s BLE features. Use ble test for RF-only, link-layer transmitter/receiver tests (no GATT involved), and bledis for a simple presence/discovery check without reading or writing any characteristic.