protected override void OnCreate(Bundle savedInstanceState)
        {
            TabLayoutResource = Resource.Layout.Tabbar;
            ToolbarResource   = Resource.Layout.Toolbar;

            base.OnCreate(savedInstanceState);

            EMDKResults results = EMDKManager.GetEMDKManager(Android.App.Application.Context, this);

            if (results.StatusCode != EMDKResults.STATUS_CODE.Success)
            {
                ScannerStatus = "Status: EMDKManager object creation failed ...";
            }
            else
            {
                ScannerStatus = "Status: EMDKManager object creation succeeded ...";
            }


            Xamarin.Essentials.Platform.Init(this, savedInstanceState);
            global::Xamarin.Forms.Forms.Init(this, savedInstanceState);

            app = new App();
            LoadApplication(app);
        }
示例#2
0
        public override void OnViewCreated(View view, Bundle savedInstanceState)
        {
            base.OnViewCreated(view, savedInstanceState);

            menuRed = view.FindViewById <FloatingActionMenu> (Resource.Id.menu_red);

            fab1 = view.FindViewById <FloatingActionButton> (Resource.Id.fab1);
            fab2 = view.FindViewById <FloatingActionButton> (Resource.Id.fab2);
            fab3 = view.FindViewById <FloatingActionButton> (Resource.Id.fab3);

            statusView = view.FindViewById <TextView>(Resource.Id.statusView);
            dataView   = view.FindViewById <TextView>(Resource.Id.DataView);


            ContextThemeWrapper  context     = new ContextThemeWrapper(this.Activity, Resource.Style.MenuButtonsStyle);
            FloatingActionButton programFab2 = new FloatingActionButton(context);

            EMDKResults results = EMDKManager.GetEMDKManager(Application.Context, this);

            if (results.StatusCode != EMDKResults.STATUS_CODE.Success)
            {
                statusView.Text = "Status: EMDKManager object creation failed ...";
            }
            else
            {
                statusView.Text = "Status: EMDKManager object creation succeeded ...";
            }
            programFab2.LabelText = "Programmatically added button";
            programFab2.SetImageResource(Resource.Drawable.ic_edit);
            fab1.Enabled = false;
            menuRed.SetOnMenuButtonClickListener(this);
            menuRed.SetClosedOnTouchOutside(true);
            menuRed.HideMenuButton(false);
            ;
        }
示例#3
0
 public override void OnCreate(Bundle savedInstanceState)
 {
     base.OnCreate(savedInstanceState);
     Log.Debug(TAG, "SSC onCreate");
     // getActivity().setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
     results = EMDKManager.GetEMDKManager(Activity.ApplicationContext, this);
 }
示例#4
0
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);

            EMDKResults result = EMDKManager.GetEMDKManager(Application.Context, this);

            if (result.StatusCode != EMDKResults.STATUS_CODE.Success)
            {
                Toast.MakeText(this, "Error opening the EMDK Manager", ToastLength.Long).Show();
            }
            else
            {
                Toast.MakeText(this, "EMDK Manager is available", ToastLength.Long).Show();
            }


            ScanReceiver _broadcastReceiver = new ScanReceiver();

            global::Xamarin.Forms.Forms.Init(this, bundle);
            var my_application = new App();

            _broadcastReceiver.scanDataReceived += (s, scanData) =>
            {
                MessagingCenter.Send <App, string> (my_application, "ScanBarcode", scanData);
            };

            // Register the broadcast receiver
            IntentFilter filter = new IntentFilter(ScanReceiver.IntentAction);

            filter.AddCategory(ScanReceiver.IntentCategory);
            Android.App.Application.Context.RegisterReceiver(_broadcastReceiver, filter);

            LoadApplication(my_application);
        }
