Gurux DLMS Component for C#, .Net, Java, Delphi and ANSI C++Sometimes device manufacturers are using custom objects to add new functionality to the meters.You can create Manufacture specific object types (IC) for Gurux DLMS/COSEM in the following way.1. Add custom ID to object type enum.JavaC#DelphiANSI C++GURUX_CUSTOM_OBJECT(1234),enum ObjectType
{
...
GuruxCustomObject = 1234
...
}OBJECT_TYPE_GURUX_CUSTOM_OBJECT = 12342. Make own class ex. GuruxCustomObject and derive it from GXDLMSObject and IGXDLMSBase. Then add constructor where you tell class ID.JavaC#DelphiANSI C++/*
* Gurux manufacture spesific object.
*/
class GuruxCustomObject extends GXDLMSObject implements IGXDLMSBase
{
/*
* Constructor.
*/
public GuruxCustomObject()
{
super(ObjectType.GURUX_CUSTOM_OBJECT);
}
/*
* Returns collection of attributes to read.
*
* If attribute is static and already read or device is returned HW error it is not returned.
*/
int[] getAttributeIndexToRead()
{
}
/*
* Returns amount of attributes.
*/
int getAttributeCount()
{
}
/*
* Returns amount of methods.
*/
int getMethodCount()
{
}
/*
* Returns collection of class values.
*/
@Override
public Object[] getValues()
{
return new Object[] {getLogicalName(), };
}
/*
* Returns value of given attribute.
*/
Object getValue(int index, int selector, Object parameters)
{
}
/*
* Set value of given attribute.
*/
void setValue(int index, Object value)
{
}
/*
* Invokes method.
*
@param index Method index.
*/
byte[][] invoke(Object sender, int index, Object parameters)
{
}
}///
/// Gurux manufacture spesific object.
///
public class GuruxCustomObject : GXDLMSObject, IGXDLMSBase
{
///
/// Constructor.
///
public GuruxCustomObject()
: base(ObjectType.GuruxCustomObject)
{
}
#region IGXDLMSBase Members
///
/// Returns collection of attributes to read.
///
///
/// If attribute is static and already read or device is returned HW error it is not returned.
///
/// Collection of attributes to read.
public int[] GetAttributeIndexToRead()
{
}
///
/// Returns amount of attributes.
///
/// Count of attributes.
public int GetAttributeCount()
{
throw new NotImplementedException();
}
//
/// Returns amount of methods.
///
///
public int GetMethodCount()
{
throw new NotImplementedException();
}
///
/// Returns names of attribute indexes.
///
///
public string[] GetNames()
{
throw new NotImplementedException();
}
///
/// Returns attributes as an array.
///
/// Collection of COSEM object values.
public override object[] GetValues()
{
}
///
/// Returns value of given attribute.
///
///
/// When raw parameter us not used example register multiplies value by scalar.
///
/// Attribute index /// Value of the attribute index. public object GetValue(int index, int selector, object parameters) { throw new NotImplementedException(); } /// /// Set value of given attribute. /// /// /// When raw parameter us not used example register multiplies value by scalar. /// /// Attribute index /// Value of the attribute index. public void SetValue(int index, Object value) { } /// /// Invokes method. /// /// Method index. public byte[][] Invoke(object sender, int index, object parameters) { throw new NotImplementedException(); } #endregion } //Gurux manufacture spesific object.
class CGuruxCustomObject : public CGXDLMSObject
{
//Constructor.
GuruxCustomObject() : CGXDLMSObject(OBJECT_TYPE_GURUX_CUSTOM_OBJECT)
{
}
// Returns amount of attributes.
int GetAttributeCount()
{
}
// Returns amount of methods.
int GetMethodCount()
{
}
//Get attribute values of object.
void GetValues(vector& values)
{
}
// Returns value of given attribute.
virtual int GetValue(int index, int selector, CGXDLMSVariant& parameters, CGXDLMSVariant& value)
{
}
// Set value of given attribute.
virtual int SetValue(int index, CGXDLMSVariant& value)
{
}
// Invokes method.
virtual int Invoke(int index, CGXDLMSVariant& parameters)
{
}
// Returns collection of attributes to read.
// If attribute is static and already read or device is returned HW error it is not returned.
void GetAttributeIndexToRead(vector& attributes)
{
}
};After you have created your class you must add it to the class factory.In C# this is done automatically, but in other programmin languages you must add this by your self.JavaC#DelphiANSI C++
//createObject is located to GXDLMS.java
static GXDLMSObject createObject(ObjectType type)
{
...
if (type == ObjectType.GURUX_CUSTOM_OBJECT)
{
return new GuruxCustomObject();
}
...
}//You can skip this. This is done automatically.
CGXDLMSObject* CGXDLMSObjectFactory::CreateObject(OBJECT_TYPE type)
{
...
if (type == OBJECT_TYPE_GURUX_CUSTOM_OBJECT)
{
return new CGuruxCustomObject();
}
...
} Now your custom IC is ready. Next time when you are reading your Association View your new IC is shown as well.Language English