DiagnosticTool.Devices.Vector.Can
1.0.2.1
.NET 5.0
This package targets .NET 5.0. The package is compatible with this framework or higher.
.NET Framework 4.6.2
This package targets .NET Framework 4.6.2. The package is compatible with this framework or higher.
dotnet add package DiagnosticTool.Devices.Vector.Can --version 1.0.2.1
NuGet\Install-Package DiagnosticTool.Devices.Vector.Can -Version 1.0.2.1
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="DiagnosticTool.Devices.Vector.Can" Version="1.0.2.1" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add DiagnosticTool.Devices.Vector.Can --version 1.0.2.1
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: DiagnosticTool.Devices.Vector.Can, 1.0.2.1"
#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.
// Install DiagnosticTool.Devices.Vector.Can as a Cake Addin #addin nuget:?package=DiagnosticTool.Devices.Vector.Can&version=1.0.2.1 // Install DiagnosticTool.Devices.Vector.Can as a Cake Tool #tool nuget:?package=DiagnosticTool.Devices.Vector.Can&version=1.0.2.1
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
诊断工具 Vector 设备 CAN 总线通信类库
分别使用 XlCanConnector 和 XlCanFdConnector 创建 CAN 总线通信对象,实现 CAN 或 CAN FD 协议的连接、断开、发送、接收等操作。
使用方式
环境配置
- 在 Vector Hardware Config 程序上,配置好应用程序名称和通道的具体设备。
设置参数
- 创建
XlApplicationChannelRecord
对象,指定具体 “应用程序名称” 下的具体 “总线类型” 下的具体 “通道序号”。 - 创建
XlCanBusParameters
对象或XlCanFdBusParameters
,指定总线的参数。
创建连接器
- 使用上述步骤创建的通道和总线参数对象,创建连接器对象
CanConnector
或CanFdConnector
。
使用
使用创建好的连接器进行连接、接收、发送、断开等操作。
示例
// 先通过 Vector Hardware Config 程序,配置好应用程序和通道
// 该配置也可通过 DiagnosticTool.Devices.Vector 包实现
// 创建 CAN 或 CAN FD 连接器
// 指定 Vector Hardware Config 中的一个已经配置好的具体的通道
var applicationChannel = new XlApplicationChannelRecord("DiagnosticTool", XLDefine.XL_BusTypes.XL_BUS_TYPE_CAN, 0);
// 指定通信参数(可根据需求选择合适的重载)
// var busParameters = new XlCanBusParameters(500000, 0.75);
var busParameters = new XlCanFdBusParameters(500000, 0.75, 2000000, 0.75);
// 创建连接器
// var connector = new CanConnector(applicationChannel, busParameters);
var connector = new CanFdConnector(applicationChannel, busParameters);
// 实现连接、断开、发送、接收的操作
// connector.Connect();
await connector.ConnectAsync();
// var canFrame = connector.Receive();
var canFrame = await connector.ReceiveAsync();
// connector.Send(canFrame);
await connector.SendAsync(canFrame);
//connector.Disconnect();
await connector.DisconnectAsync();
特性
静默模式
设置 XlCanBusParameters
和 XlCanFdBusParameters
的 AckOff
属性为 true 时,连接器将不产生 ACK 响应,保持监听状态。但无法发送 CAN 帧(发送操作会成功完成,但不会在总线上进行发送)。
连接器事件
连接器提供丰富的事件供注册:
- ConnectionStatusChanging
- ConnectionStatusChanged
- ReceivedNewCanFrame
- ReceivedErrorCanFrame
- ReceivedSendSuccessFeedback
- ReceivedSendFailedFeedback
- ChipStateFeedback
- TransceiverFeedback
注意:ReceivedNewCanFrame 事件与 Receive 方法相互独立,即通过注册事件获取到新的消息后,Receive 方法依然能读取这条相同的消息。
自动断开与重连
设置以下属性可以在探测到总线产生错误时执行断开或重连的操作。
- AutoDisconnectWhenReceiveError
- 当探测到接收错误时(包括收到错误帧、报文未应答等)达到指定次数时断开连接。
- AutoDisconnectWhenSendError
- 当探测到发送错误时(包括收到发送失败反馈)达到指定次数时断开连接。
- AutoReconnectWhenReceiveError
- 当由于接收错误而断开连接时自动重连。
- AutoReconnectWhenSendError
- 当由于发送错误而断开连接时自动重连。
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net5.0 is compatible. net5.0-windows was computed. net6.0 is compatible. 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 is compatible. 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 is compatible. 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. |
.NET Framework | net462 is compatible. net463 was computed. net47 is compatible. net471 is compatible. net472 is compatible. net48 is compatible. net481 is compatible. |
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
-
.NETFramework 4.6.2
- DiagnosticTool.Devices.Vector (>= 1.0.1.2)
- System.ValueTuple (>= 4.5.0)
-
.NETFramework 4.7
- DiagnosticTool.Devices.Vector (>= 1.0.1.2)
- System.ValueTuple (>= 4.5.0)
-
.NETFramework 4.7.1
- DiagnosticTool.Devices.Vector (>= 1.0.1.2)
- System.ValueTuple (>= 4.5.0)
-
.NETFramework 4.7.2
- DiagnosticTool.Devices.Vector (>= 1.0.1.2)
- System.ValueTuple (>= 4.5.0)
-
.NETFramework 4.8
- DiagnosticTool.Devices.Vector (>= 1.0.1.2)
- System.ValueTuple (>= 4.5.0)
-
.NETFramework 4.8.1
- DiagnosticTool.Devices.Vector (>= 1.0.1.2)
- System.ValueTuple (>= 4.5.0)
-
net5.0
- DiagnosticTool.Devices.Vector (>= 1.0.1.2)
-
net6.0
- DiagnosticTool.Devices.Vector (>= 1.0.1.2)
-
net7.0
- DiagnosticTool.Devices.Vector (>= 1.0.1.2)
-
net8.0
- DiagnosticTool.Devices.Vector (>= 1.0.1.2)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
修改 CAN FD 解释文本,移除 With BRS 后缀。