示例#5
0
        private void SetProfile()
        {
            statusTextView.Text = "";

            string[] modifyData = new string[1];

            if (pwrRadioSuspend.Checked)
            {
                // Prepare name-value pairs to modify the existing profile
                modifyData[0] = ProfileManager.CreateNameValuePair(featureName, "ResetAction", "1");
            }
            else
            {
                modifyData[0] = ProfileManager.CreateNameValuePair(featureName, "ResetAction", "4");
            }

            // Call processPrfoileAsync with profile name, 'Set' flag and modify data to update the profile
            EMDKResults results = profileManager.ProcessProfileAsync(profileName, ProfileManager.PROFILE_FLAG.Set, modifyData);

            // Check the return status of processProfileAsync
            string resultString = results.StatusCode == EMDKResults.STATUS_CODE.Processing ? "Set profile in-progress..." : "Set profile failed.";

            if (statusTextView != null)
            {
                statusTextView.Text = resultString;
            }
        }
示例#6
0
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);

            // Set our view from the "main" layout resource
            SetContentView(Resource.Layout.Main);

            statusTextView  = FindViewById <TextView>(Resource.Id.textViewStatus) as  TextView;
            checkBoxCode128 = FindViewById <CheckBox>(Resource.Id.checkBoxCode128);
            checkBoxCode39  = FindViewById <CheckBox>(Resource.Id.checkBoxCode39);
            checkBoxEAN8    = FindViewById <CheckBox>(Resource.Id.checkBoxEAN8);
            checkBoxEAN13   = FindViewById <CheckBox>(Resource.Id.checkBoxEAN13);
            checkBoxUPCA    = FindViewById <CheckBox>(Resource.Id.checkBoxUPCE);
            checkBoxUPCE0   = FindViewById <CheckBox>(Resource.Id.checkBoxUPCE0);

            // Set listener to the button
            AddSetButtonListener();

            // The EMDKManager object will be created and returned in the callback
            EMDKResults results = EMDKManager.GetEMDKManager(Android.App.Application.Context, this);

            // Check the return status of processProfile
            if (results.StatusCode != EMDKResults.STATUS_CODE.Success)
            {
                // EMDKManager object initialization success
                statusTextView.Text = "EMDKManager object creation failed ...";
            }
            else
            {
                // EMDKManager object initialization failed
                statusTextView.Text = "EMDKManager object creation succeeded ...";
            }
        }
示例#7
0
        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();
        }
示例#8
0
        private void SetProfile()
        {
            statusTextView.Text = "";

            string[] modifyData = new string[6];

            // Prepare name-value pairs to modify the existing profile
            modifyData[0] = ProfileManager.CreateNameValuePair(featureName, "decoder_code128", checkBoxCode128.Checked.ToString().ToLower());
            modifyData[1] = ProfileManager.CreateNameValuePair(featureName, "decoder_code39", checkBoxCode39.Checked.ToString().ToLower());
            modifyData[2] = ProfileManager.CreateNameValuePair(featureName, "decoder_ean8", checkBoxEAN8.Checked.ToString().ToLower());
            modifyData[3] = ProfileManager.CreateNameValuePair(featureName, "decoder_ean13", checkBoxEAN13.Checked.ToString().ToLower());
            modifyData[4] = ProfileManager.CreateNameValuePair(featureName, "decoder_upca", checkBoxUPCA.Checked.ToString().ToLower());
            modifyData[5] = ProfileManager.CreateNameValuePair(featureName, "decoder_upce0", checkBoxUPCE0.Checked.ToString().ToLower());

            // Call processPrfoileAsync with profile name, 'Set' flag and modify data to update the profile
            EMDKResults results = profileManager.ProcessProfileAsync(profileName, ProfileManager.PROFILE_FLAG.Set, modifyData);

            // Check the return status of processProfileAsync
            string resultString = results.StatusCode == EMDKResults.STATUS_CODE.Processing ? "Set profile in-progress..." : "Set profile failed.";

            if (statusTextView != null)
            {
                statusTextView.Text = resultString;
            }
        }
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);
            // Set our view from the "main" layout resource
            SetContentView(Resource.Layout.Main);
            textViewStatus = FindViewById <TextView>(Resource.Id.PStextView);

            EMDKResults results = EMDKManager.GetEMDKManager(ApplicationContext, this);

            if (results.StatusCode != EMDKResults.STATUS_CODE.Success)
            {
                textViewStatus.Text = string.Empty;
                textViewStatus.SetText("Status: " + "Failed in getEMDKManager::" + results.StatusCode, TextView.BufferType.Normal);
            }
            else
            {
                textViewStatus.Text = string.Empty;
                textViewStatus.SetText("Status: " + "getEMDKManager Success", TextView.BufferType.Normal);
            }

            addCrdInfoButtonListener();
            addbtnUnlockButtonListener();
            addFlashLedsButtonListener();
            addFCCheckboxListener();
            addDiagnosticButtonListener();
        }
