예제 #1
0
        public override bool ProcessUnsignedIntegerValue(TAGValueMatcherState state, TAGProcessorStateBase valueSink,
                                                         TAGDictionaryItem valueType, uint value)
        {
            bool result = false;

            if (valueType.Name == TAGValueNames.kTagFileTimeTag)
            {
                // Every time record marks the end of the collected data for an epoch
                // Thus, we instruct the value sink to process its context whenever we receive
                // a time value.
                if (state.HaveSeenATimeValue)
                {
                    valueSink.ProcessEpochContext();
                }

                switch (valueType.Type)
                {
                case TAGDataType.t32bitUInt:
                    // {$IFDEF DENSE_TAG_FILE_LOGGING}
                    // SIGLogProcessMessage.Publish(Self, Format('Time Origin Update: Incremented Time: %d, new Origin: %d, Delta: %d', { SKIP}
                    //                                           [FValueSink.GPSWeekTime, Value, Value - FValueSink.GPSWeekTime]), slpmcMessage);
                    // {$ENDIF}

                    valueSink.GPSWeekTime    = value;                     // Time value is GPS milliseconds since start of week
                    state.HaveSeenATimeValue = true;
                    result = true;
                    break;

                case TAGDataType.t4bitUInt:
                    valueSink.GPSWeekTime    = valueSink.GPSWeekTime + 100 * value;  // Time value is tenths of seconds delta from previous time
                    state.HaveSeenATimeValue = true;
                    result = true;
                    break;
                }
            }
            else if (valueType.Name == TAGValueNames.kTagFileWeekTag)
            {
                if (valueType.Type == TAGDataType.t16bitUInt)
                {
                    valueSink.GPSWeekNumber  = (short)value;
                    state.HaveSeenAWeekValue = true;
                    result = true;
                }
            }

            // if we have seen both a GPS week and time then we can compute the DataTime
            // value for the value sink
            if (state.HaveSeenATimeValue && state.HaveSeenAWeekValue)
            {
                valueSink.DataTime = GPS.GPSOriginTimeToDateTime(valueSink.GPSWeekNumber, valueSink.GPSWeekTime);
            }

            return(result);
        }
예제 #2
0
        public override bool ProcessEmptyValue(TAGValueMatcherState state, TAGProcessorStateBase valueSink,
                                               TAGDictionaryItem valueType)
        {
            if (!state.ProofingRunProcessed)
            {
                state.ProofingRunProcessed = valueSink.ProcessEpochContext();
            }

            valueSink.StartProofing = "";

            SetProofingRunStartTime(state, valueSink);

            return(true);
        }
예제 #3
0
        public override bool ProcessUnsignedIntegerValue(TAGValueMatcherState state, TAGProcessorStateBase valueSink,
                                                         TAGDictionaryItem valueType, uint value)
        {
            bool result = false;

            if (valueType.Name == TAGValueNames.kTagFileStartProofingTimeTag)
            {
                // Every time record marks the end of the collected data for an epoch
                // Thus, we instruct the value sink to process its context whenever we receive a time value.
                if (state.HaveSeenAProofingRunTimeValue && !valueSink.ProcessEpochContext())
                {
                    return(false);
                }

                if (valueType.Type == TAGDataType.t32bitUInt)
                {
                    valueSink.StartProofingTime         = value; // Time value is GPS milliseconds since start of week
                    state.HaveSeenAProofingRunTimeValue = true;
                    result = true;
                }
            }

            if (valueType.Name == TAGValueNames.kTagFileStartProofingWeekTag)
            {
                if (valueType.Type == TAGDataType.t16bitUInt)
                {
                    valueSink.StartProofingWeek         = (short)value;
                    state.HaveSeenAProofingRunWeekValue = true;
                    result = true;
                }
            }

            // if we have seen both a GPS week and time then we can compute the DataTime
            // value for the value sink
            if (result && state.HaveSeenAProofingRunTimeValue && state.HaveSeenAProofingRunWeekValue)
            {
                valueSink.StartProofingDataTime = GPS.GPSOriginTimeToDateTime(valueSink.StartProofingWeek, valueSink.StartProofingTime);
            }

            return(result);
        }
예제 #4
0
 public override bool Finishing()
 {
     //Check if we need to process a final context
     return(!ValueMatcherState.HaveSeenATimeValue || Processor.ProcessEpochContext());
 }
예제 #5
0
        public void Test_TAGProcessorStateBase_ProcessEpochContext()
        {
            var state = new TAGProcessorStateBase();

            Assert.True(state.ProcessEpochContext(), "Base function failed - it is not supposed to be implemented!");
        }