diff --git a/src/Services/EventActionService.cpp b/src/Services/EventActionService.cpp index 3fb2659dec6d9e53598e5265249171f7ea48da31..617df123c4c531362e0090a690126483eb230931 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 0264a3fd83dda9b7af17308a0bb312642852a688..e2431b013604c1a19144e86ebc07964503e6ed9f 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); + }