public void SynchronizationPoint()
        {
            ConfStorageLoad();
            EventServerLoad();

            foreach (string Token in ConfStorage.DoorStateList.Keys)
            {
                DoorState state = ConfStorage.DoorStateList[Token];
                DoorInfo  door  = ConfStorage.DoorInfoList[Token];
                FireAllEvents(door, state);
            }

            EventServerSave();
            ConfStorageSave();
        }
        void FireAllEvents(DoorInfo door, DoorState state)
        {
            var capabilities = door.Capabilities;

            EventServer.DoorModeEvent(this, "Initialized", door.token, state.DoorMode);

            if (capabilities.DoorMonitorSpecified && capabilities.DoorMonitor)
            {
                EventServer.DoorPhysicalStateEvent(this, "Initialized", door.token, state.DoorPhysicalState);
            }

            if (capabilities.LockMonitorSpecified && capabilities.LockMonitor)
            {
                EventServer.LockPhysicalStateEvent(this, "Initialized", door.token, state.LockPhysicalState);
            }

            if (capabilities.DoubleLockMonitorSpecified && capabilities.DoubleLockMonitor)
            {
                EventServer.DoubleLockPhysicalStateEvent(this, "Initialized", door.token, state.DoubleLockPhysicalState);
            }

            if (capabilities.AlarmSpecified && capabilities.Alarm)
            {
                EventServer.DoorAlarmMonitorEvent(this, "Initialized", door.token, state.Alarm);
            }

            if (capabilities.TamperSpecified && capabilities.Tamper)
            {
                if (state.Tamper != null)
                {
                    EventServer.DoorTamperMonitorEvent(this, "Initialized", door.token, state.Tamper.State);
                }
            }

            if (capabilities.FaultSpecified && capabilities.Fault)
            {
                if (state.Fault != null)
                {
                    EventServer.DoorFaultEvent(this, "Initialized", door.token, state.Fault.State);
                }
            }

            //if (capabilities.FaultSpecified && capabilities.Fault)
            //    EventServer.DoorFaultMonitorEvent(this, "Initialized", door.token, state.Fault);
        }
示例#3
0
        //private Dictionary<string, CredentialInformation> CredentialInfoListInitialization()
        //{
        //    Dictionary<string, CredentialInformation> res = new Dictionary<string, CredentialInformation>();

        //    CredentialInformation item;

        //    item = new CredentialInformation();
        //    item.CredentialToken = "tokenCredential1";
        //    item.CredentialHolderName = "holderNameCredential1";

        //    res.Add(item.CredentialToken, item);

        //    item = new CredentialInformation();
        //    item.CredentialToken = "tokenCredential2";
        //    item.CredentialHolderName = "holderNameCredential2";

        //    res.Add(item.CredentialToken, item);

        //    return res;
        //}

        private Dictionary <string, ServiceDoorControl10.DoorInfo> DoorInfoDefaultInitialization()
        {
            Dictionary <string, ServiceDoorControl10.DoorInfo> res = new Dictionary <string, ServiceDoorControl10.DoorInfo>();

            ServiceDoorControl10.DoorInfo item;

            item                                            = new ServiceDoorControl10.DoorInfo();
            item.token                                      = "tokenDoor1";
            item.Name                                       = "Door1 Name";
            item.Description                                = "Door1 Description";
            item.Capabilities                               = new DoorCapabilities();
            item.Capabilities.Access                        = true;
            item.Capabilities.AccessSpecified               = true;
            item.Capabilities.AccessTimingOverride          = true;
            item.Capabilities.AccessTimingOverrideSpecified = true;
            item.Capabilities.Alarm                         = true;
            item.Capabilities.AlarmSpecified                = true;
            item.Capabilities.Block                         = true;
            item.Capabilities.BlockSpecified                = true;
            item.Capabilities.DoorMonitor                   = true;
            item.Capabilities.DoorMonitorSpecified          = true;
            item.Capabilities.DoubleLock                    = true;
            item.Capabilities.DoubleLockSpecified           = true;
            item.Capabilities.DoubleLockMonitor             = true;
            item.Capabilities.DoubleLockMonitorSpecified    = true;
            item.Capabilities.Lock                          = true;
            item.Capabilities.LockSpecified                 = true;
            item.Capabilities.LockDown                      = true;
            item.Capabilities.LockDownSpecified             = true;
            item.Capabilities.LockMonitor                   = true;
            item.Capabilities.LockMonitorSpecified          = true;
            item.Capabilities.LockOpen                      = true;
            item.Capabilities.LockOpenSpecified             = true;
            item.Capabilities.Tamper                        = true;
            item.Capabilities.TamperSpecified               = true;
            item.Capabilities.Unlock                        = true;
            item.Capabilities.UnlockSpecified               = true;
            item.Capabilities.Fault                         = true;
            item.Capabilities.FaultSpecified                = true;

            res.Add(item.token, item);

            item                                            = new ServiceDoorControl10.DoorInfo();
            item.token                                      = "tokenDoor2";
            item.Name                                       = "Door2 Name";
            item.Description                                = "Door2 Description";
            item.Capabilities                               = new DoorCapabilities();
            item.Capabilities.Access                        = false;
            item.Capabilities.AccessSpecified               = true;
            item.Capabilities.AccessTimingOverride          = false;
            item.Capabilities.AccessTimingOverrideSpecified = false;
            item.Capabilities.Alarm                         = false;
            item.Capabilities.Block                         = false;
            item.Capabilities.DoorMonitor                   = false;
            item.Capabilities.DoubleLock                    = false;
            item.Capabilities.DoubleLockMonitor             = false;
            item.Capabilities.Lock                          = false;
            item.Capabilities.LockDown                      = false;
            item.Capabilities.LockMonitor                   = false;
            item.Capabilities.LockOpen                      = false;
            item.Capabilities.Tamper                        = false;
            item.Capabilities.Unlock                        = false;

            res.Add(item.token, item);

            return(res);
        }