Introduction
What is the SynapseLink Protocol?
The SynapseLink Protocol is remote procedure call (RPC) protocol for EvoluxIoT Ecosystem. It allows the communication between the EvoluxIoT Ecosystem and the Synapse Devices by using a custom transport protocol such as MQTT which communicates through commands.
How it works
Command structure
A commands allows the communication between the EvoluxIoT Ecosystem and the Synapse Devices. It invokes a action on the Synapse Device and returns the result of it.
The structure of a command sent from the EvoluxIoT Ecosystem to the Synapse Device is:
Command Syntax
COMMAND NAME:,:COMMAND PARAMETER 1:,:COMMAND PARAMETER 2:,:(...):,:EVENT ID!COMMAND DECIMAL:,:COMMAND PARAMETER 1:,:COMMAND PARAMETER 2:,:(...):,:EVENT IDCommand Parameters
!: Indicates if the message is sent from the Synapse Device to the EvoluxIoT Ecosystem. (not included when originated from the Ecosystem Portal)COMMAND NAME/DECIMAL: The name/decimal of the command to be executed on the Synapse Device.COMMAND PARAMETER: The parameters of the command to be executed on the Synapse Device. (the number of parameters depends on the command executed)EVENT ID: The id of the event to be sent back to the EvoluxIoT Ecosystem (increments by one at each message between both parties).
Practical example
The EvoluxIoT Ecosystem sends a command to the Synapse Device.
For example a user wants to display a message on the display of the Synapse Device and in the Ecossystem Portal the user enters the text and presses show.
The ecossystem receives the instruction from the user and builds a equivalent command to be sent to the Synapse Device:
DISPLAYWRITEis the command to be executedHello Worldis the paramenter of DISPLAYWRITE which contains the text to be displayed0is the event id, assuming that this is the first communication between the Ecosystem and the Synapse Device.
Ecosystem Portal outputs
DISPLAYWRITE:,:Hello World:,:0to Synapse DeviceThe Synapse Device receives the command and sends a acknowledge back to the EvoluxIoT Ecosystem.
When the Synapse Device receives a command, the Ecosystem Portal expects a acknowledge back from the Synapse Device to ensure that the command was received successfully and it's being executed on the Synapse Device:
!is always included when it's the Synapse Device communicating with the Ecosystem Portal2is the command acknowledge represented in decimal format (0x02 in hexadecimal format)- The following parameters are the same as the command sent by the Ecosystem Portal except the event id received
1is the event id, incremented by one since one message was sent from the Ecosystem Portal to the Synapse Device before.
Synapse Device outputs
!2:,:DISPLAYWRITE:,:Hello World:,:1to Ecosystem PortalEcosystem Portal knows that the command was received successfully, it's being executed on the Synapse Device and gets ready for receving the command status response.
The Synapse Device executes the command and sends the result back to the EvoluxIoT Ecosystem.
Commands Available
| Code Hex/Dec | Command Name | Command Description |
|---|---|---|
| 0x00/0 | MAXVERSION | Returns the maximum version of the SynapseLink Protocol supported by the Synapse Device |
| 0x01/1 | HEARTBEAT | Checks if the Synapse Device is online and responsive to requests |
| 0x02/2 | ACKNOWLEDGE | Returns the acknowledge of the command sent by the Ecosystem Portal |
| 0x03/3 | REBOOT | Reboots the Synapse Device |
| 0x04/4 | DIGITALREAD | Reads the value of a digital pin |
| 0x05/5 | DIGITALWRITE | Writes a value to a digital pin |
| 0x06/6 | ANALOGREAD | Reads the value of a analog pin |
| 0x07/7 | ANALOGWRITE | Writes a value to a analog pin |
| 0x08/8 | PWMREAD | Reads the value of a pwm pin |
| 0x09/9 | PWMWRITE | Writes a value to a pwm pin |
| 0x0A/10 | DISPLAYWRITE | Writes a text to the display of the Synapse Device |