PaperSourceInfo.java 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232
  1. package epson.print.screen;
  2. import android.content.Context;
  3. import android.os.AsyncTask;
  4. import android.os.Handler;
  5. import com.epson.mobilephone.common.EpLog;
  6. import com.epson.mobilephone.common.maintain2.MaintainPrinter2;
  7. import epson.print.Util.EPLog;
  8. import java.util.ArrayList;
  9. public class PaperSourceInfo {
  10. private static final long CHECK_INTEVAL = 4000;
  11. private static final int EPS_COMM_BID = 2;
  12. public static final String KEY_PAPERSOURCEINFO = "PAPERSOURCEINFO";
  13. public static final int NOTIFY_PAPERSOURCEINFO = 100;
  14. private static final String TAG = "PaperSourceInfo";
  15. public static PaperSourceInfo instance;
  16. /* access modifiers changed from: private */
  17. public MaintainPrinter2 mPrinter = MaintainPrinter2.getInstance();
  18. private PaparInfoTask paparInfoTask = null;
  19. private PaperSourceInfo(Context context) {
  20. EpLog.i();
  21. this.mPrinter.doInitDriver(context, 2);
  22. }
  23. public static PaperSourceInfo getInstance(Context context) {
  24. if (instance == null) {
  25. instance = new PaperSourceInfo(context);
  26. }
  27. return instance;
  28. }
  29. public void start(Context context, Handler handler) {
  30. EPLog.i(TAG, "call start()");
  31. if (this.paparInfoTask == null) {
  32. this.paparInfoTask = new PaparInfoTask();
  33. this.paparInfoTask.execute(new Object[]{context, handler});
  34. }
  35. }
  36. public void stop() {
  37. EPLog.i(TAG, "call stop()");
  38. if (this.paparInfoTask != null) {
  39. this.mPrinter.doCancelFindPrinter();
  40. this.paparInfoTask.cancel(true);
  41. this.paparInfoTask = null;
  42. }
  43. }
  44. public class PaparInfoTask extends AsyncTask<Object, Void, Void> {
  45. public PaparInfoTask() {
  46. }
  47. /* access modifiers changed from: protected */
  48. /* JADX WARNING: Removed duplicated region for block: B:41:0x0149 */
  49. /* Code decompiled incorrectly, please refer to instructions dump. */
  50. public java.lang.Void doInBackground(java.lang.Object... r13) {
  51. /*
  52. r12 = this;
  53. r0 = 0
  54. r1 = r13[r0]
  55. android.content.Context r1 = (android.content.Context) r1
  56. r2 = 1
  57. r13 = r13[r2]
  58. android.os.Handler r13 = (android.os.Handler) r13
  59. r3 = 100
  60. epson.print.MyPrinter r4 = epson.print.MyPrinter.getCurPrinter(r1) // Catch:{ InterruptedException -> 0x0141 }
  61. int r5 = r4.getLocation() // Catch:{ InterruptedException -> 0x0141 }
  62. if (r5 == r2) goto L_0x001b
  63. r1 = 3
  64. if (r5 == r1) goto L_0x0025
  65. goto L_0x0142
  66. L_0x001b:
  67. java.lang.String r5 = "printer"
  68. java.lang.String r1 = com.epson.mobilephone.common.wifidirect.WiFiDirectManager.getConnectInfo(r1, r5) // Catch:{ InterruptedException -> 0x0141 }
  69. if (r1 == 0) goto L_0x0025
  70. goto L_0x0142
  71. L_0x0025:
  72. boolean r1 = r12.isCancelled() // Catch:{ InterruptedException -> 0x0141 }
  73. r5 = 4000(0xfa0, double:1.9763E-320)
  74. if (r1 != 0) goto L_0x008b
  75. epson.print.screen.PaperSourceInfo r1 = epson.print.screen.PaperSourceInfo.this // Catch:{ InterruptedException -> 0x0141 }
  76. com.epson.mobilephone.common.maintain2.MaintainPrinter2 r1 = r1.mPrinter // Catch:{ InterruptedException -> 0x0141 }
  77. r7 = 60
  78. java.lang.String r8 = r4.getPrinterId() // Catch:{ InterruptedException -> 0x0141 }
  79. java.lang.String r9 = r4.getIp() // Catch:{ InterruptedException -> 0x0141 }
  80. int r10 = r4.getLocation() // Catch:{ InterruptedException -> 0x0141 }
  81. int r1 = r1.doProbePrinter(r7, r8, r9, r10) // Catch:{ InterruptedException -> 0x0141 }
  82. r7 = -1300(0xfffffffffffffaec, float:NaN)
  83. if (r1 == r7) goto L_0x0071
  84. if (r1 == 0) goto L_0x0063
  85. java.lang.String r0 = "PaperSourceInfo"
  86. java.lang.StringBuilder r2 = new java.lang.StringBuilder // Catch:{ InterruptedException -> 0x0141 }
  87. r2.<init>() // Catch:{ InterruptedException -> 0x0141 }
  88. java.lang.String r4 = "doProbePrinter() return "
  89. r2.append(r4) // Catch:{ InterruptedException -> 0x0141 }
  90. r2.append(r1) // Catch:{ InterruptedException -> 0x0141 }
  91. java.lang.String r1 = r2.toString() // Catch:{ InterruptedException -> 0x0141 }
  92. epson.print.Util.EPLog.m307e((java.lang.String) r0, (java.lang.String) r1) // Catch:{ InterruptedException -> 0x0141 }
  93. goto L_0x0142
  94. L_0x0063:
  95. epson.print.screen.PaperSourceInfo r1 = epson.print.screen.PaperSourceInfo.this // Catch:{ InterruptedException -> 0x0141 }
  96. com.epson.mobilephone.common.maintain2.MaintainPrinter2 r1 = r1.mPrinter // Catch:{ InterruptedException -> 0x0141 }
  97. int r1 = r1.doSetPrinter() // Catch:{ InterruptedException -> 0x0141 }
  98. if (r1 == 0) goto L_0x008b
  99. goto L_0x0142
  100. L_0x0071:
  101. java.lang.String r7 = "PaperSourceInfo"
  102. java.lang.StringBuilder r8 = new java.lang.StringBuilder // Catch:{ InterruptedException -> 0x0141 }
  103. r8.<init>() // Catch:{ InterruptedException -> 0x0141 }
  104. java.lang.String r9 = "doProbePrinter() return "
  105. r8.append(r9) // Catch:{ InterruptedException -> 0x0141 }
  106. r8.append(r1) // Catch:{ InterruptedException -> 0x0141 }
  107. java.lang.String r1 = r8.toString() // Catch:{ InterruptedException -> 0x0141 }
  108. epson.print.Util.EPLog.i(r7, r1) // Catch:{ InterruptedException -> 0x0141 }
  109. java.lang.Thread.sleep(r5) // Catch:{ InterruptedException -> 0x0141 }
  110. goto L_0x0025
  111. L_0x008b:
  112. boolean r1 = r12.isCancelled() // Catch:{ InterruptedException -> 0x0141 }
  113. if (r1 != 0) goto L_0x0142
  114. epson.print.screen.PaperSourceInfo r1 = epson.print.screen.PaperSourceInfo.this // Catch:{ InterruptedException -> 0x0141 }
  115. com.epson.mobilephone.common.maintain2.MaintainPrinter2 r1 = r1.mPrinter // Catch:{ InterruptedException -> 0x0141 }
  116. int[] r1 = r1.getPaperInfo() // Catch:{ InterruptedException -> 0x0141 }
  117. if (r1 != 0) goto L_0x00a6
  118. java.lang.String r0 = "PaperSourceInfo"
  119. java.lang.String r1 = "getPaperInfo() return null"
  120. epson.print.Util.EPLog.m307e((java.lang.String) r0, (java.lang.String) r1) // Catch:{ InterruptedException -> 0x0141 }
  121. goto L_0x0142
  122. L_0x00a6:
  123. r4 = r1[r0] // Catch:{ InterruptedException -> 0x0141 }
  124. r7 = -1100(0xfffffffffffffbb4, float:NaN)
  125. if (r4 == r7) goto L_0x0124
  126. if (r4 == 0) goto L_0x00c8
  127. java.lang.String r2 = "PaperSourceInfo"
  128. java.lang.StringBuilder r4 = new java.lang.StringBuilder // Catch:{ InterruptedException -> 0x0141 }
  129. r4.<init>() // Catch:{ InterruptedException -> 0x0141 }
  130. java.lang.String r5 = "getPaperInfo() return "
  131. r4.append(r5) // Catch:{ InterruptedException -> 0x0141 }
  132. r0 = r1[r0] // Catch:{ InterruptedException -> 0x0141 }
  133. r4.append(r0) // Catch:{ InterruptedException -> 0x0141 }
  134. java.lang.String r0 = r4.toString() // Catch:{ InterruptedException -> 0x0141 }
  135. epson.print.Util.EPLog.m307e((java.lang.String) r2, (java.lang.String) r0) // Catch:{ InterruptedException -> 0x0141 }
  136. goto L_0x0142
  137. L_0x00c8:
  138. r4 = r1[r2] // Catch:{ InterruptedException -> 0x0141 }
  139. java.lang.String r7 = "PaperSourceInfo"
  140. java.lang.StringBuilder r8 = new java.lang.StringBuilder // Catch:{ InterruptedException -> 0x0141 }
  141. r8.<init>() // Catch:{ InterruptedException -> 0x0141 }
  142. java.lang.String r9 = "getPaperInfo() number = "
  143. r8.append(r9) // Catch:{ InterruptedException -> 0x0141 }
  144. r9 = r1[r2] // Catch:{ InterruptedException -> 0x0141 }
  145. r8.append(r9) // Catch:{ InterruptedException -> 0x0141 }
  146. java.lang.String r8 = r8.toString() // Catch:{ InterruptedException -> 0x0141 }
  147. epson.print.Util.EPLog.i(r7, r8) // Catch:{ InterruptedException -> 0x0141 }
  148. if (r4 >= r2) goto L_0x00e5
  149. goto L_0x0142
  150. L_0x00e5:
  151. java.util.ArrayList r7 = new java.util.ArrayList // Catch:{ InterruptedException -> 0x0141 }
  152. r7.<init>() // Catch:{ InterruptedException -> 0x0141 }
  153. r8 = 0
  154. L_0x00eb:
  155. if (r8 >= r4) goto L_0x010c
  156. epson.print.screen.PaperSourceSetting r9 = new epson.print.screen.PaperSourceSetting // Catch:{ InterruptedException -> 0x0141 }
  157. r9.<init>() // Catch:{ InterruptedException -> 0x0141 }
  158. int r10 = r8 * 3
  159. int r11 = r10 + 2
  160. r11 = r1[r11] // Catch:{ InterruptedException -> 0x0141 }
  161. r9.paperSource = r11 // Catch:{ InterruptedException -> 0x0141 }
  162. int r11 = r10 + 3
  163. r11 = r1[r11] // Catch:{ InterruptedException -> 0x0141 }
  164. r9.paperSizeId = r11 // Catch:{ InterruptedException -> 0x0141 }
  165. int r10 = r10 + 4
  166. r10 = r1[r10] // Catch:{ InterruptedException -> 0x0141 }
  167. r9.paperTypeId = r10 // Catch:{ InterruptedException -> 0x0141 }
  168. r7.add(r9) // Catch:{ InterruptedException -> 0x0141 }
  169. int r8 = r8 + 1
  170. goto L_0x00eb
  171. L_0x010c:
  172. android.os.Bundle r1 = new android.os.Bundle // Catch:{ InterruptedException -> 0x0141 }
  173. r1.<init>() // Catch:{ InterruptedException -> 0x0141 }
  174. java.lang.String r4 = "PAPERSOURCEINFO"
  175. r1.putParcelableArrayList(r4, r7) // Catch:{ InterruptedException -> 0x0141 }
  176. android.os.Message r4 = new android.os.Message // Catch:{ InterruptedException -> 0x0141 }
  177. r4.<init>() // Catch:{ InterruptedException -> 0x0141 }
  178. r4.what = r3 // Catch:{ InterruptedException -> 0x0141 }
  179. r4.setData(r1) // Catch:{ InterruptedException -> 0x0141 }
  180. r13.sendMessage(r4) // Catch:{ InterruptedException -> 0x0141 }
  181. goto L_0x013c
  182. L_0x0124:
  183. java.lang.String r4 = "PaperSourceInfo"
  184. java.lang.StringBuilder r7 = new java.lang.StringBuilder // Catch:{ InterruptedException -> 0x0141 }
  185. r7.<init>() // Catch:{ InterruptedException -> 0x0141 }
  186. java.lang.String r8 = "getPaperInfo() return "
  187. r7.append(r8) // Catch:{ InterruptedException -> 0x0141 }
  188. r1 = r1[r0] // Catch:{ InterruptedException -> 0x0141 }
  189. r7.append(r1) // Catch:{ InterruptedException -> 0x0141 }
  190. java.lang.String r1 = r7.toString() // Catch:{ InterruptedException -> 0x0141 }
  191. epson.print.Util.EPLog.i(r4, r1) // Catch:{ InterruptedException -> 0x0141 }
  192. L_0x013c:
  193. java.lang.Thread.sleep(r5) // Catch:{ InterruptedException -> 0x0141 }
  194. goto L_0x008b
  195. L_0x0141:
  196. L_0x0142:
  197. boolean r0 = r12.isCancelled()
  198. r1 = 0
  199. if (r0 != 0) goto L_0x0160
  200. android.os.Bundle r0 = new android.os.Bundle
  201. r0.<init>()
  202. java.lang.String r2 = "PAPERSOURCEINFO"
  203. r0.putParcelableArrayList(r2, r1)
  204. android.os.Message r2 = new android.os.Message
  205. r2.<init>()
  206. r2.what = r3
  207. r2.setData(r0)
  208. r13.sendMessage(r2)
  209. L_0x0160:
  210. return r1
  211. */
  212. throw new UnsupportedOperationException("Method not decompiled: epson.print.screen.PaperSourceInfo.PaparInfoTask.doInBackground(java.lang.Object[]):java.lang.Void");
  213. }
  214. }
  215. public boolean checkPaperMissmatch(PrintSetting printSetting, ArrayList<PaperSourceSetting> arrayList) {
  216. for (int i = 0; i < arrayList.size(); i++) {
  217. if (printSetting.paperSourceValue == arrayList.get(i).paperSource && (printSetting.paperSizeValue != arrayList.get(i).paperSizeId || printSetting.paperTypeValue != arrayList.get(i).paperTypeId)) {
  218. return true;
  219. }
  220. }
  221. return false;
  222. }
  223. }