Skip to content

Commit

Permalink
持续改进 UHF 功能。发布正式版
Browse files Browse the repository at this point in the history
  • Loading branch information
DigitalPlatform committed Dec 8, 2023
1 parent cd2c3a1 commit 253fbed
Show file tree
Hide file tree
Showing 16 changed files with 204 additions and 101 deletions.
2 changes: 0 additions & 2 deletions DigitalPlatform.LibraryServer/AppCirculation.cs
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,6 @@
using DigitalPlatform.Text;
using DigitalPlatform.Marc;
using DigitalPlatform.rms.Client.rmsws_localhost;
using Google.Protobuf.WellKnownTypes;
using Microsoft.Extensions.Primitives;

namespace DigitalPlatform.LibraryServer
{
Expand Down
2 changes: 1 addition & 1 deletion DigitalPlatform.RFID/RfidTagList.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1172,7 +1172,7 @@ public static OneTag ChangeUID(

// 2023/12/6
// 清除 _tagTable 中缓存的信息
public static void ClearTagTable(List<TagAndData> datas)
public static void ClearTagTableByDatas(List<TagAndData> datas)
{
if (datas == null || datas.Count == 0)
return;
Expand Down
2 changes: 1 addition & 1 deletion RfidCenter/RfidCenter.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
<SuiteName>dp2 V3</SuiteName>
<CreateWebPageOnPublish>true</CreateWebPageOnPublish>
<WebPage>publish.htm</WebPage>
<ApplicationRevision>34</ApplicationRevision>
<ApplicationRevision>35</ApplicationRevision>
<ApplicationVersion>1.14.8.%2a</ApplicationVersion>
<UseApplicationTrust>false</UseApplicationTrust>
<CreateDesktopShortcut>true</CreateDesktopShortcut>
Expand Down
36 changes: 33 additions & 3 deletions dp2Circulation/CfgDlg.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

14 changes: 14 additions & 0 deletions dp2Circulation/CfgDlg.cs
Original file line number Diff line number Diff line change
Expand Up @@ -581,6 +581,11 @@ private void CfgDlg_Load(object sender, EventArgs e)
"rfidCenterUrl",
""); // 常用值 "ipc://RfidChannel/RfidServer"

this.comboBox_rfid_tagCachePolicy.Text =
ap.GetString("rfid",
"tagCachePolicy",
"不缓存");

// 2023/10/27
// 超高频标签数据格式
this.comboBox_uhf_dataFormat.Text =
Expand Down Expand Up @@ -627,6 +632,8 @@ private void CfgDlg_Load(object sender, EventArgs e)
if (StringUtil.IsInList("client_disablerfid", Program.MainForm._currentUserRights))
{
this.textBox_cardReader_rfidCenterUrl.Enabled = false;
this.comboBox_rfid_tagCachePolicy.Enabled = false;

this.button_cardReader_setRfidUrlDefaultValue.Enabled = false;

this.comboBox_uhf_dataFormat.Enabled = false;
Expand Down Expand Up @@ -1360,6 +1367,10 @@ private void button_OK_Click(object sender, EventArgs e)
"rfidCenterUrl",
this.textBox_cardReader_rfidCenterUrl.Text); // 常用值 "ipc://RfidChannel/RfidServer"

ap.SetString("rfid",
"tagCachePolicy",
this.comboBox_rfid_tagCachePolicy.Text);

// 2023/10/27
// 超高频标签数据格式
ap.SetString("uhf",
Expand Down Expand Up @@ -2146,6 +2157,9 @@ private void tabPage_cardReader_DoubleClick(object sender, EventArgs e)
{
this.groupBox_uhf.Enabled = true;
this.groupBox_rfidTest.Enabled = true;

this.label_rfid_tagCachePolicy.Enabled = true;
this.comboBox_rfid_tagCachePolicy.Enabled = true;
}

private void tabPage_cardReader_SizeChanged(object sender, EventArgs e)
Expand Down
6 changes: 0 additions & 6 deletions dp2Circulation/CfgDlg.resx
Original file line number Diff line number Diff line change
Expand Up @@ -123,12 +123,6 @@
<metadata name="toolStrip_print.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>17, 2</value>
</metadata>
<metadata name="toolStrip_server.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>153, 2</value>
</metadata>
<metadata name="toolStrip_print.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>17, 2</value>
</metadata>
<assembly alias="System.Drawing" name="System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
<data name="toolStripDropDownButton_managePrintScript.Image" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>
Expand Down
22 changes: 18 additions & 4 deletions dp2Circulation/MainForm/InitialExtension.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1663,7 +1663,7 @@ public void StartOrStopRfidManager()
RfidManager.InventoryIdleSeconds = this.RfidInventoryIdleSeconds;
RfidManager.GetRSSI = this.UhfRSSI == 0 ? false : true;
RfidTagList.OnlyReadEPC = this.UhfOnlyEpcCharging;
RfidTagList.UseTagTable = true;
SetRfidTagCachePolicy(); // RfidTagList.UseTagTable = false;
// RfidManager.AntennaList = "1|2|3|4"; // testing
// RfidManager.SetError += RfidManager_SetError;
RfidManager.ListTags += RfidManager_ListTags;
Expand All @@ -1689,6 +1689,16 @@ public void StartOrStopRfidManager()
}
}

void SetRfidTagCachePolicy()
{
if (this.RfidTagCachePolicy == "要缓存"
|| this.RfidTagCachePolicy == "部分缓存")
RfidTagList.UseTagTable = true;
else
RfidTagList.UseTagTable = false;
}


/*
private string _error = null; // "test error line asdljasdkf; ;jasldfjasdjkf aasdfasdf";
Expand Down Expand Up @@ -1741,9 +1751,13 @@ private void RfidManager_ListTags(object sender, ListTagsEventArgs e)
* 1) 将 RfidManager.UseTagTable 设置为 false (注意默认为 true),这样根本不会用到 _tagTable;
* 2) 保持 RfidManager.UseTagTable 为 true,但在每次 Refresh 的同时调用 RfidTagList>ClearTagTable() 函数清除已经拿走的标签的 _tagTable 缓存事项。
*/
// 清除已经拿走的标签对应的 RfidTagList._tagTable 缓存信息
RfidTagList.ClearTagTable(remove_books);
RfidTagList.ClearTagTable(remove_patrons);

if (this.RfidTagCachePolicy == "部分缓存")
{
// 清除已经拿走的标签对应的 RfidTagList._tagTable 缓存信息
RfidTagList.ClearTagTableByDatas(remove_books);
RfidTagList.ClearTagTableByDatas(remove_patrons);
}
},
(type, text) =>
{
Expand Down
48 changes: 47 additions & 1 deletion dp2Circulation/MainForm/MainForm.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1845,6 +1845,14 @@ void CfgDlg_ParamChanged(object sender, ParamChangedEventArgs e)
Program.MainForm._cachedInventoryIdleSeconds = -1; // clear cache
RfidManager.InventoryIdleSeconds = this.RfidInventoryIdleSeconds;
}

