package epson.maintain.activity;

import android.content.Context;

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) {
        mClientId = SharedPreferencesProvider.getInstace(context).getString(Constants.PRINTER_CLIENT_ID, "");
        EPLog.d("▲clientId = " + mClientId);
        MyPrinter curPrinter = MyPrinter.getCurPrinter(context);
        mAccessKey = EcClientLibUtil.quoteForJsonString(curPrinter.getRemotePrinterAccessKey(context));
        mPrinterName = EcClientLibUtil.quoteForJsonString(curPrinter.getUserDefName(context));
        mMailAddress = EcClientLibUtil.quoteForJsonString(curPrinter.getEmailAddress());
    }

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