Example #1
0
        public void SendRequest(InformationId informationId)
        {
            switch (informationId)
            {
            case InformationId.SyncReq:
                var syncReq = new FrameTcp(
                    this.MySendCounter,
                    this.OtherSendCounter,
                    this.KeyNumber,
                    informationId,
                    FrameVdS.CreateSyncRequestResponse(InformationId.SyncReq));
                Log.Info("{0} >> {1}", this.Type, syncReq);

                var syncReqbuff = syncReq.Serialize();
                this.stream.Write(syncReqbuff, 0, syncReqbuff.Length);
                this.IncrementMySendCounter();
                break;

            case InformationId.SyncRes:
                break;

            case InformationId.PollReqRes:
                var pollReq = new FrameTcp(
                    this.MySendCounter,
                    this.OtherSendCounter,
                    this.KeyNumber,
                    informationId,
                    FrameVdS.CreateEmpty(InformationId.PollReqRes));
                Log.Info("{0} >> {1}", this.Type, pollReq);

                var polReqBuff = pollReq.Serialize();
                this.stream.Write(polReqBuff, 0, polReqBuff.Length);
                this.IncrementMySendCounter();
                break;

            case InformationId.Payload:
                break;

            case InformationId.ErrorInformationIdUnknown:
                break;

            case InformationId.ErrorProtocolIdUnknown:
                break;

            default:
                throw new ArgumentOutOfRangeException("intInformationId");
            }
        }
Example #2
0
        private void SendResponse(params FrameVdS[] frames)
        {
            var response = new FrameTcp(
                this.MySendCounter,
                this.OtherSendCounter,
                this.KeyNumber,
                frames[0].InformationId,
                frames);

            Log.Info("{0} >> {1}", this.Type, response);

            var buff = response.Serialize();

            this.stream.Write(buff, 0, buff.Length);
            this.IncrementMySendCounter();
        }