summaryrefslogtreecommitdiffstats
path: root/src/com/android/bluetooth/gatt
diff options
context:
space:
mode:
authorSatya Calloji <satyac@broadcom.com>2015-02-10 09:18:49 -0800
committerSatya Calloji <satyac@broadcom.com>2015-04-01 17:21:55 -0700
commit655434047df38242c1848eee283f134cfd299fd1 (patch)
tree74366279a0a82762fbc21a823f150c6b61e79e58 /src/com/android/bluetooth/gatt
parent6c53637d2d9afebe66195754be864fa354fba9ab (diff)
downloadandroid_packages_apps_Bluetooth-655434047df38242c1848eee283f134cfd299fd1.tar.gz
android_packages_apps_Bluetooth-655434047df38242c1848eee283f134cfd299fd1.tar.bz2
android_packages_apps_Bluetooth-655434047df38242c1848eee283f134cfd299fd1.zip
OnFound/OnLost feature JNI changes based on BLE spec v0.90.
Bug: 19609671 Change-Id: I2ac0687ea53616287d82fe47f256686619c0998a
Diffstat (limited to 'src/com/android/bluetooth/gatt')
-rw-r--r--src/com/android/bluetooth/gatt/AdvtFilterOnFoundOnLostInfo.java1
-rw-r--r--src/com/android/bluetooth/gatt/FilterParams.java1
-rw-r--r--src/com/android/bluetooth/gatt/GattService.java29
-rw-r--r--src/com/android/bluetooth/gatt/ScanManager.java24
4 files changed, 35 insertions, 20 deletions
diff --git a/src/com/android/bluetooth/gatt/AdvtFilterOnFoundOnLostInfo.java b/src/com/android/bluetooth/gatt/AdvtFilterOnFoundOnLostInfo.java
new file mode 100644
index 000000000..d06396ca6
--- /dev/null
+++ b/src/com/android/bluetooth/gatt/AdvtFilterOnFoundOnLostInfo.java
@@ -0,0 +1 @@
+/* * Copyright (C) 2015 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.android.bluetooth.gatt; import android.annotation.Nullable; /** @hide */ public class AdvtFilterOnFoundOnLostInfo { private int mClientIf; private int mAdvPktLen; @Nullable private byte[] mAdvPkt; private int mScanRspLen; @Nullable private byte[] mScanRsp; private int mFiltIndex; private int mAdvState; private int mAdvInfoPresent; private String mAddress; private int mAddrType; private int mTxPower; private int mRssiValue; private int mTimeStamp; public 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){ mClientIf = client_if; mAdvPktLen = adv_pkt_len; mAdvPkt = adv_pkt; mScanRspLen = scan_rsp_len; mScanRsp = scan_rsp; mFiltIndex = filt_index; mAdvState = adv_state; mAdvInfoPresent = adv_info_present; mAddress = address; mAddrType = addr_type; mTxPower = tx_power; mRssiValue = rssi_value; mTimeStamp = time_stamp; } public int getClientIf () { return mClientIf; } public int getFiltIndex () { return mFiltIndex; } public int getAdvState () { return mAdvState; } public int getTxPower () { return mTxPower; } public int getTimeStamp () { return mTimeStamp; } public int getRSSIValue () { return mRssiValue; } public int getAdvInfoPresent () { return mAdvInfoPresent; } public String getAddress() { return mAddress; } public int getAddressType() { return mAddrType; } public byte[] getAdvPacketData() { return mAdvPkt; } public int getAdvPacketLen() { return mAdvPktLen; } public byte[] getScanRspData() { return mScanRsp; } public int getScanRspLen() { return mScanRspLen; } } \ No newline at end of file
diff --git a/src/com/android/bluetooth/gatt/FilterParams.java b/src/com/android/bluetooth/gatt/FilterParams.java
new file mode 100644
index 000000000..3b702794f
--- /dev/null
+++ b/src/com/android/bluetooth/gatt/FilterParams.java
@@ -0,0 +1 @@
+/* * Copyright (C) 2015 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.android.bluetooth.gatt; /** @hide */ public class FilterParams { private int mClientIf; private int mFiltIndex; private int mFeatSeln; private int mListLogicType; private int mFiltLogicType; private int mRssiHighValue; private int mRssiLowValue; private int mDelyMode; private int mFoundTimeOut; private int mLostTimeOut; private int mFoundTimeOutCnt; private int mNumOfTrackEntries; public FilterParams(int client_if, int filt_index, int feat_seln, int list_logic_type, int filt_logic_type, int rssi_high_thres, int rssi_low_thres, int dely_mode, int found_timeout, int lost_timeout, int found_timeout_cnt, int num_of_tracking_entries) { mClientIf = client_if; mFiltIndex = filt_index; mFeatSeln = feat_seln; mListLogicType = list_logic_type; mFiltLogicType = filt_logic_type; mRssiHighValue = rssi_high_thres; mRssiLowValue = rssi_low_thres; mDelyMode = dely_mode; mFoundTimeOut = found_timeout; mLostTimeOut = lost_timeout; mFoundTimeOutCnt = found_timeout_cnt; mNumOfTrackEntries = num_of_tracking_entries; } public int getClientIf () { return mClientIf; } public int getFiltIndex () { return mFiltIndex; } public int getFeatSeln () { return mFeatSeln; } public int getDelyMode () { return mDelyMode; } public int getListLogicType () { return mListLogicType; } public int getFiltLogicType () { return mFiltLogicType; } public int getRSSIHighValue () { return mRssiHighValue; } public int getRSSILowValue () { return mRssiLowValue; } public int getFoundTimeout () { return mFoundTimeOut; } public int getFoundTimeOutCnt () { return mFoundTimeOutCnt; } public int getLostTimeout () { return mLostTimeOut; } public int getNumOfTrackEntries () { return mNumOfTrackEntries; } } \ No newline at end of file
diff --git a/src/com/android/bluetooth/gatt/GattService.java b/src/com/android/bluetooth/gatt/GattService.java
index c428cf832..71f11827b 100644
--- a/src/com/android/bluetooth/gatt/GattService.java
+++ b/src/com/android/bluetooth/gatt/GattService.java
@@ -1132,24 +1132,37 @@ public class GattService extends ProfileService {
flushPendingBatchResults(clientIf, isServer);
}
- void onTrackAdvFoundLost(int filterIndex, int addrType, String address, int advState,
- int clientIf) throws RemoteException {
- if (DBG) Log.d(TAG, "onClientAdvertiserFoundLost() - clientIf="
- + clientIf + "address = " + address + "adv_state = "
- + advState + "client_if = " + clientIf);
- ClientMap.App app = mClientMap.getById(clientIf);
+ AdvtFilterOnFoundOnLostInfo CreateonTrackAdvFoundLostObject(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) {
+
+ return new AdvtFilterOnFoundOnLostInfo(client_if, adv_pkt_len, adv_pkt,
+ scan_rsp_len, scan_rsp, filt_index, adv_state,
+ adv_info_present, address, addr_type, tx_power,
+ rssi_value, time_stamp);
+ }
+
+ void onTrackAdvFoundLost(AdvtFilterOnFoundOnLostInfo trackingInfo) throws RemoteException {
+ if (DBG) Log.d(TAG, "onTrackAdvFoundLost() - clientIf="
+ + trackingInfo.getClientIf() + "address = " + trackingInfo.getAddress() +
+ "adv_state = " + trackingInfo.getAdvState()+ "address type=" +
+ trackingInfo.getAddressType()
+ + "ADV packet data =" + trackingInfo.getAdvPacketLen());
+
+ ClientMap.App app = mClientMap.getById(trackingInfo.getClientIf());
if (app == null || app.callback == null) {
Log.e(TAG, "app or callback is null");
return;
}
// use hw signal for only onlost reporting
- if (advState != ADVT_STATE_ONLOST) {
+ if (trackingInfo.getAdvState() != ADVT_STATE_ONLOST) {
return;
}
for (ScanClient client : mScanManager.getRegularScanQueue()) {
- if (client.clientIf == clientIf) {
+ if (client.clientIf == trackingInfo.getClientIf()) {
ScanSettings settings = client.settings;
if ((settings.getCallbackType() &
ScanSettings.CALLBACK_TYPE_MATCH_LOST) != 0) {
diff --git a/src/com/android/bluetooth/gatt/ScanManager.java b/src/com/android/bluetooth/gatt/ScanManager.java
index d93e4106a..ae5a76ff6 100644
--- a/src/com/android/bluetooth/gatt/ScanManager.java
+++ b/src/com/android/bluetooth/gatt/ScanManager.java
@@ -657,6 +657,8 @@ public class ScanManager {
private void configureScanFilters(ScanClient client) {
int clientIf = client.clientIf;
int deliveryMode = getDeliveryMode(client);
+ // TBD - The value needs to be handled appropriately
+ int trackEntries = 5;
if (!shouldAddAllPassFilterToController(client, deliveryMode)) {
return;
}
@@ -669,7 +671,8 @@ public class ScanManager {
int filterIndex = (deliveryMode == DELIVERY_MODE_BATCH) ?
ALL_PASS_FILTER_INDEX_BATCH_SCAN : ALL_PASS_FILTER_INDEX_REGULAR_SCAN;
resetCountDownLatch();
- configureFilterParamter(clientIf, client, ALL_PASS_FILTER_SELECTION, filterIndex);
+ configureFilterParamter(clientIf, client, ALL_PASS_FILTER_SELECTION, filterIndex,
+ trackEntries);
waitForCallback();
} else {
Deque<Integer> clientFilterIndices = new ArrayDeque<Integer>();
@@ -684,7 +687,8 @@ public class ScanManager {
waitForCallback();
}
resetCountDownLatch();
- configureFilterParamter(clientIf, client, featureSelection, filterIndex);
+ configureFilterParamter(clientIf, client, featureSelection, filterIndex,
+ trackEntries);
waitForCallback();
clientFilterIndices.add(filterIndex);
}
@@ -834,14 +838,14 @@ public class ScanManager {
// Configure filter parameters.
private void configureFilterParamter(int clientIf, ScanClient client, int featureSelection,
- int filterIndex) {
+ int filterIndex, int num_of_tracking_entries) {
int deliveryMode = getDeliveryMode(client);
int rssiThreshold = Byte.MIN_VALUE;
int timeout = getOnfoundLostTimeout(client);
- gattClientScanFilterParamAddNative(
- clientIf, filterIndex, featureSelection, LIST_LOGIC_TYPE,
- FILTER_LOGIC_TYPE, rssiThreshold, rssiThreshold, deliveryMode,
- timeout, timeout, ONFOUND_SIGHTINGS);
+ FilterParams FiltValue = new FilterParams(clientIf, filterIndex, featureSelection,
+ LIST_LOGIC_TYPE, FILTER_LOGIC_TYPE, rssiThreshold, rssiThreshold, deliveryMode,
+ timeout, timeout, ONFOUND_SIGHTINGS, num_of_tracking_entries);
+ gattClientScanFilterParamAddNative(FiltValue);
}
// Get delivery mode based on scan settings.
@@ -892,11 +896,7 @@ public class ScanManager {
long uuid_mask_lsb, long uuid_mask_msb, String name,
String address, byte addr_type, byte[] data, byte[] mask);
- private native void gattClientScanFilterParamAddNative(
- int client_if, int filt_index, int feat_seln,
- int list_logic_type, int filt_logic_type, int rssi_high_thres,
- int rssi_low_thres, int dely_mode, int found_timeout,
- int lost_timeout, int found_timeout_cnt);
+ private native void gattClientScanFilterParamAddNative(FilterParams FiltValue);
// Note this effectively remove scan filters for ALL clients.
private native void gattClientScanFilterParamClearAllNative(