pub struct StatusPacket<'a> { /* private fields */ }Expand description
A status response that is currently in the read buffer of a bus.
When dropped, the response data is removed from the read buffer.
Implementations§
Source§impl<'a> StatusPacket<'a>
impl<'a> StatusPacket<'a>
Sourcepub fn as_bytes(&self) -> &[u8] ⓘ
pub fn as_bytes(&self) -> &[u8] ⓘ
Get the raw bytes of the message.
This includes the message header and the parameters. It does not include the CRC or byte-stuffing.
Sourcepub fn instruction_id(&self) -> u8
pub fn instruction_id(&self) -> u8
The instruction ID of the response.
Sourcepub fn error_number(&self) -> u8
pub fn error_number(&self) -> u8
The error number of the status packet.
This is the lower 7 bits of the error field.
Sourcepub fn alert(&self) -> bool
pub fn alert(&self) -> bool
The alert bit from the error field of the response.
This is the 8th bit of the error field.
If this bit is set, you can normally check the “Hardware Error” register for more details. Consult the manual of your motor for more information.
Sourcepub fn parameters(&self) -> &[u8] ⓘ
pub fn parameters(&self) -> &[u8] ⓘ
The parameters of the response.
Trait Implementations§
Source§impl<'a> Debug for StatusPacket<'a>
impl<'a> Debug for StatusPacket<'a>
Source§impl<'a, 'b> From<&'b StatusPacket<'a>> for Response<&'b [u8]>
impl<'a, 'b> From<&'b StatusPacket<'a>> for Response<&'b [u8]>
Source§fn from(status_packet: &'b StatusPacket<'a>) -> Self
fn from(status_packet: &'b StatusPacket<'a>) -> Self
Converts to this type from the input type.
Source§impl<'a> From<StatusPacket<'a>> for Response<Vec<u8>>
impl<'a> From<StatusPacket<'a>> for Response<Vec<u8>>
Source§fn from(status_packet: StatusPacket<'a>) -> Self
fn from(status_packet: StatusPacket<'a>) -> Self
Converts to this type from the input type.
Source§impl<'a> TryFrom<StatusPacket<'a>> for Response<()>
impl<'a> TryFrom<StatusPacket<'a>> for Response<()>
Source§type Error = InvalidParameterCount
type Error = InvalidParameterCount
The type returned in the event of a conversion error.
Source§impl<'a> TryFrom<StatusPacket<'a>> for Response<Ping>
impl<'a> TryFrom<StatusPacket<'a>> for Response<Ping>
Source§type Error = InvalidParameterCount
type Error = InvalidParameterCount
The type returned in the event of a conversion error.
Source§impl<'a> TryFrom<StatusPacket<'a>> for Response<u16>
impl<'a> TryFrom<StatusPacket<'a>> for Response<u16>
Source§type Error = InvalidParameterCount
type Error = InvalidParameterCount
The type returned in the event of a conversion error.
Source§impl<'a> TryFrom<StatusPacket<'a>> for Response<u32>
impl<'a> TryFrom<StatusPacket<'a>> for Response<u32>
Source§type Error = InvalidParameterCount
type Error = InvalidParameterCount
The type returned in the event of a conversion error.
Auto Trait Implementations§
impl<'a> Freeze for StatusPacket<'a>
impl<'a> RefUnwindSafe for StatusPacket<'a>
impl<'a> Send for StatusPacket<'a>
impl<'a> Sync for StatusPacket<'a>
impl<'a> Unpin for StatusPacket<'a>
impl<'a> UnwindSafe for StatusPacket<'a>
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