package com.tencent.mm.plugin.appbrand.jsapi.bluetooth.sdk.scan;

import com.tencent.matrix.trace.core.AppMethodBeat;
import com.tencent.mm.plugin.appbrand.jsapi.bluetooth.sdk.c.d;
import com.tencent.mm.plugin.appbrand.jsapi.bluetooth.sdk.d.a;

public class a$2 extends e {
    final /* synthetic */ a hFl;

    public a$2(a aVar) {
        this.hFl = aVar;
    }

    public final void a(int i, ScanResultCompat scanResultCompat) {
        int i2 = 0;
        AppMethodBeat.i(94286);
        if (scanResultCompat.getDevice() == null) {
            a.e("MicroMsg.Ble.BleScanWorker", "[onScanResult]result is null, err", new Object[0]);
            AppMethodBeat.o(94286);
        } else if (!this.hFl.cnu.get()) {
            a.e("MicroMsg.Ble.BleScanWorker", "[onScanResult]not init, err", new Object[0]);
            AppMethodBeat.o(94286);
        } else if (this.hFl.hFg == null) {
            a.w("MicroMsg.Ble.BleScanWorker", "[onScanResult]may be close, err", new Object[0]);
            AppMethodBeat.o(94286);
        } else {
            a.d("MicroMsg.Ble.BleScanWorker", "callbackType:%d, result:%s", new Object[]{Integer.valueOf(i), scanResultCompat});
            String address = scanResultCompat.getDevice().getAddress();
            if (!this.hFl.hFg.containsKey(address) || com.tencent.mm.plugin.appbrand.jsapi.bluetooth.sdk.a.hDK.hDL) {
                i2 = 1;
            }
            d dVar = new d(scanResultCompat);
            if (i2 != 0) {
                if (com.tencent.mm.plugin.appbrand.jsapi.bluetooth.sdk.a.hDK.eCL > 0) {
                    if (this.hFl.hFi != null) {
                        this.hFl.hFi.add(dVar);
                    }
                } else if (this.hFl.hFk != null) {
                    this.hFl.hFk.a(dVar);
                }
            }
            this.hFl.hFg.put(address, dVar);
            AppMethodBeat.o(94286);
        }
    }

    public final void onScanFailed(int i) {
        AppMethodBeat.i(94287);
        a.e("MicroMsg.Ble.BleScanWorker", "[onScanResult]onScanFailed, errorCode:%d", new Object[]{Integer.valueOf(i)});
        AppMethodBeat.o(94287);
    }
}
