예제 #1
0
 public void Stop()
 {
     if (_poller != null)
     {
         _poller.Dispose();
     }
     if (_communication != null)
     {
         _communication.Close();
     }
     _connected = false;
     _poller    = null;
 }
 /// <summary>
 ///     Notifies the observer that the provider has finished sending push-based notifications.
 /// </summary>
 public void OnCompleted()
 {
     /*
      * Completion of the transaction pipeline means that the client has disconnected and there will be no more transactions.
      * In that case, we can safely close the communications channel.
      */
     channel.Close();
 }
예제 #3
0
 /// <summary>Notifies the observer that the provider has finished sending push-based notifications.</summary>
 public void OnCompleted()
 {
     /*
      * Completion of the transaction pipeline means that the client has disconnected and there will be no more transactions.
      * In that case, we can safely close the communications channel.
      */
     log.Info().Message("End of transaction sequence - closing channel").Write();
     channel.Close();
 }
예제 #4
0
 public void Close()
 {
     UnsubscribeControllerEvents();
     if (IsConnected)
     {
         stateMachine.SavePersistentSettings();
         channel.Close();
     }
 }
예제 #5
0
        public void Close()
        {
            running = false;

            if (serialChannel != null)
            {
                serialChannel.Close();
                serialChannel = null;
            }
        }
예제 #6
0
 public void Close()
 {
     log.Info().Message("Device Controller closing").Write();
     UnsubscribeControllerEvents();
     if (IsConnected)
     {
         connectedTimestamp = DateTime.MinValue;
         stateMachine.SavePersistentSettings();
         channel.Close();
     }
     log.Info().Message("Device Controller closed").Write();
 }
 /// <summary>
 ///     Destroys the transaction processor and its dependencies. Ensures that the
 ///     <see cref="Channel" /> is closed. Once this method has been called, the
 ///     <see cref="Channel" /> and <see cref="Endpoint" /> properties will be null. A new
 ///     connection to the same endpoint can be created by calling
 ///     <see cref="CreateTransactionProcessor" /> again.
 /// </summary>
 public void DestroyTransactionProcessor()
 {
     processor?.Dispose();
     processor = null; // [Sentinel]
     observer  = null;
     if (Channel?.IsOpen ?? false)
     {
         Channel.Close();
     }
     Channel?.Dispose();
     Channel = null; // [Sentinel]
     GC.Collect(3, GCCollectionMode.Forced, blocking: true);
 }
예제 #8
0
        private bool OnCommunicationChannelReceived(ICommunicationChannel communicationChannel, IPEndPoint remoteEndPoint, int receivedBytes)
        {
            // If no data was received, close the connection. This is a NORMAL
            // situation that shows when the client has finished sending data.
            if (receivedBytes == 0)
            {
                _log.Info($"ProcessReceive NO DATA from IP {communicationChannel.RemoteIPAddress}");

                communicationChannel.Close();

                return(false);
            }

            return(true);
        }
예제 #9
0
        public async Task Stop()
        {
            running = false;
            stopWatch.Stop();
            //commandsBufferBlock.Complete();
            actionBlock.Complete();

            Flush();

            await Task.Delay(100);

            // Notify users to clean up any devices
            // connected to the serial port if need be, before closing it.
            arduinoBrick.StoppingCommunication(serialChannel);

            if (serialChannel != null)
            {
                serialChannel.DiscardInBuffer();
                serialChannel.Close();
                serialChannel = null;
            }
        }
예제 #10
0
        public async Task Stop()
        {
            running = false;
            stopWatch.Stop();

            sem.Up();

            await Task.Delay(100);

            // Notify users to clean up any devices
            // connected to the serial port if need be, before closing it.
            element.StoppingCommunication(serialChannel);

            if (serialChannel != null)
            {
                // Clear receive buffer out, since the bootloader can send
                // some just characters, which might hose subsequent command responses:
                //serialPort.DiscardInBuffer();

                serialChannel.Close();
                serialChannel = null;
            }
        }
 /// <summary>
 /// Closes the specified channel.
 /// </summary>
 /// <param name="channel">The channel.</param>
 /// <param name="reason">The reason.</param>
 public override void Close(ICommunicationChannel channel, CloseReason reason)
 {
     channel.Close(reason);
 }
예제 #12
0
 /// <summary>
 /// Closes the specified channel.
 /// </summary>
 /// <param name="channel">The channel.</param>
 /// <param name="reason">The reason.</param>
 public override void Close(ICommunicationChannel channel, CloseReason reason)
 {
     channel.Close(reason);
 }
 public void Close()
 {
     UnsubscribeControllerEvents();
     channel.Close();
 }
예제 #14
0
        //
        // PUBLIC INTERFACE
        //


        public void Stop()
        {
            _poller.Dispose();
            _communication.Close();
            _connected = false;
        }