using System; using System.Collections.Generic; using System.Text; using DTS.Common.Enums.DASFactory; using DTS.Common.ICommunication; namespace DTS.DASLib.Command.SLICEDB { public abstract class GPIOCommands : CommandBase { public enum SDBInputRegister { On3V = (1 << 0), Charged3V = (1 << 1), Start3V = (1 << 2), RecordStatus3V = (1 << 3), OMAPPowerGood = (1 << 4), } public enum ZeroRegister { On = (1 << 0), Enable5V = (1 << 1), nEnableBattery = (1 << 2), RecordStatus = (1 << 3), OMAPPowerGood = (1 << 4), EnableOneWire = (1 << 5), EnableBatteryCharge = (1 << 6), SliceRun = (1 << 7), } public enum OneRegister { GreenLED = (1 << 0), BlueLED = (1 << 1), RedLED = (1 << 2), } public enum DirectionRegister { On3V = (1 << 0), Charged3V = (1 << 1), Start3V = (1 << 2), RecordStatus3V = (1 << 3), OMAPPowerGood = (1 << 4), } protected enum Commands { Reserved = 0x00, ReadInputRegister = 0x01, WriteSet0Register = 0x02, WriteClear0Register = 0x03, WriteToggle0Register = 0x04, ReadDat0Register = 0x05, WriteDat0Register = 0x06, WriteSet1Register = 0x07, WriteClear1Register = 0x08, WriteToggle1Register = 0x09, ReadDat1Register = 0x0A, WriteDat1Register = 0x0B, ReadDirRegister = 0x0C, WriteDirRegister = 0x0D, ReadHubConfigRegister = 0x0E, WriteHubConfigRegister = 0x0F, QueryStatusLED = 0x10, SetStatusLED = 0x11, StopStatusLEDServer = 0x12, StartStatusLEDServer = 0x13, QueryOMAPEventMon = 0x14, QueryOMAPExtStatMon = 0x15, QueryOMAPnStartMon = 0x16, QueryOMAPnStatusMon = 0x17, QueryOMAPEventLow = 0x18, SetOMAPEventLow = 0x19, QueryOMAPStartLow = 0x1A, SetOMAPStartLow = 0x1B, QueryOMAPStatusLow = 0x1C, SetOMAPStatusLow = 0x1D, QueryOMAPRecStatExt = 0x1E, SetOMAPRecStatExt = 0x1F, QueryAllGPIO = 0x20, }; protected abstract Commands _Command { get; } protected GPIOCommands(DTS.Common.Interface.DASFactory.ICommunication sock) : base(sock) { command.Type = CommandPacket.CommandType.GPIO; command.SetCommand((byte)_Command, _Command.ToString()); } protected GPIOCommands(DTS.Common.Interface.DASFactory.ICommunication sock, int TimeoutMillisec) : base(sock, TimeoutMillisec) { command.Type = CommandPacket.CommandType.GPIO; command.SetCommand((byte)_Command, _Command.ToString()); } //public const int SDB_GPIO_PROTO_VERISON = 4; } #region MSP GPIO Registors public class ReadInputRegister : GPIOCommands { protected override GPIOCommands.Commands _Command { get { return Commands.ReadInputRegister; } } public ReadInputRegister(DTS.Common.Interface.DASFactory.ICommunication sock) : base(sock) { } public ReadInputRegister(DTS.Common.Interface.DASFactory.ICommunication sock, int TimeoutMillisec) : base(sock, TimeoutMillisec) { } private byte _val; /// /// The current value of the 8-bit input register /// public byte InputRegister { get { return _val; } } protected override CommandReceiveAction WholePackage() { _val = 0; if (response.Status == DFConstantsAndEnums.CommandStatus.StatusNoError) { byte bVal; response.GetParameter(0, out bVal); _val = bVal; } return CommandReceiveAction.StopReceiving; } public override void ResponseToString(ref List> lines) { base.ResponseToString(ref lines); lines.Add(new List() { string.Format("InputRegister: {0}",InputRegister) }); } } public class ReadDat0Register : GPIOCommands { protected override GPIOCommands.Commands _Command { get { return Commands.ReadDat0Register; } } public ReadDat0Register(DTS.Common.Interface.DASFactory.ICommunication sock) : base(sock) { } public ReadDat0Register(DTS.Common.Interface.DASFactory.ICommunication sock, int TimeoutMillisec) : base(sock, TimeoutMillisec) { } private byte _value; /// /// The current value of the 8-bit input register /// public byte Value { get { return _value; } } protected override CommandReceiveAction WholePackage() { _value = 0; if (response.Status == DFConstantsAndEnums.CommandStatus.StatusNoError) { byte bVal; response.GetParameter(0, out bVal); _value = bVal; } return CommandReceiveAction.StopReceiving; } public override void ResponseToString(ref List> lines) { base.ResponseToString(ref lines); lines.Add(new List() { string.Format("Value: {0}",Value) }); } } public class ReadDat1Register : GPIOCommands { protected override GPIOCommands.Commands _Command { get { return Commands.ReadDat1Register; } } public ReadDat1Register(DTS.Common.Interface.DASFactory.ICommunication sock) : base(sock) { } public ReadDat1Register(DTS.Common.Interface.DASFactory.ICommunication sock, int TimeoutMillisec) : base(sock, TimeoutMillisec) { } private byte _value; /// /// The current value of the 8-bit input register /// public byte Value { get { return _value; } } protected override CommandReceiveAction WholePackage() { _value = 0; if (response.Status == DFConstantsAndEnums.CommandStatus.StatusNoError) { byte bVal; response.GetParameter(0, out bVal); _value = bVal; } return CommandReceiveAction.StopReceiving; } public override void ResponseToString(ref List> lines) { base.ResponseToString(ref lines); lines.Add(new List() { string.Format("Value: {0}",Value) }); } } public class WriteDat0Register : GPIOCommands { protected override GPIOCommands.Commands _Command { get { return Commands.WriteDat0Register; } } public WriteDat0Register(DTS.Common.Interface.DASFactory.ICommunication sock) : base(sock) { } public WriteDat0Register(DTS.Common.Interface.DASFactory.ICommunication sock, int TimeoutMillisec) : base(sock, TimeoutMillisec) { } private byte _val; /// /// The current Dat0 reg of the SLICE DB /// public byte Value { get { return _val; } set { _val = value; command.Parameter = new byte[sizeof(byte)]; command.SetParameter(0, _val); } } public override void CommandToString(ref List> lines) { base.CommandToString(ref lines); lines.Add(new List() { string.Format("Value: {0}", Value) }); } } public class WriteDat1Register : GPIOCommands { protected override GPIOCommands.Commands _Command { get { return Commands.WriteDat1Register; } } public WriteDat1Register(DTS.Common.Interface.DASFactory.ICommunication sock) : base(sock) { } public WriteDat1Register(DTS.Common.Interface.DASFactory.ICommunication sock, int TimeoutMillisec) : base(sock, TimeoutMillisec) { } private byte _val; /// /// The current Dat0 reg of the SLICE DB /// public byte Value { get { return _val; } set { _val = value; command.Parameter = new byte[sizeof(byte)]; command.SetParameter(0, _val); } } public override void CommandToString(ref List> lines) { base.CommandToString(ref lines); lines.Add(new List() { string.Format("Value: {0}", Value) }); } } public class WriteToggle0Register : GPIOCommands { protected override GPIOCommands.Commands _Command { get { return Commands.WriteToggle0Register; } } public WriteToggle0Register(DTS.Common.Interface.DASFactory.ICommunication sock) : base(sock) { } public WriteToggle0Register(DTS.Common.Interface.DASFactory.ICommunication sock, int TimeoutMillisec) : base(sock, TimeoutMillisec) { } private byte _val; /// /// The current Dat0 reg of the SLICE DB /// public byte Value { get { return _val; } set { _val = value; command.Parameter = new byte[sizeof(byte)]; command.SetParameter(0, _val); } } public override void CommandToString(ref List> lines) { base.CommandToString(ref lines); lines.Add(new List() { string.Format("Value: {0}", Value) }); } } public class WriteSet0Register : GPIOCommands { protected override GPIOCommands.Commands _Command { get { return Commands.WriteSet0Register; } } public WriteSet0Register(DTS.Common.Interface.DASFactory.ICommunication sock) : base(sock) { } public WriteSet0Register(DTS.Common.Interface.DASFactory.ICommunication sock, int TimeoutMillisec) : base(sock, TimeoutMillisec) { } private byte _val; /// /// The current Dat0 reg of the SLICE DB /// public byte Value { get { return _val; } set { _val = value; command.Parameter = new byte[sizeof(byte)]; command.SetParameter(0, _val); } } public override void CommandToString(ref List> lines) { base.CommandToString(ref lines); lines.Add(new List() { string.Format("Value: {0}", Value) }); } } public class WriteClear0Register : GPIOCommands { protected override GPIOCommands.Commands _Command { get { return Commands.WriteClear0Register; } } public WriteClear0Register(DTS.Common.Interface.DASFactory.ICommunication sock) : base(sock) { } public WriteClear0Register(DTS.Common.Interface.DASFactory.ICommunication sock, int TimeoutMillisec) : base(sock, TimeoutMillisec) { } private byte _val; /// /// The current Dat0 reg of the SLICE DB /// public byte Value { get { return _val; } set { _val = value; command.Parameter = new byte[sizeof(byte)]; command.SetParameter(0, _val); } } public override void CommandToString(ref List> lines) { base.CommandToString(ref lines); lines.Add(new List() { string.Format("Value: {0}", Value) }); } } #endregion #region Status LED public class QueryStatusLED : GPIOCommands { protected override GPIOCommands.Commands _Command { get { return Commands.QueryStatusLED; } } public QueryStatusLED(DTS.Common.Interface.DASFactory.ICommunication sock) : base(sock) { MinimumProtocolVersion = sock.GetMinProto(DFConstantsAndEnums.ProtocolLimitedCommands.OMAP_GPIO); } public QueryStatusLED(DTS.Common.Interface.DASFactory.ICommunication sock, int TimeoutMillisec) : base(sock, TimeoutMillisec) { MinimumProtocolVersion = sock.GetMinProto(DFConstantsAndEnums.ProtocolLimitedCommands.OMAP_GPIO); } private byte _value; /// /// The current value of the 8-bit input register /// public byte Value { get { return _value; } } protected override CommandReceiveAction WholePackage() { _value = 0; if (response.Status == DFConstantsAndEnums.CommandStatus.StatusNoError) { byte bVal; response.GetParameter(0, out bVal); _value = bVal; } return CommandReceiveAction.StopReceiving; } public override void ResponseToString(ref List> lines) { base.ResponseToString(ref lines); lines.Add(new List() { string.Format("Value: {0}",Value) }); } } public class SetStatusLED : GPIOCommands { protected override GPIOCommands.Commands _Command { get { return Commands.SetStatusLED; } } public SetStatusLED(DTS.Common.Interface.DASFactory.ICommunication sock) : base(sock) { MinimumProtocolVersion = sock.GetMinProto(DFConstantsAndEnums.ProtocolLimitedCommands.OMAP_GPIO); } public SetStatusLED(DTS.Common.Interface.DASFactory.ICommunication sock, int TimeoutMillisec) : base(sock, TimeoutMillisec) { MinimumProtocolVersion = sock.GetMinProto(DFConstantsAndEnums.ProtocolLimitedCommands.OMAP_GPIO); } private byte _val; /// /// The current StatusLED reg of the SLICE DB /// public byte Value { get { return _val; } set { _val = value; command.Parameter = new byte[sizeof(byte)]; command.SetParameter(0, _val); } } } #endregion #region OMAP GPIO Reg Monitors public class QueryOMAPEventMon : GPIOCommands { protected override GPIOCommands.Commands _Command { get { return Commands.QueryOMAPEventMon; } } public QueryOMAPEventMon(DTS.Common.Interface.DASFactory.ICommunication sock) : base(sock) { MinimumProtocolVersion = sock.GetMinProto(DFConstantsAndEnums.ProtocolLimitedCommands.OMAP_GPIO); } public QueryOMAPEventMon(DTS.Common.Interface.DASFactory.ICommunication sock, int TimeoutMillisec) : base(sock, TimeoutMillisec) { MinimumProtocolVersion = sock.GetMinProto(DFConstantsAndEnums.ProtocolLimitedCommands.OMAP_GPIO); } private byte _value; /// /// The current value of the event mon reg /// public bool Value { get { return Convert.ToBoolean(_value); } } protected override CommandReceiveAction WholePackage() { _value = 0; if (response.Status == DFConstantsAndEnums.CommandStatus.StatusNoError) { byte bVal; response.GetParameter(0, out bVal); _value = bVal; } return CommandReceiveAction.StopReceiving; } public override void ResponseToString(ref List> lines) { base.ResponseToString(ref lines); lines.Add(new List() { string.Format("Value: {0}",Value) }); } } public class QueryOMAPExtStatMon : GPIOCommands { protected override GPIOCommands.Commands _Command { get { return Commands.QueryOMAPExtStatMon; } } public QueryOMAPExtStatMon(DTS.Common.Interface.DASFactory.ICommunication sock) : base(sock) { MinimumProtocolVersion = sock.GetMinProto(DFConstantsAndEnums.ProtocolLimitedCommands.OMAP_GPIO); } public QueryOMAPExtStatMon(DTS.Common.Interface.DASFactory.ICommunication sock, int TimeoutMillisec) : base(sock, TimeoutMillisec) { MinimumProtocolVersion = sock.GetMinProto(DFConstantsAndEnums.ProtocolLimitedCommands.OMAP_GPIO); } private byte _value; /// /// The current value of the event mon reg /// public bool Value { get { return Convert.ToBoolean(_value); } } protected override CommandReceiveAction WholePackage() { _value = 0; if (response.Status == DFConstantsAndEnums.CommandStatus.StatusNoError) { byte bVal; response.GetParameter(0, out bVal); _value = bVal; } return CommandReceiveAction.StopReceiving; } public override void ResponseToString(ref List> lines) { base.ResponseToString(ref lines); lines.Add(new List() { string.Format("Value: {0}",Value) }); } } public class QueryOMAPnStartMon : GPIOCommands { protected override GPIOCommands.Commands _Command { get { return Commands.QueryOMAPnStartMon; } } public QueryOMAPnStartMon(DTS.Common.Interface.DASFactory.ICommunication sock) : base(sock) { MinimumProtocolVersion = sock.GetMinProto(DFConstantsAndEnums.ProtocolLimitedCommands.OMAP_GPIO); } public QueryOMAPnStartMon(DTS.Common.Interface.DASFactory.ICommunication sock, int TimeoutMillisec) : base(sock, TimeoutMillisec) { MinimumProtocolVersion = sock.GetMinProto(DFConstantsAndEnums.ProtocolLimitedCommands.OMAP_GPIO); } private byte _value; /// /// The current value of the event mon reg /// public bool Value { get { return Convert.ToBoolean(_value); } } protected override CommandReceiveAction WholePackage() { _value = 0; if (response.Status == DFConstantsAndEnums.CommandStatus.StatusNoError) { byte bVal; response.GetParameter(0, out bVal); _value = bVal; } return CommandReceiveAction.StopReceiving; } public override void ResponseToString(ref List> lines) { base.ResponseToString(ref lines); lines.Add(new List() { string.Format("Value: {0}",Value) }); } } public class QueryOMAPnStatusMon : GPIOCommands { protected override GPIOCommands.Commands _Command { get { return Commands.QueryOMAPnStatusMon; } } public QueryOMAPnStatusMon(DTS.Common.Interface.DASFactory.ICommunication sock) : base(sock) { MinimumProtocolVersion = sock.GetMinProto(DFConstantsAndEnums.ProtocolLimitedCommands.OMAP_GPIO); } public QueryOMAPnStatusMon(DTS.Common.Interface.DASFactory.ICommunication sock, int TimeoutMillisec) : base(sock, TimeoutMillisec) { MinimumProtocolVersion = sock.GetMinProto(DFConstantsAndEnums.ProtocolLimitedCommands.OMAP_GPIO); } private byte _value; /// /// The current value of the event mon reg /// public bool Value { get { return Convert.ToBoolean(_value); } } protected override CommandReceiveAction WholePackage() { _value = 0; if (response.Status == DFConstantsAndEnums.CommandStatus.StatusNoError) { byte bVal; response.GetParameter(0, out bVal); _value = bVal; } return CommandReceiveAction.StopReceiving; } public override void ResponseToString(ref List> lines) { base.ResponseToString(ref lines); lines.Add(new List() { string.Format("Value: {0}",Value) }); } } #endregion #region OMAP GPIO Reg Read/Writes public class QueryOMAPEventLow : GPIOCommands { protected override GPIOCommands.Commands _Command { get { return Commands.QueryOMAPEventLow; } } public QueryOMAPEventLow(DTS.Common.Interface.DASFactory.ICommunication sock) : base(sock) { MinimumProtocolVersion = sock.GetMinProto(DFConstantsAndEnums.ProtocolLimitedCommands.OMAP_GPIO); } public QueryOMAPEventLow(DTS.Common.Interface.DASFactory.ICommunication sock, int TimeoutMillisec) : base(sock, TimeoutMillisec) { MinimumProtocolVersion = sock.GetMinProto(DFConstantsAndEnums.ProtocolLimitedCommands.OMAP_GPIO); } private byte _value; /// /// The current value of the event mon reg /// public bool Value { get { return Convert.ToBoolean(_value); } } protected override CommandReceiveAction WholePackage() { _value = 0; if (response.Status == DFConstantsAndEnums.CommandStatus.StatusNoError) { byte bVal; response.GetParameter(0, out bVal); _value = bVal; } return CommandReceiveAction.StopReceiving; } public override void ResponseToString(ref List> lines) { base.ResponseToString(ref lines); lines.Add(new List() { string.Format("Value: {0}",Value) }); } } public class SetOMAPEventLow : GPIOCommands { protected override GPIOCommands.Commands _Command { get { return Commands.SetOMAPEventLow; } } public SetOMAPEventLow(DTS.Common.Interface.DASFactory.ICommunication sock) : base(sock) { MinimumProtocolVersion = sock.GetMinProto(DFConstantsAndEnums.ProtocolLimitedCommands.OMAP_GPIO); } public SetOMAPEventLow(DTS.Common.Interface.DASFactory.ICommunication sock, int TimeoutMillisec) : base(sock, TimeoutMillisec) { MinimumProtocolVersion = sock.GetMinProto(DFConstantsAndEnums.ProtocolLimitedCommands.OMAP_GPIO); } private byte _val; /// /// The current StatusLED reg of the SLICE DB /// public bool Value { get { return Convert.ToBoolean(_val); } set { _val = Convert.ToByte(value); command.Parameter = new byte[sizeof(byte)]; command.SetParameter(0, _val); } } } public class QueryOMAPStartLow : GPIOCommands { protected override GPIOCommands.Commands _Command { get { return Commands.QueryOMAPStartLow; } } public QueryOMAPStartLow(DTS.Common.Interface.DASFactory.ICommunication sock) : base(sock) { MinimumProtocolVersion = sock.GetMinProto(DFConstantsAndEnums.ProtocolLimitedCommands.OMAP_GPIO); } public QueryOMAPStartLow(DTS.Common.Interface.DASFactory.ICommunication sock, int TimeoutMillisec) : base(sock, TimeoutMillisec) { MinimumProtocolVersion = sock.GetMinProto(DFConstantsAndEnums.ProtocolLimitedCommands.OMAP_GPIO); } private byte _value; /// /// The current value of the event mon reg /// public bool Value { get { return Convert.ToBoolean(_value); } } protected override CommandReceiveAction WholePackage() { _value = 0; if (response.Status == DFConstantsAndEnums.CommandStatus.StatusNoError) { byte bVal; response.GetParameter(0, out bVal); _value = bVal; } return CommandReceiveAction.StopReceiving; } public override void ResponseToString(ref List> lines) { base.ResponseToString(ref lines); lines.Add(new List() { string.Format("Value: {0}",Value) }); } } public class SetOMAPStartLow : GPIOCommands { protected override GPIOCommands.Commands _Command { get { return Commands.SetOMAPStartLow; } } public SetOMAPStartLow(DTS.Common.Interface.DASFactory.ICommunication sock) : base(sock) { MinimumProtocolVersion = sock.GetMinProto(DFConstantsAndEnums.ProtocolLimitedCommands.OMAP_GPIO); } public SetOMAPStartLow(DTS.Common.Interface.DASFactory.ICommunication sock, int TimeoutMillisec) : base(sock, TimeoutMillisec) { MinimumProtocolVersion = sock.GetMinProto(DFConstantsAndEnums.ProtocolLimitedCommands.OMAP_GPIO); } private byte _val; /// /// The current StatusLED reg of the SLICE DB /// public bool Value { get { return Convert.ToBoolean(_val); } set { _val = Convert.ToByte(value); command.Parameter = new byte[sizeof(byte)]; command.SetParameter(0, _val); } } } public class QueryOMAPStatusLow : GPIOCommands { protected override GPIOCommands.Commands _Command { get { return Commands.QueryOMAPStatusLow; } } public QueryOMAPStatusLow(DTS.Common.Interface.DASFactory.ICommunication sock) : base(sock) { MinimumProtocolVersion = sock.GetMinProto(DFConstantsAndEnums.ProtocolLimitedCommands.OMAP_GPIO); } public QueryOMAPStatusLow(DTS.Common.Interface.DASFactory.ICommunication sock, int TimeoutMillisec) : base(sock, TimeoutMillisec) { MinimumProtocolVersion = sock.GetMinProto(DFConstantsAndEnums.ProtocolLimitedCommands.OMAP_GPIO); } private byte _value; /// /// The current value of the event mon reg /// public bool Value { get { return Convert.ToBoolean(_value); } } protected override CommandReceiveAction WholePackage() { _value = 0; if (response.Status == DFConstantsAndEnums.CommandStatus.StatusNoError) { byte bVal; response.GetParameter(0, out bVal); _value = bVal; } return CommandReceiveAction.StopReceiving; } public override void ResponseToString(ref List> lines) { base.ResponseToString(ref lines); lines.Add(new List() { string.Format("Value: {0}",Value) }); } } public class SetOMAPStatusLow : GPIOCommands { protected override GPIOCommands.Commands _Command { get { return Commands.SetOMAPStatusLow; } } public SetOMAPStatusLow(DTS.Common.Interface.DASFactory.ICommunication sock) : base(sock) { MinimumProtocolVersion = sock.GetMinProto(DFConstantsAndEnums.ProtocolLimitedCommands.OMAP_GPIO); } public SetOMAPStatusLow(DTS.Common.Interface.DASFactory.ICommunication sock, int TimeoutMillisec) : base(sock, TimeoutMillisec) { MinimumProtocolVersion = sock.GetMinProto(DFConstantsAndEnums.ProtocolLimitedCommands.OMAP_GPIO); } private byte _val; /// /// The current StatusLED reg of the SLICE DB /// public bool Value { get { return Convert.ToBoolean(_val); } set { _val = Convert.ToByte(value); command.Parameter = new byte[sizeof(byte)]; command.SetParameter(0, _val); } } } public class QueryOMAPRecStatExt : GPIOCommands { protected override GPIOCommands.Commands _Command { get { return Commands.QueryOMAPRecStatExt; } } public QueryOMAPRecStatExt(DTS.Common.Interface.DASFactory.ICommunication sock) : base(sock) { MinimumProtocolVersion = sock.GetMinProto(DFConstantsAndEnums.ProtocolLimitedCommands.OMAP_GPIO); } public QueryOMAPRecStatExt(DTS.Common.Interface.DASFactory.ICommunication sock, int TimeoutMillisec) : base(sock, TimeoutMillisec) { MinimumProtocolVersion = sock.GetMinProto(DFConstantsAndEnums.ProtocolLimitedCommands.OMAP_GPIO); } private byte _value; /// /// The current value of the event mon reg /// public bool Value { get { return Convert.ToBoolean(_value); } } protected override CommandReceiveAction WholePackage() { _value = 0; if (response.Status == DFConstantsAndEnums.CommandStatus.StatusNoError) { byte bVal; response.GetParameter(0, out bVal); _value = bVal; } return CommandReceiveAction.StopReceiving; } public override void ResponseToString(ref List> lines) { base.ResponseToString(ref lines); lines.Add(new List() { string.Format("Value: {0}",Value) }); } } public class SetOMAPRecStatExt : GPIOCommands { protected override GPIOCommands.Commands _Command { get { return Commands.SetOMAPRecStatExt; } } public SetOMAPRecStatExt(DTS.Common.Interface.DASFactory.ICommunication sock) : base(sock) { MinimumProtocolVersion = sock.GetMinProto(DFConstantsAndEnums.ProtocolLimitedCommands.OMAP_GPIO); } public SetOMAPRecStatExt(DTS.Common.Interface.DASFactory.ICommunication sock, int TimeoutMillisec) : base(sock, TimeoutMillisec) { MinimumProtocolVersion = sock.GetMinProto(DFConstantsAndEnums.ProtocolLimitedCommands.OMAP_GPIO); } private byte _val; /// /// The current StatusLED reg of the SLICE DB /// public bool Value { get { return Convert.ToBoolean(_val); } set { _val = Convert.ToByte(value); command.Parameter = new byte[sizeof(byte)]; command.SetParameter(0, _val); } } } public class QueryAllGPIO : GPIOCommands { protected override GPIOCommands.Commands _Command { get { return Commands.QueryAllGPIO; } } public QueryAllGPIO(DTS.Common.Interface.DASFactory.ICommunication sock) : base(sock) { MinimumProtocolVersion = sock.GetMinProto(DFConstantsAndEnums.ProtocolLimitedCommands.OMAP_GPIO); } public QueryAllGPIO(DTS.Common.Interface.DASFactory.ICommunication sock, int TimeoutMillisec) : base(sock, TimeoutMillisec) { MinimumProtocolVersion = sock.GetMinProto(DFConstantsAndEnums.ProtocolLimitedCommands.OMAP_GPIO); } private UInt32[] _val; /// /// The slice bus voltage in millivolts /// public UInt32[] GPIOReg { get { return _val; } } protected override CommandReceiveAction WholePackage() { _val = new uint[7]; if (response.Status == DFConstantsAndEnums.CommandStatus.StatusNoError) { UInt32 uVal; for (byte i = 0; i < _val.Length; i++) { response.GetParameter(i * 4, out uVal); _val[i] = uVal; } } return CommandReceiveAction.StopReceiving; } public override void ResponseToString(ref List> lines) { base.ResponseToString(ref lines); lines.Add(new List() { string.Format("SLICE Bus voltage (mV): {0}",GPIOReg) }); } } #endregion }