HandleReadRequest() 공개 정적인 메소드

Handle read request.
public static HandleReadRequest ( GXDLMSSettings settings, GXDLMSServer server, GXByteBuffer data, GXByteBuffer replyData, GXDLMSTranslatorStructure xml ) : void
settings GXDLMSSettings DLMS settings.
server GXDLMSServer DLMS server.
data GXByteBuffer Received data.
replyData GXByteBuffer
xml GXDLMSTranslatorStructure
리턴 void
예제 #1
0
        ///<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);
        }