use super::lib::*;
#[cfg_attr(feature = "serde", derive(serde::Serialize))]
#[derive(Debug, Clone)]
pub struct MsgBootloaderHandshakeDepA {
#[cfg_attr(feature = "serde", serde(skip_serializing))]
pub sender_id: Option<u16>,
#[cfg_attr(feature = "serde", serde(rename(serialize = "handshake")))]
pub handshake: Vec<u8>,
}
impl ConcreteMessage for MsgBootloaderHandshakeDepA {
const MESSAGE_TYPE: u16 = 176;
const MESSAGE_NAME: &'static str = "MSG_BOOTLOADER_HANDSHAKE_DEP_A";
}
impl SbpMessage for MsgBootloaderHandshakeDepA {
fn message_name(&self) -> &'static str {
<Self as ConcreteMessage>::MESSAGE_NAME
}
fn message_type(&self) -> u16 {
<Self as ConcreteMessage>::MESSAGE_TYPE
}
fn sender_id(&self) -> Option<u16> {
self.sender_id
}
fn set_sender_id(&mut self, new_id: u16) {
self.sender_id = Some(new_id);
}
fn encoded_len(&self) -> usize {
WireFormat::len(self) + crate::HEADER_LEN + crate::CRC_LEN
}
}
impl TryFrom<Sbp> for MsgBootloaderHandshakeDepA {
type Error = TryFromSbpError;
fn try_from(msg: Sbp) -> Result<Self, Self::Error> {
match msg {
Sbp::MsgBootloaderHandshakeDepA(m) => Ok(m),
_ => Err(TryFromSbpError),
}
}
}
impl WireFormat for MsgBootloaderHandshakeDepA {
const MIN_LEN: usize = <Vec<u8> as WireFormat>::MIN_LEN;
fn len(&self) -> usize {
WireFormat::len(&self.handshake)
}
fn write<B: BufMut>(&self, buf: &mut B) {
WireFormat::write(&self.handshake, buf);
}
fn parse_unchecked<B: Buf>(buf: &mut B) -> Self {
MsgBootloaderHandshakeDepA {
sender_id: None,
handshake: WireFormat::parse_unchecked(buf),
}
}
}
#[cfg_attr(feature = "serde", derive(serde::Serialize))]
#[derive(Debug, Clone)]
pub struct MsgBootloaderHandshakeReq {
#[cfg_attr(feature = "serde", serde(skip_serializing))]
pub sender_id: Option<u16>,
}
impl ConcreteMessage for MsgBootloaderHandshakeReq {
const MESSAGE_TYPE: u16 = 179;
const MESSAGE_NAME: &'static str = "MSG_BOOTLOADER_HANDSHAKE_REQ";
}
impl SbpMessage for MsgBootloaderHandshakeReq {
fn message_name(&self) -> &'static str {
<Self as ConcreteMessage>::MESSAGE_NAME
}
fn message_type(&self) -> u16 {
<Self as ConcreteMessage>::MESSAGE_TYPE
}
fn sender_id(&self) -> Option<u16> {
self.sender_id
}
fn set_sender_id(&mut self, new_id: u16) {
self.sender_id = Some(new_id);
}
fn encoded_len(&self) -> usize {
WireFormat::len(self) + crate::HEADER_LEN + crate::CRC_LEN
}
}
impl TryFrom<Sbp> for MsgBootloaderHandshakeReq {
type Error = TryFromSbpError;
fn try_from(msg: Sbp) -> Result<Self, Self::Error> {
match msg {
Sbp::MsgBootloaderHandshakeReq(m) => Ok(m),
_ => Err(TryFromSbpError),
}
}
}
impl WireFormat for MsgBootloaderHandshakeReq {
const MIN_LEN: usize = 0;
fn len(&self) -> usize {
0
}
fn write<B: BufMut>(&self, _buf: &mut B) {}
fn parse_unchecked<B: Buf>(_buf: &mut B) -> Self {
MsgBootloaderHandshakeReq { sender_id: None }
}
}
#[cfg_attr(feature = "serde", derive(serde::Serialize))]
#[derive(Debug, Clone)]
pub struct MsgBootloaderHandshakeResp {
#[cfg_attr(feature = "serde", serde(skip_serializing))]
pub sender_id: Option<u16>,
#[cfg_attr(feature = "serde", serde(rename(serialize = "flags")))]
pub flags: u32,
#[cfg_attr(feature = "serde", serde(rename(serialize = "version")))]
pub version: SbpString<Vec<u8>, Unterminated>,
}
impl ConcreteMessage for MsgBootloaderHandshakeResp {
const MESSAGE_TYPE: u16 = 180;
const MESSAGE_NAME: &'static str = "MSG_BOOTLOADER_HANDSHAKE_RESP";
}
impl SbpMessage for MsgBootloaderHandshakeResp {
fn message_name(&self) -> &'static str {
<Self as ConcreteMessage>::MESSAGE_NAME
}
fn message_type(&self) -> u16 {
<Self as ConcreteMessage>::MESSAGE_TYPE
}
fn sender_id(&self) -> Option<u16> {
self.sender_id
}
fn set_sender_id(&mut self, new_id: u16) {
self.sender_id = Some(new_id);
}
fn encoded_len(&self) -> usize {
WireFormat::len(self) + crate::HEADER_LEN + crate::CRC_LEN
}
}
impl TryFrom<Sbp> for MsgBootloaderHandshakeResp {
type Error = TryFromSbpError;
fn try_from(msg: Sbp) -> Result<Self, Self::Error> {
match msg {
Sbp::MsgBootloaderHandshakeResp(m) => Ok(m),
_ => Err(TryFromSbpError),
}
}
}
impl WireFormat for MsgBootloaderHandshakeResp {
const MIN_LEN: usize =
<u32 as WireFormat>::MIN_LEN + <SbpString<Vec<u8>, Unterminated> as WireFormat>::MIN_LEN;
fn len(&self) -> usize {
WireFormat::len(&self.flags) + WireFormat::len(&self.version)
}
fn write<B: BufMut>(&self, buf: &mut B) {
WireFormat::write(&self.flags, buf);
WireFormat::write(&self.version, buf);
}
fn parse_unchecked<B: Buf>(buf: &mut B) -> Self {
MsgBootloaderHandshakeResp {
sender_id: None,
flags: WireFormat::parse_unchecked(buf),
version: WireFormat::parse_unchecked(buf),
}
}
}
#[cfg_attr(feature = "serde", derive(serde::Serialize))]
#[derive(Debug, Clone)]
pub struct MsgBootloaderJumpToApp {
#[cfg_attr(feature = "serde", serde(skip_serializing))]
pub sender_id: Option<u16>,
#[cfg_attr(feature = "serde", serde(rename(serialize = "jump")))]
pub jump: u8,
}
impl ConcreteMessage for MsgBootloaderJumpToApp {
const MESSAGE_TYPE: u16 = 177;
const MESSAGE_NAME: &'static str = "MSG_BOOTLOADER_JUMP_TO_APP";
}
impl SbpMessage for MsgBootloaderJumpToApp {
fn message_name(&self) -> &'static str {
<Self as ConcreteMessage>::MESSAGE_NAME
}
fn message_type(&self) -> u16 {
<Self as ConcreteMessage>::MESSAGE_TYPE
}
fn sender_id(&self) -> Option<u16> {
self.sender_id
}
fn set_sender_id(&mut self, new_id: u16) {
self.sender_id = Some(new_id);
}
fn encoded_len(&self) -> usize {
WireFormat::len(self) + crate::HEADER_LEN + crate::CRC_LEN
}
}
impl TryFrom<Sbp> for MsgBootloaderJumpToApp {
type Error = TryFromSbpError;
fn try_from(msg: Sbp) -> Result<Self, Self::Error> {
match msg {
Sbp::MsgBootloaderJumpToApp(m) => Ok(m),
_ => Err(TryFromSbpError),
}
}
}
impl WireFormat for MsgBootloaderJumpToApp {
const MIN_LEN: usize = <u8 as WireFormat>::MIN_LEN;
fn len(&self) -> usize {
WireFormat::len(&self.jump)
}
fn write<B: BufMut>(&self, buf: &mut B) {
WireFormat::write(&self.jump, buf);
}
fn parse_unchecked<B: Buf>(buf: &mut B) -> Self {
MsgBootloaderJumpToApp {
sender_id: None,
jump: WireFormat::parse_unchecked(buf),
}
}
}
#[cfg_attr(feature = "serde", derive(serde::Serialize))]
#[derive(Debug, Clone)]
pub struct MsgNapDeviceDnaReq {
#[cfg_attr(feature = "serde", serde(skip_serializing))]
pub sender_id: Option<u16>,
}
impl ConcreteMessage for MsgNapDeviceDnaReq {
const MESSAGE_TYPE: u16 = 222;
const MESSAGE_NAME: &'static str = "MSG_NAP_DEVICE_DNA_REQ";
}
impl SbpMessage for MsgNapDeviceDnaReq {
fn message_name(&self) -> &'static str {
<Self as ConcreteMessage>::MESSAGE_NAME
}
fn message_type(&self) -> u16 {
<Self as ConcreteMessage>::MESSAGE_TYPE
}
fn sender_id(&self) -> Option<u16> {
self.sender_id
}
fn set_sender_id(&mut self, new_id: u16) {
self.sender_id = Some(new_id);
}
fn encoded_len(&self) -> usize {
WireFormat::len(self) + crate::HEADER_LEN + crate::CRC_LEN
}
}
impl TryFrom<Sbp> for MsgNapDeviceDnaReq {
type Error = TryFromSbpError;
fn try_from(msg: Sbp) -> Result<Self, Self::Error> {
match msg {
Sbp::MsgNapDeviceDnaReq(m) => Ok(m),
_ => Err(TryFromSbpError),
}
}
}
impl WireFormat for MsgNapDeviceDnaReq {
const MIN_LEN: usize = 0;
fn len(&self) -> usize {
0
}
fn write<B: BufMut>(&self, _buf: &mut B) {}
fn parse_unchecked<B: Buf>(_buf: &mut B) -> Self {
MsgNapDeviceDnaReq { sender_id: None }
}
}
#[cfg_attr(feature = "serde", derive(serde::Serialize))]
#[derive(Debug, Clone)]
pub struct MsgNapDeviceDnaResp {
#[cfg_attr(feature = "serde", serde(skip_serializing))]
pub sender_id: Option<u16>,
#[cfg_attr(feature = "serde", serde(rename(serialize = "dna")))]
pub dna: [u8; 8],
}
impl ConcreteMessage for MsgNapDeviceDnaResp {
const MESSAGE_TYPE: u16 = 221;
const MESSAGE_NAME: &'static str = "MSG_NAP_DEVICE_DNA_RESP";
}
impl SbpMessage for MsgNapDeviceDnaResp {
fn message_name(&self) -> &'static str {
<Self as ConcreteMessage>::MESSAGE_NAME
}
fn message_type(&self) -> u16 {
<Self as ConcreteMessage>::MESSAGE_TYPE
}
fn sender_id(&self) -> Option<u16> {
self.sender_id
}
fn set_sender_id(&mut self, new_id: u16) {
self.sender_id = Some(new_id);
}
fn encoded_len(&self) -> usize {
WireFormat::len(self) + crate::HEADER_LEN + crate::CRC_LEN
}
}
impl TryFrom<Sbp> for MsgNapDeviceDnaResp {
type Error = TryFromSbpError;
fn try_from(msg: Sbp) -> Result<Self, Self::Error> {
match msg {
Sbp::MsgNapDeviceDnaResp(m) => Ok(m),
_ => Err(TryFromSbpError),
}
}
}
impl WireFormat for MsgNapDeviceDnaResp {
const MIN_LEN: usize = <[u8; 8] as WireFormat>::MIN_LEN;
fn len(&self) -> usize {
WireFormat::len(&self.dna)
}
fn write<B: BufMut>(&self, buf: &mut B) {
WireFormat::write(&self.dna, buf);
}
fn parse_unchecked<B: Buf>(buf: &mut B) -> Self {
MsgNapDeviceDnaResp {
sender_id: None,
dna: WireFormat::parse_unchecked(buf),
}
}
}