package com.seewo.libsvendors.vendor.mstar.pppoe;

import com.seewo.libsvendors.utils.reflect.Reflect;

/* JADX INFO: loaded from: classes.dex */
public class PppoeHelper {
    public static final String PPPOE_STATE_ACTION = "com.mstar.android.pppoe.PPPOE_STATE_ACTION";
    public static final String PPPOE_STATE_AUTHFAILED = "authfailed";
    public static final String PPPOE_STATE_CONNECT = "connect";
    public static final String PPPOE_STATE_CONNECTING = "connecting";
    public static final String PPPOE_STATE_DISCONNECT = "disconnect";
    public static final String PPPOE_STATE_DISCONNECTING = "disconnecting";
    public static final String PPPOE_STATE_FAILED = "failed";
    public static final String PPPOE_STATE_LINKTIMEOUT = "linktimeout";
    public static final String PPPOE_STATE_STATUE = "PppoeStatus";
    private Object mPppoeManager = Reflect.on("android.net.pppoe.PppoeManager").call("getInstance").get();

    public void connectPppoe(String str, String str2) {
        connectPppoe(str, str2, "eth0");
    }

    public void connectPppoe(String str, String str2, String str3) {
        Object obj = this.mPppoeManager;
        if (obj != null) {
            Reflect.on(obj).call("connectPppoe", str, str2, str3).get();
        }
    }

    public void disconnectPppoe() {
        Object obj = this.mPppoeManager;
        if (obj != null) {
            Reflect.on(obj).call("disconnectPppoe").get();
        }
    }

    public String getInterfaceName() {
        Object obj = this.mPppoeManager;
        if (obj != null) {
            return (String) Reflect.on(obj).call("getInterfaceName").get();
        }
        return null;
    }

    public String getIpaddr() {
        Object obj = this.mPppoeManager;
        if (obj != null) {
            return (String) Reflect.on(obj).call("getIpaddr").get();
        }
        return null;
    }

    public String getRoute() {
        Object obj = this.mPppoeManager;
        if (obj != null) {
            return (String) Reflect.on(obj).call("getRoute").get();
        }
        return null;
    }

    public String getMask() {
        Object obj = this.mPppoeManager;
        if (obj != null) {
            return (String) Reflect.on(obj).call("getMask").get();
        }
        return null;
    }

    public String getDns1() {
        Object obj = this.mPppoeManager;
        if (obj != null) {
            return (String) Reflect.on(obj).call("getDns1").get();
        }
        return null;
    }

    public String getDns2() {
        Object obj = this.mPppoeManager;
        if (obj != null) {
            return (String) Reflect.on(obj).call("getDns2").get();
        }
        return null;
    }

    public String getPppoeStatus() {
        Object obj = this.mPppoeManager;
        if (obj != null) {
            return (String) Reflect.on(obj).call("getPppoeStatus").get();
        }
        return null;
    }

    public boolean pppoeSetInterface(String str) {
        Object obj = this.mPppoeManager;
        if (obj != null) {
            return ((Boolean) Reflect.on(obj).call("PppoeSetInterface", str).get()).booleanValue();
        }
        return false;
    }

    public boolean pppoeSetUser(String str) {
        Object obj = this.mPppoeManager;
        if (obj != null) {
            return ((Boolean) Reflect.on(obj).call("PppoeSetUser", str).get()).booleanValue();
        }
        return false;
    }

    public boolean pppoeSetPW(String str) {
        Object obj = this.mPppoeManager;
        if (obj != null) {
            return ((Boolean) Reflect.on(obj).call("PppoeSetUser", str).get()).booleanValue();
        }
        return false;
    }

    public boolean pppoeDialup() {
        Object obj = this.mPppoeManager;
        if (obj != null) {
            return ((Boolean) Reflect.on(obj).call("PppoeDialup").get()).booleanValue();
        }
        return false;
    }

    public void pppoeHangUp() {
        Object obj = this.mPppoeManager;
        if (obj != null) {
            Reflect.on(obj).call("PppoeHangUp").get();
        }
    }

    public PPPOE_STA pppoeGetStatus() {
        Object obj = this.mPppoeManager;
        if (obj == null) {
            return null;
        }
        int i = AnonymousClass1.$SwitchMap$com$seewo$libsvendors$vendor$mstar$pppoe$PPPOE_STA[((PPPOE_STA) Reflect.on(obj).call("PppoeGetStatus").get()).ordinal()];
        if (i == 1) {
            return PPPOE_STA.CONNECTED;
        }
        if (i == 2) {
            return PPPOE_STA.DISCONNECTED;
        }
        if (i != 3) {
            return null;
        }
        return PPPOE_STA.CONNECTING;
    }

    /* JADX INFO: renamed from: com.seewo.libsvendors.vendor.mstar.pppoe.PppoeHelper$1, reason: invalid class name */
    static /* synthetic */ class AnonymousClass1 {
        static final /* synthetic */ int[] $SwitchMap$com$seewo$libsvendors$vendor$mstar$pppoe$PPPOE_STA;

        static {
            int[] iArr = new int[PPPOE_STA.values().length];
            $SwitchMap$com$seewo$libsvendors$vendor$mstar$pppoe$PPPOE_STA = iArr;
            try {
                iArr[PPPOE_STA.CONNECTED.ordinal()] = 1;
            } catch (NoSuchFieldError unused) {
            }
            try {
                $SwitchMap$com$seewo$libsvendors$vendor$mstar$pppoe$PPPOE_STA[PPPOE_STA.DISCONNECTED.ordinal()] = 2;
            } catch (NoSuchFieldError unused2) {
            }
            try {
                $SwitchMap$com$seewo$libsvendors$vendor$mstar$pppoe$PPPOE_STA[PPPOE_STA.CONNECTING.ordinal()] = 3;
            } catch (NoSuchFieldError unused3) {
            }
        }
    }

    public String pppoeGetUser() {
        Object obj = this.mPppoeManager;
        if (obj != null) {
            return (String) Reflect.on(obj).call("PppoeGetUser").get();
        }
        return null;
    }

    public String pppoeGetPW() {
        Object obj = this.mPppoeManager;
        if (obj != null) {
            return (String) Reflect.on(obj).call("PppoeGetPW").get();
        }
        return null;
    }

    public String pppoeGetInterface() {
        Object obj = this.mPppoeManager;
        if (obj != null) {
            return (String) Reflect.on(obj).call("PppoeGetInterface").get();
        }
        return null;
    }

    public boolean isPppoeRunning() {
        Object obj = this.mPppoeManager;
        if (obj != null) {
            return ((Boolean) Reflect.on(obj).call("isPppoeRunning").get()).booleanValue();
        }
        return false;
    }
}
