コード例 #1
0
        public async Task ConnectAndSendCommandsUsingBuilderAsync()
        {
            using (var remote = new SdrRemote(Config))
            {
                remote.IsConnected().ShouldBeTrue();

                var gainAudioCommand        = RemoteCommand.Create("Set", "AudioGain", 45);
                var detectorTypeCommand     = RemoteCommand.Create("Set", "DetectorType", "WFM");
                var filterBandwidthCommand  = RemoteCommand.Create("Set", "FilterBandwidth", 200000);
                var squelchEnabledCommand   = RemoteCommand.Create("Set", "SquelchEnabled", false);
                var SquelchThresholdCommand = RemoteCommand.Create("Set", "SquelchThreshold", 30);
                var fmStereoCommand         = RemoteCommand.Create("Set", "FmStereo", true);
                var frequencyCommand        = RemoteCommand.Create("Set", "Frequency", 99700000);

                await remote.AddCommand(gainAudioCommand)
                .AddCommand(detectorTypeCommand)
                .AddCommand(filterBandwidthCommand)
                .AddCommand(squelchEnabledCommand)
                .AddCommand(SquelchThresholdCommand)
                .AddCommand(fmStereoCommand)
                .AddCommand(frequencyCommand)
                .Execute();

                remote.ResponseLog.Count.ShouldBeGreaterThan(10);
                remote.ToString().ShouldNotBeNullOrWhiteSpace();
            }
        }
コード例 #2
0
        public async Task <CommandResult> RunCommandAsync(RemoteCommandArgs commandArgs)
        {
            var           io            = new ProcessIO(this.logEmitter);
            RemoteCommand remoteCommand = RemoteCommand.Create(this.container, io, commandArgs.Command, commandArgs);

            TaskCommandResult taskResult = await remoteCommand.InvokeAsync();

            var result = new CommandResult
            {
                ExitCode = taskResult.ExitCode,
                StdOut   = taskResult.Stdout,
                StdErr   = taskResult.Stderr,
            };

            return(result);
        }
コード例 #3
0
        public async Task OnPostManualConfig()
        {
            var gainAudioCommand        = RemoteCommand.Create("Set", "AudioGain", CurrentState.AudioGain);
            var detectorTypeCommand     = RemoteCommand.Create("Set", "DetectorType", CurrentState.DetectorType);
            var filterBandwidthCommand  = RemoteCommand.Create("Set", "FilterBandwidth", 200000);
            var squelchEnabledCommand   = RemoteCommand.Create("Set", "SquelchEnabled", false);
            var SquelchThresholdCommand = RemoteCommand.Create("Set", "SquelchThreshold", 30);
            var fmStereoCommand         = RemoteCommand.Create("Set", "FmStereo", true);
            var frequencyCommand        = RemoteCommand.Create("Set", "Frequency", CurrentState.Frequency);

            await _remote.AddCommand(gainAudioCommand)
            .AddCommand(detectorTypeCommand)
            .AddCommand(filterBandwidthCommand)
            .AddCommand(squelchEnabledCommand)
            .AddCommand(SquelchThresholdCommand)
            .AddCommand(fmStereoCommand)
            .AddCommand(frequencyCommand)
            .Execute();
        }
コード例 #4
0
        public async Task ConnectAndSendCommandAsync()
        {
            using (var remote = new SdrRemote(Config))
            {
                remote.IsConnected().ShouldBeTrue();


                var gainAudioCommand        = RemoteCommand.Create("Set", "AudioGain", 45);
                var detectorTypeCommand     = RemoteCommand.Create("Set", "DetectorType", "WFM");
                var filterBandwidthCommand  = RemoteCommand.Create("Set", "FilterBandwidth", 200000);
                var squelchEnabledCommand   = RemoteCommand.Create("Set", "SquelchEnabled", false);
                var SquelchThresholdCommand = RemoteCommand.Create("Set", "SquelchThreshold", 30);
                var fmStereoCommand         = RemoteCommand.Create("Set", "FmStereo", true);
                var frequencyCommand        = RemoteCommand.Create("Set", "Frequency", 99700000);

                await remote.Stop();

                var gainAudioResponse = await remote.SendAsync(gainAudioCommand);

                Console.WriteLine(gainAudioResponse);
                var detectorTypeResponse = await remote.SendAsync(detectorTypeCommand);

                Console.WriteLine(detectorTypeResponse);
                var filterBandwidthResponse = await remote.SendAsync(filterBandwidthCommand);

                Console.WriteLine(filterBandwidthResponse);
                var squelchEnabledResponse = await remote.SendAsync(squelchEnabledCommand);

                Console.WriteLine(squelchEnabledResponse);
                var SquelchThresholdResponse = await remote.SendAsync(SquelchThresholdCommand);

                Console.WriteLine(SquelchThresholdResponse);
                var fmStereoResponse = await remote.SendAsync(fmStereoCommand);

                Console.WriteLine(fmStereoResponse);
                var frequencyResponse = await remote.SendAsync(frequencyCommand);

                Console.WriteLine(frequencyResponse);

                await remote.Start();
            }
        }