Example #1
0
        private static RobConstants ReadRobConstants(AstFile astFile)
        {
            var astConstants = astFile.ReadAsAstDescriptionBlock("PROCONST2");
            var variables    = astConstants.Variables;

            var robConstants = new RobConstants()
            {
                Header = new RobConstantsHeader()
                {
                    Reserved0             = astConstants.Headers.ReadAsInt(0),
                    RamBlockAddressOffset = astConstants.Headers.ReadAsInt(1),
                },
                Parameters = ReadRobParameters(variables),
            };

            return(robConstants);
        }
Example #2
0
        private static RobDeviceParams ReadRobDeviceParams(AstFile astFile, RobControlUnitType controlUnitType)
        {
            var astDeviceParams = astFile.ReadAsAstDescriptionBlock("DEVPARAM");

            RobDeviceParams robDeviceParams;
            var             headers = astDeviceParams.Headers;

            if (controlUnitType.HasFlag(RobControlUnitType.CAN))
            {
                // DEVPARAM layout seems to depend on the control unit type
                robDeviceParams = new RobCanDeviceParams()
                {
                    BaseAddressBinaryImage     = headers.ReadAsUInt(0),
                    BaseAddressMeasurementData = headers.ReadAsUInt(1),
                    CanCcpIdentifierDto        = headers.ReadAsInt(2),
                    CanCcpIdentifierCro        = headers.ReadAsInt(3),
                    AnalogOutput1Control       = headers.ReadAsInt(4),
                    AnalogOutput2Control       = headers.ReadAsInt(5),
                    AnalogOutput3Control       = headers.ReadAsInt(6),
                    AnalogOutput4Control       = headers.ReadAsInt(7),
                };
            }
            else if (controlUnitType.HasFlag(RobControlUnitType.ABUS))
            {
                throw new ParserContextErrorException(
                          "DEVPARAM not implemented for ABUS, need an example file to implement more.", astDeviceParams);
            }
            else
            {
                // ROM
                robDeviceParams = new RobRomDeviceParams()
                {
                    OffsetRomImage       = headers.ReadAsSeq(0).ReadAsInt(0),
                    OffsetProvariAddress = headers.ReadAsSeq(0).ReadAsInt(1),
                };
            }
            return(robDeviceParams);
        }