예제 #1
0
 public ShockSensorVirtualDevice(WordSerializator serializator) : base(serializator)
 {
     _calibrationFile           = deserialize(Properties.Resources.V01_RUS05_Cal, FileType.CALIBRATION);
     _factorySettingsFile       = deserialize(Properties.Resources.V01_RUS05_FSet, FileType.FACTORY_SETTINGS);
     _dataPacketFormatFile      = deserialize(Properties.Resources.V01_RUS05_DPConf, FileType.DATA_PACKET_CONFIGURATION);
     _flashDataPacketFormatFile = deserialize(Properties.Resources.V01_RUS05_DPConf, FileType.DATA_PACKET_CONFIGURATION);
 }
예제 #2
0
        public RotationSensorVirtualDevice(WordSerializator serializator) : base(serializator)
        {
            _calibrationFile            = deserialize(Properties.Resources.V01_RUS07_Cal, FileType.CALIBRATION);
            _factorySettingsFile        = deserialize(Properties.Resources.V01_RUS07_FSet, FileType.FACTORY_SETTINGS);
            _dataPacketFormatFile       = generateDataPacketFormatFile();
            _flashDataPacketFormatFile  = generateDataPacketFormatFile();
            _temperatureCalibrationFile = deserialize(Properties.Resources.V01_RUS07_TCal, FileType.TEMPERATURE_CALIBRATION);

            byte[] generateDataPacketFormatFile()
            {
                var body = new Enumerable <byte>()
                {
                    "Bl_Gyro_0101DDMMYYF_".GetASCIIBytes(),
                    serializator.Serialize(_serial),
                    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // Reserve
                };
                var i = new SmartInt().Add(1);

                addEntity("STAT", (ushort)i, (byte)i.Add(2).DValue, 0, false);
                addEntity("SGY1", (ushort)i, (byte)i.Add(2).DValue, 0, true);
                addEntity("SRO1", (ushort)i, (byte)i.Add(2).DValue, 0, true);
                addEntity("ANG1", (ushort)i, (byte)i.Add(2).DValue, 0, false);
                addEntity("TEM1", (ushort)i, (byte)i.Add(2).DValue, 0, true);
                addEntity("SGY2", (ushort)i, (byte)i.Add(2).DValue, 0, true);
                addEntity("SRO2", (ushort)i, (byte)i.Add(2).DValue, 0, true);
                addEntity("ANG2", (ushort)i, (byte)i.Add(2).DValue, 0, false);
                addEntity("TEM2", (ushort)i, (byte)i.Add(2).DValue, 0, true);
                addEntity("ADSG", (ushort)i, (byte)i.Add(2).DValue, 0, false);
                addEntity("ADH1", (ushort)i, (byte)i.Add(2).DValue, 0, false);
                addEntity("ADH2", (ushort)i, (byte)i.Add(2).DValue, 0, false);
                addEntity("ADTM", (ushort)i, (byte)i.Add(2).DValue, 0, true);

                return(body.ToArray());

                void addEntity(string mnemonicName, ushort position, byte length, byte numOfBits, bool isSigned)
                {
                    body.Add(mnemonicName.GetASCIIBytes());
                    body.Add(_serializator.Serialize(position));
                    body.Add(length);
                    body.Add((isSigned ? 1 : 0).ToByte().BitLShift(7).BitOR(numOfBits));
                }
            }
        }
예제 #3
0
 public RUSModule(WordSerializator serializator) : base(serializator)
 {
     _serial   = 100;
     _status32 = 0;
 }