A variety of universal asynchronous receiver/transmitter (UART) commands are used to control and configure the RN4870 module. All commands contain one, two or three case-insensitive characters and end with a carriage return ('\r', \x0d). The comma character is the delimiter for the commands and any argument. The list of commands available on the RN4870 can be classified into the following groups:
- Action commands
- Set/Get commands
- List commands
- Service definition
- Characteristic access
- Script control
Action Commands
These commands are used to start a process or a functionality or to display critical information.
Examples
- The $ command makes the module enter Command mode
- The A command starts the advertisement by the peripheral device
- The F command starts the scan as central device
Set/Get Commands
These commands are used to configure or read the configuration of the various functions of the module. The Set commands, which are used to configure, all begin with the letter S and need a reboot after each command for the command to take effect. The Get commands, which are used to read the current configuration, begin with the letter G.
Examples
- Command SN sets a name for the device
- Command SF, 1 resets the device to factory defaults
- Command SS sets the default services to be supported by the RN4870 in GAP server role
- Command GK gets the current connection status
List Commands
These commands list critical information in multiple lines. The information will end with the characters END.
Examples
- Command LS lists the server services and their characteristics
- Command LC lists the available client services and their characteristics
Service Configuration Commands
These commands are used to define services and their characteristics. All the definition will be stored in the Non-volatile memory (NVM) which can be restored after a power cycle.
Examples
- Command PS sets the universally unique identifier (UUID) of the public or the private service
- Command PC sets a private characteristic
Characteristic Access Commands
These commands are used to access and write the server/client characteristics. To address server services, the first letter of the command is S. To address client services, the first letter of the command is C.
Examples
- Command SHR reads the content of the server service characteristic on the local device by addressing its handle
- Command SHW writes the content of characteristic in server service to the local device by addressing its handle
- Command CHR reads the content of the client service characteristic from the remote device by addressing its handle
- Command CHW writes the content of the client service characteristic from the remote device by addressing its handle
Scripting Commands
These commands are used for scripting process of the module.
Examples
- Command WR starts execution of the script
- Command WP stops script execution
- Command WC clears the script, if any, loaded in the RN4870