package epson.print.inkrpln;

import android.content.Context;

import com.epson.mobilephone.common.maintain2.MaintainPrinter2;
import epson.print.IprintApplication;

public class PrintSettingDependencyBuilder extends DependencyBuilder {
    /* access modifiers changed from: private */
    public final String mEscprLibPrinterId;
    /* access modifiers changed from: private */
    public final String mPrinterIpAddress;
    /* access modifiers changed from: private */
    public final int mPrinterLocation;
    /* access modifiers changed from: private */
    public final String mPrinterModelName;
    /* access modifiers changed from: private */
    public final String mPrinterSerialNumber;

    public PrintSettingDependencyBuilder(String str, String str2, String str3, int i, String str4) {
        this.mEscprLibPrinterId = str;
        this.mPrinterIpAddress = str2;
        this.mPrinterSerialNumber = str3;
        this.mPrinterLocation = i;
        this.mPrinterModelName = str4;
    }

    public PrinterAdapter createPrinterAdapter() {
        return new PsPrinterAdapter();
    }

    public InkRplnRepository createInkRplnRepository() {
        return new InkRplnRepository(true);
    }

    class PsPrinterAdapter extends PrinterAdapter {
        PsPrinterAdapter() {
        }

        public String getSerialNo(@NonNull Context context) {
            return PrintSettingDependencyBuilder.this.mPrinterSerialNumber;
        }

        public String getNonRemotePrinterDeviceId(@NonNull Context context) {
            return PrintSettingDependencyBuilder.this.mPrinterModelName;
        }

        public boolean isRemotePrinter(@NonNull Context context) {
            return PrintSettingDependencyBuilder.this.mPrinterLocation == 2;
        }

        public void activateEma() {
            MaintainPrinter2 instance = MaintainPrinter2.getInstance();
            instance.doInitDriver(IprintApplication.getInstance(), 2);
            if (instance.doProbePrinter(60, PrintSettingDependencyBuilder.this.mEscprLibPrinterId, PrintSettingDependencyBuilder.this.mPrinterIpAddress, PrintSettingDependencyBuilder.this.mPrinterLocation) == 0) {
                instance.setMSearchPos(0);
                instance.doSetPrinter();
                super.activateEma();
            }
        }
    }
}
