package com.clj.fastble.data; import android.bluetooth.BluetoothDevice; import android.bluetooth.le.ScanRecord; import android.os.Parcel; import android.os.Parcelable; public class ScanResult implements Parcelable { private BluetoothDevice mDevice; private byte[] mScanRecord; private int mRssi; private long mTimestampNanos; public ScanResult(BluetoothDevice device, int rssi,byte[] scanRecord, long timestampNanos) { mDevice = device; mScanRecord = scanRecord; mRssi = rssi; mTimestampNanos = timestampNanos; } protected ScanResult(Parcel in) { mDevice = in.readParcelable(BluetoothDevice.class.getClassLoader()); mScanRecord = in.createByteArray(); mRssi = in.readInt(); mTimestampNanos = in.readLong(); } @Override public void writeToParcel(Parcel dest, int flags) { dest.writeParcelable(mDevice, flags); dest.writeByteArray(mScanRecord); dest.writeInt(mRssi); dest.writeLong(mTimestampNanos); } @Override public int describeContents() { return 0; } public static final Creator CREATOR = new Creator() { @Override public ScanResult createFromParcel(Parcel in) { return new ScanResult(in); } @Override public ScanResult[] newArray(int size) { return new ScanResult[size]; } }; public BluetoothDevice getDevice() { return mDevice; } public void setDevice(BluetoothDevice device) { this.mDevice = device; } public byte[] getScanRecord() { return mScanRecord; } public void setScanRecord(byte[] scanRecord) { this.mScanRecord = scanRecord; } public int getRssi() { return mRssi; } public void setRssi(int rssi) { this.mRssi = rssi; } public long getTimestampNanos() { return mTimestampNanos; } public void setTimestampNanos(long timestampNanos) { this.mTimestampNanos = timestampNanos; } }