PageRenderTime 62ms CodeModel.GetById 20ms RepoModel.GetById 1ms app.codeStats 0ms

/lib/commonAPI/barcode/ext/platform/android/src/com/rho/barcode/emdk3/EMDK3Scanner.java

http://github.com/rhomobile/rhodes
Java | 1914 lines | 1699 code | 97 blank | 118 comment | 166 complexity | 1e04697776be705276fd77c4033d775d MD5 | raw file
Possible License(s): CC-BY-SA-3.0, MIT, Apache-2.0, LGPL-2.1, GPL-2.0, MPL-2.0-no-copyleft-exception
  1. package com.rho.barcode.emdk3;
  2. import java.util.ArrayList;
  3. import java.util.Collections;
  4. import java.util.List;
  5. import java.util.Map;
  6. import java.util.concurrent.Executors;
  7. import java.util.concurrent.ScheduledExecutorService;
  8. import java.util.concurrent.TimeUnit;
  9. import android.annotation.SuppressLint;
  10. import android.content.BroadcastReceiver;
  11. import android.content.Context;
  12. import android.content.Intent;
  13. import android.content.IntentFilter;
  14. import android.os.AsyncTask;
  15. import android.os.BatteryManager;
  16. import android.util.Pair;
  17. import com.rho.barcode.Barcode;
  18. import com.rho.barcode.BarcodeFactory;
  19. import com.rho.barcode.EMDKCommon;
  20. import com.rho.barcode.EMDKCommon.AutoValue;
  21. import com.rho.barcode.RhoScannerInfo;
  22. import com.rho.barcode.RhoScannerInfo.RhoScannerClass;
  23. import com.rho.barcode.emdk3.EMDK3ScannerSettings.Decoder;
  24. import com.rho.barcode.emdk3.EMDK3ScannerSettings.AllDecoders;
  25. import com.rho.barcode.emdk3.EMDK3ScannerSettings.Reader;
  26. import com.rho.barcode.emdk3.EMDK3ScannerSettings.Scan;
  27. import com.rhomobile.rhodes.Logger;
  28. import com.rhomobile.rhodes.RhodesActivity;
  29. import com.rhomobile.rhodes.api.IMethodResult;
  30. import com.rhomobile.rhodes.api.MethodResult;
  31. import com.rhomobile.rhodes.extmanager.IRhoConfig;
  32. import com.rhomobile.rhodes.extmanager.IRhoWebView;
  33. import com.rhomobile.rhodes.webview.GoogleWebView;
  34. import com.rhomobile.rhodes.webview.WebViewConfig;
  35. import com.symbol.emdk.barcode.ScanDataCollection;
  36. import com.symbol.emdk.barcode.Scanner;
  37. import com.symbol.emdk.barcode.Scanner.DataListener;
  38. import com.symbol.emdk.barcode.Scanner.StatusListener;
  39. import com.symbol.emdk.barcode.Scanner.TriggerType;
  40. import com.symbol.emdk.barcode.ScannerConfig;
  41. import com.symbol.emdk.barcode.ScannerException;
  42. import com.symbol.emdk.barcode.StatusData;
  43. import com.symbol.emdk.barcode.StatusData.ScannerStates;
  44. /**
  45. * If you add or change the parameter list (adding a parameter to the Rho.Barcode object, changing
  46. * support status) you will need to manually change it in these places:
  47. * - setProperty
  48. * - getProperty
  49. * - getSupportedProperties
  50. * - EMDK3ScannerSettings
  51. * - SettingString
  52. * - Defaults (if needed)
  53. * @author Ben Kennedy (NCVT73)
  54. *
  55. */
  56. public class EMDK3Scanner extends Barcode implements DataListener, StatusListener
  57. {
  58. public enum ENABLE_TYPE
  59. {
  60. ENABLE, TAKE
  61. }
  62. private static class Defaults
  63. {
  64. public static int DECODE_FREQUENCY = 3000;
  65. public static int DECODE_VOLUME = 5;
  66. public static int DECODE_DURATION = 250;
  67. public static boolean AUTOTAB = false;
  68. public static boolean AUTOENTER = false;
  69. }
  70. private static final String TAG = "EMDK3Scanner";
  71. private float batPercent;
  72. private boolean isMinimized = false;
  73. private boolean isEnabled = false;
  74. private boolean isScanning = false;
  75. private boolean didTakeEnableTheScanner = false;
  76. private boolean hasQueuedEnableTask = false;
  77. private boolean isInitialising = true;
  78. private boolean isBluetooth = false;
  79. private boolean emdk3_0bugOnStatusFired = false;
  80. private int emdk3_0onStatusAttempts = 0;
  81. private int setupRetryCount = 0;
  82. private String scannerName;
  83. private String scannerNameShort;
  84. private ENABLE_TYPE enableType;
  85. private IMethodResult enableCallback;
  86. private IMethodResult takeCallback;
  87. private AutoValue autoValue;
  88. private Scanner scanner;
  89. private RhoScannerInfo scannerInfo;
  90. private ScannerConfig scannerConfig;
  91. private ScannerConfig defaultScannerConfig;
  92. private ArrayList<String> supportedProperties;
  93. private ArrayList<Pair<String,String>> propertyQueue;
  94. private final ScheduledExecutorService setupRetryThread = Executors.newScheduledThreadPool(1);
  95. private final ScheduledExecutorService emdk3_0testerThread = Executors.newScheduledThreadPool(1);
  96. private BarcodeFactory factory;
  97. private static ArrayList<String> allProperties = new ArrayList<String>(216);
  98. @SuppressLint("DefaultLocale")
  99. /**
  100. * This doesnt completely setup this scanner object, you will need to call setupScanner to initialise
  101. * the scannerConfig and therefore the parameters. These two methods are seperated because setting up
  102. * each scanner is asynchronous, yet only one scanner can be in the process of setting up at one time.
  103. * The limitation is specifically only 1 scanner can be enabled, and the scanner must be enabled to
  104. * get the scannerConfig.
  105. *
  106. * @param id the String ID of the Scanner, for example "EMDK0"
  107. * @param scanner the EMDK3 scanner object
  108. * @param factory the calling factory
  109. * @author Ben Kennedy (NCVT73)
  110. */
  111. public EMDK3Scanner(String id, Scanner scanner, BarcodeFactory factory)
  112. {
  113. super(id);
  114. Logger.D(TAG, "EMDK3Scanner created: " + id);
  115. this.scannerId = id;
  116. this.scanner = scanner;
  117. this.factory = factory;
  118. scanner.addDataListener(this);
  119. scanner.addStatusListener(this);
  120. scannerInfo = new EMDK3ScannerInfo(scanner.getScannerInfo());
  121. scannerName = scannerInfo.getFriendlyName();
  122. scannerNameShort = scannerName.substring(0, 2).toUpperCase();
  123. isBluetooth = scannerInfo.isBluetooth();
  124. autoValue = AutoValue.NONE;
  125. propertyQueue = new ArrayList<Pair<String,String>>();
  126. EMDKCommon.setupProperties(this, scannerInfo);
  127. Logger.D(TAG, scannerNameShort + "-");
  128. }
  129. /**
  130. * Sets up the scanner. No other scanners should be enabled. Bluetooth scanners cannot be setup (scannerConfig obtained)
  131. * as we shouldnt initiate the Bluetooth connection until enable is called. Side effect is that properties wont be
  132. * able to be getted accurately until enable is called.
  133. *
  134. * @return isInitialising - whether the scanner is initialising. If this is true, other scanners should wait for
  135. * this object to fire factory.emdk3BarcodeHasSetup() before the next scanner initialises.
  136. * @author Ben Kennedy (NCVT73)
  137. */
  138. public boolean setupScanner()
  139. {
  140. Logger.D(TAG, scannerNameShort + " setupScanner+");
  141. boolean exitValue = false;
  142. if(isBluetooth)
  143. {
  144. Logger.D(TAG, scannerNameShort + " setupScanner isBluetooth");
  145. isInitialising = false;
  146. exitValue = false;
  147. }
  148. else
  149. {
  150. Logger.D(TAG, scannerNameShort + " setupScanner isNotBluetooth");
  151. try
  152. {
  153. scanner.enable();
  154. //EMDK3.0 does not fire onStatus(IDLE) when the scanner is first enabled (this is a bug)
  155. //This hack tries to fire IDLE when the scanner has enabled.
  156. emdk3_0testerThread.schedule(new Runnable(){
  157. @Override
  158. public void run()
  159. {
  160. emdk3_0onStatusAttempts++;
  161. if(!emdk3_0bugOnStatusFired)
  162. {
  163. if(scanner.isEnabled())
  164. {
  165. Logger.D(TAG, "EMDK3.0 fired onStatus.IDLE after " + emdk3_0onStatusAttempts + " attempts");
  166. onStatus(ScannerStates.IDLE);
  167. }
  168. else
  169. {
  170. Logger.D(TAG, "EMDK3.0 is not enabled after " + emdk3_0onStatusAttempts + " attempts");
  171. if(emdk3_0onStatusAttempts < 50)
  172. {
  173. emdk3_0testerThread.schedule(this,10,TimeUnit.MILLISECONDS);
  174. }
  175. }
  176. }
  177. }
  178. },10,TimeUnit.MILLISECONDS);
  179. scanner.isEnabled();
  180. }
  181. catch (ScannerException e)
  182. {
  183. Logger.E(TAG, "setupScanner: Scanner Exception " + e);
  184. e.printStackTrace();
  185. if(++setupRetryCount < 3)
  186. {
  187. //Try setting up the scanner in 100ms
  188. setupRetryThread.schedule(new Runnable(){
  189. @Override
  190. public void run(){
  191. setupScanner();
  192. }
  193. }, 100, TimeUnit.MILLISECONDS);
  194. exitValue = true;
  195. }
  196. else
  197. {
  198. Logger.E(TAG, "Unable to setup the " + scannerName + " after multiple attempts");
  199. //It might still be able to work normally when the user calls enable. If this is the case then
  200. //let it behave as normally as possible (disable the ENABLE->GetSettings->DISABLE call)
  201. //The drawback from not being able to setup the scanner is that the user will not be able to
  202. //get the scanner config without pre-enabling the scanner.
  203. isInitialising = false;
  204. factory.emdk3BarcodeHasSetup();
  205. }
  206. }
  207. exitValue = true;
  208. }
  209. Logger.D(TAG, scannerNameShort + " setupScanner-");
  210. return exitValue;
  211. }
  212. @Override
  213. public void enable(Map<String, String> propertyMap, IMethodResult result)
  214. {
  215. Logger.D(TAG, "enable+");
  216. BarcodeFactory.setEnabledState(scannerId);
  217. enableType = ENABLE_TYPE.ENABLE;
  218. if (result == null || !result.hasCallback()) // No callback is set
  219. {
  220. Logger.D(LOGTAG, "Callbackless enable. Will output as keystrokes");
  221. enableCallback = null;
  222. }
  223. else
  224. {
  225. enableCallback = result;
  226. result.keepAlive();
  227. }
  228. setProperties(propertyMap, new MethodResult(false));
  229. int scanOrNot = 1;
  230. try{
  231. IRhoConfig rhoelementsGetConfig= null;
  232. IRhoWebView vi=null;
  233. try {
  234. vi=RhodesActivity.safeGetInstance().getMainView().getWebView(0);
  235. }
  236. catch (Exception e) {
  237. Logger.E(TAG, e);
  238. return;
  239. }
  240. GoogleWebView web=(GoogleWebView)vi;
  241. rhoelementsGetConfig=web.getConfig();
  242. batPercent = BarcodeFactory.batPercent;
  243. if(rhoelementsGetConfig.getString(WebViewConfig.ENABLE_SCAN) != null){
  244. scanOrNot = Integer.parseInt(rhoelementsGetConfig.getString(WebViewConfig.ENABLE_SCAN));
  245. }
  246. if(!isEnabled && (scanOrNot != 0 || batPercent > 5))
  247. {
  248. enable();
  249. }
  250. }
  251. catch(NumberFormatException e){
  252. }
  253. didTakeEnableTheScanner = false;
  254. Logger.D(TAG, "enable-");
  255. }
  256. @Override
  257. public void start(IMethodResult result)
  258. {
  259. Logger.D(TAG, "start+");
  260. startScanning();
  261. Logger.D(TAG, "start-");
  262. }
  263. @Override
  264. public void stop(IMethodResult result)
  265. {
  266. Logger.D(TAG, "stop+");
  267. stopScanning();
  268. Logger.D(TAG, "stop-");
  269. }
  270. @Override
  271. public void disable(IMethodResult result)
  272. {
  273. Logger.D(TAG, "disable+");
  274. BarcodeFactory.setDisabledState(scannerId);
  275. if(enableCallback != null)
  276. {
  277. enableCallback.release();
  278. enableCallback = null;
  279. }
  280. disable(false);
  281. Logger.D(TAG, "disable-");
  282. }
  283. @Override
  284. public void getAllProperties(IMethodResult result)
  285. {
  286. Logger.D(TAG, "getProperties+");
  287. getProperties(allProperties, result);
  288. Logger.D(TAG, "getProperties-");
  289. }
  290. @Override
  291. public void getProperties(List<String> arrayofNames, IMethodResult result)
  292. {
  293. Logger.D(TAG, "getProperties length: " + arrayofNames.size());
  294. for(String name: arrayofNames)
  295. {
  296. MethodResult propResult = new MethodResult(false);
  297. getProperty(name, propResult);
  298. propResult.collectSelf(name, result);
  299. }
  300. result.set();
  301. Logger.D(TAG, "getProperties-");
  302. }
  303. @SuppressLint("DefaultLocale")
  304. @Override
  305. public void getProperty(String propertyName, IMethodResult result)
  306. {
  307. Logger.D(TAG, "getProperty: " + propertyName);
  308. try
  309. {
  310. SettingString propertyEnumValue = SettingString.valueOf(propertyName.toUpperCase());
  311. RhoScannerClass scannerClass = scannerInfo.getScannerClass();
  312. if(propertyEnumValue == null)
  313. {
  314. Logger.W(TAG, "Could not find property: " + propertyName);
  315. result.setError("Could not find property: " + propertyName);
  316. return;
  317. }
  318. //Pre-enable properties
  319. switch(propertyEnumValue)
  320. {
  321. case ALLDECODERS:
  322. MethodResult temp=new MethodResult(false);
  323. super.getProperty("allDecoders",temp);
  324. result.set("" + AllDecoders.AllDecodersDefault.get(temp.getString())); break;
  325. case DECODEDURATION:
  326. case DECODEFREQUENCY:
  327. case DECODESOUND:
  328. case DECODEVOLUME:
  329. case AUTOTAB:
  330. case AUTOENTER:
  331. case FRIENDLYNAME:
  332. case ID:
  333. case SCANNERTYPE: super.getProperty(propertyName, result); return;
  334. default: break;
  335. }
  336. //Post enable properties
  337. if(scannerConfig == null)
  338. {
  339. //result.setError("Unavailable");
  340. Logger.W(TAG, "The " + propertyName + " barcode property can only be queried once the scanner has finished initialising");
  341. result.set();
  342. //TODO try to resetup the scanner
  343. return;
  344. }
  345. switch(propertyEnumValue)
  346. {
  347. case HAPTICFEEDBACK: result.set("" + Scan.DecodeHapticFeedback.get(scannerConfig)); break;
  348. case ILLUMINATIONMODE:
  349. if(scannerClass == RhoScannerClass.SCANNER_CLASS_CAMERA) {
  350. result.set("" + Reader.Camera.IlluminationMode.get(scannerConfig));
  351. break;
  352. }
  353. //result.setError("Not Supported on this scanner type");
  354. Logger.I(TAG, propertyName + " is not supported on this scanner type");
  355. result.set();
  356. break;
  357. case INVERSE1DMODE:
  358. if(scannerClass == RhoScannerClass.SCANNER_CLASS_CAMERA) {
  359. result.set("" + Reader.Camera.Inverse1DMode.get(scannerConfig));
  360. break;
  361. }
  362. if(scannerClass == RhoScannerClass.SCANNER_CLASS_IMAGER) {
  363. result.set("" + Reader.Imager.Inverse1DMode.get(scannerConfig));
  364. break;
  365. }
  366. if(scannerClass == RhoScannerClass.SCANNER_CLASS_LASER) {
  367. result.set("" + Reader.Laser.Inverse1DMode.get(scannerConfig));
  368. break;
  369. }
  370. //result.setError("Not Supported on this scanner type");
  371. Logger.I(TAG, propertyName + " is not supported on this scanner type");
  372. result.set();
  373. break;
  374. case LCDMODE:
  375. if(scannerClass == RhoScannerClass.SCANNER_CLASS_IMAGER) {
  376. result.set("" + Reader.Imager.LcdMode.get(scannerConfig));
  377. break;
  378. }
  379. //result.setError("Not Supported on this scanner type");
  380. Logger.I(TAG, propertyName + " is not supported on this scanner type");
  381. result.set();
  382. break;
  383. case LINEARSECURITYLEVEL:
  384. if(scannerClass == RhoScannerClass.SCANNER_CLASS_CAMERA) {
  385. result.set("" + Reader.Camera.LinearSecurityLevel.get(scannerConfig));
  386. break;
  387. }
  388. if(scannerClass == RhoScannerClass.SCANNER_CLASS_IMAGER) {
  389. result.set("" + Reader.Imager.LinearSecurityLevel.get(scannerConfig));
  390. break;
  391. }
  392. if(scannerClass == RhoScannerClass.SCANNER_CLASS_LASER) {
  393. result.set("" + Reader.Laser.LinearSecurityLevel.get(scannerConfig));
  394. break;
  395. }
  396. Logger.I(TAG, propertyName + " is not supported on this scanner type");
  397. result.set();
  398. break;
  399. case PICKLISTMODE:
  400. if(scannerClass == RhoScannerClass.SCANNER_CLASS_IMAGER) {
  401. result.set("" + Reader.Imager.PickList.get(scannerConfig));
  402. break;
  403. }
  404. //result.setError("PickListMode is only supported on Imager Scanners");
  405. Logger.I(TAG, propertyName + " is only supported on Imager Scanners");
  406. result.set();
  407. break;
  408. case SCANTIMEOUT:
  409. if(scannerClass == RhoScannerClass.SCANNER_CLASS_CAMERA) {
  410. result.set("" + Reader.Camera.BeamTimer.get(scannerConfig));
  411. break;
  412. }
  413. if(scannerClass == RhoScannerClass.SCANNER_CLASS_IMAGER) {
  414. result.set("" + Reader.Imager.BeamTimer.get(scannerConfig));
  415. break;
  416. }
  417. if(scannerClass == RhoScannerClass.SCANNER_CLASS_LASER) {
  418. result.set("" + Reader.Laser.BeamTimer.get(scannerConfig));
  419. break;
  420. }
  421. //result.setError("Not Supported on this scanner type");
  422. Logger.I(TAG, propertyName + " is not supported on this scanner type");
  423. result.set();
  424. break;
  425. case VIEWFINDERMODE:
  426. if(scannerClass == RhoScannerClass.SCANNER_CLASS_CAMERA) {
  427. result.set("" + Reader.Camera.ViewFinderMode.get(scannerConfig));
  428. break;
  429. }
  430. //result.setError("ViewfinderMode is only supported on Camera scanner type");
  431. Logger.I(TAG, propertyName + " is only supported on Camera Scanners");
  432. result.set();
  433. break;
  434. //TODO to implement
  435. case DISABLESCANNERDURINGNAVIGATE:
  436. //Unsupported Modes
  437. case ADAPTIVESCANNING:
  438. case AIMMODE:
  439. case AIMTYPE:
  440. case BARCODEDATAFORMAT:
  441. case BEAMWIDTH:
  442. case BIDIRECTIONALREDUNDANCY:
  443. case CONNECTIONIDLETIMEOUT:
  444. case DATABUFFERSIZE:
  445. case DBPMODE:
  446. case DIFFERENTSYMBOLTIMEOUT:
  447. case DISCONNECTBTONDISABLE:
  448. case DISPLAYBTADDRESSBARCODEONENABLE:
  449. case DPMMODE:
  450. case ENABLETIMEOUT:
  451. case FOCUSMODE:
  452. case INVALIDDECODEFREQUENCY:
  453. case INVALIDDECODESOUND:
  454. case KLASSEEINS:
  455. case LOWBATTERYSCAN:
  456. case POORQUALITY1DMODE:
  457. case RASTERHEIGHT:
  458. case RASTERMODE:
  459. case RSMBATTERYCAPACITY:
  460. case RSMBATTERYID:
  461. case RSMBATTERYSTATUS:
  462. case RSMBLUETOOTHADDRESS:
  463. case RSMBLUETOOTHAUTHENTICATION:
  464. case RSMBLUETOOTHAUTORECONNECT:
  465. case RSMBLUETOOTHBEEPONRECONNECTATTEMPT:
  466. case RSMBLUETOOTHENCRYPTION:
  467. case RSMBLUETOOTHFRIENDLYNAME:
  468. case RSMBLUETOOTHHIDAUTORECONNECT:
  469. case RSMBLUETOOTHINQUIRYMODE:
  470. case RSMBLUETOOTHPINCODE:
  471. case RSMBLUETOOTHPINCODETYPE:
  472. case RSMBLUETOOTHRECONNECTIONATTEMPTS:
  473. case RSMDATEOFMANUFACTURE:
  474. case RSMDATEOFSERVICE:
  475. case RSMDECODEFEEDBACK:
  476. case RSMDEVICECLASS:
  477. case RSMFIRMWAREVERSION:
  478. case RSMFORCESAVEPAIRINGBARCODE:
  479. case RSMGOODSCANSDELAY:
  480. case RSMIGNORECODE128USPS:
  481. case RSMLOWBATTERYINDICATION:
  482. case RSMLOWBATTERYINDICATIONCYCLE:
  483. case RSMMEMS:
  484. case RSMMODELNUMBER:
  485. case RSMPAGINGBEEPSEQUENCE:
  486. case RSMPAGINGENABLE:
  487. case RSMPROXIMITYCONTINUOUS:
  488. case RSMPROXIMITYDISTANCE:
  489. case RSMPROXIMITYENABLE:
  490. case RSMSCANLINEWIDTH:
  491. case RSMSCANTRIGGERWAKEUP:
  492. case RSMSERIALNUMBER:
  493. case SAMESYMBOLTIMEOUT:
  494. case TIMEDAIMDURATION:
  495. case TRIGGERCONNECTED:
  496. case VIEWFINDERFEEDBACK:
  497. case VIEWFINDERFEEDBACKTIME:
  498. case VIEWFINDERHEIGHT:
  499. case VIEWFINDERWIDTH:
  500. case VIEWFINDERX:
  501. case VIEWFINDERY:
  502. //Unsupported Decoders
  503. case CODE11CHECKDIGITCOUNT:
  504. case COMPOSITEABUSEUPCPREAMBLECHECKDIGITRULES:
  505. case KOREAN3OF5MAXLENGTH:
  506. case KOREAN3OF5MINLENGTH:
  507. case KOREAN3OF5REDUNDANCY:
  508. case MACROMICROPDF:
  509. case MACROMICROPDFBUFFERLABELS:
  510. case MACROMICROPDFCONVERTTOMICROPDF:
  511. case MACROMICROPDFEXCLUSIVE:
  512. case MACROMICROPDFREPORTAPPENDINFO:
  513. case MACROPDF:
  514. case MACROPDFBUFFERLABELS:
  515. case MACROPDFCONVERTTOPDF417:
  516. case MACROPDFEXCLUSIVE:
  517. case SIGNATUREIMAGEHEIGHT:
  518. case SIGNATUREIMAGEQUALITY:
  519. case SIGNATUREIMAGEWIDTH:
  520. //result.setError("Not supported on Android");
  521. Logger.I(TAG, propertyName + " is not supported on Android");
  522. result.set();
  523. return;
  524. case AUSPOSTAL: result.set("" + Decoder.AustralianPostal.get(scannerConfig)); break;
  525. case AZTEC: result.set("" + Decoder.Aztec.get(scannerConfig)); break;
  526. case CANPOSTAL: result.set("" + Decoder.CanadianPostal.get(scannerConfig)); break;
  527. case CHINESE2OF5: result.set("" + Decoder.Chinese2of5.get(scannerConfig)); break;
  528. case CODABAR: result.set("" + Decoder.CodaBar.get(scannerConfig)); break;
  529. case CODABARCLSIEDITING: result.set("" + Decoder.CodaBar.ClsiEditing.get(scannerConfig)); break;
  530. case CODABARMAXLENGTH: result.set("" + Decoder.CodaBar.Length2.get(scannerConfig)); break;
  531. case CODABARMINLENGTH: result.set("" + Decoder.CodaBar.Length1.get(scannerConfig)); break;
  532. case CODABARNOTISEDITING: result.set("" + Decoder.CodaBar.NotisEditing.get(scannerConfig)); break;
  533. case CODABARREDUNDANCY: result.set("" + Decoder.CodaBar.Redundancy.get(scannerConfig)); break;
  534. case CODE11: result.set("" + Decoder.Code11.get(scannerConfig)); break;
  535. case CODE11MAXLENGTH: result.set("" + Decoder.Code11.Length2.get(scannerConfig)); break;
  536. case CODE11MINLENGTH: result.set("" + Decoder.Code11.Length1.get(scannerConfig)); break;
  537. case CODE11REDUNDANCY: result.set("" + Decoder.Code11.Redundancy.get(scannerConfig)); break;
  538. case CODE11REPORTCHECKDIGIT:result.set("" + Decoder.Code11.ReportCheckDigit.get(scannerConfig)); break;
  539. case CODE128: result.set("" + Decoder.Code128.get(scannerConfig)); break;
  540. case CODE128CHECKISBTTABLE: result.set("" + Decoder.Code128.CheckIsbtTable.get(scannerConfig)); break;
  541. case CODE128EAN128: result.set("" + Decoder.Code128.EnableEan128.get(scannerConfig)); break;
  542. case CODE128ISBT128: result.set("" + Decoder.Code128.EnableIsbt128.get(scannerConfig)); break;
  543. case CODE128ISBT128CONCATMODE: result.set("" + Decoder.Code128.Isbt128ConcatMode.get(scannerConfig)); break;
  544. case CODE128MAXLENGTH: result.set("" + Decoder.Code128.Length2.get(scannerConfig)); break;
  545. case CODE128MINLENGTH: result.set("" + Decoder.Code128.Length1.get(scannerConfig)); break;
  546. case CODE128OTHER128: result.set("" + Decoder.Code128.EnablePlain.get(scannerConfig)); break; //TODO test me
  547. case CODE128REDUNDANCY: result.set("" + Decoder.Code128.Redundancy.get(scannerConfig)); break;
  548. case CODE128SECURITYLEVEL: result.set("" + Decoder.Code128.SecurityLevel.get(scannerConfig)); break;
  549. case CODE39: result.set("" + Decoder.Code39.get(scannerConfig)); break;
  550. case CODE39CODE32PREFIX: result.set("" + Decoder.Code39.ReportCode32Prefix.get(scannerConfig)); break;
  551. case CODE39CONVERTTOCODE32: result.set("" + Decoder.Code39.ConvertToCode32.get(scannerConfig)); break;
  552. case CODE39FULLASCII: result.set("" + Decoder.Code39.FullAscii.get(scannerConfig)); break;
  553. case CODE39MAXLENGTH: result.set("" + Decoder.Code39.Length2.get(scannerConfig)); break;
  554. case CODE39MINLENGTH: result.set("" + Decoder.Code39.Length1.get(scannerConfig)); break;
  555. case CODE39REDUNDANCY: result.set("" + Decoder.Code39.Redundancy.get(scannerConfig)); break;
  556. case CODE39REPORTCHECKDIGIT:result.set("" + Decoder.Code39.ReportCheckDigit.get(scannerConfig)); break;
  557. case CODE39SECURITYLEVEL: result.set("" + Decoder.Code39.SecurityLevel.get(scannerConfig)); break;
  558. case CODE39VERIFYCHECKDIGIT:result.set("" + Decoder.Code39.VerifyCheckDigit.get(scannerConfig)); break;
  559. case CODE93: result.set("" + Decoder.Code93.get(scannerConfig)); break;
  560. case CODE93MAXLENGTH: result.set("" + Decoder.Code93.Length2.get(scannerConfig)); break;
  561. case CODE93MINLENGTH: result.set("" + Decoder.Code93.Length1.get(scannerConfig)); break;
  562. case CODE93REDUNDANCY: result.set("" + Decoder.Code93.Redundancy.get(scannerConfig)); break;
  563. case COMPOSITEAB: result.set("" + Decoder.CompositeAB.get(scannerConfig)); break;
  564. case COMPOSITEABUCCLINKMODE:result.set("" + Decoder.CompositeAB.UccLinkMode.get(scannerConfig)); break;
  565. case COMPOSITEC: result.set("" + Decoder.CompositeC.get(scannerConfig)); break;
  566. case D2OF5: result.set("" + Decoder.D2of5.get(scannerConfig)); break;
  567. case D2OF5MAXLENGTH: result.set("" + Decoder.D2of5.Length2.get(scannerConfig)); break;
  568. case D2OF5MINLENGTH: result.set("" + Decoder.D2of5.Length1.get(scannerConfig)); break;
  569. case D2OF5REDUNDANCY: result.set("" + Decoder.D2of5.Redundancy.get(scannerConfig)); break;
  570. case DATAMATRIX: result.set("" + Decoder.DataMatrix.get(scannerConfig)); break;
  571. case DUTCHPOSTAL: result.set("" + Decoder.DutchPostal.get(scannerConfig)); break;
  572. case EAN13: result.set("" + Decoder.Ean13.get(scannerConfig)); break;
  573. case EAN8: result.set("" + Decoder.Ean8.get(scannerConfig)); break;
  574. case EAN8CONVERTTOEAN13: result.set("" + Decoder.Ean8.ConvertToEan13.get(scannerConfig)); break;
  575. case GS1DATABAR: result.set("" + Decoder.Gs1Databar.get(scannerConfig)); break;
  576. case GS1DATABAREXPANDED: result.set("" + Decoder.Gs1DatabarExp.get(scannerConfig)); break;
  577. case GS1DATABARLIMITED: result.set("" + Decoder.Gs1DatabarLim.get(scannerConfig)); break;
  578. case I2OF5: result.set("" + Decoder.I2of5.get(scannerConfig)); break;
  579. case I2OF5CONVERTTOEAN13: result.set("" + Decoder.I2of5.ConvertToEan13.get(scannerConfig)); break;
  580. case I2OF5MAXLENGTH: result.set("" + Decoder.I2of5.Length2.get(scannerConfig)); break;
  581. case I2OF5MINLENGTH: result.set("" + Decoder.I2of5.Length1.get(scannerConfig)); break;
  582. case I2OF5REDUNDANCY: result.set("" + Decoder.I2of5.Redundancy.get(scannerConfig)); break;
  583. case I2OF5REPORTCHECKDIGIT: result.set("" + Decoder.I2of5.ReportCheckDigit.get(scannerConfig)); break;
  584. case I2OF5VERIFYCHECKDIGIT: result.set("" + Decoder.I2of5.VerifyCheckDigit.get(scannerConfig)); break;
  585. case JAPPOSTAL: result.set("" + Decoder.JapanesePostal.get(scannerConfig)); break;
  586. case KOREAN3OF5: result.set("" + Decoder.Korean3of5.get(scannerConfig)); break;
  587. case MATRIX2OF5: result.set("" + Decoder.Matrix2of5.get(scannerConfig)); break;
  588. case MATRIX2OF5MAXLENGTH: result.set("" + Decoder.Matrix2of5.Length2.get(scannerConfig)); break;
  589. case MATRIX2OF5MINLENGTH: result.set("" + Decoder.Matrix2of5.Length1.get(scannerConfig)); break;
  590. case MATRIX2OF5REPORTCHECKDIGIT:result.set("" + Decoder.Matrix2of5.ReportCheckDigit.get(scannerConfig));break;
  591. case MATRIX2OF5VERIFYCHECKDIGIT:result.set("" + Decoder.Matrix2of5.VerifyCheckDigit.get(scannerConfig));break;
  592. case MAXICODE: result.set("" + Decoder.MaxiCode.get(scannerConfig)); break;
  593. case MICROPDF: result.set("" + Decoder.MicroPdf.get(scannerConfig)); break;
  594. case MICROQR: result.set("" + Decoder.MicroQr.get(scannerConfig)); break;
  595. case MSI: result.set("" + Decoder.Msi.get(scannerConfig)); break;
  596. case MSICHECKDIGITS: result.set("" + Decoder.Msi.CheckDigits.get(scannerConfig)); break;
  597. case MSICHECKDIGITSCHEME: result.set("" + Decoder.Msi.CheckDigitScheme.get(scannerConfig)); break;
  598. case MSIMAXLENGTH: result.set("" + Decoder.Msi.Length2.get(scannerConfig)); break;
  599. case MSIMINLENGTH: result.set("" + Decoder.Msi.Length1.get(scannerConfig)); break;
  600. case MSIREDUNDANCY: result.set("" + Decoder.Msi.Redundancy.get(scannerConfig)); break;
  601. case MSIREPORTCHECKDIGIT: result.set("" + Decoder.Msi.ReportCheckDigit.get(scannerConfig)); break;
  602. case PDF417: result.set("" + Decoder.Pdf417.get(scannerConfig)); break;
  603. case QRCODE: result.set("" + Decoder.QrCode.get(scannerConfig)); break;
  604. case SIGNATURE: result.set("" + Decoder.Signature.get(scannerConfig)); break;
  605. case TLC39: result.set("" + Decoder.Tlc39.get(scannerConfig)); break;
  606. case TRIOPTIC39: result.set("" + Decoder.TriOptic39.get(scannerConfig)); break;
  607. case TRIOPTIC39REDUNDANCY: result.set("" + Decoder.TriOptic39.Redundancy.get(scannerConfig)); break;
  608. case UKPOSTAL: result.set("" + Decoder.UkPostal.get(scannerConfig)); break;
  609. case UKPOSTALREPORTCHECKDIGIT:result.set("" + Decoder.UkPostal.ReportCheckDigit.get(scannerConfig)); break;
  610. case UPCA: result.set("" + Decoder.Upca.get(scannerConfig)); break;
  611. case UPCAPREAMBLE: result.set("" + Decoder.Upca.Preamble.get(scannerConfig)); break;
  612. case UPCAREPORTCHECKDIGIT: result.set("" + Decoder.Upca.ReportCheckDigit.get(scannerConfig)); break;
  613. case UPCE0: result.set("" + Decoder.Upce0.get(scannerConfig)); break;
  614. case UPCE0CONVERTTOUPCA: result.set("" + Decoder.Upce0.ConvertToUpca.get(scannerConfig)); break;
  615. case UPCE0PREAMBLE: result.set("" + Decoder.Upce0.Preamble.get(scannerConfig)); break;
  616. case UPCE0REPORTCHECKDIGIT: result.set("" + Decoder.Upce0.ReportCheckDigit.get(scannerConfig)); break;
  617. case UPCE1: result.set("" + Decoder.Upce1.get(scannerConfig)); break;
  618. case UPCE1CONVERTTOUPCA: result.set("" + Decoder.Upce1.ConvertToUpca.get(scannerConfig)); break;
  619. case UPCE1PREAMBLE: result.set("" + Decoder.Upce1.Preamble.get(scannerConfig)); break;
  620. case UPCE1REPORTCHECKDIGIT: result.set("" + Decoder.Upce1.ReportCheckDigit.get(scannerConfig)); break;
  621. case UPCEANBOOKLAND: result.set("" + Decoder.UpcEanParams.BooklandCode.get(scannerConfig)); break;
  622. case UPCEANBOOKLANDFORMAT: result.set("" + Decoder.UpcEanParams.BooklandFormat.get(scannerConfig)); break;
  623. case UPCEANCONVERTGS1DATABARTOUPCEAN:result.set("" + Decoder.UpcEanParams.ConvertDataBarToUpcEan.get(scannerConfig)); break;
  624. case UPCEANCOUPON: result.set("" + Decoder.UpcEanParams.CouponCode.get(scannerConfig)); break;
  625. case UPCEANLINEARDECODE: result.set("" + Decoder.UpcEanParams.LinearDecode.get(scannerConfig)); break;
  626. case UPCEANRANDOMWEIGHTCHECKDIGIT: result.set("" + Decoder.UpcEanParams.RandomWeightCheckDigit.get(scannerConfig)); break;
  627. case UPCEANRETRYCOUNT: result.set("" + Decoder.UpcEanParams.SupplementalRetries.get(scannerConfig));break;
  628. case UPCEANSECURITYLEVEL: result.set("" + Decoder.UpcEanParams.SecurityLevel.get(scannerConfig)); break;
  629. case UPCEANSUPPLEMENTAL2: result.set("" + Decoder.UpcEanParams.Supplemental2.get(scannerConfig)); break;
  630. case UPCEANSUPPLEMENTAL5: result.set("" + Decoder.UpcEanParams.Supplemental5.get(scannerConfig)); break;
  631. case UPCEANSUPPLEMENTALMODE:result.set("" + Decoder.UpcEanParams.SupplementalMode.get(scannerConfig)); break;
  632. case US4STATE: result.set("" + Decoder.Us4State.get(scannerConfig)); break;
  633. case US4STATEFICS: result.set("" + Decoder.Us4StateFics.get(scannerConfig)); break;
  634. case USPLANET: result.set("" + Decoder.UsPlanet.get(scannerConfig)); break;
  635. case USPLANETREPORTCHECKDIGIT:result.set("" + Decoder.UsPlanet.ReportCheckDigit.get(scannerConfig)); break;
  636. case USPOSTNET: result.set("" + Decoder.UsPostNet.get(scannerConfig)); break;
  637. case USPOSTNETREPORTCHECKDIGIT:result.set("" + Decoder.UsPostNet.ReportCheckDigit.get(scannerConfig)); break;
  638. case WEBCODE: result.set("" + Decoder.WebCode.get(scannerConfig)); break;
  639. case WEBCODEDECODEGTSUBTYPE:result.set("" + Decoder.WebCode.SubType.get(scannerConfig)); break;
  640. default:break;
  641. }
  642. }
  643. catch (NumberFormatException e) {
  644. Logger.W(TAG, e);
  645. result.setError("Incorrect parameter format");
  646. }
  647. catch (IllegalArgumentException e) {
  648. Logger.W(TAG, e);
  649. result.setError(e.getMessage());
  650. }
  651. }
  652. @SuppressWarnings("unchecked")
  653. @Override
  654. public void getSupportedProperties(IMethodResult result)
  655. {
  656. Logger.D(TAG, "getSupportedProperties");
  657. if(supportedProperties == null)
  658. {
  659. result.setError("Cannot detect supported properties if the scanner has not been enabled in this app");
  660. Logger.W(TAG, "Cannot detect supported properties if the scanner has not been enabled in this app");
  661. return;
  662. }
  663. result.set((List<Object>)(List<?>) supportedProperties);
  664. }
  665. /**
  666. * This will populate the supportedProperties arraylist with all of the properties supported by the scanner.
  667. * This can only be done if scannerConfig has already been obtained (i.e. the scanner has been enabled at
  668. * least once since startup)
  669. *
  670. * @author Ben Kennedy (NCVT73)
  671. */
  672. private void popluateSupportedProperties()
  673. {
  674. Logger.D(TAG, "populateSupportedProperties+");
  675. RhoScannerClass scannerClass = scannerInfo.getScannerClass();
  676. supportedProperties = new ArrayList<String>();
  677. SettingString[] settingStrings = SettingString.values();
  678. Logger.D(TAG, "getSupportedProperties " + settingStrings.length);
  679. for(SettingString setting: settingStrings)
  680. {
  681. Logger.D(TAG, "getSupportedProperties. name: "+ setting.name + " emdkName: " + setting.emdkName);
  682. if(setting.emdkName != null && scannerConfig.isParamSupported(setting.emdkName))
  683. supportedProperties.add(setting.name);
  684. }
  685. supportedProperties.add(SettingString.ALLDECODERS.name);
  686. supportedProperties.add(SettingString.AUTOENTER.name);
  687. supportedProperties.add(SettingString.AUTOTAB.name);
  688. supportedProperties.add(SettingString.DECODEDURATION.name);
  689. supportedProperties.add(SettingString.DECODEFREQUENCY.name);
  690. supportedProperties.add(SettingString.DECODESOUND.name);
  691. supportedProperties.add(SettingString.DECODEVOLUME.name);
  692. supportedProperties.add(SettingString.FRIENDLYNAME.name);
  693. supportedProperties.add(SettingString.ID.name);
  694. supportedProperties.add(SettingString.SCANNERTYPE.name);
  695. if(scannerClass == RhoScannerClass.SCANNER_CLASS_CAMERA)
  696. {
  697. if(scannerConfig.isParamSupported("config.readerParams.readerSpecific.cameraSpecific.illuminationMode")) supportedProperties.add(SettingString.ILLUMINATIONMODE.name);
  698. if(scannerConfig.isParamSupported("config.readerParams.readerSpecific.cameraSpecific.inverse1DMode")) supportedProperties.add(SettingString.INVERSE1DMODE.name);
  699. if(scannerConfig.isParamSupported("config.readerParams.readerSpecific.cameraSpecific.linearSecurityLevel")) supportedProperties.add(SettingString.LINEARSECURITYLEVEL.name);
  700. if(scannerConfig.isParamSupported("config.readerParams.readerSpecific.cameraSpecific.beamTimer")) supportedProperties.add(SettingString.SCANTIMEOUT.name);
  701. if(scannerConfig.isParamSupported("config.readerParams.readerSpecific.cameraSpecific.viewFinderMode")) supportedProperties.add(SettingString.VIEWFINDERMODE.name);
  702. }
  703. else if(scannerClass == RhoScannerClass.SCANNER_CLASS_IMAGER)
  704. {
  705. if(scannerConfig.isParamSupported("config.readerParams.readerSpecific.imagerSpecific.inverse1DMode")) supportedProperties.add(SettingString.INVERSE1DMODE.name);
  706. if(scannerConfig.isParamSupported("config.readerParams.readerSpecific.imagerSpecific.lcdMode")) supportedProperties.add(SettingString.LCDMODE.name);
  707. if(scannerConfig.isParamSupported("config.readerParams.readerSpecific.imagerSpecific.linearSecurityLevel")) supportedProperties.add(SettingString.LINEARSECURITYLEVEL.name);
  708. if(scannerConfig.isParamSupported("config.readerParams.readerSpecific.imagerSpecific.pickList")) supportedProperties.add(SettingString.PICKLISTMODE.name);
  709. if(scannerConfig.isParamSupported("config.readerParams.readerSpecific.imagerSpecific.beamTimer")) supportedProperties.add(SettingString.SCANTIMEOUT.name);
  710. }
  711. else if(scannerClass == RhoScannerClass.SCANNER_CLASS_LASER)
  712. {
  713. if(scannerConfig.isParamSupported("config.readerParams.readerSpecific.laserSpecific.inverse1DMode")) supportedProperties.add(SettingString.INVERSE1DMODE.name);
  714. if(scannerConfig.isParamSupported("config.readerParams.readerSpecific.laserSpecific.linearSecurityLevel")) supportedProperties.add(SettingString.LINEARSECURITYLEVEL.name);
  715. if(scannerConfig.isParamSupported("config.readerParams.readerSpecific.laserSpecific.beamTimer")) supportedProperties.add(SettingString.SCANTIMEOUT.name);
  716. }
  717. Collections.sort(supportedProperties);
  718. Logger.D(TAG, "populateSupportedProperties-");
  719. }
  720. @Override
  721. public void setProperties(Map<String, String> propertyMap, IMethodResult result)
  722. {
  723. if(propertyMap == null) return;
  724. Logger.D(TAG, "setProperties. Length: " + propertyMap.size());
  725. EMDKCommon.setProperties(this, propertyMap, result);
  726. Logger.D(TAG, "setProperties-");
  727. }
  728. /**
  729. * result can be null if the call is coming from decodeSound. We needed some way of identifying if decode sound
  730. * was coming from an internal call
  731. */
  732. @SuppressLint("DefaultLocale")
  733. @Override
  734. public void setProperty(String propertyName, String propertyValue, IMethodResult result)
  735. {
  736. Logger.D(TAG, "setProperty: " + propertyName + ", propertyValue: " + propertyValue);
  737. try
  738. {
  739. SettingString propertyEnumValue = SettingString.valueOf(propertyName.toUpperCase());
  740. RhoScannerClass scannerClass = scannerInfo.getScannerClass();
  741. if(propertyEnumValue == null)
  742. {
  743. Logger.W(TAG, "Could not find property: " + propertyName);
  744. result.setError("Could not find property: " + propertyName);
  745. return;
  746. }
  747. if(isScanning)
  748. {
  749. Logger.I(TAG, "Property will not take affect until the scanner has stopped scanning.");
  750. propertyQueue.add(new Pair<String, String>(propertyName, propertyValue));
  751. return;
  752. }
  753. if(isMinimized)
  754. {
  755. Logger.I(TAG, "Property will not take affect until the app is in the foreground and the scanner is enabled");
  756. propertyQueue.add(new Pair<String, String>(propertyName, propertyValue));
  757. return;
  758. }
  759. //Pre-enable properties
  760. switch(propertyEnumValue)
  761. {
  762. case DECODEDURATION: setDecodeDuration(Integer.valueOf(propertyValue), result); return;
  763. case DECODEFREQUENCY: setDecodeFrequency(Integer.valueOf(propertyValue), result); return;
  764. case DECODESOUND:
  765. if(result == null)
  766. {
  767. break;
  768. }
  769. else
  770. {
  771. setDecodeSound(propertyValue, result);
  772. return;
  773. }
  774. case DECODEVOLUME: setDecodeVolume(Integer.valueOf(propertyValue), result); return;
  775. case AUTOTAB: setAutoTab(Boolean.valueOf(propertyValue), result); return;
  776. case AUTOENTER: setAutoEnter(Boolean.valueOf(propertyValue), result); return;
  777. default: break;
  778. }
  779. //Post enable properties
  780. if(scannerConfig == null)
  781. {
  782. //result.setError("Unavailable");
  783. Logger.W(TAG, "The " + propertyName + " barcode property can only be set once the scanner has finished initialising");
  784. propertyQueue.add(new Pair<String, String>(propertyName, propertyValue));
  785. //TODO reget the scanner config here
  786. if(result != null) result.set();
  787. return;
  788. }
  789. switch(propertyEnumValue)
  790. {
  791. case HAPTICFEEDBACK: result.set(Scan.DecodeHapticFeedback.set(scannerConfig, propertyValue)); break;
  792. case DECODESOUND: Scan.DecodeAudioFeedbackUri.set(scannerConfig, propertyValue); break;
  793. case ILLUMINATIONMODE:
  794. if(scannerClass == RhoScannerClass.SCANNER_CLASS_CAMERA) {
  795. result.set(Reader.Camera.IlluminationMode.set(scannerConfig, propertyValue));
  796. break;
  797. }
  798. //result.setError("Not Supported on this scanner type");
  799. Logger.I(TAG, propertyName + " is not supported on this scanner type");
  800. result.set();
  801. break;
  802. case INVERSE1DMODE:
  803. if(scannerClass == RhoScannerClass.SCANNER_CLASS_CAMERA) {
  804. result.set(Reader.Camera.Inverse1DMode.set(scannerConfig, propertyValue));
  805. break;
  806. }
  807. if(scannerClass == RhoScannerClass.SCANNER_CLASS_IMAGER) {
  808. result.set(Reader.Imager.Inverse1DMode.set(scannerConfig, propertyValue));
  809. break;
  810. }
  811. if(scannerClass == RhoScannerClass.SCANNER_CLASS_LASER) {
  812. result.set(Reader.Laser.Inverse1DMode.set(scannerConfig, propertyValue));
  813. break;
  814. }
  815. //result.setError("Not Supported on this scanner type");
  816. Logger.I(TAG, propertyName + " is not supported on this scanner type");
  817. result.set();
  818. break;
  819. case LCDMODE:
  820. if(scannerClass == RhoScannerClass.SCANNER_CLASS_IMAGER) {
  821. result.set(Reader.Imager.LcdMode.set(scannerConfig, propertyValue));
  822. break;
  823. }
  824. //result.setError("Not Supported on this scanner type");
  825. Logger.I(TAG, propertyName + " is not supported on this scanner type");
  826. result.set();
  827. break;
  828. case LINEARSECURITYLEVEL:
  829. if(scannerClass == RhoScannerClass.SCANNER_CLASS_CAMERA) {
  830. result.set(Reader.Camera.LinearSecurityLevel.set(scannerConfig, propertyValue));
  831. break;
  832. }
  833. if(scannerClass == RhoScannerClass.SCANNER_CLASS_IMAGER) {
  834. result.set(Reader.Imager.LinearSecurityLevel.set(scannerConfig, propertyValue));
  835. break;
  836. }
  837. if(scannerClass == RhoScannerClass.SCANNER_CLASS_LASER) {
  838. result.set(Reader.Laser.LinearSecurityLevel.set(scannerConfig, propertyValue));
  839. break;
  840. }
  841. Logger.I(TAG, propertyName + " is not supported on this scanner type");
  842. result.set();
  843. break;
  844. case PICKLISTMODE:
  845. if(scannerClass == RhoScannerClass.SCANNER_CLASS_IMAGER) {
  846. result.set(Reader.Imager.PickList.set(scannerConfig, propertyValue));
  847. break;
  848. }
  849. //result.setError("PickListMode is only supported on Imager Scanners");
  850. Logger.I(TAG, propertyName + " is only supported on Imager Scanners");
  851. result.set();
  852. break;
  853. case SCANTIMEOUT:
  854. if(scannerClass == RhoScannerClass.SCANNER_CLASS_CAMERA) {
  855. result.set(Reader.Camera.BeamTimer.set(scannerConfig, propertyValue));
  856. break;
  857. }
  858. if(scannerClass == RhoScannerClass.SCANNER_CLASS_IMAGER) {
  859. result.set(Reader.Imager.BeamTimer.set(scannerConfig, propertyValue));
  860. break;
  861. }
  862. if(scannerClass == RhoScannerClass.SCANNER_CLASS_LASER) {
  863. result.set(Reader.Laser.BeamTimer.set(scannerConfig, propertyValue));
  864. break;
  865. }
  866. //result.setError("Not Supported on this scanner type");
  867. Logger.I(TAG, propertyName + " is not supported on this scanner type");
  868. result.set();
  869. break;
  870. case VIEWFINDERMODE:
  871. if(scannerClass == RhoScannerClass.SCANNER_CLASS_CAMERA) {
  872. result.set(Reader.Camera.ViewFinderMode.set(scannerConfig, propertyValue));
  873. break;
  874. }
  875. //result.setError("ViewfinderMode is only supported on Camera scanner type");
  876. Logger.I(TAG, propertyName + " is only supported on Camera Scanners");
  877. result.set();
  878. break;
  879. //TODO to implement
  880. case DISABLESCANNERDURINGNAVIGATE:
  881. //Unsupported Modes
  882. case ADAPTIVESCANNING:
  883. case AIMMODE:
  884. case AIMTYPE:
  885. case BARCODEDATAFORMAT:
  886. case BEAMWIDTH:
  887. case BIDIRECTIONALREDUNDANCY:
  888. case CONNECTIONIDLETIMEOUT:
  889. case DATABUFFERSIZE:
  890. case DBPMODE:
  891. case DIFFERENTSYMBOLTIMEOUT:
  892. case DISCONNECTBTONDISABLE:
  893. case DISPLAYBTADDRESSBARCODEONENABLE:
  894. case DPMMODE:
  895. case ENABLETIMEOUT:
  896. case FOCUSMODE:
  897. case INVALIDDECODEFREQUENCY:
  898. case INVALIDDECODESOUND:
  899. case KLASSEEINS:
  900. case LOWBATTERYSCAN:
  901. case POORQUALITY1DMODE:
  902. case RASTERHEIGHT:
  903. case RASTERMODE:
  904. case RSMBATTERYCAPACITY:
  905. case RSMBATTERYID:
  906. case RSMBATTERYSTATUS:
  907. case RSMBLUETOOTHADDRESS:
  908. case RSMBLUETOOTHAUTHENTICATION:
  909. case RSMBLUETOOTHAUTORECONNECT:
  910. case RSMBLUETOOTHBEEPONRECONNECTATTEMPT:
  911. case RSMBLUETOOTHENCRYPTION:
  912. case RSMBLUETOOTHFRIENDLYNAME:
  913. case RSMBLUETOOTHHIDAUTORECONNECT:
  914. case RSMBLUETOOTHINQUIRYMODE:
  915. case RSMBLUETOOTHPINCODE:
  916. case RSMBLUETOOTHPINCODETYPE:
  917. case RSMBLUETOOTHRECONNECTIONATTEMPTS:
  918. case RSMDATEOFMANUFACTURE:
  919. case RSMDATEOFSERVICE:
  920. case RSMDECODEFEEDBACK:
  921. case RSMDEVICECLASS:
  922. case RSMFIRMWAREVERSION:
  923. case RSMFORCESAVEPAIRINGBARCODE:
  924. case RSMGOODSCANSDELAY:
  925. case RSMIGNORECODE128USPS:
  926. case RSMLOWBATTERYINDICATION:
  927. case RSMLOWBATTERYINDICATIONCYCLE:
  928. case RSMMEMS:
  929. case RSMMODELNUMBER:
  930. case RSMPAGINGBEEPSEQUENCE:
  931. case RSMPAGINGENABLE:
  932. case RSMPROXIMITYCONTINUOUS:
  933. case RSMPROXIMITYDISTANCE:
  934. case RSMPROXIMITYENABLE:
  935. case RSMSCANLINEWIDTH:
  936. case RSMSCANTRIGGERWAKEUP:
  937. case RSMSERIALNUMBER:
  938. case SAMESYMBOLTIMEOUT:
  939. case TIMEDAIMDURATION:
  940. case TRIGGERCONNECTED:
  941. case VIEWFINDERFEEDBACK:
  942. case VIEWFINDERFEEDBACKTIME:
  943. case VIEWFINDERHEIGHT:
  944. case VIEWFINDERWIDTH:
  945. case VIEWFINDERX:
  946. case VIEWFINDERY:
  947. //Unsupported Decoders
  948. case CODE11CHECKDIGITCOUNT:
  949. case COMPOSITEABUSEUPCPREAMBLECHECKDIGITRULES:
  950. case KOREAN3OF5MAXLENGTH:
  951. case KOREAN3OF5MINLENGTH:
  952. case KOREAN3OF5REDUNDANCY:
  953. case MACROMICROPDF:
  954. case MACROMICROPDFBUFFERLABELS:
  955. case MACROMICROPDFCONVERTTOMICROPDF:
  956. case MACROMICROPDFEXCLUSIVE:
  957. case MACROMICROPDFREPORTAPPENDINFO:
  958. case MACROPDF:
  959. case MACROPDFBUFFERLABELS:
  960. case MACROPDFCONVERTTOPDF417:
  961. case MACROPDFEXCLUSIVE:
  962. case SIGNATUREIMAGEHEIGHT:
  963. case SIGNATUREIMAGEQUALITY:
  964. case SIGNATUREIMAGEWIDTH:
  965. //result.setError("Not supported on Android");
  966. Logger.I(TAG, propertyName + " is not supported on Android");
  967. result.set();
  968. return;
  969. case AUSPOSTAL: result.set(Decoder.AustralianPostal.set(scannerConfig, propertyValue)); break;
  970. case AZTEC: result.set(Decoder.Aztec.set(scannerConfig, propertyValue)); break;
  971. case CANPOSTAL: result.set(Decoder.CanadianPostal.set(scannerConfig, propertyValue)); break;
  972. case CHINESE2OF5: result.set(Decoder.Chinese2of5.set(scannerConfig, propertyValue)); break;
  973. case CODABAR: result.set(Decoder.CodaBar.set(scannerConfig, propertyValue)); break;
  974. case CODABARCLSIEDITING: result.set(Decoder.CodaBar.ClsiEditing.set(scannerConfig, propertyValue)); break;
  975. case CODABARMAXLENGTH: result.set(Decoder.CodaBar.Length2.set(scannerConfig, propertyValue)); break;
  976. case CODABARMINLENGTH: result.set(Decoder.CodaBar.Length1.set(scannerConfig, propertyValue)); break;
  977. case CODABARNOTISEDITING: result.set(Decoder.CodaBar.NotisEditing.set(scannerConfig, propertyValue)); break;
  978. case CODABARREDUNDANCY: result.set(Decoder.CodaBar.Redundancy.set(scannerConfig, propertyValue)); break;
  979. case CODE11: result.set(Decoder.Code11.set(scannerConfig, propertyValue)); break;
  980. case CODE11MAXLENGTH: result.set(Decoder.Code11.Length2.set(scannerConfig, propertyValue)); break;
  981. case CODE11MINLENGTH: result.set(Decoder.Code11.Length1.set(scannerConfig, propertyValue)); break;
  982. case CODE11REDUNDANCY: result.set(Decoder.Code11.Redundancy.set(scannerConfig, propertyValue)); break;
  983. case CODE11REPORTCHECKDIGIT:result.set(Decoder.Code11.ReportCheckDigit.set(scannerConfig, propertyValue)); break;
  984. case CODE128: result.set(Decoder.Code128.set(scannerConfig, propertyValue)); break;
  985. case CODE128CHECKISBTTABLE: result.set(Decoder.Code128.CheckIsbtTable.set(scannerConfig, propertyValue)); break;
  986. case CODE128EAN128: result.set(Decoder.Code128.EnableEan128.set(scannerConfig, propertyValue)); break;
  987. case CODE128ISBT128: result.set(Decoder.Code128.EnableIsbt128.set(scannerConfig, propertyValue)); break;
  988. case CODE128ISBT128CONCATMODE: result.set(Decoder.Code128.Isbt128ConcatMode.set(scannerConfig, propertyValue)); break;
  989. case CODE128MAXLENGTH: result.set(Decoder.Code128.Length2.set(scannerConfig, propertyValue)); break;
  990. case CODE128MINLENGTH: result.set(Decoder.Code128.Length1.set(scannerConfig, propertyValue)); break;
  991. case CODE128OTHER128: result.set(Decoder.Code128.EnablePlain.set(scannerConfig, propertyValue)); break; //TODO test me
  992. case CODE128REDUNDANCY: result.set(Decoder.Code128.Redundancy.set(scannerConfig, propertyValue)); break;
  993. case CODE128SECURITYLEVEL: result.set(Decoder.Code128.SecurityLevel.set(scannerConfig, propertyValue)); break;
  994. case CODE39: result.set(Decoder.Code39.set(scannerConfig, propertyValue)); break;
  995. case CODE39CODE32PREFIX: result.set(Decoder.Code39.ReportCode32Prefix.set(scannerConfig, propertyValue)); break;
  996. case CODE39CONVERTTOCODE32: result.set(Decoder.Code39.ConvertToCode32.set(scannerConfig, propertyValue)); break;
  997. case CODE39FULLASCII: result.set(Decoder.Code39.FullAscii.set(scannerConfig, propertyValue)); break;
  998. case CODE39MAXLENGTH: result.set(Decoder.Code39.Length2.set(scannerConfig, propertyValue)); break;
  999. case CODE39MINLENGTH: result.set(Decoder.Code39.Length1.set(scannerConfig, propertyValue)); break;
  1000. case CODE39REDUNDANCY: result.set(Decoder.Code39.Redundancy.set(scannerConfig, propertyValue)); break;
  1001. case CODE39REPORTCHECKDIGIT:result.set(Decoder.Code39.ReportCheckDigit.set(scannerConfig, propertyValue)); break;
  1002. case CODE39SECURITYLEVEL: result.set(Decoder.Code39.SecurityLevel.set(scannerConfig, propertyValue)); break;
  1003. case CODE39VERIFYCHECKDIGIT:result.set(Decoder.Code39.VerifyCheckDigit.set(scannerConfig, propertyValue)); break;
  1004. case CODE93: result.set(Decoder.Code93.set(scannerConfig, propertyValue)); break;
  1005. case CODE93MAXLENGTH: result.set(Decoder.Code93.Length2.set(scannerConfig, propertyValue)); break;
  1006. case CODE93MINLENGTH: result.set(Decoder.Code93.Length1.set(scannerConfig, propertyValue)); break;
  1007. case CODE93REDUNDANCY: result.set(Decoder.Code93.Redundancy.set(scannerConfig, propertyValue)); break;
  1008. case COMPOSITEAB: result.set(Decoder.CompositeAB.set(scannerConfig, propertyValue)); break;
  1009. case COMPOSITEABUCCLINKMODE:result.set(Decoder.CompositeAB.UccLinkMode.set(scannerConfig, propertyValue)); break;
  1010. case COMPOSITEC: result.set(Decoder.CompositeC.set(scannerConfig, propertyValue)); break;
  1011. case D2OF5: result.set(Decoder.D2of5.set(scannerConfig, propertyValue)); break;
  1012. case D2OF5MAXLENGTH: result.set(Decoder.D2of5.Length2.set(scannerConfig, propertyValue)); break;
  1013. case D2OF5MINLENGTH: result.set(Decoder.D2of5.Length1.set(scannerConfig, propertyValue)); break;
  1014. case D2OF5REDUNDANCY: result.set(Decoder.D2of5.Redundancy.set(scannerConfig, propertyValue)); break;
  1015. case DATAMATRIX: result.set(Decoder.DataMatrix.set(scannerConfig, propertyValue)); break;
  1016. case DUTCHPOSTAL: result.set(Decoder.DutchPostal.set(scannerConfig, propertyValue)); break;
  1017. case EAN13: result.set(Decoder.Ean13.set(scannerConfig, propertyValue)); break;
  1018. case EAN8: result.set(Decoder.Ean8.set(scannerConfig, propertyValue)); break;
  1019. case EAN8CONVERTTOEAN13: result.set(Decoder.Ean8.ConvertToEan13.set(scannerConfig, propertyValue)); break;
  1020. case GS1DATABAR: result.set(Decoder.Gs1Databar.set(scannerConfig, propertyValue)); break;
  1021. case GS1DATABAREXPANDED: result.set(Decoder.Gs1DatabarExp.set(scannerConfig, propertyValue)); break;
  1022. case GS1DATABARLIMITED: result.set(Decoder.Gs1DatabarLim.set(scannerConfig, propertyValue)); break;
  1023. case I2OF5: result.set(Decoder.I2of5.set(scannerConfig, propertyValue)); break;
  1024. case I2OF5CONVERTTOEAN13: result.set(Decoder.I2of5.ConvertToEan13.set(scannerConfig, propertyValue)); break;
  1025. case I2OF5MAXLENGTH: result.set(Decoder.I2of5.Length2.set(scannerConfig, propertyValue)); break;
  1026. case I2OF5MINLENGTH: result.set(Decoder.I2of5.Length1.set(scannerConfig, propertyValue)); break;
  1027. case I2OF5REDUNDANCY: result.set(Decoder.I2of5.Redundancy.set(scannerConfig, propertyValue)); break;
  1028. case I2OF5REPORTCHECKDIGIT: result.set(Decoder.I2of5.ReportCheckDigit.set(scannerConfig, propertyValue)); break;
  1029. case I2OF5VERIFYCHECKDIGIT: result.set(Decoder.I2of5.VerifyCheckDigit.set(scannerConfig, propertyValue)); break;
  1030. case JAPPOSTAL: result.set(Decoder.JapanesePostal.set(scannerConfig, propertyValue)); break;
  1031. case KOREAN3OF5: result.set(Decoder.Korean3of5.set(scannerConfig, propertyValue)); break;
  1032. case MATRIX2OF5: result.set(Decoder.Matrix2of5.set(scannerConfig, propertyValue)); break;
  1033. case MATRIX2OF5MAXLENGTH: result.set(Decoder.Matrix2of5.Length2.set(scannerConfig, propertyValue)); break;
  1034. case MATRIX2OF5MINLENGTH: result.set(Decoder.Matrix2of5.Length1.set(scannerConfig, propertyValue)); break;
  1035. case MATRIX2OF5REPORTCHECKDIGIT:result.set(Decoder.Matrix2of5.ReportCheckDigit.set(scannerConfig, propertyValue));break;
  1036. case MATRIX2OF5VERIFYCHECKDIGIT:result.set(Decoder.Matrix2of5.VerifyCheckDigit.set(scannerConfig, propertyValue));break;
  1037. case MAXICODE: result.set(Decoder.MaxiCode.set(scannerConfig, propertyValue)); break;
  1038. case MICROPDF: result.set(Decoder.MicroPdf.set(scannerConfig, propertyValue)); break;
  1039. case MICROQR: result.set(Decoder.MicroQr.set(scannerConfig, propertyValue)); break;
  1040. case MSI: result.set(Decoder.Msi.set(scannerConfig, propertyValue)); break;
  1041. case MSICHECKDIGITS: result.set(Decoder.Msi.CheckDigits.set(scannerConfig, propertyValue)); break;
  1042. case MSICHECKDIGITSCHEME: result.set(Decoder.Msi.CheckDigitScheme.set(scannerConfig, propertyValue)); break;
  1043. case MSIMAXLENGTH: result.set(Decoder.Msi.Length2.set(scannerConfig, propertyValue)); break;
  1044. case MSIMINLENGTH: result.set(Decoder.Msi.Length1.set(scannerConfig, propertyValue)); break;
  1045. case MSIREDUNDANCY: result.set(Decoder.Msi.Redundancy.set(scannerConfig, propertyValue)); break;
  1046. case MSIREPORTCHECKDIGIT: result.set(Decoder.Msi.ReportCheckDigit.set(scannerConfig, propertyValue)); break;
  1047. case PDF417: result.set(Decoder.Pdf417.set(scannerConfig, propertyValue)); break;
  1048. case QRCODE: result.set(Decoder.QrCode.set(scannerConfig, propertyValue)); break;
  1049. case SIGNATURE: result.set(Decoder.Signature.set(scannerConfig, propertyValue)); break;
  1050. case TLC39: result.set(Decoder.Tlc39.set(scannerConfig, propertyValue)); break;
  1051. case TRIOPTIC39: result.set(Decoder.TriOptic39.set(scannerConfig, propertyValue)); break;
  1052. case TRIOPTIC39REDUNDANCY: result.set(Decoder.TriOptic39.Redundancy.set(scannerConfig, propertyValue)); break;
  1053. case UKPOSTAL: result.set(Decoder.UkPostal.set(scannerConfig, propertyValue)); break;
  1054. case UKPOSTALREPORTCHECKDIGIT:result.set(Decoder.UkPostal.ReportCheckDigit.set(scannerConfig, propertyValue)); break;
  1055. case UPCA: result.set(Decoder.Upca.set(scannerConfig, propertyValue)); break;
  1056. case UPCAPREAMBLE: result.set(Decoder.Upca.Preamble.set(scannerConfig, propertyValue)); break;
  1057. case UPCAREPORTCHECKDIGIT: result.set(Decoder.Upca.ReportCheckDigit.set(scannerConfig, propertyValue)); break;
  1058. case UPCE0: result.set(Decoder.Upce0.set(scannerConfig, propertyValue)); break;
  1059. case UPCE0CONVERTTOUPCA: result.set(Decoder.Upce0.ConvertToUpca.set(scannerConfig, propertyValue)); break;
  1060. case UPCE0PREAMBLE: result.set(Decoder.Upce0.Preamble.set(scannerConfig, propertyValue)); break;
  1061. case UPCE0REPORTCHECKDIGIT: result.set(Decoder.Upce0.ReportCheckDigit.set(scannerConfig, propertyValue)); break;
  1062. case UPCE1: result.set(Decoder.Upce1.set(scannerConfig, propertyValue)); break;
  1063. case UPCE1CONVERTTOUPCA: result.set(Decoder.Upce1.ConvertToUpca.set(scannerConfig, propertyValue)); break;
  1064. case UPCE1PREAMBLE: result.set(Decoder.Upce1.Preamble.set(scannerConfig, propertyValue)); break;
  1065. case UPCE1REPORTCHECKDIGIT: result.set(Decoder.Upce1.ReportCheckDigit.set(scannerConfig, propertyValue)); break;
  1066. case UPCEANBOOKLAND: result.set(Decoder.UpcEanParams.BooklandCode.set(scannerConfig, propertyValue)); break;
  1067. case UPCEANBOOKLANDFORMAT: result.set(Decoder.UpcEanParams.BooklandFormat.set(scannerConfig, propertyValue)); break;
  1068. case UPCEANCONVERTGS1DATABARTOUPCEAN:result.set(Decoder.UpcEanParams.ConvertDataBarToUpcEan.set(scannerConfig, propertyValue)); break;
  1069. case UPCEANCOUPON: result.set(Decoder.UpcEanParams.CouponCode.set(scannerConfig, propertyValue)); break;
  1070. case UPCEANLINEARDECODE: result.set(Decoder.UpcEanParams.LinearDecode.set(scannerConfig, propertyValue)); break;
  1071. case UPCEANRANDOMWEIGHTCHECKDIGIT: result.set(Decoder.UpcEanParams.RandomWeightCheckDigit.set(scannerConfig, propertyValue)); break;
  1072. case UPCEANRETRYCOUNT: result.set(Decoder.UpcEanParams.SupplementalRetries.set(scannerConfig, propertyValue));break;
  1073. case UPCEANSECURITYLEVEL: result.set(Decoder.UpcEanParams.SecurityLevel.set(scannerConfig, propertyValue)); break;
  1074. case UPCEANSUPPLEMENTAL2: result.set(Decoder.UpcEanParams.Supplemental2.set(scannerConfig, propertyValue)); break;
  1075. case UPCEANSUPPLEMENTAL5: result.set(Decoder.UpcEanParams.Supplemental5.set(scannerConfig, propertyValue)); break;
  1076. case UPCEANSUPPLEMENTALMODE:result.set(Decoder.UpcEanParams.SupplementalMode.set(scannerConfig, propertyValue)); break;
  1077. case US4STATE: result.set(Decoder.Us4State.set(scannerConfig, propertyValue)); break;
  1078. case US4STATEFICS: result.set(Decoder.Us4StateFics.set(scannerConfig, propertyValue)); break;
  1079. case USPLANET: result.set(Decoder.UsPlanet.set(scannerConfig, propertyValue)); break;
  1080. case USPLANETREPORTCHECKDIGIT:result.set(Decoder.UsPlanet.ReportCheckDigit.set(scannerConfig, propertyValue)); break;
  1081. case USPOSTNET: result.set(Decoder.UsPostNet.set(scannerConfig, propertyValue)); break;
  1082. case USPOSTNETREPORTCHECKDIGIT:result.set(Decoder.UsPostNet.ReportCheckDigit.set(scannerConfig, propertyValue)); break;
  1083. case WEBCODE: result.set(Decoder.WebCode.set(scannerConfig, propertyValue)); break;
  1084. case WEBCODEDECODEGTSUBTYPE:result.set(Decoder.WebCode.SubType.set(scannerConfig, propertyValue)); break;
  1085. case ALLDECODERS: setAllDecodersState(propertyValue, result); break;
  1086. default:break;
  1087. }
  1088. if(isEnabled)
  1089. {
  1090. scanner.setConfig(scannerConfig);
  1091. scannerConfig = scanner.getConfig();
  1092. }
  1093. } catch (ScannerException e) {
  1094. Logger.E(TAG, e);
  1095. if(result != null) result.setError("An error occurred when trying to access the scanner");
  1096. return;
  1097. }
  1098. catch (NumberFormatException e) {
  1099. Logger.W(TAG, e);
  1100. if(result != null) result.setError("Incorrect parameter format");
  1101. return;
  1102. }
  1103. catch (IllegalArgumentException e) {
  1104. Logger.W(TAG, e);
  1105. if(result != null) result.setError(e.getMessage());
  1106. return;
  1107. }
  1108. super.setProperty(propertyName, propertyValue, result);
  1109. }
  1110. private void setAllDecodersState(String allDecodersString, IMethodResult methodResult){
  1111. setProperty(SettingString.AUSPOSTAL.name, allDecodersString, methodResult);
  1112. setProperty(SettingString.AZTEC.name, allDecodersString, methodResult);
  1113. setProperty(SettingString.CANPOSTAL.name, allDecodersString, methodResult);
  1114. setProperty(SettingString.CHINESE2OF5.name, allDecodersString, methodResult);
  1115. setProperty(SettingString.CODABAR.name, allDecodersString, methodResult);
  1116. setProperty(SettingString.CODE11.name, allDecodersString, methodResult);
  1117. setProperty(SettingString.CODE128.name, allDecodersString, methodResult);
  1118. setProperty(SettingString.CODE39.name, allDecodersString, methodResult);
  1119. setProperty(SettingString.CODE93.name, allDecodersString, methodResult);
  1120. setProperty(SettingString.COMPOSITEAB.name, allDecodersString, methodResult);
  1121. setProperty(SettingString.COMPOSITEC.name, allDecodersString, methodResult);
  1122. setProperty(SettingString.D2OF5.name, allDecodersString, methodResult);
  1123. setProperty(SettingString.DATAMATRIX.name, allDecodersString, methodResult);
  1124. setProperty(SettingString.DUTCHPOSTAL.name, allDecodersString, methodResult);
  1125. setProperty(SettingString.EAN13.name, allDecodersString, methodResult);
  1126. setProperty(SettingString.EAN8.name, allDecodersString, methodResult);
  1127. setProperty(SettingString.GS1DATABAR.name, allDecodersString, methodResult);
  1128. setProperty(SettingString.GS1DATABAREXPANDED.name, allDecodersString, methodResult);
  1129. setProperty(SettingString.GS1DATABARLIMITED.name, allDecodersString, methodResult);
  1130. setProperty(SettingString.I2OF5.name, allDecodersString, methodResult);
  1131. setProperty(SettingString.JAPPOSTAL.name, allDecodersString, methodResult);
  1132. setProperty(SettingString.KOREAN3OF5.name, allDecodersString, methodResult);
  1133. setProperty(SettingString.MATRIX2OF5.name, allDecodersString, methodResult);
  1134. setProperty(SettingString.MAXICODE.name, allDecodersString, methodResult);
  1135. setProperty(SettingString.MICROPDF.name, allDecodersString, methodResult);
  1136. setProperty(SettingString.MICROQR.name, allDecodersString, methodResult);
  1137. setProperty(SettingString.MSI.name, allDecodersString, methodResult);
  1138. setProperty(SettingString.PDF417.name, allDecodersString, methodResult);
  1139. setProperty(SettingString.QRCODE.name, allDecodersString, methodResult);
  1140. setProperty(SettingString.SIGNATURE.name, allDecodersString, methodResult);
  1141. setProperty(SettingString.TLC39.name, allDecodersString, methodResult);
  1142. setProperty(SettingString.TRIOPTIC39.name, allDecodersString, methodResult);
  1143. setProperty(SettingString.UKPOSTAL.name, allDecodersString, methodResult);
  1144. setProperty(SettingString.UPCA.name, allDecodersString, methodResult);
  1145. setProperty(SettingString.UPCE0.name, allDecodersString, methodResult);
  1146. setProperty(SettingString.UPCE1.name, allDecodersString, methodResult);
  1147. setProperty(SettingString.US4STATE.name, allDecodersString, methodResult);
  1148. setProperty(SettingString.US4STATEFICS.name, allDecodersString, methodResult);
  1149. setProperty(SettingString.USPLANET.name, allDecodersString, methodResult);
  1150. setProperty(SettingString.USPOSTNET.name, allDecodersString, methodResult);
  1151. setProperty(SettingString.WEBCODE.name, allDecodersString, methodResult);
  1152. super.setProperty("allDecoders", allDecodersString, methodResult);
  1153. }
  1154. @Override
  1155. public void take(Map<String, String> propertyMap, IMethodResult result)
  1156. {
  1157. setProperties(propertyMap, new MethodResult(false));
  1158. enableType = ENABLE_TYPE.TAKE;
  1159. takeCallback = result;
  1160. result.keepAlive();
  1161. if(!isEnabled) didTakeEnableTheScanner = true;
  1162. enable();
  1163. setProperties(propertyMap, new MethodResult(false));
  1164. startScanning();
  1165. }
  1166. @Override
  1167. public void take_barcode(String rubyCallbackURL, Map<String, String> propertyMap, IMethodResult result)
  1168. {
  1169. Logger.D(LOGTAG, "take_barcode");
  1170. result.setError("take_barcode is not supported on Zebra Enterprise Scanner Engines. Use 'take' or 'enable' instead.");
  1171. }
  1172. @Override
  1173. public void onResume()
  1174. {
  1175. Logger.D(TAG, "onResume");
  1176. isMinimized = false;
  1177. if(hasQueuedEnableTask)
  1178. {
  1179. hasQueuedEnableTask = false;
  1180. enable(null, enableCallback);
  1181. }
  1182. }
  1183. @Override
  1184. public void onPause()
  1185. {
  1186. Logger.D(TAG, "onPause+");
  1187. relinquishScanner();
  1188. isMinimized = true;
  1189. Logger.D(TAG, "onPause-");
  1190. }
  1191. @Override
  1192. public void onStop()
  1193. {
  1194. Logger.D(TAG, "onStop+");
  1195. relinquishScanner();
  1196. isMinimized = true;
  1197. Logger.D(TAG, "onStop-");
  1198. }
  1199. /**
  1200. * Call this when the Activity is minimized
  1201. */
  1202. private void relinquishScanner()
  1203. {
  1204. Logger.D(TAG, "relinquishScanner+");
  1205. if(!isMinimized)
  1206. {
  1207. stopScanning();
  1208. disable(!isMinimized);
  1209. }
  1210. Logger.D(TAG, "relinquishScanner-");
  1211. }
  1212. /**
  1213. * Enable the scanner if app is visible, else queue the command so it isnt lost.
  1214. */
  1215. private void enable()
  1216. {
  1217. Logger.D(TAG, "enable()+");
  1218. if(scanner != null)
  1219. {
  1220. try
  1221. {
  1222. if(isMinimized)
  1223. {
  1224. hasQueuedEnableTask = true;
  1225. }
  1226. else
  1227. {
  1228. scanner.enable();
  1229. if(isBluetooth) //For some reason bluetooth scanners dont fire "DISABLED" on a disable call
  1230. {
  1231. onStatus(StatusData.ScannerStates.IDLE);
  1232. }
  1233. }
  1234. }
  1235. catch (ScannerException e)
  1236. {
  1237. Logger.E(TAG, "enable Scanner ERROR, cannot enable scanner: " + e.getMessage());
  1238. e.printStackTrace();
  1239. }
  1240. }
  1241. Logger.D(TAG, "enable()-");
  1242. }
  1243. /**
  1244. * Disable the device. Reset parameters to default if this is a Rho.Barcode.disable call (as opposed to a minimizing
  1245. * disable call).
  1246. * @param isMinimizing if set to true, will re-enable the scanner object when app restored, unless any Rho API call
  1247. * to disable is made.
  1248. * @author Ben Kennedy (NCVT73)
  1249. */
  1250. private void disable(boolean isMinimizing)
  1251. {
  1252. Logger.D(TAG, "disable()+");
  1253. if(scanner != null)
  1254. {
  1255. try
  1256. {
  1257. if(isMinimizing && isEnabled)
  1258. {
  1259. hasQueuedEnableTask = true;
  1260. }
  1261. if(!isMinimized)
  1262. {
  1263. scannerConfig = defaultScannerConfig;
  1264. if(isEnabled) scanner.disable();
  1265. if(isMinimizing) isMinimized = true;
  1266. setAutoTab(Defaults.AUTOTAB, new MethodResult(false));
  1267. setAutoEnter(Defaults.AUTOENTER, new MethodResult(false));
  1268. setDecodeFrequency(Defaults.DECODE_FREQUENCY, new MethodResult(false));
  1269. setDecodeDuration(Defaults.DECODE_DURATION, new MethodResult(false));
  1270. setDecodeVolume(Defaults.DECODE_VOLUME, new MethodResult(false));
  1271. }
  1272. }
  1273. catch (ScannerException e)
  1274. {
  1275. Logger.E(TAG, "disable Scanner ERROR, cannot disable scanner: " + e.getMessage());
  1276. e.printStackTrace();
  1277. }
  1278. finally
  1279. {
  1280. if(!isMinimizing)
  1281. {
  1282. propertyQueue.clear();
  1283. hasQueuedEnableTask = false;
  1284. }
  1285. if(isBluetooth) //For some reason bluetooth scanners dont fire "DISABLED" on a disable call
  1286. {
  1287. onStatus(StatusData.ScannerStates.DISABLED);
  1288. }
  1289. }
  1290. }
  1291. isEnabled = false;
  1292. Logger.D(TAG, "disable()-");
  1293. }
  1294. /**
  1295. * Stop the scanner from scanning.
  1296. */
  1297. private void stopScanning()
  1298. {
  1299. Logger.D(TAG, "stopScanning+");
  1300. if(isMinimized) return;
  1301. if(scanner != null)
  1302. {
  1303. try
  1304. {
  1305. scanner.cancelRead();
  1306. }
  1307. catch (ScannerException e)
  1308. {
  1309. Logger.E(TAG, "stopScanning Scanner ERROR, cannot stop scanner: " + e.getMessage());
  1310. e.printStackTrace();
  1311. }
  1312. }
  1313. Logger.D(TAG, "stopScanning-");
  1314. }
  1315. /**
  1316. * Start scanning. Doesnt work with
  1317. */
  1318. private void startScanning()
  1319. {
  1320. Logger.D(TAG, "startScanning+");
  1321. if(isMinimized) return;
  1322. if(scanner != null)
  1323. {
  1324. try
  1325. {
  1326. scanner.triggerType = TriggerType.SOFT_ONCE;
  1327. scanner.read();
  1328. }
  1329. catch (ScannerException e)
  1330. {
  1331. Logger.E(TAG, "startScanning Scanner ERROR, cannot start scanner: " + e.getMessage());
  1332. e.printStackTrace();
  1333. }
  1334. }
  1335. Logger.D(TAG, "startScanning-");
  1336. }
  1337. @Override
  1338. public void onDestroy()
  1339. {
  1340. Logger.D(TAG, "onDestroy");
  1341. destroy();
  1342. }
  1343. @Override
  1344. public void onStatus(StatusData statusData)
  1345. {
  1346. onStatus(statusData.getState());
  1347. }
  1348. /**
  1349. * This has had to be created as onStatus(StatusData) cannot be called from inside this class as StatusData
  1350. * doesnt have a public constructor.
  1351. * onStatus is fired by the scanning library when the scanning hardware state changes. This means that state changes
  1352. * are asynchronous. Consequently, a lot of scanner setup code is in the IDLE case, as we can now only get the config
  1353. * if the scanner is enabled. Therefore when the scanner is setup, we do a quick enable->disable cycle to fetch the
  1354. * config.
  1355. * @param status the status of the scanner
  1356. * @author Ben Kennedy (NCVT73)
  1357. */
  1358. private void onStatus(ScannerStates status)
  1359. {
  1360. //TODO Probably need synchro on propertyQueue
  1361. Logger.D(TAG, scannerNameShort + " onStatus: " + status.name());
  1362. emdk3_0bugOnStatusFired = true;
  1363. switch(status)
  1364. {
  1365. case WAITING: break;//Bluetooth Scanner's Idle (for bluetooth we need to call "read" as it uses the hard scan button)
  1366. case IDLE:
  1367. if(scannerConfig == null)
  1368. {
  1369. try
  1370. {
  1371. scannerConfig = scanner.getConfig();
  1372. defaultScannerConfig = scannerConfig;
  1373. }
  1374. catch (ScannerException e)
  1375. {
  1376. Logger.E(TAG, "A Scanner error has occurred. Cannot get scanner settings. Scanner settings can not be modified. " + e);
  1377. }
  1378. }
  1379. if(supportedProperties == null) popluateSupportedProperties();
  1380. if(isInitialising)
  1381. {
  1382. try
  1383. {
  1384. scanner.disable();
  1385. }
  1386. catch (ScannerException e)
  1387. {
  1388. // TODO
  1389. e.printStackTrace();
  1390. }
  1391. return;
  1392. }
  1393. if(scannerConfig != null)
  1394. {
  1395. try
  1396. {
  1397. scanner.setConfig(scannerConfig);
  1398. }
  1399. catch (ScannerException e)
  1400. {
  1401. Logger.E(TAG, "onStatus Scanner ERROR, cannot change config: " + e.getMessage());
  1402. e.printStackTrace();
  1403. }
  1404. }
  1405. isEnabled = true;
  1406. isScanning = false;
  1407. if(propertyQueue.size() > 0)
  1408. {
  1409. for(Pair<String,String> pair: propertyQueue)
  1410. {
  1411. setProperty(pair.first, pair.second, new MethodResult(false));
  1412. }
  1413. propertyQueue.clear();
  1414. }
  1415. if(isBluetooth)
  1416. {
  1417. scanner.triggerType = TriggerType.HARD;
  1418. try
  1419. {
  1420. scanner.read();
  1421. }
  1422. catch (ScannerException e)
  1423. {
  1424. Logger.E(TAG, "onStatus Scanner ERROR, cannot initiate Bluetooth scanner read " + e.getMessage());
  1425. e.printStackTrace();
  1426. }
  1427. }
  1428. break;
  1429. case SCANNING:
  1430. isScanning = true;
  1431. break;
  1432. case DISABLED:
  1433. isEnabled = false;
  1434. isScanning = false;
  1435. if(isInitialising)
  1436. {
  1437. AsyncTask.execute(new Runnable()
  1438. {
  1439. @Override
  1440. public void run()
  1441. {
  1442. Logger.D(TAG, scannerNameShort + " has finished initializing");
  1443. isInitialising = false;
  1444. factory.emdk3BarcodeHasSetup();
  1445. }
  1446. });
  1447. }
  1448. break;
  1449. //case ERROR: Logger.E(TAG, "Scanner is in an ERROR state");
  1450. default:
  1451. break;
  1452. }
  1453. Logger.D(TAG, scannerNameShort + " onStatus-");
  1454. }
  1455. @Override
  1456. public void onData(ScanDataCollection scanDataCollection)
  1457. {
  1458. Logger.D(TAG, "onData +");
  1459. //Scan has occurred
  1460. switch(enableType)
  1461. {
  1462. case ENABLE:
  1463. for(ScanDataCollection.ScanData scanData : scanDataCollection.getScanData())
  1464. {
  1465. if(enableCallback != null)
  1466. {
  1467. enableCallback.set(EMDKCommon.makeEnableResultMap(scanData, scannerId));
  1468. }
  1469. else
  1470. {
  1471. EMDKCommon.outputAsKeys(scanData.getData(), autoValue);
  1472. }
  1473. }
  1474. break;
  1475. case TAKE:
  1476. for(ScanDataCollection.ScanData scanData : scanDataCollection.getScanData())
  1477. {
  1478. takeCallback.set(EMDKCommon.makeTakeResultMap(scanData, true));
  1479. }
  1480. if(didTakeEnableTheScanner)
  1481. {
  1482. disable(false);
  1483. didTakeEnableTheScanner = false;
  1484. }
  1485. break;
  1486. default:
  1487. Logger.D(TAG, "Unexpected onData Event");
  1488. break;
  1489. }
  1490. Logger.D(TAG, "onData -");
  1491. }
  1492. @Override
  1493. public void setDecodeVolume(int decodeVolume, IMethodResult result)
  1494. {
  1495. Logger.D(LOGTAG, "setDecodeVolume: " + decodeVolume);
  1496. super.setProperty("decodeSound", "", new MethodResult(false));
  1497. super.setProperty("decodeVolume", String.valueOf(decodeVolume), result);
  1498. setProperty("decodeSound", getDecodeAudioFilePath(), result);
  1499. }
  1500. @Override
  1501. public void setDecodeDuration(int decodeDuration, IMethodResult result)
  1502. {
  1503. Logger.D(LOGTAG, "setDecodeDuration: " + decodeDuration);
  1504. super.setProperty("decodeSound", "", new MethodResult(false));
  1505. super.setProperty("decodeDuration", String.valueOf(decodeDuration), result);
  1506. setProperty("decodeSound", getDecodeAudioFilePath(), result);
  1507. }
  1508. @Override
  1509. public void setDecodeFrequency(int decodeFrequency, IMethodResult result)
  1510. {
  1511. Logger.D(LOGTAG, "setDecodeFrequency: " + decodeFrequency);
  1512. super.setProperty("decodeSound", "", new MethodResult(false));
  1513. super.setProperty("decodeFrequency", String.valueOf(decodeFrequency), result);
  1514. setProperty("decodeSound", getDecodeAudioFilePath(), result);
  1515. }
  1516. @Override
  1517. public void setDecodeSound(String decodeSound, IMethodResult result)
  1518. {
  1519. Logger.D(LOGTAG, "setDecodeSound: " + decodeSound);
  1520. super.setProperty("decodeSound", decodeSound, result);
  1521. setProperty("decodeSound", getDecodeAudioFilePath(), null);
  1522. }
  1523. @Override
  1524. public void setAllDecoders(boolean allDecoders, IMethodResult result)
  1525. {
  1526. Logger.D(TAG, "setAllDecoders: " + allDecoders);
  1527. MethodResult methodResult = new MethodResult(false);
  1528. String allDecodersString = Boolean.toString(allDecoders);
  1529. setAllDecodersState(allDecodersString, methodResult);
  1530. Logger.D(TAG, "setAllDecoders-");
  1531. }
  1532. @Override
  1533. public void setAutoEnter(boolean autoEnter, IMethodResult result)
  1534. {
  1535. Logger.D(TAG, "setAutoEnter: " + autoEnter);
  1536. if(autoEnter) autoValue = AutoValue.AUTOENTER;
  1537. else if(autoValue.equals(AutoValue.AUTOENTER)) autoValue = AutoValue.NONE;
  1538. super.setProperty("autoEnter", Boolean.valueOf(autoEnter).toString(), result);
  1539. Logger.D(TAG, "setAutoEnter-");
  1540. }
  1541. @Override
  1542. public void setAutoTab(boolean autoTab, IMethodResult result)
  1543. {
  1544. Logger.D(TAG, "setAutoTab: " + autoTab);
  1545. if(autoTab) autoValue = AutoValue.AUTOTAB;
  1546. else if(autoValue.equals(AutoValue.AUTOTAB)) autoValue = AutoValue.NONE;
  1547. super.setProperty("autoTab", Boolean.valueOf(autoTab).toString(), result);
  1548. Logger.D(TAG, "setAutoTab-");
  1549. }
  1550. public void destroy()
  1551. {
  1552. if(scanner != null)
  1553. {
  1554. try
  1555. {
  1556. scanner.disable();
  1557. }
  1558. catch (ScannerException e)
  1559. {
  1560. Logger.W(TAG, "Scanner failed to disable on shutdown");
  1561. }
  1562. try
  1563. {
  1564. scanner.removeDataListener(this);
  1565. scanner.removeStatusListener(this);
  1566. }
  1567. catch(NullPointerException e) //TODO bad EMDK. Naughty.
  1568. {
  1569. //continue
  1570. }
  1571. scanner = null;
  1572. }
  1573. scannerInfo = null;
  1574. scannerConfig = null;
  1575. propertyQueue = null;
  1576. }
  1577. /**
  1578. * Enum containing all known Scanning Settings, together with its Rho name and EMDK class name, where possible.
  1579. * Class name can be used to check if a setting is supported.
  1580. * @author Ben Kennedy (NCVT73)
  1581. */
  1582. public enum SettingString
  1583. {
  1584. ALLDECODERS ("allDecoders", null),
  1585. AUTOENTER ("autoEnter", null),
  1586. AUTOTAB ("autoTab", null),
  1587. DECODEDURATION ("decodeDuration", null),
  1588. DECODEFREQUENCY ("decodeFrequency", null),
  1589. DECODESOUND ("decodeSound", null),
  1590. DECODEVOLUME ("decodeVolume", null),
  1591. FRIENDLYNAME ("friendlyName", null),
  1592. ID ("id", null),
  1593. SCANNERTYPE ("scannerType", null),
  1594. ADAPTIVESCANNING ("adaptiveScanning", null),
  1595. AIMMODE ("aimMode", null),
  1596. AIMTYPE ("aimType", null),
  1597. AUSPOSTAL ("ausPostal", "config.decoderParams.australianPostal.enabled"),
  1598. AZTEC ("aztec", "config.decoderParams.aztec.enabled"),
  1599. BARCODEDATAFORMAT ("barcodeDataFormat", null),
  1600. BEAMWIDTH ("beamWidth", null),
  1601. BIDIRECTIONALREDUNDANCY ("bidirectionalRedundancy", null),
  1602. CANPOSTAL ("canPostal", "config.decoderParams.canadianPostal.enabled"),
  1603. CHINESE2OF5 ("chinese2of5", "config.decoderParams.chinese2of5.enabled"),
  1604. CODABAR ("codabar", "config.decoderParams.codaBar.enabled"),
  1605. CODABARCLSIEDITING ("codabarClsiEditing", "config.decoderParams.codaBar.clsiEditing"),
  1606. CODABARMAXLENGTH ("codabarMaxLength", "config.decoderParams.codaBar.length2"),
  1607. CODABARMINLENGTH ("codabarMinLength", "config.decoderParams.codaBar.length1"),
  1608. CODABARNOTISEDITING ("codabarNotisEditing", "config.decoderParams.codaBar.notisEditing"),
  1609. CODABARREDUNDANCY ("codabarRedundancy", "config.decoderParams.codaBar.redundancy"),
  1610. CODE11 ("code11", "config.decoderParams.code11.enabled"),
  1611. CODE11CHECKDIGITCOUNT ("code11checkDigitCount", null),
  1612. CODE11MAXLENGTH ("code11maxLength", "config.decoderParams.code11.length2"),
  1613. CODE11MINLENGTH ("code11minLength", "config.decoderParams.code11.length1"),
  1614. CODE11REDUNDANCY ("code11redundancy", "config.decoderParams.code11.redundancy"),
  1615. CODE11REPORTCHECKDIGIT ("code11reportCheckDigit", "config.decoderParams.code11.reportCheckDigit"),
  1616. CODE128 ("code128", "config.decoderParams.code128.enabled"),
  1617. CODE128CHECKISBTTABLE ("code128checkIsBtTable", "config.decoderParams.code128.checkIsbtTable"),
  1618. CODE128EAN128 ("code128ean128", "config.decoderParams.code128.enableEan128"),
  1619. CODE128ISBT128 ("code128isbt128", "config.decoderParams.code128.enableIsbt128"),
  1620. CODE128ISBT128CONCATMODE ("code128isbt128ConcatMode", "config.decoderParams.code128.isbt128ConcatMode"),
  1621. CODE128MAXLENGTH ("code128maxLength", "config.decoderParams.code128.length2"),
  1622. CODE128MINLENGTH ("code128minLength", "config.decoderParams.code128.length1"),
  1623. CODE128OTHER128 ("code128other128", "config.decoderParams.code128.enablePlain"),
  1624. CODE128REDUNDANCY ("code128redundancy", "config.decoderParams.code128.redundancy"),
  1625. CODE128SECURITYLEVEL ("code128securityLevel", "config.decoderParams.code128.securityLevel"),
  1626. CODE39 ("code39", "config.decoderParams.code39.enabled"),
  1627. CODE39CODE32PREFIX ("code39code32Prefix", "config.decoderParams.code39.reportCode32Prefix"),
  1628. CODE39CONVERTTOCODE32 ("code39convertToCode32", "config.decoderParams.code39.convertToCode32"),
  1629. CODE39FULLASCII ("code39fullAscii", "config.decoderParams.code39.fullAscii"),
  1630. CODE39MAXLENGTH ("code39maxLength", "config.decoderParams.code39.length2"),
  1631. CODE39MINLENGTH ("code39minLength", "config.decoderParams.code39.length1"),
  1632. CODE39REDUNDANCY ("code39redundancy", "config.decoderParams.code39.redundancy"),
  1633. CODE39REPORTCHECKDIGIT ("code39reportCheckDigit", "config.decoderParams.code39.reportCheckDigit"),
  1634. CODE39SECURITYLEVEL ("code39securityLevel", "config.decoderParams.code39.securityLevel"),
  1635. CODE39VERIFYCHECKDIGIT ("code39verifyCheckDigit", "config.decoderParams.code39.verifyCheckDigit"),
  1636. CODE93 ("code93", "config.decoderParams.code93.enabled"),
  1637. CODE93MAXLENGTH ("code93maxLength", "config.decoderParams.code93.length2"),
  1638. CODE93MINLENGTH ("code93minLength", "config.decoderParams.code93.length1"),
  1639. CODE93REDUNDANCY ("code93redundancy", "config.decoderParams.code93.redundancy"),
  1640. COMPOSITEAB ("compositeAb", "config.decoderParams.compositeAB.enabled"),
  1641. COMPOSITEABUCCLINKMODE ("compositeAbUccLinkMode", "config.decoderParams.compositeAB.uccLinkMode"),
  1642. COMPOSITEABUSEUPCPREAMBLECHECKDIGITRULES("compositeAbUseUpcPreambleCheckDigitRules", null),
  1643. COMPOSITEC ("compositec", "config.decoderParams.compositeC.enabled"),
  1644. CONNECTIONIDLETIMEOUT ("connectionIdleTimeout", null),
  1645. D2OF5 ("d2of5", "config.decoderParams.d2of5.enabled"),
  1646. D2OF5MAXLENGTH ("d2of5maxLength", "config.decoderParams.d2of5.length2"),
  1647. D2OF5MINLENGTH ("d2of5minLength", "config.decoderParams.d2of5.length1"),
  1648. D2OF5REDUNDANCY ("d2of5redundancy", "config.decoderParams.d2of5.redundancy"),
  1649. DATABUFFERSIZE ("dataBufferSize", null),
  1650. DATAMATRIX ("dataMatrix", "config.decoderParams.dataMatrix.enabled"),
  1651. DBPMODE ("dbpMode", null),
  1652. DIFFERENTSYMBOLTIMEOUT ("differentSymbolTimeout", null),
  1653. DISABLESCANNERDURINGNAVIGATE ("disableScannerDuringNavigate", null),
  1654. DISCONNECTBTONDISABLE ("disconnectBtOnDisable", null),
  1655. DISPLAYBTADDRESSBARCODEONENABLE ("displayBtAddressBarcodeOnEnable", null),
  1656. DPMMODE ("dpmMode", null),
  1657. DUTCHPOSTAL ("dutchPostal", "config.decoderParams.dutchPostal.enabled"),
  1658. EAN13 ("ean13", "config.decoderParams.ean13.enabled"),
  1659. EAN8 ("ean8", "config.decoderParams.ean8.enabled"),
  1660. EAN8CONVERTTOEAN13 ("ean8convertToEan13", "config.decoderParams.ean8.convertToEan13"),
  1661. ENABLETIMEOUT ("enableTimeout", null),
  1662. FOCUSMODE ("focusMode", null),
  1663. GS1DATABAR ("gs1databar", "config.decoderParams.gs1Databar.enabled"),
  1664. GS1DATABAREXPANDED ("gs1databarExpanded", "config.decoderParams.gs1DatabarExp.enabled"),
  1665. GS1DATABARLIMITED ("gs1databarLimited", "config.decoderParams.gs1DatabarLim.enabled"),
  1666. HAPTICFEEDBACK ("hapticFeedback", "config.scanParams.decodeHapticFeedback"),
  1667. I2OF5 ("i2of5", "config.decoderParams.i2of5.enabled"),
  1668. I2OF5CONVERTTOEAN13 ("i2of5convertToEan13", "config.decoderParams.i2of5.convertToEan13"),
  1669. I2OF5MAXLENGTH ("i2of5maxLength", "config.decoderParams.i2of5.length2"),
  1670. I2OF5MINLENGTH ("i2of5minLength", "config.decoderParams.i2of5.length1"),
  1671. I2OF5REDUNDANCY ("i2of5redundancy", "config.decoderParams.i2of5.redundancy"),
  1672. I2OF5REPORTCHECKDIGIT ("i2of5reportCheckDigit", "config.decoderParams.i2of5.reportCheckDigit"),
  1673. I2OF5VERIFYCHECKDIGIT ("i2of5verifyCheckDigit", "config.decoderParams.i2of5.verifyCheckDigit"),
  1674. ILLUMINATIONMODE ("illuminationMode", null),
  1675. INVALIDDECODEFREQUENCY ("invaliddecodeFrequency", null),
  1676. INVALIDDECODESOUND ("invaliddecodeSound", null),
  1677. INVERSE1DMODE ("inverse1dMode", null),
  1678. JAPPOSTAL ("japPostal", "config.decoderParams.japanesePostal.enabled"),
  1679. KLASSEEINS ("klasseEins", null),
  1680. KOREAN3OF5 ("korean3of5", "config.decoderParams.korean3of5.enabled"),
  1681. KOREAN3OF5MAXLENGTH ("korean3of5maxLength", null),
  1682. KOREAN3OF5MINLENGTH ("korean3of5minLength", null),
  1683. KOREAN3OF5REDUNDANCY ("korean3of5redundancy", null),
  1684. LCDMODE ("lcdMode", null),
  1685. LINEARSECURITYLEVEL ("linearSecurityLevel", null),
  1686. LOWBATTERYSCAN ("lowBatteryScan", null),
  1687. MACROMICROPDF ("macroMicroPdf", null),
  1688. MACROMICROPDFBUFFERLABELS ("macroMicroPdfBufferLabels", null),
  1689. MACROMICROPDFCONVERTTOMICROPDF ("macroMicroPdfConvertToMicroPdf", null),
  1690. MACROMICROPDFEXCLUSIVE ("macroMicroPdfExclusive", null),
  1691. MACROMICROPDFREPORTAPPENDINFO ("macroMicroPdfReportAppendInfo", null),
  1692. MACROPDF ("macroPdf", null),
  1693. MACROPDFBUFFERLABELS ("macroPdfBufferLabels", null),
  1694. MACROPDFCONVERTTOPDF417 ("macroPdfConvertToPdf417", null),
  1695. MACROPDFEXCLUSIVE ("macroPdfExclusive", null),
  1696. MATRIX2OF5 ("matrix2of5", "config.decoderParams.matrix2of5.enabled"),
  1697. MATRIX2OF5MAXLENGTH ("matrix2of5maxLength", "config.decoderParams.matrix2of5.length2"),
  1698. MATRIX2OF5MINLENGTH ("matrix2of5minLength", "config.decoderParams.matrix2of5.length1"),
  1699. MATRIX2OF5REPORTCHECKDIGIT ("matrix2of5reportCheckDigit", "config.decoderParams.matrix2of5.reportCheckDigit"),
  1700. MATRIX2OF5VERIFYCHECKDIGIT ("matrix2of5verifyCheckDigit", "config.decoderParams.matrix2of5.verifyCheckDigit"),
  1701. MAXICODE ("maxiCode", "config.decoderParams.maxiCode.enabled"),
  1702. MICROPDF ("microPdf", "config.decoderParams.microPdf.enabled"),
  1703. MICROQR ("microQr", "config.decoderParams.microQr.enabled"),
  1704. MSI ("msi", "config.decoderParams.msi.enabled"),
  1705. MSICHECKDIGITS ("msiCheckDigits", "config.decoderParams.msi.checkDigits"),
  1706. MSICHECKDIGITSCHEME ("msiCheckDigitScheme", "config.decoderParams.msi.checkDigitScheme"),
  1707. MSIMAXLENGTH ("msiMaxLength", "config.decoderParams.msi.length2"),
  1708. MSIMINLENGTH ("msiMinLength", "config.decoderParams.msi.length1"),
  1709. MSIREDUNDANCY ("msiRedundancy", "config.decoderParams.msi.redundancy"),
  1710. MSIREPORTCHECKDIGIT ("msiReportCheckDigit", "config.decoderParams.msi.reportCheckDigit"),
  1711. PDF417 ("pdf417", "config.decoderParams.pdf417.enabled"),
  1712. PICKLISTMODE ("picklistMode", null),
  1713. POORQUALITY1DMODE ("poorQuality1dMode", null),
  1714. QRCODE ("qrCode", "config.decoderParams.qrCode.enabled"),
  1715. RASTERHEIGHT ("rasterHeight", null),
  1716. RASTERMODE ("rasterMode", null),
  1717. RSMBATTERYCAPACITY ("rsmBatteryCapacity", null),
  1718. RSMBATTERYID ("rsmBatteryId", null),
  1719. RSMBATTERYSTATUS ("rsmBatteryStatus", null),
  1720. RSMBLUETOOTHADDRESS ("rsmBluetoothAddress", null),
  1721. RSMBLUETOOTHAUTHENTICATION ("rsmBluetoothAuthentication", null),
  1722. RSMBLUETOOTHAUTORECONNECT ("rsmBluetoothAutoReconnect", null),
  1723. RSMBLUETOOTHBEEPONRECONNECTATTEMPT ("rsmBluetoothBeepOnReconnectAttempt", null),
  1724. RSMBLUETOOTHENCRYPTION ("rsmBluetoothEncryption", null),
  1725. RSMBLUETOOTHFRIENDLYNAME ("rsmBluetoothFriendlyName", null),
  1726. RSMBLUETOOTHHIDAUTORECONNECT ("rsmBluetoothHidAutoReconnect", null),
  1727. RSMBLUETOOTHINQUIRYMODE ("rsmBluetoothInquiryMode", null),
  1728. RSMBLUETOOTHPINCODE ("rsmBluetoothPinCode", null),
  1729. RSMBLUETOOTHPINCODETYPE ("rsmBluetoothPinCodeType", null),
  1730. RSMBLUETOOTHRECONNECTIONATTEMPTS ("rsmBluetoothReconnectionattempts", null),
  1731. RSMDATEOFMANUFACTURE ("rsmDateOfManufacture", null),
  1732. RSMDATEOFSERVICE ("rsmDateOfService", null),
  1733. RSMDECODEFEEDBACK ("rsmDecodeFeedback", null),
  1734. RSMDEVICECLASS ("rsmDeviceClass", null),
  1735. RSMFIRMWAREVERSION ("rsmFirmwareVersion", null),
  1736. RSMFORCESAVEPAIRINGBARCODE ("rsmForceSavePairingBarcode", null),
  1737. RSMGOODSCANSDELAY ("rsmGoodScansDelay", null),
  1738. RSMIGNORECODE128USPS ("rsmIgnoreCode128Usps", null),
  1739. RSMLOWBATTERYINDICATION ("rsmLowBatteryIndication", null),
  1740. RSMLOWBATTERYINDICATIONCYCLE ("rsmLowBatteryIndicationCycle", null),
  1741. RSMMEMS ("rsmMems", null),
  1742. RSMMODELNUMBER ("rsmModelNumber", null),
  1743. RSMPAGINGBEEPSEQUENCE ("rsmPagingBeepSequence", null),
  1744. RSMPAGINGENABLE ("rsmPagingEnable", null),
  1745. RSMPROXIMITYCONTINUOUS ("rsmProximityContinuous", null),
  1746. RSMPROXIMITYDISTANCE ("rsmProximityDistance", null),
  1747. RSMPROXIMITYENABLE ("rsmProximityEnable", null),
  1748. RSMSCANLINEWIDTH ("rsmScanLineWidth", null),
  1749. RSMSCANTRIGGERWAKEUP ("rsmScanTriggerWakeup", null),
  1750. RSMSERIALNUMBER ("rsmSerialNumber", null),
  1751. SAMESYMBOLTIMEOUT ("sameSymbolTimeout", null),
  1752. SCANTIMEOUT ("scanTimeout", null),
  1753. SIGNATURE ("signature", "config.decoderParams.signature.enabled"),
  1754. SIGNATUREIMAGEHEIGHT ("signatureImageHeight", null),
  1755. SIGNATUREIMAGEQUALITY ("signatureImageQuality", null),
  1756. SIGNATUREIMAGEWIDTH ("signatureImageWidth", null),
  1757. TIMEDAIMDURATION ("timedAimDuration", null),
  1758. TLC39 ("tlc39", "config.decoderParams.tlc39.enabled"),
  1759. TRIGGERCONNECTED ("triggerConnected", null),
  1760. TRIOPTIC39 ("trioptic39", "config.decoderParams.triOptic39.enabled"),
  1761. TRIOPTIC39REDUNDANCY ("trioptic39Redundancy", "config.decoderParams.triOptic39.redundancy"),
  1762. UKPOSTAL ("ukPostal", "config.decoderParams.ukPostal.enabled"),
  1763. UKPOSTALREPORTCHECKDIGIT ("ukPostalReportCheckDigit", "config.decoderParams.ukPostal.reportCheckDigit"),
  1764. UPCA ("upca", "config.decoderParams.upca.enabled"),
  1765. UPCAPREAMBLE ("upcaPreamble", "config.decoderParams.upca.preamble"),
  1766. UPCAREPORTCHECKDIGIT ("upcaReportCheckDigit", "config.decoderParams.upca.reportCheckDigit"),
  1767. UPCE0 ("upce0", "config.decoderParams.upce0.enabled"),
  1768. UPCE0CONVERTTOUPCA ("upce0convertToUpca", "config.decoderParams.upce0.convertToUpca"),
  1769. UPCE0PREAMBLE ("upce0preamble", "config.decoderParams.upce0.preamble"),
  1770. UPCE0REPORTCHECKDIGIT ("upce0ReportCheckDigit", "config.decoderParams.upce0.reportCheckDigit"),
  1771. UPCE1 ("upce1", "config.decoderParams.upce1.enabled"),
  1772. UPCE1CONVERTTOUPCA ("upce1convertToUpca", "config.decoderParams.upce1.convertToUpca"),
  1773. UPCE1PREAMBLE ("upce1preamble", "config.decoderParams.upce1.preamble"),
  1774. UPCE1REPORTCHECKDIGIT ("upce1ReportCheckDigit", "config.decoderParams.upce1.reportCheckDigit"),
  1775. UPCEANBOOKLAND ("upcEanBookland", "config.decoderParams.upcEanParams.booklandCode"),
  1776. UPCEANBOOKLANDFORMAT ("upcEanBooklandFormat", "config.decoderParams.upcEanParams.booklandFormat"),
  1777. UPCEANCONVERTGS1DATABARTOUPCEAN ("upcEanConvertGs1DatabarToUpcEan", "config.decoderParams.upcEanParams.convertDataBarToUpcEan"),
  1778. UPCEANCOUPON ("upcEanCoupon", "config.decoderParams.upcEanParams.couponCode"),
  1779. UPCEANLINEARDECODE ("upcEanLinearDecode", "config.decoderParams.upcEanParams.linearDecode"),
  1780. UPCEANRANDOMWEIGHTCHECKDIGIT ("upcEanRandomWeightCheckDigit", "config.decoderParams.upcEanParams.randomWeightCheckDigit"),
  1781. UPCEANRETRYCOUNT ("upcEanRetryCount", "config.decoderParams.upcEanParams.supplementalRetries"),
  1782. UPCEANSECURITYLEVEL ("upcEanSecurityLevel", "config.decoderParams.upcEanParams.securityLevel"),
  1783. UPCEANSUPPLEMENTAL2 ("upcEanSupplemental2", "config.decoderParams.upcEanParams.supplemental2"),
  1784. UPCEANSUPPLEMENTAL5 ("upcEanSupplemental5", "config.decoderParams.upcEanParams.supplemental5"),
  1785. UPCEANSUPPLEMENTALMODE ("upcEanSupplementalMode", "config.decoderParams.upcEanParams.supplementalMode"),
  1786. US4STATE ("us4state", "config.decoderParams.us4State.enabled"),
  1787. US4STATEFICS ("us4stateFics", "config.decoderParams.us4StateFics.enabled"),
  1788. USPLANET ("usPlanet", "config.decoderParams.usPlanet.enabled"),
  1789. USPLANETREPORTCHECKDIGIT ("usPlanetReportCheckDigit", "config.decoderParams.usPlanet.reportCheckDigit"),
  1790. USPOSTNET ("usPostnet", "config.decoderParams.usPostNet.enabled"),
  1791. USPOSTNETREPORTCHECKDIGIT ("usPostnetReportCheckDigit", "config.decoderParams.usPostNet.reportCheckDigit"),
  1792. VIEWFINDERFEEDBACK ("viewfinderFeedback", null),
  1793. VIEWFINDERFEEDBACKTIME ("viewfinderFeedbacktime", null),
  1794. VIEWFINDERHEIGHT ("viewfinderHeight", null),
  1795. VIEWFINDERMODE ("viewfinderMode", null),
  1796. VIEWFINDERWIDTH ("viewfinderWidth", null),
  1797. VIEWFINDERX ("viewfinderX", null),
  1798. VIEWFINDERY ("viewfinderY", null),
  1799. WEBCODE ("webcode", "config.decoderParams.webCode.enabled"),
  1800. WEBCODEDECODEGTSUBTYPE ("webcodeDecodeGtSubtype", "config.decoderParams.webCode.subType");
  1801. private final String name;
  1802. private final String emdkName;
  1803. SettingString (String name, String emdkName)
  1804. {
  1805. this.name = name;
  1806. this.emdkName = emdkName;
  1807. }
  1808. }
  1809. static
  1810. {
  1811. SettingString[] settingStrings = SettingString.values();
  1812. for(SettingString setting: settingStrings)
  1813. {
  1814. allProperties.add(setting.name);
  1815. }
  1816. }
  1817. }