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
These commands are used to start a process or a functionality or to display critical information.
- The $ command makes the module enter Command mode
- The A starts the advertisement by the peripheral device
- The F command starts the scan as central device
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.
- 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
These commands list critical information in multiple lines. The information will end with the characters END.
- 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.
- 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.
- Command SHR reads the content of the server service characteristic on the local device by addressing its handle
- Command SHW writes content of characteristic in server service to 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
These commands are used for scripting process of the module.
- Command WR starts execution of the script
- Command WP stops script execution
- Command WC clears the script, if any, loaded in the RN4870