예제 #1
0
        private void button3_Click(object sender, EventArgs e)
        {
            if (!(_serialPort.IsOpen))
            {
                // _serialPort.RtsEnable=true;
                // System.IO.Ports.SerialStream..ctor(String portName, Int32 baudRate, Parity parity, Int32 dataBits, StopBits stopBits, Int32 readTimeout, Int32 writeTimeout, Handshake handshake, Boolean dtrEnable, Boolean rtsEnable, Boolean discardNull, Byte parityReplace)
                // _serialPort.BaudRate = Convert.ToInt32(14400);


                _serialPort.Open();

                scpBus.PlugIn(1);
                timer3.Enabled     = true;
                button3.Text       = "Disconnect";
                button14.BackColor = Color.ForestGreen;
            }
            else
            {
                scpBus.Unplug(1);
                _serialPort.Close();
                timer3.Enabled     = false;
                timer1.Enabled     = false;
                timer2.Enabled     = false;
                button3.Text       = "Connect";
                button14.BackColor = Color.Red;
            }
        }
예제 #2
0
 public void unplug()
 {
     Running = false;
     rThread.Join();
     iThread.Join();
     ScpBus.Unplug(Index);
     Device.CloseDevice();
 }
예제 #3
0
        private static bool onExitHandler()
        {
            running = false;
            scpBus.Unplug(1);
            udpSocket.Close();
            networkThread.Join();
            displayThread.Join();

            return(false);
        }
예제 #4
0
        public static void SetGamepad(bool state)
        {
            scp.Unplug(gamepadIndex);
            scp     = new ScpBus();
            gamepad = new X360Controller();

            if (state)
            {
                scp.PlugIn(gamepadIndex);
            }
        }
예제 #5
0
        private void unplug_Click(object sender, EventArgs e)
        {
            bool result = _scpBus.Unplug((int)controllerNum.Value);

            status.Text = result.ToString();

            if (result)
            {
                _controller = new X360Controller();
                ResetControls();
            }
        }
예제 #6
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="message">PHONE_ID</param>
        private void UnplugController(string phoneId)
        {
            try
            {
                scpBus.Unplug(Controllers[phoneId]);
                Controllers.Remove(phoneId);
            }
            catch (Exception e)
            {
#if DEBUG
                MessageBox.Show(e.Message);
#endif
            }
        }
예제 #7
0
        private bool disposedValue = false; // To detect redundant calls

        protected virtual void Dispose(bool disposing)
        {
            if (!disposedValue)
            {
                if (disposing)
                {
                    sendThread.Dispose();
                    bus.Unplug(1);
                    bus.Dispose();
                }

                // TODO: free unmanaged resources (unmanaged objects) and override a finalizer below.
                // TODO: set large fields to null.

                disposedValue = true;
            }
        }
예제 #8
0
        public static void Stop(bool remove)
        {
            Form1.MainForm.ShowPresetControls();
            if (remove)
            {
                Input.RemoveKeyListener(OnKeyPress);
            }


            if (Form1.MainForm.InvokeRequired)
            {
                Form1.MainForm.Invoke(new Action(() => Form1.MainForm.ControllerModeButton.Text = "Start"));
            }
            else
            {
                Form1.MainForm.ControllerModeButton.Text = "Start";
            }

            m_Bus.Unplug(2);
            m_Stopwatch.Stop();
            m_bStopThread = true;
            m_Active      = false;
        }
예제 #9
0
 public static void OnProcessExit(object sender, EventArgs e)
 {
     scpbus.Unplug(CONTROLLER_NUMBER);
     Application.ExitThread();
 }
예제 #10
0
 public static bool DestroyJoystick(int joystickID)
 {
     scp.Unplug(joystickID);
     Controllers[joystickID - 1] = null;
     return(true);
 }