Exemplo n.º 1
0
        private void InvButton_Click(object sender, EventArgs e)
        {
            NurApi.TagStorage        storage;
            NurApi.InventoryResponse resp;
            int i;

            currentTag = null;
            EnableByTagPresence();

            AllTags.Clear();
            TagList.Items.Clear();
            SelectedTag.Text = "Selected: ";

            try
            {
                hNur.ClearIdBuffer();
                resp = hNur.Inventory();

                storage = hNur.FetchTags(true);

                for (i = 0; i < resp.numTagsFound; i++)
                {
                    AllTags.Add(new SL900ATag(storage[i]));
                    TagList.Items.Add(storage[i].GetEpcString());
                }
            }
            catch (Exception ex)
            {
                AddLog("Inventory error.");
                AddLog("Message: " + ex.Message);
            }
        }
Exemplo n.º 2
0
 void OnModuleConnect(object sender, NurApi.NurEventArgs e)
 {
     AddLog("Device connected.");
     TryUpdateReaderInfo();
     TryUpdateSetup();
     currentTag = null;
     EnableByTagPresence();
     EnableOpControls(CONNECTED);
     ConnectBtn.Text = "Disconnect";
 }
Exemplo n.º 3
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;
        }
Exemplo n.º 4
0
        private string ConversionToString(uint sensor, uint adValue)
        {
            string s = "";

            switch (sensor)
            {
            case SL900ATag.TEMP_SENS_TYPE:
                // Note: default values are used here (in mV).
                s = string.Format("TEMP: {0:#0.00} C ", SL900ATag.TemperatureConversion(0.0, 310.0, adValue));
                break;
            }

            s += "0x" + adValue.ToString("X4") + " (" + adValue + ")";
            return(s);
        }
Exemplo n.º 5
0
        private void TagList_SelectedIndexChanged(object sender, EventArgs e)
        {
            int index = TagList.SelectedIndex;

            if (index >= 0 && index < AllTags.Count)
            {
                currentTag       = AllTags[index];
                SelectedTag.Text = "Selected: " + currentTag.GetEpcString();
            }
            else
            {
                currentTag = null;
            }
            EnableByTagPresence();
        }
Exemplo n.º 6
0
        private void DoBatteryRead()
        {
            int ll = hNur.GetLogLevel();

            hNur.SetLogLevel(0);

            if (currentTag != null)
            {
                string type = "(N/A)";
                string volt = "(N/A)";
                BattTypeText.Text = type;
                BattVoltText.Text = volt;

                try
                {
                    SL900ATag.BatteryInfo battInfo = currentTag.Battery;
                    if (battInfo.present && !battInfo.adError)
                    {
                        volt = string.Format("{0:#0.00}", SL900ATag.VoltageConversion(battInfo));
                        type = battInfo.is3V ? "3.3V" : "1.5V";
                        AddLog("Battery read OK.");
                    }
                    else if (!battInfo.present)
                    {
                        AddLog("Battery not in place.");
                    }
                    else
                    {
                        type = "A/D error";
                        volt = "A/D error";
                    }

                    BattTypeText.Text = type;
                    BattVoltText.Text = volt;
                }
                catch (Exception e)
                {
                    AddLog("Error: " + e.Message);
                    string[] more = currentTag.LastToStrings();
                    foreach (string s in more)
                    {
                        InfoLog(s);
                    }
                }
            }
            hNur.SetLogLevel(ll);
        }