Gurux DLMS Component for C#, .Net, Java, Delphi and ANSI C++ Getting started

Read basic information from Gurux.DLMS component before you start to create DLMS notify. Read also Push FAQ.

Sending DLMS Push and Data Notification events.

Gurux.DLMS component supports DLMS Push and Data Notification messages. Structure of Data Notification messages is not so tight than structure of Push messages. Basically you can send all kind of data using Data Notification messages, but problem is that they are more manufacturer spesific.

GXDLMSNotifyHandler notify = new GXDLMSNotifyHandler(
//Is Logical name referencing used.
true, 
//Client address
16,
//Server address.
1, 
// Is used HDLC or COSEM transport layers for IPv4 networks (IEC 62056-47)
 InterfaceType.Wrapper);
GXDLMSNotifyHandler notify = new GXDLMSNotifyHandler(
//Is Logical name referencing used.
true, 
//Client address
16,
//Server address.
1, 
// Is used HDLC or COSEM transport layers for IPv4 networks (IEC 62056-47)
 InterfaceType.WRAPPER);

//Delphi is not support notifications.
//C++ is not support notifications.

Sending Push messages

You can send and receive push messages easily. GeneratePushMessage is used to send Push messages. You will just give list of COSEM objects what you want to send in Push message. In code example below we will create Register object and send it's 2th and 3rd attributes.
You will not receive an acknowledgment from the client, so do not wait it. Just send the data.
List<SimpleEntry<GXDLMSObject, Integer>> objects = new ArrayList<SimpleEntry<GXDLMSObject, Integer>>();
GXDLMSRegister r = new GXDLMSRegister();
objects.Add(new KeyValuePair<GXDLMSObject, int>(r, 2));
objects.Add(new KeyValuePair<GXDLMSObject, int>(r, 3));
byte[][] data = notify.GeneratePushMessage(null, objects);
// Send data to the client using example GXNet media component. 
List<KeyValuePair<GXDLMSObject, int>> objects = new List<KeyValuePair<GXDLMSObject, int>>();
GXDLMSRegister r = new GXDLMSRegister();
objects.Add(new KeyValuePair<GXDLMSObject, int>(r, 2));
objects.Add(new KeyValuePair<GXDLMSObject, int>(r, 3));
byte[][] data = notify.GeneratePushMessage(DateTime.Now, objects);
// Send data to the client using example GXNet media component. 
//Delphi is not supporting this functionality at the moment.
//C++ is not supporting this functionality at the moment.

Receiving Push messages

Push message receiving is made with ParsePushObjects.
GXReplyData info = new GXReplyData();
notify.getData(data, info);
if (info.getMoreData() == RequestTypes.NONE)
{
   List<SimpleEntry<GXDLMSObject, Integer>> objects = notify.parsePushObjects(info.getData());
}
GXReplyData info = new GXReplyData();
notify.GetData(data, info);
if (info.GetMoreData() == RequestTypes.None)
{
   List<KeyValuePair<GXDLMSObject, int>> objects = notify.ParsePushObjects(info.Data);
}
//Delphi is not supporting this functionality at the moment.
//C++ is not supporting this functionality at the moment.

Sending Data Notification messages

You can send and receive Data Notification messages easily. GetDataNotificationMessage is used to send Data Notification messages. You will just give byte array what you want to send in Data Notification message. In code example below we will create Register object and send it's 2th and 3rd attributes.
You will not receive an acknowledgment from the client, so do not wait it. Just send the data.
GXDLMSRegister r = new GXDLMSRegister();
GXByteBuffer bb = new GXByteBuffer();
bb.setUInt8((byte) DataType.ARRAY.GetValue());
bb.setUInt8(2);
notify.addData(r, 2, bb);
notify.addData(r, 3, bb);
byte[][] data = notify.getDataNotificationMessage(null, bb);
// Send data to the client using example GXNet media component. 
GXDLMSRegister r = new GXDLMSRegister();
GXByteBuffer bb = new GXByteBuffer();
bb.SetUInt8((byte) DataType.Array);
bb.SetUInt8(2);
notify.AddData(r, 2, bb);
notify.AddData(r, 3, bb);
byte[][] data = notify.GetDataNotificationMessage(DateTime.Now, bb);
// Send data to the client using example GXNet media component. 
//Delphi is not supporting this functionality at the moment.
//C++ is not supporting this functionality at the moment.

Receiving Data messages

Data message receiving is made with ParseDataObjects.
GXReplyData info = new GXReplyData();
notify.getData(data, info);
if (info.getMoreData() == RequestTypes.NONE)
{
   List<SimpleEntry<GXDLMSObject, Integer>> objects = Data.parseDataObjects(info.getData());
}
GXReplyData info = new GXReplyData();
notify.GetData(data, info);
if (info.GetMoreData() == RequestTypes.None)
{
   List<KeyValuePair<GXDLMSObject, int>> objects = Data.ParseDataObjects(info.Data);
}
//Delphi is not supporting this functionality at the moment.
//C++ is not supporting this functionality at the moment.

Thats it. If you have any questions or ideas how to improve Gurux.DLMS component let us know or ask question in a Forum