if (e.Section == "rfid"
&& e.Entry == "tagCachePolicy")
{
Program.MainForm._cachedRfidTagCachePolicy = null; // clear cache
SetRfidTagCachePolicy();
// RfidManager.InventoryIdleSeconds = this.RfidInventoryIdleSeconds;
}
}

public bool PrintLabelMode
Expand Down Expand Up @@ -8099,6 +8107,39 @@ public bool UhfWriteUserBank
}
}

internal string _cachedRfidTagCachePolicy = null;

// RFID 标签缓存策略
public string RfidTagCachePolicy
{
get
{
if (this.AppInfo == null)
return "不缓存";
if (_cachedRfidTagCachePolicy != null)
return _cachedRfidTagCachePolicy;
_cachedRfidTagCachePolicy = this.AppInfo.GetString(
"rfid",
"tagCachePolicy",
"不缓存");
return _cachedRfidTagCachePolicy;
}
set
{
this.AppInfo?.SetString("rfid",
"tagCachePolicy",
value);
_cachedRfidTagCachePolicy = null;
}
}


/*
this.comboBox_rfid_tagCachePolicy.Text =
ap.GetString(,
);
* */

internal int _cachedRSSI = -1;

// 超高频标签读取时过滤的 RSSI 阈值(低于此值的被丢弃)。0 表示不使用 RSSI 过滤功能
Expand Down Expand Up @@ -9600,7 +9641,12 @@ static void EnableFingerprintSendKey(bool enable)
void SetRfidManagerPause(bool pause)
{
RfidManager.Pause = pause;
this.toolStripStatusLabel_rfid.Text = pause || string.IsNullOrEmpty(RfidManager.Url) ? "" : "RFID";
if (string.IsNullOrEmpty(RfidManager.Url))
this.toolStripStatusLabel_rfid.Text = "";
else if (pause)
this.toolStripStatusLabel_rfid.Text = "RFID(暂停)";
else
this.toolStripStatusLabel_rfid.Text = "RFID";
}

