Esempio n. 1
0
        public DataCartridge(string id)
        {
            Id = id;

            EWS        = new EWSConfig();
            MFD        = new MFDConfig();
            Radio      = new RadioConfig();
            Navigation = new NavigationConfig();
            Systems    = new SystemsConfig();
            Weapons    = new WeaponsConfig();
        }
Esempio n. 2
0
        /// <summary>
        /// Opens the configuration JSON's for the access methods (cnMaestro and SNMP),
        /// as well as loading the various radiotypes from JSON
        /// </summary>
        private static IConfigurationRoot FetchConfiguration()
        {
            var builder = new ConfigurationBuilder()
                          .SetBasePath(Directory.GetCurrentDirectory())
                          .AddJsonFile("appsettings.json", optional: false, reloadOnChange: false)
                          .AddJsonFile("radiotypes.json", optional: false, reloadOnChange: false);

            IConfigurationRoot configuration = builder.Build();

            // Setup config for the main eventloop
            cambiumRadios = configuration.Get <RadioConfig>();

            // Return overall config so we can pass it to plugins
            return(configuration);
        }
Esempio n. 3
0
        public async void LoadAndPlay(RadioConfig radio)
        {
            RadioName = radio.Name;
            Playlist  = await ParsePlaylist(radio.URL);

            if (Playlist != null && Playlist.Count > 0)
            {
                var firstTrack = Playlist.First();

                CurrentTrack = firstTrack;

                MediaElement.Source = new Uri(CurrentTrack.Source);

                Play();
            }
        }
Esempio n. 4
0
        static void Main(string[] args)
        {
            Dictionary <int, byte> map = new Dictionary <int, byte>
            {
                [0] = 0x0,
                [1] = 0x1
            };
            //map.Add(0, 0);
            //map.Add(1, 1);
            IConfiguration config = new ConfigurationBuilder()
                                    .AddJsonFile("config.json", true, false)
                                    .Build();
            var c = config.GetSection("rtl_tcp").Get <RadioConfig>();

            RadioConfig[] server = new RadioConfig[] { c };

            TCPReader reader = new TCPReader();
            var       node   = reader.Chain(new SignalPreProcessor()
            {
                IQOutput = IQOutputEnum.IChannel
            })
                               .Chain(new IQ2Wave(c.Frequency, c.SampleRate))
                               .Chain(new LPF(c.Frequency, c.SampleRate, 1000f))
                               .Chain(new MoveAverage())
                               .Chain(new SignalCompare(0.2f))
                               .Chain(new SampleCounter())
                               .Chain(new SignalToByteArray(map, SIGNAL_LENGTH))
                               .Chain(new MorseDecode())
                               .Chain(new SignalReverse())
                               .Chain(new MisolWeatherStationDecoder())
                               .Chain(new MQTTSink(config.GetSection("mqtt")?.Get <MQTTConfig>()))
                               .Chain(new IoTHubDeviceSink(config.GetSection("iothub_device")?.Get <IoTHubDeviceSinkConfig>()))
            ;

            reader.Start(server, cts.Token);
            Console.WriteLine("Application Started, Press Enter to exit");
            Console.ReadLine();
            cts.Cancel();
            Console.WriteLine("waiting for threads exit...");
            PipelineManager.Default.WaitAllExit();
            Console.WriteLine("done");
            Environment.Exit(0);
        }
Esempio n. 5
0
 public void Play(RadioConfig r)
 {
     RadioName = r.Name;
     _mediaControl.Play(new Uri(r.URL));
 }