From eb04b0b75905f93a2bcd658af551b6aea1fccccc Mon Sep 17 00:00:00 2001 From: smartwyy <645583145@qq.com> Date: Sun, 26 May 2024 15:40:17 +0800 Subject: [PATCH] =?UTF-8?q?string=E8=A7=A3=E6=9E=90?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- HybirdFrameworkCore/Utils/BitUtls.cs | 2 +- Service/Charger/Client/ClientMgr.cs | 7 +++++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/HybirdFrameworkCore/Utils/BitUtls.cs b/HybirdFrameworkCore/Utils/BitUtls.cs index eaf751b..ba47b50 100644 --- a/HybirdFrameworkCore/Utils/BitUtls.cs +++ b/HybirdFrameworkCore/Utils/BitUtls.cs @@ -53,7 +53,7 @@ public static class BitUtls if (propertyType == STRING) { - return Convert.ChangeType(Encoding.ASCII.GetString(bytes, start, length), propertyType); + return Convert.ChangeType(Encoding.ASCII.GetString(bytes, start, length/8), propertyType); } if (propertyType == BYTEARRAY) diff --git a/Service/Charger/Client/ClientMgr.cs b/Service/Charger/Client/ClientMgr.cs index 054e9df..7bc7243 100644 --- a/Service/Charger/Client/ClientMgr.cs +++ b/Service/Charger/Client/ClientMgr.cs @@ -31,6 +31,13 @@ public static class ClientMgr return o; } + /// + /// 通过channel获取client + /// + /// + /// + /// 获取不到,client则为空 + /// public static bool TryGetClient(IChannel channel, out string sn, out ChargerClient? client) { string? snt = ChannelUtils.GetAttr(channel, ChargerConst.ChargerSn);