use of android.bluetooth.le.ScanFilter in project android_wear_for_ios by shiitakeo.
the class MusicControlActivity method create_scan_filter.
@TargetApi(21)
private List<ScanFilter> create_scan_filter() {
// ScanFilter filter = new ScanFilter.Builder().setServiceUuid(ParcelUuid.fromString(service_ancs)).build();
ScanFilter filter = new ScanFilter.Builder().setServiceUuid(ParcelUuid.fromString(service_ams)).build();
List<ScanFilter> list = new ArrayList<ScanFilter>(1);
list.add(filter);
return list;
}
use of android.bluetooth.le.ScanFilter in project platform_frameworks_base by android.
the class ScanFilterTest method testReadWriteParcelForFilter.
private void testReadWriteParcelForFilter(ScanFilter filter) {
Parcel parcel = Parcel.obtain();
filter.writeToParcel(parcel, 0);
parcel.setDataPosition(0);
ScanFilter filterFromParcel = ScanFilter.CREATOR.createFromParcel(parcel);
assertEquals(filter, filterFromParcel);
}
use of android.bluetooth.le.ScanFilter in project platform_frameworks_base by android.
the class ScanFilterTest method testsetNameFilter.
@SmallTest
public void testsetNameFilter() {
ScanFilter filter = mFilterBuilder.setDeviceName("Ped").build();
assertTrue("setName filter fails", filter.matches(mScanResult));
filter = mFilterBuilder.setDeviceName("Pem").build();
assertFalse("setName filter fails", filter.matches(mScanResult));
}
use of android.bluetooth.le.ScanFilter in project platform_frameworks_base by android.
the class ScanFilterTest method testManufacturerSpecificData.
@SmallTest
public void testManufacturerSpecificData() {
byte[] setManufacturerData = new byte[] { 0x02, 0x15 };
int manufacturerId = 0xE0;
ScanFilter filter = mFilterBuilder.setManufacturerData(manufacturerId, setManufacturerData).build();
assertTrue("manufacturer data filter fails", filter.matches(mScanResult));
byte[] emptyData = new byte[0];
filter = mFilterBuilder.setManufacturerData(manufacturerId, emptyData).build();
assertTrue("manufacturer data filter fails", filter.matches(mScanResult));
byte[] prefixData = new byte[] { 0x02 };
filter = mFilterBuilder.setManufacturerData(manufacturerId, prefixData).build();
assertTrue("manufacturer data filter fails", filter.matches(mScanResult));
// Test data mask
byte[] nonMatchData = new byte[] { 0x02, 0x14 };
filter = mFilterBuilder.setManufacturerData(manufacturerId, nonMatchData).build();
assertFalse("manufacturer data filter fails", filter.matches(mScanResult));
byte[] mask = new byte[] { (byte) 0xFF, (byte) 0x00 };
filter = mFilterBuilder.setManufacturerData(manufacturerId, nonMatchData, mask).build();
assertTrue("partial setManufacturerData filter fails", filter.matches(mScanResult));
}
use of android.bluetooth.le.ScanFilter in project android_frameworks_base by DirtyUnicorns.
the class ScanFilterTest method testReadWriteParcelForFilter.
private void testReadWriteParcelForFilter(ScanFilter filter) {
Parcel parcel = Parcel.obtain();
filter.writeToParcel(parcel, 0);
parcel.setDataPosition(0);
ScanFilter filterFromParcel = ScanFilter.CREATOR.createFromParcel(parcel);
assertEquals(filter, filterFromParcel);
}
Aggregations