예제 #1
0
        // This is called when NurApi is fully connected to device and ready to communicate
        private async void MApi_ConnectedEvent(object sender, NurApi.NurEventArgs e)
        {
            // Update reader info, run in task because NurApi calls may block
            await Task.Run(async() =>
            {
                try
                {
                    NurApi.ReaderInfo rdrInfo = mApi.GetReaderInfo();

                    // Update UI in UI thread
                    await CoreApplication.MainView.CoreWindow.Dispatcher.RunAsync(Windows.UI.Core.CoreDispatcherPriority.Normal, () =>
                    {
                        // Update listview item
                        if (mConnectedDev != null)
                        {
                            mConnectedDev.ConnState = NurApiTransport.State.Connected;
                            mConnectedDev.UpdateInfo();
                        }

                        // Update UI
                        ConnInfo.Text             = string.Format("Connected {0}  |  Serial {1}  |  FW {2}", rdrInfo.name, rdrInfo.serial, rdrInfo.GetVersionString());
                        InventoryButton.IsEnabled = true;
                        ConnButton.Content        = "Disconnect";
                    });
                }
                catch (Exception ex)
                {
                    await CoreApplication.MainView.CoreWindow.Dispatcher.RunAsync(Windows.UI.Core.CoreDispatcherPriority.Normal, () =>
                    {
                        ConnInfo.Text = "Error " + ex.ToString();
                    });
                }
            });
        }
예제 #2
0
        /// <summary>
        /// Handles the DisconnectedEvent event of the NUR module.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="NurApi.NurEventArgs" /> instance containing the event data.</param>
        private void hNur_DisconnectedEvent(object sender, NurApi.NurEventArgs e)
        {
            NurApi hNur = sender as NurApi;

            conStatusDesc.Text = "Disconnected";
            UpdateButtons();
        }
예제 #3
0
        /// <summary>
        /// Handles the ConnectedEvent event of the hNur control.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="NurApi.NurEventArgs"/> instance containing the event data.</param>
        /// <exception cref="System.NotImplementedException"></exception>
        void hNur_ConnectedEvent(object sender, NurApi.NurEventArgs e)
        {
            if (hNur != null && hNur.IsConnected())
            {
                try
                {
                    // Get the ReaderInfo
                    readerInfo = hNur.GetReaderInfo();
                }
                catch (NurApiException)
                {
                    // Firmware may be too old so use the defaults
                    readerInfo.name = NA;
                }

                try
                {
                    // Get the Device Capabilites
                    devCaps = hNur.GetDeviceCaps();
                    if (devCaps.txAttnStep == 3)
                    {
                        throw new Exception("Firmware may be too old so use the defaults");
                    }
                }
                catch (Exception)
                {
                    // Firmware may be too old so use the defaults
                    devCaps.maxTxmW    = 500;
                    devCaps.maxTxdBm   = 27;
                    devCaps.txAttnStep = 1;
                    devCaps.txSteps    = 20;
                    devCaps.maxAnt     = 4;
                }
            }
        }
예제 #4
0
 // This gets called when module is connected
 void nur_ConnectedEvent(object sender, NurApi.NurEventArgs e)
 {
     // Connected, display module info
     NurApi.ReaderInfo ri = nur.GetReaderInfo();
     lstbox.Items.Add(ri.name + " connected");
     lstbox.Items.Add("Version: " + ri.GetVersionString());
 }
예제 #5
0
        /// <summary>
        /// Handles the ConnectedEvent event of the NUR module.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="NurApi.NurEventArgs" /> instance containing the event data.</param>
        private void hNur_ConnectedEvent(object sender, NurApi.NurEventArgs e)
        {
            NurApi hNur = sender as NurApi;

            InitializInventoryRead();
            this.Enabled = true;
        }
예제 #6
0
        // Connected event handler
        void hNur_ConnectedEvent(object sender, NurApi.NurEventArgs e)
        {
            // Set window title
            UpdateAppTitle();

            // Here is a proper place to configure reader on the fly if needed
            hNur.TxLevel = 0;   // Set Tx power to max level
        }
예제 #7
0
        // Reader disconnected
        void mApi_DisconnectedEvent(object sender, NurApi.NurEventArgs e)
        {
            connectbutton.Text = "Connect";

            SetInfo("Status", "Disconnected");

            startbutton.Text    = "Start Positioning";
            startbutton.Enabled = false;
        }
 private async void Api_DisconnectedEvent(object sender, NurApi.NurEventArgs e)
 {
     await CoreApplication.MainView.CoreWindow.Dispatcher.RunAsync(Windows.UI.Core.CoreDispatcherPriority.Normal, () =>
     {
         // Update UI
         ButtonState = false;
         AccInfo     = "Disconnected";
     });
 }
 private async void Api_ConnectedEvent(object sender, NurApi.NurEventArgs e)
 {
     await CoreApplication.MainView.CoreWindow.Dispatcher.RunAsync(Windows.UI.Core.CoreDispatcherPriority.Normal, () =>
     {
         // Update UI
         InvButtonState      = true;
         InvButtonText       = "Simple Inventory";
         InvStreamButtonText = "Start Inventory Stream";
     });
 }
