Parsing of Date and Time is impossible in Gurux.dlms.delphi
Hello, Sir
I found estimated bug of gurux.dlms.delphi source code as bellows
(1) Thanks to example of TGXProgram, I got Get-Response from meter using Client.GetObjectRequest() and PDU data is "09 0C 07 E3 0A 0C 06 12 0D 1F 01 80 00 02"
it is date and time data of meter.
(2) When above PDU data is applied to Client.ParseObjects(Reply.Data, True), Invalid response Exception error is occurred as bellows;
size := buffer.GetUint8();
if size <> 1 then
raise TGXDLMSException.Create('Invalid response.');
First byte of PDU data is "09" and it is applied to size.
data Time of Obis code is 0.0.1.0.0.255 and it is general code.
Is there any parse function of data time of obis code besides Client.ParseObjects()?
I checked read-method of TGXP Program and found it same of GetObjectsRequest to get sender data to meter.
When I send Activity Calendar data day profile ( array, structure of unsigned, Structure of octet string and long unsigned) to get responding data from meter, I got data using "TGXDLMSClient.GetData(reply: TBytes; data: TGXReplyData)" and it contained various kind of data like this;
resultval := Common.GetData(Reply.Data, info);
--> resultval is Tvalue data type.
Reply.Data of TGXByteBuffer is as bellows;
01 0A // Array data type, 10ea
02 02 // Structure data type, member varialbe 2ea
11 00 // Unsigned data type
01 0c // array data type 12ea
...
when I extract data from resultval of Tvalue like this
"extractdata := resultval.AsType<Tbytes>",
function TValue.AsType<T>: T;
begin
if not TryAsType<T>(Result) then
raise EInvalidCast.CreateRes(@SInvalidCast);
end;
"Invalid class typecast" exception error is occurred.
The reason of exception error is seemed to containing various data type of resultval (Tvalue type).
How can I solve this status to extract data from resultval?
Hi,
Hi,
ParseObjects method is called only after you have read the association view.
I propose that you check TGXProgram.Read -method. It reads wanted object and updates value.
BR,
Mikko
Thank you sir, I will check
Thank you sir, I will check it according to your good comment.
Dear Sir,
Dear Sir,
I checked read-method of TGXP Program and found it same of GetObjectsRequest to get sender data to meter.
When I send Activity Calendar data day profile ( array, structure of unsigned, Structure of octet string and long unsigned) to get responding data from meter, I got data using "TGXDLMSClient.GetData(reply: TBytes; data: TGXReplyData)" and it contained various kind of data like this;
resultval := Common.GetData(Reply.Data, info);
--> resultval is Tvalue data type.
Reply.Data of TGXByteBuffer is as bellows;
01 0A // Array data type, 10ea
02 02 // Structure data type, member varialbe 2ea
11 00 // Unsigned data type
01 0c // array data type 12ea
...
when I extract data from resultval of Tvalue like this
"extractdata := resultval.AsType<Tbytes>",
function TValue.AsType<T>: T;
begin
if not TryAsType<T>(Result) then
raise EInvalidCast.CreateRes(@SInvalidCast);
end;
"Invalid class typecast" exception error is occurred.
The reason of exception error is seemed to containing various data type of resultval (Tvalue type).
How can I solve this status to extract data from resultval?
Please comment to find best function or method.
Thanks a lot.
Hi,
Hi,
Create TGXDLMSActivityCalendar object and read it. Then you can access read attribute from TGXDLMSActivityCalendar parameters.
BR,
Mikko
Thanks a lot Sir.
Thanks a lot Sir.