From 2930d7d66046ac964fa844f6537c160235f4f4b4 Mon Sep 17 00:00:00 2001
From: Carlson Lam <4546682+ksclam@users.noreply.github.com>
Date: Wed, 27 Feb 2019 09:00:33 -0500
Subject: [PATCH] RFMicro Temperature Tag Functions
- Added RFMicro temperature tag features.
---
.../BLE.Client.Droid/BLE.Client.Droid.csproj | 9 +-
.../Properties/AndroidManifest.xml | 2 +-
.../BLE.Client/BLE.Client.iOS/Info.plist | 4 +-
.../BLE.Client/BLE.Client/BLE.Client.csproj | 20 +
.../BLE.Client/Pages/PageRFMicroReadTemp.xaml | 86 +++
.../Pages/PageRFMicroReadTemp.xaml.cs | 72 +++
.../Pages/PageRFMicronInventory.xaml | 75 +++
.../Pages/PageRFMicronInventory.xaml.cs | 32 +
.../BLE.Client/Pages/PageReadWrite.xaml | 18 +-
.../BLE.Client/Pages/PageReadWrite.xaml.cs | 15 +-
.../Pages/PageSpecialFunctionsMenu.xaml | 1 +
.../ViewModels/ViewModelRFMicroInventory.cs | 521 ++++++++++++++++
.../ViewModels/ViewModelRFMicroReadTemp.cs | 585 ++++++++++++++++++
.../ViewModels/ViewModelReadWrite.cs | 16 +-
.../ViewModels/ViewModelSecurity.cs | 8 +-
.../ViewModelSpecialFunctionsMenu.cs | 8 +
CSLibrary/CSLibrary-DESKTOP.csproj | 3 +-
.../RFIDReader/ClassRFID.Private.Inventory.cs | 4 +-
.../RFIDReader/ClassRFID.Private.Select.cs | 1 -
CSLibrary/CSLibrary/RFIDReader/ClassRFID.cs | 67 +-
CSLibrary/Properties/AssemblyInfo.cs | 4 +-
21 files changed, 1507 insertions(+), 44 deletions(-)
create mode 100755 CS108 Demo/Source/BLE.Client/BLE.Client/Pages/PageRFMicroReadTemp.xaml
create mode 100755 CS108 Demo/Source/BLE.Client/BLE.Client/Pages/PageRFMicroReadTemp.xaml.cs
create mode 100755 CS108 Demo/Source/BLE.Client/BLE.Client/Pages/PageRFMicronInventory.xaml
create mode 100755 CS108 Demo/Source/BLE.Client/BLE.Client/Pages/PageRFMicronInventory.xaml.cs
create mode 100755 CS108 Demo/Source/BLE.Client/BLE.Client/ViewModels/ViewModelRFMicroInventory.cs
create mode 100755 CS108 Demo/Source/BLE.Client/BLE.Client/ViewModels/ViewModelRFMicroReadTemp.cs
diff --git a/CS108 Demo/Source/BLE.Client/BLE.Client.Droid/BLE.Client.Droid.csproj b/CS108 Demo/Source/BLE.Client/BLE.Client.Droid/BLE.Client.Droid.csproj
index 156f0a7..0636a66 100755
--- a/CS108 Demo/Source/BLE.Client/BLE.Client.Droid/BLE.Client.Droid.csproj
+++ b/CS108 Demo/Source/BLE.Client/BLE.Client.Droid/BLE.Client.Droid.csproj
@@ -26,7 +26,8 @@
false
-
+
+
True
@@ -43,6 +44,9 @@
Xamarin
btls
Xamarin.Android.Net.AndroidClientHandler
+ false
+ false
+ false
pdbonly
@@ -57,6 +61,9 @@
1G
Xamarin
False
+ false
+ false
+ false
diff --git a/CS108 Demo/Source/BLE.Client/BLE.Client.Droid/Properties/AndroidManifest.xml b/CS108 Demo/Source/BLE.Client/BLE.Client.Droid/Properties/AndroidManifest.xml
index cf128f8..a1a9821 100755
--- a/CS108 Demo/Source/BLE.Client/BLE.Client.Droid/Properties/AndroidManifest.xml
+++ b/CS108 Demo/Source/BLE.Client/BLE.Client.Droid/Properties/AndroidManifest.xml
@@ -1,5 +1,5 @@
-
+
diff --git a/CS108 Demo/Source/BLE.Client/BLE.Client.iOS/Info.plist b/CS108 Demo/Source/BLE.Client/BLE.Client.iOS/Info.plist
index 6cdd6de..5869066 100755
--- a/CS108 Demo/Source/BLE.Client/BLE.Client.iOS/Info.plist
+++ b/CS108 Demo/Source/BLE.Client/BLE.Client.iOS/Info.plist
@@ -25,7 +25,7 @@
UILaunchStoryboardName
LaunchScreen
CFBundleShortVersionString
- 2.0.12
+ 2.0.13
NSCalendarsUsageDescription
Only for testing, we don't need the data to do anything
UIApplicationExitsOnSuspend
@@ -54,6 +54,6 @@
CFBundleVersion
- 152
+ 158
diff --git a/CS108 Demo/Source/BLE.Client/BLE.Client/BLE.Client.csproj b/CS108 Demo/Source/BLE.Client/BLE.Client/BLE.Client.csproj
index ef22d34..5d43f4b 100755
--- a/CS108 Demo/Source/BLE.Client/BLE.Client/BLE.Client.csproj
+++ b/CS108 Demo/Source/BLE.Client/BLE.Client/BLE.Client.csproj
@@ -53,6 +53,12 @@
PageFilter.xaml
+
+ PageRFMicroReadTemp.xaml
+
+
+ PageRFMicronInventory.xaml
+
PagePeriodicRead.xaml
@@ -113,11 +119,13 @@
+
+
@@ -365,6 +373,18 @@
Designer
+
+
+ MSBuild:UpdateDesignTimeXaml
+ Designer
+
+
+
+
+ MSBuild:UpdateDesignTimeXaml
+ Designer
+
+
diff --git a/CS108 Demo/Source/BLE.Client/BLE.Client/Pages/PageRFMicroReadTemp.xaml b/CS108 Demo/Source/BLE.Client/BLE.Client/Pages/PageRFMicroReadTemp.xaml
new file mode 100755
index 0000000..145820b
--- /dev/null
+++ b/CS108 Demo/Source/BLE.Client/BLE.Client/Pages/PageRFMicroReadTemp.xaml
@@ -0,0 +1,86 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/CS108 Demo/Source/BLE.Client/BLE.Client/Pages/PageRFMicroReadTemp.xaml.cs b/CS108 Demo/Source/BLE.Client/BLE.Client/Pages/PageRFMicroReadTemp.xaml.cs
new file mode 100755
index 0000000..2ba2fb4
--- /dev/null
+++ b/CS108 Demo/Source/BLE.Client/BLE.Client/Pages/PageRFMicroReadTemp.xaml.cs
@@ -0,0 +1,72 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+using Xamarin.Forms;
+using Xamarin.Forms.Xaml;
+
+namespace BLE.Client.Pages
+{
+ public partial class PageRFMicroReadTemp
+ {
+ public PageRFMicroReadTemp()
+ {
+ InitializeComponent();
+ }
+
+ protected override void OnAppearing()
+ {
+ base.OnAppearing();
+ }
+
+ protected override void OnDisappearing()
+ {
+ base.OnDisappearing();
+ }
+
+ void InputFocused(object sender, EventArgs args)
+ {
+ double curY = ((Entry)sender).Y;
+ double move;
+
+ if (curY != 0)
+ {
+ move = -(curY - 97.5);
+ }
+ else
+ {
+ move = -174;
+ }
+
+ Content.LayoutTo(new Rectangle(0, move, Content.Bounds.Width, Content.Bounds.Height));
+ }
+
+ void InputACCPWDFocused(object sender, EventArgs args)
+ {
+ Content.LayoutTo(new Rectangle(0, -110, Content.Bounds.Width, Content.Bounds.Height));
+ }
+
+ void InputUnfocused(object sender, EventArgs args)
+ {
+ Content.LayoutTo(new Rectangle(0, 0, Content.Bounds.Width, Content.Bounds.Height));
+ }
+
+ int HexVal (string value, int offset = 1)
+ {
+ offset--;
+ byte[] header = UnicodeEncoding.Unicode.GetBytes(value.Substring(offset, 1));
+
+ if (header[0] >= 48 && header[0] <= 57)
+ return (header[0] - 48);
+ else if (header[0] >= 65 && header[0] <= 70)
+ return (header[0] - 55);
+ else if (header[0] >= 97 && header[0] <= 102)
+ return (header[0] - 87);
+ else
+ return -1;
+ }
+
+ }
+}
diff --git a/CS108 Demo/Source/BLE.Client/BLE.Client/Pages/PageRFMicronInventory.xaml b/CS108 Demo/Source/BLE.Client/BLE.Client/Pages/PageRFMicronInventory.xaml
new file mode 100755
index 0000000..99f8da1
--- /dev/null
+++ b/CS108 Demo/Source/BLE.Client/BLE.Client/Pages/PageRFMicronInventory.xaml
@@ -0,0 +1,75 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/CS108 Demo/Source/BLE.Client/BLE.Client/Pages/PageRFMicronInventory.xaml.cs b/CS108 Demo/Source/BLE.Client/BLE.Client/Pages/PageRFMicronInventory.xaml.cs
new file mode 100755
index 0000000..3643abc
--- /dev/null
+++ b/CS108 Demo/Source/BLE.Client/BLE.Client/Pages/PageRFMicronInventory.xaml.cs
@@ -0,0 +1,32 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+using Xamarin.Forms;
+
+namespace BLE.Client.Pages
+{
+ public partial class PageRFMicroInventory
+ {
+ public PageRFMicroInventory()
+ {
+ InitializeComponent();
+ }
+
+ public async void OnItemSelected(object sender, SelectedItemChangedEventArgs e)
+ {
+ var answer = await DisplayAlert("Select Tag", "Selected Tag for Read/Write, Geiger and RFMicro search", "OK", "Cancel");
+
+ if (answer)
+ {
+ //BLE.Client.ViewModels.ViewModelInventorynScan.TagInfo Items = (BLE.Client.ViewModels.ViewModelInventorynScan.TagInfo)e.SelectedItem;
+ BLE.Client.ViewModels.TagInfoViewModel Items = (BLE.Client.ViewModels.TagInfoViewModel)e.SelectedItem;
+
+ BleMvxApplication._SELECT_EPC = Items.EPC;
+ BleMvxApplication._SELECT_PC = Items.PC;
+ }
+ }
+ }
+}
diff --git a/CS108 Demo/Source/BLE.Client/BLE.Client/Pages/PageReadWrite.xaml b/CS108 Demo/Source/BLE.Client/BLE.Client/Pages/PageReadWrite.xaml
index 7ade546..fc30e7c 100755
--- a/CS108 Demo/Source/BLE.Client/BLE.Client/Pages/PageReadWrite.xaml
+++ b/CS108 Demo/Source/BLE.Client/BLE.Client/Pages/PageReadWrite.xaml
@@ -8,10 +8,8 @@
-
-
-
-
+
+
@@ -32,24 +30,22 @@
+
-
-
-
-
-
+
+
-
+
-
+
diff --git a/CS108 Demo/Source/BLE.Client/BLE.Client/Pages/PageReadWrite.xaml.cs b/CS108 Demo/Source/BLE.Client/BLE.Client/Pages/PageReadWrite.xaml.cs
index 4cbf0b2..e3a3e03 100755
--- a/CS108 Demo/Source/BLE.Client/BLE.Client/Pages/PageReadWrite.xaml.cs
+++ b/CS108 Demo/Source/BLE.Client/BLE.Client/Pages/PageReadWrite.xaml.cs
@@ -89,8 +89,8 @@ public async void onentryPCTextChanged(object sender, EventArgs e)
epcWordLen = HexVal(entryPC.Text.Substring(0, 1)) << 1;
epcWordLen |= HexVal(entryPC.Text.Substring(1, 1)) >> 3;
- _EPCLength = epcWordLen * 4;
-
+ _EPCLength = epcWordLen * 4;
+
labelEPCLength.Text = "EPC Length " + (epcWordLen * 16).ToString() + " bits";
}
catch (Exception ex)
@@ -109,6 +109,11 @@ public async void onentryPCUnfocused(object sender, EventArgs e)
entryPC.Text += "0000".Remove(4-entryPC.Text.Length);
onentryEPCTextChanged(sender, e);
+
+ await DisplayAlert("Changing EPC Length will automatically modify to " + (_EPCLength * 4).ToString() + " bits", "", null, "OK");
+
+ if (editorSelectedEPC.Text.Length > _EPCLength)
+ editorSelectedEPC.Text = editorSelectedEPC.Text.Substring(0, _EPCLength);
}
public async void onentryEPCTextChanged(object sender, EventArgs e)
@@ -138,5 +143,11 @@ public async void onentryEPCUnfocused(object sender, EventArgs e)
entryEPC.Focus();
}
}
+
+ public async void onentryTemperatureCodeTextChanged(object sender, EventArgs e)
+ {
+
+ }
+
}
}
diff --git a/CS108 Demo/Source/BLE.Client/BLE.Client/Pages/PageSpecialFunctionsMenu.xaml b/CS108 Demo/Source/BLE.Client/BLE.Client/Pages/PageSpecialFunctionsMenu.xaml
index 40a2c86..def183c 100755
--- a/CS108 Demo/Source/BLE.Client/BLE.Client/Pages/PageSpecialFunctionsMenu.xaml
+++ b/CS108 Demo/Source/BLE.Client/BLE.Client/Pages/PageSpecialFunctionsMenu.xaml
@@ -11,6 +11,7 @@
+
diff --git a/CS108 Demo/Source/BLE.Client/BLE.Client/ViewModels/ViewModelRFMicroInventory.cs b/CS108 Demo/Source/BLE.Client/BLE.Client/ViewModels/ViewModelRFMicroInventory.cs
new file mode 100755
index 0000000..0586534
--- /dev/null
+++ b/CS108 Demo/Source/BLE.Client/BLE.Client/ViewModels/ViewModelRFMicroInventory.cs
@@ -0,0 +1,521 @@
+using System;
+using System.Collections.ObjectModel;
+using System.Collections.Generic;
+using Acr.UserDialogs;
+using MvvmCross.Core.ViewModels;
+using MvvmCross.Platform;
+
+using System.Windows.Input;
+using Xamarin.Forms;
+
+
+using Plugin.BLE.Abstractions.Contracts;
+
+using Plugin.BLE.Abstractions;
+using Plugin.BLE.Abstractions.Extensions;
+
+using Prism.Mvvm;
+
+
+namespace BLE.Client.ViewModels
+{
+ public class ViewModelRFMicroInventory : BaseViewModel
+ {
+ private readonly IUserDialogs _userDialogs;
+
+ #region -------------- RFID inventory -----------------
+
+ public ICommand OnStartInventoryButtonCommand { protected set; get; }
+ public ICommand OnClearButtonCommand { protected set; get; }
+
+ private ObservableCollection _TagInfoList = new ObservableCollection();
+ public ObservableCollection TagInfoList { get { return _TagInfoList; } set { SetProperty(ref _TagInfoList, value); } }
+
+ public int tagsCount = 0;
+ bool _newTag = false;
+ int _tagCountForAlert = 0;
+ bool _newTagFound = false;
+
+ public bool _startInventory = true;
+
+ private bool _switchRSSI_TempToggled = false;
+ public bool switchRSSI_TempToggled { get { return _switchRSSI_TempToggled; } set { _switchRSSI_TempToggled = value; } }
+ public string Col2Label { get { return _switchRSSI_TempToggled ? "Temp" : "OC RSSI"; } }
+
+ private string _startInventoryButtonText = "Start Inventory";
+ public string startInventoryButtonText { get { return _startInventoryButtonText; } }
+
+ bool _tagCount = false;
+
+ private string _tagPerSecondText = "0 tags/s";
+ public string tagPerSecondText { get { return _tagPerSecondText; } }
+ private string _numberOfTagsText = "0 tags";
+ public string numberOfTagsText { get { return _numberOfTagsText; } }
+ private string _labelVoltage = "";
+ public string labelVoltage { get { return _labelVoltage; } }
+
+ private int _ListViewRowHeight = -1;
+ public int ListViewRowHeight { get { return _ListViewRowHeight; } set { _ListViewRowHeight = value; } }
+
+ DateTime InventoryStartTime;
+ private double _InventoryTime = 0;
+ public string InventoryTime { get { return ((uint)_InventoryTime).ToString() + "s"; } }
+
+ private int _DefaultRowHight;
+
+ bool _cancelVoltageValue = false;
+
+ #endregion
+
+ public ViewModelRFMicroInventory(IAdapter adapter, IUserDialogs userDialogs) : base(adapter)
+ {
+ _userDialogs = userDialogs;
+
+ RaisePropertyChanged(() => ListViewRowHeight);
+ _DefaultRowHight = ListViewRowHeight;
+
+ OnStartInventoryButtonCommand = new Command(StartInventoryClick);
+ OnClearButtonCommand = new Command(ClearClick);
+
+ RaisePropertyChanged(() => switchRSSI_TempToggled);
+ }
+
+ ~ViewModelRFMicroInventory()
+ {
+ }
+
+ public override void Resume()
+ {
+ base.Resume();
+
+ // RFID event handler
+ BleMvxApplication._reader.rfid.OnAsyncCallback += new EventHandler(TagInventoryEvent);
+
+ // Key Button event handler
+ BleMvxApplication._reader.notification.OnKeyEvent += new EventHandler(HotKeys_OnKeyEvent);
+ BleMvxApplication._reader.notification.OnVoltageEvent += new EventHandler(VoltageEvent);
+
+ InventorySetting();
+ }
+
+ public override void Suspend()
+ {
+ BleMvxApplication._reader.rfid.CancelAllSelectCriteria(); // Confirm cancel all filter
+
+ BleMvxApplication._reader.rfid.StopOperation();
+ ClassBattery.SetBatteryMode(ClassBattery.BATTERYMODE.IDLE);
+ BleMvxApplication._reader.barcode.Stop();
+
+ // Cancel RFID event handler
+ BleMvxApplication._reader.rfid.OnAsyncCallback -= new EventHandler(TagInventoryEvent);
+ BleMvxApplication._reader.rfid.OnStateChanged += new EventHandler(StateChangedEvent);
+
+ // Key Button event handler
+ BleMvxApplication._reader.notification.OnKeyEvent -= new EventHandler(HotKeys_OnKeyEvent);
+ BleMvxApplication._reader.notification.OnVoltageEvent -= new EventHandler(VoltageEvent);
+
+ base.Suspend();
+ }
+
+ protected override void InitFromBundle(IMvxBundle parameters)
+ {
+ base.InitFromBundle(parameters);
+ }
+
+ private void ClearClick()
+ {
+ InvokeOnMainThread(() =>
+ {
+ lock (TagInfoList)
+ {
+ TagInfoList.Clear();
+ _numberOfTagsText = _TagInfoList.Count.ToString() + " tags";
+ RaisePropertyChanged(() => numberOfTagsText);
+
+ tagsCount = 0;
+ _tagPerSecondText = tagsCount.ToString() + " tags/s";
+ RaisePropertyChanged(() => tagPerSecondText);
+ }
+ });
+ }
+
+ //private TagInfoViewModel _ItemSelected;
+ public TagInfoViewModel objItemSelected
+ {
+ set
+ {
+ BleMvxApplication._SELECT_EPC = value.EPC;
+ BleMvxApplication._SELECT_PC = value.PC;
+ ShowViewModel(new MvxBundle());
+ }
+ }
+
+ void InventorySetting()
+ {
+ switch (BleMvxApplication._config.RFID_FrequenceSwitch)
+ {
+ case 0:
+ BleMvxApplication._reader.rfid.SetHoppingChannels(BleMvxApplication._config.RFID_Region);
+ break;
+ case 1:
+ BleMvxApplication._reader.rfid.SetFixedChannel(BleMvxApplication._config.RFID_Region, BleMvxApplication._config.RFID_FixedChannel);
+ break;
+ case 2:
+ BleMvxApplication._reader.rfid.SetAgileChannels(BleMvxApplication._config.RFID_Region);
+ break;
+ }
+
+ BleMvxApplication._reader.rfid.Options.TagRanging.flags = CSLibrary.Constants.SelectFlags.ZERO;
+
+ // Setting 1
+ BleMvxApplication._reader.rfid.SetInventoryDuration((uint)BleMvxApplication._config.RFID_DWellTime);
+ BleMvxApplication._reader.rfid.SetPowerLevel((uint)BleMvxApplication._config.RFID_Power);
+
+ // Setting 3 // MUST SET for RFMicro
+ BleMvxApplication._config.RFID_DynamicQParms.retryCount = 5; // for RFMicro special setting
+ BleMvxApplication._reader.rfid.SetDynamicQParms(BleMvxApplication._config.RFID_DynamicQParms);
+ BleMvxApplication._config.RFID_DynamicQParms.retryCount = 0; // reset to normal
+
+ // Setting 4
+ BleMvxApplication._config.RFID_FixedQParms.retryCount = 5; // for RFMicro special setting
+ BleMvxApplication._reader.rfid.SetFixedQParms(BleMvxApplication._config.RFID_FixedQParms);
+ BleMvxApplication._config.RFID_FixedQParms.retryCount = 0; // reset to normal
+
+ // Setting 2
+ BleMvxApplication._reader.rfid.SetOperationMode(BleMvxApplication._config.RFID_OperationMode);
+ BleMvxApplication._reader.rfid.SetTagGroup(CSLibrary.Constants.Selected.ASSERTED, CSLibrary.Constants.Session.S1, CSLibrary.Constants.SessionTarget.A);
+ BleMvxApplication._reader.rfid.SetCurrentSingulationAlgorithm(BleMvxApplication._config.RFID_Algorithm);
+ BleMvxApplication._reader.rfid.SetCurrentLinkProfile(BleMvxApplication._config.RFID_Profile);
+
+ // Select RFMicro filter
+ {
+ CSLibrary.Structures.SelectCriterion extraSlecetion = new CSLibrary.Structures.SelectCriterion();
+
+ // for ok config
+ extraSlecetion.action = new CSLibrary.Structures.SelectAction(CSLibrary.Constants.Target.SELECTED, CSLibrary.Constants.Action.ASLINVA_DSLINVB, 0);
+ extraSlecetion.mask = new CSLibrary.Structures.SelectMask(CSLibrary.Constants.MemoryBank.TID, 0, 28, new byte[] { 0xe2, 0x82, 0x40, 0x30 });
+ BleMvxApplication._reader.rfid.SetSelectCriteria(0, extraSlecetion);
+
+ extraSlecetion.action = new CSLibrary.Structures.SelectAction(CSLibrary.Constants.Target.SELECTED, CSLibrary.Constants.Action.NOTHING_DSLINVB, 0);
+ extraSlecetion.mask = new CSLibrary.Structures.SelectMask(CSLibrary.Constants.MemoryBank.BANK3, 0xd0, 8, new byte[] { 0x20 });
+ BleMvxApplication._reader.rfid.SetSelectCriteria(1, extraSlecetion);
+
+ BleMvxApplication._reader.rfid.Options.TagRanging.flags |= CSLibrary.Constants.SelectFlags.SELECT;
+ }
+
+ // Multi bank inventory
+ BleMvxApplication._reader.rfid.Options.TagRanging.multibanks = 2;
+ BleMvxApplication._reader.rfid.Options.TagRanging.bank1 = CSLibrary.Constants.MemoryBank.BANK0;
+ BleMvxApplication._reader.rfid.Options.TagRanging.offset1 = 13;
+ BleMvxApplication._reader.rfid.Options.TagRanging.count1 = 2;
+ BleMvxApplication._reader.rfid.Options.TagRanging.bank2 = CSLibrary.Constants.MemoryBank.USER;
+ BleMvxApplication._reader.rfid.Options.TagRanging.offset2 = 8;
+ BleMvxApplication._reader.rfid.Options.TagRanging.count2 = 4;
+ BleMvxApplication._reader.rfid.Options.TagRanging.compactmode = false;
+
+ BleMvxApplication._reader.rfid.StartOperation(CSLibrary.Constants.Operation.TAG_PRERANGING);
+ }
+
+ void StartInventory()
+ {
+ if (_startInventory == false)
+ return;
+
+ //TagInfoList.Clear();
+
+ StartTagCount();
+ //if (BleMvxApplication._config.RFID_OperationMode == CSLibrary.Constants.RadioOperationMode.CONTINUOUS)
+ {
+ _startInventory = false;
+ _startInventoryButtonText = "Stop Inventory";
+ }
+
+ _ListViewRowHeight = 40 + (int)(BleMvxApplication._reader.rfid.Options.TagRanging.multibanks * 10);
+ RaisePropertyChanged(() => ListViewRowHeight);
+
+ // Set second column type
+ {
+ CSLibrary.Structures.SelectCriterion extraSlecetion = new CSLibrary.Structures.SelectCriterion();
+
+ RaisePropertyChanged(() => switchRSSI_TempToggled);
+ RaisePropertyChanged(() => Col2Label);
+
+ if (switchRSSI_TempToggled) // flase = RSSI, true = Temp
+ {
+ // Temp
+ extraSlecetion.action = new CSLibrary.Structures.SelectAction(CSLibrary.Constants.Target.SELECTED, CSLibrary.Constants.Action.ASLINVA_DSLINVB, 0);
+ extraSlecetion.mask = new CSLibrary.Structures.SelectMask(CSLibrary.Constants.MemoryBank.BANK3, 0xe0, 0, new byte[] { 0x00 });
+ BleMvxApplication._reader.rfid.SetSelectCriteria(1, extraSlecetion);
+ }
+ else
+ {
+ // OC RSSI
+ extraSlecetion.action = new CSLibrary.Structures.SelectAction(CSLibrary.Constants.Target.SELECTED, CSLibrary.Constants.Action.NOTHING_DSLINVB, 0);
+ extraSlecetion.mask = new CSLibrary.Structures.SelectMask(CSLibrary.Constants.MemoryBank.BANK3, 0xd0, 8, new byte[] { 0x20 });
+ BleMvxApplication._reader.rfid.SetSelectCriteria(1, extraSlecetion);
+ }
+ }
+
+
+
+ InventoryStartTime = DateTime.Now;
+ BleMvxApplication._reader.rfid.StartOperation(CSLibrary.Constants.Operation.TAG_EXERANGING);
+ ClassBattery.SetBatteryMode(ClassBattery.BATTERYMODE.INVENTORY);
+ _cancelVoltageValue = true;
+
+ RaisePropertyChanged(() => startInventoryButtonText);
+ }
+
+ void StopInventory ()
+ {
+ _startInventory = true;
+ _startInventoryButtonText = "Start Inventory";
+
+ _tagCount = false;
+ BleMvxApplication._reader.rfid.StopOperation();
+ RaisePropertyChanged(() => startInventoryButtonText);
+
+ //BleMvxApplication._reader.rfid.CancelAllSelectCriteria(); // Confirm cancel all filter
+ }
+
+ void StartInventoryClick()
+ {
+ if (_startInventory)
+ {
+ StartInventory();
+ }
+ else
+ {
+ StopInventory();
+ }
+ }
+
+ void StartTagCount()
+ {
+ tagsCount = 0;
+ _tagCount = true;
+
+ // Create a timer that waits one second, then invokes every second.
+ Xamarin.Forms.Device.StartTimer(TimeSpan.FromMilliseconds(1000), () =>
+ {
+ _InventoryTime = (DateTime.Now - InventoryStartTime).TotalSeconds;
+ RaisePropertyChanged(() => InventoryTime);
+
+ _tagCountForAlert = 0;
+
+ _numberOfTagsText = _TagInfoList.Count.ToString() + " tags";
+ RaisePropertyChanged(() => numberOfTagsText);
+
+ _tagPerSecondText = tagsCount.ToString() + " tags/s";
+ RaisePropertyChanged(() => tagPerSecondText);
+ tagsCount = 0;
+
+ if (_tagCount)
+ return true;
+
+ return false;
+ });
+ }
+
+ void StopInventoryClick()
+ {
+ BleMvxApplication._reader.rfid.StopOperation();
+ }
+
+ void TagInventoryEvent(object sender, CSLibrary.Events.OnAsyncCallbackEventArgs e)
+ {
+ if (e.type != CSLibrary.Constants.CallbackType.TAG_RANGING)
+ return;
+
+ InvokeOnMainThread(() =>
+ {
+ _tagCountForAlert++;
+ if (_tagCountForAlert == 1)
+ {
+ if (BleMvxApplication._config.RFID_InventoryAlertSound)
+ {
+ if (_newTagFound)
+ Xamarin.Forms.DependencyService.Get().SystemSound(3);
+ else
+ Xamarin.Forms.DependencyService.Get().SystemSound(2);
+ _newTagFound = false;
+ }
+ }
+ else if (_tagCountForAlert >= 5)
+ _tagCountForAlert = 0;
+
+ AddOrUpdateTagData(e.info);
+ tagsCount++;
+ });
+ }
+
+ void StateChangedEvent(object sender, CSLibrary.Events.OnStateChangedEventArgs e)
+ {
+ //InvokeOnMainThread(() =>
+ //{
+ switch (e.state)
+ {
+ case CSLibrary.Constants.RFState.IDLE:
+ ClassBattery.SetBatteryMode(ClassBattery.BATTERYMODE.IDLE);
+ _cancelVoltageValue = true;
+ switch (BleMvxApplication._reader.rfid.LastMacErrorCode)
+ {
+ case 0x00: // normal end
+ break;
+
+ case 0x0309: //
+ _userDialogs.Alert("Too near to metal, please move CS108 away from metal and start inventory again.");
+ break;
+
+ default:
+ _userDialogs.Alert("Mac error : 0x" + BleMvxApplication._reader.rfid.LastMacErrorCode.ToString("X4"));
+ break;
+ }
+ break;
+ }
+ //});
+ }
+
+ private void AddOrUpdateTagData(CSLibrary.Structures.TagCallbackInfo info)
+ {
+ InvokeOnMainThread(() =>
+ {
+ bool found = false;
+
+ int cnt;
+
+ lock (TagInfoList)
+ {
+ for (cnt = 0; cnt < TagInfoList.Count; cnt++)
+ {
+ if (TagInfoList[cnt].EPC == info.epc.ToString())
+ {
+ TagInfoList[cnt].Bank2Data = CSLibrary.Tools.Hex.ToString(info.Bank2Data);
+ if (_switchRSSI_TempToggled)
+ {
+ UInt64 caldata = (UInt64)(((UInt64)info.Bank2Data[0] << 48) | ((UInt64)info.Bank2Data[1] << 32) | ((UInt64)info.Bank2Data[2] << 16) | ((UInt64)info.Bank2Data[3]));
+ TagInfoList[cnt].Bank1Data = Math.Round(getTemperatue(info.Bank1Data[1], caldata), 2).ToString();
+
+ //TagInfoList[cnt].Bank1Data = info.Bank1Data[0].ToString();
+ }
+ else
+ TagInfoList[cnt].Bank1Data = info.Bank1Data[0].ToString();
+
+ found = true;
+ break;
+ }
+ }
+
+ if (!found)
+ {
+ TagInfoViewModel item = new TagInfoViewModel();
+
+ item.EPC = info.epc.ToString();
+ item.Bank2Data = CSLibrary.Tools.Hex.ToString(info.Bank2Data);
+ if (_switchRSSI_TempToggled)
+ {
+ UInt64 caldata = (UInt64)(((UInt64)info.Bank2Data[0] << 48) | ((UInt64)info.Bank2Data[1] << 32) | ((UInt64)info.Bank2Data[2] << 16) | ((UInt64)info.Bank2Data[3]));
+ item.Bank1Data = Math.Round(getTemperatue(info.Bank1Data[1], caldata), 2).ToString();
+
+ //item.Bank1Data = info.Bank1Data[0].ToString();
+ }
+ else
+ item.Bank1Data = info.Bank1Data[0].ToString();
+
+ TagInfoList.Insert(0, item);
+
+ _newTagFound = true;
+
+ Trace.Message("EPC Data = {0}", item.EPC);
+
+ _newTag = true;
+ }
+ }
+ });
+ }
+
+ double getTemperatue(UInt16 temp, UInt64 CalCode)
+ {
+ int crc = (int)(CalCode >> 48) & 0xffff;
+ int calCode1 = (int)(CalCode >> 36) & 0x0fff;
+ int calTemp1 = (int)(CalCode >> 25) & 0x07ff;
+ int calCode2 = (int)(CalCode >> 13) & 0x0fff;
+ int calTemp2 = (int)(CalCode >> 2) & 0x7FF;
+ int calVer = (int)(CalCode & 0x03);
+
+ double fTemperature = temp;
+ fTemperature = ((double)calTemp2 - (double)calTemp1) * (fTemperature - (double)calCode1);
+ fTemperature /= ((double)(calCode2) - (double)calCode1);
+ fTemperature += (double)calTemp1;
+ fTemperature -= 800;
+ fTemperature /= 10;
+ //textViewTemperatureCode.setText(accessResult.substring(0, 4) + (calVer != -1 ? ("(" + String.format("%.1f", fTemperature) + (char)0x00B0 + "C" + ")") : ""));
+
+ return fTemperature;
+ }
+
+ void VoltageEvent(object sender, CSLibrary.Notification.VoltageEventArgs e)
+ {
+ if (e.Voltage == 0xffff)
+ {
+ _labelVoltage = "CS108 Bat. ERROR"; // 3.98v
+ }
+ else
+ {
+ // to fix CS108 voltage bug
+ if (_cancelVoltageValue)
+ {
+ _cancelVoltageValue = false;
+ return;
+ }
+
+ switch (BleMvxApplication._config.BatteryLevelIndicatorFormat)
+ {
+ case 0:
+ _labelVoltage = "CS108 Bat. " + ((double)e.Voltage / 1000).ToString("0.000") + "v"; // v
+ break;
+
+ default:
+ _labelVoltage = "CS108 Bat. " + ClassBattery.Voltage2Percent((double)e.Voltage / 1000).ToString("0") + "%"; // %
+ break;
+ }
+ }
+
+ RaisePropertyChanged(() => labelVoltage);
+ }
+
+ #region Key_event
+
+ void HotKeys_OnKeyEvent(object sender, CSLibrary.Notification.HotKeyEventArgs e)
+ {
+ if (e.KeyCode == CSLibrary.Notification.Key.BUTTON)
+ {
+ if (e.KeyDown)
+ {
+ StartInventory();
+ }
+ else
+ {
+ StopInventory();
+ }
+ }
+ }
+ #endregion
+
+ async void ShowDialog(string Msg)
+ {
+ var config = new ProgressDialogConfig()
+ {
+ Title = Msg,
+ IsDeterministic = true,
+ MaskType = MaskType.Gradient,
+ };
+
+ using (var progress = _userDialogs.Progress(config))
+ {
+ progress.Show();
+ await System.Threading.Tasks.Task.Delay(1000);
+ }
+ }
+ }
+}
diff --git a/CS108 Demo/Source/BLE.Client/BLE.Client/ViewModels/ViewModelRFMicroReadTemp.cs b/CS108 Demo/Source/BLE.Client/BLE.Client/ViewModels/ViewModelRFMicroReadTemp.cs
new file mode 100755
index 0000000..f1ef96b
--- /dev/null
+++ b/CS108 Demo/Source/BLE.Client/BLE.Client/ViewModels/ViewModelRFMicroReadTemp.cs
@@ -0,0 +1,585 @@
+using System;
+using System.Collections.ObjectModel;
+using System.Collections.Generic;
+using Acr.UserDialogs;
+using MvvmCross.Core.ViewModels;
+using MvvmCross.Platform;
+
+using System.Windows.Input;
+using Xamarin.Forms;
+
+using Plugin.BLE.Abstractions.Contracts;
+
+using Plugin.BLE.Abstractions;
+using Plugin.BLE.Abstractions.Extensions;
+
+namespace BLE.Client.ViewModels
+{
+ public class ViewModelRFMicroReadTemp : BaseViewModel
+ {
+ private readonly IUserDialogs _userDialogs;
+
+ public string entrySelectedEPC { get; set; }
+ public string entrySelectedPWD { get; set; }
+
+ public string entryUpperRSSILimit { get; set; }
+ public string entryLowerRSSILimit { get; set; }
+ public string entryRWTagID { get; set; }
+ public string entryCalibration { get; set; }
+ public string entrySensorCode { get; set; }
+ public string entryRssiCode { get; set; }
+ public string entryTemperatureCode { get; set; }
+
+ public string labelRWTagIDStatus { get; set; } = "";
+ public string labelCalibrationStatus { get; set; } = "";
+ public string labelSensorCodeStatus { get; set; } = "";
+ public string labelRssiCodeStatus { get; set; } = "";
+ public string labelTemperatureCodeStatus { get; set; } = "";
+
+ public Boolean switchRWTagIDIsToggled { get; set; } = false;
+ public Boolean switchCalibrationIsToggled { get; set; } = false;
+ public Boolean switchSensorCodeIsToggled { get; set; } = false;
+ public Boolean switchRssiCodeIsToggled { get; set; } = false;
+ public Boolean switchTemperatureCodeIsToggled { get; set; } = false;
+
+ public string labelOCRSSIText { get; set; }
+ public string labelOCRSSIColor { get; set; }
+
+ public string labelTemperatureText { get; set; }
+
+ public ICommand OnReadButtonCommand { protected set; get; }
+
+ uint readRetryCnt = 0;
+
+ //RFMicro data location
+ const int _setOfData = 8;
+ CSLibrary.Constants.MemoryBank[] _dataBank = new CSLibrary.Constants.MemoryBank[_setOfData];
+ UInt16[] _dataOffset = new ushort[_setOfData];
+ UInt16[] _dataCount = new ushort[_setOfData];
+
+ uint _readProcedure = 0;
+ uint _tagMode = 3;
+ UInt64 _calibrationCode;
+
+
+ public ViewModelRFMicroReadTemp(IAdapter adapter, IUserDialogs userDialogs) : base(adapter)
+ {
+ _userDialogs = userDialogs;
+
+ OnReadButtonCommand = new Command(OnReadButtonButtonClick);
+
+ // RWTagID
+ _dataBank[0] = CSLibrary.Constants.MemoryBank.BANK2; _dataOffset[0] = 0; _dataCount[0] = 2;
+ // Calibration
+ _dataBank[1] = CSLibrary.Constants.MemoryBank.BANK3; _dataOffset[1] = 8; _dataCount[1] = 4;
+ // Sensor Code
+ _dataBank[2] = CSLibrary.Constants.MemoryBank.BANK3; _dataOffset[2] = 11; _dataCount[2] = 1; // for mode 1
+ _dataBank[3] = CSLibrary.Constants.MemoryBank.BANK0; _dataOffset[3] = 11; _dataCount[3] = 1; // for mode 2
+ _dataBank[4] = CSLibrary.Constants.MemoryBank.BANK0; _dataOffset[4] = 12; _dataCount[4] = 1; // for mode 3
+ // Rssi Code
+ _dataBank[5] = CSLibrary.Constants.MemoryBank.BANK3; _dataOffset[5] = 9; _dataCount[5] = 1; // for mode 1
+ _dataBank[6] = CSLibrary.Constants.MemoryBank.BANK0; _dataOffset[6] = 13; _dataCount[6] = 1; // for mode 2/3
+ //Temperature Code
+ _dataBank[7] = CSLibrary.Constants.MemoryBank.BANK0; _dataOffset[7] = 14; _dataCount[7] = 1;
+ }
+
+ public override void Resume()
+ {
+ base.Resume();
+ BleMvxApplication._reader.rfid.OnAccessCompleted += new EventHandler(TagCompletedEvent);
+ }
+
+ public override void Suspend()
+ {
+ BleMvxApplication._reader.rfid.OnAccessCompleted -= new EventHandler(TagCompletedEvent);
+ base.Suspend();
+ }
+
+ protected override void InitFromBundle(IMvxBundle parameters)
+ {
+ base.InitFromBundle(parameters);
+
+ entrySelectedEPC = BleMvxApplication._SELECT_EPC;
+ entrySelectedPWD = "00000000";
+
+ entryUpperRSSILimit = "21";
+ entryLowerRSSILimit = "13";
+
+ RaisePropertyChanged(() => entryUpperRSSILimit);
+ RaisePropertyChanged(() => entryLowerRSSILimit);
+ RaisePropertyChanged(() => entrySelectedEPC);
+ RaisePropertyChanged(() => entrySelectedPWD);
+
+ switchRWTagIDIsToggled = true;
+ switchCalibrationIsToggled = true;
+ switchSensorCodeIsToggled = true;
+ switchRssiCodeIsToggled = true;
+ switchTemperatureCodeIsToggled = true;
+
+ labelOCRSSIColor = "Black";
+
+ RaisePropertyChanged(() => switchRWTagIDIsToggled);
+ RaisePropertyChanged(() => switchCalibrationIsToggled);
+ RaisePropertyChanged(() => switchSensorCodeIsToggled);
+ RaisePropertyChanged(() => switchRssiCodeIsToggled);
+ RaisePropertyChanged(() => switchTemperatureCodeIsToggled);
+ }
+
+ void TagCompletedEvent(object sender, CSLibrary.Events.OnAccessCompletedEventArgs e)
+ {
+ if (e.access == CSLibrary.Constants.TagAccess.READ)
+ {
+ if (e.bank == CSLibrary.Constants.Bank.SPECIFIC)
+ {
+ if (!e.success)
+ {
+ if (--readRetryCnt > 0)
+ {
+ BleMvxApplication._reader.rfid.StartOperation(CSLibrary.Constants.Operation.TAG_READ);
+ return;
+ }
+ }
+
+ switch (_readProcedure)
+ {
+ case 0:
+ if (e.success)
+ {
+ entryRWTagID = BleMvxApplication._reader.rfid.Options.TagRead.pData.ToString();
+ RaisePropertyChanged(() => entryRWTagID);
+ labelRWTagIDStatus = "Ok";
+ RaisePropertyChanged(() => labelRWTagIDStatus);
+ }
+ else
+ {
+ labelRWTagIDStatus = "Er";
+ RaisePropertyChanged(() => labelRWTagIDStatus);
+ }
+ break;
+ case 1:
+ if (e.success)
+ {
+ entryCalibration = BleMvxApplication._reader.rfid.Options.TagRead.pData.ToString();
+ RaisePropertyChanged(() => entryCalibration);
+ labelCalibrationStatus = "Ok";
+ RaisePropertyChanged(() => labelCalibrationStatus);
+ {
+ UInt16 [] cal = BleMvxApplication._reader.rfid.Options.TagRead.pData.ToUshorts();
+ _calibrationCode = (UInt64)(((UInt64)cal[0] << 48) | ((UInt64)cal[1] << 32) | ((UInt64)cal[2] << 16) | ((UInt64)cal[3]));
+ }
+ }
+ else
+ {
+ labelCalibrationStatus = "Er";
+ RaisePropertyChanged(() => labelCalibrationStatus);
+ }
+ break;
+ case 2:
+ if (e.success)
+ {
+ entrySensorCode = BleMvxApplication._reader.rfid.Options.TagRead.pData.ToString();
+ RaisePropertyChanged(() => entrySensorCode);
+ labelSensorCodeStatus = "Ok";
+ RaisePropertyChanged(() => labelSensorCodeStatus);
+ }
+ else
+ {
+ labelSensorCodeStatus = "Er";
+ RaisePropertyChanged(() => labelSensorCodeStatus);
+ }
+ break;
+ case 3:
+ if (e.success)
+ {
+ entryRssiCode = BleMvxApplication._reader.rfid.Options.TagRead.pData.ToString();
+ RaisePropertyChanged(() => entryRssiCode);
+ labelRssiCodeStatus = "Ok";
+ RaisePropertyChanged(() => labelRssiCodeStatus);
+
+ {
+ UInt16 rssi = BleMvxApplication._reader.rfid.Options.TagRead.pData.ToUshorts()[0];
+ labelOCRSSIText = rssi.ToString("D");
+
+ try
+ {
+ if (rssi < UInt16.Parse(entryLowerRSSILimit) || rssi > UInt16.Parse(entryUpperRSSILimit))
+ labelOCRSSIColor = "Red";
+ else
+ labelOCRSSIColor = "Black";
+ }
+ catch (Exception ex)
+ {
+ labelOCRSSIColor = "Blue";
+ }
+
+ RaisePropertyChanged(() => labelOCRSSIText);
+ RaisePropertyChanged(() => labelOCRSSIColor);
+ }
+ }
+ else
+ {
+ labelRssiCodeStatus = "Er";
+ RaisePropertyChanged(() => labelRssiCodeStatus);
+ }
+ break;
+ case 4:
+ if (e.success)
+ {
+ UInt16 [] var = BleMvxApplication._reader.rfid.Options.TagRead.pData.ToUshorts();
+
+ entryTemperatureCode = BleMvxApplication._reader.rfid.Options.TagRead.pData.ToString();
+ RaisePropertyChanged(() => entryTemperatureCode);
+ labelTemperatureCodeStatus = "Ok";
+ RaisePropertyChanged(() => labelTemperatureCodeStatus);
+ RaisePropertyChanged(() => labelTemperatureText);
+
+ double temperatue = Math.Round(getTemperatue(var[0], _calibrationCode), 2);
+
+ labelTemperatureText = temperatue.ToString() + " C";
+ RaisePropertyChanged(() => labelTemperatureText);
+ }
+ else
+ {
+ labelTemperatureCodeStatus = "Er";
+ RaisePropertyChanged(() => labelTemperatureCodeStatus);
+ }
+ break;
+ }
+
+ ReadNextData();
+ }
+ }
+ }
+
+ void ReadNextData ()
+ {
+ if (_readProcedure >= 5)
+ {
+ BleMvxApplication._reader.rfid.CancelAllSelectCriteria(); // Confirm cancel all filter
+ return;
+ }
+
+ _readProcedure++;
+ if (SetParameters())
+ BleMvxApplication._reader.rfid.StartOperation(CSLibrary.Constants.Operation.TAG_READ);
+ }
+
+ void StartReadData ()
+ {
+ _readProcedure = 0;
+ if (SetParameters())
+ BleMvxApplication._reader.rfid.StartOperation(CSLibrary.Constants.Operation.TAG_READ);
+ }
+
+ bool SetParameters ()
+ {
+ switch (_readProcedure)
+ {
+ case 0: //
+ if (!switchRWTagIDIsToggled)
+ {
+ _readProcedure++;
+ return SetParameters();
+ }
+ BleMvxApplication._reader.rfid.Options.TagRead.bank = (CSLibrary.Constants.MemoryBank)_dataBank[0];
+ BleMvxApplication._reader.rfid.Options.TagRead.offset = _dataOffset[0];
+ BleMvxApplication._reader.rfid.Options.TagRead.count = _dataCount[0];
+ BleMvxApplication._reader.rfid.StartOperation(CSLibrary.Constants.Operation.TAG_SELECTED);
+ BleMvxApplication._reader.rfid.SetSelectCriteria(1, null);
+ break;
+ case 1:
+ if (!switchCalibrationIsToggled)
+ {
+ _readProcedure++;
+ return SetParameters();
+ }
+ BleMvxApplication._reader.rfid.Options.TagRead.bank = _dataBank[1];
+ BleMvxApplication._reader.rfid.Options.TagRead.offset = _dataOffset[1];
+ BleMvxApplication._reader.rfid.Options.TagRead.count = _dataCount[1];
+ BleMvxApplication._reader.rfid.StartOperation(CSLibrary.Constants.Operation.TAG_SELECTED);
+ BleMvxApplication._reader.rfid.SetSelectCriteria(1, null);
+ break;
+ case 2:
+ if (!switchSensorCodeIsToggled)
+ {
+ _readProcedure++;
+ return SetParameters();
+ }
+ BleMvxApplication._reader.rfid.Options.TagRead.bank = _dataBank[_tagMode + 1];
+ BleMvxApplication._reader.rfid.Options.TagRead.offset = _dataOffset[_tagMode + 1];
+ BleMvxApplication._reader.rfid.Options.TagRead.count = _dataCount[_tagMode + 1];
+ {
+ BleMvxApplication._reader.rfid.StartOperation(CSLibrary.Constants.Operation.TAG_SELECTED);
+ BleMvxApplication._reader.rfid.SetTagGroup(CSLibrary.Constants.Selected.ASSERTED, CSLibrary.Constants.Session.S1, CSLibrary.Constants.SessionTarget.A); // better for read rangage
+
+ CSLibrary.Structures.SelectCriterion extraSlecetion = new CSLibrary.Structures.SelectCriterion();
+
+ extraSlecetion.action = new CSLibrary.Structures.SelectAction(CSLibrary.Constants.Target.SELECTED, CSLibrary.Constants.Action.ASLINVA_DSLINVB, 0);
+ extraSlecetion.mask = new CSLibrary.Structures.SelectMask(CSLibrary.Constants.MemoryBank.BANK3, 0xe0, 0, new byte[1]);
+ BleMvxApplication._reader.rfid.SetSelectCriteria(0, extraSlecetion);
+
+ extraSlecetion.action = new CSLibrary.Structures.SelectAction(CSLibrary.Constants.Target.SELECTED, CSLibrary.Constants.Action.ASLINVA_DSLINVB, 0);
+ extraSlecetion.mask = new CSLibrary.Structures.SelectMask(CSLibrary.Constants.MemoryBank.EPC, 0x20, 0x60, CSLibrary.Tools.Hex.ToBytes(entrySelectedEPC));
+ BleMvxApplication._reader.rfid.SetSelectCriteria(1, extraSlecetion);
+ }
+ break;
+ case 3:
+ if (!switchRssiCodeIsToggled)
+ {
+ _readProcedure++;
+ return SetParameters();
+ }
+ if (_tagMode == 1)
+ {
+ BleMvxApplication._reader.rfid.Options.TagRead.bank = _dataBank[5];
+ BleMvxApplication._reader.rfid.Options.TagRead.offset = _dataOffset[5];
+ BleMvxApplication._reader.rfid.Options.TagRead.count = _dataCount[5];
+ }
+ else
+ {
+ BleMvxApplication._reader.rfid.Options.TagRead.bank = _dataBank[6];
+ BleMvxApplication._reader.rfid.Options.TagRead.offset = _dataOffset[6];
+ BleMvxApplication._reader.rfid.Options.TagRead.count = _dataCount[6];
+ }
+ {
+ BleMvxApplication._reader.rfid.StartOperation(CSLibrary.Constants.Operation.TAG_SELECTED);
+ BleMvxApplication._reader.rfid.SetTagGroup(CSLibrary.Constants.Selected.ASSERTED, CSLibrary.Constants.Session.S1, CSLibrary.Constants.SessionTarget.A); // better for read rangage
+
+ CSLibrary.Structures.SelectCriterion extraSlecetion = new CSLibrary.Structures.SelectCriterion();
+
+ extraSlecetion.action = new CSLibrary.Structures.SelectAction(CSLibrary.Constants.Target.SELECTED, CSLibrary.Constants.Action.ASLINVA_DSLINVB, 0);
+ extraSlecetion.mask = new CSLibrary.Structures.SelectMask(CSLibrary.Constants.MemoryBank.BANK3, 0xd0, 8, new byte[] { 0x20 });
+ BleMvxApplication._reader.rfid.SetSelectCriteria(0, extraSlecetion);
+
+ extraSlecetion.action = new CSLibrary.Structures.SelectAction(CSLibrary.Constants.Target.SELECTED, CSLibrary.Constants.Action.ASLINVA_DSLINVB, 0);
+ extraSlecetion.mask = new CSLibrary.Structures.SelectMask(CSLibrary.Constants.MemoryBank.EPC, 0x20, 0x60, CSLibrary.Tools.Hex.ToBytes(entrySelectedEPC));
+
+ BleMvxApplication._reader.rfid.SetSelectCriteria(1, extraSlecetion);
+ }
+
+ break;
+ case 4:
+ if (!switchTemperatureCodeIsToggled)
+ {
+ _readProcedure++;
+ return SetParameters();
+ }
+ BleMvxApplication._reader.rfid.Options.TagRead.bank = _dataBank[7];
+ BleMvxApplication._reader.rfid.Options.TagRead.offset = _dataOffset[7];
+ BleMvxApplication._reader.rfid.Options.TagRead.count = _dataCount[7];
+
+ {
+ BleMvxApplication._reader.rfid.StartOperation(CSLibrary.Constants.Operation.TAG_SELECTED);
+ BleMvxApplication._reader.rfid.SetTagGroup(CSLibrary.Constants.Selected.ASSERTED, CSLibrary.Constants.Session.S1, CSLibrary.Constants.SessionTarget.A);// better for read rangage
+
+ CSLibrary.Structures.SelectCriterion extraSlecetion = new CSLibrary.Structures.SelectCriterion();
+
+ extraSlecetion.action = new CSLibrary.Structures.SelectAction(CSLibrary.Constants.Target.SELECTED, CSLibrary.Constants.Action.ASLINVA_DSLINVB, 0);
+ extraSlecetion.mask = new CSLibrary.Structures.SelectMask(CSLibrary.Constants.MemoryBank.BANK3, 0xe0, 0, new byte[] { 0x00 });
+ BleMvxApplication._reader.rfid.SetSelectCriteria(0, extraSlecetion);
+
+ extraSlecetion.action = new CSLibrary.Structures.SelectAction(CSLibrary.Constants.Target.SELECTED, CSLibrary.Constants.Action.ASLINVA_DSLINVB, 0);
+ extraSlecetion.mask = new CSLibrary.Structures.SelectMask(CSLibrary.Constants.MemoryBank.EPC, 0x20, 0x60, CSLibrary.Tools.Hex.ToBytes(entrySelectedEPC));
+ BleMvxApplication._reader.rfid.SetSelectCriteria(1, extraSlecetion);
+ }
+ break;
+ default:
+ BleMvxApplication._reader.rfid.CancelAllSelectCriteria(); // Confirm cancel all filter
+ return false;
+ break;
+ }
+
+ readRetryCnt = 7;
+ return true;
+ }
+
+ System.Threading.CancellationTokenSource cancelSrc;
+
+ void OnReadButtonButtonClick()
+ {
+ Xamarin.Forms.DependencyService.Get().SystemSound(1);
+
+ RaisePropertyChanged(() => entrySelectedEPC);
+ RaisePropertyChanged(() => entrySelectedPWD);
+
+ RaisePropertyChanged(() => switchRWTagIDIsToggled);
+ RaisePropertyChanged(() => switchCalibrationIsToggled);
+ RaisePropertyChanged(() => switchSensorCodeIsToggled);
+ RaisePropertyChanged(() => switchRssiCodeIsToggled);
+ RaisePropertyChanged(() => switchTemperatureCodeIsToggled);
+
+ BleMvxApplication._reader.rfid.Options.TagRead.accessPassword = Convert.ToUInt32(entrySelectedPWD, 16);
+
+
+ if (BleMvxApplication._reader.rfid.State != CSLibrary.Constants.RFState.IDLE)
+ {
+ //MessageBox.Show("Reader is busy now, please try later.");
+ return;
+ }
+
+ BleMvxApplication._reader.rfid.Options.TagSelected.epcMask = new CSLibrary.Structures.S_MASK(/*m_record.pc.ToString() + */entrySelectedEPC);
+ BleMvxApplication._reader.rfid.Options.TagSelected.flags = CSLibrary.Constants.SelectMaskFlags.ENABLE_TOGGLE;
+ BleMvxApplication._reader.rfid.Options.TagSelected.epcMaskOffset = 0;
+ BleMvxApplication._reader.rfid.Options.TagSelected.epcMaskLength = (uint)BleMvxApplication._reader.rfid.Options.TagSelected.epcMask.Length * 8;
+ //BleMvxApplication._reader.rfid.StartOperation(CSLibrary.Constants.Operation.TAG_SELECTED);
+
+ if (switchRWTagIDIsToggled)
+ {
+ labelRWTagIDStatus = "R";
+ RaisePropertyChanged(() => labelRWTagIDStatus);
+ }
+
+ if (switchCalibrationIsToggled)
+ {
+ labelCalibrationStatus = "R";
+ RaisePropertyChanged(() => labelCalibrationStatus);
+ }
+
+ if (switchSensorCodeIsToggled)
+ {
+ labelSensorCodeStatus = "R";
+ RaisePropertyChanged(() => labelSensorCodeStatus);
+ }
+
+ if (switchRssiCodeIsToggled)
+ {
+ labelRssiCodeStatus = "R";
+ RaisePropertyChanged(() => labelRssiCodeStatus);
+ }
+
+ if (switchTemperatureCodeIsToggled)
+ {
+ labelTemperatureCodeStatus = "R";
+ RaisePropertyChanged(() => labelTemperatureCodeStatus);
+ }
+
+ _readProcedure = 0;
+
+ if (SetParameters())
+ BleMvxApplication._reader.rfid.StartOperation(CSLibrary.Constants.Operation.TAG_READ);
+ }
+
+ async void ShowDialog(string Msg)
+ {
+ var config = new ProgressDialogConfig()
+ {
+ Title = Msg,
+ IsDeterministic = true,
+ MaskType = MaskType.Gradient,
+ };
+
+ using (var progress = _userDialogs.Progress(config))
+ {
+ progress.Show();
+ await System.Threading.Tasks.Task.Delay(3000);
+ }
+ }
+
+
+ /*
+ String getTemperatue(String stringInput)
+ {
+ byte bValue = Byte.parseByte(stringInput.substring(0, 1), 16);
+ byte bValue2 = Byte.parseByte(stringInput.substring(1, 2), 16); bValue2 <<= 4;
+ byte bValue3 = Byte.parseByte(stringInput.substring(2, 3), 16); bValue2 |= bValue3;
+ String stringValue = "";
+ if ((bValue & 0x01) != 0) { stringValue = "-"; bValue2 ^= 0xFF; if (bValue2 != 0xFF) bValue2++; }
+ stringValue += String.valueOf((bValue2 & 0xFF) >> 2);
+ switch (bValue2 & 0x03)
+ {
+ case 1:
+ stringValue += ".25";
+ break;
+ case 2:
+ stringValue += ".50";
+ break;
+ case 3:
+ stringValue += ".75";
+ break;
+ }
+ return stringValue;
+
+ }
+
+ boolean setCalibrationVersion(String strUser) {
+ if (strUser == null) return false;
+ if (strUser.length() < 16) return false;
+ int crc = Integer.parseInt(strUser.substring(0, 4), 16);
+ calCode1 = Integer.parseInt(strUser.substring(4, 7), 16);
+ calTemp1 = Integer.parseInt(strUser.substring(7, 10), 16); calTemp1 >>= 1;
+ calCode2 = Integer.parseInt(strUser.substring(9, 13), 16); calCode2 >>= 1; calCode2 &= 0xFFF;
+ calTemp2 = Integer.parseInt(strUser.substring(12, 16), 16); calTemp2 >>= 2; calTemp2 &= 0x7FF;
+ calVer = Integer.parseInt(strUser.substring(15, 16),16); calVer &= 0x3;
+ MainActivity.mCs108Library4a.appendToLog("crc = " + crc + ", code1 = " + calCode1 + ", temp1 = " + calTemp1 + ", code2 = " + calCode2 + ", temp2 = " + calTemp2 + ", ver = " + calVer);
+ textViewCalibrationVersion.setText(strUser); //String.valueOf(calVer)
+ return true;
+ }
+
+ if (accessResult.length() >= 4) {
+ float fTemperature = Integer.parseInt(accessResult.substring(0,4), 16);
+ fTemperature = ((float)calTemp2 - (float)calTemp1) * (fTemperature - (float) calCode1);
+ fTemperature /= ((float) (calCode2) - (float)calCode1);
+ fTemperature += (float) calTemp1;
+ fTemperature -= 800;
+ fTemperature /= 10;
+ textViewTemperatureCode.setText(accessResult.substring(0,4) + (calVer != -1 ? ("(" + String.format("%.1f", fTemperature) + (char) 0x00B0 + "C" + ")") : ""));
+ }
+
+
+ */
+
+ double getTemperatue(UInt16 temp, UInt64 CalCode)
+ {
+ int crc = (int)(CalCode >> 48) & 0xffff;
+ int calCode1 = (int)(CalCode >> 36) & 0x0fff;
+ int calTemp1 = (int)(CalCode >> 25) & 0x07ff;
+ int calCode2 = (int)(CalCode >> 13) & 0x0fff;
+ int calTemp2 = (int)(CalCode >> 2) & 0x7FF;
+ int calVer = (int)(CalCode & 0x03);
+
+ double fTemperature = temp;
+ fTemperature = ((double)calTemp2 - (double)calTemp1) * (fTemperature - (double)calCode1);
+ fTemperature /= ((double)(calCode2) - (double)calCode1);
+ fTemperature += (double)calTemp1;
+ fTemperature -= 800;
+ fTemperature /= 10;
+ //textViewTemperatureCode.setText(accessResult.substring(0, 4) + (calVer != -1 ? ("(" + String.format("%.1f", fTemperature) + (char)0x00B0 + "C" + ")") : ""));
+
+ return fTemperature;
+ }
+
+ /*
+ double getTemperatue_old(UInt16 temp)
+ {
+ double readableTemp = 0;
+
+ byte bValue = (byte)(temp >> 16);
+ byte bValue2 = (byte)(temp >> 8); bValue2 <<= 4;
+ byte bValue3 = (byte)(temp); bValue2 |= bValue3;
+
+ if ((bValue & 0x01) != 0)
+ {
+ double absTemp;
+
+ bValue2 ^= 0xFF;
+ if (bValue2 != 0xFF)
+ bValue2++;
+
+ absTemp = bValue2 >> 2;
+ absTemp += (bValue2 & 0x03) * 0.25;
+
+ readableTemp = 0 - absTemp;
+ }
+ else
+ {
+ readableTemp = bValue2 >> 2;
+ readableTemp += (bValue2 & 0x03) * 0.25;
+ }
+
+ return readableTemp;
+ }
+ */
+
+
+ }
+}
diff --git a/CS108 Demo/Source/BLE.Client/BLE.Client/ViewModels/ViewModelReadWrite.cs b/CS108 Demo/Source/BLE.Client/BLE.Client/ViewModels/ViewModelReadWrite.cs
index 27dae01..eddcc5d 100755
--- a/CS108 Demo/Source/BLE.Client/BLE.Client/ViewModels/ViewModelReadWrite.cs
+++ b/CS108 Demo/Source/BLE.Client/BLE.Client/ViewModels/ViewModelReadWrite.cs
@@ -485,13 +485,7 @@ void OnReadButtonButtonClick()
//BleMvxApplication._reader.rfid.StartOperation(CSLibrary.Constants.Operation.TAG_RANGING);
- if (entrySelectedEPC.Length > 64)
- {
- //MessageBox.Show("EPC too long, only selecte first 256 bit");
- BleMvxApplication._reader.rfid.Options.TagSelected.epcMask = new CSLibrary.Structures.S_MASK(/*m_record.pc.ToString() + */entrySelectedEPC.Substring(0, 64));
- }
- else
- BleMvxApplication._reader.rfid.Options.TagSelected.epcMask = new CSLibrary.Structures.S_MASK(/*m_record.pc.ToString() + */entrySelectedEPC);
+ BleMvxApplication._reader.rfid.Options.TagSelected.epcMask = new CSLibrary.Structures.S_MASK(/*m_record.pc.ToString() + */entrySelectedEPC);
BleMvxApplication._reader.rfid.Options.TagSelected.flags = CSLibrary.Constants.SelectMaskFlags.ENABLE_TOGGLE;
BleMvxApplication._reader.rfid.Options.TagSelected.epcMaskOffset = 0;
@@ -626,13 +620,7 @@ void OnWriteButtonButtonClick()
return;
}
- if (entrySelectedEPC.Length > 64)
- {
- //MessageBox.Show("EPC too long, only selecte first 256 bit");
- BleMvxApplication._reader.rfid.Options.TagSelected.epcMask = new CSLibrary.Structures.S_MASK(/*m_record.pc.ToString() + */entrySelectedEPC.Substring(0, 64));
- }
- else
- BleMvxApplication._reader.rfid.Options.TagSelected.epcMask = new CSLibrary.Structures.S_MASK(/*m_record.pc.ToString() + */entrySelectedEPC);
+ BleMvxApplication._reader.rfid.Options.TagSelected.epcMask = new CSLibrary.Structures.S_MASK(/*m_record.pc.ToString() + */entrySelectedEPC);
BleMvxApplication._reader.rfid.Options.TagSelected.flags = CSLibrary.Constants.SelectMaskFlags.ENABLE_TOGGLE;
BleMvxApplication._reader.rfid.Options.TagSelected.epcMaskOffset = 0;
diff --git a/CS108 Demo/Source/BLE.Client/BLE.Client/ViewModels/ViewModelSecurity.cs b/CS108 Demo/Source/BLE.Client/BLE.Client/ViewModels/ViewModelSecurity.cs
index 0fbb83d..66e4563 100755
--- a/CS108 Demo/Source/BLE.Client/BLE.Client/ViewModels/ViewModelSecurity.cs
+++ b/CS108 Demo/Source/BLE.Client/BLE.Client/ViewModels/ViewModelSecurity.cs
@@ -106,13 +106,7 @@ void OnApplyButtonClicked()
return;
}
- if (entrySelectedEPC.Length > 64)
- {
- //MessageBox.Show("EPC too long, only selecte first 256 bit");
- BleMvxApplication._reader.rfid.Options.TagSelected.epcMask = new CSLibrary.Structures.S_MASK(/*m_record.pc.ToString() + */entrySelectedEPC.Substring(0, 64));
- }
- else
- BleMvxApplication._reader.rfid.Options.TagSelected.epcMask = new CSLibrary.Structures.S_MASK(/*m_record.pc.ToString() + */entrySelectedEPC);
+ BleMvxApplication._reader.rfid.Options.TagSelected.epcMask = new CSLibrary.Structures.S_MASK(/*m_record.pc.ToString() + */entrySelectedEPC);
BleMvxApplication._reader.rfid.Options.TagSelected.flags = CSLibrary.Constants.SelectMaskFlags.DISABLE_ALL;
BleMvxApplication._reader.rfid.Options.TagSelected.epcMaskOffset = 0;
diff --git a/CS108 Demo/Source/BLE.Client/BLE.Client/ViewModels/ViewModelSpecialFunctionsMenu.cs b/CS108 Demo/Source/BLE.Client/BLE.Client/ViewModels/ViewModelSpecialFunctionsMenu.cs
index a916c4a..bc69749 100755
--- a/CS108 Demo/Source/BLE.Client/BLE.Client/ViewModels/ViewModelSpecialFunctionsMenu.cs
+++ b/CS108 Demo/Source/BLE.Client/BLE.Client/ViewModels/ViewModelSpecialFunctionsMenu.cs
@@ -20,6 +20,8 @@ public class ViewModelSpecialFunctionsMenu : BaseViewModel
public ICommand OnPhaseChannelInventoryButtonCommand { protected set; get; }
public ICommand OnPeriodicReadButtonCommand { protected set; get; }
public ICommand OnUCODEDNAButtonCommand { protected set; get; }
+ public ICommand OnRFMicroButtonCommand { protected set; get; }
+
public ViewModelSpecialFunctionsMenu (IAdapter adapter, IUserDialogs userDialogs) : base(adapter)
{
@@ -29,6 +31,7 @@ public ViewModelSpecialFunctionsMenu (IAdapter adapter, IUserDialogs userDialogs
OnPhaseChannelInventoryButtonCommand = new Command(OnPhaseChannelInventoryButtonClicked);
OnPeriodicReadButtonCommand = new Command(OnPeriodicReadButtonClicked);
OnUCODEDNAButtonCommand = new Command(OnUCODEDNAButtonClicked);
+ OnRFMicroButtonCommand = new Command(OnRFMicroButtonClicked);
}
void OnMultiBankInventoryButtonClicked()
@@ -51,5 +54,10 @@ void OnUCODEDNAButtonClicked()
ShowViewModel(new MvxBundle());
}
+ void OnRFMicroButtonClicked()
+ {
+ ShowViewModel(new MvxBundle());
+ }
+
}
}
diff --git a/CSLibrary/CSLibrary-DESKTOP.csproj b/CSLibrary/CSLibrary-DESKTOP.csproj
index dfc52d3..644de8b 100755
--- a/CSLibrary/CSLibrary-DESKTOP.csproj
+++ b/CSLibrary/CSLibrary-DESKTOP.csproj
@@ -11,6 +11,8 @@
CSLibrary
v4.6.1
512
+
+
true
@@ -99,7 +101,6 @@
-
diff --git a/CSLibrary/CSLibrary/RFIDReader/ClassRFID.Private.Inventory.cs b/CSLibrary/CSLibrary/RFIDReader/ClassRFID.Private.Inventory.cs
index 8eebb09..66f9241 100755
--- a/CSLibrary/CSLibrary/RFIDReader/ClassRFID.Private.Inventory.cs
+++ b/CSLibrary/CSLibrary/RFIDReader/ClassRFID.Private.Inventory.cs
@@ -110,8 +110,10 @@ private void PreTagRangingThreadProc()
// Set MultiBanks Info
MacReadRegister(MACREGISTER.HST_INV_CFG, ref Value);
- Value &= 0xfff4fcff;
+ Value &= 0xfff0fcff;
+
Value |= (1 << 18); // enable CRC checking
+
if (m_rdr_opt_parms.TagRanging.multibanks != 0)
Value |= (m_rdr_opt_parms.TagRanging.multibanks & (uint)0x03) << 16;
diff --git a/CSLibrary/CSLibrary/RFIDReader/ClassRFID.Private.Select.cs b/CSLibrary/CSLibrary/RFIDReader/ClassRFID.Private.Select.cs
index 45c3f64..0dcddb6 100755
--- a/CSLibrary/CSLibrary/RFIDReader/ClassRFID.Private.Select.cs
+++ b/CSLibrary/CSLibrary/RFIDReader/ClassRFID.Private.Select.cs
@@ -107,7 +107,6 @@ private void TagSelectedDYNQ()
(m_rdr_opt_parms.TagSelected.flags & CSLibrary.Constants.SelectMaskFlags.ENABLE_NON_MATCH) == CSLibrary.Constants.SelectMaskFlags.ENABLE_NON_MATCH ?
CSLibrary.Constants.Action.DSLINVB_ASLINVA : CSLibrary.Constants.Action.ASLINVA_DSLINVB, 0);
-
if (m_rdr_opt_parms.TagSelected.bank == CSLibrary.Constants.MemoryBank.EPC)
{
sel[0].mask = new CSLibrary.Structures.SelectMask(
diff --git a/CSLibrary/CSLibrary/RFIDReader/ClassRFID.cs b/CSLibrary/CSLibrary/RFIDReader/ClassRFID.cs
index 9411203..2e41619 100755
--- a/CSLibrary/CSLibrary/RFIDReader/ClassRFID.cs
+++ b/CSLibrary/CSLibrary/RFIDReader/ClassRFID.cs
@@ -1434,7 +1434,6 @@ public Result SetSelectCriteria(SelectCriterion[] critlist)
SC.countCriteria = (uint)critlist.Length;
SC.pCriteria = (SelectCriterion[])critlist.Clone();
-
index = 0;
{
SelectCriterion pCriterion = SC.pCriteria[index];
@@ -1477,6 +1476,72 @@ public Result SetSelectCriteria(SelectCriterion[] critlist)
return m_Result;
}
+ public Result SetSelectCriteria(uint index, SelectCriterion crit)
+ {
+ uint registerValue;
+
+ // Instruct the MAC as to which select mask we want to work with
+ MacWriteRegister(MACREGISTER.HST_TAGMSK_DESC_SEL, index);
+
+ if (crit == null)
+ {
+ MacWriteRegister(MACREGISTER.HST_TAGMSK_DESC_CFG, 0x0000);
+ //MacWriteRegister(MACREGISTER.HST_TAGMSK_BANK, 0x0000);
+ //MacWriteRegister(MACREGISTER.HST_TAGMSK_PTR, 0x0000);
+ //MacWriteRegister(MACREGISTER.HST_TAGMSK_LEN, 0x0000);
+ return Result.OK;
+ }
+
+ try
+ {
+ {
+ SelectCriterion pCriterion = crit;
+ SelectMask pMask = pCriterion.mask;
+ SelectAction pAction = pCriterion.action;
+
+ // Create the HST_TAGMSK_DESC_CFG register value and write it to the MAC
+ registerValue = (0x01 |
+ (((uint)(pAction.target) & 0x07) << 1) |
+ (((uint)(pAction.action) & 0x07) << 4) |
+ (pAction.enableTruncate != 0x00 ? (uint)(1 << 7) : 0));
+ MacWriteRegister(MACREGISTER.HST_TAGMSK_DESC_CFG, registerValue);
+
+ // Create the HST_TAGMSK_BANK register value and write it to the MAC
+ registerValue = (uint)pMask.bank;
+ MacWriteRegister(MACREGISTER.HST_TAGMSK_BANK, registerValue);
+
+ // Write the mask offset to the HST_TAGMSK_PTR register
+ MacWriteRegister(MACREGISTER.HST_TAGMSK_PTR, (uint)pMask.offset);
+
+ // Create the HST_TAGMSK_LEN register and write it to the MAC
+ registerValue = (uint)(pMask.count);
+ MacWriteRegister(MACREGISTER.HST_TAGMSK_LEN, registerValue);
+
+ // Now write the MAC's mask registers
+ WriteMacMaskRegisters((ushort)MACREGISTER.HST_TAGMSK_0_3, pMask.count, pMask.mask);
+ // Set up the selection criteria
+ }
+ }
+ catch (System.Exception ex)
+ {
+#if DEBUG
+ // CSLibrary.Diagnostics.CoreDebug.Logger.ErrorException("HighLevelInterface.SetSelectCriteria()", ex);
+#endif
+ return Result.SYSTEM_CATCH_EXCEPTION;
+ }
+ return m_Result;
+ }
+
+ public Result CancelAllSelectCriteria()
+ {
+ for (uint cnt = 0; cnt < 7; cnt++)
+ {
+ SetSelectCriteria(cnt, null);
+ }
+
+ return Result.OK;
+ }
+
/* public Result SetSelectCriteria(SelectCriterion[] critlist)
{
uint index;
diff --git a/CSLibrary/Properties/AssemblyInfo.cs b/CSLibrary/Properties/AssemblyInfo.cs
index b93b45e..2d09113 100755
--- a/CSLibrary/Properties/AssemblyInfo.cs
+++ b/CSLibrary/Properties/AssemblyInfo.cs
@@ -27,5 +27,5 @@
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.2.0")]
-[assembly: AssemblyVersion("2.0.13.0")]
-[assembly: AssemblyFileVersion("2.0.13.0")]
+[assembly: AssemblyVersion("2.0.14.0")]
+[assembly: AssemblyFileVersion("2.0.14.0")]