All Hardware. Instantiating this class activate DataReceived events for all hardware.
        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;
        }
 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);
 }
Esempio n. 3
0
 public UserCommands(Hardware hw)
 {
     this.hardware = hw;
 }
 public MotorController(Hardware hw)
 {
     this.hardware = hw;
 }