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

            if (valueType.Type == TAGDataType.t4bitUInt && value <= 3) // Check only the two least significant bits are set
            {
                valueSink.SetInAvoidZoneState((byte)value);
                result = true;
            }

            return(result);
        }
Beispiel #2
0
        public override bool ProcessUnsignedIntegerValue(TAGValueMatcherState state, TAGProcessorStateBase valueSink,
                                                         TAGDictionaryItem valueType, uint value)
        {
            if (valueType.Type == TAGDataType.t8bitUInt &&
                (value == (byte)ElevationMappingMode.LatestElevation ||
                 value == (byte)ElevationMappingMode.MinimumElevation))
            {
                valueSink.SetElevationMappingModeState((ElevationMappingMode)value);
                return(true);
            }

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

            if (valueType.Type == TAGDataType.t4bitUInt && value <= 2) // Sonic state currently only defines three states
            {
                valueSink.ICSonic3D = (byte)value;
                result = true;;
            }

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

            if (valueType.Type == TAGDataType.t8bitUInt)
            {
                valueSink.SetICCCALeftRearValue((byte)value);
                result = true;
            }

            return(result);
        }
Beispiel #5
0
        public override bool ProcessIntegerValue(TAGValueMatcherState state, TAGProcessorStateBase valueSink,
                                                 TAGDictionaryItem valueType, int value)
        {
            // Position value is integer number of millimeters offset from the current position
            bool result = false;

            if (state.HaveSeenAnAbsoluteRearPosition)
            {
                if (valueType.Name == TAGValueNames.kTagFileEastingRearTag)
                {
                    if (state.RearSide == TAGValueSide.Left)
                    {
                        valueSink.DataRearLeft.X += (double)value / 1000;
                    }
                    else
                    {
                        valueSink.DataRearRight.X += (double)value / 1000;
                    }

                    result = true;
                }
                else if (valueType.Name == TAGValueNames.kTagFileNorthingRearTag)
                {
                    if (state.RearSide == TAGValueSide.Left)
                    {
                        valueSink.DataRearLeft.Y += (double)value / 1000;
                    }
                    else
                    {
                        valueSink.DataRearRight.Y += (double)value / 1000;
                    }

                    result = true;
                }
                else if (valueType.Name == TAGValueNames.kTagFileElevationRearTag)
                {
                    if (state.RearSide == TAGValueSide.Left)
                    {
                        valueSink.DataRearLeft.Z += (double)value / 1000;
                    }
                    else
                    {
                        valueSink.DataRearRight.Z += (double)value / 1000;
                    }

                    result = true;
                }
            }

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

            // Value is the absolute CCV value
            if (valueType.Type == TAGDataType.t16bitUInt)
            {
                valueSink.ICTargetLiftThickness = (float)value / 1000;
                result = true;
            }

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

            // Value is a minimum temperature warning level value...
            if (valueType.Type == TAGDataType.t12bitUInt)
            {
                valueSink.ICTempWarningLevelMinValue = (ushort)(value * CellPassConsts.MaterialTempValueRatio);
                result = true;
            }

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

            // Value is the absolute MDP value
            if (valueType.Type == TAGDataType.t12bitUInt)
            {
                valueSink.ICMDPTargetValue = (short)value;
                result = true;
            }

            return(result);
        }
Beispiel #9
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);
        }
Beispiel #10
0
        public override bool ProcessUnsignedIntegerValue(TAGValueMatcherState state, TAGProcessorStateBase valueSink,
                                                         TAGDictionaryItem valueType, uint value)
        {
            bool result = false;

            if (valueType.Type == TAGDataType.t4bitUInt &&
                (value >= MachineGearConsts.MACHINE_GEAR_MIN_VALUE && value <= MachineGearConsts.MACHINE_GEAR_MAX_VALUE))
            {
                valueSink.ICGear = (MachineGear)value;
                result           = true;
            }

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

            if (valueType.Type == TAGDataType.t4bitUInt &&
                (value >= OnGroundStateConsts.ON_GROUND_STATE_MIN_VALUE && value <= OnGroundStateConsts.ON_GROUND_STATE_MAX_VALUE))
            {
                valueSink.SetOnGround((OnGroundState)value);
                result = true;
            }

            return(result);
        }
