pub trait ChipImpl:
HlComms
+ Send
+ Sync
+ 'static {
// Required methods
fn update_init_state(
&mut self,
status: &mut InitStatus,
) -> Result<ChipInitResult, PlatformError>;
fn get_arch(&self) -> Arch;
fn get_telemetry(&self) -> Result<Telemetry, PlatformError>;
fn arc_msg(&self, msg: ArcMsgOptions) -> Result<ArcMsgOk, PlatformError>;
fn get_neighbouring_chips(
&self,
) -> Result<Vec<NeighbouringChip>, PlatformError>;
fn as_any(&self) -> &dyn Any;
fn get_device_info(&self) -> Result<Option<DeviceInfo>, PlatformError>;
}
Expand description
Defines common functionality for all chips. This is a convinence interface that allows chip type agnostic code to be written.
As a general rule the chip should not be accessed without an explicit request from the user. This means that chip initialization must be explicity called and for example if the user has not explicity stated that they want to enumerate remote chips, then we won’t even start looking at remote readiness. This is to avoid situations where a problematic state is reached and causes an abort even if that capability is not needed.
Required Methods§
Sourcefn update_init_state(
&mut self,
status: &mut InitStatus,
) -> Result<ChipInitResult, PlatformError>
fn update_init_state( &mut self, status: &mut InitStatus, ) -> Result<ChipInitResult, PlatformError>
Update the initialization state of the chip. The primary purpose of this function is to tell the caller when it is safe to starting interacting with the chip.
However the secondary purpose is to provide information about what chip functions are currently available for use. For example if the arc is not ready, then we should not try to send an arc message. Or in a more complex example, if the arc is ready, but the ethernet is not (for example the ethernet fw is hung) then we will be able to access the local arc, but won’t be able to access any remote chips.
Sourcefn get_arch(&self) -> Arch
fn get_arch(&self) -> Arch
Returns the current arch of the chip, can be used to avoid needing to ducktype when downcasting.
Sourcefn get_telemetry(&self) -> Result<Telemetry, PlatformError>
fn get_telemetry(&self) -> Result<Telemetry, PlatformError>
Get telemetry information from the chip. The information is not cached, so should not be called repeatedly.
Sourcefn arc_msg(&self, msg: ArcMsgOptions) -> Result<ArcMsgOk, PlatformError>
fn arc_msg(&self, msg: ArcMsgOptions) -> Result<ArcMsgOk, PlatformError>
Send an arc_msg to the underlying chip.
Sourcefn get_neighbouring_chips(&self) -> Result<Vec<NeighbouringChip>, PlatformError>
fn get_neighbouring_chips(&self) -> Result<Vec<NeighbouringChip>, PlatformError>
Get a list of neighbouring chips. Will return an empty list for gs and up to four chips for wh.
Sourcefn get_device_info(&self) -> Result<Option<DeviceInfo>, PlatformError>
fn get_device_info(&self) -> Result<Option<DeviceInfo>, PlatformError>
Get information about the underlying chip transport. This is a hack to get the physical id of the chip.