diff --git a/inc/Message.hpp b/inc/Message.hpp index 5747a2111c5ed740c55a50edb325becc626d9670..8b3ff35dcca78a8451316b8d1a13eb61ac92b02d 100644 --- a/inc/Message.hpp +++ b/inc/Message.hpp @@ -98,7 +98,7 @@ public: * * PTC = 1, PFC = 8 */ - void appendEnumerated(uint8_t value) { + void appendEnum8(uint8_t value) { return appendByte(value); }; @@ -107,7 +107,7 @@ public: * * PTC = 1, PFC = 16 */ - void appendEnumerated(uint16_t value) { + void appendEnum16(uint16_t value) { return appendHalfword(value); } @@ -116,7 +116,7 @@ public: * * PTC = 1, PFC = 32 */ - void appendEnumerated(uint32_t value) { + void appendEnum32(uint32_t value) { return appendWord(value); } @@ -125,7 +125,7 @@ public: * * PTC = 2, PFC = 4 */ - void appendInteger(uint8_t value) { + void appendUint8(uint8_t value) { return appendByte(value); } @@ -134,7 +134,7 @@ public: * * PTC = 2, PFC = 8 */ - void appendInteger(uint16_t value) { + void appendUint16(uint16_t value) { return appendHalfword(value); } @@ -143,7 +143,7 @@ public: * * PTC = 2, PFC = 14 */ - void appendInteger(uint32_t value) { + void appendUint32(uint32_t value) { return appendWord(value); } @@ -152,7 +152,7 @@ public: * * PTC = 3, PFC = 4 */ - void appendInteger(int8_t value) { + void appendSint8(int8_t value) { return appendByte(reinterpret_cast<uint8_t&>(value)); } @@ -161,7 +161,7 @@ public: * * PTC = 3, PFC = 8 */ - void appendInteger(int16_t value) { + void appendSint16(int16_t value) { return appendHalfword(reinterpret_cast<uint16_t&>(value)); } @@ -170,7 +170,7 @@ public: * * PTC = 3, PFC = 14 */ - void appendInteger(int32_t value) { + void appendSint32(int32_t value) { return appendWord(reinterpret_cast<uint32_t&>(value)); } @@ -179,7 +179,7 @@ public: * * PTC = 5, PFC = 1 */ - void appendReal(float value) { + void appendFloat(float value) { static_assert(sizeof(uint32_t) == sizeof(value), "Floating point numbers must be 32 bits long"); return appendWord(reinterpret_cast<uint32_t&>(value)); diff --git a/src/Services/TestService.cpp b/src/Services/TestService.cpp index 674b19db93c3e699e3e7699f85a31f98547a8e58..aaf3f4f661d5d0b2de318e1ae6bba0a1d16e21d6 100644 --- a/src/Services/TestService.cpp +++ b/src/Services/TestService.cpp @@ -12,7 +12,7 @@ void TestService::onBoardConnection(const Message &request) { Message report = createTM(4); // TODO: This is not the correct way to do this! Fetching functions will be added later - report.appendInteger(request.data[1]); + report.appendUint8(request.data[1]); storeMessage(report); } diff --git a/src/main.cpp b/src/main.cpp index 31ecd04fb4fde76903d1eee668475f8eaa074a85..5d94164819c2a6c5954faa2ca7916cdbd6b09350 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -8,7 +8,7 @@ int main() { packet.appendString(5, "hello"); packet.appendBits(15, 0x28a8); packet.appendBits(1, 1); - packet.appendReal(5.7); + packet.appendFloat(5.7); std::cout << "Hello, World!" << std::endl; std::cout << std::hex << packet.data << std::endl; // packet data must be 'helloQQ' @@ -19,7 +19,7 @@ int main() { Message receivedPacket = Message(17, 1, Message::TC, 1); testService.areYouAlive(receivedPacket); receivedPacket = Message(17, 3, Message::TC, 1); - receivedPacket.appendInteger(static_cast<uint16_t>(7)); + receivedPacket.appendUint16(7); testService.onBoardConnection(receivedPacket); return 0;