///<summary>
/// Handle action request.
///</summary>
///<param name="Reply">
/// Received data from the client.
///</param>
///<returns>
///Reply.
///</returns>
private byte[][] HandleMethodRequest()
{
GXByteBuffer data = Reply.Data;
GXByteBuffer bb = new GXByteBuffer();
// Get type.
data.GetUInt8();
// Get invoke ID and priority.
data.GetUInt8();
// CI
ObjectType ci = (ObjectType)data.GetUInt16();
byte[] ln = new byte[6];
data.Get(ln);
// Attribute Id
int id = data.GetUInt8();
// Get parameters.
object parameters = null;
if (data.GetUInt8() != 0)
{
GXDataInfo info = new GXDataInfo();
parameters = GXCommon.GetData(data, info);
}
GXDLMSObject obj = Settings.Objects.FindByLN(ci, GXDLMSObject.ToLogicalName(ln));
if (obj == null)
{
obj = FindObject(ci, 0, GXDLMSObject.ToLogicalName(ln));
}
if (obj == null)
{
// Device reports a undefined object.
addError(ErrorCode.UndefinedObject, bb);
Debug.WriteLine("Undefined object.");
}
else
{
ValueEventArgs e = new ValueEventArgs(obj, id, 0, parameters);
Action(e);
if (e.Handled)
{
bb.Add((obj as IGXDLMSBase).Invoke(Settings, id, parameters));
}
else
{
bb.Add((obj as IGXDLMSBase).Invoke(Settings, id, parameters));
}
}
return(GXDLMS.SplitPdu(Settings, Command.MethodResponse, 1, bb, ErrorCode.Ok, DateTime.MinValue)[0]);
}