From a1e00763c56448ac83a14e89ff4cb133cafca72e Mon Sep 17 00:00:00 2001 From: Azenk Date: Sat, 19 Sep 2020 22:07:36 +0800 Subject: [PATCH 1/2] Fix data field slice errors in SET_NEXT_BLOCKS request. --- development/src/GXDLMS.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/development/src/GXDLMS.cpp b/development/src/GXDLMS.cpp index ee583cba..dd268342 100644 --- a/development/src/GXDLMS.cpp +++ b/development/src/GXDLMS.cpp @@ -909,7 +909,7 @@ int CGXDLMS::GetLNPdu( len -= GXHelpers::GetObjectCountSizeInBytes(len); } GXHelpers::SetObjectCount(len, reply); - reply.Set(p.GetData(), 0, len); + reply.Set(p.GetData(), p.GetData()->GetPosition(), len); } // Add data that fits to one block. if (len == 0) @@ -4139,4 +4139,4 @@ int CGXDLMS::HandleExceptionResponse(CGXReplyData& data) return DLMS_ERROR_TYPE_EXCEPTION_RESPONSE | value << 8 | error; } return 0; -} \ No newline at end of file +} From dceccd1999655610049c739f09bc4df32f8dbcb5 Mon Sep 17 00:00:00 2001 From: Azenk Date: Tue, 22 Sep 2020 12:29:40 +0800 Subject: [PATCH 2/2] Fix attribute descriptor errors in SET_NEXT_BLOCKS request. --- development/src/GXDLMS.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/development/src/GXDLMS.cpp b/development/src/GXDLMS.cpp index dd268342..d9c30908 100644 --- a/development/src/GXDLMS.cpp +++ b/development/src/GXDLMS.cpp @@ -857,7 +857,9 @@ int CGXDLMS::GetLNPdu( } // Add attribute descriptor. - reply.Set(p.GetAttributeDescriptor()); + if (!((p.GetCommand() == DLMS_COMMAND_SET_REQUEST) && (p.GetRequestType() == 3))) + reply.Set(p.GetAttributeDescriptor()); + // If multiple blocks. if (p.IsMultipleBlocks() && (p.GetSettings()->GetNegotiatedConformance() & DLMS_CONFORMANCE_GENERAL_BLOCK_TRANSFER) == 0) {