コード例 #1
0
ファイル: SerialPortManager.cs プロジェクト: sundfar/Windman3
        public SerialPortManager(MeasureManager pMeasureManager)
        {
            _measureManager = pMeasureManager;
            _currentSerialSettings = SerialSettings.NewFromConfigFile();
            // Finding installed serial ports on hardware
            //_currentSerialSettings.PortNameCollection = SerialPort.GetPortNames();
            //_currentSerialSettings.PropertyChanged += new System.ComponentModel.PropertyChangedEventHandler(_currentSerialSettings_PropertyChanged);

            // If serial ports is found, we select the first found
            //if (_currentSerialSettings.PortNameCollection.Length > 0)
            //    _currentSerialSettings.PortName = _currentSerialSettings.PortNameCollection[0];
        }
コード例 #2
0
ファイル: Form1.cs プロジェクト: sundfar/Windman3
        private void Form1_Load(object sender, EventArgs e)
        {
            lblLastMeasure.Text = "";
            lblLastMeasure.Text = "";
            lblTemperature.Text = "";
            lblWindDirection.Text = "";
            lblWindSpeedAverage.Text = "";
            lblWindSpeedMaximum.Text = "";
            lblWindSpeedMinimum.Text = "";
            lblBatteryVoltage.Text = "";

            _vsComm = new VindsidenCommunication();
            _measureManager = new MeasureManager();
            _spManager = new SerialPortManager(_measureManager);
            _spManager.NewSerialDataRecieved += new EventHandler<SerialDataEventArgs>(_spManager_NewSerialDataRecieved);
            _spManager.StartListening();
        }