正在查看: xDrip+ v04633772025.07.16 应用的 ConnectReceiver.java JAVA 源代码文件
本页面展示 JAVA 反编译生成的源代码文件,支持语法高亮显示。 仅供安全研究与技术分析使用,严禁用于任何非法用途。请遵守相关法律法规。
正在查看: xDrip+ v04633772025.07.16 应用的 ConnectReceiver.java JAVA 源代码文件
本页面展示 JAVA 反编译生成的源代码文件,支持语法高亮显示。 仅供安全研究与技术分析使用,严禁用于任何非法用途。请遵守相关法律法规。
package com.eveningoutpost.dexdrip.utils.bt;
import android.bluetooth.BluetoothDevice;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import com.eveningoutpost.dexdrip.models.UserError;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
public class ConnectReceiver extends BroadcastReceiver {
private static final String TAG = "ConnectReceiver";
private static final ConcurrentHashMap<String, BtCallBack3> callbacks = new ConcurrentHashMap<>();
public static void addCallBack(BtCallBack3 btCallBack3, String str) {
callbacks.put(str, btCallBack3);
}
public static void removeCallBack(String str) {
callbacks.remove(str);
}
private synchronized void processCallBacks(String str, String str2, BluetoothDevice bluetoothDevice) {
for (Map.Entry<String, BtCallBack3> entry : callbacks.entrySet()) {
UserError.Log.d(TAG, "Callback: " + entry.getKey());
entry.getValue().btCallback3(str, str2, null, null, bluetoothDevice);
}
}
@Override
public void onReceive(Context context, Intent intent) {
BluetoothDevice bluetoothDevice;
String address;
try {
if (!intent.getAction().equals("android.bluetooth.device.action.ACL_CONNECTED") || (bluetoothDevice = (BluetoothDevice) intent.getParcelableExtra("android.bluetooth.device.extra.DEVICE")) == null || (address = bluetoothDevice.getAddress()) == null) {
return;
}
UserError.Log.d(TAG, "Connection notice: " + address);
processCallBacks(address, "CONNECTED", bluetoothDevice);
} catch (NullPointerException e) {
UserError.Log.e(TAG, "NPE in onReceive: " + e);
}
}
}