예제 #1
0
        public void Close()
        {
            switch (ConnectionMode)
            {
            case Mode.SocketMode:
                mSocket.Close();
                mSocket = null;
                break;

            case Mode.SerialMode:
                mSerialPort.Close();
                mSerialPort = null;
                Running     = false;
                break;

            case Mode.PipeMode:
                if (mNamedPipe != null)
                {
                    mNamedPipe.Close();
                    mNamedPipe = null;
                }
                Running = false;

                break;
            }

            mMedium = null;
            if (mKdb != null)
            {
                mKdb.Close();
            }
            mKdb           = null;
            ConnectionMode = Mode.ClosedMode;
        }
예제 #2
0
 void NamedPipe_ClientConnectedEvent(object sender, EventArgs e)
 {
     mKdb    = new KDBG(mNamedPipe);
     Running = true;
     ConnectEventHandlers();
     /* retrieve input seperate thread */
     ReadThread = new Thread(mNamedPipe.ReadLoop);
     ReadThread.Start();
     WriteThread = new Thread(mNamedPipe.WriteLoop);
     WriteThread.Start();
 }
예제 #3
0
        public void Close()
        {
            switch (ConnectionMode)
            {
            case Mode.SocketMode:
                mSocket.Close();
                mSocket = null;
                break;
            }

            mMedium = null;
            if (mKdb != null)
            {
                mKdb.Close();
            }
            mKdb           = null;
            ConnectionMode = Mode.ClosedMode;
        }
예제 #4
0
 void SocketConnectCompleted(object sender, SocketAsyncEventArgs e)
 {
     if (mAsyncConnect.SocketError == SocketError.Success)
     {
         mMedium = new SocketPipe(mSocket);
         mMedium.PipeErrorEvent   += MediumErrorEvent;
         mMedium.PipeReceiveEvent += PipeReceiveEvent;
         mKdb = new KDBG(mMedium);
         ConnectEventHandlers();
         Running = true;
         if (DebugConnectionConnectedEvent != null)
         {
             DebugConnectionConnectedEvent(this, new DebugConnectedEventArgs());
         }
     }
     else
     {
         Close();
     }
 }
예제 #5
0
 void SocketConnectCompleted(object sender, SocketAsyncEventArgs e)
 {
     if (mAsyncConnect.SocketError == SocketError.Success)
     {
         mMedium = new SocketPipe(mSocket);
         mMedium.PipeErrorEvent   += MediumError;
         mMedium.PipeReceiveEvent += PipeReceiveEvent;
         mKdb = new KDBG(mMedium);
         mKdb.RegisterChangeEvent += RegisterChangeEvent;
         mKdb.ModuleListEvent     += ModuleListEvent;
         mKdb.MemoryUpdateEvent   += MemoryUpdateEvent;
         Running = true;
         if (DebugConnectionConnectedEvent != null)
         {
             DebugConnectionConnectedEvent(this, new DebugConnectedEventArgs());
         }
     }
     else
     {
         Close();
     }
 }
예제 #6
0
 public void StartSerial(string port, int baudrate)
 {
     Close();
     ConnectionMode        = Mode.SerialMode;
     mSerialPort           = new SerialPort(port, baudrate, Parity.None, 8, StopBits.One);
     mSerialPort.Handshake = Handshake.None;
     try
     {
         //opening could fail for occupied, not existing or misconfigured ports
         mSerialPort.Open();
         //create pipe and kdb instances, connect internal receive pipe
         mMedium = new SerialPipe(mSerialPort);
         mMedium.PipeReceiveEvent += PipeReceiveEvent;
         mMedium.PipeErrorEvent   += MediumErrorEvent;
         mKdb = new KDBG(mMedium);
         ConnectEventHandlers();
         Running = true;
     }
     catch (Exception ex)
     {
         ConnectionMode = Mode.ClosedMode;
         //error signal?
     }
 }
 void SocketConnectCompleted(object sender, SocketAsyncEventArgs e)
 {
     if (mAsyncConnect.SocketError == SocketError.Success)
     {
         mMedium = new SocketPipe(mSocket);
         mMedium.PipeErrorEvent += MediumError;
         mMedium.PipeReceiveEvent += PipeReceiveEvent;
         mKdb = new KDBG(mMedium);
         mKdb.RegisterChangeEvent += RegisterChangeEvent;
         mKdb.ModuleListEvent += ModuleListEvent;
         mKdb.MemoryUpdateEvent += MemoryUpdateEvent;
         Running = true;
         if (DebugConnectionConnectedEvent != null)
             DebugConnectionConnectedEvent(this, new DebugConnectedEventArgs());
     }
     else
         Close();
 }
        public void Close()
        {
            switch (ConnectionMode)
            {
                case Mode.SocketMode:
                    mSocket.Close();
                    mSocket = null;
                    break;
            }

            mMedium = null;
            if (mKdb != null)
                mKdb.Close();
            mKdb = null;
            ConnectionMode = Mode.ClosedMode;
        }