Struct CellTemperatures

Source
pub struct CellTemperatures;
Expand description

Represents a command to request individual cell temperatures. The BMS returns cell temperatures in multiple frames.

Implementations§

Source§

impl CellTemperatures

Source

pub fn request(address: Address) -> Vec<u8>

Creates a request frame to read individual cell temperatures from the BMS.

§Arguments
  • address - The address of the BMS (should be Address::Host when sending from host).
§Returns

A byte vector representing the request frame.

This is a low-level function. Users might prefer client methods.

Source

pub fn reply_size(n_sensors: u8) -> usize

Calculates the total expected reply size in bytes for all frames for a given number of temperature sensors.

§Arguments
  • n_sensors - The number of temperature sensors in the battery pack.
Source

pub fn decode(rx_buffer: &[u8], n_sensors: u8) -> Result<Vec<i32>, Error>

Decodes the individual cell temperature data from a concatenated multi-frame response.

§Arguments
  • rx_buffer - The concatenated response frames received from the BMS.
  • n_sensors - The total number of temperature sensors expected.
§Returns

A Result containing a Vec<i32> of cell temperatures in degrees Celsius or an Error if decoding fails. Note that the BMS adds an offset of 40 to the temperature values, which is handled by this function.

This is a low-level function. Users might prefer client methods.

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.