pub struct FirmwareManager { /* private fields */ }Expand description
The firmware management package running on a device, TS006-1.0.0.
It reports the versions the device was built with, the upgrade image it is holding, and
keeps the one programmed reboot the specification allows. It owns no clock: the caller
passes the time into FirmwareManager::heard when the device knows it, and a device
that does not know the time refuses a reboot set for a moment in time, as section 3.3
asks.
Implementations§
Source§impl FirmwareManager
impl FirmwareManager
Sourcepub const fn new(firmware: u32, hardware: u32) -> FirmwareManager
pub const fn new(firmware: u32, hardware: u32) -> FirmwareManager
Sourcepub const fn with_image(self, image: Image) -> FirmwareManager
pub const fn with_image(self, image: Image) -> FirmwareManager
Sourcepub const fn set_image(&mut self, image: Option<Image>)
pub const fn set_image(&mut self, image: Option<Image>)
Puts an image in the device’s store, replacing whatever was there.
§Arguments
image- the image, orNoneonce one has been installed or deleted.
Sourcepub const fn reboot_at_s(&self) -> Option<u32>
pub const fn reboot_at_s(&self) -> Option<u32>
The moment the device is to reboot, where one was programmed as a time.
§Returns
Seconds since the GPS epoch, and None when the reboot is a countdown, immediate, or
not programmed at all.
Sourcepub const fn reboot_in_s(&self) -> Option<u32>
pub const fn reboot_in_s(&self) -> Option<u32>
How long until the device is to reboot, where one was programmed as a countdown.
§Returns
The seconds left, and None when the reboot is a moment in time, immediate, or not
programmed at all.
Sourcepub const fn reboot_now(&self) -> bool
pub const fn reboot_now(&self) -> bool
Whether the device was told to reboot at once.
§Returns
true when it should reboot as soon as it can, in which case it sends no answer.
Sourcepub const fn rebooted(&mut self)
pub const fn rebooted(&mut self)
Forgets the programmed reboot, for a device that has carried it out.
Sourcepub fn heard_at(
&mut self,
payload: &[u8],
now_s: Option<u32>,
out: &mut [u8],
) -> Result<usize, LorawanError>
pub fn heard_at( &mut self, payload: &[u8], now_s: Option<u32>, out: &mut [u8], ) -> Result<usize, LorawanError>
Reads a downlink on the firmware port and writes the answers it calls for.
Commands run in the order they arrive, and each writes its answer after the one
before it, as section 3 asks. A reboot the device was told to do at once is recorded
on FirmwareManager::reboot_now and answered with nothing, because the device will
be gone.
§Arguments
payload- what arrived on portPORT.now_s- what the device believes the time is, in seconds since the GPS epoch, orNonewhen it does not know.out- where to write the answers.
§Returns
How many bytes of answer were written.
§Errors
The first error a command raised, or LorawanError::PayloadTooLong when the
answers do not fit.
Sourcepub fn heard(
&mut self,
payload: &[u8],
out: &mut [u8],
) -> Result<usize, LorawanError>
pub fn heard( &mut self, payload: &[u8], out: &mut [u8], ) -> Result<usize, LorawanError>
Trait Implementations§
Source§impl Clone for FirmwareManager
impl Clone for FirmwareManager
Source§fn clone(&self) -> FirmwareManager
fn clone(&self) -> FirmwareManager
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more