mirror of
https://github.com/mysensors/MySensors.git
synced 2026-02-20 01:21:27 +01:00
The dummy signing driver backend is used. But with this commit all framework logic for managing signed messages in the MySensors ecosystem is implemented and enables more sophisticated signing backends to be added later on. For a sensor (or gateway) that require a gateway to send signed messages to it, add 'true' as the fifth argument to 'begin'. The gateway will automatically inform a node of it's signing requirements as soon as it receivs the nodes signing preference. It is important to understand that if the gateway require signing, it will in this implementation only require signing from nodes that require signing by the gateway. If the sensor requires signing from another node on the network which it communicates directly with, it needs to send 'true' in an internal message of type I_REQUEST_SIGNING.
See NodeJsController/Readme.md for usage instructions...
Technical details to write your own controller
All initialization the bootloader does (finding parent / requesting nodeId on first start) uses the same packets as a normal MySensors sketch. There is no need for the controller to distinguish between packets from the bootloader and packets from normal sketch execution. The controller only needs to care about two additional request/response communications. All communication is binary.FirmwareConfig
- the bootloader sends a FirmwareConfigRequest packet to the gateway to request information about the firmware it should execute:
typedef struct
{
uint16_t type;
uint16_t version;
} FirmwareConfigRequest; - the gateway (the controller) responds with a FirmwareConfigResponse including details about the firmware the sensor should execute:
typedef struct
{
uint16_t type;
uint16_t version;
uint16_t blocks;
uint16_t crc;
} FirmwareConfigResponse;
Firmware
- the bootloader sends a FirmwareRequest packet to the gateway to request a specific subset (block) of the compiled firmware:
typedef struct
{
uint16_t type;
uint16_t version;
uint16_t block;
} FirmwareRequest; - the gateway (the controller) responds with a FirmwareResponse including the specific block of the compiled firmware:
typedef struct
{
uint16_t type;
uint16_t version;
uint16_t block;
uint8_t data[FIRMWARE_BLOCK_SIZE];
} FirmwareResponse;