Example #1
0
        public StepperController(CommunicationService communicationService)
        {
            if (communicationService == null)
                throw new ArgumentNullException("communicationService", "communicationService is null.");
            _CommunicationService = communicationService;
            _CommunicationService.AnswerRecieved += OnAnswerRecieved;
            SelectedStepRate = AvaliableSteps.FirstOrDefault();
            StepDownCommand = new Command((x) => MakeMove(-SelectedStepRate), (x) => Ready);
            StepUpCommand = new Command((x) =>  MakeMove(SelectedStepRate), (x) => Ready);
            SetHomeCommand = new Command((x) => SetHome(), (x) => Ready);
            GoHomeCommand = new Command((x) => GoHome(), (x) => Ready);

            _requestTimer = new Timer(500);
            _requestTimer.Elapsed += OnRequestTimerElapsed;
            _requestTimer.Start();
        }
Example #2
0
        public SensorController(CommunicationService communicationService, DBManager dataBaseManager)
        {
            if (communicationService == null)
                throw new ArgumentNullException("communicationService", "communicationService is null.");
            if (dataBaseManager == null)
                throw new ArgumentNullException("dataBaseManager", "dataBaseManager is null.");

            _DataBaseManager = dataBaseManager;
            _CommunicationService = communicationService;
            _CommunicationService.AnswerRecieved += OnAnswerRecieved;
            _Sensor1 = DATA_NOT_READY;
            _Sensor2 = DATA_NOT_READY;
            _Temperature = DATA_NOT_READY;
            RequestSensorCommand = new Command((x) => RequestSensor(), (x) => true);
            //_RequestTimer = new Timer(REQUEST_TIMEOUT);
            //_RequestTimer.Elapsed += new ElapsedEventHandler(RequestTimer_Elapsed);
            //_RequestTimer.Start();
        }
        public CalibrationController(CommunicationService communicationService, StepperController stepperControl, DBManager dBManager, SensorController sensorControl)
        {
            if (communicationService == null)
                throw new ArgumentNullException("communicationService", "communicationService is null.");
            if (sensorControl == null)
                throw new ArgumentNullException("sensorControl", "sensorControl is null.");
            if (stepperControl == null)
                throw new ArgumentNullException("stepperControl", "stepperControl is null.");
            if (dBManager == null)
                throw new ArgumentNullException("dBManager", "dBManager is null.");

            _CommunicationService = communicationService;
            _StepperControl = stepperControl;
            _DataBaseManager = dBManager;
            _SensorControl = sensorControl;

            StartStopCalibrationCommand = new Command((x) => StartStopCalibaration(), (x) => EnableControl);
            _SensorControl.SensorValueRecieved += OnSensorValueRecieved;
        }