Skip to main content

PlatformServices

Trait PlatformServices 

Source
pub trait PlatformServices {
    type OtaWriter: OtaActions + 'static;
    type Can: BufferedCan + 'static;

    // Required methods
    fn can(&self) -> &'static Self::Can;
    fn save_config(
        &self,
        config: &SSHStampConfig,
    ) -> impl Future<Output = Result<(), HalError>>;
    fn reset(&self) -> !;
    fn ota_writer(&self) -> Self::OtaWriter;
    fn activate_uart(&self);
}
Expand description

Platform-owned services the app layer cannot provide on its own.

§Contract

  • Self::save_config must be durable: after it returns Ok(()) the config must survive a reboot.
  • Self::reset must not return.
  • Self::ota_writer may be called multiple times; each call yields a fresh writer suitable for a single OTA session.
  • Self::activate_uart signals the platform’s buffered UART task (if any) that it is OK to start streaming. Idempotent.

Required Associated Types§

Source

type OtaWriter: OtaActions + 'static

OTA writer type this platform provides. Must live for the whole SFTP session, so 'static is required.

Source

type Can: BufferedCan + 'static

Buffered CAN type this platform provides. The CAN pump task owns it for the lifetime of the device, so 'static is required.

Required Methods§

Source

fn can(&self) -> &'static Self::Can

Access the platform’s buffered CAN interface for the SSH can subsystem bridge.

Source

fn save_config( &self, config: &SSHStampConfig, ) -> impl Future<Output = Result<(), HalError>>

Persist the full config to non-volatile storage.

§Errors

Returns HalError::Flash on write / erase failure.

Source

fn reset(&self) -> !

Reset the device. Does not return.

Source

fn ota_writer(&self) -> Self::OtaWriter

Construct a fresh OTA writer for a new SFTP OTA session.

Source

fn activate_uart(&self)

Signal the platform’s buffered UART task that SSH is ready and UART transfer may start. Idempotent.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§