Loading android/app/jni/com_android_bluetooth_gatt.cpp +13 −1 Original line number Diff line number Diff line Loading @@ -142,6 +142,7 @@ static jmethodID method_onGetGattDb; static jmethodID method_onClientPhyUpdate; static jmethodID method_onClientPhyRead; static jmethodID method_onClientConnUpdate; static jmethodID method_onServiceChanged; /** * Server callback methods Loading Loading @@ -528,6 +529,13 @@ void btgattc_conn_updated_cb(int conn_id, uint16_t interval, uint16_t latency, conn_id, interval, latency, timeout, status); } void btgattc_service_changed_cb(int conn_id) { CallbackEnv sCallbackEnv(__func__); if (!sCallbackEnv.valid()) return; sCallbackEnv->CallVoidMethod(mCallbacksObj, method_onServiceChanged, conn_id); } static const btgatt_scanner_callbacks_t sGattScannerCallbacks = { btgattc_scan_result_cb, btgattc_batchscan_reports_cb, Loading @@ -554,7 +562,9 @@ static const btgatt_client_callbacks_t sGattClientCallbacks = { NULL, /* services_removed_cb */ NULL, /* services_added_cb */ btgattc_phy_updated_cb, btgattc_conn_updated_cb}; btgattc_conn_updated_cb, btgattc_service_changed_cb, }; /** * BTA server callbacks Loading Loading @@ -835,6 +845,8 @@ static void classInitNative(JNIEnv* env, jclass clazz) { env->GetMethodID(clazz, "onClientPhyUpdate", "(IIII)V"); method_onClientConnUpdate = env->GetMethodID(clazz, "onClientConnUpdate", "(IIIII)V"); method_onServiceChanged = env->GetMethodID(clazz, "onServiceChanged", "(I)V"); // Server callbacks Loading android/app/src/com/android/bluetooth/gatt/GattService.java +18 −0 Original line number Diff line number Diff line Loading @@ -1304,6 +1304,24 @@ public class GattService extends ProfileService { app.callback.onConnectionUpdated(address, interval, latency, timeout, status); } void onServiceChanged(int connId) throws RemoteException { if (DBG) { Log.d(TAG, "onServiceChanged - connId=" + connId); } String address = mClientMap.addressByConnId(connId); if (address == null) { return; } ClientMap.App app = mClientMap.getByConnId(connId); if (app == null) { return; } app.callback.onServiceChanged(address); } void onServerPhyUpdate(int connId, int txPhy, int rxPhy, int status) throws RemoteException { if (DBG) { Log.d(TAG, "onServerPhyUpdate() - connId=" + connId + ", status=" + status); Loading Loading
android/app/jni/com_android_bluetooth_gatt.cpp +13 −1 Original line number Diff line number Diff line Loading @@ -142,6 +142,7 @@ static jmethodID method_onGetGattDb; static jmethodID method_onClientPhyUpdate; static jmethodID method_onClientPhyRead; static jmethodID method_onClientConnUpdate; static jmethodID method_onServiceChanged; /** * Server callback methods Loading Loading @@ -528,6 +529,13 @@ void btgattc_conn_updated_cb(int conn_id, uint16_t interval, uint16_t latency, conn_id, interval, latency, timeout, status); } void btgattc_service_changed_cb(int conn_id) { CallbackEnv sCallbackEnv(__func__); if (!sCallbackEnv.valid()) return; sCallbackEnv->CallVoidMethod(mCallbacksObj, method_onServiceChanged, conn_id); } static const btgatt_scanner_callbacks_t sGattScannerCallbacks = { btgattc_scan_result_cb, btgattc_batchscan_reports_cb, Loading @@ -554,7 +562,9 @@ static const btgatt_client_callbacks_t sGattClientCallbacks = { NULL, /* services_removed_cb */ NULL, /* services_added_cb */ btgattc_phy_updated_cb, btgattc_conn_updated_cb}; btgattc_conn_updated_cb, btgattc_service_changed_cb, }; /** * BTA server callbacks Loading Loading @@ -835,6 +845,8 @@ static void classInitNative(JNIEnv* env, jclass clazz) { env->GetMethodID(clazz, "onClientPhyUpdate", "(IIII)V"); method_onClientConnUpdate = env->GetMethodID(clazz, "onClientConnUpdate", "(IIIII)V"); method_onServiceChanged = env->GetMethodID(clazz, "onServiceChanged", "(I)V"); // Server callbacks Loading
android/app/src/com/android/bluetooth/gatt/GattService.java +18 −0 Original line number Diff line number Diff line Loading @@ -1304,6 +1304,24 @@ public class GattService extends ProfileService { app.callback.onConnectionUpdated(address, interval, latency, timeout, status); } void onServiceChanged(int connId) throws RemoteException { if (DBG) { Log.d(TAG, "onServiceChanged - connId=" + connId); } String address = mClientMap.addressByConnId(connId); if (address == null) { return; } ClientMap.App app = mClientMap.getByConnId(connId); if (app == null) { return; } app.callback.onServiceChanged(address); } void onServerPhyUpdate(int connId, int txPhy, int rxPhy, int status) throws RemoteException { if (DBG) { Log.d(TAG, "onServerPhyUpdate() - connId=" + connId + ", status=" + status); Loading