示例#10
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            TabLayoutResource = Resource.Layout.Tabbar;
            ToolbarResource   = Resource.Layout.Toolbar;

            base.OnCreate(savedInstanceState);

            EMDKResults result = EMDKManager.GetEMDKManager(Android.App.Application.Context, this);

            if (result.StatusCode != EMDKResults.STATUS_CODE.Success)
            {
                Toast.MakeText(this, "Error opening the EMDK Manager", ToastLength.Long).Show();
            }
            else
            {
                Toast.MakeText(this, "EMDK Manager is available", ToastLength.Long).Show();
            }

            _broadcastReceiver = new ScanReceiver();

            Xamarin.Essentials.Platform.Init(this, savedInstanceState);
            global::Xamarin.Forms.Forms.Init(this, savedInstanceState);

            var my_application = new App();

            _broadcastReceiver.scanDataReceived += (s, scanData) =>
            {
                MessagingCenter.Send <App, string>(my_application, "ScanBarcode", scanData);
            };



            LoadApplication(my_application);
        }
示例#11
0
        private void initializeEMDK()
        {
            if (mEMDKManager == null)
            {
                EMDKResults results = null;
                try
                {
                    //The EMDKManager object will be created and returned in the callback.
                    results = EMDKManager.GetEMDKManager(mContext.ApplicationContext, mEMDKListener);
                }
                catch (Exception e)
                {
                    logMessage("Error while requesting EMDKManager.\n" + e.Message, EMessageType.ERROR);
                    return;
                }

                //Check the return status of EMDKManager object creation.
                if (results.StatusCode == EMDKResults.STATUS_CODE.Success)
                {
                    logMessage("EMDKManager request command issued with success", EMessageType.DEBUG);
                }
                else
                {
                    logMessage("EMDKManager request command error", EMessageType.ERROR);
                }
            }
            else
            {
                onEMDKManagerRetrieved(mEMDKManager);
            }
        }
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);
            // Set our view from the "main" layout resource

            SetContentView(Symbol.XamarinEMDK.SerialCommSample1.Resource.Layout.Main);
            editText = FindViewById <EditText>(Symbol.XamarinEMDK.SerialCommSample1.Resource.Id.editText1);
            editText.SetText("Serial Communication Write Data Testing.", EditText.BufferType.Normal);

            statusView = FindViewById <TextView>(Symbol.XamarinEMDK.SerialCommSample1.Resource.Id.statusView);
            statusView.SetText("", TextView.BufferType.Normal);
            statusView.RequestFocus();

            EMDKResults results = EMDKManager.GetEMDKManager(ApplicationContext, this);

            if (results.StatusCode != EMDKResults.STATUS_CODE.Success)
            {
                statusView.SetText("Failed to open EMDK", TextView.BufferType.Normal);
            }
            else
            {
                statusView.SetText("Opening EMDK...", TextView.BufferType.Normal);
            }

            addReadButtonEvents();
            writeButtonEvents();
            setEnabled(false);
            Activity = this;
        }
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);

            // Set our view from the "main" layout resource
            SetContentView(Resource.Layout.Main);

            textViewData   = FindViewById <TextView>(Resource.Id.textViewData) as TextView;
            textViewStatus = FindViewById <TextView>(Resource.Id.textViewStatus) as TextView;

            AddStartScanButtonListener();
            AddStopScanButtonListener();
            AddSpinnerScannersListener();
            AddSpinnerTriggersListener();
            AddCheckBoxContinuousListener();
            AddCheckBoxDecodersListener();

            PopulateTriggers();

            // The EMDKManager object will be created and returned in the callback
            EMDKResults results = EMDKManager.GetEMDKManager(Application.Context, this);

            // Check the return status of GetEMDKManager
            if (results.StatusCode != EMDKResults.STATUS_CODE.Success)
            {
                // EMDKManager object initialization success
                textViewStatus.Text = "Status: EMDKManager object creation failed.";
            }
            else
            {
                // EMDKManager object initialization failed
                textViewStatus.Text = "Status: EMDKManager object creation succeeded.";
            }
        }
