SHARE
TWEET

Untitled

a guest Jun 25th, 2019 50 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. @Override
  2. public void onDeviceData(BluetoothDevice device, byte[] data) {
  3.  
  4. }
  5.      
  6. class Callbacks : AndroidJavaProxy
  7. {
  8.     ConcurrentQueue<byte[]> IncomingMessages { get; private set; }
  9.  
  10.     public Callbacks()
  11.         : base("com.example.sdk.SdkCallbacks")
  12.     {
  13.         IncomingMessages = new ConcurrentQueue<byte[]>();
  14.     }
  15.  
  16.     void onDeviceData(AndroidJavaObject device, byte[] data)
  17.     {
  18.         IncomingMessages.Enqueue(data);
  19.     }
  20. }
  21.      
  22. while (!_device.IncomingMessages.IsEmpty)
  23. {
  24.     byte[] data;
  25.  
  26.     if (_device.IncomingMessages.TryDequeue(out data))
  27.     {
  28.         // do something with the data
  29.     }
  30. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top