예제 #1
0
        public void BareLinkNotConnected()
        {
            var link = new SiKInterface();

            Assert.IsFalse(link.CommandMode);
            Assert.IsFalse(link.PortConnected);
        }
예제 #2
0
        /// <summary>
        /// Populate Drop Down with Serial Port names.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void SerialPort_DropDownOpened(object sender, EventArgs e)
        {
            SerialPort.Items.Clear();

            foreach (var item in SiKInterface.GetSerialPorts())
            {
                SerialPort.Items.Add(item);
            }
        }
예제 #3
0
        public MainWindow()
        {
            InitializeComponent();

            Height             = SMALLWNDHEIGHT;
            RssiFig.Visibility = Visibility.Collapsed;

            SerialPort.DropDownOpened += SerialPort_DropDownOpened;

            foreach (var item in SiKInterface.GetSerialPorts())
            {
                SerialPort.Items.Add(item);
            }

            foreach (var item in Helpers.SerialRates)
            {
                SerialSpeed.Items.Add(item);
            }

            SerialSpeed.SelectedItem = 57600;

            foreach (var item in SiKLink.Constants.SiKSerialRates)
            {
                SiKSerialSpeed.Items.Add(item);
            }

            foreach (var item in Helpers.MavVersions)
            {
                MavlinkFrame.Items.Add(item);
            }

            foreach (var item in SiKLink.Constants.AirPower)
            {
                AirPower.Items.Add(item);
            }

            foreach (var item in Enumerable.Range(1, 100))
            {
                DutyCycle.Items.Add(item);
            }

            foreach (var item in Enumerable.Range(0, 255))
            {
                LbtRssi.Items.Add(item);
            }

            foreach (var item in Enumerable.Range(33, 99))
            {
                MaxWnd.Items.Add(item);
            }

            DataContext = _sikInterface.SiKConfig;
        }
예제 #4
0
        private void PopulateSerialPortCombo()
        {
            var ports = SiKInterface.GetSerialPorts();

            ports.Add("<refresh>");

            _portNameCombo.RemoveAll();
            foreach (var pname in ports)
            {
                _portNameCombo.PrependText(pname);
            }
        }
예제 #5
0
        public MainWindow() : base(WindowType.Toplevel)
        {
            // Setup GUI
            WindowPosition = WindowPosition.Center;
            DefaultSize    = new Gdk.Size(600, 300);

            var provider = new CssProvider();

            provider.LoadFromData(".blue-background { background-image: none; background-color: rgb(240, 248, 255); }");
            Gtk.StyleContext.AddProviderForScreen(Gdk.Screen.Default, provider, 1);


            _sikInterface = new SiKInterface();

            _headerBar = new HeaderBar();
            _headerBar.ShowCloseButton = true;
            _headerBar.Title           = "SiK Radio Configurator";

            _boardIdentifiers  = new BoardIdentifierControls();
            _dataTableControls = new DataTableControls();
            _sikInterface.SiKConfig.PropertyChanged += _boardIdentifiers.SiKConfig_PropertyChanged;
            _dataTableControls.CreateBindings(_sikInterface.SiKConfig);

            _pageLabel = new Label(NOT_CONN_LBL);

            Titlebar   = _headerBar;
            Destroyed += (sender, e) => Application.Quit();

            _notebook      = new Notebook();
            _pageContainer = new Box(Orientation.Vertical, 1);
            _notebook.AppendPage(_pageContainer, _pageLabel);
            _notebook.AppendPage(new Box(Orientation.Vertical, 5), new Label("TBD"));

            Add(_notebook);

            CreatePortSelLine();
            CreateDataTable();
            CreateBoardIdLine();
            CreateButtonsLine();

            // TODO: Fix Statusbar at the bottom
            _statusBar = new Statusbar();
            _pageContainer.Add(_statusBar);
            _cxt = _statusBar.GetContextId("Main page");

            ShowAll();
        }