MaintainPrinter2.java 5.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191
  1. package com.epson.mobilephone.common.maintain2;
  2. import android.content.Context;
  3. import com.epson.mobilephone.common.escpr.EscprLib;
  4. import java.util.EnumMap;
  5. public class MaintainPrinter2 {
  6. public static final int STATUS_BUSY = 2;
  7. public static final int STATUS_CANCELLING = 3;
  8. public static final int STATUS_ERROR = 4;
  9. public static final int STATUS_IDEL = 0;
  10. public static final int STATUS_PRINTING = 1;
  11. private static Object lockObj = new Object();
  12. private static final MaintainPrinter2 maintainPrinter_INSTANCE = new MaintainPrinter2();
  13. protected EscprLib mEscpLib = EscprLib.getInstance();
  14. protected MaintainPrinterInfo2 mPrinterInfor = new MaintainPrinterInfo2();
  15. protected int mSearchPos = 0;
  16. private MaintainPrinter2() {
  17. }
  18. public static MaintainPrinter2 getInstance() {
  19. return maintainPrinter_INSTANCE;
  20. }
  21. public void setMSearchPos(int i) {
  22. mSearchPos = i;
  23. }
  24. public EscprLib getMEscpLib() {
  25. return mEscpLib;
  26. }
  27. public MaintainPrinterInfo2 getMPrinterInfor() {
  28. return mPrinterInfor;
  29. }
  30. public int getMSearchPos() {
  31. return mSearchPos;
  32. }
  33. public int doInitDriver(Context context, int i) {
  34. EpLog.i("MaintainPrinter2", " @@@@@@@ doInitDriver @");
  35. EpLog.m77i(mEscpLib.is64bit() ? "Native is operating at ☆ 64 bit !!" : "Native is operating at 32 bit");
  36. return mEscpLib.epsWrapperInitDriver(context, i);
  37. }
  38. public int doReleaseDriver() {
  39. EpLog.i("MaintainPrinter2", " xxxxxxx doReleaseDriver x");
  40. return mEscpLib.release_driver();
  41. }
  42. public int doFindPrinter(int i, int i2) {
  43. int doFindPrinter;
  44. synchronized (lockObj) {
  45. EpLog.i("MaintainPrinter2", "**********Call do find printer************");
  46. mEscpLib.setSearchStt(true);
  47. mEscpLib.resetIPAdressCheck();
  48. EpLog.i("MaintainPrinter2", "findType = " + i);
  49. doFindPrinter = mEscpLib.doFindPrinter(i, i2);
  50. EpLog.i("MaintainPrinter2", "**********Finish do find printer************");
  51. }
  52. return doFindPrinter;
  53. }
  54. public int doGetLang() {
  55. return mEscpLib.get_lang();
  56. }
  57. public String doGetIp() {
  58. return mEscpLib.epsWrapperGetIp();
  59. }
  60. public String doGetId() {
  61. return mEscpLib.epsWrapperGetId();
  62. }
  63. public int doCancelFindPrinter() {
  64. mEscpLib.setSearchStt(false);
  65. return mEscpLib.epsWrapperCancelFindPrinter();
  66. }
  67. public int doSetPrinter() {
  68. return mEscpLib.set_printer(mSearchPos);
  69. }
  70. public int doGetStatus() {
  71. int epsWrapperGetStatus;
  72. synchronized (lockObj) {
  73. epsWrapperGetStatus = mEscpLib.epsWrapperGetStatus(mPrinterInfor.getMStatus());
  74. }
  75. return epsWrapperGetStatus;
  76. }
  77. public int doDoMainteCmd(int i) {
  78. int epsWrapperDoMainteCmd;
  79. synchronized (lockObj) {
  80. EpLog.i("MaintainPrinter2", "**********doDoMainteCmd************");
  81. epsWrapperDoMainteCmd = mEscpLib.epsWrapperDoMainteCmd(i);
  82. }
  83. return epsWrapperDoMainteCmd;
  84. }
  85. public int doGetInkInfo() {
  86. int epsWrapperGetInkInfo2;
  87. synchronized (lockObj) {
  88. epsWrapperGetInkInfo2 = mEscpLib.epsWrapperGetInkInfo2(mPrinterInfor);
  89. }
  90. return epsWrapperGetInkInfo2;
  91. }
  92. public int doProbePrinter(int i, String str, String str2, int i2) {
  93. int epsWrapperProbePrinter2;
  94. synchronized (lockObj) {
  95. EpLog.i("MaintainPrinter2", "**********Call doProbePrinter************");
  96. mEscpLib.resetIPAdressCheck();
  97. epsWrapperProbePrinter2 = mEscpLib.epsWrapperProbePrinter2(i, str, str2, i2);
  98. if (epsWrapperProbePrinter2 < 0) {
  99. EpLog.m72e("MaintainPrinter2", "ret=" + epsWrapperProbePrinter2);
  100. }
  101. EpLog.i("MaintainPrinter2", "**********Finish doProbePrinter************");
  102. }
  103. return epsWrapperProbePrinter2;
  104. }
  105. private int[] getStatus() {
  106. return getMPrinterInfor().getMStatus();
  107. }
  108. public int[] getMediaInfo(int i, int i2) {
  109. return mEscpLib.epsWrapperGetMediaInfo(i, i2);
  110. }
  111. public int[] getPaperInfo() {
  112. int[] epsWrapperGetPaperInfo;
  113. synchronized (lockObj) {
  114. epsWrapperGetPaperInfo = mEscpLib.epsWrapperGetPaperInfo();
  115. }
  116. return epsWrapperGetPaperInfo;
  117. }
  118. public int getFirmwareInfo(EnumMap<EscprLib.PrinterFirmInfo, String> enumMap) {
  119. int firmwareInfo;
  120. synchronized (lockObj) {
  121. firmwareInfo = mEscpLib.getFirmwareInfo(enumMap);
  122. }
  123. return firmwareInfo;
  124. }
  125. public int getBatteryInfo(BatteryInfo batteryInfo) {
  126. int batteryInfo2;
  127. synchronized (lockObj) {
  128. batteryInfo2 = mEscpLib.getBatteryInfo(batteryInfo);
  129. }
  130. return batteryInfo2;
  131. }
  132. public int getBatteryInfo(BatteryInfoEx batteryInfoEx) {
  133. int batteryInfoEx2;
  134. synchronized (lockObj) {
  135. batteryInfoEx2 = mEscpLib.getBatteryInfoEx(batteryInfoEx);
  136. }
  137. return batteryInfoEx2;
  138. }
  139. public int[] getMaintenanceBoxInformation() {
  140. int[] epsWrapperGetMaintenanceBoxInformation;
  141. synchronized (lockObj) {
  142. epsWrapperGetMaintenanceBoxInformation = mEscpLib.epsWrapperGetMaintenanceBoxInformation();
  143. }
  144. return epsWrapperGetMaintenanceBoxInformation;
  145. }
  146. public int getEmaStatus(int[] iArr) {
  147. int epsWrapperGetEmaStatus;
  148. synchronized (lockObj) {
  149. epsWrapperGetEmaStatus = mEscpLib.epsWrapperGetEmaStatus(iArr);
  150. }
  151. return epsWrapperGetEmaStatus;
  152. }
  153. public int setEmaStatus(int i) {
  154. int epsWrapperSetEmaStatus;
  155. synchronized (lockObj) {
  156. epsWrapperSetEmaStatus = mEscpLib.epsWrapperSetEmaStatus(i);
  157. }
  158. return epsWrapperSetEmaStatus;
  159. }
  160. }