READER COMMAND Message

The READER COMMAND Message is used to send a basic, short command to the Smart Reader using one of the channels that supports JSON. Complex commands shall always be passed using the Direct Protocol.

Fields in the JSON READER COMMAND Message

Field Format Description Supported by
"Sequence" string or integer Have the device play one of its pre-defined UI sequences. All devices
"Leds" string Control the device’s LEDs directly. Devices with a 4-LED ramp
"RgbColor" string or integer Control the color of the device’s RGB LED directly. Devices with a RGB LED
"RgbMode" string or integer Control the mode of the device’s RGB LED directly. Devices with a RGB LED
"Buzzer" string or integer Control the device’s buzzer directly. Devices with a buzzer
"Relay" boolean, string or integer Control the device’s relay directly. Devices with one relay
"Relays" array Control the device’s relay directly. Devices with one or more relays

All fields are optional. Sending a "Sequence" field together with either a "Leds", "RgbColor", "RgbMode" or "Buzzer" field is not allowed.

Sequence field

The value selects the sequence to play.

The value may either be expressed as a decimal integer, or within an hexadecimal string.

See PLAY_SEQUENCE for the complete list of pre-defined sequences.

Leds field

The value is on 4 bytes, expressed in hexadecimal within a string.

Byte 0 controls the 1st LED, byte 1 controls the 2nd LED, byte 2 controls the 3rd LED and byte 3 controls the 4th LED.

See SET_LEDS and LED Modes for details.

RgbColor field

To be written

RgbMode field

To be written

Buzzer field

The value specifies the duration of the beep (in milliseconds; max value is 65535).

The value may either be expressed as a decimal Integer, or within an hexadecimal string.

See SET_BUZZER for details.

Relay and Relays values

The understanding of the command depends on the type of the field in the JSON object.

  • If the field has the boolean type, then value true sets the relay (active position) and value false resets the relay (idle position),
  • If the field has the integer type, then value 0 resets the relay (idle position); value -1 sets the relay forever (permanent active position). Any positive value is understood as a duration in seconds. The relay is set for the specified time and reset afterwards,
  • If the field has the string type, then values "reset" and "false" resets the relay (idle position); values "set" and "true" sets the relay forever (permanent active position). Any other value is processed as an hexadecimal number and understood as a duration in seconds. The relay is set for the specified time and reset afterwards.
  • If the field has the null type, then the current entry is discarded.

Examples

{
	"Leds":"92929292",
	"Buzzer":100
}

This command does the following:

  • Set the 4 LEDs to flash-blinking (pattern is 20% ON, 80% OFF) with a 100ms period (frequency 10Hz),
  • Beep during 100ms.
{
	"Sequence":"60"
}

This command plays the Access Granted sequence (60 in hex).

{
	"Sequence":97
}

This command plays the Access Denied sequence (61 in hex).

Channels supporting this Message

The READER COMMAND Message is accepted by the device on any channel that is suitable for JSON operation.

Over the MQTT Client channel, it goes through topic springcard/springcore/{$id}/rdr/cmd.