Beispiel #1
0
        void InitScanner()
        {
            if (m_EmdkManager != null)
            {
                if (m_BarcodeManager == null)
                {
                    try
                    {
                        m_BarcodeManager = (BarcodeManager)m_EmdkManager.GetInstance(EMDKManager.FEATURE_TYPE.Barcode);
                        m_Scanner        = m_BarcodeManager.GetDevice(BarcodeManager.DeviceIdentifier.Default);

                        if (m_Scanner != null)
                        {
                            m_Scanner.Data   -= DataReceived;
                            m_Scanner.Data   += DataReceived;
                            m_Scanner.Status -= StatusChanged;
                            m_Scanner.Status += StatusChanged;
                        }
                        else
                        {
                            OnStatusChanged?.Invoke(this, new EMDKStatusChangedArgs("Failed to enable scanner."));
                        }
                    }
                    catch (ScannerException e)
                    {
                        OnStatusChanged?.Invoke(this, new EMDKStatusChangedArgs($"Error: {e.Message}"));
                    }
                    catch (Exception ex)
                    {
                        OnStatusChanged?.Invoke(this, new EMDKStatusChangedArgs($"Error: {ex.Message}"));
                    }
                }
            }
        }
        public void OnOpened(EMDKManager emdkManagerInstance)
        {
            // This callback will be issued when the EMDK is ready to use.
            textViewStatus.Text = "Status: EMDK open success.";

            this.emdkManager = emdkManagerInstance;

            try
            {
                // Acquire the barcode manager resources
                barcodeManager = (BarcodeManager)emdkManager.GetInstance(EMDKManager.FEATURE_TYPE.Barcode);

                if (barcodeManager != null)
                {
                    // Add connection listener
                    barcodeManager.Connection += barcodeManager_Connection;
                }

                // Enumerate scanner devices
                EnumerateScanners();

                // Set default scanner
                spinnerScannerDevices.SetSelection(defaultIndex);

                // Set trigger (App default - HARD)
                spinnerTriggers.SetSelection(triggerIndex);
            }
            catch (System.Exception e)
            {
                textViewStatus.Text = "Status: BarcodeManager object creation failed.";
                Console.WriteLine("Exception:" + e.StackTrace);
            }
        }
