Пример #1
0
 /// <summary>
 /// Communication callback function
 /// </summary>
 /// <param name="cmd"></param>
 public void CommCallbackCaller(CommEvent cmd)
 {
     if (CommEvents != null)
     {
         CommEvents(this, cmd);
     }
 }
Пример #2
0
 public void CommEventCallback(object sender, CommEvent cmd)
 {
     if (cmd == CommEvent.CommOpen)
     {
         HWID = GetHWID(Comm.GetCommStatus());
     }
 }
Пример #3
0
        public void CommCallbackCaller(object o, CommEvent cmd)
        {
            CommEventHandler commEvents = CommEvents;

            if (commEvents != null)
            {
                commEvents(this, cmd);
            }
        }
Пример #4
0
        public void CommEventCallbackCaller(CommEvent cmd)
        {
            Encoding         encoding   = Encoding.GetEncoding("Windows-1252");
            CommEventHandler commEvents = CommEvents;

            if (commEvents != null)
            {
                commEvents(this, cmd);
            }
        }
Пример #5
0
 public void CommCallback(object sender, CommEvent cmd)
 {
     if (cmd == CommEvent.CommOpen)
     {
         IsCommEnabled = true;
     }
     else if (cmd == CommEvent.CommLost)
     {
         IsCommEnabled = false;
     }
     CommEventCallbackCaller(cmd);
 }
Пример #6
0
        static EventBase GetFakeEvent()
        {
            var selector = Faker.NumberFaker.Number(0, 5);

            switch (selector)
            {
            case 0:
                var e = new DoorEvent
                {
                    Eventno   = count++,
                    EventType = DoorEventEventType.DoorEvent,
                    Doors     = new DoorsSchema
                    {
                        Event = count++,
                        Left  = new Doorpos
                        {
                            Count = Faker.NumberFaker.Number(0, 65000),
                            Open  = Faker.BooleanFaker.Boolean()
                        },
                        Right = new Doorpos
                        {
                            Count = Faker.NumberFaker.Number(0, 65000),
                            Open  = Faker.BooleanFaker.Boolean()
                        }
                    }
                };
                return(e);

            case 1:
                var le = new LightEvent
                {
                    Eventno   = count++,
                    EventType = LightEventEventType.LightEvent,
                    Lights    = new LightsSchema
                    {
                        Event     = Faker.NumberFaker.Number(0, 11),
                        Frontpass = Faker.BooleanFaker.Boolean(),
                        Rearpass  = Faker.BooleanFaker.Boolean(),
                        Left      = new Lightpos
                        {
                            Count = Faker.NumberFaker.Number(0, 65000),
                            Lit   = Faker.BooleanFaker.Boolean()
                        },
                        Right = new Lightpos
                        {
                            Count = Faker.NumberFaker.Number(0, 65000),
                            Lit   = Faker.BooleanFaker.Boolean()
                        },
                        Rear = new Lightpos
                        {
                            Count = Faker.NumberFaker.Number(0, 65000),
                            Lit   = Faker.BooleanFaker.Boolean()
                        }
                    }
                };
                return(le);

            case 2:
                var re = new RelocatedEvent
                {
                    EventType = RelocatedEventEventType.RelocatedEvent,
                    Location  = GetFakeLocation()
                };
                return(re);

            case 3:
                var pe = new PowerEvent
                {
                    EventType = PowerEventEventType.PowerEvent,
                    Msg       = Faker.TextFaker.Sentence()
                };
                return(pe);

            case 4:
                var ce = new CommEvent
                {
                    EventType = CommEventEventType.CommEventSuccess,
                    Conncount = count++,
                    Humidity  = Faker.NumberFaker.Number(0, 100),
                    Tempf     = Faker.NumberFaker.Number(0, 100),
                    Msgnum    = count,
                    Msg       = Faker.TextFaker.Sentence()
                };
                return(ce);

            case 5:
                var cee = new CommEvent
                {
                    EventType = CommEventEventType.CommEventError,
                    Conncount = count++,
                    Humidity  = Faker.NumberFaker.Number(0, 100),
                    Tempf     = Faker.NumberFaker.Number(0, 100),
                    Msgnum    = count,
                    Msg       = Faker.TextFaker.Sentence()
                };
                return(cee);

            default:
                return(null);
            }
        }
Пример #7
0
 private void CommCallback(object o, CommEvent cmd)
 {
 }
Пример #8
0
 public void CommCallback(object sender, CommEvent cmd)
 {
     CommCallbackCaller(this, cmd);
 }