am 1602b0f8: am 3f0aa505: am 34020eb6: Merge "Add support of advertising through standard instance.(1/4)" into lmp-sprout-dev
* commit '1602b0f8d0ccbdedb5406a5d427c777c5d8b39b5': Add support of advertising through standard instance.(1/4)
This commit is contained in:
@@ -464,7 +464,8 @@ public final class BluetoothAdapter {
|
|||||||
if (getState() != STATE_ON) {
|
if (getState() != STATE_ON) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
if (!isMultipleAdvertisementSupported()) {
|
if (!isMultipleAdvertisementSupported() && !isPeripheralModeSupported()) {
|
||||||
|
Log.e(TAG, "bluetooth le advertising not supported");
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
synchronized(mLock) {
|
synchronized(mLock) {
|
||||||
@@ -916,6 +917,21 @@ public final class BluetoothAdapter {
|
|||||||
return false;
|
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
|
* Return true if offloaded filters are supported
|
||||||
*
|
*
|
||||||
|
|||||||
@@ -92,6 +92,7 @@ interface IBluetooth
|
|||||||
boolean configHciSnoopLog(boolean enable);
|
boolean configHciSnoopLog(boolean enable);
|
||||||
|
|
||||||
boolean isMultiAdvertisementSupported();
|
boolean isMultiAdvertisementSupported();
|
||||||
|
boolean isPeripheralModeSupported();
|
||||||
boolean isOffloadedFilteringSupported();
|
boolean isOffloadedFilteringSupported();
|
||||||
boolean isOffloadedScanBatchingSupported();
|
boolean isOffloadedScanBatchingSupported();
|
||||||
boolean isActivityAndEnergyReportingSupported();
|
boolean isActivityAndEnergyReportingSupported();
|
||||||
|
|||||||
@@ -111,7 +111,8 @@ public final class BluetoothLeAdvertiser {
|
|||||||
if (callback == null) {
|
if (callback == null) {
|
||||||
throw new IllegalArgumentException("callback cannot be null");
|
throw new IllegalArgumentException("callback cannot be null");
|
||||||
}
|
}
|
||||||
if (!mBluetoothAdapter.isMultipleAdvertisementSupported()) {
|
if (!mBluetoothAdapter.isMultipleAdvertisementSupported() &&
|
||||||
|
!mBluetoothAdapter.isPeripheralModeSupported()) {
|
||||||
postStartFailure(callback,
|
postStartFailure(callback,
|
||||||
AdvertiseCallback.ADVERTISE_FAILED_FEATURE_UNSUPPORTED);
|
AdvertiseCallback.ADVERTISE_FAILED_FEATURE_UNSUPPORTED);
|
||||||
return;
|
return;
|
||||||
|
|||||||
Reference in New Issue
Block a user