static jmethodID method_onGetGattDb;
static jmethodID method_onClientPhyUpdate;
static jmethodID method_onClientPhyRead;
+static jmethodID method_onClientConnUpdate;
/**
* Server callback methods
static jmethodID method_onServerMtuChanged;
static jmethodID method_onServerPhyUpdate;
static jmethodID method_onServerPhyRead;
+static jmethodID method_onServerConnUpdate;
/**
* Advertiser callback methods
CallbackEnv sCallbackEnv(__func__);
if (!sCallbackEnv.valid()) return;
- info("ASDFASDFADSFDSAFDS");
sCallbackEnv->CallVoidMethod(mCallbacksObj, method_onClientPhyUpdate, conn_id,
tx_phy, rx_phy, status);
}
+void btgattc_conn_updated_cb(int conn_id, uint16_t interval, uint16_t latency,
+ uint16_t timeout, uint8_t status) {
+ CallbackEnv sCallbackEnv(__func__);
+ if (!sCallbackEnv.valid()) return;
+
+ sCallbackEnv->CallVoidMethod(mCallbacksObj, method_onClientConnUpdate,
+ conn_id, interval, latency, timeout, status);
+}
+
static const btgatt_scanner_callbacks_t sGattScannerCallbacks = {
btgattc_scan_result_cb,
btgattc_batchscan_reports_cb,
btgattc_get_gatt_db_cb,
NULL, /* services_removed_cb */
NULL, /* services_added_cb */
- btgattc_phy_updated_cb};
+ btgattc_phy_updated_cb,
+ btgattc_conn_updated_cb};
/**
* BTA server callbacks
tx_phy, rx_phy, status);
}
+void btgatts_conn_updated_cb(int conn_id, uint16_t interval, uint16_t latency,
+ uint16_t timeout, uint8_t status) {
+ CallbackEnv sCallbackEnv(__func__);
+ if (!sCallbackEnv.valid()) return;
+
+ sCallbackEnv->CallVoidMethod(mCallbacksObj, method_onServerConnUpdate,
+ conn_id, interval, latency, timeout, status);
+}
+
static const btgatt_server_callbacks_t sGattServerCallbacks = {
btgatts_register_app_cb,
btgatts_connection_cb,
btgatts_indication_sent_cb,
btgatts_congestion_cb,
btgatts_mtu_changed_cb,
- btgatts_phy_updated_cb};
+ btgatts_phy_updated_cb,
+ btgatts_conn_updated_cb};
/**
* GATT callbacks
env->GetMethodID(clazz, "onClientPhyRead", "(IIII)V");
method_onClientPhyUpdate =
env->GetMethodID(clazz, "onClientPhyUpdate", "(IIII)V");
+ method_onClientConnUpdate =
+ env->GetMethodID(clazz, "onClientConnUpdate", "(IIIII)V");
// Server callbacks
env->GetMethodID(clazz, "onServerPhyRead", "(IIII)V");
method_onServerPhyUpdate =
env->GetMethodID(clazz, "onServerPhyUpdate", "(IIII)V");
+ method_onServerConnUpdate =
+ env->GetMethodID(clazz, "onServerConnUpdate", "(IIIII)V");
info("classInitNative: Success!");
}
app.callback.onPhyRead(address, txPhy, rxPhy, status);
}
+ void onClientConnUpdate(int connId, int interval, int latency, int timeout, int status)
+ throws RemoteException {
+ if (DBG) Log.d(TAG, "onClientConnUpdate() - connId=" + connId + ", status=" + status);
+
+ String address = mClientMap.addressByConnId(connId);
+ if (address == null) return;
+
+ ClientMap.App app = mClientMap.getByConnId(connId);
+ if (app == null) return;
+
+ app.callback.onConnectionUpdated(address, interval, latency, timeout, status);
+ }
+
void onServerPhyUpdate(int connId, int txPhy, int rxPhy, int status) throws RemoteException {
if (DBG) Log.d(TAG, "onServerPhyUpdate() - connId=" + connId + ", status=" + status);
app.callback.onPhyRead(address, txPhy, rxPhy, status);
}
+ void onServerConnUpdate(int connId, int interval, int latency, int timeout, int status)
+ throws RemoteException {
+ if (DBG) Log.d(TAG, "onServerConnUpdate() - connId=" + connId + ", status=" + status);
+
+ String address = mServerMap.addressByConnId(connId);
+ if (address == null) return;
+
+ ServerMap.App app = mServerMap.getByConnId(connId);
+ if (app == null) return;
+
+ app.callback.onConnectionUpdated(address, interval, latency, timeout, status);
+ }
+
void onSearchCompleted(int connId, int status) throws RemoteException {
if (DBG) Log.d(TAG, "onSearchCompleted() - connId=" + connId+ ", status=" + status);
// Gatt DB is ready!