public RealCarCommunicator(ICar parent)
        {
            ICar = parent;

            extentionCardCommunicator = new USB4702();
            servoDriver = new ServoDriver();
            angleAndSpeedMeter = new RS232Controller(this);

            //TODO: make thread for every initialization //its actually done for angleAndSpeedMeter
            extentionCardCommunicator.Initialize();
            servoDriver.Initialize();
            angleAndSpeedMeter.Initialize();

            SpeedMeasuringTimer.Interval = SPEED_MEASURING_TIMER_INTERVAL_IN_MS;
            SpeedMeasuringTimer.Tick += new EventHandler(SpeedMeasuringTimer_Tick);
            SpeedMeasuringTimer.Start();
        }
예제 #2
0
        public RealCarCommunicator(ICar parent)
        {
            ICar = parent;

            servoDriver = new ServoDriver();
            deviceManager.RegisterDevice(servoDriver);

            //angleAndSpeedMeter = new SafeRS232Controller(this, new SafeRS232Communicator("COM4"));
            //deviceManager.RegisterDevice(angleAndSpeedMeter);

            angleAndSpeedMeter = new CarController_old.RS232Controller(this);
            deviceManager.RegisterDevice(angleAndSpeedMeter);

            extentionCardCommunicator = new USB4702();
            deviceManager.RegisterDevice(extentionCardCommunicator);

            speedometer = new Speedometer(extentionCardCommunicator);
            deviceManager.RegisterDevice(speedometer);

            gearboxController = new GearboxController(extentionCardCommunicator, this);
            deviceManager.RegisterDevice(gearboxController);

            speedometer.evSpeedInfoReceived += speedometer_evSpeedInfoReceived;
        }