/// <summary> /// /// </summary> public virtual void OnCharacteristicChanged(BluetoothGatt gatt, BluetoothGattCharacteristic characteristic) { //Log.i("BleSerialPort","OnCharacteristicChanged"); m_BufferRead = characteristic.GetValue(); m_SizeRead = m_BufferRead.Length; if (m_ReadCallback != null) { m_ReadCallback.OnStreamRead(this); } else { //Log.e("BleSerialPort","m_ReadCallback==null"); } //m_Buffer=null; }
/// <summary> /// /// </summary> protected virtual int ReadThread( System.IntPtr lpThreadParameter ) { int tId = ++m_TId; while (tId == m_TId) { m_SizeRead = m_Sp.Read(m_BufferRead, 0, m_MaxRead); //Log.i("WinSerialPort",tId.ToString()); if (m_ReadCallback != null) { m_ReadCallback.OnStreamRead(this); } } Log.i("WinSerialPort", "Abort the SerialPort read thread...."); return(0); }
/// <summary> /// /// </summary> public virtual void OnStreamRead(byte[] buffer, int offset) { if (m_Offset == -1) { return; } // m_Buffer = buffer; m_BaseOffset = offset; //Log.i("VirtualStream",(m_BaseOffset + m_Offset)+"/"+ m_Buffer.Length + "/"+m_Count); // if (m_ReadCallback != null) { m_ReadCallback.OnStreamRead(this); } // m_Buffer = null; m_BaseOffset = -1; }