Exemplo n.º 1
0
        private void createConsumers()
        {
            consumer = new EventingBasicConsumer(channel);

            consumer.Received += (model, ea) =>
            {
                var body       = ea.Body;
                var message    = Encoding.UTF8.GetString(body);
                var routingKey = ea.RoutingKey;

                FrameSerialization serialization = Communication.createSerialization();
                AnsCmd             ans;
                CommunicationFrame frame = new FrameAMQP();
                frame.Data = message + ":";
                frame.Data = frame.Data + frame.checkSum().ToString("X2");

                if (serialization.decode(out ans, frame))
                {
                    acceptAnswer?.Invoke(ans);
                }
            };
        }
Exemplo n.º 2
0
        void verifyFrame()
        {
            try
            {
                FrameSerialization serialization = Communication.createSerialization();

                AnsCmd ans;

                serialization.decode(out ans, rxFrame);

                if (ans != null)
                {
                    acceptAnswer?.Invoke(ans);

                    setStatusRx(StatusRx.RX_FRAME_OK);
                }
            }
            catch (Exception e)
            {
                Debug.WriteLine(e);
            }

            setStatusRx(StatusRx.RX_FRAME_BEGIN);
        }