package epson.maintain.activity;

import android.content.Context;
import com.epson.mobilephone.common.EpLog;
import epson.common.Constants;
import epson.print.MyPrinter;
import epson.print.ecclient.EcClientLib;
import epson.print.ecclient.EcClientLibUtil;
import epson.provider.SharedPreferencesProvider;

/* compiled from: EccPrintLog */
class LogUrl {
    String mAccessKey;
    String mClientId;
    String mMailAddress;
    String mPrinterName;

    LogUrl() {
    }

    public void setContextDependValue(Context context) {
        this.mClientId = SharedPreferencesProvider.getInstace(context).getString(Constants.PRINTER_CLIENT_ID, "");
        EpLog.m69d("▲clientId = " + this.mClientId);
        MyPrinter curPrinter = MyPrinter.getCurPrinter(context);
        this.mAccessKey = EcClientLibUtil.quoteForJsonString(curPrinter.getRemotePrinterAccessKey(context));
        this.mPrinterName = EcClientLibUtil.quoteForJsonString(curPrinter.getUserDefName(context));
        this.mMailAddress = EcClientLibUtil.quoteForJsonString(curPrinter.getEmailAddress());
    }

    public String getUrl() throws EccPrintLogException {
        EcClientLib ecClientLib = new EcClientLib();
        if (ecClientLib.Initialize()) {
            int GetPrintLogUri = ecClientLib.GetPrintLogUri(this.mMailAddress, this.mAccessKey, this.mClientId, this.mPrinterName);
            if (GetPrintLogUri == 0) {
                String str = ecClientLib.mLogUri;
                ecClientLib.Terminate();
                return str;
            }
            throw new EccPrintLogException(GetPrintLogUri);
        }
        throw new EccPrintLogException(10);
    }
}
