/*    */ package com.seuic.scanner;
/*    */ 
/*    */ import android.app.ActivityManager;
/*    */ import android.content.Context;
/*    */ import android.content.Intent;
/*    */ import android.util.SparseIntArray;
/*    */ import java.util.List;
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ public abstract class Scanner
/*    */   implements IScanner
/*    */ {
/*    */   public static final String ACTION_SEND_BARCODE = "com.android.server.scannerservice.broadcast";
/*    */   public static final String ACTION_SEND_KEY = "scannerdata";
/*    */   public static final String ACTION_SEND_KEY_CODE_TYPE = "codetype";
/*    */   private static final String ACTION_SCANNER_SERVICE_TERMINATE = "com.android.scanner.TERMINATE";
/*    */   private static final String SERVICE_NAME = "com.seuic.scanner.service.ScanService";
/*    */   private static final String ACTION_START_SCAN_SERVICE = "com.seuic.action.START_SCANSERVICE";
/*    */   protected boolean isEnabled = true;
/* 22 */   protected static SparseIntArray paramArray = new SparseIntArray();
/*    */   
/*    */   Context mContext;
/*    */   
/*    */   Scanner(Context context) {
/* 27 */     this.mContext = context;
/*    */   }
/*    */   public abstract SparseIntArray getAllParams();
/*    */   
/*    */   public static void stopScanService(Context context) {
/* 32 */     while (isRunning(context, "com.seuic.scanner.service.ScanService")) {
/* 33 */       context.sendBroadcast(new Intent("com.android.scanner.TERMINATE"));
/*    */     }
/*    */     try {
/* 36 */       Thread.sleep(150L);
/* 37 */     } catch (InterruptedException e) {
/* 38 */       e.printStackTrace();
/*    */     } 
/*    */   }
/*    */   
/*    */   public static void startScanService(Context context) {
/* 43 */     context.sendBroadcast(new Intent("com.seuic.action.START_SCANSERVICE"));
/*    */   }
/*    */   
/*    */   private static boolean isRunning(Context context, String serviceName) {
/* 47 */     ActivityManager am = (ActivityManager)context.getSystemService("activity");
/* 48 */     List<ActivityManager.RunningServiceInfo> infos = am.getRunningServices(100);
/* 49 */     for (ActivityManager.RunningServiceInfo serviceInfo : infos) {
/* 50 */       if (serviceInfo.service.getClassName().equals(serviceName)) {
/* 51 */         return true;
/*    */       }
/*    */     } 
/* 54 */     return false;
/*    */   }
/*    */ 
/*    */   
/*    */   public void enable() {
/* 59 */     this.isEnabled = true;
/*    */   }
/*    */ 
/*    */   
/*    */   public void disable() {
/* 64 */     this.isEnabled = false;
/*    */   }
/*    */ }


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