From 1f147c93f2a75a885d02e3c7b83b50d3a341567e Mon Sep 17 00:00:00 2001 From: kongr45gpen <electrovesta@gmail.com> Date: Mon, 12 Nov 2018 02:25:25 +0200 Subject: [PATCH] Add response for TC[17,3] --- inc/Services/TestService.hpp | 9 ++++++++- src/Services/TestService.cpp | 15 ++++++++++++++- src/main.cpp | 3 +++ 3 files changed, 25 insertions(+), 2 deletions(-) diff --git a/inc/Services/TestService.hpp b/inc/Services/TestService.hpp index 35c276bc..47062a9d 100644 --- a/inc/Services/TestService.hpp +++ b/inc/Services/TestService.hpp @@ -15,7 +15,14 @@ public: /** * TC[17,1] perform an are-you-alive connection test */ - void areYouAlive(const Message & message); + void areYouAlive(const Message & request); + + /** + * TC[17,3] perform an on-board connection test + * + * @todo Only respond if we have the correct APID + */ + void onBoardConnection(const Message & request); }; diff --git a/src/Services/TestService.cpp b/src/Services/TestService.cpp index aff053f6..6335e3ad 100644 --- a/src/Services/TestService.cpp +++ b/src/Services/TestService.cpp @@ -1,8 +1,21 @@ + +#include <Services/TestService.hpp> + #include "Services/TestService.hpp" -void TestService::areYouAlive(const Message &message) { +void TestService::areYouAlive(const Message &request) { // TM[17,2] are-you-alive connection test report Message report = createTM(2); storeMessage(report); } + +void TestService::onBoardConnection(const Message &request) { + // TM[17,4] on-board connection test report + 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]); + + storeMessage(report); +} diff --git a/src/main.cpp b/src/main.cpp index 05c564c5..31ecd04f 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -18,6 +18,9 @@ int main() { TestService testService; 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)); + testService.onBoardConnection(receivedPacket); return 0; } -- GitLab