void FireAllEvents(string Token, DoorState state) { EventServer.DoorModeEvent(this, "Initialized", Token, state.DoorMode); EventServer.DoorMonitorEvent(this, "Initialized", Token, state.DoorMonitor); EventServer.DoorDoubleLockMonitorEvent(this, "Initialized", Token, state.DoorDoubleLockMonitor); EventServer.DoorLockMonitorEvent(this, "Initialized", Token, state.DoorLockMonitor); EventServer.DoorAlarmMonitorEvent(this, "Initialized", Token, state.DoorAlarm); EventServer.DoorTamperMonitorEvent(this, "Initialized", Token, state.DoorTamper); }
void FireAllEvents(string Token, DoorState state) { EventServer.DoorModeEvent(this, "Initialized", Token, state.DoorMode); EventServer.DoorPhysicalStateEvent(this, "Initialized", Token, state.DoorPhysicalState); EventServer.DoubleLockPhysicalStateEvent(this, "Initialized", Token, state.DoubleLockPhysicalState); EventServer.LockPhysicalStateEvent(this, "Initialized", Token, state.LockPhysicalState); EventServer.DoorAlarmMonitorEvent(this, "Initialized", Token, state.Alarm); if (state.Tamper != null) { EventServer.DoorTamperMonitorEvent(this, "Initialized", Token, state.Tamper.State); } }
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); }
public void SignalReceived(string deviceToken, string deviceType, string sensor, string value) { ConfStorageLoad(); LoggingService.LogMessage(string.Format("Signal received: token={0}, deviceType={1} sensor={2}, value={3}", deviceToken, deviceType, sensor, value), ExternalLogging.MessageType.Details); if (deviceType == "Door") { DoorState doorState = null; if (ConfStorage.DoorStateList.ContainsKey(deviceToken)) { doorState = ConfStorage.DoorStateList[deviceToken]; } switch (sensor) { case "Alarm": { DoorAlarmState state = (DoorAlarmState)Enum.Parse(typeof(DoorAlarmState), value); if (doorState != null) { doorState.Alarm = state; EventServer.DoorAlarmMonitorEvent(null, "Changed", deviceToken, state); } } break; case "LockPhysicalState": { LockPhysicalState state = (LockPhysicalState)Enum.Parse(typeof(LockPhysicalState), value); if (doorState != null) { doorState.LockPhysicalState = state; EventServer.LockPhysicalStateEvent(null, "Changed", deviceToken, state); } } break; case "DoubleLockPhysicalState": { LockPhysicalState state = (LockPhysicalState)Enum.Parse(typeof(LockPhysicalState), value); if (doorState != null) { doorState.DoubleLockPhysicalState = state; EventServer.DoubleLockPhysicalStateEvent(null, "Changed", deviceToken, state); } } break; case "DoorPhysicalState": { DoorPhysicalState state = (DoorPhysicalState)Enum.Parse(typeof(DoorPhysicalState), value); if (doorState != null) { doorState.DoorPhysicalState = state; EventServer.DoorPhysicalStateEvent(null, "Changed", deviceToken, state); } } break; case "Tamper": { DoorTamperState state = (DoorTamperState)Enum.Parse(typeof(DoorTamperState), value); if ((doorState != null) && (doorState.Tamper != null)) { doorState.Tamper.State = state; EventServer.DoorTamperMonitorEvent(null, "Changed", deviceToken, state); } } break; case "Fault": { DoorFaultState state = (DoorFaultState)Enum.Parse(typeof(DoorFaultState), value); if ((doorState != null) && (doorState.Fault != null)) { doorState.Fault.State = state; EventServer.DoorFaultEvent(null, "Changed", deviceToken, state); } } break; } StateReporter.ReportStateUpdate(deviceToken, doorState); } if (deviceType == "Credential") { CredentialState credentialState = null; if (ConfStorage.CredentialStateList.ContainsKey(deviceToken)) { credentialState = ConfStorage.CredentialStateList[deviceToken]; } switch (sensor) { case "AntipassbackViolated": { bool state = (value == "True"); if (credentialState != null) { credentialState.AntipassbackState.AntipassbackViolated = state; //TODO: event } } break; } } }