Merge "Add implementation for IRK to parcelable functions."
This commit is contained in:
@@ -168,6 +168,15 @@ public final class ScanFilter implements Parcelable {
|
|||||||
dest.writeByteArray(mManufacturerDataMask);
|
dest.writeByteArray(mManufacturerDataMask);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// IRK
|
||||||
|
if (mDeviceAddress != null) {
|
||||||
|
dest.writeInt(mAddressType);
|
||||||
|
dest.writeInt(mIrk == null ? 0 : 1);
|
||||||
|
if (mIrk != null) {
|
||||||
|
dest.writeByteArray(mIrk);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -187,8 +196,10 @@ public final class ScanFilter implements Parcelable {
|
|||||||
if (in.readInt() == 1) {
|
if (in.readInt() == 1) {
|
||||||
builder.setDeviceName(in.readString());
|
builder.setDeviceName(in.readString());
|
||||||
}
|
}
|
||||||
|
String address = null;
|
||||||
|
// If we have a non-null address
|
||||||
if (in.readInt() == 1) {
|
if (in.readInt() == 1) {
|
||||||
builder.setDeviceAddress(in.readString());
|
address = in.readString();
|
||||||
}
|
}
|
||||||
if (in.readInt() == 1) {
|
if (in.readInt() == 1) {
|
||||||
ParcelUuid uuid = in.readParcelable(ParcelUuid.class.getClassLoader());
|
ParcelUuid uuid = in.readParcelable(ParcelUuid.class.getClassLoader());
|
||||||
@@ -245,6 +256,17 @@ public final class ScanFilter implements Parcelable {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// IRK
|
||||||
|
if (address != null) {
|
||||||
|
final int addressType = in.readInt();
|
||||||
|
if (in.readInt() == 1) {
|
||||||
|
final byte[] irk = new byte[16];
|
||||||
|
in.readByteArray(irk);
|
||||||
|
builder.setDeviceAddress(address, addressType, irk);
|
||||||
|
} else {
|
||||||
|
builder.setDeviceAddress(address, addressType);
|
||||||
|
}
|
||||||
|
}
|
||||||
return builder.build();
|
return builder.build();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user