1 /*
2  * Copyright (C) 2015 The Android Open Source Project
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  *      http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 
17 package com.android.bluetooth.le_scan;
18 
19 import android.annotation.Nullable;
20 import android.bluetooth.BluetoothDevice;
21 
22 public class AdvtFilterOnFoundOnLostInfo {
23     private int mClientIf;
24 
25     private int mAdvPktLen;
26     @Nullable private byte[] mAdvPkt;
27 
28     private int mScanRspLen;
29 
30     @Nullable private byte[] mScanRsp;
31 
32     private int mFiltIndex;
33     private int mAdvState;
34     private int mAdvInfoPresent;
35     private String mAddress;
36 
37     private int mAddrType;
38     private int mTxPower;
39     private int mRssiValue;
40     private int mTimeStamp;
41 
AdvtFilterOnFoundOnLostInfo( int clientIf, int advPktLen, byte[] advPkt, int scanRspLen, byte[] scanRsp, int filtIndex, int advState, int advInfoPresent, String address, int addrType, int txPower, int rssiValue, int timeStamp)42     public AdvtFilterOnFoundOnLostInfo(
43             int clientIf,
44             int advPktLen,
45             byte[] advPkt,
46             int scanRspLen,
47             byte[] scanRsp,
48             int filtIndex,
49             int advState,
50             int advInfoPresent,
51             String address,
52             int addrType,
53             int txPower,
54             int rssiValue,
55             int timeStamp) {
56 
57         mClientIf = clientIf;
58         mAdvPktLen = advPktLen;
59         mAdvPkt = advPkt;
60         mScanRspLen = scanRspLen;
61         mScanRsp = scanRsp;
62         mFiltIndex = filtIndex;
63         mAdvState = advState;
64         mAdvInfoPresent = advInfoPresent;
65         mAddress = address;
66         mAddrType = addrType;
67         mTxPower = txPower;
68         mRssiValue = rssiValue;
69         mTimeStamp = timeStamp;
70     }
71 
getClientIf()72     public int getClientIf() {
73         return mClientIf;
74     }
75 
getFiltIndex()76     public int getFiltIndex() {
77         return mFiltIndex;
78     }
79 
getAdvState()80     public int getAdvState() {
81         return mAdvState;
82     }
83 
getTxPower()84     public int getTxPower() {
85         return mTxPower;
86     }
87 
getTimeStamp()88     public int getTimeStamp() {
89         return mTimeStamp;
90     }
91 
getRSSIValue()92     public int getRSSIValue() {
93         return mRssiValue;
94     }
95 
getAdvInfoPresent()96     public int getAdvInfoPresent() {
97         return mAdvInfoPresent;
98     }
99 
getAddress()100     public String getAddress() {
101         return mAddress;
102     }
103 
104     @BluetoothDevice.AddressType
getAddressType()105     public int getAddressType() {
106         return mAddrType;
107     }
108 
getAdvPacketData()109     public byte[] getAdvPacketData() {
110         return mAdvPkt;
111     }
112 
getAdvPacketLen()113     public int getAdvPacketLen() {
114         return mAdvPktLen;
115     }
116 
getScanRspData()117     public byte[] getScanRspData() {
118         return mScanRsp;
119     }
120 
getScanRspLen()121     public int getScanRspLen() {
122         return mScanRspLen;
123     }
124 
getResult()125     public byte[] getResult() {
126         int resultLength = mAdvPkt.length + ((mScanRsp != null) ? mScanRsp.length : 0);
127         byte[] result = new byte[resultLength];
128         System.arraycopy(mAdvPkt, 0, result, 0, mAdvPkt.length);
129         if (mScanRsp != null) {
130             System.arraycopy(mScanRsp, 0, result, mAdvPkt.length, mScanRsp.length);
131         }
132         return result;
133     }
134 }
135