public static HandleReadRequest ( |
||
settings | DLMS settings. | |
server | DLMS server. | |
data | Received data. | |
replyData | ||
xml | ||
return | void |
///<summary> /// Handle received command. ///</summary> private byte[] HandleCommand(Command cmd, GXByteBuffer data, GXDLMSConnectionEventArgs connectionInfo) { byte frame = 0; switch (cmd) { case Command.AccessRequest: GXDLMSLNCommandHandler.HandleAccessRequest(Settings, this, data, replyData, null); break; case Command.SetRequest: GXDLMSLNCommandHandler.HandleSetRequest(Settings, this, data, replyData, null); break; case Command.WriteRequest: GXDLMSSNCommandHandler.HandleWriteRequest(Settings, this, data, replyData, null); break; case Command.GetRequest: if (data.Size != 0) { GXDLMSLNCommandHandler.HandleGetRequest(Settings, this, data, replyData, null); } break; case Command.ReadRequest: GXDLMSSNCommandHandler.HandleReadRequest(Settings, this, data, replyData, null); break; case Command.MethodRequest: GXDLMSLNCommandHandler.HandleMethodRequest(Settings, this, data, connectionInfo, replyData, null); break; case Command.Snrm: HandleSnrmRequest(); frame = (byte)Command.Ua; break; case Command.Aarq: HandleAarqRequest(data, connectionInfo); break; case Command.ReleaseRequest: case Command.DisconnectRequest: GenerateDisconnectRequest(); Settings.Connected = false; Disconnected(connectionInfo); frame = (byte)Command.Ua; break; case Command.None: //Get next frame. break; default: Debug.WriteLine("Invalid command: " + (int)cmd); break; } byte[] reply; if (this.InterfaceType == Enums.InterfaceType.WRAPPER) { reply = GXDLMS.GetWrapperFrame(Settings, replyData); } else { reply = GXDLMS.GetHdlcFrame(Settings, frame, replyData); } return(reply); }