| 123456789101112131415161718192021222324252627 |
- using System;
- using System.Collections.Generic;
- using System.Linq;
- namespace PressureGage_3051.MessageEntity.Outgoing
- {
- public class PresetSingleRegister_Request : MessageBase
- {
- private Dictionary<string, byte> unitMapper = new Dictionary<string, byte>();
- /// <summary>
- ///
- /// </summary>
- public PresetSingleRegister_Request(byte deviceAddress, short dataAddress, string writeValue)
- {
- unitMapper["Pa"] = 11;
- unitMapper["KPa"] = 12;
- unitMapper["MPa"] = 237;
- base.Address = deviceAddress;
- base.FunctionCode = FunctionCode.PRESET_SINGLE_REGISTER;
- base.RawDataField = new List<byte>();
- base.RawDataField.AddRange(BitConverter.GetBytes(dataAddress).Reverse());
- base.RawDataField.AddRange(new byte[] { 0, unitMapper[writeValue] });
- }
- }
- }
|