public GatePassageEventArgs([NotNull] WirelessNetworkAddress source, [CanBeNull] TimeSpan? sensorTime,
     GatePassage gatePassage)
     : base(source, sensorTime)
 {
     GatePassage = gatePassage;
 }
        public void HandleGatePassed([CanBeNull] TimeSpan? sensorTime, GatePassage passageGate,
            [NotNull] WirelessNetworkAddress source)
        {
            string timeText = sensorTime != null ? "with time " + sensorTime : "without time";
            Log.Debug($"Entering HandleGatePassed for {passageGate} {timeText}.");

            // Devices without capability TimeSensor are considered low-precision, but hardware time is used.
            bool useSensorTime = synchronizationMonitor.IsDeviceSynchronized(source);
            TimeAccuracy? accuracy = DeviceHasTimeSensorCapability(source)
                ? (TimeAccuracy?) null
                : TimeAccuracy.LowPrecision;
            var passageTime = new RecordedTime(useSensorTime ? sensorTime : null, SystemContext.UtcNow(), accuracy);

            Log.Debug($"Evaluated sensor time: {passageTime}");

            switch (passageGate)
            {
                case GatePassage.PassStartFinish:
                    HandlePassStartOrFinishWhenSingleSensor(passageTime);
                    break;
                case GatePassage.PassStart:
                    HandlePassStart(passageTime);
                    break;
                case GatePassage.PassIntermediate1:
                    HandlePassIntermediate1(passageTime);
                    break;
                case GatePassage.PassIntermediate2:
                    HandlePassIntermediate2(passageTime);
                    break;
                case GatePassage.PassIntermediate3:
                    HandlePassIntermediate3(passageTime);
                    break;
                case GatePassage.PassFinish:
                    HandlePassFinish(passageTime);
                    break;
                default:
                    throw ExceptionFactory.CreateNotSupportedExceptionFor(passageGate);
            }
        }
예제 #3
0
 public GatePassageEventArgs(WirelessNetworkAddress source, TimeSpan?sensorTime, GatePassage gatePassage)
     : base(source, sensorTime)
 {
     GatePassage = gatePassage;
 }