VitroIO SDK
Software development kit for Vitro Shard.
|
Class is a main component of the node firmware. More...
#include <node_controller.h>
Public Member Functions | |
NodeController (Canbus *canbus, const FirmwareId &fwId, const Version &fwVersion, FlashSpace environmentFlashSpace, FlashSpace regionAFlashSpace, FlashSpace regionBFlashSpace, EventQueue *targetQueue, uint32_t eventQueueSize=VITROIO_NODE_CONTROLLER_DEFAULT_EVENT_QUEUE_SIZE) | |
Contructor initializes the controller and chains an internal event queue to the targetQueue . More... | |
NodeController (Canbus *canbus, const FirmwareId &fwId, const Version &fwVersion, FlashSpace environmentFlashSpace, FlashSpace regionAFlashSpace, FlashSpace regionBFlashSpace, osPriority priority=osPriorityNormal, uint32_t eventQueueSize=VITROIO_NODE_CONTROLLER_DEFAULT_EVENT_QUEUE_SIZE) | |
Contructor initializes the controller and creates internal event loop using thread with priority priority . More... | |
NodeController (Canbus *canbus, const FirmwareId &fwId, const Version &fwVersion, osPriority priority=osPriorityNormal, uint32_t eventQueueSize=VITROIO_NODE_CONTROLLER_DEFAULT_EVENT_QUEUE_SIZE) | |
Contructor initializes the controller and creates internal event loop using thread with priority priority . More... | |
NodeController (Canbus *canbus, const FirmwareId &fwId, const Version &fwVersion, EventQueue *targetQueue, uint32_t eventQueueSize=VITROIO_NODE_CONTROLLER_DEFAULT_EVENT_QUEUE_SIZE) | |
Contructor initializes the controller and chains an internal event queue to the targetQueue . More... | |
~NodeController () | |
bool | isValid () |
Function allows to check whether the controller is in valid state. More... | |
int | initCommunication (Transport_layer *layer) |
Function initializes communication with gateway. This method blocks until the communication is not initialized and no error occurred. More... | |
int | initCommunication (uint32_t sync_time, Transport_layer *layer) |
Function initializes communication with gateway. This method blocks until the communication is not initialized and no error occurred. More... | |
uint32_t | nodeId () |
Function allows to obtain node ID assigned by gateway during initialization of communication. More... | |
void | setExternalFrameCallback (std::function< void(const CanbusFrame &)>) |
Function allows to attach a handler for frames with paramId matching VITROIO_PROTOCOL_EXTERNAL_FRAME. More... | |
Class is a main component of the node firmware.
The class handles standard operations of vitroio system such like firmware upgrade and initialization of communication with gateway. It requires flash memory space for storing environment variables.
The class uses an event loop for handling events. The event queue can be managed by external queue specified by user or by internal queue with thread of specified priority.
|
explicit |
Contructor initializes the controller and chains an internal event queue to the targetQueue
.
targetQueue
must be run before usage of this class (construction of the object can be done earlier).Initialization includes all of necessary components.
There is not guarantee that the object is in valid state. User should call isValid() method to determine if the object was initialized successfully. When the object is in invalid state, the behaviour is undefined.
The constructor uses mbed::EventQueue::chain method for connection to targetQueue
.
canbus | Pointer to Canbus object |
fwId | id of firmware |
fwVersion | Version of firmware |
environmentFlashSpace | Specifies flash memory space for storing environment variables |
regionAFlashSpace | Specifies region A of flash memory space intended for firmware |
regionBFlashSpace | Specifies region B of flash memory space intended for firmware |
targetQueue | External event queue to which the internal queue is to be chained |
eventQueueSize | Size of internal event queue |
|
explicit |
Contructor initializes the controller and creates internal event loop using thread with priority priority
.
Initialization includes all of necessary components.
There is not guarantee that the object is in valid state. User should call isValid() method to determine if the object was initialized successfully. When the object is in invalid state, the behaviour is undefined.
canbus | Pointer to Canbus object |
fwId | id of firmware |
fwVersion | Version of firmware |
environmentFlashSpace | Specifies flash memory space for storing environment variables |
regionAFlashSpace | Specifies region A of flash memory space intended for firmware |
regionBFlashSpace | Specifies region B of flash memory space intended for firmware |
priority | Priority of thread for handling internal events |
eventQueueSize | Size of internal event queue |
vitroio::sdk::NodeController::NodeController | ( | Canbus * | canbus, |
const FirmwareId & | fwId, | ||
const Version & | fwVersion, | ||
osPriority | priority = osPriorityNormal , |
||
uint32_t | eventQueueSize = VITROIO_NODE_CONTROLLER_DEFAULT_EVENT_QUEUE_SIZE |
||
) |
Contructor initializes the controller and creates internal event loop using thread with priority priority
.
Initialization includes all of necessary components.
There is not guarantee that the object is in valid state. User should call isValid() method to determine if the object was initialized successfully. When the object is in invalid state, the behaviour is undefined.
vitroio::sdk::NodeController::NodeController | ( | Canbus * | canbus, |
const FirmwareId & | fwId, | ||
const Version & | fwVersion, | ||
EventQueue * | targetQueue, | ||
uint32_t | eventQueueSize = VITROIO_NODE_CONTROLLER_DEFAULT_EVENT_QUEUE_SIZE |
||
) |
Contructor initializes the controller and chains an internal event queue to the targetQueue
.
targetQueue
must be run before usage of this class (construction of the object can be done earlier).Initialization includes all of necessary components.
There is not guarantee that the object is in valid state. User should call isValid() method to determine if the object was initialized successfully. When the object is in invalid state, the behaviour is undefined.
The constructor uses mbed::EventQueue::chain method for connection to targetQueue
.
vitroio::sdk::NodeController::~NodeController | ( | ) |
int vitroio::sdk::NodeController::initCommunication | ( | Transport_layer * | layer | ) |
Function initializes communication with gateway. This method blocks until the communication is not initialized and no error occurred.
int vitroio::sdk::NodeController::initCommunication | ( | uint32_t | sync_time, |
Transport_layer * | layer | ||
) |
Function initializes communication with gateway. This method blocks until the communication is not initialized and no error occurred.
bool vitroio::sdk::NodeController::isValid | ( | ) |
Function allows to check whether the controller is in valid state.
uint32_t vitroio::sdk::NodeController::nodeId | ( | ) |
Function allows to obtain node ID assigned by gateway during initialization of communication.
void vitroio::sdk::NodeController::setExternalFrameCallback | ( | std::function< void(const CanbusFrame &)> | ) |
Function allows to attach a handler for frames with paramId matching VITROIO_PROTOCOL_EXTERNAL_FRAME.