TMTC Stack Refactoring #106
@ -74,20 +74,6 @@ class SerializeIF {
|
|||||||
return serialize(buffer, size, maxSize, SerializeIF::Endianness::MACHINE);
|
return serialize(buffer, size, maxSize, SerializeIF::Endianness::MACHINE);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Forwards to regular @serialize call with network endianness
|
|
||||||
*/
|
|
||||||
virtual ReturnValue_t serializeNe(uint8_t** buffer, size_t* size, size_t maxSize) {
|
|
||||||
return serialize(buffer, size, maxSize, SerializeIF::Endianness::NETWORK);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* If endianness is not explicitly specified, use machine endianness
|
|
||||||
*/
|
|
||||||
virtual ReturnValue_t serialize(uint8_t **buffer, size_t *size, size_t maxSize) {
|
|
||||||
return serialize(buffer, size, maxSize, SerializeIF::Endianness::MACHINE);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the size of a object if it would be serialized in a buffer
|
* Gets the size of a object if it would be serialized in a buffer
|
||||||
* @return Size of serialized object
|
* @return Size of serialized object
|
||||||
|
@ -41,7 +41,7 @@ TEST_CASE("CCSDS Packet ID", "[ccsds-packet-id]") {
|
|||||||
packetId.secHeaderFlag = false;
|
packetId.secHeaderFlag = false;
|
||||||
packetId.packetType = ccsds::PacketType::TM;
|
packetId.packetType = ccsds::PacketType::TM;
|
||||||
REQUIRE(packetId.raw() == 0x1ff);
|
REQUIRE(packetId.raw() == 0x1ff);
|
||||||
REQUIRE(packetId.SerializeIF::serialize(buf.data(), buf.size(), SerializeIF::Endianness::NETWORK) ==
|
REQUIRE(packetId.SerializeIF::serializeNe(buf.data(), buf.size()) ==
|
||||||
HasReturnvaluesIF::RETURN_OK);
|
HasReturnvaluesIF::RETURN_OK);
|
||||||
REQUIRE(buf[0] == 0x1);
|
REQUIRE(buf[0] == 0x1);
|
||||||
REQUIRE(buf[1] == 0xff);
|
REQUIRE(buf[1] == 0xff);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user