Firmware FAQ

Where sensors are read ?

When calling ODev.loop () data from all sensors will be read by executing the Device.hasChanged () method, which reads the data and stores the value if it has been changed.

Check methods: OpenDeviceClass::checkSensorsStatus()

Specialized sensors have their own class that uses the third-party library to do the reading (Ex.: RFIDSensor)

Note that you can also be the data using interrupts (must be enabled in config.h, ENABLE_DEVICE_INTERRUPTION).

Where data is sent ?

Each type of connection has its implementation as: MQTTWifiConnection.cpp

After reading the sensors (OpenDeviceClass::checkSensorsStatus ()) the method: OpenDeviceClass::onSensorChanged

Where is the data received (from the server)?

Each type of connection has its implementation as mentioned before. But the basic implementation of reading the coming data can be found in the class: 

But the basic implementation of reading the coming data can be found in the class: DeviceConnection.

Check methods: DeviceConnection::checkDataAvalible()

Where are the commands evaluated?

After the data is received, the function will be executed: onMessageReceivedImpl (OpenDevice.h)

It will handle the commands sent by the server in specific actions defined by the protocol

How are dependencies / connections / devices discovered?

The firmware uses a number of build directives to include the dependencies according to the libraries included and the platform being run.

This is a smart way to activate features without having to change the code

Most of this logic is in: dependencies.h and OpenDevice.h