protected void ReadCompleted(IAsyncResult iResult) { byte[] arrBuff = (byte[])iResult.AsyncState; try { m_oFile.EndRead(iResult); try { InputReport oInRep = CreateInputReport(); oInRep.SetData(arrBuff); HandleDataReceived(oInRep); } finally { BeginAsyncRead(); } } catch (IOException) // Device removed { HandleDeviceRemoved(); if (OnDeviceRemoved != null) { OnDeviceRemoved(this, new EventArgs()); } Dispose(); } }
protected override void HandleDataReceived(InputReport oInRep) { if (DataRecieved != null) { SpecifiedInputReport report = (SpecifiedInputReport)oInRep; DataRecieved(this, new DataRecievedEventArgs(report.Data)); } }
protected virtual void HandleDataReceived(InputReport oInRep) { }