From a5313470fc4149180993660514537637366e118f Mon Sep 17 00:00:00 2001 From: athatheocsd <athatheo@csd.auth.gr> Date: Thu, 3 Jan 2019 00:26:00 +0200 Subject: [PATCH] TC[19,7] Completed Standard's services completed --- src/Services/EventActionService.cpp | 7 +++++++ test/Services/EventActionService.cpp | 30 ++++++++++++++++++++++++++++ 2 files changed, 37 insertions(+) diff --git a/src/Services/EventActionService.cpp b/src/Services/EventActionService.cpp index 3fb2659d..617df123 100644 --- a/src/Services/EventActionService.cpp +++ b/src/Services/EventActionService.cpp @@ -127,6 +127,13 @@ void EventActionService::requestEventActionDefinitionStatus(Message message) { void EventActionService::eventActionStatusReport() { // TM[19,7] Message report = createTM(7); + uint8_t count = 0; + for (uint16_t i = 0; i < 256; i++) { + if (eventActionDefinitionArray[i].empty == 0) { + count++; + } + } + report.appendUint8(count); for (uint16_t i = 0; i < 256; i++) { if (eventActionDefinitionArray[i].empty == 0) { report.appendEnum16(eventActionDefinitionArray[i].applicationId); diff --git a/test/Services/EventActionService.cpp b/test/Services/EventActionService.cpp index 0264a3fd..e2431b01 100644 --- a/test/Services/EventActionService.cpp +++ b/test/Services/EventActionService.cpp @@ -203,6 +203,36 @@ TEST_CASE("Request event-action definition status TC[19,6]", "[service][st09]") } TEST_CASE("Event-action status report TM[19,7]", "[service][st09]") { + EventActionService eventActionService; + Message message0(19, 1, Message::TC, 0); + message0.appendEnum16(1); + message0.appendEnum16(0); + String<64> data = "0"; + message0.appendString(data); + eventActionService.addEventActionDefinitions(message0); + Message message1(19, 1, Message::TC, 0); + message1.appendEnum16(1); + message1.appendEnum16(2); + data = "2"; + message1.appendString(data); + eventActionService.addEventActionDefinitions(message1); + Message message2(19, 5, Message::TC, 0); + message2.appendUint16(1); + message2.appendEnum16(1); + message2.appendEnum16(0); + eventActionService.disableEventActionDefinitions(message2); + eventActionService.eventActionStatusReport(); + REQUIRE(ServiceTests::hasOneMessage()); + + Message report = ServiceTests::get(0); + CHECK(report.readUint8() == 2); + CHECK(report.readEnum16() == 1); + CHECK(report.readEnum16() == 0); + CHECK(report.readUint8() == 0); + CHECK(report.readEnum16() == 1); + CHECK(report.readEnum16() == 2); + CHECK(report.readUint8() == 1); + } -- GitLab