Beispiel #12
0
        public void Test_TAGFile_Read_File()
        {
            // Create the TAG file and reader classes
            TAGFile file = new TAGFile();

            // Create the state and sink
            TAGProcessorStateBase stateBase = new TAGProcessorStateBase(); // Derivatives to construct later
            TAGValueSink          sink      = new TAGValueSink(stateBase);

            //Read the TAG file
            TAGReadResult result = file.Read(Path.Combine("TestData", "TAGFiles", "TestTAGFile-TAGFile-Read-File.tag"), sink);

            Assert.Equal(TAGReadResult.NoError, result);
        }
Beispiel #13
0
        public override bool ProcessUnsignedIntegerValue(TAGValueMatcherState state, TAGProcessorStateBase valueSink,
                                                         TAGDictionaryItem valueType, uint value)
        {
            bool result = false;

            if (valueType.Type == TAGDataType.t12bitUInt)
            {
                valueSink.SetVolkelMeasUtilRange((int)value);
                state.HaveSeenAnAbsoluteVolkelMeasUtilRange = true;
                result = true;
            }

            return(result);
        }
Beispiel #14
0
        public override bool ProcessDoubleValue(TAGValueMatcherState state, TAGProcessorStateBase valueSink,
                                                TAGDictionaryItem valueType, double value)
        {
            state.HaveSeenAnAbsoluteTrackPosition = true;

            if (valueType.Name == TAGValueNames.kTagFileEastingTrackTag)
            {
                if (state.TrackSide == TAGValueSide.Left)
                {
                    valueSink.DataTrackLeft.X = value;
                }
                else
                {
                    valueSink.DataTrackRight.X = value;
                }

                return(true);
            }

            if (valueType.Name == TAGValueNames.kTagFileNorthingTrackTag)
            {
                if (state.TrackSide == TAGValueSide.Left)
                {
                    valueSink.DataTrackLeft.Y = value;
                }
                else
                {
                    valueSink.DataTrackRight.Y = value;
                }

                return(true);
            }

            if (valueType.Name == TAGValueNames.kTagFileElevationTrackTag)
            {
                if (state.TrackSide == TAGValueSide.Left)
                {
                    valueSink.DataTrackLeft.Z = value;
                }
                else
                {
                    valueSink.DataTrackRight.Z = value;
                }

                return(true);
            }

            return(false);
        }
Beispiel #15
0
        public override bool ProcessDoubleValue(TAGValueMatcherState state, TAGProcessorStateBase valueSink,
                                                TAGDictionaryItem valueType, double value)
        {
            // Value is absolute wheel width expressed in

            bool result = false;

            if (valueType.Type == TAGDataType.tIEEEDouble)
            {
                valueSink.MachineWheelWidth = value;
                result = true;
            }

            return(result);
        }
Beispiel #16
0
        public void Test_TAGProcessorStateBase_SetAndGetMachineDirection()
        {
            var state = new TAGProcessorStateBase();

            // Note: Machine direction cannot be set after a gear value is selected
            Assert.Equal(MachineDirection.Unknown, state.MachineDirection);

            state.SetMachineDirection(MachineDirection.Forward);
            Assert.Equal(MachineDirection.Forward, state.MachineDirection);

            state.ICGear = MachineGear.Forward;

            state.SetMachineDirection(MachineDirection.Reverse);
            Assert.NotEqual(MachineDirection.Reverse, state.MachineDirection);
        }
Beispiel #17
0
        public override bool ProcessUnsignedIntegerValue(TAGValueMatcherState state, TAGProcessorStateBase valueSink,
                                                         TAGDictionaryItem valueType, uint value)
        {
            state.HaveSeenAnAbsoluteAmplitude = true;

            bool result = false;

            if (valueType.Type == TAGDataType.t12bitUInt)
            {
                valueSink.SetICAmplitude((ushort)value);
                result = true;
            }

            return(result);
        }
