Esempio n. 1
0
        /// <summary>
        /// Initalize the lists.
        /// </summary>
        /// <param name="name"></param>
        public InputTerminalViewModel(string name)
        {
            base.DisplayName = name;

            _outputVM = IoC.Get <OutputDataViewModel>();

            _serialOptions = new SerialOptions();
            CommPortList   = SerialOptions.PortOptions;
            BaudRateList   = SerialOptions.BaudRateOptions;
            SelectedBaud   = 115200;

            GpsCommPortList   = SerialOptions.PortOptions;
            _gpsSerialOptions = new SerialOptions();
            SelectedGpsBaud   = 9600;

            StatusOutput = "";

            _adcpCodec = new AdcpCodec();
            _adcpCodec.ProcessDataEvent += _adcpCodec_ProcessDataEvent;

            // Scan for ADCP command
            ScanAdcpCommand = ReactiveUI.Legacy.ReactiveCommand.Create();
            ScanAdcpCommand.Subscribe(_ => ScanForAdcp());

            // Disconnect Serial
            ConnectAdcpCommand = ReactiveUI.Legacy.ReactiveCommand.Create();
            ConnectAdcpCommand.Subscribe(_ => ConnectAdcpSerial());

            // Disconnect Serial
            DisconnectAdcpCommand = ReactiveUI.Legacy.ReactiveCommand.Create();
            DisconnectAdcpCommand.Subscribe(_ => DisconnectAdcpSerial());

            // Scan for GPS command
            ScanGpsCommand = ReactiveUI.Legacy.ReactiveCommand.Create();
            ScanGpsCommand.Subscribe(_ => ScanForGps());

            // Disconnect Serial
            ConnectGpsCommand = ReactiveUI.Legacy.ReactiveCommand.Create();
            ConnectGpsCommand.Subscribe(_ => ConnectGpsSerial());

            // Disconnect Serial
            DisconnectGpsCommand = ReactiveUI.Legacy.ReactiveCommand.Create();
            DisconnectGpsCommand.Subscribe(_ => DisconnectGpsSerial());

            // Start Pinging if not pinging
            StartPingingCommand = ReactiveUI.Legacy.ReactiveCommand.Create();
            StartPingingCommand.Subscribe(_ => StartPinging());

            // Stop Pinging if not pinging
            StopPingingCommand = ReactiveUI.Legacy.ReactiveCommand.Create();
            StopPingingCommand.Subscribe(_ => StopPinging());

            // Send the command to the ADCP
            SendAdcpCmdCommand = ReactiveUI.Legacy.ReactiveCommand.Create();
            SendAdcpCmdCommand.Subscribe(_ => SendAdcpCommand());
        }
Esempio n. 2
0
        /// <summary>
        /// Playback the given file.
        /// </summary>
        public FilePlayback()
        {
            // Initialize values
            BytesPerEnsemble = DEFAULT_BYTES_PER_ENSEMBLE;
            _fileOffset      = 0;
            TotalEnsembles   = 0;
            //_ensembleList = new List<EnsembleData>();
            Name          = "";
            _ensembleDict = new Dictionary <int, EnsembleData>();
            _currEnsNum   = 0;
            _firstEnsNum  = 0;
            _lastEnsNum   = 0;

            // Codecs
            _adcpCodec = new AdcpCodec();
            _adcpCodec.ProcessDataEvent         += new AdcpCodec.ProcessDataEventHandler(_adcpCodec_ProcessDataEvent);
            _adcpCodec.ProcessDataCompleteEvent += _adcpCodec_ProcessDataCompleteEvent;

            // Wait for decoding to be complete
            _eventWaitDecode = new EventWaitHandle(false, EventResetMode.AutoReset);
        }
        /// <summary>
        /// Initialize.
        /// </summary>
        public DataFormatViewModel(IEventAggregator eventAggregator)
        {
            _eventAggregator = eventAggregator;

            _options = new DataFormatOptions();

            // Initialize the codec
            _codec = new AdcpCodec();

            // Init values
            _curProjectName  = "";
            _currEnsCount    = 0;
            IsRtb            = _options.IsRTB;
            _RtbDataCount    = 0;
            _RtbDataBytes    = 0;
            IsRtd            = _options.IsRTD;
            _RtdDataCount    = 0;
            _RtdDataBytes    = 0;
            IsPd0            = _options.IsPD0;
            _Pd0DataCount    = 0;
            _Pd0DataBytes    = 0;
            IsPd6_13         = _options.IsPD6_13;
            _Pd6_13DataCount = 0;
            _Pd6_13DataBytes = 0;
            IsPd4_5          = _options.IsPD4_5;
            _Pd4_5DataCount  = 0;
            _Pd4_5DataBytes  = 0;

            // Setup event handlers
            _codec.ProcessDataEvent += _codec_ProcessDataEvent;

            // Update the display
            _displayTimer           = new System.Timers.Timer(1000);
            _displayTimer.Elapsed  += _displayTimer_Elapsed;
            _displayTimer.AutoReset = true;
            _displayTimer.Enabled   = true;
        }
Esempio n. 4
0
        /// <summary>
        /// Playback the given file.
        /// </summary>
        public FilePlayback()
        {
            // Initialize values
            BytesPerEnsemble = DEFAULT_BYTES_PER_ENSEMBLE;
            _fileOffset = 0;
            TotalEnsembles = 0;
            _ensembleList = new List<EnsembleData>();
            Name = "";

            // Codecs
            _adcpCodec = new AdcpCodec();
            _adcpCodec.ProcessDataEvent += new AdcpCodec.ProcessDataEventHandler(_adcpCodec_ProcessDataEvent);
            _adcpCodec.ProcessDataCompleteEvent += _adcpCodec_ProcessDataCompleteEvent;

            // Wait for decoding to be complete
            _eventWaitDecode = new EventWaitHandle(false, EventResetMode.AutoReset);
        }