示例#14
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);

            SetContentView(Resource.Layout.activity_main);

            getImagesOferta();

            buscarLoyal = (Button)FindViewById(Resource.Id.recompensa_btn);

            buscarLoyal.Click += dialogLoyal;

            EMDKResults results = EMDKManager.GetEMDKManager(Android.App.Application.Context, this);

            if (results.StatusCode != EMDKResults.STATUS_CODE.Success)
            {
                ScannerStatus = "Status: EMDKManager object creation failed ...";
            }
            else
            {
                ScannerStatus = "Status: EMDKManager object creation succeeded ...";
            }

            StartTimer();
        }
示例#15
0
        void profileManager_Data(object sender, ProfileManager.DataEventArgs e)
        {
            // Call back with the result of the processProfileAsync
            EMDKResults results = e.P0.Result;

            string statusString = CheckXmlError(results);

            output(statusString);
        }
示例#16
0
        void profileManager_Data(object sender, ProfileManager.DataEventArgs e)
        {
            // Call back with the result of the processProfileAsync
            EMDKResults results = e.P0.Result;

            string statusString = CheckXmlError(results);

            RunOnUiThread(() => statusTextView.Text = statusString);
        }
        private void btnRequestPermissionClick(object sender, EventArgs e)
        {
            EMDKResults emdkManagerResults = EMDKManager.GetEMDKManager(Application.Context, this);

            if (emdkManagerResults.StatusCode != EMDKResults.STATUS_CODE.Success)
            {
                Log.Error(LOG_TAG, "Unable to create EMDK Manager");
                Toast.MakeText(this, "Unable to create EMDK Manager", ToastLength.Short).Show();
            }
        }
        private string CheckXmlError(EMDKResults results)
        {
            StringReader stringReader   = null;
            string       checkXmlStatus = "";
            bool         isFailure      = false;

            try
            {
                if (results.StatusCode == EMDKResults.STATUS_CODE.CheckXml)
                {
                    stringReader = new StringReader(results.StatusString);

                    using (XmlReader reader = XmlReader.Create(stringReader))
                    {
                        while (reader.Read())
                        {
                            if (reader.NodeType == XmlNodeType.Element)
                            {
                                switch (reader.Name)
                                {
                                case "parm-error":
                                    isFailure = true;
                                    string parmName             = reader.GetAttribute("name");
                                    string parmErrorDescription = reader.GetAttribute("desc");
                                    checkXmlStatus = "Name: " + parmName + ", Error Description: " + parmErrorDescription;
                                    break;

                                case "characteristic-error":
                                    isFailure = true;
                                    string errorType            = reader.GetAttribute("type");
                                    string charErrorDescription = reader.GetAttribute("desc");
                                    checkXmlStatus = "Type: " + errorType + ", Error Description: " + charErrorDescription;
                                    break;
                                }
                            }
                        }

                        if (!isFailure)
                        {
                            checkXmlStatus = "Profile applied successfully ...";
                        }
                    }
                }
            }
            finally
            {
                if (stringReader != null)
                {
                    stringReader.Dispose();
                }
            }

            return(checkXmlStatus);
        }
        public ScannerEmdk(EMDKManager.IEMDKListener listener)
        {
            Log.Debug(TAG, "scannerUtil is initialized");
            //The EMDKManager object will be created asynchronously, and returned in OnOpen callback.
            EMDKResults results = EMDKManager.GetEMDKManager(Android.App.Application.Context, listener);

            if (results.StatusCode != EMDKResults.STATUS_CODE.Success)
            {
                throw new Exception("Barcode scanner could not be initialized.");
            }
        }
