Example #1
0
 private void setLine(int line, int mode)
 {
     if (controller != null && controller.connected)
     {
         controller.setLineMode(line, mode);
     }
 }
Example #2
0
        private void TerminalJControllerConnected(object sender, EventArgs e)
        {
            Invoke((MethodInvoker) delegate()
            {
                cbConnectTerminal.Checked = true;
                cbConnectTerminal.Image   = JeromeControl.Properties.Resources.icon_connected;
                fStatus.pTerminalStatus.BackgroundImage = JeromeControl.Properties.Resources.icon_connected;
            });
            foreach (WX0BTerminalSwitchTemplate st in TerminalTemplate.switches)
            {
                terminalJConnection.setLineMode(st.button, 1);
                terminalJConnection.setLineMode(st.led, 0);
            }
            terminalJConnection.setLineMode(TerminalTemplate.pttLED, 0);
            terminalJConnection.setLineMode(TerminalTemplate.lockLED, 0);
            terminalJConnection.setLineMode(TerminalTemplate.pttButton, 1);
            terminalJConnection.setLineMode(TerminalTemplate.lockButton, 1);
            displayActiveSwitch();
            displayLockSwitch();
            displayPTT();
            WX0BTerminalSwitch s = tx ? lockSwitch : activeSwitch;

            if (terminalJConnection.connected)
            {
                foreach (WX0BTerminalSwitchTemplate st in TerminalTemplate.switches)
                {
                    terminalJConnection.switchLine(st.led, switches[st] == s ? 1 : 0);
                }
            }
        }
Example #3
0
        protected void controllerConnected(object sender, EventArgs e)
        {
            bool senderFound = false;
            KeyValuePair <JeromeConnectionParams, JeromeConnectionState> senderEntry =
                connections.FirstOrDefault(x => x.Value.controller == sender && (senderFound = true));

            if (!senderFound)
            {
                return;
            }
            JeromeConnectionParams cp = senderEntry.Key;

            this.Invoke((MethodInvoker) delegate
            {
                connections[cp].watch   = false;
                menuControl[cp].Checked = true;
                this.Text = cp.name;
                updateButtonsMode();
            });
            JeromeController controller = connections[cp].controller;
            string           linesState = controller.readlines();

            controller.setLineMode(controllerTemplate.dir, 0);
            controller.setLineMode(controllerTemplate.pulse, 0);
            controller.setLineMode(controllerTemplate.enable, 0);
            controller.setLineMode(controllerTemplate.ptt, 0);
            controller.switchLine(controllerTemplate.enable, 1);
            controller.switchLine(controllerTemplate.pulse, 0);
            controller.switchLine(controllerTemplate.ptt, 0);
            for (int co = 0; co < controllerTemplate.relays.Length; co++)
            {
                controller.setLineMode(controllerTemplate.relays[co], 0);
                controller.switchLine(controllerTemplate.relays[co], 0);
            }
            foreach (int line in controllerTemplate.limits.Values)
            {
                controller.setLineMode(line, 1);
            }
            controller.lineStateChanged += controllerLineStateChanged;
            if (linesState[controllerTemplate.limits[-1] - 1] == '0')
            {
                limit = -1;
            }
            else if (linesState[controllerTemplate.limits[1] - 1] == '0')
            {
                limit = 1;
            }
            if (position == -1)
            {
                rotate(0);
            }
        }