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.gatt; 18 import android.annotation.Nullable; 19 20 /** @hide */ 21 public class AdvtFilterOnFoundOnLostInfo { 22 private int mClientIf; 23 24 private int mAdvPktLen; 25 @Nullable 26 private byte[] mAdvPkt; 27 28 private int mScanRspLen; 29 30 @Nullable 31 private byte[] mScanRsp; 32 33 private int mFiltIndex; 34 private int mAdvState; 35 private int mAdvInfoPresent; 36 private String mAddress; 37 38 private int mAddrType; 39 private int mTxPower; 40 private int mRssiValue; 41 private int mTimeStamp; 42 AdvtFilterOnFoundOnLostInfo(int client_if, int adv_pkt_len, byte[] adv_pkt, int scan_rsp_len, byte[] scan_rsp, int filt_index, int adv_state, int adv_info_present, String address, int addr_type, int tx_power, int rssi_value, int time_stamp)43 public AdvtFilterOnFoundOnLostInfo(int client_if, int adv_pkt_len, byte[] adv_pkt, 44 int scan_rsp_len, byte[] scan_rsp, int filt_index, int adv_state, 45 int adv_info_present, String address, int addr_type, int tx_power, 46 int rssi_value, int time_stamp){ 47 48 mClientIf = client_if; 49 mAdvPktLen = adv_pkt_len; 50 mAdvPkt = adv_pkt; 51 mScanRspLen = scan_rsp_len; 52 mScanRsp = scan_rsp; 53 mFiltIndex = filt_index; 54 mAdvState = adv_state; 55 mAdvInfoPresent = adv_info_present; 56 mAddress = address; 57 mAddrType = addr_type; 58 mTxPower = tx_power; 59 mRssiValue = rssi_value; 60 mTimeStamp = time_stamp; 61 } 62 getClientIf()63 public int getClientIf () { 64 return mClientIf; 65 } 66 getFiltIndex()67 public int getFiltIndex () { 68 return mFiltIndex; 69 } 70 getAdvState()71 public int getAdvState () { 72 return mAdvState; 73 } 74 getTxPower()75 public int getTxPower () { 76 return mTxPower; 77 } 78 getTimeStamp()79 public int getTimeStamp () { 80 return mTimeStamp; 81 } 82 getRSSIValue()83 public int getRSSIValue () { 84 return mRssiValue; 85 } 86 getAdvInfoPresent()87 public int getAdvInfoPresent () { 88 return mAdvInfoPresent; 89 } 90 getAddress()91 public String getAddress() { 92 return mAddress; 93 } 94 getAddressType()95 public int getAddressType() { 96 return mAddrType; 97 } 98 getAdvPacketData()99 public byte[] getAdvPacketData() { 100 return mAdvPkt; 101 } 102 getAdvPacketLen()103 public int getAdvPacketLen() { 104 return mAdvPktLen; 105 } 106 getScanRspData()107 public byte[] getScanRspData() { 108 return mScanRsp; 109 } 110 getScanRspLen()111 public int getScanRspLen() { 112 return mScanRspLen; 113 } 114 getResult()115 public byte [] getResult() { 116 int resultLength = mAdvPkt.length + ((mScanRsp != null) ? mScanRsp.length : 0); 117 byte result[] = new byte[resultLength]; 118 System.arraycopy(mAdvPkt, 0, result, 0, mAdvPkt.length); 119 if (mScanRsp != null) { 120 System.arraycopy(mScanRsp, 0, result, mAdvPkt.length, mScanRsp.length); 121 } 122 return result; 123 } 124 125 } 126 127