Skip to main content
Version: 3.1.0

Gate

The gate is a major tool of the Luos ecosystem. It is allowing you to translate any Luos architecture into a more convenient format for standard software ([JSON] most of the time) and to stream and receive this formatted information into any kind of communication way such as serial interface, WiFi, Bluetooth, Lora, ...

You can use it to take control of any embedded service with any languages on any machine. For example, we use it in Pyluos or ROS.

The gate is a simple embedded app service, so it can work on any MCU running Luos without any modification.

The gate service must be used with a driver service called pipe that can be hosted into different kinds of nodeHardware element (MCU) hosting and running Luos and hosting one or several services. allowing you to choose the communication way fitting with your project (USB, Wifi, Bluetooth, etc.).

Default Gate Process

The default behavior of the gate is optimized for system that only have drivers and control the entire behavior through a distant machine.

  1. At power up, the gate make a network detection to find a pipe service. (Optional)
  2. The gate wait to receive a detection message from a pipe.
  3. At detection command, the gate perform a new detection and generate a formated routing table to send it back to the pipe.
  4. Then the gate evaluate the time needed to convert the entire network values into the selected format. (Optional)
  5. the gate setup all the network service to send back their values at the optimal frequency. (Optional)
  6. At this optimal frequency the gate generate formated data and send commands comming from a pipe.
caution

The gate service refreshes sensors informations as fast as it can, so that can be intensive to Luos network bandwidth.

The gate and the pipe are two separate services, they can be put on the same node or on separate node.

A Gate and a pipe on the same node

In that configuration, you put two services in the node as shown below:

#include "luos_engine.h"
#include "pipe.h"
#include "gate.h"

int main(void)
{
Luos_Init();
Pipe_Init();
Gate_Init();

while (1)
{
Luos_Loop();
Pipe_Loop();
Gate_Loop();
}
}
luos_imgluos_img

In that configuration formatted messages don't pass through the Luos network and stay in localhost.

A Gate and a pipe on separate node

When the gate and the pipe are on separate nodes, formated messages transit into the network and use even more bandwidth on the network and add latency.

luos_imgluos_img

The gate configurations

The default process described above can be changed using different configurations that you can use in the file node_config.h.

You could need to change it if you have apps on your Luos embedded system.

ParametersDefaults valueDescription
GATE_BUFF_SIZE1024Maximum size of 1 formatted Data.
GATE_POLLINGNOT DEFINEDNo auto-refresh, always ask for data (more intensive to Luos bandwidth).
NODETECTIONNOT DEFINEDGate does not make detection at power up. Use it only if you have another app performing the detection
INIT_TIME150Number of millisecond allowing all node to properly start before launching a detection.

If you have an app service on your device managing detections you should define NODETECTION avoiding useless detection from the gate at boot.

If you have an app service on your device using auto-update you should define GATE_POLLING avoiding the gate to take the lead on the services your App is using.

Gate custom conversion

The Gate is allowing you to create you own custom conversion. If you are using Platformio, this specific configuration have to be managed on the build_flags. more information on the Platformio page

To do so you have to :

  • use the TinyJSON default conversion code as reference. Copy paste it on your lib folder
  • Rename this folder as you want
  • On your platformio.ini modify the Gate conversion format to use your custom one : -D GATEFORMAT=custom_folder_name
  • Now you can add and improve the conversion code as you want in your project.