An algorithm for encoding and sending messages, resync execution.
- The python module is implemented as a part of client software installed on the IoT device.
- Each time a client wants to send telemetry data it must be passed (as either string or byte array) to the appropriate route in the LE client module
- A copy of the current LE state is created and saved as a backup buffer. The library encrypts the data using the provided secret key. As a result of encryption, the MAC is generated
- The message sent to the gateway consists of fields: caller id, payload, MAC.
- The program checks if the response has been received
- If there is a problem with the connection or the response has not been received, we revert the LE state to its previous iteration using the backup buffer, initialized in point 3.
- If the response is received, the header type of the message is checked. It could be either ‘data’. meaning that everything went smoothly, or ‘reset’ meaning that the hard reset is necessary
- In case of receiving the ‘data’ header, we check if the payload matches the established message sent by the gateway. If it’s not we revert back to the previous key, as described in point 6.
- If the received header is ‘reset’, the hard-reset mechanism is employed and the process is repeated.