public void OnOpened(EMDKManager emdkManager) { Log.Debug(TAG, "onOpened"); textViewStatus.Text = "Status: " + "EMDK open success!"; this.emdkManager = emdkManager; simulscanManager = (SimulScanManager)this.emdkManager .GetInstance(Symbol.XamarinEMDK.EMDKManager.FEATURE_TYPE.Simulscan); if (null == simulscanManager) { Log.Error(TAG, "Get SimulScanManager instance failed!"); textViewStatus.Text = "Status: " + "Get SimulScanManager instance failed!"; return; } readerInfoList = simulscanManager.SupportedDevicesInfo; List <string> nameList = new List <string>(); foreach (SimulScanReaderInfo rinfo in readerInfoList) { nameList.Add(rinfo.FriendlyName); } addItemsOnSpinner(spinner2, nameList); spinner2.ItemSelected += spinner2_ItemSelected; readerIndex = 0; try { selectedSimulScanReader = simulscanManager.GetDevice((SimulScanReaderInfo)readerInfoList[readerIndex]); initCurrentScanner(); } catch (SimulScanException e) { // TODO Auto-generated catch block e.PrintStackTrace(); } }
public void prepareScanner(int pos) { if (simulscanManager != null) { SimulScanReaderInfo readerInfo = (SimulScanReaderInfo)readerInfoList[pos]; if (readerInfo != null) { Log.Debug(TAG, "onItemSelected:" + readerInfo.FriendlyName); if (readerIndex != pos) { readerIndex = pos; } // if (readerInfo.getDeviceIdentifier() != selectedDeviceIdentifier) { // selectedDeviceIdentifier = readerInfo.getDeviceIdentifier(); try { deinitCurrentScanner(); //SimulScanReaderInfo readerInfo1 = (SimulScanReaderInfo)readerInfoList[readerIndex]; //selectedSimulScanReader = simulscanManager.GetDevice(readerInfo1); selectedSimulScanReader = simulscanManager.GetDevice(readerInfoList[readerIndex]); initCurrentScanner(); } catch (SimulScanException e) { Log.Error(TAG, "Error enabling reader: " + e.Message); e.PrintStackTrace(); textViewStatus.Text = "Status: " + "Error enabling reader"; } } } }