• 大小: 4.36MB
    文件类型: .zip
    金币: 1
    下载: 0 次
    发布日期: 2023-09-20
  • 语言: 其他
  • 标签: can  dbc  

资源简介

DBC文件解析,基于致远电子DBC_demo_代码。博文,https://blog.csdn.net/liulangdelangzi/article/details/83181562#comments

资源截图

代码片段和文件信息

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using System.Runtime.InteropServices;

//1.ZLGCAN系列接口卡信息的数据类型。
public struct VCI_BOARD_INFO 

public UInt16 hw_Version;
    public UInt16 fw_Version;
    public UInt16 dr_Version;
    public UInt16 in_Version;
    public UInt16 irq_Num;
    public byte can_Num;
    [MarshalAs(UnmanagedType.ByValArray SizeConst=20)] public byte []str_Serial_Num;
    [MarshalAs(UnmanagedType.ByValArray SizeConst = 40)]
    public byte[] str_hw_Type;
    [MarshalAs(UnmanagedType.ByValArray SizeConst = 8)]
    public byte[] Reserved;
}


/////////////////////////////////////////////////////
//2.定义CAN信息帧的数据类型。
unsafe public struct VCI_CAN_OBJ  //使用不安全代码
{
    public uint ID;
    public uint TimeStamp;
    public byte TimeFlag;
    public byte SendType;
    public byte RemoteFlag;//是否是远程帧
    public byte ExternFlag;//是否是扩展帧
    public byte DataLen;

    public fixed byte Data[8];

    public fixed byte Reserved[3];

}
////2.定义CAN信息帧的数据类型。
//public struct VCI_CAN_OBJ 
//{
//    public UInt32 ID;
//    public UInt32 TimeStamp;
//    public byte TimeFlag;
//    public byte SendType;
//    public byte RemoteFlag;//是否是远程帧
//    public byte ExternFlag;//是否是扩展帧
//    public byte DataLen;
//    [MarshalAs(UnmanagedType.ByValArray SizeConst = 8)]
//    public byte[] Data;
//    [MarshalAs(UnmanagedType.ByValArray SizeConst = 3)]
//    public byte[] Reserved;

//    public void Init()
//    {
//        Data = new byte[8];
//        Reserved = new byte[3];
//    }
//}

//3.定义CAN控制器状态的数据类型。
public struct VCI_CAN_STATUS 
{
    public byte ErrInterrupt;
    public byte regMode;
    public byte regStatus;
    public byte regALCapture;
    public byte regECCapture;
    public byte regEWLimit;
    public byte regRECounter;
    public byte regTECounter;
    [MarshalAs(UnmanagedType.ByValArray SizeConst = 4)]
    public byte[] Reserved;
}

//4.定义错误信息的数据类型。
public struct VCI_ERR_INFO 
{
    public UInt32 ErrCode;
    public byte Passive_ErrData1;
    public byte Passive_ErrData2;
    public byte Passive_ErrData3;
    public byte ArLost_ErrData;
}

//5.定义初始化CAN的数据类型
public struct VCI_INIT_CONFIG 
{
    public UInt32 AccCode;
    public UInt32 AccMask;
    public UInt32 Reserved;
    public byte Filter;
    public byte Timing0;
    public byte Timing1;
    public byte Mode;
}

public struct CHGDESIPANDPORT 
{
    [MarshalAs(UnmanagedType.ByValArray SizeConst = 10)]
    public byte[] szpwd;
    [MarshalAs(UnmanagedType.ByValArray SizeConst = 20)]
    public byte[] szdesip;
    public Int32 desport;

    public void Init()
    {
        szpwd = new byte[10];
        szdesip = new byte[20];
    }
}

///////// new add struct for filter /////////
//typedef struct _VCI_FILTER_RECORD{
//    DWORD Extframe; /

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----
     目录           0  2019-01-10 11:02  ZLGCAN\
     目录           0  2019-01-10 11:02  ZLGCAN\.vs\
     目录           0  2019-01-10 11:02  ZLGCAN\.vs\WindowsApplication1\
     目录           0  2019-01-10 11:02  ZLGCAN\.vs\WindowsApplication1\v14\
     文件       84480  2019-01-10 10:53  ZLGCAN\.vs\WindowsApplication1\v14\.suo
     目录           0  2019-01-10 11:02  ZLGCAN\Backup\
     目录           0  2019-01-10 11:02  ZLGCAN\Backup\WindowsApplication1\
     文件       32297  2014-03-06 14:00  ZLGCAN\Backup\WindowsApplication1\Form1.Designer.cs
     文件       18606  2015-08-18 09:33  ZLGCAN\Backup\WindowsApplication1\Form1.cs
     文件        6011  2014-03-06 14:00  ZLGCAN\Backup\WindowsApplication1\Form1.resx
     文件         478  2014-03-06 14:00  ZLGCAN\Backup\WindowsApplication1\Program.cs
     目录           0  2019-01-10 11:02  ZLGCAN\Backup\WindowsApplication1\Properties\
     文件        1192  2014-03-06 14:00  ZLGCAN\Backup\WindowsApplication1\Properties\AssemblyInfo.cs
     文件        2892  2014-03-06 14:00  ZLGCAN\Backup\WindowsApplication1\Properties\Resources.Designer.cs
     文件        5612  2014-03-06 14:00  ZLGCAN\Backup\WindowsApplication1\Properties\Resources.resx
     文件        1102  2014-03-06 14:00  ZLGCAN\Backup\WindowsApplication1\Properties\Settings.Designer.cs
     文件         249  2014-03-06 14:00  ZLGCAN\Backup\WindowsApplication1\Properties\Settings.settings
     文件        3385  2014-03-06 14:00  ZLGCAN\Backup\WindowsApplication1\WindowsApplication1.csproj
     文件         946  2014-03-06 14:00  ZLGCAN\Backup\WindowsApplication1.sln
     文件       22528  2015-08-18 09:44  ZLGCAN\Backup\WindowsApplication1.v12.suo
     文件       45826  2018-08-14 13:06  ZLGCAN\UpgradeLog.htm
     目录           0  2019-01-10 11:02  ZLGCAN\WindowsApplication1\
     文件        3974  2018-10-10 17:59  ZLGCAN\WindowsApplication1\ClassDiagram1.cd
     文件        4222  2018-10-25 08:57  ZLGCAN\WindowsApplication1\DBCStruct.cs
     文件       34846  2018-10-18 16:18  ZLGCAN\WindowsApplication1\Form1.Designer.cs
     文件       19017  2018-12-26 09:26  ZLGCAN\WindowsApplication1\Form1.cs
     文件        6383  2018-10-18 16:18  ZLGCAN\WindowsApplication1\Form1.resx
     文件        3782  2018-10-18 16:20  ZLGCAN\WindowsApplication1\FrmAbout.Designer.cs
     文件         444  2018-10-18 16:20  ZLGCAN\WindowsApplication1\FrmAbout.cs
     文件       73512  2018-10-18 16:20  ZLGCAN\WindowsApplication1\FrmAbout.resx
     文件       18267  2019-01-10 10:50  ZLGCAN\WindowsApplication1\FrmDBC.Designer.cs
............此处省略86个文件信息

评论

共有 条评论