pub struct SetSoc;Expand description
Represents a command to set the State of Charge (SOC) percentage.
Implementations§
Source§impl SetSoc
impl SetSoc
Sourcepub fn request(address: Address, soc_percent: f32) -> Vec<u8> ⓘ
pub fn request(address: Address, soc_percent: f32) -> Vec<u8> ⓘ
Creates a request frame to set the SOC percentage on the BMS.
§Arguments
address- The address of the BMS (should beAddress::Hostwhen sending from host).soc_percent- The desired SOC percentage (0.0 to 100.0). Values outside this range will be clamped.
§Returns
A byte vector representing the request frame.
This is a low-level function. Users might prefer client methods.
Sourcepub fn reply_size() -> usize
pub fn reply_size() -> usize
Expected size of the reply frame for a set SOC command.
Sourcepub fn decode(rx_buffer: &[u8]) -> Result<(), Error>
pub fn decode(rx_buffer: &[u8]) -> Result<(), Error>
Decodes the response frame for a set SOC command. This typically just validates the checksum and length.
§Arguments
rx_buffer- The response frame received from the BMS.
§Returns
An empty Result if successful, or an Error if decoding fails.
This is a low-level function. Users might prefer client methods.
Auto Trait Implementations§
impl Freeze for SetSoc
impl RefUnwindSafe for SetSoc
impl Send for SetSoc
impl Sync for SetSoc
impl Unpin for SetSoc
impl UnwindSafe for SetSoc
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more