pub use msg_fileio_config_req::MsgFileioConfigReq;
pub use msg_fileio_config_resp::MsgFileioConfigResp;
pub use msg_fileio_read_dir_req::MsgFileioReadDirReq;
pub use msg_fileio_read_dir_resp::MsgFileioReadDirResp;
pub use msg_fileio_read_req::MsgFileioReadReq;
pub use msg_fileio_read_resp::MsgFileioReadResp;
pub use msg_fileio_remove::MsgFileioRemove;
pub use msg_fileio_write_req::MsgFileioWriteReq;
pub use msg_fileio_write_resp::MsgFileioWriteResp;
pub mod msg_fileio_config_req {
#![allow(unused_imports)]
use super::*;
use crate::messages::lib::*;
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Debug, PartialEq, Clone)]
pub struct MsgFileioConfigReq {
#[cfg_attr(feature = "serde", serde(skip_serializing, alias = "sender"))]
pub sender_id: Option<u16>,
#[cfg_attr(feature = "serde", serde(rename = "sequence"))]
pub sequence: u32,
}
impl ConcreteMessage for MsgFileioConfigReq {
const MESSAGE_TYPE: u16 = 4097;
const MESSAGE_NAME: &'static str = "MSG_FILEIO_CONFIG_REQ";
}
impl SbpMessage for MsgFileioConfigReq {
fn message_name(&self) -> &'static str {
<Self as ConcreteMessage>::MESSAGE_NAME
}
fn message_type(&self) -> Option<u16> {
Some(<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
}
fn is_valid(&self) -> bool {
true
}
fn into_valid_msg(self) -> Result<Self, crate::messages::invalid::Invalid> {
Ok(self)
}
}
impl FriendlyName for MsgFileioConfigReq {
fn friendly_name() -> &'static str {
"FILEIO CONFIG REQ"
}
}
impl TryFrom<Sbp> for MsgFileioConfigReq {
type Error = TryFromSbpError;
fn try_from(msg: Sbp) -> Result<Self, Self::Error> {
match msg {
Sbp::MsgFileioConfigReq(m) => Ok(m),
_ => Err(TryFromSbpError(msg)),
}
}
}
impl WireFormat for MsgFileioConfigReq {
const MIN_LEN: usize = <u32 as WireFormat>::MIN_LEN;
fn len(&self) -> usize {
WireFormat::len(&self.sequence)
}
fn write<B: BufMut>(&self, buf: &mut B) {
WireFormat::write(&self.sequence, buf);
}
fn parse_unchecked<B: Buf>(buf: &mut B) -> Self {
MsgFileioConfigReq {
sender_id: None,
sequence: WireFormat::parse_unchecked(buf),
}
}
}
}
pub mod msg_fileio_config_resp {
#![allow(unused_imports)]
use super::*;
use crate::messages::lib::*;
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Debug, PartialEq, Clone)]
pub struct MsgFileioConfigResp {
#[cfg_attr(feature = "serde", serde(skip_serializing, alias = "sender"))]
pub sender_id: Option<u16>,
#[cfg_attr(feature = "serde", serde(rename = "sequence"))]
pub sequence: u32,
#[cfg_attr(feature = "serde", serde(rename = "window_size"))]
pub window_size: u32,
#[cfg_attr(feature = "serde", serde(rename = "batch_size"))]
pub batch_size: u32,
#[cfg_attr(feature = "serde", serde(rename = "fileio_version"))]
pub fileio_version: u32,
}
impl ConcreteMessage for MsgFileioConfigResp {
const MESSAGE_TYPE: u16 = 4098;
const MESSAGE_NAME: &'static str = "MSG_FILEIO_CONFIG_RESP";
}
impl SbpMessage for MsgFileioConfigResp {
fn message_name(&self) -> &'static str {
<Self as ConcreteMessage>::MESSAGE_NAME
}
fn message_type(&self) -> Option<u16> {
Some(<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
}
fn is_valid(&self) -> bool {
true
}
fn into_valid_msg(self) -> Result<Self, crate::messages::invalid::Invalid> {
Ok(self)
}
}
impl FriendlyName for MsgFileioConfigResp {
fn friendly_name() -> &'static str {
"FILEIO CONFIG RESP"
}
}
impl TryFrom<Sbp> for MsgFileioConfigResp {
type Error = TryFromSbpError;
fn try_from(msg: Sbp) -> Result<Self, Self::Error> {
match msg {
Sbp::MsgFileioConfigResp(m) => Ok(m),
_ => Err(TryFromSbpError(msg)),
}
}
}
impl WireFormat for MsgFileioConfigResp {
const MIN_LEN: usize = <u32 as WireFormat>::MIN_LEN
+ <u32 as WireFormat>::MIN_LEN
+ <u32 as WireFormat>::MIN_LEN
+ <u32 as WireFormat>::MIN_LEN;
fn len(&self) -> usize {
WireFormat::len(&self.sequence)
+ WireFormat::len(&self.window_size)
+ WireFormat::len(&self.batch_size)
+ WireFormat::len(&self.fileio_version)
}
fn write<B: BufMut>(&self, buf: &mut B) {
WireFormat::write(&self.sequence, buf);
WireFormat::write(&self.window_size, buf);
WireFormat::write(&self.batch_size, buf);
WireFormat::write(&self.fileio_version, buf);
}
fn parse_unchecked<B: Buf>(buf: &mut B) -> Self {
MsgFileioConfigResp {
sender_id: None,
sequence: WireFormat::parse_unchecked(buf),
window_size: WireFormat::parse_unchecked(buf),
batch_size: WireFormat::parse_unchecked(buf),
fileio_version: WireFormat::parse_unchecked(buf),
}
}
}
}
pub mod msg_fileio_read_dir_req {
#![allow(unused_imports)]
use super::*;
use crate::messages::lib::*;
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Debug, PartialEq, Clone)]
pub struct MsgFileioReadDirReq {
#[cfg_attr(feature = "serde", serde(skip_serializing, alias = "sender"))]
pub sender_id: Option<u16>,
#[cfg_attr(feature = "serde", serde(rename = "sequence"))]
pub sequence: u32,
#[cfg_attr(feature = "serde", serde(rename = "offset"))]
pub offset: u32,
#[cfg_attr(feature = "serde", serde(rename = "dirname"))]
pub dirname: SbpString<Vec<u8>, NullTerminated>,
}
impl ConcreteMessage for MsgFileioReadDirReq {
const MESSAGE_TYPE: u16 = 169;
const MESSAGE_NAME: &'static str = "MSG_FILEIO_READ_DIR_REQ";
}
impl SbpMessage for MsgFileioReadDirReq {
fn message_name(&self) -> &'static str {
<Self as ConcreteMessage>::MESSAGE_NAME
}
fn message_type(&self) -> Option<u16> {
Some(<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
}
fn is_valid(&self) -> bool {
true
}
fn into_valid_msg(self) -> Result<Self, crate::messages::invalid::Invalid> {
Ok(self)
}
}
impl FriendlyName for MsgFileioReadDirReq {
fn friendly_name() -> &'static str {
"FILEIO READ DIR REQ"
}
}
impl TryFrom<Sbp> for MsgFileioReadDirReq {
type Error = TryFromSbpError;
fn try_from(msg: Sbp) -> Result<Self, Self::Error> {
match msg {
Sbp::MsgFileioReadDirReq(m) => Ok(m),
_ => Err(TryFromSbpError(msg)),
}
}
}
impl WireFormat for MsgFileioReadDirReq {
const MIN_LEN: usize = <u32 as WireFormat>::MIN_LEN
+ <u32 as WireFormat>::MIN_LEN
+ <SbpString<Vec<u8>, NullTerminated> as WireFormat>::MIN_LEN;
fn len(&self) -> usize {
WireFormat::len(&self.sequence)
+ WireFormat::len(&self.offset)
+ WireFormat::len(&self.dirname)
}
fn write<B: BufMut>(&self, buf: &mut B) {
WireFormat::write(&self.sequence, buf);
WireFormat::write(&self.offset, buf);
WireFormat::write(&self.dirname, buf);
}
fn parse_unchecked<B: Buf>(buf: &mut B) -> Self {
MsgFileioReadDirReq {
sender_id: None,
sequence: WireFormat::parse_unchecked(buf),
offset: WireFormat::parse_unchecked(buf),
dirname: WireFormat::parse_unchecked(buf),
}
}
}
}
pub mod msg_fileio_read_dir_resp {
#![allow(unused_imports)]
use super::*;
use crate::messages::lib::*;
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Debug, PartialEq, Clone)]
pub struct MsgFileioReadDirResp {
#[cfg_attr(feature = "serde", serde(skip_serializing, alias = "sender"))]
pub sender_id: Option<u16>,
#[cfg_attr(feature = "serde", serde(rename = "sequence"))]
pub sequence: u32,
#[cfg_attr(feature = "serde", serde(rename = "contents"))]
pub contents: SbpString<Vec<u8>, Multipart>,
}
impl ConcreteMessage for MsgFileioReadDirResp {
const MESSAGE_TYPE: u16 = 170;
const MESSAGE_NAME: &'static str = "MSG_FILEIO_READ_DIR_RESP";
}
impl SbpMessage for MsgFileioReadDirResp {
fn message_name(&self) -> &'static str {
<Self as ConcreteMessage>::MESSAGE_NAME
}
fn message_type(&self) -> Option<u16> {
Some(<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
}
fn is_valid(&self) -> bool {
true
}
fn into_valid_msg(self) -> Result<Self, crate::messages::invalid::Invalid> {
Ok(self)
}
}
impl FriendlyName for MsgFileioReadDirResp {
fn friendly_name() -> &'static str {
"FILEIO READ DIR RESP"
}
}
impl TryFrom<Sbp> for MsgFileioReadDirResp {
type Error = TryFromSbpError;
fn try_from(msg: Sbp) -> Result<Self, Self::Error> {
match msg {
Sbp::MsgFileioReadDirResp(m) => Ok(m),
_ => Err(TryFromSbpError(msg)),
}
}
}
impl WireFormat for MsgFileioReadDirResp {
const MIN_LEN: usize =
<u32 as WireFormat>::MIN_LEN + <SbpString<Vec<u8>, Multipart> as WireFormat>::MIN_LEN;
fn len(&self) -> usize {
WireFormat::len(&self.sequence) + WireFormat::len(&self.contents)
}
fn write<B: BufMut>(&self, buf: &mut B) {
WireFormat::write(&self.sequence, buf);
WireFormat::write(&self.contents, buf);
}
fn parse_unchecked<B: Buf>(buf: &mut B) -> Self {
MsgFileioReadDirResp {
sender_id: None,
sequence: WireFormat::parse_unchecked(buf),
contents: WireFormat::parse_unchecked(buf),
}
}
}
}
pub mod msg_fileio_read_req {
#![allow(unused_imports)]
use super::*;
use crate::messages::lib::*;
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Debug, PartialEq, Clone)]
pub struct MsgFileioReadReq {
#[cfg_attr(feature = "serde", serde(skip_serializing, alias = "sender"))]
pub sender_id: Option<u16>,
#[cfg_attr(feature = "serde", serde(rename = "sequence"))]
pub sequence: u32,
#[cfg_attr(feature = "serde", serde(rename = "offset"))]
pub offset: u32,
#[cfg_attr(feature = "serde", serde(rename = "chunk_size"))]
pub chunk_size: u8,
#[cfg_attr(feature = "serde", serde(rename = "filename"))]
pub filename: SbpString<Vec<u8>, NullTerminated>,
}
impl ConcreteMessage for MsgFileioReadReq {
const MESSAGE_TYPE: u16 = 168;
const MESSAGE_NAME: &'static str = "MSG_FILEIO_READ_REQ";
}
impl SbpMessage for MsgFileioReadReq {
fn message_name(&self) -> &'static str {
<Self as ConcreteMessage>::MESSAGE_NAME
}
fn message_type(&self) -> Option<u16> {
Some(<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
}
fn is_valid(&self) -> bool {
true
}
fn into_valid_msg(self) -> Result<Self, crate::messages::invalid::Invalid> {
Ok(self)
}
}
impl FriendlyName for MsgFileioReadReq {
fn friendly_name() -> &'static str {
"FILEIO READ REQ"
}
}
impl TryFrom<Sbp> for MsgFileioReadReq {
type Error = TryFromSbpError;
fn try_from(msg: Sbp) -> Result<Self, Self::Error> {
match msg {
Sbp::MsgFileioReadReq(m) => Ok(m),
_ => Err(TryFromSbpError(msg)),
}
}
}
impl WireFormat for MsgFileioReadReq {
const MIN_LEN: usize = <u32 as WireFormat>::MIN_LEN
+ <u32 as WireFormat>::MIN_LEN
+ <u8 as WireFormat>::MIN_LEN
+ <SbpString<Vec<u8>, NullTerminated> as WireFormat>::MIN_LEN;
fn len(&self) -> usize {
WireFormat::len(&self.sequence)
+ WireFormat::len(&self.offset)
+ WireFormat::len(&self.chunk_size)
+ WireFormat::len(&self.filename)
}
fn write<B: BufMut>(&self, buf: &mut B) {
WireFormat::write(&self.sequence, buf);
WireFormat::write(&self.offset, buf);
WireFormat::write(&self.chunk_size, buf);
WireFormat::write(&self.filename, buf);
}
fn parse_unchecked<B: Buf>(buf: &mut B) -> Self {
MsgFileioReadReq {
sender_id: None,
sequence: WireFormat::parse_unchecked(buf),
offset: WireFormat::parse_unchecked(buf),
chunk_size: WireFormat::parse_unchecked(buf),
filename: WireFormat::parse_unchecked(buf),
}
}
}
}
pub mod msg_fileio_read_resp {
#![allow(unused_imports)]
use super::*;
use crate::messages::lib::*;
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Debug, PartialEq, Clone)]
pub struct MsgFileioReadResp {
#[cfg_attr(feature = "serde", serde(skip_serializing, alias = "sender"))]
pub sender_id: Option<u16>,
#[cfg_attr(feature = "serde", serde(rename = "sequence"))]
pub sequence: u32,
#[cfg_attr(feature = "serde", serde(rename = "contents"))]
pub contents: Vec<u8>,
}
impl ConcreteMessage for MsgFileioReadResp {
const MESSAGE_TYPE: u16 = 163;
const MESSAGE_NAME: &'static str = "MSG_FILEIO_READ_RESP";
}
impl SbpMessage for MsgFileioReadResp {
fn message_name(&self) -> &'static str {
<Self as ConcreteMessage>::MESSAGE_NAME
}
fn message_type(&self) -> Option<u16> {
Some(<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
}
fn is_valid(&self) -> bool {
true
}
fn into_valid_msg(self) -> Result<Self, crate::messages::invalid::Invalid> {
Ok(self)
}
}
impl FriendlyName for MsgFileioReadResp {
fn friendly_name() -> &'static str {
"FILEIO READ RESP"
}
}
impl TryFrom<Sbp> for MsgFileioReadResp {
type Error = TryFromSbpError;
fn try_from(msg: Sbp) -> Result<Self, Self::Error> {
match msg {
Sbp::MsgFileioReadResp(m) => Ok(m),
_ => Err(TryFromSbpError(msg)),
}
}
}
impl WireFormat for MsgFileioReadResp {
const MIN_LEN: usize = <u32 as WireFormat>::MIN_LEN + <Vec<u8> as WireFormat>::MIN_LEN;
fn len(&self) -> usize {
WireFormat::len(&self.sequence) + WireFormat::len(&self.contents)
}
fn write<B: BufMut>(&self, buf: &mut B) {
WireFormat::write(&self.sequence, buf);
WireFormat::write(&self.contents, buf);
}
fn parse_unchecked<B: Buf>(buf: &mut B) -> Self {
MsgFileioReadResp {
sender_id: None,
sequence: WireFormat::parse_unchecked(buf),
contents: WireFormat::parse_unchecked(buf),
}
}
}
}
pub mod msg_fileio_remove {
#![allow(unused_imports)]
use super::*;
use crate::messages::lib::*;
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Debug, PartialEq, Clone)]
pub struct MsgFileioRemove {
#[cfg_attr(feature = "serde", serde(skip_serializing, alias = "sender"))]
pub sender_id: Option<u16>,
#[cfg_attr(feature = "serde", serde(rename = "filename"))]
pub filename: SbpString<Vec<u8>, NullTerminated>,
}
impl ConcreteMessage for MsgFileioRemove {
const MESSAGE_TYPE: u16 = 172;
const MESSAGE_NAME: &'static str = "MSG_FILEIO_REMOVE";
}
impl SbpMessage for MsgFileioRemove {
fn message_name(&self) -> &'static str {
<Self as ConcreteMessage>::MESSAGE_NAME
}
fn message_type(&self) -> Option<u16> {
Some(<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
}
fn is_valid(&self) -> bool {
true
}
fn into_valid_msg(self) -> Result<Self, crate::messages::invalid::Invalid> {
Ok(self)
}
}
impl FriendlyName for MsgFileioRemove {
fn friendly_name() -> &'static str {
"FILEIO REMOVE"
}
}
impl TryFrom<Sbp> for MsgFileioRemove {
type Error = TryFromSbpError;
fn try_from(msg: Sbp) -> Result<Self, Self::Error> {
match msg {
Sbp::MsgFileioRemove(m) => Ok(m),
_ => Err(TryFromSbpError(msg)),
}
}
}
impl WireFormat for MsgFileioRemove {
const MIN_LEN: usize = <SbpString<Vec<u8>, NullTerminated> as WireFormat>::MIN_LEN;
fn len(&self) -> usize {
WireFormat::len(&self.filename)
}
fn write<B: BufMut>(&self, buf: &mut B) {
WireFormat::write(&self.filename, buf);
}
fn parse_unchecked<B: Buf>(buf: &mut B) -> Self {
MsgFileioRemove {
sender_id: None,
filename: WireFormat::parse_unchecked(buf),
}
}
}
}
pub mod msg_fileio_write_req {
#![allow(unused_imports)]
use super::*;
use crate::messages::lib::*;
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Debug, PartialEq, Clone)]
pub struct MsgFileioWriteReq {
#[cfg_attr(feature = "serde", serde(skip_serializing, alias = "sender"))]
pub sender_id: Option<u16>,
#[cfg_attr(feature = "serde", serde(rename = "sequence"))]
pub sequence: u32,
#[cfg_attr(feature = "serde", serde(rename = "offset"))]
pub offset: u32,
#[cfg_attr(feature = "serde", serde(rename = "filename"))]
pub filename: SbpString<Vec<u8>, NullTerminated>,
#[cfg_attr(feature = "serde", serde(rename = "data"))]
pub data: Vec<u8>,
}
impl ConcreteMessage for MsgFileioWriteReq {
const MESSAGE_TYPE: u16 = 173;
const MESSAGE_NAME: &'static str = "MSG_FILEIO_WRITE_REQ";
}
impl SbpMessage for MsgFileioWriteReq {
fn message_name(&self) -> &'static str {
<Self as ConcreteMessage>::MESSAGE_NAME
}
fn message_type(&self) -> Option<u16> {
Some(<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
}
fn is_valid(&self) -> bool {
true
}
fn into_valid_msg(self) -> Result<Self, crate::messages::invalid::Invalid> {
Ok(self)
}
}
impl FriendlyName for MsgFileioWriteReq {
fn friendly_name() -> &'static str {
"FILEIO WRITE REQ"
}
}
impl TryFrom<Sbp> for MsgFileioWriteReq {
type Error = TryFromSbpError;
fn try_from(msg: Sbp) -> Result<Self, Self::Error> {
match msg {
Sbp::MsgFileioWriteReq(m) => Ok(m),
_ => Err(TryFromSbpError(msg)),
}
}
}
impl WireFormat for MsgFileioWriteReq {
const MIN_LEN: usize = <u32 as WireFormat>::MIN_LEN
+ <u32 as WireFormat>::MIN_LEN
+ <SbpString<Vec<u8>, NullTerminated> as WireFormat>::MIN_LEN
+ <Vec<u8> as WireFormat>::MIN_LEN;
fn len(&self) -> usize {
WireFormat::len(&self.sequence)
+ WireFormat::len(&self.offset)
+ WireFormat::len(&self.filename)
+ WireFormat::len(&self.data)
}
fn write<B: BufMut>(&self, buf: &mut B) {
WireFormat::write(&self.sequence, buf);
WireFormat::write(&self.offset, buf);
WireFormat::write(&self.filename, buf);
WireFormat::write(&self.data, buf);
}
fn parse_unchecked<B: Buf>(buf: &mut B) -> Self {
MsgFileioWriteReq {
sender_id: None,
sequence: WireFormat::parse_unchecked(buf),
offset: WireFormat::parse_unchecked(buf),
filename: WireFormat::parse_unchecked(buf),
data: WireFormat::parse_unchecked(buf),
}
}
}
}
pub mod msg_fileio_write_resp {
#![allow(unused_imports)]
use super::*;
use crate::messages::lib::*;
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Debug, PartialEq, Clone)]
pub struct MsgFileioWriteResp {
#[cfg_attr(feature = "serde", serde(skip_serializing, alias = "sender"))]
pub sender_id: Option<u16>,
#[cfg_attr(feature = "serde", serde(rename = "sequence"))]
pub sequence: u32,
}
impl ConcreteMessage for MsgFileioWriteResp {
const MESSAGE_TYPE: u16 = 171;
const MESSAGE_NAME: &'static str = "MSG_FILEIO_WRITE_RESP";
}
impl SbpMessage for MsgFileioWriteResp {
fn message_name(&self) -> &'static str {
<Self as ConcreteMessage>::MESSAGE_NAME
}
fn message_type(&self) -> Option<u16> {
Some(<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
}
fn is_valid(&self) -> bool {
true
}
fn into_valid_msg(self) -> Result<Self, crate::messages::invalid::Invalid> {
Ok(self)
}
}
impl FriendlyName for MsgFileioWriteResp {
fn friendly_name() -> &'static str {
"FILEIO WRITE RESP"
}
}
impl TryFrom<Sbp> for MsgFileioWriteResp {
type Error = TryFromSbpError;
fn try_from(msg: Sbp) -> Result<Self, Self::Error> {
match msg {
Sbp::MsgFileioWriteResp(m) => Ok(m),
_ => Err(TryFromSbpError(msg)),
}
}
}
impl WireFormat for MsgFileioWriteResp {
const MIN_LEN: usize = <u32 as WireFormat>::MIN_LEN;
fn len(&self) -> usize {
WireFormat::len(&self.sequence)
}
fn write<B: BufMut>(&self, buf: &mut B) {
WireFormat::write(&self.sequence, buf);
}
fn parse_unchecked<B: Buf>(buf: &mut B) -> Self {
MsgFileioWriteResp {
sender_id: None,
sequence: WireFormat::parse_unchecked(buf),
}
}
}
}