Beispiel #3
0
        public void OnOpened(EMDKManager emdkManagerInstance)
        {
            // This callback will be issued when the EMDK is ready to use.
            textViewStatus.Text = "Status: EMDK open success.";

            this.emdkManager = emdkManagerInstance;

            try
            {
                // Acquire the barcode manager resources
                barcodeManager = (BarcodeManager)emdkManager.GetInstance(EMDKManager.FEATURE_TYPE.Barcode);

                if (barcodeManager != null)
                {
                    // Add connection listener
                    barcodeManager.Connection += barcodeManager_Connection;
                }

                // Enumerate scanner devices
                enumerateScanners();

                // Set default scanner
                spinnerScanners.SetSelection(defaultIndex);

                // Set trigger (App default - HARD)
                spinnerTriggers.SetSelection(triggerIndex);
            }
            catch (Exception e)
            {
                textViewStatus.Text = "Status: BarcodeManager object creation failed.";
                Console.WriteLine("Exception:" + e.StackTrace);
            }
        }
        public void OnOpened(EMDKManager emdkManager)
        {
            mEmdkManager = emdkManager;
            String strStatus = "";

            String[] modifyData = new String[1];

            mProfileManager = (ProfileManager)mEmdkManager.GetInstance(EMDKManager.FEATURE_TYPE.Profile);

            EMDKResults results = mProfileManager.ProcessProfile(mProfileName, ProfileManager.PROFILE_FLAG.Set, modifyData);

            if (results.StatusCode == EMDKResults.STATUS_CODE.Success)
            {
                strStatus = "Profile processed succesfully";
            }
            else if (results.StatusCode == EMDKResults.STATUS_CODE.CheckXml)
            {
                //Inspect the XML response to see if there are any errors, if not report success
                using (XmlReader reader = XmlReader.Create(new StringReader(results.StatusString)))
                {
                    String checkXmlStatus = "Status:\n\n";
                    while (reader.Read())
                    {
                        switch (reader.NodeType)
                        {
                        case XmlNodeType.Element:
                            switch (reader.Name)
                            {
                            case "parm-error":
                                checkXmlStatus += "Parm Error:\n";
                                checkXmlStatus += reader.GetAttribute("name") + " - ";
                                checkXmlStatus += reader.GetAttribute("desc") + "\n\n";
                                break;

                            case "characteristic-error":
                                checkXmlStatus += "characteristic Error:\n";
                                checkXmlStatus += reader.GetAttribute("type") + " - ";
                                checkXmlStatus += reader.GetAttribute("desc") + "\n\n";
                                break;
                            }
                            break;
                        }
                    }
                    if (checkXmlStatus == "Status:\n\n")
                    {
                        strStatus = "Status: Profile applied successfully ...";
                    }
                    else
                    {
                        strStatus = checkXmlStatus;
                    }
                }
            }
            else
            {
                strStatus = "Something wrong on processing the profile";
            }

            Toast.MakeText(this, strStatus, ToastLength.Long).Show();
        }
        public void InitializeScanner()
        {
            if (scanner == null && EmdkManager != null)
            {
                try
                {
                    barcodeManager = (BarcodeManager)EmdkManager.GetInstance(EMDKManager.FEATURE_TYPE.Barcode);
                    scanner        = barcodeManager?.GetDevice(BarcodeManager.DeviceIdentifier.Default);
                }
                catch (Exception ex)
                {
                    scanner = null;
                    Log.Debug(TAG, "Scanner Initialize Exception", ex);
                }
            }

            if (scanner != null && !scannerEventsWired)
            {
                try
                {
                    scanner.Status += Scanner_Status;
                    scanner.Data   += Scanner_Data;
                    scanner.Enable();
                    scannerEventsWired = true;
                    Log.Debug(TAG, "Scanner events are wired successfully.");
                }
                catch (Exception ex)
                {
                    Log.Debug(TAG, "Scanner Initialize Exception", ex);
                }
            }
        }
Beispiel #6
0
    public override void OnResume()
    {
        Log.Debug(TAG, "SSC onResume");
        base.OnResume();
        // The application is in foreground

        // Acquire the SimulScan manager resources
        if (emdkManager != null)
        {
            simulscanManager = (SimulScanManager)emdkManager
                               .GetInstance(Symbol.XamarinEMDK.EMDKManager.FEATURE_TYPE.Simulscan);

            // Initialize scanner
            try {
                if (simulscanManager != null)
                {
                    prepareScanner(spinner2.SelectedItemPosition);
                }
                else
                {
                    Log.Debug(TAG, "SSC onResume simulscanManager is null");
                }
            } catch (SimulScanException e) {
                // TODO Auto-generated catch block
                e.PrintStackTrace();
            }
        }
    }
        public void OnOpened(EMDKManager emdkManager)
        {
            mEmdkManager = emdkManager;
            String strStatus = "";
            String[] modifyData = new String[1];

            mProfileManager = (ProfileManager)mEmdkManager.GetInstance(EMDKManager.FEATURE_TYPE.Profile);

            EMDKResults results = mProfileManager.ProcessProfile(mProfileName, ProfileManager.PROFILE_FLAG.Set, modifyData);

            if (results.StatusCode == EMDKResults.STATUS_CODE.Success)
            {
                strStatus = "Profile processed succesfully";
            }
            else if (results.StatusCode == EMDKResults.STATUS_CODE.CheckXml)
            {
                //Inspect the XML response to see if there are any errors, if not report success
                using (XmlReader reader = XmlReader.Create(new StringReader(results.StatusString)))
                {
                    String checkXmlStatus = "Status:\n\n";
                    while (reader.Read())
                    {
                        switch (reader.NodeType)
                        {
                            case XmlNodeType.Element:
                                switch (reader.Name)
                                {
                                    case "parm-error":
                                        checkXmlStatus += "Parm Error:\n";
                                        checkXmlStatus += reader.GetAttribute("name") + " - ";
                                        checkXmlStatus += reader.GetAttribute("desc") + "\n\n";
                                        break;
                                    case "characteristic-error":
                                        checkXmlStatus += "characteristic Error:\n";
                                        checkXmlStatus += reader.GetAttribute("type") + " - ";
                                        checkXmlStatus += reader.GetAttribute("desc") + "\n\n";
                                        break;
                                }
                                break;
                        }
                    }
                    if (checkXmlStatus == "Status:\n\n")
                    {
                        strStatus = "Status: Profile applied successfully ...";
                    }
                    else
                    {
                        strStatus = checkXmlStatus;
                    }

                }
            }
            else
            {
                strStatus = "Something wrong on processing the profile";
            }

            Toast.MakeText(this, strStatus, ToastLength.Long).Show();
        }
 void initSAMManager()
 {
     if (emdkManager != null)
     {
         //Get the SAMManager object to process the profiles
         samManager = (SAMManager)emdkManager.GetInstance(EMDKManager.FEATURE_TYPE.Sam);
     }
 }
