Merge "Expose service changed event to application (2/3)"
This commit is contained in:
@@ -688,6 +688,31 @@ public final class BluetoothGatt implements BluetoothProfile {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Callback invoked when service changed event is received
|
||||||
|
* @hide
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public void onServiceChanged(String address) {
|
||||||
|
if (DBG) {
|
||||||
|
Log.d(TAG, "onServiceChanged() - Device=" + address);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!address.equals(mDevice.getAddress())) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
runOrQueueCallback(new Runnable() {
|
||||||
|
@Override
|
||||||
|
public void run() {
|
||||||
|
final BluetoothGattCallback callback = mCallback;
|
||||||
|
if (callback != null) {
|
||||||
|
callback.onServiceChanged(BluetoothGatt.this);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
/*package*/ BluetoothGatt(IBluetoothGatt iGatt, BluetoothDevice device,
|
/*package*/ BluetoothGatt(IBluetoothGatt iGatt, BluetoothDevice device,
|
||||||
|
|||||||
@@ -194,4 +194,17 @@ public abstract class BluetoothGattCallback {
|
|||||||
public void onConnectionUpdated(BluetoothGatt gatt, int interval, int latency, int timeout,
|
public void onConnectionUpdated(BluetoothGatt gatt, int interval, int latency, int timeout,
|
||||||
int status) {
|
int status) {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Callback indicating service changed event is received
|
||||||
|
*
|
||||||
|
* <p>Receiving this event means that the GATT database is out of sync with
|
||||||
|
* the remote device. {@link BluetoothGatt#discoverServices} should be
|
||||||
|
* called to re-discover the services.
|
||||||
|
*
|
||||||
|
* @param gatt GATT client involved
|
||||||
|
* @hide
|
||||||
|
*/
|
||||||
|
public void onServiceChanged(BluetoothGatt gatt) {
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user