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

import android.annotation.TargetApi;
import com.tencent.matrix.trace.core.AppMethodBeat;
import com.tencent.mm.plugin.appbrand.jsapi.a;
import com.tencent.mm.plugin.appbrand.jsapi.bluetooth.sdk.c.h;
import com.tencent.mm.plugin.appbrand.jsapi.bluetooth.sdk.c.j;
import com.tencent.mm.plugin.appbrand.jsapi.c;
import com.tencent.mm.sdk.platformtools.ab;
import java.util.HashMap;
import org.json.JSONObject;

@TargetApi(18)
public final class m extends a {
    private static final int CTRL_INDEX = 173;
    private static final String NAME = "openBluetoothAdapter";

    public final void a(final c cVar, JSONObject jSONObject, int i) {
        AppMethodBeat.i(94203);
        c.kT(0);
        ab.i("MicroMsg.JsApiOpenBluetoothAdapter", "appid:%s openBluetoothAdapter!", new Object[]{cVar.getAppId()});
        j a = a.a(r0, new b.a() {
            public final void dV(boolean z) {
                AppMethodBeat.i(94194);
                c.a(cVar, z, false);
                AppMethodBeat.o(94194);
            }
        }, new h() {
            public final void ag(String str, boolean z) {
                AppMethodBeat.i(94195);
                b.a(cVar, str, z);
                AppMethodBeat.o(94195);
            }
        }, new 3(this, cVar));
        HashMap hashMap = new HashMap();
        switch (a.errCode) {
            case 0:
                cVar.M(i, j("ok", hashMap));
                c.kT(1);
                AppMethodBeat.o(94203);
                return;
            case 10001:
                hashMap.put("errCode", Integer.valueOf(10001));
                cVar.M(i, j("fail:not available", hashMap));
                c.cZ(2, 7);
                AppMethodBeat.o(94203);
                return;
            case 10009:
                hashMap.put("errCode", Integer.valueOf(10009));
                cVar.M(i, j("fail:system not support", hashMap));
                c.cZ(2, 8);
                AppMethodBeat.o(94203);
                return;
            default:
                hashMap.put("errCode", Integer.valueOf(a.errCode));
                cVar.M(i, j(a.aIm, hashMap));
                c.kT(2);
                AppMethodBeat.o(94203);
                return;
        }
    }
}
