张海江
2017-08-07 957b8e9d4bc63524dad27c2f8458856da0bf5c06
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
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<ScanResult> CREATOR = new Creator<ScanResult>() {
        @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;
    }
 
}