libuav original
Dependents: UAVCAN UAVCAN_Subscriber
FirmwareVersionChecker Class Reference
Firmware version checking logic. More...
#include <firmware_version_checker.hpp>
Inherits uavcan::IFirmwareVersionChecker.
Public Types | |
enum | |
This value is limited by the pool block size minus some extra data. More... | |
typedef MakeString < MaxFirmwareFilePathLength > ::Type | FirmwareFilePath |
This type is used to store path to firmware file that the target node will retrieve using the service uavcan.protocol.file.Read. | |
Public Member Functions | |
int | createFwPaths (const char *base_path) |
Creates the Directories were the files will be stored. | |
virtual bool | shouldRequestFirmwareUpdate (NodeID node_id, const protocol::GetNodeInfo::Response &node_info, FirmwareFilePath &out_firmware_file_path)=0 |
This method will be invoked when the class obtains a response to GetNodeInfo request. | |
virtual bool | shouldRetryFirmwareUpdate (NodeID node_id, const protocol::file::BeginFirmwareUpdate::Response &error_response, FirmwareFilePath &out_firmware_file_path)=0 |
This method will be invoked when a node responds to the update request with an error. | |
virtual void | handleFirmwareUpdateConfirmation (NodeID node_id, const protocol::file::BeginFirmwareUpdate::Response &response) |
This node is invoked when the node responds to the update request with confirmation. | |
Protected Member Functions | |
virtual bool | shouldRequestFirmwareUpdate (uavcan::NodeID, const uavcan::protocol::GetNodeInfo::Response &node_info, FirmwareFilePath &out_firmware_file_path) |
This method will be invoked when the class obtains a response to GetNodeInfo request. | |
virtual bool | shouldRetryFirmwareUpdate (uavcan::NodeID, const uavcan::protocol::file::BeginFirmwareUpdate::Response &, FirmwareFilePath &) |
This method will be invoked when a node responds to the update request with an error. |
Detailed Description
Firmware version checking logic.
Refer to FirmwareUpdateTrigger for details.
Definition at line 32 of file firmware_version_checker.hpp.
Member Typedef Documentation
typedef MakeString<MaxFirmwareFilePathLength>::Type FirmwareFilePath [inherited] |
This type is used to store path to firmware file that the target node will retrieve using the service uavcan.protocol.file.Read.
Note that the maximum length is limited due to some specifics of libuavcan (MaxFirmwareFilePathLength), this is NOT a protocol-level limitation.
Definition at line 37 of file firmware_update_trigger.hpp.
Member Enumeration Documentation
anonymous enum [inherited] |
This value is limited by the pool block size minus some extra data.
Please refer to the Map<> documentation for details. If this size is set too high, the compilation will fail in the Map<> template.
Definition at line 30 of file firmware_update_trigger.hpp.
Member Function Documentation
int createFwPaths | ( | const char * | base_path ) |
Creates the Directories were the files will be stored.
This is directory structure is in support of a workaround for the issues that FirmwareFilePath is 40
It creates a path structure: +---(base_path) +-c <----------- Files are cached here.
Definition at line 371 of file firmware_version_checker.hpp.
virtual void handleFirmwareUpdateConfirmation | ( | NodeID | node_id, |
const protocol::file::BeginFirmwareUpdate::Response & | response | ||
) | [virtual, inherited] |
This node is invoked when the node responds to the update request with confirmation.
Note that if by the time of arrival of the response the node is already removed, this method will not be called.
Implementation is optional; default one does nothing.
- Parameters:
-
node_id Node ID that confirmed the request. response Actual response.
Definition at line 89 of file firmware_update_trigger.hpp.
virtual bool shouldRequestFirmwareUpdate | ( | NodeID | node_id, |
const protocol::GetNodeInfo::Response & | node_info, | ||
FirmwareFilePath & | out_firmware_file_path | ||
) | [pure virtual, inherited] |
This method will be invoked when the class obtains a response to GetNodeInfo request.
- Parameters:
-
node_id Node ID that this GetNodeInfo response was received from. node_info Actual node info structure; refer to uavcan.protocol.GetNodeInfo for details. out_firmware_file_path The implementation should return the firmware image path via this argument. Note that this path must be reachable via uavcan.protocol.file.Read service. Refer to FileServer and BasicFileServer for details.
- Returns:
- True - the class will begin sending update requests. False - the node will be ignored, no request will be sent.
virtual bool shouldRequestFirmwareUpdate | ( | uavcan::NodeID | , |
const uavcan::protocol::GetNodeInfo::Response & | node_info, | ||
FirmwareFilePath & | out_firmware_file_path | ||
) | [protected, virtual] |
This method will be invoked when the class obtains a response to GetNodeInfo request.
- Parameters:
-
node_id Node ID that this GetNodeInfo response was received from. node_info Actual node info structure; refer to uavcan.protocol.GetNodeInfo for details. out_firmware_file_path The implementation should return the firmware image path via this argument. Note that this path must be reachable via uavcan.protocol.file.Read service. Refer to FileServer and BasicFileServer for details.
- Returns:
- True - the class will begin sending update requests. False - the node will be ignored, no request will be sent.
Definition at line 240 of file firmware_version_checker.hpp.
virtual bool shouldRetryFirmwareUpdate | ( | uavcan::NodeID | , |
const uavcan::protocol::file::BeginFirmwareUpdate::Response & | , | ||
FirmwareFilePath & | |||
) | [protected, virtual] |
This method will be invoked when a node responds to the update request with an error.
If the request simply times out, this method will not be invoked. Note that if by the time of arrival of the response the node is already removed, this method will not be called.
SPECIAL CASE: If the node responds with ERROR_IN_PROGRESS, the class will assume that further requesting is not needed anymore. This method will not be invoked.
- Parameters:
-
node_id Node ID that returned this error. error_response Contents of the error response. It contains error code and text. out_firmware_file_path New firmware path if a retry is needed. Note that this argument will be initialized with old path, so if the same path needs to be reused, this argument should be left unchanged.
- Returns:
- True - the class will continue sending update requests with new firmware path. False - the node will be forgotten, new requests will not be sent.
Definition at line 343 of file firmware_version_checker.hpp.
virtual bool shouldRetryFirmwareUpdate | ( | NodeID | node_id, |
const protocol::file::BeginFirmwareUpdate::Response & | error_response, | ||
FirmwareFilePath & | out_firmware_file_path | ||
) | [pure virtual, inherited] |
This method will be invoked when a node responds to the update request with an error.
If the request simply times out, this method will not be invoked. Note that if by the time of arrival of the response the node is already removed, this method will not be called.
SPECIAL CASE: If the node responds with ERROR_IN_PROGRESS, the class will assume that further requesting is not needed anymore. This method will not be invoked.
- Parameters:
-
node_id Node ID that returned this error. error_response Contents of the error response. It contains error code and text. out_firmware_file_path New firmware path if a retry is needed. Note that this argument will be initialized with old path, so if the same path needs to be reused, this argument should be left unchanged.
- Returns:
- True - the class will continue sending update requests with new firmware path. False - the node will be forgotten, new requests will not be sent.
Generated on Tue Jul 12 2022 17:17:38 by 1.7.2