This commit is contained in:
cli 2024-10-11 11:27:57 +08:00
parent 0a5c32be4b
commit ff4b635de4
5 changed files with 6 additions and 5 deletions

View File

@ -3,6 +3,7 @@ using JiShe.CollectBus.Protocol.Contracts.Attributes;
using JiShe.CollectBus.Protocol.Contracts.DependencyInjection; using JiShe.CollectBus.Protocol.Contracts.DependencyInjection;
using TouchSocket.Core; using TouchSocket.Core;
// ReSharper disable once CheckNamespace
namespace Microsoft.Extensions.DependencyInjection namespace Microsoft.Extensions.DependencyInjection
{ {
public static class DependencyInjectionExtensions public static class DependencyInjectionExtensions

View File

@ -4,6 +4,7 @@ using Microsoft.Extensions.Configuration;
using TouchSocket.Core; using TouchSocket.Core;
using TouchSocket.Sockets; using TouchSocket.Sockets;
// ReSharper disable once CheckNamespace
namespace Microsoft.Extensions.DependencyInjection namespace Microsoft.Extensions.DependencyInjection
{ {
public static class ServiceCollectionExtensions public static class ServiceCollectionExtensions

View File

@ -29,7 +29,7 @@ namespace JiShe.CollectBus.Core.Plugins
public class UdpClosePlugin(ILog logger) : PluginBase, IUdpReceivedPlugin public class UdpClosePlugin(ILog logger) : PluginBase, IUdpReceivedPlugin
{ {
public async Task OnUdpReceived(IUdpSessionBase client, UdpReceivedDataEventArgs e) public Task OnUdpReceived(IUdpSessionBase client, UdpReceivedDataEventArgs e)
{ {
throw new NotImplementedException(); throw new NotImplementedException();
} }

View File

@ -12,8 +12,7 @@ namespace JiShe.CollectBus.Core.Plugins
{ {
//TODO:电表: 376.1 645-07 modbus 水表: 118 645-97 //TODO:电表: 376.1 645-07 modbus 水表: 118 645-97
var protocolType = "TestProtocol"; const string protocolType = "TestProtocol";
IProtocolPlugin? protocolPlugin;
switch (protocolType) switch (protocolType)
{ {
//case "376": //case "376":
@ -23,7 +22,7 @@ namespace JiShe.CollectBus.Core.Plugins
// //todo: 直接拿设备信息,根据设备信息使用不同的协议解析服务 // //todo: 直接拿设备信息,根据设备信息使用不同的协议解析服务
// break; // break;
} }
protocolPlugin = serviceProvider.GetKeyedService<IProtocolPlugin>(protocolType); var protocolPlugin = serviceProvider.GetKeyedService<IProtocolPlugin>(protocolType);
client.Logger.Info($"{protocolPlugin?.Get().Name},{protocolPlugin?.Get().RegularExpression}"); client.Logger.Info($"{protocolPlugin?.Get().Name},{protocolPlugin?.Get().RegularExpression}");

View File

@ -14,7 +14,7 @@ namespace JiShe.CollectBus.Protocol
return new ProtocolInfo("Standard", "376.1", "TCP","376.1协议","DTS1980"); return new ProtocolInfo("Standard", "376.1", "TCP","376.1协议","DTS1980");
} }
public void Load() public new void Load()
{ {
base.Load(); base.Load();
} }