DoNetDrive.Connector.SerialPort 1.5.0

dotnet add package DoNetDrive.Connector.SerialPort --version 1.5.0
                    
NuGet\Install-Package DoNetDrive.Connector.SerialPort -Version 1.5.0
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="DoNetDrive.Connector.SerialPort" Version="1.5.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="DoNetDrive.Connector.SerialPort" Version="1.5.0" />
                    
Directory.Packages.props
<PackageReference Include="DoNetDrive.Connector.SerialPort" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add DoNetDrive.Connector.SerialPort --version 1.5.0
                    
#r "nuget: DoNetDrive.Connector.SerialPort, 1.5.0"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package DoNetDrive.Connector.SerialPort@1.5.0
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=DoNetDrive.Connector.SerialPort&version=1.5.0
                    
Install as a Cake Addin
#tool nuget:?package=DoNetDrive.Connector.SerialPort&version=1.5.0
                    
Install as a Cake Tool

DoNetDrive.Connector.SerialPort

介绍

实现基于串口的命令收发功能,可用于RS232/485通讯

软件架构

基于 netstandard2.0 ;

使用说明


using DoNetDrive.Connector.SerialPort;
using DoNetDrive.Core;
using DoNetDrive.Core.Command;
using DoNetDrive.Core.Connector;
using DoNetDrive.Core.Factory;
using DoNetDrive.Protocol;
using DoNetDrive.Protocol.Door.Door8800.Door.Remote;
using DoNetDrive.Protocol.Door.Door8800.SystemParameter.SN;

var mAllocator = ConnectorAllocator.GetAllocator();

//导入 串口通讯库
var defFactory = mAllocator.ConnectorFactory as DefaultConnectorFactory;
defFactory.ConnectorFactoryDictionary.Add(ConnectorType.SerialPort, SerialPortFactory.GetInstance());


var cmdDtl = GetCommandDetail(new SerialPortDetail(6, 19200), 
    CommandDetailFactory.ControllerType.Door89H, "0000000000000000", "FFFFFFFF");


try
{
    //Read SN
    ReadSN cmd = new ReadSN(cmdDtl);
    await mAllocator.AddCommandAsync(cmd);
    var snResult = cmd.getResult() as SN_Result;
    string SN = System.Text.Encoding.ASCII.GetString(snResult.SNBuf);
    Console.WriteLine(SN);

    //open door
    cmdDtl = GetCommandDetail(new SerialPortDetail(6, 19200),
    CommandDetailFactory.ControllerType.Door89H, SN, "FFFFFFFF");
    var doorDetail = new DoNetDrive.Protocol.Door.Door8800.Door.DoorDetail<bool>();
    doorDetail.SetDoor(1, true);
    var openCmd = new OpenDoor(cmdDtl, new Remote_Parameter(doorDetail));
    await mAllocator.AddCommandAsync(openCmd);

    Console.WriteLine("开门成功");
}
catch (Exception ex)
{
    Console.WriteLine(ex.Message);
}

//释放
mAllocator.Dispose();



INCommandDetail GetCommandDetail(INConnectorDetail connectdtl,
           CommandDetailFactory.ControllerType protocolType,
           string sn, string password)
{

    INCommandDetail cmdDtl = CommandDetailFactory.CreateDetail(connectdtl,
        protocolType, sn, password);

    cmdDtl.Timeout = 1500;
    cmdDtl.RestartCount = 3;

    return cmdDtl;
}

版本记录

ver 1.0.0

DoNetDrive.Core 通讯库中的串口通讯实现,当需要使用串口通讯时,需要引用这个动态库,并将这个库和DoNetDrive.Core中的分配器关联 VB.NET代码 Dim defFactory As DefaultConnectorFactory = TryCast(Allocator.ConnectorFactory, DefaultConnectorFactory) defFactory.ConnectorFactoryDictionary.Add(ConnectorType.SerialPort, DoNetDrive.Connector.COM.SerialPortFactory.GetInstance())

ver 1.01.0

增加命令发送间隔,使通道的 CommandSendIntervalTimeMS 属性可以作用到每一次发

ver 1.02.0

增加命令发送间隔

ver 1.03.0

修复上个版本命令发送间隔计算错误的问题 修改串口不能关闭的bug

ver 1.05.0

修复命令发送后 buf没有释放的bug

Product Compatible and additional computed target framework versions.
.NET net5.0 was computed.  net5.0-windows was computed.  net6.0 was computed.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 was computed.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed.  net9.0 was computed.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  net10.0 was computed.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
.NET Core netcoreapp2.0 was computed.  netcoreapp2.1 was computed.  netcoreapp2.2 was computed.  netcoreapp3.0 was computed.  netcoreapp3.1 was computed. 
.NET Standard netstandard2.0 is compatible.  netstandard2.1 was computed. 
.NET Framework net461 was computed.  net462 was computed.  net463 was computed.  net47 was computed.  net471 was computed.  net472 was computed.  net48 was computed.  net481 was computed. 
MonoAndroid monoandroid was computed. 
MonoMac monomac was computed. 
MonoTouch monotouch was computed. 
Tizen tizen40 was computed.  tizen60 was computed. 
Xamarin.iOS xamarinios was computed. 
Xamarin.Mac xamarinmac was computed. 
Xamarin.TVOS xamarintvos was computed. 
Xamarin.WatchOS xamarinwatchos was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
1.5.0 336 11/18/2023
1.4.0 163 10/9/2023
1.3.0 603 6/28/2022
1.2.0 468 6/27/2022
1.0.0 518 3/9/2022