예제 #10
0
 void OnModuleConnect(object sender, NurApi.NurEventArgs e)
 {
     AddLog("Device connected.");
     TryUpdateReaderInfo();
     TryUpdateSetup();
     currentTag = null;
     EnableByTagPresence();
     EnableOpControls(CONNECTED);
     ConnectBtn.Text = "Disconnect";
 }
예제 #11
0
 void hNur_ConnectedEvent(object sender, NurApi.NurEventArgs e)
 {
     EnableControls(true);
     TrySetDefaults();
     try
     {
         StatusText.Text = hNur.GetReaderInfo().GetVersionString();
     }
     catch { }
 }
예제 #12
0
        /// <summary>
        /// Handles the DisconnectedEvent event of the NUR module.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="NurApi.NurEventArgs" /> instance containing the event data.</param>
        private void hNur_DisconnectedEvent(object sender, NurApi.NurEventArgs e)
        {
            NurApi hNur = sender as NurApi;

            this.Text = string.Format("{0} {1} ({2}/{3})",
                                      System.Reflection.Assembly.GetEntryAssembly().GetName().Name,
                                      System.Reflection.Assembly.GetEntryAssembly().GetName().Version,
                                      hNur.GetFileVersion(),
                                      NurUtils.NurApiDotNetVersion);
        }
예제 #13
0
        // Disconnected event handler
        void hNur_DisconnectedEvent(object sender, NurApi.NurEventArgs e)
        {
            // Get NurApi object that generated the event
            NurApi hNur = sender as NurApi;

            SendMessage("DISCONNECTED");

            // Releace user NURAPI object
            hNur.Dispose();
            nurApis.Remove(hNur);
        }
예제 #14
0
        /// <summary>
        /// Handles the ConnectedEvent event of the NUR module.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="NurApi.NurEventArgs" /> instance containing the event data.</param>
        private void hNur_ConnectedEvent(object sender, NurApi.NurEventArgs e)
        {
            NurApi hNur = sender as NurApi;

            this.Text = string.Format("{0} App:{1} Net:{2} Dll:{3} Fw:{4}",
                                      System.Reflection.Assembly.GetEntryAssembly().GetName().Name,
                                      System.Reflection.Assembly.GetEntryAssembly().GetName().Version,
                                      NurUtils.NurApiDotNetVersion,
                                      hNur.GetFileVersion(),
                                      hNur.GetReaderInfo().GetVersionString());
        }
예제 #15
0
 private static void HNur_ConnectedEvent(object sender, NurApi.NurEventArgs e)
 {
     Console.WriteLine("Nur Connected");
     try
     {
         hNur.StartInventoryStream();
     }
     catch (Exception ex)
     {
         Console.WriteLine("Could not start inventory stream [" + ex.Message + "]");
     }
 }
예제 #16
0
        void OnModuleDisconnect(object sender, NurApi.NurEventArgs e)
        {
            AddLog("Device discconnected.");
            TagList.Items.Clear();
            SelectedTag.Text = "Selected:";
            currentTag       = null;
            EnableByTagPresence();
            EnableOpControls(NOT_CONNECTED);
            UsbAutoChk.Checked = false;
            ConnectBtn.Text    = "Connect";

            UsbAutoChk.Checked = false;
        }
예제 #17
0
        void OnReaderConnect(object sender, NurApi.NurEventArgs e)
        {
            EnableCtls(true);
            TryUpdateInformation();
            TryUpdateSetup(true);
            PopulateTxLevel(TxLevelSel, mSetup.txLevel);
            UpdateLogSettings();
            AddLog("Connected.");

            if (AutoScanChk.Checked)
            {
                AddLog("Auto scan...");
                DoGetTags();
            }
        }
예제 #18
0
        void OnReaderConnect(object sender, NurApi.NurEventArgs e)
        {
            EnableCtls(true);
            UpdateReaderInformation();
            FillTxLevels();
            FillPhysAntListView();
            ModuleSetupToControls();
            UpdateLogSettings();
            AddLog("Connected to reader");

            if (AutoScanChk.Checked)
            {
                AddLog("Auto scan...");
                DoGetTags();
            }
        }
