CAN 配置和报文记录的功能

This commit is contained in:
2024-12-23 21:33:19 +08:00
parent 713b9b02e6
commit 8b21846424
20 changed files with 1021 additions and 114 deletions

View File

@@ -1,7 +1,11 @@
using CapMachine.Wpf.CanDrive;
using CapMachine.Model.CANLIN;
using CapMachine.Wpf.CanDrive;
using ImTools;
using Prism.Ioc;
using Prism.Mvvm;
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
@@ -11,17 +15,64 @@ namespace CapMachine.Wpf.Services
/// <summary>
/// Can驱动服务
/// </summary>
public class CanDriveService:BindableBase
public class CanDriveService : BindableBase
{
public CanDriveService()
/// <summary>
/// 实例化函数
/// </summary>
public CanDriveService(HighSpeedDataService highSpeedDataService,IContainerProvider containerProvider)
{
ToomossCanDrive=new ToomossCan();
ToomossCanDrive = new ToomossCan(containerProvider);
//高速数据服务
HighSpeedDataService = highSpeedDataService;
//ToomossCanDrive.StartCanDrive();
}
/// <summary>
/// 图莫斯 CAN Drive
/// ToomossCanDrive
/// </summary>
public ToomossCan ToomossCanDrive { get; set; }
/// <summary>
/// Dbc消息集合
/// 包括读取的实时值和数据
/// </summary>
public ObservableCollection<CanDbcModel> ListCanDbcModel { get; set; } = new ObservableCollection<CanDbcModel>();
/// <summary>
/// 初始化CAN的配置信息
/// </summary>
public void InitCanConfig(CanLinConfigPro selectedCanLinConfigPro)
{
//赋值配置数据
SelectedCanLinConfigPro = selectedCanLinConfigPro;
//为DBC实时数据关联配置的名称
foreach (var item in SelectedCanLinConfigPro.CanLinConfigContents)
{
var FindData = ListCanDbcModel.FindFirst(a => a.SignalName == item.Content);
if (FindData != null)
{
FindData.Name = item.Name;
}
}
}
/// <summary>
/// 开始DBC 配置文件 加载
/// </summary>
/// <returns></returns>
public ObservableCollection<CanDbcModel> StartDbc(string Path)
{
ListCanDbcModel = ToomossCanDrive.StartDbc(Path);
return ListCanDbcModel;
}
/// <summary>
/// 当前选中的CanLinConfigPro 程序
/// </summary>
public CanLinConfigPro SelectedCanLinConfigPro { get; set; }
public HighSpeedDataService HighSpeedDataService { get; }
}
}