package com.tencent.mm.plugin.appbrand.jsapi.c;

import android.bluetooth.BluetoothAdapter;
import android.bluetooth.BluetoothAdapter.LeScanCallback;
import android.bluetooth.BluetoothManager;
import com.tencent.matrix.trace.core.AppMethodBeat;
import com.tencent.mm.sdk.platformtools.ab;
import com.tencent.mm.sdk.platformtools.ah;
import java.util.Map;
import java.util.UUID;
import java.util.concurrent.ConcurrentHashMap;
import org.json.JSONObject;

public class a$a {
    volatile boolean cFy = false;
    BluetoothAdapter hJY;
    Map<String, JSONObject> hJZ = new ConcurrentHashMap();
    UUID[] hKa = null;
    a hKb;
    long hKc = 0;
    Map<String, JSONObject> hKd = new ConcurrentHashMap();
    LeScanCallback hKe = new 1(this);

    public a$a() {
        AppMethodBeat.i(94353);
        BluetoothManager bluetoothManager = (BluetoothManager) ah.getContext().getSystemService("bluetooth");
        if (bluetoothManager == null) {
            ab.e("MicroMsg.BeaconManager", "bluetoothManager is null!");
            AppMethodBeat.o(94353);
            return;
        }
        this.hJY = bluetoothManager.getAdapter();
        if (this.hJY == null) {
            ab.e("MicroMsg.BeaconManager", "bluetoothAdapter is null!");
            AppMethodBeat.o(94353);
            return;
        }
        a.hDs = this.hJY.isEnabled();
        AppMethodBeat.o(94353);
    }

    /* Access modifiers changed, original: final|declared_synchronized */
    public final synchronized boolean isStart() {
        return this.cFy;
    }

    public final boolean EH() {
        AppMethodBeat.i(94354);
        ab.i("MicroMsg.BeaconManager", "BeaconWorker:%d stop", new Object[]{Integer.valueOf(hashCode())});
        if (isStart()) {
            this.hJZ.clear();
            this.hJY.stopLeScan(this.hKe);
            this.cFy = false;
            AppMethodBeat.o(94354);
            return true;
        }
        ab.i("MicroMsg.BeaconManager", "BeaconWorker:%d, already stop", new Object[]{Integer.valueOf(hashCode())});
        AppMethodBeat.o(94354);
        return false;
    }
}