예제 #19
0
        // This is called when NurApi is fully connected to device and ready to communicate
        private async void Api_ConnectedEvent(object sender, NurApi.NurEventArgs e)
        {
            System.Diagnostics.Debug.WriteLine("Api_ConnectedEvent");

            NurApi connApi = sender as NurApi;

            App.NurApi = connApi;

            await CoreApplication.MainView.CoreWindow.Dispatcher.RunAsync(Windows.UI.Core.CoreDispatcherPriority.Normal, () =>
            {
                NurDeviceWatcherInfo knownDev = connApi.UserData as NurDeviceWatcherInfo;

                // Save connect spec to settings
                //mLocalSettings.Values["devicespec"] = DeviceSpecStr;
                mLocalSettings.Values["devicespec"] = knownDev.SpecStr;

                // Update listview entry
                knownDev.ConnState = NurApiTransport.State.Connected;
                knownDev.UpdateInfo();

                if (knownDev == SelectedDev)
                {
                    ConnButtonText = "Disconnect";
                }
            });

            // Update reader info
            await Task.Run(async() =>
            {
                try
                {
                    NurApi.ReaderInfo rdrInfo = App.NurApi.GetReaderInfo();
                    await CoreApplication.MainView.CoreWindow.Dispatcher.RunAsync(Windows.UI.Core.CoreDispatcherPriority.Normal, () =>
                    {
                        ConnInfo = string.Format("Connected {0}  |  Serial {1}  |  FW {2}", rdrInfo.name, rdrInfo.serial, rdrInfo.GetVersionString());
                    });
                }
                catch (Exception ex)
                {
                    await CoreApplication.MainView.CoreWindow.Dispatcher.RunAsync(Windows.UI.Core.CoreDispatcherPriority.Normal, async() =>
                    {
                        ConnInfo = "Error";
                        await App.ShowException(ex);
                    });
                }
            });
        }
예제 #20
0
        // Reader connected
        void mApi_ConnectedEvent(object sender, NurApi.NurEventArgs e)
        {
            try
            {
                connectbutton.Text = "Disconnect";

                SetInfo("Status", "Connected");
                startbutton.Text    = "Start Gate";
                startbutton.Enabled = true;
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
                connectbutton.Text = "Connect";
                SetInfo("Status", "Device not supported");
            }
        }
예제 #21
0
        /// <summary>
        /// Handles the ConnectedEvent event of the NUR module.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="NurApi.NurEventArgs" /> instance containing the event data.</param>
        private void hNur_ConnectedEvent(object sender, NurApi.NurEventArgs e)
        {
            NurApi hNur = sender as NurApi;

            try
            {
                isAutoTuneSupported = true;
                this.Enabled        = true;
                CreateListOfPhysicalAntennas();
                UpdateAntennaSelection();
                UpdateAntennaTuneSettings();
            }
            catch (NurApiException)
            {
                this.Enabled = false;
            }
        }
예제 #22
0
        /// <summary>
        /// Handles the ConnectedEvent event of the NUR module.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="NurApi.NurEventArgs" /> instance containing the event data.</param>
        private void hNur_ConnectedEvent(object sender, NurApi.NurEventArgs e)
        {
            NurApi hNur = sender as NurApi;

            try
            {
                this.Enabled = NurCapabilities.I.DeviceCaps.tune;
                if (NurCapabilities.I.DeviceCaps.tune == false)
                {
                    AddMessage("Not available with this module!!!");
                }
            }
            catch (NurApiException)
            {
                this.Enabled = false;
            }
        }
예제 #23
0
        // Reader connected
        void mApi_ConnectedEvent(object sender, NurApi.NurEventArgs e)
        {
            connectbutton.Text = "Disconnect";

            // Make sure reader supports beam antenna configuration
            if (mApi.GetDeviceCaps().beamAntenna)
            {
                SetInfo("Status", "Connected");
                startbutton.Text    = "Start Positioning";
                startbutton.Enabled = true;
            }
            else
            {
                SetInfo("Status", "Device not supported");
                startbutton.Enabled = false;
            }
        }
예제 #24
0
        /// <summary>
        /// Handles the ConnectedEvent event of the NUR module.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="NurApi.NurEventArgs" /> instance containing the event data.</param>
        private void hNur_ConnectedEvent(object sender, NurApi.NurEventArgs e)
        {
            NurApi hNur = sender as NurApi;

            conStatusDesc.Text = "Connected";
            UpdateButtons();
            try
            {
                NurApi.EthConfig ethConfig = hNur.GetEthConfig();
                tcpipAddr.Text  = IpToString(ethConfig.ip);
                tcpipPort.Value = ethConfig.serverPort;
            }
            catch (NurApiException)
            {
                // Ignore this error
            }
        }
예제 #25
0
        // Reader connected
        void mApi_ConnectedEvent(object sender, NurApi.NurEventArgs e)
        {
            try
            {
                connectbutton.Text = "Disconnect";
                tagsPerAntennaControl1.Config(mApi);

                SetInfo("Status", "Connected");
                startbutton.Text    = "Start Positioning";
                startbutton.Enabled = true;
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
                connectbutton.Text = "Connect";
                SetInfo("Status", "Device not supported");
            }
        }
