title: Android Bluetooth Low Energy Getting response to specific request
body: <p>There's something I'm not quite getting with using Gatt to communicate with a BLE device.
  According to this:
  <a href="https://developer.android.com/reference/android/bluetooth/BluetoothDevice.html#connectGatt(android.content.Context,%20boolean,%20android.bluetooth.BluetoothGattCallback)" rel="nofollow noreferrer">https://developer.android.com/reference/android/bluetooth/BluetoothDevice.html#connectGatt(android.content.Context, boolean, android.bluetooth.BluetoothGattCallback)
  </a></p>
  <pre><code>BluetoothGatt gatt = device.connectGatt(context,true,new BluetoothGattCallback(){....})
  </code></pre>
  <p>I can connect to a BLE device and give it a callbacks object to be notified on stuff like onCharacteristicRead and onCharacteristicWrite</p>
  <p>What I'm not getting is how do which write corresponds to which read callback?</p>
  <p>This method signatures are:</p>
  <pre><code>public void onCharacteristicRead (BluetoothGatt gatt, BluetoothGattCharacteristic characteristic, int status)
  public void onCharacteristicWrite (BluetoothGatt gatt, BluetoothGattCharacteristic characteristic, int status)
  </code></pre>
  <p>so if I do:</p>
  <pre><code>BluetoothGattCharacteristic char = gatt.getService(UART_SERVICE_UUID).getCharacteristic(UART_TX_CHARACTERISTIC_UUID);
  char1.setValue(&quot;command1&quot;);
  gatt.writeCharacteristic(char);
  char1.setValue(&quot;command2&quot;);
  gatt.writeCharacteristic(char);
  </code></pre>
  <p>in the onCharacteristicRead callback, how do I know if the characteristic.getStringValue() is for command1 or command2?</p>
  <p>Thanks!</p>