Beispiel #9
0
        protected override void OnResume()
        {
            base.OnResume();



            #region Ring Scanner On Resume
            if (emdkManager != null)
            {
                try
                {
                    barcodeManager = (BarcodeManager)emdkManager.GetInstance(EMDKManager.FEATURE_TYPE.Barcode);
                }
                catch (Exception e)
                {
                    //TODO:   log here
                    Console.WriteLine("Exception: " + e.StackTrace);
                }
                #endregion
            }
        }
Beispiel #10
0
        void InitializeBarcodeManager()
        {
            _barcodeManager = (BarcodeManager)_emdkManager?.GetInstance(EMDKManager.FEATURE_TYPE.Barcode);
            if (_barcodeManager == null)
            {
                return;
            }

            if (_barcodeManager.SupportedDevicesInfo?.Count > 0)
            {
                _scanner = _barcodeManager.GetDevice(BarcodeManager.DeviceIdentifier.Default);
            }
        }
        protected override void OnResume()
        {
            base.OnResume();
            // Acquire the serialComm manager resources
            if (emdkManager != null)
            {
                serialCommManager = (SerialCommMgrEX)emdkManager.GetInstance(EMDKManager.FEATURE_TYPE.SerialcommEx);

                if (serialCommManager != null)
                {
                    populatePorts();
                    initSerialComm();
                }
            }
        }
Beispiel #12
0
        void InitScanner()
        {
            if (emdkManager != null)
            {
                if (barcodeManager == null)
                {
                    try
                    {
                        //Get the feature object such as BarcodeManager object for accessing the feature.
                        barcodeManager = (BarcodeManager)emdkManager.GetInstance(EMDKManager.FEATURE_TYPE.Barcode);

                        scanner = barcodeManager.GetDevice(BarcodeManager.DeviceIdentifier.Default);

                        if (scanner != null)
                        {
                            //Attahch the Data Event handler to get the data callbacks.
                            scanner.Data += scanner_Data;

                            //Attach Scanner Status Event to get the status callbacks.
                            scanner.Status += scanner_Status;

                            scanner.Enable();

                            //EMDK: Configure the scanner settings
                            ScannerConfig config = scanner.GetConfig();
                            config.SkipOnUnsupported            = ScannerConfig.SkipOnUnSupported.None;
                            config.ScanParams.DecodeLEDFeedback = true;
                            config.ReaderParams.ReaderSpecific.ImagerSpecific.PickList = ScannerConfig.PickList.Enabled;
                            config.DecoderParams.Code39.Enabled  = true;
                            config.DecoderParams.Code128.Enabled = false;
                            scanner.SetConfig(config);
                        }
                        else
                        {
                            displayStatus("Failed to enable scanner.\n");
                        }
                    }
                    catch (ScannerException e)
                    {
                        displayStatus("Error: " + e.Message);
                    }
                    catch (Exception ex)
                    {
                        displayStatus("Error: " + ex.Message);
                    }
                }
            }
        }
