Ejemplo n.º 1
0
        public MvaWacohForceLdd()
        {
            this.netNonStopTcpClient.EhDataReceive += (sender, e) =>
            {
                var ee = e as CtkNonStopTcpStateEventArgs;
                var msg = ee.TrxMessageBuffer;
                this.messageReceiver.Receive(msg.Buffer, msg.Offset, msg.Length);
                this.messageReceiver.AnalysisMessage();

                if (this.messageReceiver.Count == 0) return;

                var vec = this.messageReceiver.Dequeue();
                if (this.correctionFlag)
                {
                    this.centerForceVector = vec;
                    lock (this)
                        correctionFlag = false;
                }

                var ea = new MvaWacohForceMessageEventArgs();
                ea.centerForceVector = this.centerForceVector;
                ea.rawForceVector = vec;
                this.OnDataReceive(ea);
            };


            this.netNonStopTcpClient.EhDisconnect += (sender, e) =>
            {
                this.connectionStatus = MvaWacohForceEnumConnectionStatus.Disconnection;
            };
            this.netNonStopTcpClient.EhFirstConnect += (sender, e) =>
            {
                this.connectionStatus = MvaWacohForceEnumConnectionStatus.Connected;
            };

        }
Ejemplo n.º 2
0
 void OnDataReceive(MvaWacohForceMessageEventArgs ea)
 {
     if (this.evtDataReceive == null) return;
     this.evtDataReceive(this, ea);
 }