示例#20
0
        public void ProcessProfile(String profileName)
        {
            Console.WriteLine("Testing");

            string[] modifyData1 = new string[1];

            // Call processPrfoileAsync with profile name, 'Set' flag and modify data to update the profile
            EMDKResults results = profileManager.ProcessProfileAsync(profileName, ProfileManager.PROFILE_FLAG.Set, modifyData1);

            string resultString = results.StatusCode == EMDKResults.STATUS_CODE.Processing ? "Set profile in-progress..." : "Set profile failed.";

            output(resultString);
        }
示例#21
0
        void InitializeEMDK(Context context)
        {
            // To retrieve the EMDKManager correctly this code requires
            // an instance of EMDKMAnager.IEMDKListener which is why
            // we can pass the current instance via 'this'
            EMDKResults results = EMDKManager.GetEMDKManager(context, this);

            if (results.StatusCode != EMDKResults.STATUS_CODE.Success)
            {
                // If there is a problem initializing throw an exception
                throw new InvalidOperationException("Unable to initialize EMDK Manager");
            }
        }
        public void EnciendeEscaner()
        {
            EMDKResults results = EMDKManager.GetEMDKManager(Android.App.Application.Context, this);

            if (results.StatusCode != EMDKResults.STATUS_CODE.Success)
            {
                // EMDKManager object initialization success
                Console.WriteLine("Main", "Status: EMDKManager object creation failed.");
            }
            else
            {
                // EMDKManager object initialization failed
                Console.WriteLine("Main", "Status: EMDKManager object creation succeeded.");
            }
        }
示例#23
0
        void profileManager_Data(object sender, ProfileManager.DataEventArgs e)
        {
            // Call back with the result of the processProfileAsync

            EMDKResults results = e.P0.Result;

            // Check the return status of processProfileAsync
            string resultString = results.StatusCode == EMDKResults.STATUS_CODE.Success ? "Set profile success." : "Set profile failed.";

            if (statusTextView != null)
            {
                RunOnUiThread(() => statusTextView.Text = resultString);
                Console.WriteLine("Status: " + results.StatusCode + " ExtendedStatus: " + results.ExtendedStatusCode + "\n" + results.StatusString);
            }
        }
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);
            present_Activity = this;
            SetContentView(Resource.Layout.Main);

            /*tableView = FindViewById<TableLayout>(Resource.Id.tableView);
             * scrollView = FindViewById<ScrollView>(Resource.Id.scrollView);
             * textViewStatus = FindViewById<TextView>(Resource.Id.textViewStatus) as TextView;
             * textView = (TextView) FindViewById<TextView>(Resource.Id.textView);
             * textView1 = FindViewById<TextView>(Resource.Id.textView1) as TextView;
             * textView2 = FindViewById<TextView>(Resource.Id.textView2) as TextView;
             * textView4 = FindViewById<TextView>(Resource.Id.textView4) as TextView;
             * textViewType = FindViewById<TextView>(Resource.Id.textViewType) as TextView;
             *
             * spinnerScannerDevices = FindViewById<Spinner>(Resource.Id.spinnerScannerDevices) as Spinner;
             * spinnerTriggers = FindViewById<Spinner>(Resource.Id.spinnerTriggers);
             * barcodeCount = FindViewById<EditText>(Resource.Id.barcodeCount);
             * Button StartScanbtn = FindViewById<Button>(Resource.Id.buttonStartScan);*/
            textViewStatus            = (TextView)FindViewById(Resource.Id.textViewStatus);
            spinnerScannerDevices     = (Spinner)FindViewById(Resource.Id.spinnerScannerDevices);
            spinnerTriggers           = (Spinner)FindViewById(Resource.Id.spinnerTriggers);
            barcodeCount              = (EditText)FindViewById(Resource.Id.barcodeCount);
            barcodeCount.TextChanged += BarcodeCount_TextChanged;


            EMDKResults results = EMDKManager.GetEMDKManager(Application.Context, this);

            // Check the return status of GetEMDKManager
            if (results.StatusCode != EMDKResults.STATUS_CODE.Success)
            {
                // EMDKManager object initialization failed
                textViewStatus.Text = "Status: EMDKManager object creation failed.";
            }
            else
            {
                // EMDKManager object initialization succeeded
                textViewStatus.Text = "Status: EMDKManager object creation succeeded.";
            }



            AddBarcodeCountListener();
            AddStartScanButtonListener();
            AddSpinnerScannerDevicesListener();
            AddSpinnerTriggersListener();
            PopulateTriggers();
        }
