コード例 #1
0
 /// <summary>
 /// Sự kiện phát sinh khi có dữ liệu được gửi đến từ client
 /// </summary>
 /// <param name="dataHeader">Thông tin kết nối</param>
 /// <param name="data">dữ liệu nhận được</param>
 public override void OnIncommingData(DataHeader dataHeader, byte[] data)
 {
     try
     {
         BaseDevice baseDevice = GetDevice(string.Format("{0}:{1}", dataHeader.ClientIP, dataHeader.ClientPort));
         if (baseDevice != null)
         {
             baseDevice.RaiseEventIncommingData(data);
         }
     }
     catch (Exception ex)
     {
         Log.Error("Error while raise 'OnIncommingData' {0}", ex.ToString());
     }
 }
コード例 #2
0
ファイル: LablinkRs232.cs プロジェクト: vunb/CoreServicesNew
        public override void OnIncommingData(DataReceiveRs232 obj)
        {
            try
            {
                string     deviceConnector = obj.Port.PortName;
                BaseDevice device          = GetDevice(deviceConnector);

                //Nếu không tồn tại thiết bị nào ghi lại log.
                if (device == null)
                {
                    Log.Debug("Could not load any devcie on {0}", deviceConnector);
                }
                else
                {
                    //Nếu tồn tại thiết bị thì phát sinh sự kiện nhận được dữ liệu
                    device.RaiseEventIncommingData(obj);
                }
            }
            catch (Exception ex)
            {
                Log.Error("Error in 'OnIncommingData' method. Error Message:{0}", ex);
                throw ex;
            }
        }