Merge "Expose LE advertiser address for easier PTS tests (1/6)"
This commit is contained in:
@@ -56,6 +56,7 @@ interface IBluetoothGatt {
|
|||||||
in IAdvertisingSetCallback callback);
|
in IAdvertisingSetCallback callback);
|
||||||
void stopAdvertisingSet(in IAdvertisingSetCallback callback);
|
void stopAdvertisingSet(in IAdvertisingSetCallback callback);
|
||||||
|
|
||||||
|
void getOwnAddress(in int advertiserId);
|
||||||
void enableAdvertisingSet(in int advertiserId, in boolean enable, in int duration, in int maxExtAdvEvents);
|
void enableAdvertisingSet(in int advertiserId, in boolean enable, in int duration, in int maxExtAdvEvents);
|
||||||
void setAdvertisingData(in int advertiserId, in AdvertiseData data);
|
void setAdvertisingData(in int advertiserId, in AdvertiseData data);
|
||||||
void setScanResponseData(in int advertiserId, in AdvertiseData data);
|
void setScanResponseData(in int advertiserId, in AdvertiseData data);
|
||||||
|
|||||||
@@ -181,7 +181,23 @@ public final class AdvertisingSet {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns advertiserId associated with thsi advertising set.
|
* Returns address associated with this advertising set.
|
||||||
|
* This method is exposed only for Bluetooth PTS tests, no app or system service
|
||||||
|
* should ever use it.
|
||||||
|
*
|
||||||
|
* This method requires {@link android.Manifest.permission#BLUETOOTH_PRIVILEGED} permission.
|
||||||
|
* @hide
|
||||||
|
*/
|
||||||
|
public void getOwnAddress(){
|
||||||
|
try {
|
||||||
|
gatt.getOwnAddress(this.advertiserId);
|
||||||
|
} catch (RemoteException e) {
|
||||||
|
Log.e(TAG, "remote exception - ", e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns advertiserId associated with this advertising set.
|
||||||
*
|
*
|
||||||
* @hide
|
* @hide
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -143,4 +143,15 @@ public abstract class AdvertisingSetCallback {
|
|||||||
*/
|
*/
|
||||||
public void onPeriodicAdvertisingEnabled(AdvertisingSet advertisingSet, boolean enable,
|
public void onPeriodicAdvertisingEnabled(AdvertisingSet advertisingSet, boolean enable,
|
||||||
int status) {}
|
int status) {}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Callback triggered in response to {@link AdvertisingSet#getOwnAddress()}
|
||||||
|
* indicating result of the operation.
|
||||||
|
*
|
||||||
|
* @param advertisingSet The advertising set.
|
||||||
|
* @param addressType type of address.
|
||||||
|
* @param address advertising set bluetooth address.
|
||||||
|
* @hide
|
||||||
|
*/
|
||||||
|
public void onOwnAddressRead(AdvertisingSet advertisingSet, int addressType, String address) {}
|
||||||
}
|
}
|
||||||
@@ -544,6 +544,17 @@ public final class BluetoothLeAdvertiser {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onOwnAddressRead(int advertiserId, int addressType, String address) {
|
||||||
|
handler.post(new Runnable() {
|
||||||
|
@Override
|
||||||
|
public void run() {
|
||||||
|
AdvertisingSet advertisingSet = mAdvertisingSets.get(advertiserId);
|
||||||
|
callback.onOwnAddressRead(advertisingSet, addressType, address);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onAdvertisingSetStopped(int advertiserId) {
|
public void onAdvertisingSetStopped(int advertiserId) {
|
||||||
handler.post(new Runnable() {
|
handler.post(new Runnable() {
|
||||||
|
|||||||
@@ -21,6 +21,7 @@ package android.bluetooth.le;
|
|||||||
*/
|
*/
|
||||||
oneway interface IAdvertisingSetCallback {
|
oneway interface IAdvertisingSetCallback {
|
||||||
void onAdvertisingSetStarted(in int advertiserId, in int tx_power, in int status);
|
void onAdvertisingSetStarted(in int advertiserId, in int tx_power, in int status);
|
||||||
|
void onOwnAddressRead(in int advertiserId, in int addressType, in String address);
|
||||||
void onAdvertisingSetStopped(in int advertiserId);
|
void onAdvertisingSetStopped(in int advertiserId);
|
||||||
void onAdvertisingEnabled(in int advertiserId, in boolean enable, in int status);
|
void onAdvertisingEnabled(in int advertiserId, in boolean enable, in int status);
|
||||||
void onAdvertisingDataSet(in int advertiserId, in int status);
|
void onAdvertisingDataSet(in int advertiserId, in int status);
|
||||||
|
|||||||
Reference in New Issue
Block a user