Skip to content

Commit 527161b

Browse files
committed
Improve the API
1 parent ac1cc1a commit 527161b

21 files changed

Lines changed: 592 additions & 728 deletions

src/dlms_parser/apdu_handler.cpp

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
#include "apdu_handler.h"
2-
#include "log.h"
32
#include "utils.h"
43
#include <algorithm>
54
#include <array>
@@ -28,8 +27,8 @@ static bool is_known_tag(const uint8_t b) {
2827
case DLMS_APDU_DATA_NOTIFICATION:
2928
case DLMS_APDU_GENERAL_GLO_CIPHERING:
3029
case DLMS_APDU_GENERAL_DED_CIPHERING:
31-
case DLMS_DATA_TYPE_ARRAY:
32-
case DLMS_DATA_TYPE_STRUCTURE:
30+
case static_cast<uint8_t>(DlmsDataType::ARRAY):
31+
case static_cast<uint8_t>(DlmsDataType::STRUCTURE):
3332
return true;
3433
default:
3534
return false;
@@ -51,9 +50,9 @@ std::span<uint8_t> parse_apdu_in_place(std::span<uint8_t> buf, Aes128GcmDecrypto
5150
const uint8_t tag = buf[0];
5251

5352
// --- Raw AXDR (0x01/0x02): done
54-
if (tag == DLMS_DATA_TYPE_ARRAY || tag == DLMS_DATA_TYPE_STRUCTURE) {
53+
if (tag == static_cast<uint8_t>(DlmsDataType::ARRAY) || tag == static_cast<uint8_t>(DlmsDataType::STRUCTURE)) {
5554
Logger::log(LogLevel::VERBOSE, "Found raw AXDR %s (0x%02X) - no APDU wrapper",
56-
tag == DLMS_DATA_TYPE_ARRAY ? "ARRAY" : "STRUCTURE", tag);
55+
tag == static_cast<uint8_t>(DlmsDataType::ARRAY) ? "ARRAY" : "STRUCTURE", tag);
5756
return buf;
5857
}
5958

0 commit comments

Comments
 (0)