예제 #1
0
        private void btnLogs_Click(object sender, EventArgs e)
        {
            this.UIParams = new UIParams(ref this.waveformPainter, ref this.volumeMeter, (PCMAudioFormat)cbEncoding.SelectedIndex, Mode.Logs);
            try
            {
                var result = InvokeReceiver(new TcpReceiver(UIParams));

                if (!result)
                {
                    MessageBox.Show("Issue: The device is not connected.", "Warning", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    return;
                }

                //waits for the Receiver to end.
                Thread.Sleep(2000);

                if (this.Receiver.Logs.Count > 0)
                {
                    new Logs(this.Receiver.Logs).ShowDialog();
                    this.Receiver.Logs.Clear();
                }
            }
            catch (Exception)
            {
                throw;
            }

            SetButtonStatus(true);
        }
예제 #2
0
        public Receiver(UIParams ui)
        {
            this.UI                     = ui;
            this.pcmHelper              = new PCMHelper(ui.Format);
            this.ReceivedBytes          = new List <byte>();
            this._waveFormat            = GetWaveFormat(ui.Format);
            this._provider              = new BufferedWaveProvider(this._waveFormat);
            this._provider.BufferLength = this._provider.BufferLength * 10;
            var sampleChannel = new SampleChannel(_provider);

            sampleChannel.PreVolumeMeter += OnPreVolumeMeter;
            setVolumeDelegate             = vol => sampleChannel.Volume = vol;
            _meteringSampleProvider       = new MeteringSampleProvider(sampleChannel);
            //indica la cantidad de samples que representan un punto en la grafica
            _meteringSampleProvider.SamplesPerNotification = 80;
            _meteringSampleProvider.StreamVolume          += OnPostVolumeMeter;
        }
예제 #3
0
        private void btnTest_Click(object sender, EventArgs e)
        {
            this.UIParams = new UIParams(ref this.waveformPainter, ref this.volumeMeter, (PCMAudioFormat)cbEncoding.SelectedIndex, Mode.Test);
            try
            {
                bool result;
                result = InvokeReceiver(new TcpReceiver(UIParams));

                if (!result)
                {
                    MessageBox.Show("Issue: The device is not connected.", "Warning", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    return;
                }
                else
                {
                    //waits for the Receiver to end.
                    Thread.Sleep(2000);

                    if (this.Receiver.TestResult)
                    {
                        MessageBox.Show("OK: The data was received correctly and the device is responding as expected.", "Info", MessageBoxButtons.OK, MessageBoxIcon.Information);
                        SetNotificationLabel("Test PASSED.");
                    }
                    else
                    {
                        MessageBox.Show("Error: There are connection errors. The data was not received correctly.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                        SetNotificationLabel("Test not passed.");
                    }
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            SetButtonStatus(true);
        }
예제 #4
0
 private void cbEncoding_SelectedIndexChanged(object sender, EventArgs e)
 {
     this.UIParams = new UIParams(ref this.waveformPainter, ref this.volumeMeter, (PCMAudioFormat)cbEncoding.SelectedIndex);
 }