RN4870 Command Groups

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
  • TheA command starts the advertisement by the peripheral device
  • TheF command starts the scan as central device
ActionCommands.png

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 letterS 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 letterG.

Examples

  • CommandSN sets a name for the device
  • CommandSF, 1 resets the device to factory defaults
  • CommandSS sets the default services to be supported by the RN4870 in GAP server role
  • CommandGK gets the current connection status
SetAndGetCommands.png

List Commands

These commands list critical information in multiple lines. The information will end with the charactersEND.

Examples

  • CommandLS lists the server services and their characteristics
  • CommandLC lists the available client services and their characteristics
ListCommands.png

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

  • CommandPS sets the universally unique identifier (UUID) of the public or the private service
  • CommandPC sets a private characteristic
ServiceCommands.png

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 isS. To address client services, the first letter of the command isC.

Examples

  • CommandSHR reads the content of the server service characteristic on the local device by addressing its handle
  • CommandSHW writes the content of characteristic in server service to the local device by addressing its handle
  • CommandCHR reads the content of the client service characteristic from the remote device by addressing its handle
  • CommandCHW writes the content of the client service characteristic from the remote device by addressing its handle
CharacteristicAccessCommands.png

Scripting Commands

These commands are used for scripting process of the module.

Examples

  • CommandWR starts execution of the script
  • CommandWP stops script execution
  • CommandWC clears the script, if any, loaded in the RN4870
ScriptCommands.png