Merge "Add support of advertising through standard instance.(1/4)" into lmp-sprout-dev
This commit is contained in:
@@ -464,7 +464,8 @@ public final class BluetoothAdapter {
|
||||
if (getState() != STATE_ON) {
|
||||
return null;
|
||||
}
|
||||
if (!isMultipleAdvertisementSupported()) {
|
||||
if (!isMultipleAdvertisementSupported() && !isPeripheralModeSupported()) {
|
||||
Log.e(TAG, "bluetooth le advertising not supported");
|
||||
return null;
|
||||
}
|
||||
synchronized(mLock) {
|
||||
@@ -916,6 +917,21 @@ public final class BluetoothAdapter {
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns whether peripheral mode is supported.
|
||||
*
|
||||
* @hide
|
||||
*/
|
||||
public boolean isPeripheralModeSupported() {
|
||||
if (getState() != STATE_ON) return false;
|
||||
try {
|
||||
return mService.isPeripheralModeSupported();
|
||||
} catch (RemoteException e) {
|
||||
Log.e(TAG, "failed to get peripheral mode capability: ", e);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return true if offloaded filters are supported
|
||||
*
|
||||
|
||||
@@ -92,6 +92,7 @@ interface IBluetooth
|
||||
boolean configHciSnoopLog(boolean enable);
|
||||
|
||||
boolean isMultiAdvertisementSupported();
|
||||
boolean isPeripheralModeSupported();
|
||||
boolean isOffloadedFilteringSupported();
|
||||
boolean isOffloadedScanBatchingSupported();
|
||||
boolean isActivityAndEnergyReportingSupported();
|
||||
|
||||
@@ -111,7 +111,8 @@ public final class BluetoothLeAdvertiser {
|
||||
if (callback == null) {
|
||||
throw new IllegalArgumentException("callback cannot be null");
|
||||
}
|
||||
if (!mBluetoothAdapter.isMultipleAdvertisementSupported()) {
|
||||
if (!mBluetoothAdapter.isMultipleAdvertisementSupported() &&
|
||||
!mBluetoothAdapter.isPeripheralModeSupported()) {
|
||||
postStartFailure(callback,
|
||||
AdvertiseCallback.ADVERTISE_FAILED_FEATURE_UNSUPPORTED);
|
||||
return;
|
||||
|
||||
Reference in New Issue
Block a user