Beispiel #13
0
        public void OnOpened(EMDKManager emdkManagerInstance)
        {
            this.emdkManager = emdkManagerInstance;

            try
            {
                // Acquire the barcode manager resources
                barcodeManager = (BarcodeManager)emdkManager.GetInstance(EMDKManager.FEATURE_TYPE.Barcode);

                InitScanner();
            }
            catch (Exception e)
            {
                //TODO Log here
                Console.WriteLine("Exception:" + e.StackTrace);
            }
        }
Beispiel #14
0
        public void OnOpened(EMDKManager emdkManagerInstance)
        {
            this.emdkManager = emdkManagerInstance;

            try
            {
                // Get the ProfileManager object to process the profiles
                profileManager = (ProfileManager)emdkManager.GetInstance(EMDKManager.FEATURE_TYPE.Profile);

                // Add listener to get async results
                profileManager.Data += profileManager_Data;
            }
            catch (Exception e)
            {
                output("Error loading profile manager.");
                Console.WriteLine("Exception: " + e.StackTrace);
            }
        }
Beispiel #15
0
        protected override void OnResume()
        {
            base.OnResume();
            // The application is in foreground

            // Restore continuous mode flag
            isContinuousMode = isContinuousModeSaved;

            // Acquire the barcode manager resources
            if (emdkManager != null)
            {
                try
                {
                    barcodeManager = (BarcodeManager)emdkManager.GetInstance(EMDKManager.FEATURE_TYPE.Barcode);

                    if (barcodeManager != null)
                    {
                        // Add connection listener
                        barcodeManager.Connection += barcodeManager_Connection;
                    }

                    // Enumerate scanners
                    EnumerateScanners();

                    // Set selected scanner
                    spinnerScanners.SetSelection(scannerIndex);

                    // Set selected trigger
                    spinnerTriggers.SetSelection(triggerIndex);
                    if (horizontal)
                    {
                        buttonStartScan.SetWidth(120);
                        buttonStartScan.SetTextKeepState("Start", TextView.BufferType.Editable);
                        buttonStopScan.SetWidth(120);
                        buttonStopScan.SetTextKeepState("Stop", TextView.BufferType.Editable);
                    }
                }
                catch (Exception e)
                {
                    textViewStatus.Text = "Status: BarcodeManager object creation failed.";
                    Console.WriteLine("Exception: " + e.StackTrace);
                }
            }
        }
Beispiel #16
0
        public void OnOpened(EMDKManager emdkManagerInstance)
        {
            // This callback will be issued when the EMDK is ready to use.
            statusTextView.Text = "EMDK open success.";

            this.emdkManager = emdkManagerInstance;

            try
            {
                // Get the ProfileManager object to process the profiles
                profileManager = (ProfileManager)emdkManager.GetInstance(EMDKManager.FEATURE_TYPE.Profile);

                new ProcessProfileSetXMLTask().Execute(this);
            }
            catch (Exception e)
            {
                statusTextView.Text = "Error setting the profile.";
                Console.WriteLine("Exception:" + e.StackTrace);
            }
        }
Beispiel #17
0
        public void OnOpened(EMDKManager emdkManagerInstance)
        {
            // This callback will be issued when the EMDK is ready to use.
            statusTextView.Text = "EMDK open success.";

            this.emdkManager = emdkManagerInstance;

            try
            {
                // Get the ProfileManager object to process the profiles
                profileManager = (ProfileManager)emdkManager.GetInstance(EMDKManager.FEATURE_TYPE.Profile);

                new ProcessProfileSetXMLTask().Execute(this);
            }
            catch (Exception e)
            {
                statusTextView.Text = "Error setting the profile.";
                Console.WriteLine("Exception:" + e.StackTrace);
            }
        }
