5.4.3.8 Write Local Characteristic Value (SHW,<hex16>…)

Format: SHW,<hex16>,<hex value>

The command SHW writes the content of the characteristic in service to the local device by addressing its handle.

This command takes two parameters. The first parameter is the 16-bit hex value of the handle that corresponds to the characteristic of the server service. The user must find a match between the handle and its characteristic UUID by using command LS. The second parameter is the content to be written to the characteristic.

This command is effective only if the handle is valid in the local GATT service. The characteristic in the local GATT service is always writable regardless of its property. The characteristic property is only for remote access.

The content of a configuration handle is set remotely, which starts or stops notification/indication. The recommendation is not to write to the configuration handle while there is no prohibition on such operation.

The user can issue command SHW to change the local content of the characteristic, and the remote device receives a notification/indication after meeting the following conditions:

  • An active connection exists
  • Remote device supports the corresponding service and characteristic in GATT client role
  • Property of corresponding characteristic supports notification or indication
  • Notification or indication service for the corresponding characteristic is started by the remote device
    Note: Notification or indication starting by SHW is only supported in a single link. For a multiple link situation, use the SHWM command.
Example:SHW,001A,64

// Set the local value of the characteristic battery level with value handle 0x001A to 100%

// If the notification service is started on battery level before, the local device notifies the new value of 100% to the remote peer device

Response:AOK// Success
Err// Syntax error or invalid parameter
NFail// Notification/Indication failure