Skip to content

Commit a72c61e

Browse files
Florian Guggiflorg-32
authored andcommitted
chore!: Switch CEP CRC algorithm to CRC-32/JAMCRC
Closes: #158
1 parent 932f074 commit a72c61e

File tree

3 files changed

+3
-20
lines changed

3 files changed

+3
-20
lines changed

scheduler/src/communication/cep.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
use crc::{Crc, CRC_32_MPEG_2};
1+
use crc::{Crc, CRC_32_JAMCRC};
22
use std::io::Read;
33

44
#[derive(Debug, Clone, PartialEq, Eq)]
@@ -21,7 +21,7 @@ impl CEPPacket {
2121
pub const MAXIMUM_DATA_LENGTH: usize = 11_000;
2222
pub const MAXIMUM_PACKET_LENGTH: usize = 7 + Self::MAXIMUM_DATA_LENGTH;
2323

24-
const CRC: Crc<u32> = Crc::<u32>::new(&CRC_32_MPEG_2);
24+
const CRC: Crc<u32> = Crc::<u32>::new(&CRC_32_JAMCRC);
2525

2626
/// Calculates the CRC32 MPEG-2 checksum for the contained data. For variants other than `Self::Data`, 0 is returned
2727
#[must_use]
@@ -138,7 +138,7 @@ mod tests {
138138
#[test_case(vec![0x27], CEPPacket::Nack)]
139139
#[test_case(vec![0x59], CEPPacket::Eof)]
140140
#[test_case(vec![0x8B, 0, 0, 0xff, 0xff, 0xff, 0xff], CEPPacket::Data(vec![]); "empty Data packet")]
141-
#[test_case(vec![0x8B, 4, 0, 0x0a, 0x0b, 0x05, 0x73, 0x52, 0x27, 0x92, 0xf4], CEPPacket::Data(vec![0x0a, 0x0b, 0x05, 0x73]); "filled data packet")]
141+
#[test_case(vec![0x8B, 4, 0, 0x0a, 0x0b, 0x05, 0x73, 0xA5, 0xFB, 0x28, 0x09], CEPPacket::Data(vec![0x0a, 0x0b, 0x05, 0x73]); "filled data packet")]
142142
fn packet_is_parsed_and_serialized_correctly(vec: Vec<u8>, packet: CEPPacket) {
143143
assert_eq!(&packet.clone().serialize(), &vec);
144144
assert_eq!(CEPPacket::try_from(vec).unwrap(), packet);

scheduler/tests/software_tests/communication_tests.rs

Lines changed: 0 additions & 16 deletions
This file was deleted.

scheduler/tests/software_tests/mod.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
mod command_integration;
22
pub mod common;
3-
mod communication_tests;
43
mod execute_program;
54
mod get_status;
65
mod return_result;

0 commit comments

Comments
 (0)