drtio-mgmt: reorder last param

This commit is contained in:
occheung 2024-08-23 11:46:16 +08:00
parent 1683572838
commit 1fc3ea40f7
1 changed files with 10 additions and 10 deletions

View File

@ -313,8 +313,8 @@ pub enum Packet {
}, },
CoreMgmtConfigWriteRequest { CoreMgmtConfigWriteRequest {
destination: u8, destination: u8,
length: u16,
last: bool, last: bool,
length: u16,
data: [u8; MASTER_PAYLOAD_MAX_SIZE], data: [u8; MASTER_PAYLOAD_MAX_SIZE],
}, },
CoreMgmtConfigRemoveRequest { CoreMgmtConfigRemoveRequest {
@ -337,8 +337,8 @@ pub enum Packet {
data: [u8; SAT_PAYLOAD_MAX_SIZE], data: [u8; SAT_PAYLOAD_MAX_SIZE],
}, },
CoreMgmtConfigReadReply { CoreMgmtConfigReadReply {
length: u16,
last: bool, last: bool,
length: u16,
value: [u8; SAT_PAYLOAD_MAX_SIZE], value: [u8; SAT_PAYLOAD_MAX_SIZE],
}, },
CoreMgmtAck, CoreMgmtAck,
@ -650,14 +650,14 @@ impl Packet {
}, },
0xd6 => { 0xd6 => {
let destination = reader.read_u8()?; let destination = reader.read_u8()?;
let length = reader.read_u16()?;
let last = reader.read_bool()?; let last = reader.read_bool()?;
let length = reader.read_u16()?;
let mut data: [u8; MASTER_PAYLOAD_MAX_SIZE] = [0; MASTER_PAYLOAD_MAX_SIZE]; let mut data: [u8; MASTER_PAYLOAD_MAX_SIZE] = [0; MASTER_PAYLOAD_MAX_SIZE];
reader.read_exact(&mut data[0..length as usize])?; reader.read_exact(&mut data[0..length as usize])?;
Packet::CoreMgmtConfigWriteRequest { Packet::CoreMgmtConfigWriteRequest {
destination: destination, destination: destination,
length: length,
last: last, last: last,
length: length,
data: data, data: data,
} }
} }
@ -693,13 +693,13 @@ impl Packet {
} }
}, },
0xdc => { 0xdc => {
let length = reader.read_u16()?;
let last = reader.read_bool()?; let last = reader.read_bool()?;
let length = reader.read_u16()?;
let mut value: [u8; SAT_PAYLOAD_MAX_SIZE] = [0; SAT_PAYLOAD_MAX_SIZE]; let mut value: [u8; SAT_PAYLOAD_MAX_SIZE] = [0; SAT_PAYLOAD_MAX_SIZE];
reader.read_exact(&mut value[0..length as usize])?; reader.read_exact(&mut value[0..length as usize])?;
Packet::CoreMgmtConfigReadReply { Packet::CoreMgmtConfigReadReply {
length: length,
last: last, last: last,
length: length,
value: value, value: value,
} }
}, },
@ -1117,14 +1117,14 @@ impl Packet {
} }
Packet::CoreMgmtConfigWriteRequest { Packet::CoreMgmtConfigWriteRequest {
destination, destination,
length,
last, last,
length,
data, data,
} => { } => {
writer.write_u8(0xd6)?; writer.write_u8(0xd6)?;
writer.write_u8(destination)?; writer.write_u8(destination)?;
writer.write_u16(length)?;
writer.write_bool(last)?; writer.write_bool(last)?;
writer.write_u16(length)?;
writer.write_all(&data[0..length as usize])?; writer.write_all(&data[0..length as usize])?;
} }
Packet::CoreMgmtConfigRemoveRequest { Packet::CoreMgmtConfigRemoveRequest {
@ -1156,13 +1156,13 @@ impl Packet {
writer.write_all(&data[0..length as usize])?; writer.write_all(&data[0..length as usize])?;
} }
Packet::CoreMgmtConfigReadReply { Packet::CoreMgmtConfigReadReply {
length,
last, last,
length,
value, value,
} => { } => {
writer.write_u8(0xdc)?; writer.write_u8(0xdc)?;
writer.write_u16(length)?;
writer.write_bool(last)?; writer.write_bool(last)?;
writer.write_u16(length)?;
writer.write_all(&value[0..length as usize])?; writer.write_all(&value[0..length as usize])?;
} }
Packet::CoreMgmtAck => writer.write_u8(0xdd)?, Packet::CoreMgmtAck => writer.write_u8(0xdd)?,