Beispiel #18
0
        public override bool ProcessDoubleValue(TAGValueMatcherState state, TAGProcessorStateBase valueSink,
                                                TAGDictionaryItem valueType, double value)
        {
            state.HaveSeenAnAbsoluteRearPosition = true;
            bool result = false;

            if (valueType.Name == TAGValueNames.kTagFileEastingRearTag)
            {
                if (state.RearSide == TAGValueSide.Left)
                {
                    valueSink.DataRearLeft.X = value;
                }
                else
                {
                    valueSink.DataRearRight.X = value;
                }

                result = true;
            }
            else if (valueType.Name == TAGValueNames.kTagFileNorthingRearTag)
            {
                if (state.RearSide == TAGValueSide.Left)
                {
                    valueSink.DataRearLeft.Y = value;
                }
                else
                {
                    valueSink.DataRearRight.Y = value;
                }

                result = true;
            }
            else if (valueType.Name == TAGValueNames.kTagFileElevationRearTag)
            {
                if (state.RearSide == TAGValueSide.Left)
                {
                    valueSink.DataRearLeft.Z = value;
                }
                else
                {
                    valueSink.DataRearRight.Z = value;
                }

                result = true;
            }

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

            var testValue = value - 1; // Direction value in tag file is 1-based

            if (valueType.Type == TAGDataType.t4bitUInt &&
                (testValue >= MachineDirectionConsts.MACHINE_DIRECTION_MIN_VALUE && testValue <= MachineDirectionConsts.MACHINE_DIRECTION_MAX_VALUE))
            {
                valueSink.MachineDirection = (MachineDirection)testValue;
                result = true;
            }

            return(result);
        }
Beispiel #20
0
        public override bool ProcessDoubleValue(TAGValueMatcherState state, TAGProcessorStateBase valueSink,
                                                TAGDictionaryItem valueType, double value)
        {
            if (state.GPSBasePositionReportingHaveStarted)
            {
                valueSink.GPSBaseLon = value;
                state.GPSBasePositionReportingHaveStarted = !valueSink.GPSBaseLLHReceived;
            }
            else
            {
                valueSink.LLHLon            = value;
                state.HaveSeenAnLLHPosition = valueSink.LLHReceived;
            }

            return(true);
        }
Beispiel #21
0
        public override bool ProcessEmptyValue(TAGValueMatcherState state, TAGProcessorStateBase valueSink,
                                               TAGDictionaryItem valueType)
        {
            state.HaveSeenAnAbsoluteTrackPosition = false;

            if (state.TrackSide == TAGValueSide.Left)
            {
                valueSink.DataTrackLeft = XYZ.Null;
            }
            else
            {
                valueSink.DataTrackRight = XYZ.Null;
            }

            return(true);
        }
Beispiel #22
0
        public void Test_TAGProcessorStateBase_HaveReceivedValidRearPositions()
        {
            var state = new TAGProcessorStateBase();

            Assert.False(state.HaveReceivedValidRearPositions, "Initial value incorrect");

            state.DataRearLeft    = new XYZ(10.0, 10.0, 10.0);
            state.DataRearRight.X = 10.0;
            state.DataRearRight.Y = 10.0;

            Assert.False(state.HaveReceivedValidRearPositions, "Value incorrect after setting");

            state.DataRearRight.Z = 10.0;

            Assert.True(state.HaveReceivedValidRearPositions, "Value incorrect after setting");
        }
Beispiel #23
0
        public override bool ProcessIntegerValue(TAGValueMatcherState state, TAGProcessorStateBase valueSink,
                                                 TAGDictionaryItem valueType, int value)
        {
            bool result = false;

            if (state.HaveSeenAnAbsoluteAmplitude &&
                (valueType.Type == TAGDataType.t4bitInt || valueType.Type == TAGDataType.t8bitInt))
            {
                if (((ushort)(valueSink.ICAmplitudes.GetLatest()) + value) >= 0)
                {
                    valueSink.SetICAmplitude((ushort)((ushort)(valueSink.ICAmplitudes.GetLatest()) + value));
                    result = true;
                }
            }

            return(result);
        }
Beispiel #24
0
        public override bool ProcessIntegerValue(TAGValueMatcherState state, TAGProcessorStateBase valueSink,
                                                 TAGDictionaryItem valueType, int value)
        {
            bool result = false;

            if (state.HaveSeenAnAbsoluteVolkelMeasUtilRange &&
                (valueType.Type == TAGDataType.t4bitInt || valueType.Type == TAGDataType.t8bitInt))
            {
                if (((int)valueSink.VolkelMeasureUtilRanges.GetLatest() + value) >= 0)
                {
                    valueSink.SetVolkelMeasUtilRange((int)valueSink.VolkelMeasureUtilRanges.GetLatest() + value);
                    result = true;
                }
            }

            return(result);
        }
