lock (this)
{
if (trace)
{
Console.WriteLine("<- " + Gurux.Common.GXCommon.ToHex((byte[])e.Data, true));
}
reply.Set((byte[])e.Data);
//Example handles only notify messages.
GXReplyData data = new GXReplyData();
client.GetData(reply, data, notify);
// If all data is received.
if (notify.IsComplete)
{
reply.Clear();
if (!notify.IsMoreData)
{
try
{
// Make clone so we don't replace current values.
GXDLMSPushSetup clone = (GXDLMSPushSetup)push.Clone();
clone.GetPushValues(client, (List<object>)notify.Value);
//Comment this if the meter describes the content of the push message for the client in the received data.
foreach (var it in clone.PushObjectList)
{
int index = it.Value.AttributeIndex - 1;
Console.WriteLine(((IGXDLMSBase)it.Key).GetNames()[index] + ": " + it.Key.GetValues()[index]);
}
}
catch (Exception ex)
{
Console.WriteLine(ex.Message);
}
try
{
//Show data as XML.
string xml;
GXDLMSTranslator t = new GXDLMSTranslator(TranslatorOutputType.SimpleXml);
t.DataToXml(notify.Data, out xml);
Console.WriteLine(xml);
// Print received data.
PrintData(notify.Value, 0);
//Un-comment this if the meter describes the content of the push message for the client in the received data.
/*
if (notify.Value is List<object>)
{
List<object> tmp = notify.Value as List<object>;
List<KeyValuePair<GXDLMSObject, int>> objects = client.ParsePushObjects((List<object>)tmp[0]);
//Remove first item because it's not needed anymore.
objects.RemoveAt(0);
//Update clock.
int Valueindex = 1;
foreach (KeyValuePair<GXDLMSObject, int> it in objects)
{
client.UpdateValue(it.Key, it.Value, tmp[Valueindex]);
++Valueindex;
//Print value
Console.WriteLine(it.Key.ObjectType + " " + it.Key.LogicalName + " " + it.Value + ":" + it.Key.GetValues()[it.Value - 1]);
}
}
*/
Console.WriteLine("Server address:" + notify.ServerAddress + " Client Address:" + notify.ClientAddress);
}
catch (Exception ex)
{
Console.WriteLine(ex.Message);
}
finally
{
notify.Clear();
}
}
}
}
}
catch (Exception ex)
{
Console.WriteLine(ex.Message);
}
}
data sent from meter-00 01 00 01 00 40 00 76 DB 08 53 55 58 31 32 39 34 38 82 00 69 20 00 00 00 01 18 50 81 C3 C9 36 49 9D 4F 0B 52 FE 2D 77 2C 95 FF 4D 34 3D 34 B3 30 F9 E2 D2 2F 3F E3 DC 09 52 3C 11 89 F0 FE 63 5D 9B 4C 10 2E AC 29 2C 78 A1 00 8E 05 85 FF 08 9F D9 73 F9 BB 6F D7 CB AF 16 EB 47 79 34 A7 4C 56 29 6A 8A 84 BF 18 0C 7F F2 26 A7 95 96 B8 31 8A E8 6B D8 BB 12 44 2A 4F 06 4E 26 A9 44
but it is not returning any data.First of all
GXReplyData data = new GXReplyData();
client.GetData(reply, data, notify);
// If all data is received.
if (notify.IsComplete)
{
reply.Clear();
notify.IsComplete is returning false.Please help out to resolve this.
This meter is sending around 13 parameters some meter can send more than 13 parameter also,In this scenario we need handle dynamically,but i am unable to find which value indicates what?
So,Is there any possibility to get obiscode along with data.
Hi,
Send push messages are defined in the push object list and they can be configured, so you need to establish the connection to the meter and read the push object list
Hi, Push.Listener.Example…
Hi,
Push.Listener.Example listens push messages from the meter.
https://github.com/Gurux/Gurux.DLMS.Net/tree/master/Gurux.DLMS.Push.Lis…
How the server example sends push messages:
https://github.com/Gurux/Gurux.DLMS.Net/blob/83559d81579c83083e6f074dd0…
BR,
Mikko
Hi,Our requirement is,need…
Hi,Our requirement is,need to receive data from the meter and saved to our database.
so we can configure Push.Listener and host to the server is enough right??
Hi, Yes, you need to…
Hi,
Yes, you need to configure push listener and then you can save received data to the database.
BR,
Mikko
Hi, Thanks for the…
Hi,
Thanks for the confirmation.
Now,meter is sending data to .net Push Listener in the form of bytes and I converted bytes to Hex string
2A 49 4E 53 54 2C 30 33 30 30 31 35 39 37 2C 30 30 30 30 2C 31 32 3A 31 30 3A 30 30 2D 31 30 2D 31 30 2D 32 30 32 34 2C 30 37 2C 50 52 45 50 41 49 44 2C 32 33 31 2E 36 33 38 2C 32 33 32 2E 31 36 32 2C 32 33 32 2E 30 33 32 2C 30 30 30 2E 30 30 30 2C 30 30 30 2E 30 30 30 2C 30 30 30 2E 30 30 30 2C 2B 30 2E 30 30 30 2C 2B 30 2E 30 30 30 2C 2B 30 2E 30 30 30 2C 2B 30 2E 30 30 30 2C 35 30 2E 31 33 35 2C 30 30 30 30 30 30 2C 30 30 30 30 30 30 2C 30 30 30 30 30 30 2C 30 30 30 30 30 30 30 30 30 30 2C 30 30 30 30 30 30 30 30 30 30 2C 30 30 30 30 30 30 30 30 30 30 2C 30 30 30 30 30 30 30 30 30 30 2C 30 30 30 30 30 30 30 30 30 30 2C 30 30 30 30 30 30 30 30 30 30 2C 30 30 30 30 30 30 30 30 30 30 2C 30 30 30 30 30 30 30 30 30 30 2C 30 30 30 30 30 2C 30 30 3A 30 30 3A 30 30 2D 30 30 2D 32 30 30 30 2C 30 30 30 30 30 2C 30 30 3A 30 30 3A 30 30 2D 30 30 2D 32 30 30 30 2C 30 30 32 32 2C 30 30 30 30 32 33 35 38 33 38 2C 30 30 30 30 37 34 35 37 36 31 2C 30 30 30 32 34 39 2C 30 2E 30 30 30 2C 30 31 2C 30 31 2C 30 31 2C 33 30 2C 33 30 2C 30 31 2C 30 31 2C 30 30 30 36 35 39 2E 39 38 2C 30 30 30 34 39 34 37 33 2C 31 2C 30 30 30 31 30 30 2E 30 30 2C 31 2C 30 30 30 30 31 30 2E 30 30 2C 30 30 30 30 31 33 2E 33 34 2C 30 30 30 30 30 30 2E 30 30 2C 30 2C 30 35 34 30 30 30 2C 30 30 30 30 30 30 2C 30 2C 31 2C 23 0D 0A 0D 0A 2A 50 55 53 48 2D 49 4E 53 54 41 4E 0D 0A 4F 4B
How i can decode this hexa string?
Thank you
Hi, Your meter is sending…
Hi,
Your meter is sending push messages as a plain ASCII text and not with DLMS.
You need to build a parser that can handle this.
BR,
Mikko
Hi, Thanks for your response…
Hi,
Thanks for your response,as you suggested created parser now i can able to get the data.
But we have two meter manufacturer,one manufacturer sending data with DLMS only
00 01 00 01 00 40 00 78 DB 08 44 45 49 FF FF FF FF FF 6D 20 00 00 00 06 19 BB 60 D0 86 AF 25 5C FE BB 5B C7 FD 6E AC A1 7E 0E 06 B2 58 BD EE 30 DF 4D DE 85 6C 60 0B 9F 3D B3 15 DB DA 34 E9 13 E8 4C 49 A6 22 DB 93 2F CC 67 5D 98 A0 BB C8 6A 7C 03 72 78 EF 52 DE EE 64 D7 F5 E1 89 ED CC 42 94 4D B1 8B 53 45 16 1F 1C 9B 40 0C 37 AB 6B 35 04 0E 71 E4 D1 56 B9 79 FA 74 54 68 33 4D C0 91
So how i can decode this data
Hi, You can use Push…
Hi,
You can use Push.Listener.Example as I proposed earlier. You need to set correct block cipher and authentication keys so data can be decrypted.
BR,
Mikko
Hi, I am using following…
Hi,
I am using following method to convert dlms data bytes to readable format
async void OnReceived(object sender, Gurux.Common.ReceiveEventArgs e)
{
Console.WriteLine(DateTime.Now + " Data received-" + e.SenderInfo);
try
{
lock (this)
{
if (trace)
{
Console.WriteLine("<- " + Gurux.Common.GXCommon.ToHex((byte[])e.Data, true));
}
reply.Set((byte[])e.Data);
//Example handles only notify messages.
GXReplyData data = new GXReplyData();
client.GetData(reply, data, notify);
// If all data is received.
if (notify.IsComplete)
{
reply.Clear();
if (!notify.IsMoreData)
{
try
{
// Make clone so we don't replace current values.
GXDLMSPushSetup clone = (GXDLMSPushSetup)push.Clone();
clone.GetPushValues(client, (List<object>)notify.Value);
//Comment this if the meter describes the content of the push message for the client in the received data.
foreach (var it in clone.PushObjectList)
{
int index = it.Value.AttributeIndex - 1;
Console.WriteLine(((IGXDLMSBase)it.Key).GetNames()[index] + ": " + it.Key.GetValues()[index]);
}
}
catch (Exception ex)
{
Console.WriteLine(ex.Message);
}
try
{
//Show data as XML.
string xml;
GXDLMSTranslator t = new GXDLMSTranslator(TranslatorOutputType.SimpleXml);
t.DataToXml(notify.Data, out xml);
Console.WriteLine(xml);
// Print received data.
PrintData(notify.Value, 0);
//Un-comment this if the meter describes the content of the push message for the client in the received data.
/*
if (notify.Value is List<object>)
{
List<object> tmp = notify.Value as List<object>;
List<KeyValuePair<GXDLMSObject, int>> objects = client.ParsePushObjects((List<object>)tmp[0]);
//Remove first item because it's not needed anymore.
objects.RemoveAt(0);
//Update clock.
int Valueindex = 1;
foreach (KeyValuePair<GXDLMSObject, int> it in objects)
{
client.UpdateValue(it.Key, it.Value, tmp[Valueindex]);
++Valueindex;
//Print value
Console.WriteLine(it.Key.ObjectType + " " + it.Key.LogicalName + " " + it.Value + ":" + it.Key.GetValues()[it.Value - 1]);
}
}
*/
Console.WriteLine("Server address:" + notify.ServerAddress + " Client Address:" + notify.ClientAddress);
}
catch (Exception ex)
{
Console.WriteLine(ex.Message);
}
finally
{
notify.Clear();
}
}
}
}
}
catch (Exception ex)
{
Console.WriteLine(ex.Message);
}
}
data sent from meter-00 01 00 01 00 40 00 76 DB 08 53 55 58 31 32 39 34 38 82 00 69 20 00 00 00 01 18 50 81 C3 C9 36 49 9D 4F 0B 52 FE 2D 77 2C 95 FF 4D 34 3D 34 B3 30 F9 E2 D2 2F 3F E3 DC 09 52 3C 11 89 F0 FE 63 5D 9B 4C 10 2E AC 29 2C 78 A1 00 8E 05 85 FF 08 9F D9 73 F9 BB 6F D7 CB AF 16 EB 47 79 34 A7 4C 56 29 6A 8A 84 BF 18 0C 7F F2 26 A7 95 96 B8 31 8A E8 6B D8 BB 12 44 2A 4F 06 4E 26 A9 44
but it is not returning any data.First of all
GXReplyData data = new GXReplyData();
client.GetData(reply, data, notify);
// If all data is received.
if (notify.IsComplete)
{
reply.Clear();
notify.IsComplete is returning false.Please help out to resolve this.
Thanks in advance
Hi, You need to change the…
Hi,
You need to change the client interface from HDLC to WRAPPER. Then you need to set block cipher and authentication keys because the data is encrypted.
BR,
Mikko
Hi, Thanks,i can able to…
Hi,
Thanks,i can able to decrypt the data now.but i have some scenario
push bytes
00 01 00 01 00 40 00 76 DB 08 53 55 58 31 32 39 34 38 82 00 69 20 00 00 00 01 18 50 81 C3 C9 36 49 9D 4E 19 51 E0 00 7D 2C 95 FF 4D 34 3D 34 B3 30 F9 E2 D2 2F 3F E3 DC 09 52 3C 11 89 F0 FE 63 5D 9B 4C 10 2E AC 29 2D 6A A2 1E A3 0F 85 FF 08 9F D9 73 F4 50 E8 D7 CB AF 16 EB 47 79 34 A7 4C 56 29 6A 8A 84 BF 18 0C 7F F2 26 A7 95 96 B8 31 8A E9 6B D8 BB 12 44 2A 4F 06 4E 26 A9 44
decrypted xml format data
<x:structure>
<x:visible-string>SUX01012948</x:visible-string>
<x:octet-string>0000190900FF</x:octet-string>
<x:octet-string>07E80B04010F2D00FF014A00</x:octet-string>
<x:float32>436AA49C</x:float32>
<x:float32>00000000</x:float32>
<x:float32>00000000</x:float32>
<x:float32>00000000</x:float32>
<x:float32>00000000</x:float32>
<x:long-unsigned>3</x:long-unsigned>
<x:double-long-unsigned>1</x:double-long-unsigned>
<x:float32>00000000</x:float32>
<x:boolean>true</x:boolean>
<x:double-long-unsigned>15120</x:double-long-unsigned>
</x:structure>
readable format data
Value: SUX01012948
Value: System.Byte[]
Value: System.Byte[]
Value: 234.643
Value: 0
Value: 0
Value: 0
Value: 0
Value: 3
Value: 1
Value: 0
Value: True
Value: 15120
This meter is sending around 13 parameters some meter can send more than 13 parameter also,In this scenario we need handle dynamically,but i am unable to find which value indicates what?
So,Is there any possibility to get obiscode along with data.
(I have cloned this and checking the functionality
https://github.com/Gurux/Gurux.DLMS.Net/tree/master/Gurux.DLMS.Push.Lis…)
Hi, Send push messages are…
Hi,
Send push messages are defined in the push object list and they can be configured, so you need to establish the connection to the meter and read the push object list
https://www.gurux.fi/Gurux.DLMS.Objects.GXDLMSPushSetup
I believe that the first item is the meter serial number, the second is the Logical name, and the third is the meter time.
BR,
Mikko