Beispiel #18
0
        public void OnOpened(EMDKManager emdkManager)
        {
            mEmdkManager = emdkManager;

            if (null == mScanner)
            {
                // Get Barcode Manager
                mBarcodeManager = (BarcodeManager)mEmdkManager.GetInstance(EMDKManager.FEATURE_TYPE.Barcode);
                if (null == mBarcodeManager)
                {
                    mStatusTextView.Text = "Impossible to get BarcodeManager handle";
                    return;
                }
                mScanner = mBarcodeManager.GetDevice(BarcodeManager.DeviceIdentifier.InternalImager1);

                if (null == mScanner)
                {
                    mStatusTextView.Text = "Impossible to get Scanner handle";
                    return;
                }

                try
                {
                    mScanner.AddDataListener(this);
                    mScanner.AddStatusListener(this);

                    mScanner.TriggerType = Scanner.TriggerTypes.Hard;

                    mScanner.Enable();

                    mScanner.Read(); // Start an Async scann
                }
                catch (ScannerException e)
                {
                    e.PrintStackTrace();
                }

                Toast.MakeText(this, "Press Hard Scan Button to start scanning...", ToastLength.Long).Show();
            }
        }
Beispiel #19
0
        public void OnOpened(EMDKManager emdkManager)
        {
            mEmdkManager = emdkManager;

            if (null == mScanner)
            {
                // Get Barcode Manager
                mBarcodeManager = (BarcodeManager)mEmdkManager.GetInstance(EMDKManager.FEATURE_TYPE.Barcode);
                if (null == mBarcodeManager)
                {
                    mStatusTextView.Text = "Impossible to get BarcodeManager handle";
                    return;
                }
                mScanner = mBarcodeManager.GetDevice(BarcodeManager.DeviceIdentifier.InternalImager1);

                if (null == mScanner)
                {
                    mStatusTextView.Text = "Impossible to get Scanner handle";
                    return;
                }

                try
                {
                    mScanner.AddDataListener(this);
                    mScanner.AddStatusListener(this);

                    mScanner.TriggerType = Scanner.TriggerTypes.Hard;

                    mScanner.Enable();

                    mScanner.Read(); // Start an Async scann
                }
                catch (ScannerException e)
                {
                    e.PrintStackTrace();
                }

                Toast.MakeText(this, "Press Hard Scan Button to start scanning...", ToastLength.Long).Show();
            }
        }
        public void OnOpened(EMDKManager emdkManagerInstance)
        {
            emdkManager = emdkManagerInstance;

            try
            {
                barcodeManager = (BarcodeManager)emdkManager.GetInstance(EMDKManager.FEATURE_TYPE.Barcode);

                if (barcodeManager != null)
                {
                    barcodeManager.Connection += BarcodeManager_Connection;
                }

                var scannerlist = barcodeManager.SupportedDevicesInfo;
                foreach (var item in scannerlist)
                {
                    Console.WriteLine(item.FriendlyName);
                    Console.WriteLine(item.Class);
                    Console.WriteLine(item.DeviceIdentifier);
                }
                scanner             = barcodeManager.GetDevice(scannerlist.Where(d => d.FriendlyName.Contains("2D Barcode")).Single());
                scanner.Data       += Scanner_Data;
                scanner.Status     += Scanner_Status;
                scanner.TriggerType = Scanner.TriggerTypes.Hard;

                try
                {
                    scanner.Enable();
                }
                catch (ScannerException ex)
                {
                    Console.WriteLine(ex.StackTrace);
                    //throw;
                }
            }
            catch (System.Exception ex)
            {
                Console.WriteLine("PedidoActivity -> OnOpened", ex.Message);
            }
        }
Beispiel #21
0
        public void InitScanner()
        {
            try
            {
                if (_emdkManager == null)
                {
                    return;
                }

                if (_barcodeManager == null)
                {
                    _barcodeManager = (BarcodeManager)_emdkManager.GetInstance(EMDKManager.FEATURE_TYPE.Barcode);
                    _scanner        = _barcodeManager.GetDevice(BarcodeManager.DeviceIdentifier.Default);

                    if (_scanner == null)
                    {
                        return;
                    }

                    _scanner.Data   += _scanner_Data;
                    _scanner.Status += _scanner_Status;

                    _scanner.Enable();

                    //set the configuration
                    ScannerConfig scannerConfig = _scanner.GetConfig();
                    scannerConfig.SkipOnUnsupported             = ScannerConfig.SkipOnUnSupported.None;
                    scannerConfig.ScanParams.DecodeLEDFeedback  = true;
                    scannerConfig.DecoderParams.Code11.Enabled  = true;
                    scannerConfig.DecoderParams.Code39.Enabled  = true;
                    scannerConfig.DecoderParams.Code93.Enabled  = true;
                    scannerConfig.DecoderParams.Code128.Enabled = true;
                    _scanner.SetConfig(scannerConfig);
                }
            }
            catch (Exception ex)
            {
            }
        }