Beispiel #25
0
        public override bool ProcessEmptyValue(TAGValueMatcherState state, TAGProcessorStateBase valueSink,
                                               TAGDictionaryItem valueType)
        {
            bool result = false;

            if (valueType.Name == TAGValueNames.kTagFileLeftRearTag)
            {
                state.RearSide = TAGValueSide.Left;
                result         = true;
            }
            else if (valueType.Name == TAGValueNames.kTagFileRightRearTag)
            {
                state.RearSide = TAGValueSide.Right;
                result         = true;
            }

            return(result);
        }
Beispiel #26
0
        public void Test_TAGFile_Read_Stream()
        {
            // Create the TAG file and reader classes
            TAGFile file = new TAGFile();

            using (var reader = new TAGReader(new FileStream(
                                                  Path.Combine("TestData", "TAGFiles", "TestTAGFile-TAGFile-Read-Stream.tag"), FileMode.Open,
                                                  FileAccess.Read)))
            {
                // Create the state and sink
                TAGProcessorStateBase stateBase = new TAGProcessorStateBase(); // Derivatives to construct later
                TAGValueSink          sink      = new TAGValueSink(stateBase);

                //Read the TAG file
                TAGReadResult result = file.Read(reader, sink);

                Assert.Equal(TAGReadResult.NoError, result);
            }
        }
Beispiel #27
0
        public override bool ProcessUnsignedIntegerValue(TAGValueMatcherState state, TAGProcessorStateBase valueSink,
                                                         TAGDictionaryItem valueType, uint value)
        {
            bool result = false;

            if (valueType.Type == TAGDataType.t4bitUInt &&
                (value >= CoordinateSystemTypeConsts.COORDINATE_SYSTEM_MIN_VALUE && value <= CoordinateSystemTypeConsts.COORDINATE_SYSTEM_MAX_VALUE))
            {
                valueSink.CSType = (CoordinateSystemType)value;

                if (valueSink.CSType == CoordinateSystemType.ACS)
                {
                    valueSink.IsCSIBCoordSystemTypeOnly = false;
                }

                result = true;
            }

            return(result);
        }
Beispiel #28
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);
        }
Beispiel #29
0
        public override bool ProcessUnsignedIntegerValue(TAGValueMatcherState state, TAGProcessorStateBase valueSink,
                                                         TAGDictionaryItem valueType, uint value)
        {
            bool result = false;

            if (valueType.Type == TAGDataType.t8bitUInt)
            {
                valueSink.UTMZone = (byte)value;

                if (!state.HaveSeenAUTMZone)
                {
                    valueSink.UTMZoneAtFirstPosition = (byte)value;

                    state.HaveSeenAUTMZone = true;
                }

                result = true;
            }

            return(result);
        }
Beispiel #30
0
        public override bool ProcessUnsignedIntegerValue(TAGValueMatcherState state, TAGProcessorStateBase valueSink,
                                                         TAGDictionaryItem valueType, uint value)
        {
            bool result = valueType.Type == TAGDataType.t16bitUInt;

            if (result)
            {
                GPSAccuracy Accuracy;

                // Shift bits right so that we can check the top 2 bits
                ushort WordToCheck = (ushort)(value >> 14); //16-bit UINT

                switch (WordToCheck)
                {
                case 0:
                    Accuracy = GPSAccuracy.Fine;
                    break;

                case 1:
                    Accuracy = GPSAccuracy.Medium;
                    break;

                case 2:
                    Accuracy = GPSAccuracy.Coarse;
                    break;

                default:
                    Accuracy = GPSAccuracy.Unknown;
                    break;
                }

                // Lose the top 2 bits; what remains is the error limit in mm
                ushort ErrorLimit = (ushort)(value & 0x3fff);

                valueSink.SetGPSAccuracyState(Accuracy, ErrorLimit);
            }

            return(result);
        }