示例#25
0
        private void getEMDKManager()
        {
            string      strResults = string.Empty;
            EMDKResults results    = EMDKManager.GetEMDKManager(Application.Context, this);

            if (results.StatusCode != EMDKResults.STATUS_CODE.Success)
            {
                strResults = "EMDKManager object creation failed!";
            }
            else
            {
                strResults = "EMDKManager object creation succeeded.";
            }

            OnStatusChanged?.Invoke(this, new EMDKStatusChangedArgs(strResults));
        }
示例#26
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            TabLayoutResource = Resource.Layout.Tabbar;
            ToolbarResource   = Resource.Layout.Toolbar;



            base.OnCreate(savedInstanceState);

            //Ring Scanner related
            EMDKResults results = EMDKManager.GetEMDKManager(Android.App.Application.Context, this);



            RequestedOrientation = ScreenOrientation.Portrait;
        }
示例#27
0
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);

            // Set our view from the "main" layout resource
            SetContentView(Resource.Layout.Main);

            EMDKResults result = EMDKManager.GetEMDKManager(Application.Context, this);

            if (result.StatusCode != EMDKResults.STATUS_CODE.Success)
            {
                Toast.MakeText(this, "Error opening the EMDK Manager", ToastLength.Long).Show();
            }
            else
            {
                Toast.MakeText(this, "EMDK Manager is available", ToastLength.Long).Show();
            }

            // Get our button from the layout resource,
            // and attach an event to toggle scanning option
            Button scanButton = FindViewById <Button>(Resource.Id.btn_scan);

            scanButton.Click += delegate
            {
                var intent = new Intent();
                intent.SetAction(ACTION_SOFTSCANTRIGGER);
                intent.PutExtra(EXTRA_PARAM, DWAPI_TOGGLE_SCANNING);
                SendBroadcast(intent);
            };

            MyReceiver _broadcastReceiver = new MyReceiver();

            EditText editText = FindViewById <EditText>(Resource.Id.editbox);

            _broadcastReceiver.scanDataReceived += (s, scanData) =>
            {
                editText.Text = scanData;
            };

            // Register the broadcast receiver
            IntentFilter filter = new IntentFilter("barcodescanner.RECVR");

            filter.AddCategory("android.intent.category.DEFAULT");
            Application.Context.RegisterReceiver(_broadcastReceiver, filter);
        }