void SetPalmManagerPause(bool pause)
Expand Down
9 changes: 3 additions & 6 deletions dp2Circulation/MainForm/MainForm.resx
Original file line number Diff line number Diff line change
Expand Up @@ -568,12 +568,6 @@
<metadata name="contextMenuStrip_fixedPanel.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>17, 56</value>
</metadata>
<metadata name="toolStrip_panelFixed.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>610, 17</value>
</metadata>
<metadata name="toolStrip_messageHub.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>241, 31</value>
</metadata>
<metadata name="toolStrip_messageHub.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>241, 31</value>
</metadata>
Expand Down Expand Up @@ -622,6 +616,9 @@
TgDQASA1MVpwzwAAAABJRU5ErkJggg==
</value>
</data>
<metadata name="toolStrip_panelFixed.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>610, 17</value>
</metadata>
<data name="toolStripButton_close.Image" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>
iVBORw0KGgoAAAANSUhEUgAAAA8AAAAPCAYAAAA71pVKAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8
Expand Down
4 changes: 2 additions & 2 deletions dp2Circulation/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@
// Build Number
// Revision
//
[assembly: AssemblyVersion("3.93.*")]
[assembly: AssemblyFileVersion("3.93.0.0")]
[assembly: AssemblyVersion("3.91.*")]
[assembly: AssemblyFileVersion("3.91.0.0")]

// V2.6 2015/11/7 MainForm BiblioSearchForm ChannelForm 采用 ChannelPool。注意观察有无通讯通道方面的故障
// V2.7 2015/11/30 EntityForm 大幅度改造,采用 ChannelPool。Stop 类的 BeginLoop() 不再允许嵌套,注意观察是否会抛出异常。固定面板区属性页的显示很多已经改造为 PropertyTaskList 实现
Expand Down
2 changes: 1 addition & 1 deletion dp2Circulation/Util/RfidToolForm.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2547,7 +2547,7 @@ private void listView_tags_MouseUp(object sender, MouseEventArgs e)
menuItem = new MenuItem("-");
contextMenu.MenuItems.Add(menuItem);

menuItem = new MenuItem("清除标签内容 [" + this.listView_tags.SelectedItems.Count.ToString() + "] (&C)");
menuItem = new MenuItem("清空标签内容 [" + this.listView_tags.SelectedItems.Count.ToString() + "] (&C)");
menuItem.Click += new System.EventHandler(this.menu_clearSelectedTagContent_Click);
if (this.listView_tags.SelectedItems.Count == 0)
menuItem.Enabled = false;
Expand Down
Loading

0 comments on commit 253fbed

Please sign in to comment.