/*     */ package com.seuic.scanner;
/*     */ 
/*     */ import android.content.Context;
/*     */ import android.os.Handler;
/*     */ import android.os.Message;
/*     */ import android.text.TextUtils;
/*     */ import android.util.Log;
/*     */ import android.util.SparseIntArray;
/*     */ 
/*     */ public class HHPScanner
/*     */   extends Scanner
/*     */ {
/*  13 */   final String LOG_TAG = "HHPScanner";
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */   
/*  25 */   private final int DEFAULT_PARAMETER = 849;
/*     */   
/*     */   private Thread mThread;
/*     */   private boolean isEnabled = true;
/*     */   private static DecodeCallback callback;
/*  30 */   private Handler mHandler = new DecodeHandler();
/*  31 */   private Runnable runnable = new DecodeRunnable();
/*     */   boolean scanFinished; static { System.loadLibrary("HHPScanner_jni"); paramArray.put(257, 1); paramArray.put(258, 17); paramArray.put(259, 33); paramArray.put(260, 49); paramArray.put(261, 65); paramArray.put(263, 2); paramArray.put(264, 18); paramArray.put(265, 34); paramArray.put(266, 3); paramArray.put(267, 19); paramArray.put(265, 35); paramArray.put(273, 20); paramArray.put(289, 113); paramArray.put(290, 114); paramArray.put(291, 115); paramArray.put(292, 145); paramArray.put(305, 209); paramArray.put(307, 212); paramArray.put(310, 210); paramArray.put(311, 211); paramArray.put(321, 241); paramArray.put(322, 242); paramArray.put(323, 243); paramArray.put(337, 257); paramArray.put(338, 258); paramArray.put(339, 259); paramArray.put(341, 260); paramArray.put(353, 273); paramArray.put(354, 274); paramArray.put(355, 275); paramArray.put(401, 289); paramArray.put(402, 290); paramArray.put(403, 291); paramArray.put(513, 305); paramArray.put(514, 306); paramArray.put(515, 307); paramArray.put(577, 321); paramArray.put(578, 322); paramArray.put(579, 323); paramArray.put(593, 337); paramArray.put(594, 338); paramArray.put(595, 339); paramArray.put(609, 369); paramArray.put(617, 370); paramArray.put(610, 385); paramArray.put(618, 386); paramArray.put(611, 401); paramArray.put(612, 417); paramArray.put(613, 433); paramArray.put(689, 561); paramArray.put(690, 562); paramArray.put(691, 563); paramArray.put(836, 564); paramArray.put(529, 497); paramArray.put(705, 577); paramArray.put(706, 578); paramArray.put(707, 579); paramArray.put(721, 593); paramArray.put(722, 594); paramArray.put(723, 595); paramArray.put(561, 609); paramArray.put(562, 610); paramArray.put(563, 611); paramArray.put(737, 625); paramArray.put(739, 626); paramArray.put(739, 627); paramArray.put(545, 641); paramArray.put(546, 642); paramArray.put(547, 643); paramArray.put(753, 657); paramArray.put(754, 658); paramArray.put(755, 659); paramArray.put(769, 705); paramArray.put(770, 706); paramArray.put(771, 707); paramArray.put(785, 753); paramArray.put(786, 754); paramArray.put(787, 755); paramArray.put(788, 756);
/*     */     paramArray.put(817, 785);
/*     */     paramArray.put(818, 786);
/*  35 */     paramArray.put(7, 850); } HHPScanner(Context context) { super(context);
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */     
/* 187 */     this.scanFinished = true; }
/*     */   void decode() { HHPObject object = new HHPObject(); if (JNIGetDecode(object, 5000) > 0) { ScanLed.setLed(1); Message msg = this.mHandler.obtainMessage(); msg.obj = object; this.mHandler.sendMessage(msg); }
/* 189 */      this.scanFinished = true; } void scan() { synchronized (this.runnable) {
/* 190 */       if (this.isEnabled)
/* 191 */         if (this.scanFinished) {
/* 192 */           this.runnable.notify();
/*     */         } else {
/* 194 */           this.scanFinished = true;
/*     */         }  
/*     */     }  } public boolean open() { if (JNIOpen() > -1) {
/*     */       this.mThread = new Thread(this.runnable); this.mThread.start(); return true;
/*     */     } 
/*     */     return false; }
/*     */   public void close() { JNIClose(); }
/*     */   public void startScan() { scan(); }
/* 202 */   public void stopScan() { JNIStopDecode(); }
/*     */ 
/*     */ 
/*     */   
/*     */   public int getParams(int num) {
/* 207 */     if (paramArray.get(num, -1) == -1 && num != 801) {
/* 208 */       return -1;
/*     */     }
/*     */     
/* 211 */     ScanParam param = new ScanParam();
/* 212 */     param.id = paramArray.get(num);
/* 213 */     JNIGetParameter(param);
/*     */ 
/*     */     
/* 216 */     if (num == 7) {
/* 217 */       Log.i("HHPScanner", "12345");
/*     */     }
/*     */     
/* 220 */     return param.value;
/*     */   }
/*     */ 
/*     */   
/*     */   public void enable() {
/* 225 */     JNIEnable();
/*     */   }
/*     */ 
/*     */   
/*     */   public void disable() {
/* 230 */     JNIDisable();
/*     */   }
/*     */ 
/*     */ 
/*     */   
/*     */   public boolean setParams(int num, int value) {
/* 236 */     if (paramArray.get(num, -1) == -1 && num != 801) {
/* 237 */       return false;
/*     */     }
/*     */     
/* 240 */     ScanParam param = new ScanParam();
/* 241 */     if (num != 801) {
/* 242 */       param.id = paramArray.get(num);
/*     */     } else {
/*     */       
/* 245 */       param.id = 849;
/*     */     } 
/* 247 */     param.value = value;
/*     */     
/* 249 */     if (JNISetParameter(param) == 1) {
/* 250 */       return true;
/*     */     }
/* 252 */     return false;
/*     */   }
/*     */   
/*     */   public void setOCRTemplate(String template) {
/* 256 */     JNISetOCRTemplate(template);
/*     */   }
/*     */ 
/*     */   
/*     */   public SparseIntArray getAllParams() {
/* 261 */     return paramArray;
/*     */   }
/*     */   
/*     */   static class DecodeHandler extends Handler {
/*     */     public void handleMessage(Message msg) {
/* 266 */       HHPObject object = (HHPObject)msg.obj;
/* 267 */       if (HHPScanner.callback != null && !TextUtils.isEmpty(object.msg))
/* 268 */         HHPScanner.callback.onDecodeComplete(object.msg); 
/*     */     }
/*     */   }
/*     */   
/*     */   class DecodeRunnable
/*     */     implements Runnable
/*     */   {
/*     */     public void run() {
/*     */       while (true) {
/* 277 */         synchronized (HHPScanner.this.runnable) {
/*     */           try {
/* 279 */             HHPScanner.this.runnable.wait();
/* 280 */           } catch (InterruptedException e) {
/* 281 */             Log.e("HHPScanner", "DecodeRunnable:" + e.getMessage());
/*     */           } 
/* 283 */           HHPScanner.this.decode();
/*     */         } 
/*     */       } 
/*     */     }
/*     */   }
/*     */ 
/*     */   
/*     */   public void setDecodeCallBack(DecodeCallback decodeCallback) {
/* 291 */     callback = decodeCallback;
/*     */   }
/*     */   
/*     */   public void setDecodeInfoCallBack(DecodeInfoCallBack callback) {}
/*     */   
/*     */   final native int JNIOpen();
/*     */   
/*     */   final native int JNIClose();
/*     */   
/*     */   final native int JNIEnable();
/*     */   
/*     */   final native int JNIDisable();
/*     */   
/*     */   final native int JNISetOCRTemplate(String paramString);
/*     */   
/*     */   final native int JNIStopDecode();
/*     */   
/*     */   final native int JNIGetDecode(HHPObject paramHHPObject, int paramInt);
/*     */   
/*     */   final native int JNISetParameter(ScanParam paramScanParam);
/*     */   
/*     */   final native int JNIGetParameter(ScanParam paramScanParam);
/*     */ }


/* Location:              E:\Demo\ChaoRan_A9L\libs\ScannerAPI.jar!\com\seuic\scanner\HHPScanner.class
 * Java compiler version: 6 (50.0)
 * JD-Core Version:       1.1.3
 */