예제 #26
0
 void hNur_ConnectedEvent(object sender, NurApi.NurEventArgs e)
 {
     try
     {   //GetReaderInfo from module
         NurApi.ReaderInfo readerInfo = hNur.GetReaderInfo();
         //Show results in Listbox
         listBox1.Items.Add("Name\t" + readerInfo.name);
         listBox1.Items.Add("Version\t" + readerInfo.GetVersionString());
         listBox1.Items.Add("HW Ver\t" + readerInfo.hwVersion);
         listBox1.Items.Add("FCC\t  " + readerInfo.fccId);
         listBox1.Items.Add("Serial\t" + readerInfo.serial);
         listBox1.Items.Add("SW Ver\t" + readerInfo.swVerMajor + "." + readerInfo.swVerMinor);
     }
     catch (Exception ex) //Handle error by show error message in Listbox
     {
         listBox1.Items.Add("Error: GetReaderInfo:" + ex.Message);
     }
 }
        private async void Api_ConnectedEvent(object sender, NurApi.NurEventArgs e)
        {
            NurApi.AccessoryFWInfo?accFwInfo = null;
            string connInfo = "";

            try
            {
                // Get accessory device info
                await Task.Run(() =>
                {
                    accFwInfo = App.NurApi.AccGetFwInfo();
                    connInfo  = App.NurApi.AccGetConnectionInfo();
                });
            }
            catch (Exception ex)
            {
                if (ex is NurApiException && (ex as NurApiException).error == NurApiErrors.NUR_ERROR_INVALID_COMMAND)
                {
                    // This is not accessory device
                    accFwInfo = null;
                }
                else
                {
                    await App.ShowException(ex);

                    return;
                }
            }

            // Update UI
            await CoreApplication.MainView.CoreWindow.Dispatcher.RunAsync(Windows.UI.Core.CoreDispatcherPriority.Normal, () =>
            {
                ButtonState = true;

                if (accFwInfo != null)
                {
                    AccInfo = string.Format("Accessory FW version: {0}; Connection info: {1}", accFwInfo?.FullAppVersion, connInfo);
                }
                else
                {
                    AccInfo = "Connected device does not support accessory device commands";
                }
            });
        }
예제 #28
0
        // This is called when NurApi is fully disconnect (and released resources)
        private async void MApi_DisconnectedEvent(object sender, NurApi.NurEventArgs e)
        {
            // Update UI in UI thread
            await CoreApplication.MainView.CoreWindow.Dispatcher.RunAsync(Windows.UI.Core.CoreDispatcherPriority.Normal, () =>
            {
                // Update listview item
                if (mConnectedDev != null)
                {
                    mConnectedDev.ConnState = NurApiTransport.State.Disconnected;
                    mConnectedDev.UpdateInfo();
                    mConnectedDev = null;
                }

                // Update UI
                InventoryButton.IsEnabled = false;
                ConnInfo.Text             = "Disconnected";
                ConnButton.Content        = "Connect";
            });
        }
예제 #29
0
        // Connected event handler
        void hNur_ConnectedEvent(object sender, NurApi.NurEventArgs e)
        {
            // Get NurApi object that generated the event
            NurApi hNur = sender as NurApi;

            SendMessage(string.Format("CONNECTED: {0}, {1}, {2}",
                                      hNur.GetReaderInfo().name,
                                      hNur.GetReaderInfo().altSerial,
                                      hNur.GetReaderInfo().GetVersionString()
                                      ));

            UpdateAppTitle();

            // Here is a proper place to configure reader on the fly if needed
            //hNur.TxLevel = 0;   // Set Tx power to max level

            // Start inventory stream
            hNur.StartInventoryStream();
        }
예제 #30
0
        /// <summary>
        /// Handles the ConnectedEvent event of the NUR module.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="NurApi.NurEventArgs" /> instance containing the event data.</param>
        private void hNur_ConnectedEvent(object sender, NurApi.NurEventArgs e)
        {
            NurApi hNur = sender as NurApi;

            conStatusDesc.Text = "Connected";
            UpdateButtons();
            // Update default settings
            Properties.Settings.Default.connectionUsb     = useUsbRadioBox.Checked;
            Properties.Settings.Default.connectionUsbAuto = useUsbAutoRadioBox.Checked;
            Properties.Settings.Default.connectionSerial  = useSerialRadioBox.Checked;
            Properties.Settings.Default.connectionSocket  = useSocketRadioBox.Checked;
            if (useSocketRadioBox.Checked)
            {
                Properties.Settings.Default.connectionSocketAddress = socketAddressTextBox.Text;
                Properties.Settings.Default.connectionSocketPort    = (int)socketPortNumericUpDown.Value;
            }
            // Save default settings
            Properties.Settings.Default.Save();
        }