RN4870/71 Bluetooth
®
Low Energy Module User’s Guide
DS50002466A-page 46 2016 Microchip Technology Inc.
2.9.6 SHW
According to the command-interpolation method described in Section 2.9.1 “Definition
of Characteristic Access Commands”, command SHW writes content of characteristic in
Server Service to local device by addressing its handle.
This command takes two parameters. The first parameter is the 16-bit hex value of the
handle which corresponds to the characteristic of the server service. The user must be
able to find match between handle and its characteristic UUID by using command LS.
The second parameter is the content to be written to the characteristic. The format of
the public characteristic is defined in the Bluetooth SIG specifications. The user defines
the format of each private characteristic.
This command is effective only if the handle is valid in server service. Characteristic in
server service is always writable regardless of its property. Characteristic property is
only for remote access.
The content of a configuration handle, which starts or stops notification/indication, is
usually set remotely. It is highly recommended not to write to the configuration handle,
although such operation is not prohibited.
When command SHW is issued to change the local content of the characteristic, a Noti-
fication/Indication can be sent to the remote device if the following conditions are met:
• An active connection exists
• Remote device supports the corresponding service and characteristic in client role
• Property of corresponding characteristic supports notification or indication
• Notification or indication service for the corresponding characteristic has been
started by the remote device
2.10 SCRIPT COMMANDS
The following section describes the commands used for the embedded scripting func-
tion on the RN4870/71 module. For more details on the Embedded Scripting Feature,
refer to Chapter 3. “Embedded Scripting Feature”.
2.10.1
WC
Command WC clears the script, if any, loaded in the RN4870/71. It expects no
parameters.
Example: SHW,001A,64 // Set local value of characteristic Battery Level
// with value handle 0x001A to be 100%.
// If notification service has been started on Battery
// Level before, local device notifies the new
// value of 100% to the remote peer device.
Response: AOK
ERR
NFail
// Success
// Syntax error or invalid parameter
// Notification/Indication failure
Default: N/A
Example: WC // Clear the script loaded in RN4870/71 module
Response: AOK // Success