Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion generator/sbpg/targets/resources/sbp_messages_mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ pub trait SBPMessage: SbpSerialize {
}

#[cfg_attr(feature = "sbp_serde", derive(Serialize, Deserialize))]
#[derive(Debug)]
#[derive(Debug, Clone)]
pub enum SBP {
((*- for m in msgs *))
(((m.identifier|camel_case)))( (((m.identifier|camel_case))) ),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ use super::(((i)))::*;
///
((*- endif *))
#[cfg_attr(feature = "sbp_serde", derive(Serialize, Deserialize))]
#[derive(Debug)]
#[derive(Debug, Clone)]
#[allow(non_snake_case)]
pub struct (((m.identifier|camel_case))) {
((*- if m.sbp_id *))
Expand Down
15 changes: 7 additions & 8 deletions rust/sbp/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -194,13 +194,12 @@ mod tests {
let packet = vec![
// Start with a mostly valid message, with a single byte error
0x55, 0x0c, // This byte should be 0x0b, changed to intentionally cause a CRC error
0x02, 0xd3, 0x88, 0x14, 0x28, 0xf4, 0x7a, 0x13, 0x96,
0x62, 0xee, 0xff, 0xbe, 0x40, 0x14, 0x00, 0xf6, 0xa3, 0x09, 0x00, 0x00, 0x00, 0x0e,
0x00, 0xdb, 0xbf, 0xde, 0xad, 0xbe, 0xef,
// Include another valid message to properly parse
0x55u8, 0x0b, 0x02, 0xd3, 0x88, 0x14, 0x28, 0xf4, 0x7a, 0x13, 0x96,
0x62, 0xee, 0xff, 0xbe, 0x40, 0x14, 0x00, 0xf6, 0xa3, 0x09, 0x00, 0x00, 0x00, 0x0e,
0x00, 0xdb, 0xbf, 0xde, 0xad, 0xbe, 0xef,
0x02, 0xd3, 0x88, 0x14, 0x28, 0xf4, 0x7a, 0x13, 0x96, 0x62, 0xee, 0xff, 0xbe, 0x40,
0x14, 0x00, 0xf6, 0xa3, 0x09, 0x00, 0x00, 0x00, 0x0e, 0x00, 0xdb, 0xbf, 0xde, 0xad,
0xbe, 0xef, // Include another valid message to properly parse
0x55u8, 0x0b, 0x02, 0xd3, 0x88, 0x14, 0x28, 0xf4, 0x7a, 0x13, 0x96, 0x62, 0xee, 0xff,
0xbe, 0x40, 0x14, 0x00, 0xf6, 0xa3, 0x09, 0x00, 0x00, 0x00, 0x0e, 0x00, 0xdb, 0xbf,
0xde, 0xad, 0xbe, 0xef,
];
let mut reader = std::io::Cursor::new(packet);
let mut parser = crate::parser::Parser::new();
Expand All @@ -209,7 +208,7 @@ mod tests {
let sbp_result = parser.parse(&mut reader);
assert!(sbp_result.is_err());
match sbp_result.unwrap_err() {
crate::Error::CrcError => {},
crate::Error::CrcError => {}
e => {
assert!(false, "Unexpected error: {:?}", e);
}
Expand Down
16 changes: 8 additions & 8 deletions rust/sbp/src/messages/acquisition.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ use serde::{Deserialize, Serialize};
/// The message is used to debug and measure the performance.
///
#[cfg_attr(feature = "sbp_serde", derive(Serialize, Deserialize))]
#[derive(Debug)]
#[derive(Debug, Clone)]
#[allow(non_snake_case)]
pub struct AcqSvProfile {
/// SV search job type (deep, fallback, etc)
Expand Down Expand Up @@ -131,7 +131,7 @@ impl crate::serialize::SbpSerialize for AcqSvProfile {
/// Deprecated.
///
#[cfg_attr(feature = "sbp_serde", derive(Serialize, Deserialize))]
#[derive(Debug)]
#[derive(Debug, Clone)]
#[allow(non_snake_case)]
pub struct AcqSvProfileDep {
/// SV search job type (deep, fallback, etc)
Expand Down Expand Up @@ -241,7 +241,7 @@ impl crate::serialize::SbpSerialize for AcqSvProfileDep {
/// ratio.
///
#[cfg_attr(feature = "sbp_serde", derive(Serialize, Deserialize))]
#[derive(Debug)]
#[derive(Debug, Clone)]
#[allow(non_snake_case)]
pub struct MsgAcqResult {
pub sender_id: Option<u16>,
Expand Down Expand Up @@ -309,7 +309,7 @@ impl crate::serialize::SbpSerialize for MsgAcqResult {
/// Deprecated.
///
#[cfg_attr(feature = "sbp_serde", derive(Serialize, Deserialize))]
#[derive(Debug)]
#[derive(Debug, Clone)]
#[allow(non_snake_case)]
pub struct MsgAcqResultDepA {
pub sender_id: Option<u16>,
Expand Down Expand Up @@ -379,7 +379,7 @@ impl crate::serialize::SbpSerialize for MsgAcqResultDepA {
/// Deprecated.
///
#[cfg_attr(feature = "sbp_serde", derive(Serialize, Deserialize))]
#[derive(Debug)]
#[derive(Debug, Clone)]
#[allow(non_snake_case)]
pub struct MsgAcqResultDepB {
pub sender_id: Option<u16>,
Expand Down Expand Up @@ -448,7 +448,7 @@ impl crate::serialize::SbpSerialize for MsgAcqResultDepB {
/// Deprecated.
///
#[cfg_attr(feature = "sbp_serde", derive(Serialize, Deserialize))]
#[derive(Debug)]
#[derive(Debug, Clone)]
#[allow(non_snake_case)]
pub struct MsgAcqResultDepC {
pub sender_id: Option<u16>,
Expand Down Expand Up @@ -517,7 +517,7 @@ impl crate::serialize::SbpSerialize for MsgAcqResultDepC {
/// The message is used to debug and measure the performance.
///
#[cfg_attr(feature = "sbp_serde", derive(Serialize, Deserialize))]
#[derive(Debug)]
#[derive(Debug, Clone)]
#[allow(non_snake_case)]
pub struct MsgAcqSvProfile {
pub sender_id: Option<u16>,
Expand Down Expand Up @@ -570,7 +570,7 @@ impl crate::serialize::SbpSerialize for MsgAcqSvProfile {
/// Deprecated.
///
#[cfg_attr(feature = "sbp_serde", derive(Serialize, Deserialize))]
#[derive(Debug)]
#[derive(Debug, Clone)]
#[allow(non_snake_case)]
pub struct MsgAcqSvProfileDep {
pub sender_id: Option<u16>,
Expand Down
12 changes: 6 additions & 6 deletions rust/sbp/src/messages/bootload.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ use serde::{Deserialize, Serialize};
/// Deprecated.
///
#[cfg_attr(feature = "sbp_serde", derive(Serialize, Deserialize))]
#[derive(Debug)]
#[derive(Debug, Clone)]
#[allow(non_snake_case)]
pub struct MsgBootloaderHandshakeDepA {
pub sender_id: Option<u16>,
Expand Down Expand Up @@ -85,7 +85,7 @@ impl crate::serialize::SbpSerialize for MsgBootloaderHandshakeDepA {
/// response from the device is MSG_BOOTLOADER_HANDSHAKE_RESP.
///
#[cfg_attr(feature = "sbp_serde", derive(Serialize, Deserialize))]
#[derive(Debug)]
#[derive(Debug, Clone)]
#[allow(non_snake_case)]
pub struct MsgBootloaderHandshakeReq {
pub sender_id: Option<u16>,
Expand Down Expand Up @@ -133,7 +133,7 @@ impl crate::serialize::SbpSerialize for MsgBootloaderHandshakeReq {
/// protocol version number.
///
#[cfg_attr(feature = "sbp_serde", derive(Serialize, Deserialize))]
#[derive(Debug)]
#[derive(Debug, Clone)]
#[allow(non_snake_case)]
pub struct MsgBootloaderHandshakeResp {
pub sender_id: Option<u16>,
Expand Down Expand Up @@ -191,7 +191,7 @@ impl crate::serialize::SbpSerialize for MsgBootloaderHandshakeResp {
/// The host initiates the bootloader to jump to the application.
///
#[cfg_attr(feature = "sbp_serde", derive(Serialize, Deserialize))]
#[derive(Debug)]
#[derive(Debug, Clone)]
#[allow(non_snake_case)]
pub struct MsgBootloaderJumpToApp {
pub sender_id: Option<u16>,
Expand Down Expand Up @@ -249,7 +249,7 @@ impl crate::serialize::SbpSerialize for MsgBootloaderJumpToApp {
/// and not related to the Piksi's serial number.
///
#[cfg_attr(feature = "sbp_serde", derive(Serialize, Deserialize))]
#[derive(Debug)]
#[derive(Debug, Clone)]
#[allow(non_snake_case)]
pub struct MsgNapDeviceDnaReq {
pub sender_id: Option<u16>,
Expand Down Expand Up @@ -298,7 +298,7 @@ impl crate::serialize::SbpSerialize for MsgNapDeviceDnaReq {
/// and not related to the Piksi's serial number.
///
#[cfg_attr(feature = "sbp_serde", derive(Serialize, Deserialize))]
#[derive(Debug)]
#[derive(Debug, Clone)]
#[allow(non_snake_case)]
pub struct MsgNapDeviceDnaResp {
pub sender_id: Option<u16>,
Expand Down
2 changes: 1 addition & 1 deletion rust/sbp/src/messages/ext_events.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ use serde::{Deserialize, Serialize};
/// which pin it was and whether it was rising or falling.
///
#[cfg_attr(feature = "sbp_serde", derive(Serialize, Deserialize))]
#[derive(Debug)]
#[derive(Debug, Clone)]
#[allow(non_snake_case)]
pub struct MsgExtEvent {
pub sender_id: Option<u16>,
Expand Down
18 changes: 9 additions & 9 deletions rust/sbp/src/messages/file_io.rs
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ use serde::{Deserialize, Serialize};
/// that can be in-flight during read or write operations.
///
#[cfg_attr(feature = "sbp_serde", derive(Serialize, Deserialize))]
#[derive(Debug)]
#[derive(Debug, Clone)]
#[allow(non_snake_case)]
pub struct MsgFileioConfigReq {
pub sender_id: Option<u16>,
Expand Down Expand Up @@ -93,7 +93,7 @@ impl crate::serialize::SbpSerialize for MsgFileioConfigReq {
/// that can be in-flight during read or write operations.
///
#[cfg_attr(feature = "sbp_serde", derive(Serialize, Deserialize))]
#[derive(Debug)]
#[derive(Debug, Clone)]
#[allow(non_snake_case)]
pub struct MsgFileioConfigResp {
pub sender_id: Option<u16>,
Expand Down Expand Up @@ -170,7 +170,7 @@ impl crate::serialize::SbpSerialize for MsgFileioConfigResp {
/// from sender ID 0x42.
///
#[cfg_attr(feature = "sbp_serde", derive(Serialize, Deserialize))]
#[derive(Debug)]
#[derive(Debug, Clone)]
#[allow(non_snake_case)]
pub struct MsgFileioReadDirReq {
pub sender_id: Option<u16>,
Expand Down Expand Up @@ -238,7 +238,7 @@ impl crate::serialize::SbpSerialize for MsgFileioReadDirReq {
/// the response is preserved from the request.
///
#[cfg_attr(feature = "sbp_serde", derive(Serialize, Deserialize))]
#[derive(Debug)]
#[derive(Debug, Clone)]
#[allow(non_snake_case)]
pub struct MsgFileioReadDirResp {
pub sender_id: Option<u16>,
Expand Down Expand Up @@ -303,7 +303,7 @@ impl crate::serialize::SbpSerialize for MsgFileioReadDirResp {
/// to this message when it is received from sender ID 0x42.
///
#[cfg_attr(feature = "sbp_serde", derive(Serialize, Deserialize))]
#[derive(Debug)]
#[derive(Debug, Clone)]
#[allow(non_snake_case)]
pub struct MsgFileioReadReq {
pub sender_id: Option<u16>,
Expand Down Expand Up @@ -375,7 +375,7 @@ impl crate::serialize::SbpSerialize for MsgFileioReadReq {
/// preserved from the request.
///
#[cfg_attr(feature = "sbp_serde", derive(Serialize, Deserialize))]
#[derive(Debug)]
#[derive(Debug, Clone)]
#[allow(non_snake_case)]
pub struct MsgFileioReadResp {
pub sender_id: Option<u16>,
Expand Down Expand Up @@ -436,7 +436,7 @@ impl crate::serialize::SbpSerialize for MsgFileioReadResp {
/// process this message when it is received from sender ID 0x42.
///
#[cfg_attr(feature = "sbp_serde", derive(Serialize, Deserialize))]
#[derive(Debug)]
#[derive(Debug, Clone)]
#[allow(non_snake_case)]
pub struct MsgFileioRemove {
pub sender_id: Option<u16>,
Expand Down Expand Up @@ -496,7 +496,7 @@ impl crate::serialize::SbpSerialize for MsgFileioRemove {
/// 0x42.
///
#[cfg_attr(feature = "sbp_serde", derive(Serialize, Deserialize))]
#[derive(Debug)]
#[derive(Debug, Clone)]
#[allow(non_snake_case)]
pub struct MsgFileioWriteReq {
pub sender_id: Option<u16>,
Expand Down Expand Up @@ -568,7 +568,7 @@ impl crate::serialize::SbpSerialize for MsgFileioWriteReq {
/// request.
///
#[cfg_attr(feature = "sbp_serde", derive(Serialize, Deserialize))]
#[derive(Debug)]
#[derive(Debug, Clone)]
#[allow(non_snake_case)]
pub struct MsgFileioWriteResp {
pub sender_id: Option<u16>,
Expand Down
20 changes: 10 additions & 10 deletions rust/sbp/src/messages/flash.rs
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ use serde::{Deserialize, Serialize};
/// MSG_FLASH_PROGRAM, may return this message on failure.
///
#[cfg_attr(feature = "sbp_serde", derive(Serialize, Deserialize))]
#[derive(Debug)]
#[derive(Debug, Clone)]
#[allow(non_snake_case)]
pub struct MsgFlashDone {
pub sender_id: Option<u16>,
Expand Down Expand Up @@ -90,7 +90,7 @@ impl crate::serialize::SbpSerialize for MsgFlashDone {
/// invalid.
///
#[cfg_attr(feature = "sbp_serde", derive(Serialize, Deserialize))]
#[derive(Debug)]
#[derive(Debug, Clone)]
#[allow(non_snake_case)]
pub struct MsgFlashErase {
pub sender_id: Option<u16>,
Expand Down Expand Up @@ -153,7 +153,7 @@ impl crate::serialize::SbpSerialize for MsgFlashErase {
/// erased before addresses can be programmed.
///
#[cfg_attr(feature = "sbp_serde", derive(Serialize, Deserialize))]
#[derive(Debug)]
#[derive(Debug, Clone)]
#[allow(non_snake_case)]
pub struct MsgFlashProgram {
pub sender_id: Option<u16>,
Expand Down Expand Up @@ -227,7 +227,7 @@ impl crate::serialize::SbpSerialize for MsgFlashProgram {
/// range.
///
#[cfg_attr(feature = "sbp_serde", derive(Serialize, Deserialize))]
#[derive(Debug)]
#[derive(Debug, Clone)]
#[allow(non_snake_case)]
pub struct MsgFlashReadReq {
pub sender_id: Option<u16>,
Expand Down Expand Up @@ -296,7 +296,7 @@ impl crate::serialize::SbpSerialize for MsgFlashReadReq {
/// range.
///
#[cfg_attr(feature = "sbp_serde", derive(Serialize, Deserialize))]
#[derive(Debug)]
#[derive(Debug, Clone)]
#[allow(non_snake_case)]
pub struct MsgFlashReadResp {
pub sender_id: Option<u16>,
Expand Down Expand Up @@ -360,7 +360,7 @@ impl crate::serialize::SbpSerialize for MsgFlashReadResp {
/// register. The device replies with a MSG_FLASH_DONE message.
///
#[cfg_attr(feature = "sbp_serde", derive(Serialize, Deserialize))]
#[derive(Debug)]
#[derive(Debug, Clone)]
#[allow(non_snake_case)]
pub struct MsgM25FlashWriteStatus {
pub sender_id: Option<u16>,
Expand Down Expand Up @@ -414,7 +414,7 @@ impl crate::serialize::SbpSerialize for MsgM25FlashWriteStatus {
/// memory. The device replies with a MSG_FLASH_DONE message.
///
#[cfg_attr(feature = "sbp_serde", derive(Serialize, Deserialize))]
#[derive(Debug)]
#[derive(Debug, Clone)]
#[allow(non_snake_case)]
pub struct MsgStmFlashLockSector {
pub sender_id: Option<u16>,
Expand Down Expand Up @@ -468,7 +468,7 @@ impl crate::serialize::SbpSerialize for MsgStmFlashLockSector {
/// memory. The device replies with a MSG_FLASH_DONE message.
///
#[cfg_attr(feature = "sbp_serde", derive(Serialize, Deserialize))]
#[derive(Debug)]
#[derive(Debug, Clone)]
#[allow(non_snake_case)]
pub struct MsgStmFlashUnlockSector {
pub sender_id: Option<u16>,
Expand Down Expand Up @@ -525,7 +525,7 @@ impl crate::serialize::SbpSerialize for MsgStmFlashUnlockSector {
/// ID in the payload.
///
#[cfg_attr(feature = "sbp_serde", derive(Serialize, Deserialize))]
#[derive(Debug)]
#[derive(Debug, Clone)]
#[allow(non_snake_case)]
pub struct MsgStmUniqueIdReq {
pub sender_id: Option<u16>,
Expand Down Expand Up @@ -573,7 +573,7 @@ impl crate::serialize::SbpSerialize for MsgStmUniqueIdReq {
/// ID in the payload..
///
#[cfg_attr(feature = "sbp_serde", derive(Serialize, Deserialize))]
#[derive(Debug)]
#[derive(Debug, Clone)]
#[allow(non_snake_case)]
pub struct MsgStmUniqueIdResp {
pub sender_id: Option<u16>,
Expand Down
Loading