Central / GATT Write
Overview
Similar to the Central sample, except that this application use GATT Write Without Response.
Requirements
BlueZ running on the host, or
A board with Bluetooth LE support
Building and Running
Build and flash the sample as follows, replacing <board> with your target board:
west build -b <board> samples/bluetooth/central_gatt_write
west flash
After flashing, the sample scans for nearby Bluetooth LE devices, connects to the first one found, and continuously sends GATT Write Without Response commands. Use the Peripheral GATT Write sample on a second board as the peripheral.
Notification modes
By default both peers exchange GATT Write Without Response commands. Two Kconfig
options (defined in Kconfig.gatt_write) select notification-based workloads
instead:
CONFIG_USE_NOTIFYswitches the workload to GATT Notifications: the peripheral streams notifications and the central subscribes to and receives them.CONFIG_USE_FULL_DUPLEX(enabled by default, and only meaningful together withCONFIG_USE_NOTIFY) makes both peers subscribe to and notify each other. Disable it to run the one-directional (simplex) path where only the peripheral notifies and the central receives.
For example, to build in simplex notification mode:
west build -b <board> samples/bluetooth/central_gatt_write -- -DCONFIG_USE_NOTIFY=y -DCONFIG_USE_FULL_DUPLEX=n