using System; using System.Collections.Generic; using System.Text; namespace TATSUNO_Pump.Messages { /// /// sample: [04][40][51][05] /// public class PollingOrSelectingRequest : MessageBase { public enum RequestTypeEnum { Polling = 1, Selecting = 0 } public enum DeviceKindEnum { Interface = 0x00, GasPumpOrLpgDispenser = 0x01, LevelMeter = 0x04, CarWasher = 0x06, LargSizedDisplay = 0x07, AutoChanger = 0x08, OilChanger = 0x09 } /// /// /// /// actual the device address which configed in device side, range from 40H~7FH /// /// public PollingOrSelectingRequest(byte stationAddress, RequestTypeEnum requestType, DeviceKindEnum deviceKind) { if (stationAddress < 0x40 || stationAddress > 0x7F) throw new ArgumentException("stationAddress must in range of 40H~7FH"); base.DataRaw = new List(); base.DataRaw.AddRange(new byte[] { 0x04, stationAddress, (byte)(((1 + (byte)requestType)<<4) +(byte)deviceKind), 0x05 }); } } }