示例#28
0
        private void ProcessMXContent()
        {
            var parameters = new String[1];

            parameters[0] = msProfileData;

            EMDKResults results = mProfileManager.ProcessProfile(msProfileName, ProfileManager.PROFILE_FLAG.Set, parameters);

            //Check the return status of processProfile
            if (results.StatusCode == EMDKResults.STATUS_CODE.CheckXml)
            {
                try
                {
                    // Empty Error Holder Array List if it already exists
                    mErrors.Clear();

                    //Inspect the XML response to see if there are any errors, if not report success
                    using (XmlReader reader = XmlReader.Create(new StringReader(results.StatusString)))
                    {
                        //while (reader.Read())
                        //{

                        //}
                    }
                    onProfileExecutedWithSuccess();
                }
                catch (Exception e)
                {
                }
            }
            else if (results.StatusCode == EMDKResults.STATUS_CODE.Success)
            {
                logMessage("Profile executed with success: " + msProfileName, EMessageType.DEBUG);
                onProfileExecutedWithSuccess();
                return;
            }
            else
            {
                String errorMessage = "Profile update failed." + GetResultCode(results.StatusCode) + "\nProfile:\n" + msProfileName;
                logMessage(errorMessage, EMessageType.ERROR);
                onProfileExecutedError(errorMessage);
                return;
            }
        }
示例#29
0
        //ScanAndPairManager.StatusEventArgs statusCallbackObj = this;

        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);
            // Set our view from the "main" layout resource
            SetContentView(Resource.Layout.Main);
            btName              = FindViewById <EditText>(Resource.Id.name);
            btAddress           = (EditText)FindViewById(Resource.Id.address);
            checkBoxAlwaysScan  = (CheckBox)FindViewById(Resource.Id.alwaysscan);
            checkboxHardTrigger = (CheckBox)FindViewById(Resource.Id.triggerType);
            scanAndPairButton   = (Button)FindViewById(Resource.Id.scanandpair);
            scanAndUnpairButton = (Button)FindViewById(Resource.Id.scanandunpair);
            statusView          = (TextView)FindViewById(Resource.Id.logs);
            scandataType        = (Spinner)FindViewById(Resource.Id.scanDataType);
            statusView.SetText("\n", TextView.BufferType.Normal);

            btName.Enabled    = false;
            btAddress.Enabled = false;

            // The EMDKManager object creation and object will be returned in the callback.
            EMDKResults results = EMDKManager.GetEMDKManager(ApplicationContext, this);

            // Check the return status of getEMDKManager ()
            if (results.StatusCode == EMDKResults.STATUS_CODE.Success)
            {
                statusView.SetText("Please wait, initialization in progress...", TextView.BufferType.Normal);
            }
            else
            {
                statusView.SetText("Initialization failed!", TextView.BufferType.Normal);
            }
            System.Collections.Generic.List <Symbol.XamarinEMDK.ScanAndPair.ScanAndPairConfig.ScanDataType> scanDataTypes = new System.Collections.Generic.List <ScanAndPairConfig.ScanDataType>();
            scanDataTypes.Add(Symbol.XamarinEMDK.ScanAndPair.ScanAndPairConfig.ScanDataType.MacAddress);
            scanDataTypes.Add(Symbol.XamarinEMDK.ScanAndPair.ScanAndPairConfig.ScanDataType.DeviceName);
            scanDataTypes.Add(Symbol.XamarinEMDK.ScanAndPair.ScanAndPairConfig.ScanDataType.Unspecified);

            ArrayAdapter <Symbol.XamarinEMDK.ScanAndPair.ScanAndPairConfig.ScanDataType> arrayAdapter = new ArrayAdapter <Symbol.XamarinEMDK.ScanAndPair.ScanAndPairConfig.ScanDataType>(ApplicationContext, Resource.Layout.simple_spinner_item, scanDataTypes);

            scandataType.Adapter = arrayAdapter;

            registerForButtonEvents();
            addCheckBoxListener();
        }
示例#30
0
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);

            // Set our view from the "main" layout resource
            SetContentView(Resource.Layout.Main);

            // Get our button from the layout resource,
            // and attach an event to it
            mStatusTextView = FindViewById <TextView>(Resource.Id.textViewStatus);
            mDataView       = FindViewById <EditText>(Resource.Id.editText1);

            // Now the EMDKManager!
            EMDKResults result = EMDKManager.GetEMDKManager(Application.Context, this);

            if (result.StatusCode != EMDKResults.STATUS_CODE.Success)
            {
                mStatusTextView.Text = "EMDKManager Request failed!";
            }
        }