All Hardware. Instantiating this class activate DataReceived events for all hardware.
コード例 #1
0
        public BatteryController(Hardware hw)
        {
            this.hardware = hw;

            this.Off = new Mode { ID = 0, CanDischarge = false, Drive = false, CanCharge = false };
            this.Discharging = new Mode { ID = 1, CanDischarge = true, Drive = false, CanCharge = false };
            this.Drive = new Mode { ID = 2, CanDischarge = true, Drive = true, CanCharge = false };
            this.EmptyCharging = new Mode { ID = 4, CanDischarge = false, Drive = false, CanCharge = true };
            this.Charging = new Mode { ID = 5, CanDischarge = true, Drive = false, CanCharge = true };
            this.DriveCharging = new Mode { ID = 6, CanDischarge = true, Drive = true, CanCharge = true };

            this.Off.ChargeConj = this.EmptyCharging;
            this.Off.DischargeConj = this.Discharging;
            this.Off.DriveConj = null;

            this.Discharging.ChargeConj = this.Charging;
            this.Discharging.DischargeConj = this.Off;
            this.Discharging.DriveConj = this.Drive;

            this.Drive.ChargeConj = this.DriveCharging;
            this.Drive.DischargeConj = this.Off;
            this.Drive.DriveConj = this.Discharging;

            this.EmptyCharging.ChargeConj = this.Off;
            this.EmptyCharging.DischargeConj = this.Charging;
            this.EmptyCharging.DriveConj = null;

            this.Charging.ChargeConj = this.Discharging;
            this.Charging.DischargeConj = this.EmptyCharging;
            this.Charging.DriveConj = this.DriveCharging;

            this.DriveCharging.ChargeConj = this.Drive;
            this.DriveCharging.DischargeConj = this.EmptyCharging;
            this.DriveCharging.DriveConj = this.Charging;

            this.Current = this.Off;
        }
コード例 #2
0
 public SignalController(Hardware hw)
 {
     this.hardware = hw;
     this.haz_timer = new Timer(800);
     this.haz_timer.Elapsed += (object sender, ElapsedEventArgs e) => (this.haz_blink = !this.haz_blink);
 }
コード例 #3
0
 public UserCommands(Hardware hw)
 {
     this.hardware = hw;
 }
コード例 #4
0
 public MotorController(Hardware hw)
 {
     this.hardware = hw;
 }