Beispiel #22
0
 private void InitScanner()
 {
     try
     {
         if (_emdkManager != null)
         {
             if (_barcodeManager == null)
             {
                 try
                 {
                     _barcodeManager = (BarcodeManager)_emdkManager.GetInstance(EMDKManager.FEATURE_TYPE.Barcode);
                     _scanner        = _barcodeManager.GetDevice(BarcodeManager.DeviceIdentifier.Default);
                     if (_scanner != null)
                     {
                         _scanner.Data   += Scanner_Data;
                         _scanner.Status += Scanner_Status;
                         _scanner.Enable();
                         SetScannerConfig();
                     }
                     else
                     {
                     }
                 }
                 catch (ScannerException e)
                 {
                 }
                 catch (Exception ex)
                 {
                 }
             }
         }
     }
     catch (Exception ex)
     {
         ErrorMessage("MainActivity - InitScanner:" + ex.Message);
     }
 }
        void EMDKManager.IEMDKListener.OnOpened(EMDKManager emdkManager)
        {
            mEmdkManager    = emdkManager;
            mProfileManager = (ProfileManager)mEmdkManager.GetInstance(EMDKManager.FEATURE_TYPE.Profile);
            if (mProfileManager != null)
            {
                EMDKResults result = mProfileManager.ProcessProfile("GrantSerialId", ProfileManager.PROFILE_FLAG.Set,
                                                                    generateProfileXml("GrantSerialId", SERIAL_URI));

                EMDKResults result2 = mProfileManager.ProcessProfile("GrantIMEIId", ProfileManager.PROFILE_FLAG.Set,
                                                                     generateProfileXml("GrantIMEIId", IMEI_URI));

                EMDKResults result3 = mProfileManager.ProcessProfile("GrantBTMac", ProfileManager.PROFILE_FLAG.Set,
                                                                     generateProfileXml("GrantBTMac", BT_MAC_URI));

                if ((result.StatusCode.Equals(EMDKResults.STATUS_CODE.CheckXml) || result.StatusCode.Equals(EMDKResults.STATUS_CODE.Success)) &&
                    (result2.StatusCode.Equals(EMDKResults.STATUS_CODE.CheckXml) || result2.StatusCode.Equals(EMDKResults.STATUS_CODE.Success)) &&
                    (result3.StatusCode.Equals(EMDKResults.STATUS_CODE.CheckXml) || result3.StatusCode.Equals(EMDKResults.STATUS_CODE.Success)))
                {
                    Log.Info(LOG_TAG, "EMDK Profiles successfully applied");
                    Toast.MakeText(this, "EMDK Profiles successfully applied", ToastLength.Long).Show();
                }
                else
                {
                    Log.Error(LOG_TAG, "EMDK Profiles could not be applied");
                    Toast.MakeText(this, "EMDK Profiles could not be applied", ToastLength.Long).Show();
                }

                mEmdkManager.Release();
                mEmdkManager = null;
            }
            else
            {
                Log.Error(LOG_TAG, "Unable to create Profile Manager");
                Toast.MakeText(this, "Unable to create Profile Manager", ToastLength.Short).Show();
            }
        }
Beispiel #24
0
        protected override void OnResume()
        {
            base.OnResume();
            // The application is in foreground

            // Set continuous flag
            isContinuousMode = checkBoxContinuous.Checked;

            // Acquire the barcode manager resources
            if (emdkManager != null)
            {
                try
                {
                    barcodeManager = (BarcodeManager)emdkManager.GetInstance(EMDKManager.FEATURE_TYPE.Barcode);

                    if (barcodeManager != null)
                    {
                        // Add connection listener
                        barcodeManager.Connection += barcodeManager_Connection;
                    }

                    // Enumerate scanners
                    enumerateScanners();

                    // Set selected scanner
                    spinnerScanners.SetSelection(scannerIndex);

                    // Set selected trigger
                    spinnerTriggers.SetSelection(triggerIndex);
                }
                catch (Exception e)
                {
                    textViewStatus.Text = "Status: BarcodeManager object creation failed.";
                    Console.WriteLine("Exception: " + e.StackTrace);
                }
            }
        }
