123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192 |
- package com.epson.mobilephone.common.maintain2;
- import android.content.Context;
- import com.epson.mobilephone.common.EpLog;
- import com.epson.mobilephone.common.escpr.EscprLib;
- import java.util.EnumMap;
- public class MaintainPrinter2 {
- public static final int STATUS_BUSY = 2;
- public static final int STATUS_CANCELLING = 3;
- public static final int STATUS_ERROR = 4;
- public static final int STATUS_IDEL = 0;
- public static final int STATUS_PRINTING = 1;
- private static Object lockObj = new Object();
- private static final MaintainPrinter2 maintainPrinter_INSTANCE = new MaintainPrinter2();
- protected EscprLib mEscpLib = EscprLib.getInstance();
- protected MaintainPrinterInfo2 mPrinterInfor = new MaintainPrinterInfo2();
- protected int mSearchPos = 0;
- private MaintainPrinter2() {
- }
- public static MaintainPrinter2 getInstance() {
- return maintainPrinter_INSTANCE;
- }
- public void setMSearchPos(int i) {
- mSearchPos = i;
- }
- public EscprLib getMEscpLib() {
- return mEscpLib;
- }
- public MaintainPrinterInfo2 getMPrinterInfor() {
- return mPrinterInfor;
- }
- public int getMSearchPos() {
- return mSearchPos;
- }
- public int doInitDriver(Context context, int i) {
- EpLog.m78i("MaintainPrinter2", " @@@@@@@ doInitDriver @");
- EpLog.m77i(mEscpLib.is64bit() ? "Native is operating at ☆ 64 bit !!" : "Native is operating at 32 bit");
- return mEscpLib.epsWrapperInitDriver(context, i);
- }
- public int doReleaseDriver() {
- EpLog.m78i("MaintainPrinter2", " xxxxxxx doReleaseDriver x");
- return mEscpLib.release_driver();
- }
- public int doFindPrinter(int i, int i2) {
- int doFindPrinter;
- synchronized (lockObj) {
- EpLog.m78i("MaintainPrinter2", "**********Call do find printer************");
- mEscpLib.setSearchStt(true);
- mEscpLib.resetIPAdressCheck();
- EpLog.m78i("MaintainPrinter2", "findType = " + i);
- doFindPrinter = mEscpLib.doFindPrinter(i, i2);
- EpLog.m78i("MaintainPrinter2", "**********Finish do find printer************");
- }
- return doFindPrinter;
- }
- public int doGetLang() {
- return mEscpLib.get_lang();
- }
- public String doGetIp() {
- return mEscpLib.epsWrapperGetIp();
- }
- public String doGetId() {
- return mEscpLib.epsWrapperGetId();
- }
- public int doCancelFindPrinter() {
- mEscpLib.setSearchStt(false);
- return mEscpLib.epsWrapperCancelFindPrinter();
- }
- public int doSetPrinter() {
- return mEscpLib.set_printer(mSearchPos);
- }
- public int doGetStatus() {
- int epsWrapperGetStatus;
- synchronized (lockObj) {
- epsWrapperGetStatus = mEscpLib.epsWrapperGetStatus(mPrinterInfor.getMStatus());
- }
- return epsWrapperGetStatus;
- }
- public int doDoMainteCmd(int i) {
- int epsWrapperDoMainteCmd;
- synchronized (lockObj) {
- EpLog.m78i("MaintainPrinter2", "**********doDoMainteCmd************");
- epsWrapperDoMainteCmd = mEscpLib.epsWrapperDoMainteCmd(i);
- }
- return epsWrapperDoMainteCmd;
- }
- public int doGetInkInfo() {
- int epsWrapperGetInkInfo2;
- synchronized (lockObj) {
- epsWrapperGetInkInfo2 = mEscpLib.epsWrapperGetInkInfo2(mPrinterInfor);
- }
- return epsWrapperGetInkInfo2;
- }
- public int doProbePrinter(int i, String str, String str2, int i2) {
- int epsWrapperProbePrinter2;
- synchronized (lockObj) {
- EpLog.m78i("MaintainPrinter2", "**********Call doProbePrinter************");
- mEscpLib.resetIPAdressCheck();
- epsWrapperProbePrinter2 = mEscpLib.epsWrapperProbePrinter2(i, str, str2, i2);
- if (epsWrapperProbePrinter2 < 0) {
- EpLog.m72e("MaintainPrinter2", "ret=" + epsWrapperProbePrinter2);
- }
- EpLog.m78i("MaintainPrinter2", "**********Finish doProbePrinter************");
- }
- return epsWrapperProbePrinter2;
- }
- private int[] getStatus() {
- return getMPrinterInfor().getMStatus();
- }
- public int[] getMediaInfo(int i, int i2) {
- return mEscpLib.epsWrapperGetMediaInfo(i, i2);
- }
- public int[] getPaperInfo() {
- int[] epsWrapperGetPaperInfo;
- synchronized (lockObj) {
- epsWrapperGetPaperInfo = mEscpLib.epsWrapperGetPaperInfo();
- }
- return epsWrapperGetPaperInfo;
- }
- public int getFirmwareInfo(EnumMap<EscprLib.PrinterFirmInfo, String> enumMap) {
- int firmwareInfo;
- synchronized (lockObj) {
- firmwareInfo = mEscpLib.getFirmwareInfo(enumMap);
- }
- return firmwareInfo;
- }
- public int getBatteryInfo(BatteryInfo batteryInfo) {
- int batteryInfo2;
- synchronized (lockObj) {
- batteryInfo2 = mEscpLib.getBatteryInfo(batteryInfo);
- }
- return batteryInfo2;
- }
- public int getBatteryInfo(BatteryInfoEx batteryInfoEx) {
- int batteryInfoEx2;
- synchronized (lockObj) {
- batteryInfoEx2 = mEscpLib.getBatteryInfoEx(batteryInfoEx);
- }
- return batteryInfoEx2;
- }
- public int[] getMaintenanceBoxInformation() {
- int[] epsWrapperGetMaintenanceBoxInformation;
- synchronized (lockObj) {
- epsWrapperGetMaintenanceBoxInformation = mEscpLib.epsWrapperGetMaintenanceBoxInformation();
- }
- return epsWrapperGetMaintenanceBoxInformation;
- }
- public int getEmaStatus(int[] iArr) {
- int epsWrapperGetEmaStatus;
- synchronized (lockObj) {
- epsWrapperGetEmaStatus = mEscpLib.epsWrapperGetEmaStatus(iArr);
- }
- return epsWrapperGetEmaStatus;
- }
- public int setEmaStatus(int i) {
- int epsWrapperSetEmaStatus;
- synchronized (lockObj) {
- epsWrapperSetEmaStatus = mEscpLib.epsWrapperSetEmaStatus(i);
- }
- return epsWrapperSetEmaStatus;
- }
- }
|