Beispiel #1
0
 private void OutStringData(string args)
 {
     lock (this)
     {
         LogObjectValue?.Invoke("PortDataReceivedEventArgs", args);
         SetLinesState(args);
     }
 }
 void ActivePort_PortDataReceived(PortDataReceivedEventArgs args)
 {
     lock (this)
     {
         LogObjectValue?.Invoke("PortDataReceivedEventArgs", args);
         SetLinesState(args.Data as string);
     }
 }
Beispiel #3
0
 private void _activePort_AllRecDataReceive(TildaCIDHID.Public.CalllogDetail callogdetail, object mysender)
 {
     lock (this)
     {
         LogObjectValue?.Invoke("PortDataReceivedEventArgs", callogdetail.sUpdateFileds);
         SetLinesState(callogdetail);
     }
 }
        public void StartMonitoring(string port, string baudRate, IntPtr handle = default(IntPtr))
        {
            if (ActivePort == null)
            {
                return;
            }

            _activePort.PortDataReceived += ActivePort_PortDataReceived;
            LogObjectValue?.Invoke("ActivePort", ActivePort);
            LogStringValue?.Invoke("Port", port);
            LogStringValue?.Invoke("BaudRate", baudRate);
            _activePort.LogObjectValue += delegate(string title, object value) { LogObjectValue?.Invoke(title, value); };
            ActivePort.StartListenning(port, baudRate);
            LogMessageValue?.Invoke("Monitoring Started Successfully!");
        }
 public void StopListenning()
 {
     try
     {
         if (!IsOpen)
         {
             return;
         }
         DataReceived -= SerialPortDataReceived;
         Close();
     }
     catch (Exception ex)
     {
         LogObjectValue?.Invoke("StopListenning Ex", ex);
     }
 }
 private void SerialPortDataReceived(object sender, SerialDataReceivedEventArgs e)
 {
     try
     {
         LogObjectValue?.Invoke("SerialDataReceivedEventArgs", e);
         if (PortDataReceived == null)
         {
             return;
         }
         var args = new PortDataReceivedEventArgs(PortName, "Serial", ReadExisting());
         LogObjectValue?.Invoke("Received Data", args);
         PortDataReceived(args);
     }
     catch (Exception ex)
     {
         LogObjectValue?.Invoke("SerialPortDataReceived Ex", ex);
     }
 }
 public void StartListenning(string port, string baudRate)
 {
     LogObjectValue?.Invoke("StartListening!", "");
     try
     {
         if (IsOpen)
         {
             return;
         }
         DataReceived += SerialPortDataReceived;
         PortName      = port;
         BaudRate      = Convert.ToInt32(baudRate);
         Open();
     }
     catch (Exception ex)
     {
         LogObjectValue?.Invoke("StartListenning Ex", ex);
     }
 }