Exemplo n.º 1
0
 public void Close()
 {
     if (!IsOpen)
     {
         throw new InvalidOperationException("The port is not open.");
     }
     SerialPortAgent.Close();
 }
Exemplo n.º 2
0
        public void Dispose()
        {
            if (SerialPortAgent == null)
            {
                return;
            }

            if (SerialPortAgent.IsOpen)
            {
                Close();
            }

            SerialPortAgent.Dispose();
        }
Exemplo n.º 3
0
        public void Open(Transport configuration)
        {
            if (IsOpen)
            {
                throw new InvalidOperationException("The port is already open.");
            }
            if (SerialPortAgent != null)
            {
                SerialPortAgent.Dispose();
                SerialPortAgent = null;
            }

            SerialPortAgent = new SerialPortAgent(configuration);
            Open();
        }
Exemplo n.º 4
0
 public void Open()
 {
     if (IsOpen)
     {
         throw new InvalidOperationException("The port is already open.");
     }
     SerialPortAgent.ScanEvent += ScanEvent;
     SerialPortAgent.ScanConfirmationNotreceivedEvent += ScanConfirmationNotreceivedEvent;
     SerialPortAgent.ButtonPressedEvent += ButtonPressedEvent;
     SerialPortAgent.ButtonConfirmationNotreceivedEvent += ButtonConfirmationNotreceivedEvent;
     SerialPortAgent.SignalChangedEvent     += SignalChangedEvent;
     SerialPortAgent.ConnectionChangedEvent += ConnectionChangedEvent;
     SerialPortAgent.MessageEvent           += MessageEvent;
     SerialPortAgent.ConfigurationEvent     += ConfigurationEvent;
     SerialPortAgent.Open();
 }