Ejemplo n.º 1
0
 private void setConnectionParameters() {
   // Make sure connection interval is long enough for OAD
   byte[] value = {
     Conversion.loUint16(OAD_CONN_INTERVAL),
     Conversion.hiUint16(OAD_CONN_INTERVAL),
     Conversion.loUint16(OAD_CONN_INTERVAL),
     Conversion.hiUint16(OAD_CONN_INTERVAL),
     0,
     0,
     Conversion.loUint16(OAD_SUPERVISION_TIMEOUT),
     Conversion.hiUint16(OAD_SUPERVISION_TIMEOUT)
   };
   mCharConnReq.setValue(value);
   boolean ok = mLeService.writeCharacteristic(mCharConnReq);
   if (ok) ok = mLeService.waitIdle(GATT_WRITE_TIMEOUT);
 }
Ejemplo n.º 2
0
 private boolean enableNotification(BluetoothGattCharacteristic c, boolean enable) {
   boolean ok = mLeService.setCharacteristicNotification(c, enable);
   if (ok) ok = mLeService.waitIdle(GATT_WRITE_TIMEOUT);
   return ok;
 }
Ejemplo n.º 3
0
 private boolean writeCharacteristic(BluetoothGattCharacteristic c, byte v) {
   boolean ok = mLeService.writeCharacteristic(c, v);
   if (ok) ok = mLeService.waitIdle(GATT_WRITE_TIMEOUT);
   return ok;
 }