Beispiel #25
0
        public void OnOpened(EMDKManager emdkManagerInstance)
        {
            // This callback will be issued when the EMDK is ready to use.
            statusTextView.Text = "EMDK open success.";

            this.emdkManager = emdkManagerInstance;

            try
            {
                // Get the ProfileManager object to process the profiles
                profileManager = (ProfileManager)emdkManager.GetInstance(EMDKManager.FEATURE_TYPE.Profile);

                // Add listener to get async results
                profileManager.Data += profileManager_Data;

                // Set profile at the start
                SetProfile();
            }
            catch (Exception e)
            {
                statusTextView.Text = "Error setting the profile.";
                Console.WriteLine("Exception:" + e.StackTrace);
            }
        }
Beispiel #26
0
 public void OnOpened(EMDKManager p0)
 {
     _emdkManager    = p0;
     _barcodeManager = (BarcodeManager)_emdkManager.GetInstance(EMDKManager.FEATURE_TYPE.Barcode);
 }
Beispiel #27
0
        private void ScanAndPairButton_Click(object sender, EventArgs e)
        {
            try
            {
                statusView.SetText("ScanAndPair started..." + "\n", TextView.BufferType.Normal);

                if (scanAndPairMgr == null)
                {
                    scanAndPairMgr = (ScanAndPairManager)emdkManager.GetInstance(Symbol.XamarinEMDK.EMDKManager.FEATURE_TYPE.Scanandpair);


                    if (scanAndPairMgr != null)
                    {
                        scanAndPairMgr.StatusEvent += scanAndPairMgr_StatusEvent;


                        //    scanAndPairMgr.addStatusListener(statusCallbackObj);
                    }
                }

                if (scanAndPairMgr != null)
                {
                    scanAndPairMgr.Config.AlwaysScan       = (Java.Lang.Boolean)checkBoxAlwaysScan.Checked;
                    scanAndPairMgr.Config.NotificationType = Symbol.XamarinEMDK.ScanAndPair.ScanAndPairConfig.NotificationTypes.Beeper;
                    if (!checkBoxAlwaysScan.Checked)
                    {
                        scanAndPairMgr.Config.BluetoothInfo.MacAddress = btAddress.Text.ToString().Trim();
                        scanAndPairMgr.Config.BluetoothInfo.DeviceName = btName.Text.ToString().Trim();
                    }
                    else
                    {
                        scanAndPairMgr.Config.ScanInfo.ScanTimeout = 5000;
                        if (checkboxHardTrigger.Checked)
                        {
                            scanAndPairMgr.Config.ScanInfo.TriggerType = Symbol.XamarinEMDK.ScanAndPair.ScanAndPairConfig.TriggerType.Hard;
                        }
                        else
                        {
                            scanAndPairMgr.Config.ScanInfo.TriggerType = Symbol.XamarinEMDK.ScanAndPair.ScanAndPairConfig.TriggerType.Soft;
                        }

                        scanAndPairMgr.Config.ScanInfo.ScanDataType = (Symbol.XamarinEMDK.ScanAndPair.ScanAndPairConfig.ScanDataType)scandataType.SelectedItem;
                    }


                    ScanAndPairResults resultCode = scanAndPairMgr.ScanAndPair("0000");

                    if (!resultCode.Equals(ScanAndPairResults.Success))
                    {
                        statusView.Append(resultCode.ToString() + "\n\n");
                    }
                }
                else
                {
                    statusView.Append("ScanAndPairmanager intialization failed!");
                }
            }
            catch (Java.Lang.Exception ex)
            {
                statusView.SetText("ScanAndUnpair Error:" + ex.Message + "\n", TextView.BufferType.Normal);
            }
        }