第一次提交:

支持广成CAN,PCAN,同星(要用低版本的TSMaster),TOOMOSS(没有测试过)
This commit is contained in:
刘大贵 2024-11-06 16:52:30 +08:00
commit beceab4798
87 changed files with 27886 additions and 0 deletions

7
.gitignore vendored Normal file
View File

@ -0,0 +1,7 @@
#忽略所有以 .o,.d,.crf,.uvoptx 结尾的文件
# 忽略 /obj/ 目录
/obj/
# 忽略 JLinkLog.txt 文件

BIN
.vs/CAN_Tool/v17/.suo Normal file

Binary file not shown.

View File

@ -0,0 +1,191 @@
{
"Version": 1,
"WorkspaceRootPath": "E:\\liudagui\\project\\HONGRI\\code\\dev\\uds_tools\\",
"Documents": [
{
"AbsoluteMoniker": "D:0:0:{F7B5DB9E-0890-47ED-813C-324B0AF56390}|CAN_Tool\\uds_tools.csproj|e:\\liudagui\\project\\hongri\\code\\dev\\uds_tools\\can_tool\\uds.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}",
"RelativeMoniker": "D:0:0:{F7B5DB9E-0890-47ED-813C-324B0AF56390}|CAN_Tool\\uds_tools.csproj|solutionrelative:can_tool\\uds.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}"
},
{
"AbsoluteMoniker": "D:0:0:{F7B5DB9E-0890-47ED-813C-324B0AF56390}|CAN_Tool\\uds_tools.csproj|e:\\liudagui\\project\\hongri\\code\\dev\\uds_tools\\can_tool\\uds_tools.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}|Form",
"RelativeMoniker": "D:0:0:{F7B5DB9E-0890-47ED-813C-324B0AF56390}|CAN_Tool\\uds_tools.csproj|solutionrelative:can_tool\\uds_tools.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}|Form"
},
{
"AbsoluteMoniker": "D:0:0:{F7B5DB9E-0890-47ED-813C-324B0AF56390}|CAN_Tool\\uds_tools.csproj|e:\\liudagui\\project\\hongri\\code\\dev\\uds_tools\\can_tool\\candevice\\tosun\\tosun.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}",
"RelativeMoniker": "D:0:0:{F7B5DB9E-0890-47ED-813C-324B0AF56390}|CAN_Tool\\uds_tools.csproj|solutionrelative:can_tool\\candevice\\tosun\\tosun.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}"
},
{
"AbsoluteMoniker": "D:0:0:{00000000-0000-0000-0000-000000000000}|\u003CSolution\u003E|uds_tools||{04B8AB82-A572-4FEF-95CE-5222444B6B64}|"
},
{
"AbsoluteMoniker": "D:0:0:{F7B5DB9E-0890-47ED-813C-324B0AF56390}|CAN_Tool\\uds_tools.csproj|e:\\liudagui\\project\\hongri\\code\\dev\\uds_tools\\can_tool\\uds_tools.designer.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}",
"RelativeMoniker": "D:0:0:{F7B5DB9E-0890-47ED-813C-324B0AF56390}|CAN_Tool\\uds_tools.csproj|solutionrelative:can_tool\\uds_tools.designer.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}"
},
{
"AbsoluteMoniker": "D:0:0:{F7B5DB9E-0890-47ED-813C-324B0AF56390}|CAN_Tool\\uds_tools.csproj|e:\\liudagui\\project\\hongri\\code\\dev\\uds_tools\\can_tool\\uds_tools.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}",
"RelativeMoniker": "D:0:0:{F7B5DB9E-0890-47ED-813C-324B0AF56390}|CAN_Tool\\uds_tools.csproj|solutionrelative:can_tool\\uds_tools.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}"
},
{
"AbsoluteMoniker": "D:0:0:{F7B5DB9E-0890-47ED-813C-324B0AF56390}|CAN_Tool\\uds_tools.csproj|e:\\liudagui\\project\\hongri\\code\\dev\\uds_tools\\can_tool\\candevice\\pcan\\pcanbasic.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}",
"RelativeMoniker": "D:0:0:{F7B5DB9E-0890-47ED-813C-324B0AF56390}|CAN_Tool\\uds_tools.csproj|solutionrelative:can_tool\\candevice\\pcan\\pcanbasic.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}"
},
{
"AbsoluteMoniker": "D:0:0:{F7B5DB9E-0890-47ED-813C-324B0AF56390}|CAN_Tool\\uds_tools.csproj|e:\\liudagui\\project\\hongri\\code\\dev\\uds_tools\\can_tool\\candevice\\pcan\\pcan.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}",
"RelativeMoniker": "D:0:0:{F7B5DB9E-0890-47ED-813C-324B0AF56390}|CAN_Tool\\uds_tools.csproj|solutionrelative:can_tool\\candevice\\pcan\\pcan.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}"
},
{
"AbsoluteMoniker": "D:0:0:{F7B5DB9E-0890-47ED-813C-324B0AF56390}|CAN_Tool\\uds_tools.csproj|e:\\liudagui\\project\\hongri\\code\\dev\\uds_tools\\can_tool\\candevice\\gccan\\gc_ecanbasic.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}",
"RelativeMoniker": "D:0:0:{F7B5DB9E-0890-47ED-813C-324B0AF56390}|CAN_Tool\\uds_tools.csproj|solutionrelative:can_tool\\candevice\\gccan\\gc_ecanbasic.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}"
},
{
"AbsoluteMoniker": "D:0:0:{F7B5DB9E-0890-47ED-813C-324B0AF56390}|CAN_Tool\\uds_tools.csproj|e:\\liudagui\\project\\hongri\\code\\dev\\uds_tools\\can_tool\\candevice\\gccan\\gc_ecan.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}",
"RelativeMoniker": "D:0:0:{F7B5DB9E-0890-47ED-813C-324B0AF56390}|CAN_Tool\\uds_tools.csproj|solutionrelative:can_tool\\candevice\\gccan\\gc_ecan.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}"
},
{
"AbsoluteMoniker": "D:0:0:{F7B5DB9E-0890-47ED-813C-324B0AF56390}|CAN_Tool\\uds_tools.csproj|e:\\liudagui\\project\\hongri\\code\\dev\\uds_tools\\can_tool\\||{B270807C-D8C6-49EB-8EBE-8E8D566637A1}|f8d6553f-f752-4dbf-acb6-f291b744a792"
}
],
"DocumentGroupContainers": [
{
"Orientation": 0,
"VerticalTabListWidth": 256,
"DocumentGroups": [
{
"DockedWidth": 200,
"SelectedChildIndex": 1,
"Children": [
{
"$type": "Document",
"DocumentIndex": 2,
"Title": "ToSun.cs",
"DocumentMoniker": "E:\\liudagui\\project\\HONGRI\\code\\dev\\uds_tools\\CAN_Tool\\CanDevice\\TOSUN\\ToSun.cs",
"RelativeDocumentMoniker": "CAN_Tool\\CanDevice\\TOSUN\\ToSun.cs",
"ToolTip": "E:\\liudagui\\project\\HONGRI\\code\\dev\\uds_tools\\CAN_Tool\\CanDevice\\TOSUN\\ToSun.cs",
"RelativeToolTip": "CAN_Tool\\CanDevice\\TOSUN\\ToSun.cs",
"ViewState": "AgIAADUAAAAAAAAAAAAQwI8AAAAgAAAAAAAAAA==",
"Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000738|",
"WhenOpened": "2024-11-06T03:59:41.934Z",
"IsPinned": true,
"EditorCaption": ""
},
{
"$type": "Document",
"DocumentIndex": 0,
"Title": "UDS.cs",
"DocumentMoniker": "E:\\liudagui\\project\\HONGRI\\code\\dev\\uds_tools\\CAN_Tool\\UDS.cs",
"RelativeDocumentMoniker": "CAN_Tool\\UDS.cs",
"ToolTip": "E:\\liudagui\\project\\HONGRI\\code\\dev\\uds_tools\\CAN_Tool\\UDS.cs",
"RelativeToolTip": "CAN_Tool\\UDS.cs",
"ViewState": "AgIAAJoBAAAAAAAAAAAcwKkBAAAAAAAAAAAAAA==",
"Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000738|",
"WhenOpened": "2024-11-06T08:33:03.505Z",
"EditorCaption": ""
},
{
"$type": "Document",
"DocumentIndex": 3,
"Title": "uds_tools",
"DocumentMoniker": "E:\\liudagui\\project\\HONGRI\\code\\dev\\uds_tools\\CAN_Tool\\uds_tools.csproj",
"RelativeDocumentMoniker": "CAN_Tool\\uds_tools.csproj",
"ToolTip": "E:\\liudagui\\project\\HONGRI\\code\\dev\\uds_tools\\CAN_Tool\\uds_tools.csproj",
"RelativeToolTip": "CAN_Tool\\uds_tools.csproj",
"Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.001001|",
"WhenOpened": "2024-11-06T08:27:23.586Z",
"EditorCaption": ""
},
{
"$type": "Document",
"DocumentIndex": 4,
"Title": "uds_tools.Designer.cs",
"DocumentMoniker": "E:\\liudagui\\project\\HONGRI\\code\\dev\\uds_tools\\CAN_Tool\\uds_tools.Designer.cs",
"RelativeDocumentMoniker": "CAN_Tool\\uds_tools.Designer.cs",
"ToolTip": "E:\\liudagui\\project\\HONGRI\\code\\dev\\uds_tools\\CAN_Tool\\uds_tools.Designer.cs",
"RelativeToolTip": "CAN_Tool\\uds_tools.Designer.cs",
"ViewState": "AgIAAE8AAAAAAAAAAAAtwDwAAAAcAAAAAAAAAA==",
"Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000738|",
"WhenOpened": "2024-11-06T08:22:58.434Z",
"EditorCaption": ""
},
{
"$type": "Document",
"DocumentIndex": 5,
"Title": "uds_tools.cs",
"DocumentMoniker": "E:\\liudagui\\project\\HONGRI\\code\\dev\\uds_tools\\CAN_Tool\\uds_tools.cs",
"RelativeDocumentMoniker": "CAN_Tool\\uds_tools.cs",
"ToolTip": "E:\\liudagui\\project\\HONGRI\\code\\dev\\uds_tools\\CAN_Tool\\uds_tools.cs",
"RelativeToolTip": "CAN_Tool\\uds_tools.cs",
"ViewState": "AgIAAGoGAAAAAAAAAAArwIYGAAAvAAAAAAAAAA==",
"Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000738|",
"WhenOpened": "2024-11-06T04:48:46.253Z",
"EditorCaption": ""
},
{
"$type": "Document",
"DocumentIndex": 1,
"Title": "uds_tools.cs [\u8BBE\u8BA1]",
"DocumentMoniker": "E:\\liudagui\\project\\HONGRI\\code\\dev\\uds_tools\\CAN_Tool\\uds_tools.cs",
"RelativeDocumentMoniker": "CAN_Tool\\uds_tools.cs",
"ToolTip": "E:\\liudagui\\project\\HONGRI\\code\\dev\\uds_tools\\CAN_Tool\\uds_tools.cs [\u8BBE\u8BA1]",
"RelativeToolTip": "CAN_Tool\\uds_tools.cs [\u8BBE\u8BA1]",
"Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000738|",
"WhenOpened": "2024-11-06T05:18:35.248Z",
"EditorCaption": " [\u8BBE\u8BA1]"
},
{
"$type": "Document",
"DocumentIndex": 6,
"Title": "PCANBasic.cs",
"DocumentMoniker": "E:\\liudagui\\project\\HONGRI\\code\\dev\\uds_tools\\CAN_Tool\\CanDevice\\PCAN\\PCANBasic.cs",
"RelativeDocumentMoniker": "CAN_Tool\\CanDevice\\PCAN\\PCANBasic.cs",
"ToolTip": "E:\\liudagui\\project\\HONGRI\\code\\dev\\uds_tools\\CAN_Tool\\CanDevice\\PCAN\\PCANBasic.cs",
"RelativeToolTip": "CAN_Tool\\CanDevice\\PCAN\\PCANBasic.cs",
"ViewState": "AgIAAEwEAAAAAAAAAAAAwFoEAAApAAAAAAAAAA==",
"Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000738|",
"WhenOpened": "2024-11-06T04:01:51.647Z",
"EditorCaption": ""
},
{
"$type": "Document",
"DocumentIndex": 7,
"Title": "Pcan.cs",
"DocumentMoniker": "E:\\liudagui\\project\\HONGRI\\code\\dev\\uds_tools\\CAN_Tool\\CanDevice\\PCAN\\Pcan.cs",
"RelativeDocumentMoniker": "CAN_Tool\\CanDevice\\PCAN\\Pcan.cs",
"ToolTip": "E:\\liudagui\\project\\HONGRI\\code\\dev\\uds_tools\\CAN_Tool\\CanDevice\\PCAN\\Pcan.cs",
"RelativeToolTip": "CAN_Tool\\CanDevice\\PCAN\\Pcan.cs",
"ViewState": "AgIAAKgAAAAAAAAAAAAQwLUAAABGAAAAAAAAAA==",
"Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000738|",
"WhenOpened": "2024-11-06T03:57:50.869Z",
"EditorCaption": ""
},
{
"$type": "Document",
"DocumentIndex": 8,
"Title": "GC_ECANBasic.cs",
"DocumentMoniker": "E:\\liudagui\\project\\HONGRI\\code\\dev\\uds_tools\\CAN_Tool\\CanDevice\\GCCAN\\GC_ECANBasic.cs",
"RelativeDocumentMoniker": "CAN_Tool\\CanDevice\\GCCAN\\GC_ECANBasic.cs",
"ToolTip": "E:\\liudagui\\project\\HONGRI\\code\\dev\\uds_tools\\CAN_Tool\\CanDevice\\GCCAN\\GC_ECANBasic.cs",
"RelativeToolTip": "CAN_Tool\\CanDevice\\GCCAN\\GC_ECANBasic.cs",
"ViewState": "AgIAAEsAAAAAAAAAAAAUwJkAAAAvAAAAAAAAAA==",
"Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000738|",
"WhenOpened": "2024-11-06T03:51:53.1Z",
"EditorCaption": ""
},
{
"$type": "Document",
"DocumentIndex": 9,
"Title": "GC_ECAN.cs",
"DocumentMoniker": "E:\\liudagui\\project\\HONGRI\\code\\dev\\uds_tools\\CAN_Tool\\CanDevice\\GCCAN\\GC_ECAN.cs",
"RelativeDocumentMoniker": "CAN_Tool\\CanDevice\\GCCAN\\GC_ECAN.cs",
"ToolTip": "E:\\liudagui\\project\\HONGRI\\code\\dev\\uds_tools\\CAN_Tool\\CanDevice\\GCCAN\\GC_ECAN.cs",
"RelativeToolTip": "CAN_Tool\\CanDevice\\GCCAN\\GC_ECAN.cs",
"ViewState": "AgIAAAAAAAAAAAAAAAAAAAYAAAAbAAAAAAAAAA==",
"Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000738|",
"WhenOpened": "2024-11-06T03:51:43.461Z",
"EditorCaption": ""
}
]
}
]
}
]
}

View File

@ -0,0 +1,179 @@
{
"Version": 1,
"WorkspaceRootPath": "E:\\liudagui\\project\\HONGRI\\code\\git\\uds_tools\\",
"Documents": [
{
"AbsoluteMoniker": "D:0:0:{F7B5DB9E-0890-47ED-813C-324B0AF56390}|CAN_Tool\\uds_tools.csproj|e:\\liudagui\\project\\hongri\\code\\git\\uds_tools\\can_tool\\uds.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}",
"RelativeMoniker": "D:0:0:{F7B5DB9E-0890-47ED-813C-324B0AF56390}|CAN_Tool\\uds_tools.csproj|solutionrelative:can_tool\\uds.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}"
},
{
"AbsoluteMoniker": "D:0:0:{F7B5DB9E-0890-47ED-813C-324B0AF56390}|CAN_Tool\\uds_tools.csproj|E:\\liudagui\\project\\HONGRI\\code\\git\\uds_tools\\can_tool\\uds_tools.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}|Form",
"RelativeMoniker": "D:0:0:{F7B5DB9E-0890-47ED-813C-324B0AF56390}|CAN_Tool\\uds_tools.csproj|solutionrelative:can_tool\\uds_tools.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}|Form"
},
{
"AbsoluteMoniker": "D:0:0:{F7B5DB9E-0890-47ED-813C-324B0AF56390}|CAN_Tool\\uds_tools.csproj|E:\\liudagui\\project\\HONGRI\\code\\git\\uds_tools\\can_tool\\candevice\\tosun\\tosun.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}",
"RelativeMoniker": "D:0:0:{F7B5DB9E-0890-47ED-813C-324B0AF56390}|CAN_Tool\\uds_tools.csproj|solutionrelative:can_tool\\candevice\\tosun\\tosun.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}"
},
{
"AbsoluteMoniker": "D:0:0:{00000000-0000-0000-0000-000000000000}|\u003CSolution\u003E|uds_tools||{04B8AB82-A572-4FEF-95CE-5222444B6B64}|"
},
{
"AbsoluteMoniker": "D:0:0:{F7B5DB9E-0890-47ED-813C-324B0AF56390}|CAN_Tool\\uds_tools.csproj|E:\\liudagui\\project\\HONGRI\\code\\git\\uds_tools\\can_tool\\uds_tools.designer.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}",
"RelativeMoniker": "D:0:0:{F7B5DB9E-0890-47ED-813C-324B0AF56390}|CAN_Tool\\uds_tools.csproj|solutionrelative:can_tool\\uds_tools.designer.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}"
},
{
"AbsoluteMoniker": "D:0:0:{F7B5DB9E-0890-47ED-813C-324B0AF56390}|CAN_Tool\\uds_tools.csproj|E:\\liudagui\\project\\HONGRI\\code\\git\\uds_tools\\can_tool\\uds_tools.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}",
"RelativeMoniker": "D:0:0:{F7B5DB9E-0890-47ED-813C-324B0AF56390}|CAN_Tool\\uds_tools.csproj|solutionrelative:can_tool\\uds_tools.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}"
},
{
"AbsoluteMoniker": "D:0:0:{F7B5DB9E-0890-47ED-813C-324B0AF56390}|CAN_Tool\\uds_tools.csproj|E:\\liudagui\\project\\HONGRI\\code\\git\\uds_tools\\can_tool\\candevice\\pcan\\pcanbasic.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}",
"RelativeMoniker": "D:0:0:{F7B5DB9E-0890-47ED-813C-324B0AF56390}|CAN_Tool\\uds_tools.csproj|solutionrelative:can_tool\\candevice\\pcan\\pcanbasic.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}"
},
{
"AbsoluteMoniker": "D:0:0:{F7B5DB9E-0890-47ED-813C-324B0AF56390}|CAN_Tool\\uds_tools.csproj|E:\\liudagui\\project\\HONGRI\\code\\git\\uds_tools\\can_tool\\candevice\\pcan\\pcan.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}",
"RelativeMoniker": "D:0:0:{F7B5DB9E-0890-47ED-813C-324B0AF56390}|CAN_Tool\\uds_tools.csproj|solutionrelative:can_tool\\candevice\\pcan\\pcan.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}"
},
{
"AbsoluteMoniker": "D:0:0:{F7B5DB9E-0890-47ED-813C-324B0AF56390}|CAN_Tool\\uds_tools.csproj|E:\\liudagui\\project\\HONGRI\\code\\git\\uds_tools\\can_tool\\candevice\\gccan\\gc_ecanbasic.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}",
"RelativeMoniker": "D:0:0:{F7B5DB9E-0890-47ED-813C-324B0AF56390}|CAN_Tool\\uds_tools.csproj|solutionrelative:can_tool\\candevice\\gccan\\gc_ecanbasic.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}"
},
{
"AbsoluteMoniker": "D:0:0:{F7B5DB9E-0890-47ED-813C-324B0AF56390}|CAN_Tool\\uds_tools.csproj|E:\\liudagui\\project\\HONGRI\\code\\git\\uds_tools\\can_tool\\candevice\\gccan\\gc_ecan.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}",
"RelativeMoniker": "D:0:0:{F7B5DB9E-0890-47ED-813C-324B0AF56390}|CAN_Tool\\uds_tools.csproj|solutionrelative:can_tool\\candevice\\gccan\\gc_ecan.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}"
}
],
"DocumentGroupContainers": [
{
"Orientation": 0,
"VerticalTabListWidth": 256,
"DocumentGroups": [
{
"DockedWidth": 200,
"SelectedChildIndex": 1,
"Children": [
{
"$type": "Document",
"DocumentIndex": 2,
"Title": "ToSun.cs",
"DocumentMoniker": "E:\\liudagui\\project\\HONGRI\\code\\git\\uds_tools\\CAN_Tool\\CanDevice\\TOSUN\\ToSun.cs",
"RelativeDocumentMoniker": "CAN_Tool\\CanDevice\\TOSUN\\ToSun.cs",
"ToolTip": "E:\\liudagui\\project\\HONGRI\\code\\git\\uds_tools\\CAN_Tool\\CanDevice\\TOSUN\\ToSun.cs",
"RelativeToolTip": "CAN_Tool\\CanDevice\\TOSUN\\ToSun.cs",
"ViewState": "AgIAADUAAAAAAAAAAAAQwI8AAAAgAAAAAAAAAA==",
"Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000738|",
"WhenOpened": "2024-11-06T03:59:41.934Z",
"IsPinned": true
},
{
"$type": "Document",
"DocumentIndex": 0,
"Title": "UDS.cs",
"DocumentMoniker": "E:\\liudagui\\project\\HONGRI\\code\\git\\uds_tools\\CAN_Tool\\UDS.cs",
"RelativeDocumentMoniker": "CAN_Tool\\UDS.cs",
"ToolTip": "E:\\liudagui\\project\\HONGRI\\code\\git\\uds_tools\\CAN_Tool\\UDS.cs",
"RelativeToolTip": "CAN_Tool\\UDS.cs",
"ViewState": "AgIAAJoBAAAAAAAAAAAcwKkBAAAAAAAAAAAAAA==",
"Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000738|",
"WhenOpened": "2024-11-06T08:33:03.505Z",
"EditorCaption": ""
},
{
"$type": "Document",
"DocumentIndex": 3,
"Title": "uds_tools",
"DocumentMoniker": "E:\\liudagui\\project\\HONGRI\\code\\git\\uds_tools\\CAN_Tool\\uds_tools.csproj",
"RelativeDocumentMoniker": "CAN_Tool\\uds_tools.csproj",
"ToolTip": "E:\\liudagui\\project\\HONGRI\\code\\git\\uds_tools\\CAN_Tool\\uds_tools.csproj",
"RelativeToolTip": "CAN_Tool\\uds_tools.csproj",
"Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.001001|",
"WhenOpened": "2024-11-06T08:27:23.586Z"
},
{
"$type": "Document",
"DocumentIndex": 4,
"Title": "uds_tools.Designer.cs",
"DocumentMoniker": "E:\\liudagui\\project\\HONGRI\\code\\git\\uds_tools\\CAN_Tool\\uds_tools.Designer.cs",
"RelativeDocumentMoniker": "CAN_Tool\\uds_tools.Designer.cs",
"ToolTip": "E:\\liudagui\\project\\HONGRI\\code\\git\\uds_tools\\CAN_Tool\\uds_tools.Designer.cs",
"RelativeToolTip": "CAN_Tool\\uds_tools.Designer.cs",
"ViewState": "AgIAAE8AAAAAAAAAAAAtwDwAAAAcAAAAAAAAAA==",
"Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000738|",
"WhenOpened": "2024-11-06T08:22:58.434Z"
},
{
"$type": "Document",
"DocumentIndex": 5,
"Title": "uds_tools.cs",
"DocumentMoniker": "E:\\liudagui\\project\\HONGRI\\code\\git\\uds_tools\\CAN_Tool\\uds_tools.cs",
"RelativeDocumentMoniker": "CAN_Tool\\uds_tools.cs",
"ToolTip": "E:\\liudagui\\project\\HONGRI\\code\\git\\uds_tools\\CAN_Tool\\uds_tools.cs",
"RelativeToolTip": "CAN_Tool\\uds_tools.cs",
"ViewState": "AgIAAGoGAAAAAAAAAAArwIYGAAAvAAAAAAAAAA==",
"Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000738|",
"WhenOpened": "2024-11-06T04:48:46.253Z"
},
{
"$type": "Document",
"DocumentIndex": 1,
"Title": "uds_tools.cs [\u8BBE\u8BA1]",
"DocumentMoniker": "E:\\liudagui\\project\\HONGRI\\code\\git\\uds_tools\\CAN_Tool\\uds_tools.cs",
"RelativeDocumentMoniker": "CAN_Tool\\uds_tools.cs",
"ToolTip": "E:\\liudagui\\project\\HONGRI\\code\\dev\\uds_tools\\CAN_Tool\\uds_tools.cs [\u8BBE\u8BA1]",
"RelativeToolTip": "..\\..\\dev\\uds_tools\\CAN_Tool\\uds_tools.cs [\u8BBE\u8BA1]",
"Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000738|",
"WhenOpened": "2024-11-06T05:18:35.248Z"
},
{
"$type": "Document",
"DocumentIndex": 6,
"Title": "PCANBasic.cs",
"DocumentMoniker": "E:\\liudagui\\project\\HONGRI\\code\\git\\uds_tools\\CAN_Tool\\CanDevice\\PCAN\\PCANBasic.cs",
"RelativeDocumentMoniker": "CAN_Tool\\CanDevice\\PCAN\\PCANBasic.cs",
"ToolTip": "E:\\liudagui\\project\\HONGRI\\code\\git\\uds_tools\\CAN_Tool\\CanDevice\\PCAN\\PCANBasic.cs",
"RelativeToolTip": "CAN_Tool\\CanDevice\\PCAN\\PCANBasic.cs",
"ViewState": "AgIAAEwEAAAAAAAAAAAAwFoEAAApAAAAAAAAAA==",
"Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000738|",
"WhenOpened": "2024-11-06T04:01:51.647Z"
},
{
"$type": "Document",
"DocumentIndex": 7,
"Title": "Pcan.cs",
"DocumentMoniker": "E:\\liudagui\\project\\HONGRI\\code\\git\\uds_tools\\CAN_Tool\\CanDevice\\PCAN\\Pcan.cs",
"RelativeDocumentMoniker": "CAN_Tool\\CanDevice\\PCAN\\Pcan.cs",
"ToolTip": "E:\\liudagui\\project\\HONGRI\\code\\git\\uds_tools\\CAN_Tool\\CanDevice\\PCAN\\Pcan.cs",
"RelativeToolTip": "CAN_Tool\\CanDevice\\PCAN\\Pcan.cs",
"ViewState": "AgIAAKgAAAAAAAAAAAAQwLUAAABGAAAAAAAAAA==",
"Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000738|",
"WhenOpened": "2024-11-06T03:57:50.869Z"
},
{
"$type": "Document",
"DocumentIndex": 8,
"Title": "GC_ECANBasic.cs",
"DocumentMoniker": "E:\\liudagui\\project\\HONGRI\\code\\git\\uds_tools\\CAN_Tool\\CanDevice\\GCCAN\\GC_ECANBasic.cs",
"RelativeDocumentMoniker": "CAN_Tool\\CanDevice\\GCCAN\\GC_ECANBasic.cs",
"ToolTip": "E:\\liudagui\\project\\HONGRI\\code\\git\\uds_tools\\CAN_Tool\\CanDevice\\GCCAN\\GC_ECANBasic.cs",
"RelativeToolTip": "CAN_Tool\\CanDevice\\GCCAN\\GC_ECANBasic.cs",
"ViewState": "AgIAAEsAAAAAAAAAAAAUwJkAAAAvAAAAAAAAAA==",
"Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000738|",
"WhenOpened": "2024-11-06T03:51:53.1Z"
},
{
"$type": "Document",
"DocumentIndex": 9,
"Title": "GC_ECAN.cs",
"DocumentMoniker": "E:\\liudagui\\project\\HONGRI\\code\\git\\uds_tools\\CAN_Tool\\CanDevice\\GCCAN\\GC_ECAN.cs",
"RelativeDocumentMoniker": "CAN_Tool\\CanDevice\\GCCAN\\GC_ECAN.cs",
"ToolTip": "E:\\liudagui\\project\\HONGRI\\code\\git\\uds_tools\\CAN_Tool\\CanDevice\\GCCAN\\GC_ECAN.cs",
"RelativeToolTip": "CAN_Tool\\CanDevice\\GCCAN\\GC_ECAN.cs",
"ViewState": "AgIAAAAAAAAAAAAAAAAAAAYAAAAbAAAAAAAAAA==",
"Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000738|",
"WhenOpened": "2024-11-06T03:51:43.461Z"
}
]
}
]
}
]
}

22
CAN_Tool.sln Normal file
View File

@ -0,0 +1,22 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 17
VisualStudioVersion = 17.11.35327.3
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "uds_tools", "CAN_Tool\uds_tools.csproj", "{F7B5DB9E-0890-47ED-813C-324B0AF56390}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{F7B5DB9E-0890-47ED-813C-324B0AF56390}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{F7B5DB9E-0890-47ED-813C-324B0AF56390}.Debug|Any CPU.Build.0 = Debug|Any CPU
{F7B5DB9E-0890-47ED-813C-324B0AF56390}.Release|Any CPU.ActiveCfg = Release|Any CPU
{F7B5DB9E-0890-47ED-813C-324B0AF56390}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
EndGlobal

BIN
CAN_Tool.v12.suo Normal file

Binary file not shown.

6
CAN_Tool/App.config Normal file
View File

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.8"/>
</startup>
</configuration>

261
CAN_Tool/CRC32Cls.cs Normal file
View File

@ -0,0 +1,261 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace CanTool
{
class CRC32Cls
{
private byte crc_msb_lsb_cfg = 1;
private byte CRC_MSB = 0;
private byte CRC_LSB = 1;
public uint BZIP2_TABLE_SIZE = 256u;
public uint BZIP2_CALCULATED_WIDTH = 8u;
//public ulong BZIP2_INIT_CRC_TABLE_SHIFT = 24ul;
public ulong BZIP2_INIT_CRC_TABLE_BITS = 8ul;
public static uint gs_bzip2CrcRemainder;
public static uint[] gs_bzip2CrcTable = new uint[256u];
public uint BZIP2_INIT_CRC_TABLE_MASK;
public uint CRC32_BZIP2_POLYNOMIAL;
//crc表
/* static uint[] crcTable =
{
0x0, 0x77073096, 0xee0e612c, 0x990951ba, 0x76dc419, 0x706af48f, 0xe963a535, 0x9e6495a3,
0xedb8832, 0x79dcb8a4, 0xe0d5e91e, 0x97d2d988, 0x9b64c2b, 0x7eb17cbd, 0xe7b82d07, 0x90bf1d91,
0x1db71064, 0x6ab020f2, 0xf3b97148, 0x84be41de, 0x1adad47d, 0x6ddde4eb, 0xf4d4b551, 0x83d385c7,
0x136c9856, 0x646ba8c0, 0xfd62f97a, 0x8a65c9ec, 0x14015c4f, 0x63066cd9, 0xfa0f3d63, 0x8d080df5,
0x3b6e20c8, 0x4c69105e, 0xd56041e4, 0xa2677172, 0x3c03e4d1, 0x4b04d447, 0xd20d85fd, 0xa50ab56b,
0x35b5a8fa, 0x42b2986c, 0xdbbbc9d6, 0xacbcf940, 0x32d86ce3, 0x45df5c75, 0xdcd60dcf, 0xabd13d59,
0x26d930ac, 0x51de003a, 0xc8d75180, 0xbfd06116, 0x21b4f4b5, 0x56b3c423, 0xcfba9599, 0xb8bda50f,
0x2802b89e, 0x5f058808, 0xc60cd9b2, 0xb10be924, 0x2f6f7c87, 0x58684c11, 0xc1611dab, 0xb6662d3d,
0x76dc4190, 0x1db7106, 0x98d220bc, 0xefd5102a, 0x71b18589, 0x6b6b51f, 0x9fbfe4a5, 0xe8b8d433,
0x7807c9a2, 0xf00f934, 0x9609a88e, 0xe10e9818, 0x7f6a0dbb, 0x86d3d2d, 0x91646c97, 0xe6635c01,
0x6b6b51f4, 0x1c6c6162, 0x856530d8, 0xf262004e, 0x6c0695ed, 0x1b01a57b, 0x8208f4c1, 0xf50fc457,
0x65b0d9c6, 0x12b7e950, 0x8bbeb8ea, 0xfcb9887c, 0x62dd1ddf, 0x15da2d49, 0x8cd37cf3, 0xfbd44c65,
0x4db26158, 0x3ab551ce, 0xa3bc0074, 0xd4bb30e2, 0x4adfa541, 0x3dd895d7, 0xa4d1c46d, 0xd3d6f4fb,
0x4369e96a, 0x346ed9fc, 0xad678846, 0xda60b8d0, 0x44042d73, 0x33031de5, 0xaa0a4c5f, 0xdd0d7cc9,
0x5005713c, 0x270241aa, 0xbe0b1010, 0xc90c2086, 0x5768b525, 0x206f85b3, 0xb966d409, 0xce61e49f,
0x5edef90e, 0x29d9c998, 0xb0d09822, 0xc7d7a8b4, 0x59b33d17, 0x2eb40d81, 0xb7bd5c3b, 0xc0ba6cad,
0xedb88320, 0x9abfb3b6, 0x3b6e20c, 0x74b1d29a, 0xead54739, 0x9dd277af, 0x4db2615, 0x73dc1683,
0xe3630b12, 0x94643b84, 0xd6d6a3e, 0x7a6a5aa8, 0xe40ecf0b, 0x9309ff9d, 0xa00ae27, 0x7d079eb1,
0xf00f9344, 0x8708a3d2, 0x1e01f268, 0x6906c2fe, 0xf762575d, 0x806567cb, 0x196c3671, 0x6e6b06e7,
0xfed41b76, 0x89d32be0, 0x10da7a5a, 0x67dd4acc, 0xf9b9df6f, 0x8ebeeff9, 0x17b7be43, 0x60b08ed5,
0xd6d6a3e8, 0xa1d1937e, 0x38d8c2c4, 0x4fdff252, 0xd1bb67f1, 0xa6bc5767, 0x3fb506dd, 0x48b2364b,
0xd80d2bda, 0xaf0a1b4c, 0x36034af6, 0x41047a60, 0xdf60efc3, 0xa867df55, 0x316e8eef, 0x4669be79,
0xcb61b38c, 0xbc66831a, 0x256fd2a0, 0x5268e236, 0xcc0c7795, 0xbb0b4703, 0x220216b9, 0x5505262f,
0xc5ba3bbe, 0xb2bd0b28, 0x2bb45a92, 0x5cb36a04, 0xc2d7ffa7, 0xb5d0cf31, 0x2cd99e8b, 0x5bdeae1d,
0x9b64c2b0, 0xec63f226, 0x756aa39c, 0x26d930a, 0x9c0906a9, 0xeb0e363f, 0x72076785, 0x5005713,
0x95bf4a82, 0xe2b87a14, 0x7bb12bae, 0xcb61b38, 0x92d28e9b, 0xe5d5be0d, 0x7cdcefb7, 0xbdbdf21,
0x86d3d2d4, 0xf1d4e242, 0x68ddb3f8, 0x1fda836e, 0x81be16cd, 0xf6b9265b, 0x6fb077e1, 0x18b74777,
0x88085ae6, 0xff0f6a70, 0x66063bca, 0x11010b5c, 0x8f659eff, 0xf862ae69, 0x616bffd3, 0x166ccf45,
0xa00ae278, 0xd70dd2ee, 0x4e048354, 0x3903b3c2, 0xa7672661, 0xd06016f7, 0x4969474d, 0x3e6e77db,
0xaed16a4a, 0xd9d65adc, 0x40df0b66, 0x37d83bf0, 0xa9bcae53, 0xdebb9ec5, 0x47b2cf7f, 0x30b5ffe9,
0xbdbdf21c, 0xcabac28a, 0x53b39330, 0x24b4a3a6, 0xbad03605, 0xcdd70693, 0x54de5729, 0x23d967bf,
0xb3667a2e, 0xc4614ab8, 0x5d681b02, 0x2a6f2b94, 0xb40bbe37, 0xc30c8ea1, 0x5a05df1b, 0x2d02ef8d,
};*/
public void SetLsb()
{
crc_msb_lsb_cfg = CRC_LSB;
}
public void SetMsb()
{
crc_msb_lsb_cfg = CRC_MSB;
}
//返回字符串的crc
public uint GetCRC16(byte[] msg)
{
/*int iCount = msg.Length;
uint crc = 0xFFFFFFFF;
for (int i = 0; i < iCount; i++)
{
crc = ((crc >> 8) & 0x00FFFFFF) ^ crcTable[(crc ^ (byte)msg[i]) & 0xFF];
}
return crc ^ 0xFFFFFFFF;*/
uint mask = 0x1021;
int size = msg.Length;
uint crc = 0xFFFF;
int tmp;
int i, j;
for (i = 0; i < size; i++)
{
tmp = msg[i] << 8;
for (j = 0; j < 8; j++)
{
if (((crc ^ tmp) & 0x8000u) == 0x8000u)
{
crc = (crc << 1) ^ mask;
}
else
{
crc <<= 1;
}
tmp <<= 1;
}
}
return crc;
}
public void _Bzip2_InitTable()
{
uint remainder;
uint dividend;
byte bit;
if(crc_msb_lsb_cfg==CRC_MSB)// msb
{
/* Compute the remainder of each possible dividend.*/
for (dividend = 0; dividend < BZIP2_TABLE_SIZE; dividend++)
{
/* Start with the dividend followed by zeros.*/
remainder = dividend << 24;
/* Perform modulo-2 division, a bit at a time.*/
for (bit = (byte)BZIP2_INIT_CRC_TABLE_BITS; bit > 0; --bit)
{
/* Try to divide the current data bit.*/
if ((remainder & BZIP2_INIT_CRC_TABLE_MASK) != 0UL)
{
remainder = (remainder << 1) ^ CRC32_BZIP2_POLYNOMIAL;
}
else
{
remainder = (remainder << 1);
}
}
/* Store the result into the table.*/
gs_bzip2CrcTable[dividend] = remainder;
}
}
else/// geely lsb
{
/* Compute the remainder of each possible dividend.*/
for (dividend = 0; dividend < BZIP2_TABLE_SIZE; dividend++)
{
/* Start with the dividend followed by zeros.*/
remainder = dividend;
/* Perform modulo-2 division, a bit at a time.*/
for (bit = (byte)BZIP2_INIT_CRC_TABLE_BITS; bit > 0; bit--)
{
/* Try to divide the current data bit.*/
if ((remainder & BZIP2_INIT_CRC_TABLE_MASK) != 0UL)
{
remainder = (remainder >> 1) ^ CRC32_BZIP2_POLYNOMIAL;
}
else
{
remainder = (remainder >> 1);
}
}
/* Store the result into the table.*/
gs_bzip2CrcTable[dividend] = remainder;
}
}
return;
}
public void Bzip2_Init()
{
if(crc_msb_lsb_cfg==CRC_MSB)//msb
{
BZIP2_INIT_CRC_TABLE_MASK = (0x80000000);
CRC32_BZIP2_POLYNOMIAL = (0x04C11DB7);
}
else///geely lsb
{
BZIP2_INIT_CRC_TABLE_MASK = 0x00000001;
CRC32_BZIP2_POLYNOMIAL = 0xEDB88320;
}
_Bzip2_InitTable();
}
public void Bzip2_Start()
{
gs_bzip2CrcRemainder = 0xFFFFFFFF;
}
public int Bzip2_Update(uint size, byte[] data)
{
byte tmp;
uint i;
uint crc = gs_bzip2CrcRemainder;
if(crc_msb_lsb_cfg==CRC_MSB)///msb
{
for (i = 0; i < size; i++)
{
tmp = (byte)((crc >> 24) ^ data[i]);
crc = (crc << 8) ^ gs_bzip2CrcTable[tmp];
}
gs_bzip2CrcRemainder = crc;
}
else/// geely lsb
{
for (i = 0; i < size; i++)
{
tmp = (byte)((crc ^ data[i]) & 0xFFu);
crc = (crc >> 8) ^ gs_bzip2CrcTable[tmp];
}
gs_bzip2CrcRemainder = crc;
}
return 0;
}
public void _Lbm_CalculateHashByDct(byte[] databuf, uint lenght)
{
byte[] data = new byte[512];
uint offset = 0;
do
{
if (lenght > 512)
{
for (int i = 0; i < 512; i++)
{
data[i] = databuf[i + offset];
}
Bzip2_Update(512, data);
//databuf += 512;
lenght -= 512;
offset += 512;
}
else
{
for (int i = 0; i < lenght; i++)
{
data[i] = databuf[i + offset];
}
Bzip2_Update(lenght, data);
lenght = 0;
}
} while (lenght != 0);
return;
}
public uint Bzip2_Verify()
{
return gs_bzip2CrcRemainder ^ 0xFFFFFFFF;
//return gs_bzip2CrcRemainder;
}
}
}

View File

@ -0,0 +1,204 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Can
{
class CanMessage
{
public UInt32 Id;
public byte[] Data;
public int Len;
public bool IsTx;
public CanMessage()
{
Id = 0;
Data = new byte[8];
Len = 8;
IsTx = true;
}
public CanMessage(UInt32 id, byte[] data, int len, bool isTx)
{
Id = id;
Data = data;
Len = len;
IsTx = isTx;
}
}
class CanDevice
{
public delegate void CanReadMessageCallBack(UInt32 id, byte[] data, int len);
private event CanReadMessageCallBack CanReadMessageEvent;
private static byte[] LenToDlcTable =
{
/*0~8*/
0,1,2,3,4,5,6,7,8,
/*9~12*/
9,9,9,9,
/*13~16*/
10,10,10,10,
/*17~20*/
11,11,11,11,
/*21~24*/
12,12,12,12,
/*25~32*/
13,13,13,13,13,13,13,13,
/*33~48*/
14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,
/*49~64*/
15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,
};
private static byte[] DlcToLenTable =
{
/*0~15*/
0,1,2,3,4,5,6,7,8,12,16,20,24,32,48,64
};
protected static byte MessagesLenToDlc(int len)
{
return LenToDlcTable[len];
}
protected static byte MessagesDlcToLen(int dlc)
{
return DlcToLenTable[dlc];
}
//标准CAN
#region CAN
//CAN初始化
public virtual string CanInit()
{
return "未选择具体设备或没完成相应设备的驱动";
}
//CAN逆初始化
public virtual string CanDeInit()
{
this.UnregisterCanReadEventAll();
return "未选择具体设备或没完成相应设备的驱动";
}
public virtual string CanReceiveEventEnable()
{
return "未选择具体设备或没完成相应设备的驱动";
}
public virtual string CanReceiveEventDisable()
{
return "未选择具体设备或没完成相应设备的驱动";
}
//CAN设置ID过滤器
public virtual string CanSetFilter(UInt32 stratId, UInt32 endId)
{
return "未选择具体设备或没完成相应设备的驱动";
}
//CAN发送一帧报文
public virtual void CanSendMessage(UInt32 id, byte[] data, int len)
{
}
//CAN从FIFO读取一帧报文
public virtual bool CanReadMessage(ref UInt32 id, byte[] data, ref int len)
{
return false;
}
#endregion
//CANFD
#region CANFD
//CANFD初始化
public virtual string CanFdInit()
{
return "未选择具体设备或没完成相应设备的驱动";
}
//CANFD逆初始化
public virtual string CanFdDeInit()
{
this.UnregisterCanReadEventAll();
return "未选择具体设备或没完成相应设备的驱动";
}
public virtual string CanFdReceiveEventEnable()
{
return "未选择具体设备或没完成相应设备的驱动";
}
public virtual string CanFdReceiveEventDisable()
{
return "未选择具体设备或没完成相应设备的驱动";
}
//CANFD设置ID过滤器
public virtual string CanFdSetFilter(UInt32 stratId, UInt32 endId)
{
return "未选择具体设备或没完成相应设备的驱动";
}
//CANFD发送一帧报文
public virtual void CanFdSendMessage(UInt32 id, byte[] data, int len)
{
}
//CANFD从FIFO读取一帧报文
public virtual bool CanFdReadMessage(ref UInt32 id, byte[] data, ref int len)
{
return false;
}
#endregion
//注册接收报文事件
public void RegisterCanReadEvent(CanReadMessageCallBack canReadFunc)
{
CanReadMessageEvent += canReadFunc;
}
//删除一个接收报文事件
public void UnregisterCanReadEvent(CanReadMessageCallBack canReadFunc)
{
CanReadMessageEvent -= canReadFunc;
}
//删除所有注册的接收报文事件
public void UnregisterCanReadEventAll()
{
CanReadMessageEvent = null;
}
//触发接收报文事件
public void CanReadEventInvoke(UInt32 id, byte[] data, int len)
{
if (null != CanReadMessageEvent)
{
CanReadMessageEvent.Invoke(id, data, len);
}
}
}
}

View File

@ -0,0 +1,240 @@
using System;
using System.Collections.Generic;
using System.Text;
using System.Runtime.InteropServices;
using System.Threading;
using GC_ECan.Basic;
using System.Windows.Forms;
namespace Can
{
class ECanDevice : CanDevice
{
Thread ReadThread;
//标准CAN
#region CAN
//CAN初始化
public override string CanInit()
{
string ret;
INIT_CONFIG init_config = new INIT_CONFIG();
init_config.AccCode = 0;
init_config.AccMask = 0xffffff;
init_config.Filter = 0;
// 波特率 500K
init_config.Timing0 = 0;
init_config.Timing1 = 0x1c;
init_config.Mode = 0;
if (ECANDLL.OpenDevice(1, 0, 0) != GC_ECan.Basic.ECANStatus.STATUS_OK)
{
MessageBox.Show("Open GC_USBCAN_II fault!");
ret = "Error!";
}
if (ECANDLL.InitCAN(1, 0, 0, ref init_config) != GC_ECan.Basic.ECANStatus.STATUS_OK)
{
MessageBox.Show("Init GC_USBCAN_II fault!");
ret = "Error!";
}
if (ECANDLL.StartCAN(1, 0, 0) != GC_ECan.Basic.ECANStatus.STATUS_OK)
{
MessageBox.Show("StartCAN GC_USBCAN_II fault!");
ret = "Error!";
}
else
{
ret = "OK";
}
return ret;
}
//CAN逆初始化
public override string CanDeInit()
{
string ret;
if(ECANDLL.CloseDevice(1, 0) == GC_ECan.Basic.ECANStatus.STATUS_OK)
{
ret = "OK";
}
else
{
ret = "断开连接失败";
}
return ret;
}
public override string CanReceiveEventEnable()
{
string ret;
if (null == ReadThread)
{
ret = "线程为null";
}
else
{
ReadThread.Start();
ret = "OK";
}
return ret;
}
public override string CanReceiveEventDisable()
{
string ret;
if (null == ReadThread)
{
ret = "线程为null";
}
else
{
ReadThread.Abort();
ret = "OK";
}
return ret;
}
// CAN发送一帧报文
public override void CanSendMessage(UInt32 id, byte[] data, int len)
{
CAN_OBJ mMsg;
uint mLen = 1; // 发送多少次
// We create a TPCANMsg message structure
//
mMsg = new CAN_OBJ();
mMsg.data = new byte[8];
mMsg.ID = id;
mMsg.DataLen = (byte)len;
mMsg.ExternFlag = 0; // 标准和扩展选择
mMsg.RemoteFlag = 0; // 本地和远程选择
for(int i = 0; i< mMsg.DataLen; i++)
{
mMsg.data[i] = data[i];
}
if (ECANDLL.Transmit(1, 0, 0, ref mMsg, (ushort)mLen) != ECANStatus.STATUS_OK)
{
}
}
//CAN从FIFO接收一帧报文
public override bool CanReadMessage(ref UInt32 id, byte[] data, ref int len)
{
bool ret = false;
CAN_OBJ mMsg = new CAN_OBJ();
mMsg.data = new byte[8];
uint mLen = 1; // 接收多少次
if (!((ECANDLL.Receive(1, 0, 0, out mMsg, mLen, 1) == ECANStatus.STATUS_OK) & (mLen > 0)))
{
return ret;
}
else
{
id = mMsg.ID;
len = (int)mMsg.DataLen;
for(int i = 0;i < len; i++)
{
data[i] = mMsg.data[i];
}
ret = true;
}
return ret;
}
// 设置过滤设置
public override string CanSetFilter(UInt32 stratId, UInt32 endId)
{
return "OK";
}
#endregion
//CANFD
#region CANFD
//CANFD初始化
public override string CanFdInit()
{
return "OK";
}
//CANFD初始化
public override string CanFdDeInit()
{
// return this.CanDeInit();
string ret;
ret = "OK";
return ret;
}
// CanFD 过滤器设置
public override string CanFdSetFilter(UInt32 stratId, UInt32 endId)
{
//清除所有过滤器
//设置过滤
return "OK";
}
// 开接收
public override string CanFdReceiveEventEnable()
{
return this.CanReceiveEventEnable();
}
// 关接收
public override string CanFdReceiveEventDisable()
{
return this.CanReceiveEventDisable();
}
//CANFD发送一帧报文
public override void CanFdSendMessage(UInt32 id, byte[] data, int len)
{
}
//CANFD从FIFO接收一帧报文
public override bool CanFdReadMessage(ref UInt32 id, byte[] data, ref int len)
{
bool ret = false;
return ret;
}
#endregion
}
}

View File

@ -0,0 +1,180 @@
using System;
using System.Collections.Generic;
using System.Text;
using System.Runtime.InteropServices;
namespace GC_ECan.Basic
{
[Flags]
public enum ECANStatus : uint
{
/// <summary>
/// error
/// </summary>
STATUS_ERR = 0x00000,
/// <summary>
/// No error
/// </summary>
STATUS_OK = 0x00001,
}
[StructLayout(LayoutKind.Sequential)]
public struct CAN_OBJ
{
public uint ID;
public uint 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 struct CAN_ERR_INFO
{
public uint ErrCode;
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 3)]
public byte[] Passive_ErrData;
public byte ArLost_ErrData;
}
/*
public struct CAN_OBJ
{
public uint ID;
public uint TimeStamp;
public byte TimeFlag;
public byte RemoteFlag;
public byte ExternFlag;
public byte DataLen;
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 8)]
public byte[] data;
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 2)]
public byte[] Reserved;
}
*/
public struct INIT_CONFIG
{
public uint AccCode;
public uint AccMask;
public uint Reserved;
public byte Filter;
public byte Timing0;
public byte Timing1;
public byte Mode;
}
public struct BOARD_INFO
{
public ushort hw_Version;
public ushort fw_Version;
public ushort dr_Version;
public ushort in_Version;
public ushort 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 = 4)]
public ushort[] Reserved;
}
public static class ECANDLL
{
[DllImport("ECANVCI.dll", EntryPoint = "OpenDevice")]
public static extern ECANStatus OpenDevice(
UInt32 DeviceType,
UInt32 DeviceInd,
UInt32 Reserved);
[DllImport("ECANVCI.dll", EntryPoint = "CloseDevice")]
public static extern ECANStatus CloseDevice(
UInt32 DeviceType,
UInt32 DeviceInd);
[DllImport("ECANVCI.dll", EntryPoint = "InitCAN")]
public static extern ECANStatus InitCAN(
UInt32 DeviceType,
UInt32 DeviceInd,
UInt32 CANInd,
ref INIT_CONFIG InitConfig);
[DllImport("ECANVCI.dll", EntryPoint = "StartCAN")]
public static extern ECANStatus StartCAN(
UInt32 DeviceType,
UInt32 DeviceInd,
UInt32 CANInd);
[DllImport("ECANVCI.dll", EntryPoint = "ResetCAN")]
public static extern ECANStatus ResetCAN(
UInt32 DeviceType,
UInt32 DeviceInd,
UInt32 CANInd);
[DllImport("ECANVCI.dll", EntryPoint = "Transmit")]
public static extern ECANStatus Transmit(
UInt32 DeviceType,
UInt32 DeviceInd,
UInt32 CANInd,
ref CAN_OBJ Send,
UInt16 length);
[DllImport("ECANVCI.dll", EntryPoint = "Receive")]
public static extern ECANStatus Receive(
UInt32 DeviceType,
UInt32 DeviceInd,
UInt32 CANInd,
out CAN_OBJ Receive,
UInt32 length,
UInt32 WaitTime);
[DllImport("ECANVCI.dll", EntryPoint = "ReadErrInfo")]
public static extern ECANStatus ReadErrInfo(
UInt32 DeviceType,
UInt32 DeviceInd,
UInt32 CANInd,
out CAN_ERR_INFO ReadErrInfo);
[DllImport("ECANVCI.dll", EntryPoint = "ReadBoardInfo")]
public static extern ECANStatus ReadBoardInfo(
UInt32 DeviceType,
UInt32 DeviceInd,
out BOARD_INFO ReadErrInfo);
}
}

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,369 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Threading;
using Peak.Can.Basic;
namespace Can
{
using TPCANHandle = System.UInt16;
//using TPCANBitrateFD = System.String;
//using TPCANTimestampFD = System.UInt64;
class PcanDevice : CanDevice
{
private TPCANHandle PcanHandle;
Thread ReadThread;
AutoResetEvent ReceiveEvent;
bool IsConnect;
//private TPCANBaudrate Baudrate;
public PcanDevice()
{
IsConnect = false;
this.PcanHandle = PCANBasic.PCAN_USBBUS1;
}
public override string CanInit()
{
TPCANStatus stsResult;
string ret;
/*stsResult = PCANBasic.Initialize(
PcanHandle,
TPCANBaudrate.PCAN_BAUD_500K,
TPCANType.PCAN_TYPE_ISA,
(UInt32)0x0100,
(UInt16)0x03);*/
stsResult = PCANBasic.Initialize(
PcanHandle,
TPCANBaudrate.PCAN_BAUD_500K,
TPCANType.PCAN_TYPE_ISA,
(UInt32)0x0,
(UInt16)0x0);
if (stsResult != TPCANStatus.PCAN_ERROR_OK)
{
ret = GetFormatedError(stsResult);
}
else //连接成功
{
IsConnect = true;
ReadThread = new Thread(new ThreadStart(this.CANReadThreadFunc));
ReceiveEvent = new System.Threading.AutoResetEvent(false);
ReadThread.IsBackground = true;
//ReadThread.Start();
ret = "OK";
}
return ret;
}
public override string CanDeInit()
{
base.CanDeInit();
TPCANStatus stsResult;
stsResult = PCANBasic.Uninitialize(PcanHandle);
if (TPCANStatus.PCAN_ERROR_OK == stsResult)
{
IsConnect = false;
ReadThread.Abort();
return "OK";
}
else
{
return GetFormatedError(stsResult);
}
}
public override string CanReceiveEventEnable()
{
string ret;
if (null == ReadThread)
{
ret = "线程为null";
}
else
{
ReadThread.Start();
ret = "OK";
}
return ret;
}
public override string CanReceiveEventDisable()
{
string ret;
if (null == ReadThread)
{
ret = "线程为null";
}
else
{
ReadThread.Abort();
ret = "OK";
}
return ret;
}
public override string CanSetFilter(UInt32 stratId, UInt32 endId)
{
string ret;
TPCANStatus stsResult;
stsResult = PCANBasic.FilterMessages(PcanHandle, stratId, endId, TPCANMode.PCAN_MODE_STANDARD);
//stsResult = PCANBasic.FilterMessages(PcanHandle, stratId, endId, TPCANMode.PCAN_MODE_EXTENDED);
if (stsResult != TPCANStatus.PCAN_ERROR_OK)
{
ret = GetFormatedError(stsResult);
}
else
{
ret = "OK";
}
return ret;
}
private string GetFormatedError(TPCANStatus error)
{
StringBuilder strTemp;
// Creates a buffer big enough for a error-text
//
strTemp = new StringBuilder(256);
// Gets the text using the GetErrorText API function
// If the function success, the translated error is returned. If it fails,
// a text describing the current error is returned.
//
if (PCANBasic.GetErrorText(error, 0, strTemp) != TPCANStatus.PCAN_ERROR_OK)
return string.Format("An error occurred. Error-code's text ({0:X}) couldn't be retrieved", error);
else
return strTemp.ToString();
}
public override void CanSendMessage(UInt32 id, byte[] data, int len)
{
TPCANMsg msg;
msg.ID = id;
msg.DATA = data;
msg.LEN = MessagesLenToDlc(len);
msg.MSGTYPE = TPCANMessageType.PCAN_MESSAGE_STANDARD;
PCANBasic.Write(PcanHandle, ref msg);
}
public override bool CanReadMessage(ref UInt32 id, byte[] data, ref int len)
{
TPCANMsg msg;
TPCANTimestamp timeStamp;
TPCANStatus stsResult;
stsResult = PCANBasic.Read(PcanHandle, out msg, out timeStamp);
if (stsResult != TPCANStatus.PCAN_ERROR_QRCVEMPTY)
{
id = msg.ID;
msg.DATA.CopyTo(data, 0);
len = msg.LEN;
return true;
}
else
{
return false;
}
}
private void CANReadThreadFunc()
{
UInt32 id = 0;
byte[] data = new byte[8];
int len = 0;
UInt32 iBuffer;
TPCANStatus stsResult;
iBuffer = Convert.ToUInt32(ReceiveEvent.SafeWaitHandle.DangerousGetHandle().ToInt32());
// Sets the handle of the Receive-Event.
//
stsResult = PCANBasic.SetValue(PcanHandle, TPCANParameter.PCAN_RECEIVE_EVENT, ref iBuffer, sizeof(UInt32));
if (stsResult != TPCANStatus.PCAN_ERROR_OK)
{
return;
}
// While this mode is selected
while (IsConnect)
{
if (ReceiveEvent.WaitOne(50))
{
while (true == CanReadMessage(ref id, data, ref len))
{
CanReadEventInvoke(id, data, len);
}
}
}
}
public override string CanFdInit()
{
string ret;
TPCANStatus stsResult;
stsResult = PCANBasic.InitializeFD(PcanHandle, "f_clock_mhz=24, nom_brp=8, nom_tseg1=4, nom_tseg2=1, nom_sjw=1, data_brp=2, data_tseg1=4, data_tseg2=1, data_sjw=1");
if (stsResult != TPCANStatus.PCAN_ERROR_OK)
{
ret = GetFormatedError(stsResult);
}
else //连接成功
{
IsConnect = true;
ReadThread = new Thread(new ThreadStart(this.CanFdReadThreadFunc));
ReceiveEvent = new System.Threading.AutoResetEvent(false);
ReadThread.IsBackground = true;
ret = "OK";
}
return ret;
}
//CANFD初始化
public override string CanFdDeInit()
{
return this.CanDeInit();
}
public override string CanFdReceiveEventEnable()
{
return this.CanReceiveEventEnable();
}
public override string CanFdReceiveEventDisable()
{
return this.CanReceiveEventDisable();
}
//CANFD设置ID过滤器
public override string CanFdSetFilter(UInt32 startId, UInt32 endId)
{
return this.CanSetFilter(startId, endId);
}
//CANFD发送一帧报文
public override void CanFdSendMessage(UInt32 id, byte[] data, int len)
{
TPCANMsgFD msg = new TPCANMsgFD();
msg.ID = id;
msg.DLC = MessagesLenToDlc(len);
msg.DATA = new byte[64];
Array.Copy(data, msg.DATA, len);
//msg.MSGTYPE = (chbExtended.Checked) ? TPCANMessageType.PCAN_MESSAGE_EXTENDED : TPCANMessageType.PCAN_MESSAGE_STANDARD;
// msg.MSGTYPE |= (chbFD.Checked) ? TPCANMessageType.PCAN_MESSAGE_FD : TPCANMessageType.PCAN_MESSAGE_STANDARD;
//msg.MSGTYPE |= (chbBRS.Checked) ? TPCANMessageType.PCAN_MESSAGE_BRS : TPCANMessageType.PCAN_MESSAGE_STANDARD;
msg.MSGTYPE = TPCANMessageType.PCAN_MESSAGE_STANDARD;
msg.MSGTYPE |= TPCANMessageType.PCAN_MESSAGE_FD;
msg.MSGTYPE |= TPCANMessageType.PCAN_MESSAGE_BRS;
//msg.MSGTYPE |= TPCANMessageType.PCAN_MESSAGE_RTR;
PCANBasic.WriteFD(PcanHandle, ref msg);
}
//CANFD从FIFO读取一帧报文
public override bool CanFdReadMessage(ref UInt32 id, byte[] data, ref int len)
{
TPCANMsgFD msg;
UInt64 timeStamp;
TPCANStatus stsResult;
// We execute the "Read" function of the PCANBasic
//
stsResult = PCANBasic.ReadFD(PcanHandle, out msg, out timeStamp);
if (stsResult != TPCANStatus.PCAN_ERROR_QRCVEMPTY)
{
id = msg.ID;
msg.DATA.CopyTo(data, 0);
len = MessagesDlcToLen(msg.DLC);
return true;
}
else
{
return false;
}
}
private void CanFdReadThreadFunc()
{
UInt32 id = 0;
byte[] data = new byte[64];
int len = 0;
UInt32 iBuffer;
TPCANStatus stsResult;
iBuffer = Convert.ToUInt32(ReceiveEvent.SafeWaitHandle.DangerousGetHandle().ToInt32());
// Sets the handle of the Receive-Event.
//
stsResult = PCANBasic.SetValue(PcanHandle, TPCANParameter.PCAN_RECEIVE_EVENT, ref iBuffer, sizeof(UInt32));
if (stsResult != TPCANStatus.PCAN_ERROR_OK)
{
return;
}
// While this mode is selected
while (IsConnect)
{
if (ReceiveEvent.WaitOne(50))
{
while (true == CanFdReadMessage(ref id, data, ref len))
{
CanReadEventInvoke(id, data, len);
}
}
}
}
}
}

View File

@ -0,0 +1,256 @@
using System;
using System.Collections.Generic;
using System.Runtime.InteropServices;
using System.Linq;
using System.Diagnostics;
using System.Text;
using System.Threading.Tasks;
using System.Threading;
using USB2XXX;
namespace Can
{
class TooMossDevice : CanDevice
{
private Int32 DevHandle;
private Byte WriteCANIndex = 0;
private Byte ReadCANIndex = 0;
Thread CanSendMsgThread;
List<CanMessage> CanSendMsgBuffer;
object CanSendMsgLock;
public TooMossDevice()
{
CanSendMsgBuffer = new List<CanMessage>();
CanSendMsgLock = new object();
CanSendMsgThread = new Thread(new ThreadStart(CanSendMessageThreadLoop));
CanSendMsgThread.IsBackground = true;
CanSendMsgThread.Start();
}
~TooMossDevice()
{
CanSendMsgThread.Join();
CanSendMsgThread.Abort();
}
public override string CanInit()
{
USB_DEVICE.DEVICE_INFO DevInfo = new USB_DEVICE.DEVICE_INFO();
Int32[] DevHandles = new Int32[20];
bool state;
Int32 DevNum, ret;
//扫描查找设备
DevNum = USB_DEVICE.USB_ScanDevice(DevHandles);
if (DevNum <= 0)
{
return "No device connected!";
}
else
{
//Console.WriteLine("Have {0} device connected!", DevNum);
}
DevHandle = DevHandles[0];
//打开设备
state = USB_DEVICE.USB_OpenDevice(DevHandle);
if (!state)
{
return "Open device error!";
}
else
{
//Console.WriteLine("Open device success!");
}
//获取固件信息
StringBuilder FuncStr = new StringBuilder(256);
state = USB_DEVICE.DEV_GetDeviceInfo(DevHandle, ref DevInfo, FuncStr);
if (!state)
{
return "Get device infomation error!";
}
else
{
/*
Console.WriteLine("Firmware Info:");
Console.WriteLine(" Name:" + Encoding.Default.GetString(DevInfo.FirmwareName));
Console.WriteLine(" Build Date:" + Encoding.Default.GetString(DevInfo.BuildDate));
Console.WriteLine(" Firmware Version:v{0}.{1}.{2}", (DevInfo.FirmwareVersion >> 24) & 0xFF, (DevInfo.FirmwareVersion >> 16) & 0xFF, DevInfo.FirmwareVersion & 0xFFFF);
Console.WriteLine(" Hardware Version:v{0}.{1}.{2}", (DevInfo.HardwareVersion >> 24) & 0xFF, (DevInfo.HardwareVersion >> 16) & 0xFF, DevInfo.HardwareVersion & 0xFFFF);
Console.WriteLine(" Functions:" + DevInfo.Functions.ToString("X8"));
Console.WriteLine(" Functions String:" + FuncStr);
*/
}
//初始化配置CAN
USB2CAN.CAN_INIT_CONFIG CANConfig = new USB2CAN.CAN_INIT_CONFIG();
ret = USB2CAN.CAN_GetCANSpeedArg(DevHandle, ref CANConfig, 500000);
if (ret != USB2CAN.CAN_SUCCESS)
{
return "Get CAN Speed failed!";
}
else
{
//Console.WriteLine("Get CAN Speed Success!");
}
#if false
CANConfig.CAN_Mode = 1;//环回模式
#else
CANConfig.CAN_Mode = 0x80;//正常模式并接入终端电阻
#endif
ret = USB2CAN.CAN_Init(DevHandle, WriteCANIndex, ref CANConfig);
if (ret != USB2CAN.CAN_SUCCESS)
{
return "Config CAN failed!";
}
else
{
//Console.WriteLine("Config CAN Success!");
}
ret = USB2CAN.CAN_Init(DevHandle, ReadCANIndex, ref CANConfig);
if (ret != USB2CAN.CAN_SUCCESS)
{
return "Config CAN failed!";
}
else
{
//Console.WriteLine("Config CAN Success!");
}
//配置过滤器,接收所有数据
/*USB2CAN.CAN_FILTER_CONFIG CANFilter = new USB2CAN.CAN_FILTER_CONFIG();
CANFilter.Enable = 1;
CANFilter.ExtFrame = 0;
CANFilter.FilterIndex = 0;
CANFilter.FilterMode = 0;
CANFilter.MASK_IDE = 0;
CANFilter.MASK_RTR = 0;
CANFilter.MASK_Std_Ext = 0;
CANFilter.ID_Std_Ext = 0x475;
ret = USB2CAN.CAN_Filter_Init(DevHandle, ReadCANIndex, ref CANFilter);
if (ret != USB2CAN.CAN_SUCCESS)
{
Console.WriteLine("Config CAN Filter failed!");
return;
}
else
{
Console.WriteLine("Config CAN Filter Success!");
}*/
//启动CAN接收数据
ret = USB2CAN.CAN_StartGetMsg(DevHandle, ReadCANIndex);
if (ret != USB2CAN.CAN_SUCCESS)
{
return "Start CAN failed!";
}
else
{
//Console.WriteLine("Start CAN Success!");
}
return "OK";
}
public override string CanDeInit()
{
//停止CAN
USB2CAN.CAN_StopGetMsg(DevHandle, ReadCANIndex);
return "OK";
}
public override void CanSendMessage(uint id, byte[] data, int len)
{
CanMessage msg = new CanMessage();
msg.Id = id;
msg.Len = len;
msg.IsTx = true;
Array.Copy(data, 0, msg.Data, 0, len);
lock (CanSendMsgLock)
{
CanSendMsgBuffer.Add(msg);
}
}
private void CanSendMessageThreadLoop()
{
CanMessage[] msg;
for (;;)
{
msg = new CanMessage[0];
lock (CanSendMsgLock)
{
msg = CanSendMsgBuffer.ToArray();
CanSendMsgBuffer.Clear();
}
USB2CAN.CAN_MSG[] usb2CanMsg = new USB2CAN.CAN_MSG[msg.Length];
for (int i = 0; i < usb2CanMsg.Length; i++)
{
usb2CanMsg[i] = new USB2CAN.CAN_MSG();
usb2CanMsg[i].ExternFlag = 0;
usb2CanMsg[i].RemoteFlag = 0;
usb2CanMsg[i].ID = msg[i].Id;
usb2CanMsg[i].DataLen = (byte)msg[i].Len;
usb2CanMsg[i].Data = msg[i].Data;
}
//Array.Copy(data, 0, CanMsg[0].Data, 0, len);
int SendedNum = USB2CAN.CAN_SendMsg(DevHandle, WriteCANIndex, usb2CanMsg, (UInt32)usb2CanMsg.Length);
Thread.Sleep(20);
}
}
public override bool CanReadMessage(ref UInt32 id, byte[] data, ref int len)
{
USB2CAN.CAN_MSG[] CanMsgBuffer = new USB2CAN.CAN_MSG[1];
//申请存储数据缓冲区
IntPtr pt = Marshal.AllocHGlobal(Marshal.SizeOf(typeof(USB2CAN.CAN_MSG)) * CanMsgBuffer.Length);
int CanNum = USB2CAN.CAN_GetMsgWithSize(DevHandle, ReadCANIndex, pt, CanMsgBuffer.Length);
if (CanNum > 0)
{
//从缓冲区中获取数据
//CanMsgBuffer[0] = (USB2CAN.CAN_MSG)Marshal.PtrToStructure((IntPtr)((UInt32)pt + 0 * Marshal.SizeOf(typeof(USB2CAN.CAN_MSG))), typeof(USB2CAN.CAN_MSG));
CanMsgBuffer[0] = (USB2CAN.CAN_MSG)Marshal.PtrToStructure((IntPtr)((UInt32)pt), typeof(USB2CAN.CAN_MSG));
id = CanMsgBuffer[0].ID;
len = CanMsgBuffer[0].DataLen;
Array.Copy(CanMsgBuffer[0].Data, 0, data, 0, CanMsgBuffer[0].Data.Length);
Marshal.FreeHGlobal(pt);
return true;
}
else
{
Marshal.FreeHGlobal(pt);
return false;
}
}
}
}

View File

@ -0,0 +1,139 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Runtime.InteropServices;
using USB2XXX;
namespace USB2XXX
{
class USB2CAN
{
//1.CAN信息帧的数据类型定义
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Ansi)]
public struct CAN_MSG
{
public UInt32 ID; //报文ID。
public UInt32 TimeStamp; //接收到信息帧时的时间标识从CAN 控制器初始化开始计时。
public Byte RemoteFlag; //bit[0]-是否是远程帧,bit[6..5]-当前帧通道号bit[7]-发送帧标志
public Byte ExternFlag; //是否是扩展帧
public Byte DataLen; //数据长度(<=8)即Data 的长度。
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 8, ArraySubType = UnmanagedType.I1)]
public Byte[] Data; //报文的数据。
public Byte TimeStampHigh; //时间戳高位
};
//2.初始化CAN的数据类型定义
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Ansi)]
public struct CAN_INIT_CONFIG
{
//CAN波特率 = 100MHz/(CAN_BRP)/(CAN_SJW+CAN_BS1+CAN_BS2)
public UInt32 CAN_BRP; //取值范围1~1024
public Byte CAN_SJW; //取值范围1~4
public Byte CAN_BS1; //取值范围1~16
public Byte CAN_BS2; //取值范围1~8
public Byte CAN_Mode; //CAN工作模式0-正常模式1-环回模式2-静默模式3-静默环回模式
public Byte CAN_ABOM; //自动离线管理0-禁止1-使能
public Byte CAN_NART; //报文重发管理0-使能报文重传1-禁止报文重传
public Byte CAN_RFLM; //FIFO锁定管理0-新报文覆盖旧报文1-丢弃新报文
public Byte CAN_TXFP; //发送优先级管理0-标识符决定1-发送请求顺序决定
};
//3.CAN 滤波器设置数据类型定义
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Ansi)]
public struct CAN_FILTER_CONFIG{
public Byte Enable; //使能该过滤器1-使能0-禁止
public Byte FilterIndex; //过滤器索引号取值范围为0到13
public Byte FilterMode; //过滤器模式0-屏蔽位模式1-标识符列表模式
public Byte ExtFrame; //过滤的帧类型标志为1 代表要过滤的为扩展帧为0 代表要过滤的为标准帧。
public UInt32 ID_Std_Ext; //验收码ID
public UInt32 ID_IDE; //验收码IDE
public UInt32 ID_RTR; //验收码RTR
public UInt32 MASK_Std_Ext; //屏蔽码ID该项只有在过滤器模式为屏蔽位模式时有用
public UInt32 MASK_IDE; //屏蔽码IDE该项只有在过滤器模式为屏蔽位模式时有用
public UInt32 MASK_RTR; //屏蔽码RTR该项只有在过滤器模式为屏蔽位模式时有用
};
//4.CAN总线状态数据类型定义
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Ansi)]
public struct CAN_STATUS{
public UInt32 TSR; //发送状态寄存器
public UInt32 ESR; //错误状态寄存器
public Byte RECounter; //CAN 控制器接收错误寄存器。
public Byte TECounter; //CAN 控制器发送错误寄存器。
public Byte LECode; //最后的错误代码
};
//5.定义CAN Bootloader命令列表
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Ansi)]
public struct CBL_CMD_LIST{
//Bootloader相关命令
public Byte Erase; //擦出APP储存扇区数据
public Byte WriteInfo; //设置多字节写数据相关参数(写起始地址,数据量)
public Byte Write; //以多字节形式写数据
public Byte Check; //检测节点是否在线,同时返回固件信息
public Byte SetBaudRate; //设置节点波特率
public Byte Excute; //执行固件
//节点返回状态
public Byte CmdSuccess; //命令执行成功
public Byte CmdFaild; //命令执行失败
};
public const UInt32 CAN_BL_BOOT = 0x55555555;
public const UInt32 CAN_BL_APP = 0xAAAAAAAA;
//6.函数返回错误代码定义
public const Int32 CAN_SUCCESS = (0); //函数执行成功
public const Int32 CAN_ERR_NOT_SUPPORT = (-1); //适配器不支持该函数
public const Int32 CAN_ERR_USB_WRITE_FAIL = (-2); //USB写数据失败
public const Int32 CAN_ERR_USB_READ_FAIL = (-3); //USB读数据失败
public const Int32 CAN_ERR_CMD_FAIL = (-4); //命令执行失败
public const Int32 CAN_BL_ERR_CONFIG = (-20); //配置设备错误
public const Int32 CAN_BL_ERR_SEND = (-21); //发送数据出错
public const Int32 CAN_BL_ERR_TIME_OUT = (-22); //超时错误
public const Int32 CAN_BL_ERR_CMD = (-23); //执行命令失败
//USB2CAN相关函数定义
[DllImport("USB2XXX.dll")]
public static extern Int32 CAN_GetCANSpeedArg(Int32 DevHandle,ref CAN_INIT_CONFIG pCanConfig, UInt32 SpeedBps);
[DllImport("USB2XXX.dll")]
public static extern Int32 CAN_Init(Int32 DevHandle, Byte CANIndex, ref CAN_INIT_CONFIG pCanConfig);
[DllImport("USB2XXX.dll")]
public static extern Int32 CAN_Filter_Init(Int32 DevHandle, Byte CANIndex, ref CAN_FILTER_CONFIG pFilterConfig);
[DllImport("USB2XXX.dll")]
public static extern Int32 CAN_StartGetMsg(Int32 DevHandle, Byte CANIndex);
[DllImport("USB2XXX.dll")]
public static extern Int32 CAN_StopGetMsg(Int32 DevHandle, Byte CANIndex);
[DllImport("USB2XXX.dll")]
public static extern Int32 CAN_SendMsg(Int32 DevHandle, Byte CANIndex, CAN_MSG[] pCanSendMsg,UInt32 SendMsgNum);
[DllImport("USB2XXX.dll")]
public static extern Int32 CAN_GetMsg(Int32 DevHandle, Byte CANIndex, IntPtr pCanGetMsg);
[DllImport("USB2XXX.dll")]
public static extern Int32 CAN_GetMsgWithSize(Int32 DevHandle, Byte CANIndex, IntPtr pCanGetMsg, Int32 BufferSize);
[DllImport("USB2XXX.dll")]
public static extern Int32 CAN_ClearMsg(Int32 DevHandle, Byte CANIndex);
[DllImport("USB2XXX.dll")]
public static extern Int32 CAN_GetStatus(Int32 DevHandle, Byte CANIndex, ref CAN_STATUS pCANStatus);
[DllImport("USB2XXX.dll")]
public static extern Int32 CAN_SetSchedule(Int32 DevHandle, Byte CANIndex, CAN_MSG[] pCanMsgTab, Byte[] pMsgNum, UInt16[] pSendTimes, Byte MsgTabNum);
[DllImport("USB2XXX.dll")]
public static extern Int32 CAN_StartSchedule(Int32 DevHandle, Byte CANIndex, Byte MsgTabIndex, Byte TimePrecMs,Byte OrderSend);
[DllImport("USB2XXX.dll")]
public static extern Int32 CAN_StopSchedule(Int32 DevHandle, Byte CANIndex);
[DllImport("USB2XXX.dll")]
public static extern Int32 CAN_SetRelay(Int32 DevHandle, Byte RelayState);
//CAN Bootloader相关函数
[DllImport("USB2XXX.dll")]
public static extern Int32 CAN_BL_Init(Int32 DevHandle,Int32 CANIndex,ref CAN_INIT_CONFIG pInitConfig,ref CBL_CMD_LIST pCmdList);
[DllImport("USB2XXX.dll")]
public static extern Int32 CAN_BL_NodeCheck(Int32 DevHandle, Int32 CANIndex, UInt16 NodeAddr, UInt32[] pVersion, UInt32[] pType, UInt32 TimeOut);
[DllImport("USB2XXX.dll")]
public static extern Int32 CAN_BL_Erase(Int32 DevHandle,Int32 CANIndex,UInt16 NodeAddr,UInt32 FlashSize,UInt32 TimeOut);
[DllImport("USB2XXX.dll")]
public static extern Int32 CAN_BL_Write(Int32 DevHandle,Int32 CANIndex,UInt16 NodeAddr,UInt32 AddrOffset,Byte[] pData,UInt32 DataNum,UInt32 TimeOut);
[DllImport("USB2XXX.dll")]
public static extern Int32 CAN_BL_Excute(Int32 DevHandle,Int32 CANIndex,UInt16 NodeAddr,UInt32 Type);
[DllImport("USB2XXX.dll")]
public static extern Int32 CAN_BL_SetNewBaudRate(Int32 DevHandle, Int32 CANIndex, UInt16 NodeAddr, ref CAN_INIT_CONFIG pInitConfig, UInt32 NewBaudRate, UInt32 TimeOut);
}
}

View File

@ -0,0 +1,142 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Runtime.InteropServices;
namespace USB2XXX
{
class USB2CANFD
{
//1.CANFD信息帧的数据类型定义
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Ansi, Pack = 1)]
public struct CANFD_MSG
{
public UInt32 ID; //报文ID,bit[30]-RTR,bit[31]-IDE,bit[28..0]-ID
public Byte DLC; //数据字节长度,可设置为-0,1,2,3,4,5,6,7,8,12,16,20,24,32,48,64
public Byte Flags; //bit[0]-BRS,bit[1]-ESI,bit[2]-FDF,bit[6..5]-Channel,bit[7]-RXD
public Byte __Res0; //保留
public Byte TimeStampHigh;//时间戳高位
public UInt32 TimeStamp;//帧接收或者发送时的时间戳单位为10us
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 64, ArraySubType = UnmanagedType.I1)]
public Byte[] Data; //报文的数据。
};
//2.CANFD初始化配置数据类型定义
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Ansi, Pack = 1)]
public struct CANFD_INIT_CONFIG
{
public Byte Mode; //0-正常模式1-自发自收模式
public Byte ISOCRCEnable;//0-禁止ISO CRC,1-使能ISO CRC
public Byte RetrySend;//0-禁止重发1-无限制重发
public Byte ResEnable;//0-不接入内部120欧终端电阻1-接入内部120欧终端电阻
//波特率参数可以用TCANLINPro软件里面的波特率计算工具计算
//仲裁段波特率参数,波特率=40M/NBT_BRP*(1+NBT_SEG1+NBT_SEG2)
public Byte NBT_BRP;
public Byte NBT_SEG1;
public Byte NBT_SEG2;
public Byte NBT_SJW;
//数据段波特率参数,波特率=40M/DBT_BRP*(1+DBT_SEG1+DBT_SEG2)
public Byte DBT_BRP;
public Byte DBT_SEG1;
public Byte DBT_SEG2;
public Byte DBT_SJW;
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 8, ArraySubType = UnmanagedType.I1)]
public Byte[] __Res0;//保留
};
//3.CANFD诊断帧信息结构体定义
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Ansi, Pack = 1)]
public struct CANFD_DIAGNOSTIC {
public Byte NREC;//标称比特率接收错误计数
public Byte NTEC;//标称比特率发送错误计数
public Byte DREC;//数据比特率接收错误计数
public Byte DTEC;//数据比特率发送错误计数
public UInt16 ErrorFreeMsgCount;//无错误帧计数
public UInt16 Flags;//参考诊断标志定义
};
//4.CANFD总线错误信息结构体定义
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Ansi, Pack = 1)]
public struct CANFD_BUS_ERROR {
public Byte TEC;//发送错误计数
public Byte REC;//接收错误计数
public Byte Flags;//参考总线错误标志定义
public Byte __Res0;
};
//5.CAN 滤波器设置数据类型定义
public struct CANFD_FILTER_CONFIG{
public Byte Enable; //使能该过滤器1-使能0-禁止
public Byte Index; //过滤器索引号取值范围为0到31
public Byte __Res0;
public Byte __Res1;
public UInt32 ID_Accept; //验收码ID,bit[28..0]为有效ID位bit[31]为IDE
public UInt32 ID_Mask; //屏蔽码对应bit位若为1则需要对比对应验收码bit位相同才接收
};
//函数返回错误代码定义
public const Int32 CANFD_SUCCESS = (0); //函数执行成功
public const Int32 CANFD_ERR_NOT_SUPPORT = (-1); //适配器不支持该函数
public const Int32 CANFD_ERR_USB_WRITE_FAIL = (-2); //USB写数据失败
public const Int32 CANFD_ERR_USB_READ_FAIL = (-3); //USB读数据失败
public const Int32 CANFD_ERR_CMD_FAIL = (-4); //命令执行失败
//CANFD_MSG.ID定义
public const Int32 CANFD_MSG_FLAG_RTR = (1<<30);
public const Int32 CANFD_MSG_FLAG_IDE = (1<<31);
public const Int32 CANFD_MSG_FLAG_ID_MASK = (0x1FFFFFFF);
//CANFD_MSG.Flags定义
public const Int32 CANFD_MSG_FLAG_BRS = (1<<0);
public const Int32 CANFD_MSG_FLAG_ESI = (1<<1);
public const Int32 CANFD_MSG_FLAG_FDF = (1<<2);
public const Int32 CANFD_MSG_FLAG_RXD = (1<<7);
//CANFD_DIAGNOSTIC.Flags定义
public const Int32 CANFD_DIAGNOSTIC_FLAG_NBIT0_ERR = (0x0001);//在发送报文或应答位、主动错误标志或过载标志期间器件要发送显性电平逻辑值为0的数据或标识符位但监视的总线值为隐性。
public const Int32 CANFD_DIAGNOSTIC_FLAG_NBIT1_ERR = (0x0002);//在发送报文仲裁字段除外期间器件要发送隐性电平逻辑值为1的位但监视到的总线值为显性。
public const Int32 CANFD_DIAGNOSTIC_FLAG_NACK_ERR = (0x0004);//发送报文未应答。
public const Int32 CANFD_DIAGNOSTIC_FLAG_NFORM_ERR = (0x0008);//接收报文的固定格式部分格式错误。
public const Int32 CANFD_DIAGNOSTIC_FLAG_NSTUFF_ERR = (0x0010);//在接收报文的一部分中序列中包含了5个以上相等位而报文中不允许出现这种序列。
public const Int32 CANFD_DIAGNOSTIC_FLAG_NCRC_ERR = (0x0020);//接收的报文的CRC校验和不正确。输入报文的CRC与通过接收到的数据计算得到的CRC不匹配。
public const Int32 CANFD_DIAGNOSTIC_FLAG_TXBO_ERR = (0x0080);//器件进入离线状态(且自动恢复)。
public const Int32 CANFD_DIAGNOSTIC_FLAG_DBIT0_ERR = (0x0100);//见NBIT0_ERR
public const Int32 CANFD_DIAGNOSTIC_FLAG_DBIT1_ERR = (0x0200);//见NBIT1_ERR
public const Int32 CANFD_DIAGNOSTIC_FLAG_DFORM_ERR = (0x0800);//见NFORM_ERR
public const Int32 CANFD_DIAGNOSTIC_FLAG_DSTUFF_ERR = (0x1000);//见NSTUFF_ERR
public const Int32 CANFD_DIAGNOSTIC_FLAG_DCRC_ERR = (0x2000);//见NCRC_ERR
public const Int32 CANFD_DIAGNOSTIC_FLAG_ESI_ERR = (0x4000);//接收的CAN FD报文的ESI标志置1
public const Int32 CANFD_DIAGNOSTIC_FLAG_DLC_MISMATCH = (0x8000);//DLC不匹配,在发送或接收期间指定的DLC大于FIFO元素的PLSIZE
//CANFD_BUS_ERROR.Flags定义
public const Int32 CANFD_BUS_ERROR_FLAG_TX_RX_WARNING = (0x01);
public const Int32 CANFD_BUS_ERROR_FLAG_RX_WARNING = (0x02);
public const Int32 CANFD_BUS_ERROR_FLAG_TX_WARNING = (0x04);
public const Int32 CANFD_BUS_ERROR_FLAG_RX_BUS_PASSIVE = (0x08);
public const Int32 CANFD_BUS_ERROR_FLAG_TX_BUS_PASSIVE = (0x10);
public const Int32 CANFD_BUS_ERROR_FLAG_TX_BUS_OFF = (0x20);
//USB2CANFD相关函数定义
[DllImport("USB2XXX.dll")]
public static extern Int32 CANFD_GetCANSpeedArg(Int32 DevHandle, ref CANFD_INIT_CONFIG pCanConfig, UInt32 SpeedBpsNBT, UInt32 SpeedBpsDBT);
[DllImport("USB2XXX.dll")]
public static extern Int32 CANFD_Init(Int32 DevHandle, Byte CANIndex, ref CANFD_INIT_CONFIG pCanConfig);
[DllImport("USB2XXX.dll")]
public static extern Int32 CANFD_StartGetMsg(Int32 DevHandle, Byte CANIndex);
[DllImport("USB2XXX.dll")]
public static extern Int32 CANFD_StopGetMsg(Int32 DevHandle, Byte CANIndex);
[DllImport("USB2XXX.dll")]
public static extern Int32 CANFD_SendMsg(Int32 DevHandle, Byte CANIndex, IntPtr pCanSendMsg, Int32 SendMsgNum);
[DllImport("USB2XXX.dll")]
public static extern Int32 CANFD_GetMsg(Int32 DevHandle, Byte CANIndex, IntPtr pCanGetMsg, Int32 BufferSize);
[DllImport("USB2XXX.dll")]
public static extern Int32 CANFD_SetFilter(Int32 DevHandle, Byte CANIndex,ref CANFD_FILTER_CONFIG pCanFilter,Byte Len);
[DllImport("USB2XXX.dll")]
public static extern Int32 CANFD_GetDiagnostic(Int32 DevHandle, Byte CANIndex,ref CANFD_DIAGNOSTIC pCanDiagnostic);
[DllImport("USB2XXX.dll")]
public static extern Int32 CANFD_GetBusError(Int32 DevHandle, Byte CANIndex,ref CANFD_BUS_ERROR pCanBusError);
[DllImport("USB2XXX.dll")]
public static extern Int32 CANFD_SetSchedule(Int32 DevHandle, Byte CANIndex, CANFD_MSG[] pCanMsgTab, Byte[] pMsgNum, UInt16[] pSendTimes, Byte MsgTabNum);
[DllImport("USB2XXX.dll")]
public static extern Int32 CANFD_StartSchedule(Int32 DevHandle, Byte CANIndex, Byte MsgTabIndex, Byte TimePrecMs,Byte OrderSend);
[DllImport("USB2XXX.dll")]
public static extern Int32 CANFD_StopSchedule(Int32 DevHandle, Byte CANIndex);
[DllImport("USB2XXX.dll")]
public static extern Int32 CANFD_SetRelay(Int32 DevHandle, Byte RelayState);
}
}

View File

@ -0,0 +1,123 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Runtime.InteropServices;
namespace USB2XXX
{
class USB_DEVICE
{
//定义电压输出值
public const Byte POWER_LEVEL_NONE = 0; //不输出
public const Byte POWER_LEVEL_1V8 = 1; //输出1.8V
public const Byte POWER_LEVEL_2V5 = 2; //输出2.5V
public const Byte POWER_LEVEL_3V3 = 3; //输出3.3V
public const Byte POWER_LEVEL_5V0 = 4; //输出5.0V
//设备信息定义
public struct DEVICE_INFO
{
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 32)]
public Byte[] FirmwareName; //固件名称字符串
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 32)]
public Byte[] BuildDate; //固件编译时间字符串
public UInt32 HardwareVersion;//硬件版本号
public UInt32 FirmwareVersion;//固件版本号
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 3)]
public UInt32[] SerialNumber; //适配器序列号
public UInt32 Functions; //适配器当前具备的功能
}
//方法定义
/**
* @brief USB设备
* @param pDevHandle
* @retval
*/
[DllImport("USB2XXX.dll")]
public static extern Int32 USB_ScanDevice(Int32[] pDevHandle);
/**
* @brief
* @param DevHandle
* @retval
*/
[DllImport("USB2XXX.dll")]
public static extern bool USB_OpenDevice(Int32 DevHandle);
/**
* @brief
* @param DevHandle
* @retval
*/
[DllImport("USB2XXX.dll")]
public static extern bool USB_CloseDevice(Int32 DevHandle);
/**
* @brief USB_ScanDeviceUSB_OpenDevice函数
* @param DevHandle
* @retval
*/
[DllImport("USB2XXX.dll")]
public static extern bool USB_ResetDevice(Int32 DevHandle);
/**
* @brief
* @param DevHandle
* @param pDevInfo
* @param pFunctionStr
* @retval
*/
[DllImport("USB2XXX.dll")]
public static extern bool DEV_GetDeviceInfo(Int32 DevHandle, ref DEVICE_INFO pDevInfo, StringBuilder pFunctionStr);
/**
* @brief
* @param DevHandle
* @retval
*/
[DllImport("USB2XXX.dll")]
public static extern bool DEV_EraseUserData(Int32 DevHandle);
/**
* @brief
* @param DevHandle
* @param OffsetAddr 0x000x1000064KBye
* @param pWriteData
* @param DataLen
* @retval
*/
[DllImport("USB2XXX.dll")]
public static extern bool DEV_WriteUserData(Int32 DevHandle,Int32 OffsetAddr,byte[] pWriteData,Int32 DataLen);
/**
* @brief
* @param DevHandle
* @param OffsetAddr 0x000x1000064KBye
* @param pReadData
* @param DataLen
* @retval
*/
[DllImport("USB2XXX.dll")]
public static extern bool DEV_ReadUserData(Int32 DevHandle,Int32 OffsetAddr,byte[] pReadData,Int32 DataLen);
/**
* @brief
* @param DevHandle
* @param PowerLevel
* @retval
*/
[DllImport("USB2XXX.dll")]
public static extern bool DEV_SetPowerLevel(Int32 DevHandle,byte PowerLevel);
/**
* @brief CAN或者LIN的时间戳原始值
* @param DevHandle
* @param pTimestamp
* @retval
*/
[DllImport("USB2XXX.dll")]
public static extern bool DEV_GetTimestamp(Int32 DevHandle,byte BusType,Int32[] pTimestamp);
/**
* @brief CAN/LIN时间戳CAN/LIN之后调用
* @param DevHandle
* @retval
*/
[DllImport("USB2XXX.dll")]
public static extern bool DEV_ResetTimestamp(Int32 DevHandle);
}
}

View File

@ -0,0 +1,446 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using TSMaster;
namespace Can
{
class ToSunDevice : CanDevice
{
private string Name = "666";
private TCANQueueEvent CanQueueEvent;
private TCANFDQueueEvent CanFdQueueEvent;
public ToSunDevice()
{
this.CanQueueEvent = new TCANQueueEvent(OnCANRxEvent);
this.CanFdQueueEvent = new TCANFDQueueEvent(OnCANFDRxEvent);
}
~ToSunDevice()
{
//释放所有资源
TsMasterApi.finalize_lib_tsmaster();
}
//标准CAN
#region CAN
//CAN初始化
public override string CanInit()
{
//释放所有资源
//TsMasterApi.finalize_lib_tsmaster();
TsMasterApi.initialize_lib_tsmaster(Name);
//创建通道数
if ((TsMasterApi.tsapp_set_can_channel_count(1) == 0)
&& (TsMasterApi.tsapp_set_lin_channel_count(0) == 0)
)
{
}
else
{
return "创建通道失败";
}
TsMasterApi.tsapp_set_lin_channel_count(0);
/*int hardwareNum = 0;
TsMasterApi.tsapp_enumerate_hw_devices(out hardwareNum);
TLIBHWInfo tmpDeviceInfo = new TLIBHWInfo(0);
TsMasterApi.tsapp_get_hw_info_by_index(0, ref tmpDeviceInfo);*/
#if true
//创建通道映射
if (TsMasterApi.tsapp_set_mapping_verbose(Name, TLIBApplicationChannelType.APP_CAN,
APP_CHANNEL.CHN1, "TC1012", TLIBBusToolDeviceType.TS_USB_DEVICE, 12, 0, HARDWARE_CHANNEL.CHN1) == 0) //12
#else
if (TsMasterApi.tsapp_set_mapping_verbose(Name, TLIBApplicationChannelType.APP_CAN,
APP_CHANNEL.CHN1, "TC1011", TLIBBusToolDeviceType.TS_USB_DEVICE, 5, 0, HARDWARE_CHANNEL.CHN1) == 0) //12
#endif
{
}
else
{
return "创建通道映射失败";
}
#if true
//初始化通道参数
if (TsMasterApi.tsapp_configure_baudrate_can((int)APP_CHANNEL.CHN1, 500, false, true) != 0)
{
return "创建通道参数失败";
}
#else
if (TsMasterApi.tsapp_configure_can_regs(APP_CHANNEL.CHN1, 500, 7, 1, 1, 1, 0) != 0)
{
return "创建通道参数失败";
}
//tsapp_configure_can_regs(APP_CHANNEL AIdxChn, float ABaudrateKbps, int ASEG1, int ASEG2, int APrescaler, int ASJW, int A120OhmConnected);
#endif
//连接application连接硬件通道并开启接收FIFO
int ret = TsMasterApi.tsapp_connect();
string connectResult = TsMasterApi.tsapp_get_error_description(ret);
if (0 == ret)
{
TsMasterApi.tsfifo_enable_receive_fifo();
}
else
{
//Log(connectResult);
//Log("Connect Application Failed! Please check the mapping table and whether the Hardware is Ready?!");
return "连接设备失败";
}
TsMasterApi.tsapp_unregister_events_all((IntPtr)0);
//注册接收回调函数在每一次的回调函数vCANQueueEventObj中刷新数据段
/*if (0 == TsMasterApi.tsapp_register_event_can((IntPtr)0, CanQueueEvent))
{
}
else
{
return "创建接受报文事件失败";
}*/
return "OK";
}
//CAN逆初始化
public override string CanDeInit()
{
base.CanDeInit();
TsMasterApi.tsapp_unregister_events_all((IntPtr)0);
if(0 == TsMasterApi.tsapp_disconnect()
)
{
base.CanDeInit();
return "OK";
}
else
{
return "断开连接失败";
}
}
public override string CanReceiveEventEnable()
{
string ret;
//注册接收回调函数在每一次的回调函数vCANQueueEventObj中刷新数据段
if (0 == TsMasterApi.tsapp_register_event_can((IntPtr)0, CanQueueEvent))
{
ret = "OK";
}
else
{
ret = "创建接受报文事件失败";
}
return ret;
}
public override string CanReceiveEventDisable()
{
string ret;
if (0 == TsMasterApi.tsapp_unregister_events_all((IntPtr)0))
{
ret = "OK";
}
else
{
ret = "失能接收事件失败";
}
return ret;
}
public override string CanSetFilter(UInt32 stratId, UInt32 endId)
{
//清除所有过滤器
for (int i = 0; i < 0x7ff; i++)
{
TsMasterApi.tsfifo_delete_can_canfd_pass_filter(APP_CHANNEL.CHN1, (int)i);
}
//设置过滤
for(UInt32 i = stratId; i <= endId; i++)
{
TsMasterApi.tsfifo_add_can_canfd_pass_filter(APP_CHANNEL.CHN1, (int)i, true);
}
return "OK";
}
//CAN发送一帧报文
public override void CanSendMessage(UInt32 id, byte[] data, int len)
{
TLIBCAN msg = new TLIBCAN(0, (int)id, true, false, false, MessagesLenToDlc(len), data);
if (TsMasterApi.tsapp_transmit_can_async(ref msg) == 0)
{
}
else
{
}
}
//CAN从FIFO接收一帧报文
public override bool CanReadMessage(ref UInt32 id, byte[] data, ref int len)
{
TLIBCAN msg;
bool ret = false;
if(true == TsMasterApi.tsfifo_receive_can_message(out msg, 0))
{
id = (UInt32)msg.FIdentifier;
msg.FData.CopyTo(data, 0);
len = MessagesDlcToLen(msg.FDLC);
ret = true;
}
return ret;
}
//CAN接收事件
private void OnCANRxEvent(IntPtr AObj, ref TLIBCAN AData)
{
if (AData.FIsTx)//发送的报文
{
}
else if(false == AData.FIsError)//接受的报文
{
TLIBCAN msg;
while(true == TsMasterApi.tsfifo_receive_can_message(out msg, 0))
{
CanReadEventInvoke((UInt32)AData.FIdentifier, AData.FData, MessagesDlcToLen(AData.FDLC));
}
}
}
#endregion
//CANFD
#region CANFD
//CANFD初始化
public override string CanFdInit()
{
TsMasterApi.initialize_lib_tsmaster(Name);
//创建通道数
if ((TsMasterApi.tsapp_set_can_channel_count(1) == 0)
&& (TsMasterApi.tsapp_set_lin_channel_count(0) == 0)
)
{
}
else
{
return "创建通道失败";
}
//创建通道映射
if (TsMasterApi.tsapp_set_mapping_verbose(Name, TLIBApplicationChannelType.APP_CAN,
APP_CHANNEL.CHN1, "TC1012", TLIBBusToolDeviceType.TS_USB_DEVICE, 12, 0, HARDWARE_CHANNEL.CHN1) == 0)
{
}
else
{
return "创建通道映射失败";
}
//初始化通道参数
#if true
if (TsMasterApi.tsapp_configure_baudrate_canfd((int)APP_CHANNEL.CHN1, 500, 2000, TLIBCANFDControllerType.lfdtISOFDCAN, TLIBCANFDControllerMode.lfdmNormal, true) == 0)
{
}
else
{
return "创建通道参数失败";
}
#else
if (TsMasterApi.tsapp_configure_canfd_regs(APP_CHANNEL.CHN1,
500, 4, 1, 1, 1, //500
2000, 4, 1, 1, 1, //2000
TLIBCANFDControllerType.lfdtISOFDCAN, TLIBCANFDControllerMode.lfdmNormal, 0) != 0)
{
return "创建通道参数失败";
}
#endif
//连接application连接硬件通道并开启接收FIFO
int ret = TsMasterApi.tsapp_connect();
string connectResult = TsMasterApi.tsapp_get_error_description(ret);
if (0 == ret)
{
TsMasterApi.tsfifo_enable_receive_fifo();
}
else
{
return "连接设备失败";
}
TsMasterApi.tsapp_unregister_events_all((IntPtr)0);
return "OK";
}
//CANFD逆初始化
public override string CanFdDeInit()
{
base.CanFdDeInit();
TsMasterApi.tsapp_unregister_events_all((IntPtr)0);
if((0 == TsMasterApi.tsapp_disconnect())
)
{
return "OK";
}
else
{
return "断开连接失败";
}
}
public override string CanFdSetFilter(UInt32 stratId, UInt32 endId)
{
//清除所有过滤器
for (int i = 0; i < 0x7ff; i++)
{
TsMasterApi.tsfifo_delete_can_canfd_pass_filter(APP_CHANNEL.CHN1, (int)i);
}
//设置过滤
for (UInt32 i = stratId; i <= endId; i++)
{
TsMasterApi.tsfifo_add_can_canfd_pass_filter(APP_CHANNEL.CHN1, (int)i, true);
}
return "OK";
}
public override string CanFdReceiveEventEnable()
{
string ret;
//注册接收回调函数在每一次的回调函数vCANQueueEventObj中刷新数据段
if (0 == TsMasterApi.tsapp_register_event_canfd((IntPtr)0, CanFdQueueEvent))
{
ret = "OK";
}
else
{
ret = "创建接受报文事件失败";
}
return ret;
}
public override string CanFdReceiveEventDisable()
{
return this.CanReceiveEventDisable();
}
//CANFD发送一帧报文
public override void CanFdSendMessage(UInt32 id, byte[] data, int len)
{
TLIBCANFD msg = new TLIBCANFD(APP_CHANNEL.CHN1, (int)id, true, false, false, MessagesLenToDlc(len), data, true, true);
if (TsMasterApi.tsapp_transmit_canfd_async(ref msg) == 0)
{
}
else
{
}
}
//CANFD从FIFO接收一帧报文
public override bool CanFdReadMessage(ref UInt32 id, byte[] data, ref int len)
{
TLIBCANFD msg = new TLIBCANFD();
bool ret = false;
if (true == TsMasterApi.tsfifo_receive_canfd_message(ref msg, 0))
{
id = (UInt32)msg.FIdentifier;
msg.FData.CopyTo(data, 0);
len = MessagesDlcToLen(msg.FDLC);
ret = true;
}
return ret;
}
//CANFD接收报文事件
private void OnCANFDRxEvent(IntPtr AObj, ref TLIBCANFD AData)
{
//发送的报文
if (AData.FIsTx)
{
}
else if (false == AData.FIsError)//接受的报文
{
TLIBCANFD msg = new TLIBCANFD();
while (true == TsMasterApi.tsfifo_receive_canfd_message(ref msg, 0))
{
CanReadEventInvoke((UInt32)AData.FIdentifier, AData.FData, MessagesDlcToLen(AData.FDLC));
}
}
}
#endregion
}
}

View File

@ -0,0 +1,288 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace CanTool
{
partial class uds_tools
{
//
//当前使用的诊断相关配置参数
private ReadVersionConfig ReadVersionConfigNow = new ReadVersionConfig();
//比亚迪的诊断相关配置参数
private ReadVersionConfig ReadVersionConfigBYD;
//鸿日的诊断相关配置参数
private ReadVersionConfig ReadVersionConfigHR;
private void DiagParamsInit()
{
#region
ReadVersionConfigBYD = new ReadVersionConfig(new VersionParams[]
{
//new VersionParams("客户MCU软件版本号", 0x22, 0xf189, new byte[0], ReadVersionConfig.DefaultAnalysisVersion0x22),
//new VersionParams("客户MCU硬件版本号", 0x22, 0xf17f, new byte[0], ReadVersionConfig.DefaultAnalysisVersion0x22),
//new VersionParams("供应商软件版本号", 0x22, 0xf195, new byte[0], ReadVersionConfig.DefaultAnalysisVersion0x22),
//new VersionParams("供应商硬件版本号", 0x22, 0xf193, new byte[0], ReadVersionConfig.DefaultAnalysisVersion0x22),
//new VersionParams("BOOT版本号", 0x22, 0xf180, new byte[0], ReadVersionConfig.DefaultAnalysisVersion0x22),
//new VersionParams("UI版本号", 0x2f, 0xf063, new byte[]{0x03,0x03}, ReadVersionConfig.DefaultAnalysisVersion0x2f),
//new VersionParams("内控版本号", 0x2f, 0xf063, new byte[]{0x03, 0x01}, ReadVersionConfig.DefaultAnalysisVersion0x2f),
//new VersionParams("零件号", 0x22, 0xf187, new byte[0], ReadVersionConfig.DefaultAnalysisVersion0x22),
}
);
#endregion
#region 鸿
ReadVersionConfigHR = new ReadVersionConfig(new VersionParams[]
{
//new VersionParams("客户MCU软件版本号", 0x22, 0xf189, new byte[0], ReadVersionConfig.DefaultAnalysisVersion0x22),
//new VersionParams("客户MCU硬件版本号", 0x22, 0xf17f, new byte[0], ReadVersionConfig.DefaultAnalysisVersion0x22),
//new VersionParams("供应商软件版本号", 0x22, 0xf195, new byte[0], ReadVersionConfig.DefaultAnalysisVersion0x22),
//new VersionParams("供应商硬件版本号", 0x22, 0xf193, new byte[0], ReadVersionConfig.DefaultAnalysisVersion0x22),
//new VersionParams("BOOT版本号", 0x22, 0xf180, new byte[0], ReadVersionConfig.DefaultAnalysisVersion0x22),
//new VersionParams("UI版本号", 0x2f, 0xf063, new byte[]{0x03,0x03}, ReadVersionConfig.DefaultAnalysisVersion0x2f),
//new VersionParams("内控版本号", 0x2f, 0xf063, new byte[]{0x03, 0x01}, ReadVersionConfig.DefaultAnalysisVersion0x2f),
//new VersionParams("零件号", 0x22, 0xf187, new byte[0], ReadVersionConfig.DefaultAnalysisVersion0x22),
}
);
#endregion
//自诊断故障码对应文字说明表创建
/*
selfDiagFaultType = new Dictionary<UInt16, string>()
{
{0x01A5,"首次上电标志"},
{0x0101,"异常断电"},
{0x0102,"读取E2PROM异常"},
{0x0103,"FLASH初始化异常"},
{0x0104,"I2C初始化异常"},
{0x0105,"urat 初始化异常"},
{0x0106,"SPI 初始化异常"},
{0x0107,"timer 初始化异常"},
{0x0108,"图库版本错误"},
{0x01F1,"KL15 ON唤醒"},
{0x01F2,"CAN信号唤醒唤醒"},
{0x01F3,"预留唤醒"},
{0x0201,"背光工作状态异常"},
{0x0202,"LED 背光驱动外设异常"},
{0x0301,"到位开关失效"},
{0x0302,"TFT温度传感器开路"},
{0x0303,"TFT温度传感器短路"},
{0x0304,"LED温度传感器开路"},
{0x0305,"LED温度传感器短路"},
{0x0308,"TFT过温"},
{0x0309,"LED过温"},
{0x0401,"车速信号无效"},
{0x0402,"转速信号无效"},
{0x0403,"ACC信号无效"},
{0x0404,"IACC信号无效"},
{0x0405,"TSR信号无效"},
{0x0406,"LDW信号无效"},
{0x0407,"导航信号无效"},
{0x0408,"电话信号无效"},
{0x0501,"消息队列堵塞"},
{0x0502,"UI刷新超时"},
{0x0503,"显示层初始化失败"},
{0x0504,"RW2D 初始化失败"},
{0x0505,"HMI heap 初始化失败"},
{0x0506,"导航箭头输入信号逻辑错误"},
{0x0507,"联系人信息输入信号逻辑错误"},
{0x0508,"TSR输入信号逻辑错误"},
{0x0509,"通话状态输入信号逻辑错误"},
{0x050A,"导航箭头信号输入一直没有清零"},
{0x0601,"升级APP失败"},
{0x0602,"升级图库失败"},
{0x0603,"升级后兼容性检查失败"},
{0x0604,"升级包按校验失败"},
{0x0605,"读取升级标志失败"},
{0x0606,"数据帧checksum校验失败"},
{0x0607,"升级数据通讯超时"},
{0x0608,"code flash擦除动作失败"},
{0x0609,"code flash数据写入失败"},
{0x060A,"外部 flash擦除动作失败"},
{0x060B,"外部 flash数据写入失败"},
};
*/
}
#region DiagReceivedTable
private void DiagReceivedTableInit()
{
//升级接收表驱动初始化
this.UDSReceivedTable.Add(0x50, UDSReceived0x50);
this.UDSReceivedTable.Add(0xC5, UDSReceived0xC5);
this.UDSReceivedTable.Add(0x68, UDSReceived0x68);
this.UDSReceivedTable.Add(0x6E, UDSReceived0x6E);
this.UDSReceivedTable.Add(0x67, UDSReceived0x67);
this.UDSReceivedTable.Add(0x71, UDSReceived0x71);
this.UDSReceivedTable.Add(0x74, UDSReceived0x74);
this.UDSReceivedTable.Add(0x76, UDSReceived0x76);
this.UDSReceivedTable.Add(0x77, UDSReceived0x77);
this.UDSReceivedTable.Add(0x51, UDSReceived0x51);
this.UDSReceivedTable.Add(0x7F, UDSReceived0x7F);
}
//10服务接收
private void UDSReceived0x50(byte[] data)
{
if (data[1] == 0x01)
{
//打印log
rtxtLog.AppendText("进入默认会话成功\n");
}
else if(data[1] == 0x02)
{
//打印log
rtxtLog.AppendText("进入编程会话成功\n");
}
else if (data[1] == 0x03)
{
//打印log
rtxtLog.AppendText("进入扩展会话成功\n");
}
}
private void UDSReceived0xC5(byte[] data)
{
}
private void UDSReceived0x68(byte[] data)
{
}
private void UDSReceived0x6E(byte[] data)
{
}
private void UDSReceived0x67(byte[] data)
{
if ((this.UpdateConfigParamsNow.RequestSeedL1 == data[1])
|| (this.UpdateConfigParamsNow.RequestSeedL2 == data[1])
|| (this.UpdateConfigParamsNow.RequestSeedL3 == data[1])
|| (this.UpdateConfigParamsNow.RequestSeedL4 == data[1])
)
{
//打印log
rtxtLog.AppendText("获取种子成功\n");
Array.Copy(data, 2, RecvSeed, 0, 16);
//进入安全时
if (this.UpdateConfigParamsNow.RequestSeedL1 == data[1])
{
this.EntrySecurityFlag = EntrySecurityStatus.SendkeyLevel1;
}
else if (this.UpdateConfigParamsNow.RequestSeedL2 == data[1])
{
this.EntrySecurityFlag = EntrySecurityStatus.SendkeyLevel2;
}
else if (this.UpdateConfigParamsNow.RequestSeedL3 == data[1])
{
this.EntrySecurityFlag = EntrySecurityStatus.SendkeyLevel3;
}
else if (this.UpdateConfigParamsNow.RequestSeedL4 == data[1])
{
this.EntrySecurityFlag = EntrySecurityStatus.SendkeyLevel4;
}
}
else if ((this.UpdateConfigParamsNow.SendKeyL1 == data[1])
|| (this.UpdateConfigParamsNow.SendKeyL2 == data[1])
|| (this.UpdateConfigParamsNow.SendKeyL3 == data[1])
|| (this.UpdateConfigParamsNow.SendKeyL4 == data[1])
)
{
//打印log
rtxtLog.AppendText("进入安全模式成功\n");
//进入安全时
if (EntrySecurityStatus.Idle != this.EntrySecurityFlag)
{
this.EntrySecurityFlag = EntrySecurityStatus.Unlock;
}
}
}
private void UDSReceived0x71(byte[] data)
{
if ((0xAA == data[2]) && (0x55 == data[3]))
{
//this.UpdateConfigParamsNow.UpdateStepNum++;
// UpdateSendCmdFlag = true;
//打印log
//rtxtLog.AppendText("重置安全密钥成功\n");
rtxtLog.AppendText("升级boot成功\n");
}
}
private void UDSReceived0x74(byte[] data)
{
}
private void UDSReceived0x76(byte[] data)
{
}
private void UDSReceived0x77(byte[] data)
{
}
private void UDSReceived0x51(byte[] data)
{
//打印log
rtxtLog.AppendText("复位成功\n");
}
private void UDSReceived0x7F(byte[] data)
{
NegativeResponeseDisplay(data);
}
#endregion
}
}

File diff suppressed because it is too large Load Diff

218
CAN_Tool/Diag.cs Normal file
View File

@ -0,0 +1,218 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace CanTool
{
public class DiagItem
{
public byte Sid;
public UInt16 Did;
public byte[] ParamsArray;
public DiagItem()
{
this.ParamsArray = new byte[0];
}
public DiagItem(DiagItem diagItem)
{
Sid = diagItem.Sid;
Did = diagItem.Did;
ParamsArray = new byte[diagItem.ParamsArray.Length];
diagItem.ParamsArray.CopyTo(ParamsArray, 0);
}
public DiagItem(byte sid, UInt16 did, byte[] paramsArray)
{
Sid = sid;
Did = did;
ParamsArray = new byte[paramsArray.Length];
paramsArray.CopyTo(ParamsArray, 0);
}
public UInt64 GetSidAndDidAndParams()
{
UInt64 SidAndDidAndParams = (UInt64)((UInt64)this.Sid << 56 | (UInt64)this.Did << 40);
for(int i = 0;i < this.ParamsArray.Length;i++)
{
SidAndDidAndParams |= (UInt64)((UInt64)this.ParamsArray[i] << ((4 - i) * 8));
}
return SidAndDidAndParams;
}
}
public delegate string AnalysisVersionDelegate(byte[] data, UInt32 len);
public class VersionParams
{
public string VersionComment; //版本号说明
public DiagItem DiagItem; //版本号对应的诊断
public AnalysisVersionDelegate AnalysisVersionFunc;
public VersionParams()
{
VersionComment = "";
DiagItem = new DiagItem();
}
public VersionParams(string versionComment, DiagItem diagItem, AnalysisVersionDelegate analysisVersionFunc)
{
VersionComment = versionComment;
DiagItem = diagItem;
AnalysisVersionFunc = analysisVersionFunc;
}
public VersionParams(string versionComment, byte sid, UInt16 did, byte[] paramsArray, AnalysisVersionDelegate analysisVersionFunc)
{
VersionComment = versionComment;
DiagItem = new DiagItem(sid, did, paramsArray);
AnalysisVersionFunc = analysisVersionFunc;
}
}
public class ReadVersionConfig
{
public VersionParams[] VersionParamsTable;
public ReadVersionConfig()
{
VersionParamsTable = new VersionParams[0];
}
public ReadVersionConfig(VersionParams[] versionParamsTable)
{
VersionParamsTable = versionParamsTable;
}
public DiagItem GetDiagItem(int index)
{
DiagItem ret;
if(index < VersionParamsTable.Length)
{
ret = new DiagItem(VersionParamsTable[index].DiagItem);
}
else
{
ret = new DiagItem(0xff, 0xff, new byte[0]);
}
return ret;
}
public string GetVersionComment(int index)
{
string ret;
if ((index >= 0)
&& (index < VersionParamsTable.Length)
)
{
ret = VersionParamsTable[index].VersionComment;
}
else
{
ret = "";
}
return ret;
}
//通过SID DID 参数来寻找具体的项
public int IndexOf(byte sid, UInt16 did, byte[] paramsArray)
{
int index = -1;
int paramsLenMin;
for (int i = 0; i < VersionParamsTable.Length; i++)
{
//对比SID和DID
if (((VersionParamsTable[i].DiagItem.Sid + 0x40) != (sid))
|| (VersionParamsTable[i].DiagItem.Did != did)
)
{
continue;
}
//获取参数长度最小的
paramsLenMin = Math.Min(VersionParamsTable[i].DiagItem.ParamsArray.Length, paramsArray.Length);
//对比参数
int j;
for (j = 0; j < paramsLenMin; j++)
{
if (VersionParamsTable[i].DiagItem.ParamsArray[j] != paramsArray[j])
{
break;
}
}
//参数也全部相等 则找到对应的诊断项
if (j == paramsLenMin)
{
index = i;
break;
}
}
return index;
}
//通过数据解析版本号
public string AnalysisVersion(int index, byte[] data, UInt32 len)
{
string str = "";
if ((index >= 0)
&& (index < VersionParamsTable.Length)
)
{
if (VersionParamsTable[index].AnalysisVersionFunc != null)
{
str = VersionParamsTable[index].AnalysisVersionFunc(data, len);
}
}
return str;
}
//默认解析22读取的信息
static public string DefaultAnalysisVersion0x22(byte[] data, UInt32 len)
{
return Encoding.ASCII.GetString(data, 3, (int)(len - 3));
}
//默认解析内控版本号信息
static public string DefaultAnalysisVersion0x2f(byte[] data, UInt32 len)
{
return Encoding.ASCII.GetString(data, 5, (int)(len - 5));
}
}
}

BIN
CAN_Tool/Flash Player.ico Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 97 KiB

233
CAN_Tool/MessageConfigForm.Designer.cs generated Normal file
View File

@ -0,0 +1,233 @@
namespace CanTool
{
partial class MessageConfigForm
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.label1 = new System.Windows.Forms.Label();
this.label2 = new System.Windows.Forms.Label();
this.label3 = new System.Windows.Forms.Label();
this.txtMessageId = new System.Windows.Forms.TextBox();
this.txtMessageLen = new System.Windows.Forms.TextBox();
this.txtMessageData0 = new System.Windows.Forms.TextBox();
this.btnOk = new System.Windows.Forms.Button();
this.btnCancel = new System.Windows.Forms.Button();
this.txtMessageData1 = new System.Windows.Forms.TextBox();
this.txtMessageData2 = new System.Windows.Forms.TextBox();
this.txtMessageData3 = new System.Windows.Forms.TextBox();
this.txtMessageData4 = new System.Windows.Forms.TextBox();
this.txtMessageData5 = new System.Windows.Forms.TextBox();
this.txtMessageData6 = new System.Windows.Forms.TextBox();
this.txtMessageData7 = new System.Windows.Forms.TextBox();
this.lblInfo = new System.Windows.Forms.Label();
this.SuspendLayout();
//
// label1
//
this.label1.AutoSize = true;
this.label1.Location = new System.Drawing.Point(13, 13);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(53, 12);
this.label1.TabIndex = 0;
this.label1.Text = "ID:(Hex)";
//
// label2
//
this.label2.AutoSize = true;
this.label2.Location = new System.Drawing.Point(186, 13);
this.label2.Name = "label2";
this.label2.Size = new System.Drawing.Size(29, 12);
this.label2.TabIndex = 1;
this.label2.Text = "Len:";
//
// label3
//
this.label3.AutoSize = true;
this.label3.Location = new System.Drawing.Point(13, 74);
this.label3.Name = "label3";
this.label3.Size = new System.Drawing.Size(65, 12);
this.label3.TabIndex = 2;
this.label3.Text = "Data:(Hex)";
//
// txtMessageId
//
this.txtMessageId.Location = new System.Drawing.Point(15, 38);
this.txtMessageId.Name = "txtMessageId";
this.txtMessageId.Size = new System.Drawing.Size(150, 21);
this.txtMessageId.TabIndex = 3;
this.txtMessageId.Text = "0";
//
// txtMessageLen
//
this.txtMessageLen.Location = new System.Drawing.Point(188, 38);
this.txtMessageLen.Name = "txtMessageLen";
this.txtMessageLen.Size = new System.Drawing.Size(43, 21);
this.txtMessageLen.TabIndex = 4;
this.txtMessageLen.Text = "8";
//
// txtMessageData0
//
this.txtMessageData0.Location = new System.Drawing.Point(15, 99);
this.txtMessageData0.Name = "txtMessageData0";
this.txtMessageData0.Size = new System.Drawing.Size(28, 21);
this.txtMessageData0.TabIndex = 5;
this.txtMessageData0.Text = "0";
//
// btnOk
//
this.btnOk.Location = new System.Drawing.Point(128, 258);
this.btnOk.Name = "btnOk";
this.btnOk.Size = new System.Drawing.Size(75, 23);
this.btnOk.TabIndex = 6;
this.btnOk.Text = "确定";
this.btnOk.UseVisualStyleBackColor = true;
this.btnOk.Click += new System.EventHandler(this.btnOk_Click);
//
// btnCancel
//
this.btnCancel.Location = new System.Drawing.Point(209, 258);
this.btnCancel.Name = "btnCancel";
this.btnCancel.Size = new System.Drawing.Size(75, 23);
this.btnCancel.TabIndex = 7;
this.btnCancel.Text = "取消";
this.btnCancel.UseVisualStyleBackColor = true;
this.btnCancel.Click += new System.EventHandler(this.btnCancel_Click);
//
// txtMessageData1
//
this.txtMessageData1.Location = new System.Drawing.Point(50, 99);
this.txtMessageData1.Name = "txtMessageData1";
this.txtMessageData1.Size = new System.Drawing.Size(28, 21);
this.txtMessageData1.TabIndex = 8;
this.txtMessageData1.Text = "0";
//
// txtMessageData2
//
this.txtMessageData2.Location = new System.Drawing.Point(84, 99);
this.txtMessageData2.Name = "txtMessageData2";
this.txtMessageData2.Size = new System.Drawing.Size(28, 21);
this.txtMessageData2.TabIndex = 9;
this.txtMessageData2.Text = "0";
//
// txtMessageData3
//
this.txtMessageData3.Location = new System.Drawing.Point(118, 99);
this.txtMessageData3.Name = "txtMessageData3";
this.txtMessageData3.Size = new System.Drawing.Size(28, 21);
this.txtMessageData3.TabIndex = 10;
this.txtMessageData3.Text = "0";
//
// txtMessageData4
//
this.txtMessageData4.Location = new System.Drawing.Point(152, 99);
this.txtMessageData4.Name = "txtMessageData4";
this.txtMessageData4.Size = new System.Drawing.Size(28, 21);
this.txtMessageData4.TabIndex = 11;
this.txtMessageData4.Text = "0";
//
// txtMessageData5
//
this.txtMessageData5.Location = new System.Drawing.Point(188, 99);
this.txtMessageData5.Name = "txtMessageData5";
this.txtMessageData5.Size = new System.Drawing.Size(28, 21);
this.txtMessageData5.TabIndex = 12;
this.txtMessageData5.Text = "0";
//
// txtMessageData6
//
this.txtMessageData6.Location = new System.Drawing.Point(222, 99);
this.txtMessageData6.Name = "txtMessageData6";
this.txtMessageData6.Size = new System.Drawing.Size(28, 21);
this.txtMessageData6.TabIndex = 13;
this.txtMessageData6.Text = "0";
//
// txtMessageData7
//
this.txtMessageData7.Location = new System.Drawing.Point(256, 99);
this.txtMessageData7.Name = "txtMessageData7";
this.txtMessageData7.Size = new System.Drawing.Size(28, 21);
this.txtMessageData7.TabIndex = 14;
this.txtMessageData7.Text = "0";
//
// lblInfo
//
this.lblInfo.AutoSize = true;
this.lblInfo.Location = new System.Drawing.Point(12, 263);
this.lblInfo.Name = "lblInfo";
this.lblInfo.Size = new System.Drawing.Size(0, 12);
this.lblInfo.TabIndex = 15;
//
// formAddMessage
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(301, 293);
this.Controls.Add(this.lblInfo);
this.Controls.Add(this.txtMessageData7);
this.Controls.Add(this.txtMessageData6);
this.Controls.Add(this.txtMessageData5);
this.Controls.Add(this.txtMessageData4);
this.Controls.Add(this.txtMessageData3);
this.Controls.Add(this.txtMessageData2);
this.Controls.Add(this.txtMessageData1);
this.Controls.Add(this.btnCancel);
this.Controls.Add(this.btnOk);
this.Controls.Add(this.txtMessageData0);
this.Controls.Add(this.txtMessageLen);
this.Controls.Add(this.txtMessageId);
this.Controls.Add(this.label3);
this.Controls.Add(this.label2);
this.Controls.Add(this.label1);
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle;
this.Name = "formAddMessage";
this.Text = "添加报文";
this.Load += new System.EventHandler(this.formAddMessage_Load);
this.ResumeLayout(false);
this.PerformLayout();
}
#endregion
private System.Windows.Forms.Label label1;
private System.Windows.Forms.Label label2;
private System.Windows.Forms.Label label3;
private System.Windows.Forms.TextBox txtMessageId;
private System.Windows.Forms.TextBox txtMessageLen;
private System.Windows.Forms.TextBox txtMessageData0;
private System.Windows.Forms.Button btnOk;
private System.Windows.Forms.Button btnCancel;
private System.Windows.Forms.TextBox txtMessageData1;
private System.Windows.Forms.TextBox txtMessageData2;
private System.Windows.Forms.TextBox txtMessageData3;
private System.Windows.Forms.TextBox txtMessageData4;
private System.Windows.Forms.TextBox txtMessageData5;
private System.Windows.Forms.TextBox txtMessageData6;
private System.Windows.Forms.TextBox txtMessageData7;
private System.Windows.Forms.Label lblInfo;
}
}

View File

@ -0,0 +1,106 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace CanTool
{
public partial class MessageConfigForm : Form
{
public Action<UInt32, byte[], int> MessageReturn;
public MessageConfigForm()
{
InitializeComponent();
this.MessageReturn = null;
}
public MessageConfigForm(UInt32 id, byte[] data, int len)
{
InitializeComponent();
this.MessageReturn = null;
TextBox[] txtBoxTable = new TextBox[]
{
txtMessageData0,
txtMessageData1,
txtMessageData2,
txtMessageData3,
txtMessageData4,
txtMessageData5,
txtMessageData6,
txtMessageData7,
};
txtMessageId.Text = Convert.ToString(id, 16);
txtMessageLen.Text = Convert.ToString(len);
for(int i = 0;i < txtBoxTable.Length;i++)
{
txtBoxTable[i].Text = Convert.ToString(data[i], 16);
}
}
private void formAddMessage_Load(object sender, EventArgs e)
{
}
private void btnOk_Click(object sender, EventArgs e)
{
UInt32 id;
int len;
byte[] data = new byte[8];
try
{
id = Convert.ToUInt32(txtMessageId.Text, 16);
len = Convert.ToInt32(txtMessageLen.Text);
data[0] = Convert.ToByte(txtMessageData0.Text, 16);
data[1] = Convert.ToByte(txtMessageData1.Text, 16);
data[2] = Convert.ToByte(txtMessageData2.Text, 16);
data[3] = Convert.ToByte(txtMessageData3.Text, 16);
data[4] = Convert.ToByte(txtMessageData4.Text, 16);
data[5] = Convert.ToByte(txtMessageData5.Text, 16);
data[6] = Convert.ToByte(txtMessageData6.Text, 16);
data[7] = Convert.ToByte(txtMessageData7.Text, 16);
}
catch
{
lblInfo.Text = "输入错误";
return;
}
if (len > 8)
{
len = 8;
}
if (this.MessageReturn != null)
{
this.MessageReturn(id, data, len);
}
this.Close();
}
private void btnCancel_Click(object sender, EventArgs e)
{
this.Close();
}
}
}

View File

@ -0,0 +1,120 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
</root>

BIN
CAN_Tool/PCANTest.ico Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.2 KiB

22
CAN_Tool/Program.cs Normal file
View File

@ -0,0 +1,22 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace CanTool
{
static class Program
{
/// <summary>
/// 应用程序的主入口点。
/// </summary>
[STAThread]
static void Main()
{
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
Application.Run(new uds_tools());
}
}
}

View File

@ -0,0 +1,36 @@
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// 有关程序集的常规信息通过以下
// 特性集控制。更改这些特性值可修改
// 与程序集关联的信息。
[assembly: AssemblyTitle("CANTestV1.0")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Microsoft")]
[assembly: AssemblyProduct("CANTestV1.0")]
[assembly: AssemblyCopyright("Copyright © Microsoft 2021")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// 将 ComVisible 设置为 false 使此程序集中的类型
// 对 COM 组件不可见。 如果需要从 COM 访问此程序集中的类型,
// 则将该类型上的 ComVisible 特性设置为 true。
[assembly: ComVisible(false)]
// 如果此项目向 COM 公开,则下列 GUID 用于类型库的 ID
[assembly: Guid("b981da53-96a6-47a7-a46d-99a855bb21e3")]
// 程序集的版本信息由下面四个值组成:
//
// 主版本
// 次版本
// 生成号
// 修订号
//
// 可以指定所有这些值,也可以使用“生成号”和“修订号”的默认值,
// 方法是按如下所示使用“*”:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]

View File

@ -0,0 +1,63 @@
//------------------------------------------------------------------------------
// <auto-generated>
// 此代码由工具生成。
// 运行时版本:4.0.30319.42000
//
// 对此文件的更改可能会导致不正确的行为,并且如果
// 重新生成代码,这些更改将会丢失。
// </auto-generated>
//------------------------------------------------------------------------------
namespace CanTool.Properties {
using System;
/// <summary>
/// 一个强类型的资源类,用于查找本地化的字符串等。
/// </summary>
// 此类是由 StronglyTypedResourceBuilder
// 类通过类似于 ResGen 或 Visual Studio 的工具自动生成的。
// 若要添加或移除成员,请编辑 .ResX 文件,然后重新运行 ResGen
// (以 /str 作为命令选项),或重新生成 VS 项目。
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "17.0.0.0")]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
internal class Resources {
private static global::System.Resources.ResourceManager resourceMan;
private static global::System.Globalization.CultureInfo resourceCulture;
[global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
internal Resources() {
}
/// <summary>
/// 返回此类使用的缓存的 ResourceManager 实例。
/// </summary>
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
internal static global::System.Resources.ResourceManager ResourceManager {
get {
if (object.ReferenceEquals(resourceMan, null)) {
global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("CanTool.Properties.Resources", typeof(Resources).Assembly);
resourceMan = temp;
}
return resourceMan;
}
}
/// <summary>
/// 重写当前线程的 CurrentUICulture 属性,对
/// 使用此强类型资源类的所有资源查找执行重写。
/// </summary>
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
internal static global::System.Globalization.CultureInfo Culture {
get {
return resourceCulture;
}
set {
resourceCulture = value;
}
}
}
}

View File

@ -0,0 +1,117 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
</root>

26
CAN_Tool/Properties/Settings.Designer.cs generated Normal file
View File

@ -0,0 +1,26 @@
//------------------------------------------------------------------------------
// <auto-generated>
// 此代码由工具生成。
// 运行时版本:4.0.30319.42000
//
// 对此文件的更改可能会导致不正确的行为,并且如果
// 重新生成代码,这些更改将会丢失。
// </auto-generated>
//------------------------------------------------------------------------------
namespace CanTool.Properties {
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "17.11.0.0")]
internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase {
private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
public static Settings Default {
get {
return defaultInstance;
}
}
}
}

View File

@ -0,0 +1,7 @@
<?xml version='1.0' encoding='utf-8'?>
<SettingsFile xmlns="http://schemas.microsoft.com/VisualStudio/2004/01/settings" CurrentProfile="(Default)">
<Profiles>
<Profile Name="(Default)" />
</Profiles>
<Settings />
</SettingsFile>

705
CAN_Tool/S19File.cs Normal file
View File

@ -0,0 +1,705 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.IO;
namespace S19File
{
class S19FileStream
{
public List<string> FileText;
//数据大小
private int size;
public int Size
{
get
{
return size;
}
}
//起始地址
private int startAddr;
public int StartAddr
{
get
{
return startAddr;
}
}
//结束地址
private int endAddr;
public int EndAddr
{
get
{
return endAddr;
}
}
public S19FileStream()
{
FileText = new List<string>();
size = 0;
startAddr = 0;
endAddr = 0;
}
public S19FileStream(string FileName)
{
StreamReader StreamRead = new StreamReader(FileName, System.Text.Encoding.Default);
FileText = new List<string>();
string LineText;
while ((LineText = StreamRead.ReadLine()) != null)
{
if (0 != LineText.Length)
{
FileText.Add(LineText);
}
}
size = GetSize();
startAddr = GetStartAddr();
endAddr = GetEndAddr();
}
//清除读取到的S19数据
public void Clear()
{
this.FileText.Clear();
size = 0;
startAddr = 0;
endAddr = 0;
}
//获取S19文件的数据的大小
private int GetSize()
{
int size;
int startAddr;
int endAddr;
int endLineNum;
int endLineDataLen;
//获取起始地址
startAddr = this.GetStartAddr();
endAddr = this.GetEndAddr();
endLineNum = this.GetEndLineNum();
endLineDataLen = this.GetLineDataLen(endLineNum);
size = endAddr - startAddr + endLineDataLen;
return size;
}
//一字节转16进制字符串 小于0x10往前补零
private string ByteToStringHex(byte num)
{
string str;
if (num >= 0x10)
{
str = Convert.ToString(num, 16);
}
else
{
str = "0" + Convert.ToString(num, 16);
}
return str.ToUpper();
}
public byte[] ToBinByteArray(int size)
{
string s19Head;
int count = 0;
int lineAddrLen;
int lineDataLen;
List<byte> dataBuff = new List<byte>();
foreach (string line in this.FileText)
{
s19Head = line.Substring(0, 2);
lineDataLen = Convert.ToByte(line.Substring(2, 2), 16);
/*lineAddrLen = s19Head switch
{
"S1" => 4,
"S1"
}*/
switch (s19Head)
{
case "S1":
{
lineAddrLen = 4;
break;
}
case "S2":
{
lineAddrLen = 6;
break;
}
case "S3":
{
lineAddrLen = 8;
break;
}
default:
lineAddrLen = 0;
break;
}
if (0 != lineAddrLen)
{
for (int i = lineAddrLen + 4; i < (lineDataLen << 1) + 2; i += 2)
{
dataBuff.Add(Convert.ToByte(line.Substring(i, 2), 16));
count++;
if (count >= size)
{
return dataBuff.ToArray();
}
}
}
}
return dataBuff.ToArray();
}
//获取S19行存放地址的长度
private int GetLineAddrLen(int line)
{
string s19LineHead;
int lineAddrLen;
if ((line < this.FileText.Count)
&& (line >= 0)
)
{
s19LineHead = this.FileText[line].Substring(0, 2);
}
else
{
s19LineHead = "";
}
switch (s19LineHead)
{
case "S1":
{
lineAddrLen = 4;
break;
}
case "S2":
{
lineAddrLen = 6;
break;
}
case "S3":
{
lineAddrLen = 8;
break;
}
default:
lineAddrLen = 0;
break;
}
return lineAddrLen;
}
private int GetLineAddr(int line)
{
//一行的头 S0 S1 S2 S3 ...
//string s19LineHead;
//要读取的行的地址数据的长度
int lineAddrLen;
//要读取的行的地址
int lineAddr;
lineAddrLen = GetLineAddrLen(line);
if (0 == lineAddrLen)
{
lineAddr = 0;
}
else
{
lineAddr = Convert.ToInt32(this.FileText[line].Substring(4, lineAddrLen), 16);
}
return lineAddr;
}
private int GetStartAddr()
{
string s19Head;
//int lineAddrLen;
int startAddr;
int headLineNum = 0;
s19Head = this.FileText[0].Substring(0, 2);
if ("S0" == s19Head)
{
headLineNum = 1;
}
startAddr = GetLineAddr(headLineNum);
return startAddr;
}
//获取结束行数
private int GetEndLineNum()
{
int endLineNum = -1;
for (int i = this.FileText.Count - 1; i >= 0; i--)
{
if (("S1" == this.FileText[i].Substring(0, 2))
|| ("S2" == this.FileText[i].Substring(0, 2))
|| ("S3" == this.FileText[i].Substring(0, 2))
)
{
endLineNum = i;
break;
}
}
return endLineNum;
}
//获取结束行的地址大小
private int GetEndAddr()
{
int endLineNum = 0;
int endAddr;
endLineNum = GetEndLineNum();
if (0 == endLineNum)
{
endAddr = 0;
}
else
{
endAddr = this.GetLineAddr(endLineNum);
}
return endAddr;
}
private byte GetS19LineChecksum(string line)
{
byte lineDataLen;
int sum = 0;
lineDataLen = Convert.ToByte(line.Substring(2, 2), 16);
int len = line.Length;
for (int i = 2; i < (lineDataLen << 1) + 2; i += 2)
{
sum += Convert.ToByte(line.Substring(i, 2), 16);
}
sum = 0xff - (sum & 0xff);
//sum = temp - sum;
return (byte)sum;
}
//获取S19标识的行的长度
private int GetLineLen(int line)
{
int lineLen;
if ((line < this.FileText.Count)
&& (line >= 0)
)
{
lineLen = Convert.ToInt16(this.FileText[line].Substring(2, 2), 16);
}
else
{
lineLen = 0;
}
return lineLen;
}
//获取S19行的数据长度
private int GetLineDataLen(int line)
{
int lineLen;
int lineAddrLen;
int lineDataLen;
lineLen = GetLineLen(line);
lineAddrLen = this.GetLineAddrLen(line);
lineDataLen = lineLen - lineAddrLen / 2 - 1;
return lineDataLen;
}
public void AddHead(byte[] data, int size, byte fill)
{
string s19Head;
//string line = "";
int lineLen;
int lineDataLen;
int lineAddrLen;
int startAddr;
int addLineNum;
int dataIndex = 0;
int insertIndex;
int headLineNum = 0;
s19Head = this.FileText[0].Substring(0, 2);
if ("S0" == s19Head)
{
headLineNum = 1;
}
insertIndex = headLineNum;
s19Head = this.FileText[headLineNum].Substring(0, 2);
lineLen = Convert.ToByte(this.FileText[headLineNum].Substring(2, 2), 16);
switch (s19Head)
{
case "S1":
{
lineAddrLen = 4;
break;
}
case "S2":
{
lineAddrLen = 6;
break;
}
case "S3":
{
lineAddrLen = 8;
break;
}
default:
{
return;
}
}
lineDataLen = lineLen - (lineAddrLen >> 1) - 1;
startAddr = this.GetStartAddr();
if (size > startAddr)
{
return;
}
else
{
//需要增加的行数 向上取整
addLineNum = (size + lineDataLen - 1) / (lineDataLen);
startAddr = startAddr - addLineNum * lineDataLen;
for (int i = 0; i < addLineNum; i++)
{
//添加Sx和长度
string line = s19Head + this.ByteToStringHex((byte)lineLen);
//添加地址
for (int j = 0; j < (lineAddrLen >> 1); j++)
{
int addrNum = (startAddr >> (((lineAddrLen >> 1) - j - 1) << 3)) & 0xff;
line += this.ByteToStringHex((byte)addrNum);
}
startAddr += lineDataLen;
//添加数据
for (int k = 0; k < lineDataLen; k++)
{
if (dataIndex < data.Length)
{
line += this.ByteToStringHex(data[dataIndex]);
dataIndex++;
}
else
{
line += "FF";
}
}
//添加校验和
line += this.ByteToStringHex(this.GetS19LineChecksum(line));
//line += "\r\n";
this.FileText.Insert(insertIndex, line);
insertIndex++;
}
}
startAddr = GetStartAddr();
endAddr = GetEndAddr();
size = GetSize();
}
public void AddEnd(byte[] data, int size, byte fill)
{
string s19Head;
//string line = "";
int lineLen;
int lineDataLen;
int lineAddrLen;
int addAddr;
int addLineNum;
int dataIndex = 0;
int insertIndex;
int endLineNum;
int endLineLen;
int endLineAddLen;
char[] endLineTextData;
endLineNum = this.GetEndLineNum();
insertIndex = endLineNum + 1;
lineAddrLen = this.GetLineAddrLen(endLineNum);
lineDataLen = this.GetLineDataLen(endLineNum - 1);
endLineLen = this.GetLineLen(endLineNum);
lineLen = this.GetLineLen(endLineNum - 1);
s19Head = this.FileText[endLineNum].Substring(0, 2);
//最后一行未满
if (endLineLen < lineLen)
{
if (size > (lineLen - endLineLen))
{
endLineAddLen = lineLen - endLineLen;
}
else
{
endLineAddLen = size;
}
endLineTextData = this.FileText[endLineNum].Substring(0, endLineLen * 2 + 2).ToCharArray();
string temp = this.ByteToStringHex((byte)(endLineLen + endLineAddLen));
endLineTextData[2] = temp[0];
endLineTextData[3] = temp[1];
this.FileText[endLineNum] = new string(endLineTextData);
for (int k = 0; k < endLineAddLen; k++)
{
if (dataIndex < data.Length)
{
this.FileText[endLineNum] += this.ByteToStringHex(data[dataIndex]);
}
else
{
this.FileText[endLineNum] += "FF";
}
dataIndex++;
size--;
}
//添加校验和
this.FileText[endLineNum] += this.ByteToStringHex(this.GetS19LineChecksum(this.FileText[endLineNum]));
}
//需要增加的行数 向上取整
addLineNum = (size + lineDataLen - 1) / (lineDataLen);
//需要添加的地址
addAddr = this.GetEndAddr();
for (int i = 0; i < addLineNum; i++)
{
addAddr += lineDataLen;
//添加Sx和长度
string line = s19Head + this.ByteToStringHex((byte)lineLen);
//添加地址
for (int j = 0; j < (lineAddrLen >> 1); j++)
{
int addrNum = (addAddr >> (((lineAddrLen >> 1) - j - 1) << 3)) & 0xff;
line += this.ByteToStringHex((byte)addrNum);
}
//添加数据
for (int k = 0; k < lineDataLen; k++)
{
if (dataIndex < data.Length)
{
line += this.ByteToStringHex(data[dataIndex]);
dataIndex++;
}
else
{
line += "FF";
}
}
//添加校验和
line += this.ByteToStringHex(this.GetS19LineChecksum(line));
//line += "\r\n";
this.FileText.Insert(insertIndex, line);
insertIndex++;
}
startAddr = GetStartAddr();
endAddr = GetEndAddr();
size = GetSize();
}
public void ReadBinArray(string s19Head, byte[] data, int startAddr, int lineLen)
{
int addLineNum;
int lineAddrLen;
int lineDataLen;
int addAddr;
int dataIndex = 0;
switch (s19Head)
{
case "S1":
{
lineAddrLen = 4;
break;
}
case "S2":
{
lineAddrLen = 6;
break;
}
case "S3":
{
lineAddrLen = 8;
break;
}
default:
{
return;
}
}
//需要添加的地址
addAddr = startAddr;
lineDataLen = lineLen - (lineAddrLen >> 1) - 1;
//需要增加的行数 向上取整
addLineNum = (data.Length + lineDataLen - 1) / (lineDataLen);
this.FileText.Clear();
for (int i = 0; i < addLineNum; i++)
{
//添加Sx和长度
if ((data.Length - dataIndex) < (lineLen - 1))//最后一行数据未满
{
lineDataLen = data.Length - dataIndex;
lineLen = lineDataLen + (lineAddrLen >> 1) + 1;
}
string line = s19Head + this.ByteToStringHex((byte)lineLen);
//添加地址
for (int j = 0; j < (lineAddrLen >> 1); j++)
{
int addrNum = (addAddr >> (((lineAddrLen >> 1) - j - 1) << 3)) & 0xff;
line += this.ByteToStringHex((byte)addrNum);
}
//添加数据
for (int k = 0; k < lineDataLen; k++)
{
if (dataIndex < data.Length)
{
line += this.ByteToStringHex(data[dataIndex]);
dataIndex++;
}
else
{
line += "FF";
}
}
//添加校验和
line += this.ByteToStringHex(this.GetS19LineChecksum(line));
//line += "\r\n";
//this.FileText.Insert(insertIndex, line);
this.FileText.Add(line);
addAddr += lineDataLen;
}
startAddr = GetStartAddr();
endAddr = GetEndAddr();
size = GetSize();
}
}
}

View File

@ -0,0 +1,656 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Runtime.InteropServices;
namespace CanTool
{
class SecurityAlgorithmCA
{
public void ISeedToIOKeyArrayCA(byte[] iSeedArray, out byte[] ioKeyArray, int level)
{
int i;
byte[] seed = { 0, 0, 0, 0 };
byte[] seed2 = { 0, 0, 0, 0 };
ioKeyArray = new byte[4];
uint seedtemp, SeedEx1;
byte[] key1 = { 0, 0, 0, 0 };
uint key1_32 = 0;
byte[] key2 = { 0, 0, 0, 0 };
uint key2_32 = 0;
byte[] keysum = { 0, 0, 0, 0 };
uint keysum32;
byte[] Xor = { 0x90, 0xA3, 0xFC, 0xF5 };//{0x17,0x15,0xF7,0x74};
seed[0] = iSeedArray[3];
seed[1] = iSeedArray[2];
seed[2] = iSeedArray[1];
seed[3] = iSeedArray[0];
//if (0x01 == level)
{
for (i = 0; i < 4; i++)
{
key1[i] = (byte)((uint)seed[i] ^ (uint)Xor[i]);
}
seedtemp = ((uint)seed[3]) << 24 | ((uint)seed[2]) << 16 | ((uint)seed[1]) << 8 | (seed[0]);
SeedEx1 = 0;
for (i = 0; i < 32; i++)
{
SeedEx1 <<= 1;
if ((seedtemp & 0x00000001) == 1)
{
SeedEx1 |= 0x00000001;
}
seedtemp >>= 1;
}
seed2[0] = (byte)(SeedEx1);
seed2[1] = (byte)(SeedEx1 >> 8);
seed2[2] = (byte)(SeedEx1 >> 16);
seed2[3] = (byte)(SeedEx1 >> 24);
for (i = 0; i < 4; i++)
{
key2[i] = (byte)((uint)seed2[i] ^ (uint)Xor[i]);
}
key1_32 = (uint)((uint)key1[3] << 24) | ((uint)key1[2] << 16) | ((uint)key1[1] << 8) | ((uint)key1[0]);
key2_32 = (uint)((uint)key2[3] << 24) | ((uint)key2[2] << 16) | ((uint)key2[1] << 8) | ((uint)key2[0]);
keysum32 = (uint)((UInt64)key1_32 + (UInt64)key2_32);
ioKeyArray[0] = (byte)((keysum32 >> 24) & 0xffu);
ioKeyArray[1] = (byte)((keysum32 >> 16) & 0xffu);
ioKeyArray[2] = (byte)((keysum32 >> 8) & 0xffu);
ioKeyArray[3] = (byte)(keysum32 & 0xffu);
}
}
}
class SecurityAlgorithmGQ
{
byte[] sBox = new byte[]
{ /* 0 1 2 3 4 5 6 7 8 9 a b c d e f */
0x63, 0x7c, 0x77, 0x7b, 0xf2, 0x6b, 0x6f, 0xc5, 0x30, 0x01, 0x67, 0x2b, 0xfe, 0xd7, 0xab, 0x76, /*0*/
0xca, 0x82, 0xc9, 0x7d, 0xfa, 0x59, 0x47, 0xf0, 0xad, 0xd4, 0xa2, 0xaf, 0x9c, 0xa4, 0x72, 0xc0, /*1*/
0xb7, 0xfd, 0x93, 0x26, 0x36, 0x3f, 0xf7, 0xcc, 0x34, 0xa5, 0xe5, 0xf1, 0x71, 0xd8, 0x31, 0x15, /*2*/
0x04, 0xc7, 0x23, 0xc3, 0x18, 0x96, 0x05, 0x9a, 0x07, 0x12, 0x80, 0xe2, 0xeb, 0x27, 0xb2, 0x75, /*3*/
0x09, 0x83, 0x2c, 0x1a, 0x1b, 0x6e, 0x5a, 0xa0, 0x52, 0x3b, 0xd6, 0xb3, 0x29, 0xe3, 0x2f, 0x84, /*4*/
0x53, 0xd1, 0x00, 0xed, 0x20, 0xfc, 0xb1, 0x5b, 0x6a, 0xcb, 0xbe, 0x39, 0x4a, 0x4c, 0x58, 0xcf, /*5*/
0xd0, 0xef, 0xaa, 0xfb, 0x43, 0x4d, 0x33, 0x85, 0x45, 0xf9, 0x02, 0x7f, 0x50, 0x3c, 0x9f, 0xa8, /*6*/
0x51, 0xa3, 0x40, 0x8f, 0x92, 0x9d, 0x38, 0xf5, 0xbc, 0xb6, 0xda, 0x21, 0x10, 0xff, 0xf3, 0xd2, /*7*/
0xcd, 0x0c, 0x13, 0xec, 0x5f, 0x97, 0x44, 0x17, 0xc4, 0xa7, 0x7e, 0x3d, 0x64, 0x5d, 0x19, 0x73, /*8*/
0x60, 0x81, 0x4f, 0xdc, 0x22, 0x2a, 0x90, 0x88, 0x46, 0xee, 0xb8, 0x14, 0xde, 0x5e, 0x0b, 0xdb, /*9*/
0xe0, 0x32, 0x3a, 0x0a, 0x49, 0x06, 0x24, 0x5c, 0xc2, 0xd3, 0xac, 0x62, 0x91, 0x95, 0xe4, 0x79, /*a*/
0xe7, 0xc8, 0x37, 0x6d, 0x8d, 0xd5, 0x4e, 0xa9, 0x6c, 0x56, 0xf4, 0xea, 0x65, 0x7a, 0xae, 0x08, /*b*/
0xba, 0x78, 0x25, 0x2e, 0x1c, 0xa6, 0xb4, 0xc6, 0xe8, 0xdd, 0x74, 0x1f, 0x4b, 0xbd, 0x8b, 0x8a, /*c*/
0x70, 0x3e, 0xb5, 0x66, 0x48, 0x03, 0xf6, 0x0e, 0x61, 0x35, 0x57, 0xb9, 0x86, 0xc1, 0x1d, 0x9e, /*d*/
0xe1, 0xf8, 0x98, 0x11, 0x69, 0xd9, 0x8e, 0x94, 0x9b, 0x1e, 0x87, 0xe9, 0xce, 0x55, 0x28, 0xdf, /*e*/
0x8c, 0xa1, 0x89, 0x0d, 0xbf, 0xe6, 0x42, 0x68, 0x41, 0x99, 0x2d, 0x0f, 0xb0, 0x54, 0xbb, 0x16 /*f*/
};
byte[] invsBox = new byte[]
{ /* 0 1 2 3 4 5 6 7 8 9 a b c d e f */
0x52, 0x09, 0x6a, 0xd5, 0x30, 0x36, 0xa5, 0x38, 0xbf, 0x40, 0xa3, 0x9e, 0x81, 0xf3, 0xd7, 0xfb, /*0*/
0x7c, 0xe3, 0x39, 0x82, 0x9b, 0x2f, 0xff, 0x87, 0x34, 0x8e, 0x43, 0x44, 0xc4, 0xde, 0xe9, 0xcb, /*1*/
0x54, 0x7b, 0x94, 0x32, 0xa6, 0xc2, 0x23, 0x3d, 0xee, 0x4c, 0x95, 0x0b, 0x42, 0xfa, 0xc3, 0x4e, /*2*/
0x08, 0x2e, 0xa1, 0x66, 0x28, 0xd9, 0x24, 0xb2, 0x76, 0x5b, 0xa2, 0x49, 0x6d, 0x8b, 0xd1, 0x25, /*3*/
0x72, 0xf8, 0xf6, 0x64, 0x86, 0x68, 0x98, 0x16, 0xd4, 0xa4, 0x5c, 0xcc, 0x5d, 0x65, 0xb6, 0x92, /*4*/
0x6c, 0x70, 0x48, 0x50, 0xfd, 0xed, 0xb9, 0xda, 0x5e, 0x15, 0x46, 0x57, 0xa7, 0x8d, 0x9d, 0x84, /*5*/
0x90, 0xd8, 0xab, 0x00, 0x8c, 0xbc, 0xd3, 0x0a, 0xf7, 0xe4, 0x58, 0x05, 0xb8, 0xb3, 0x45, 0x06, /*6*/
0xd0, 0x2c, 0x1e, 0x8f, 0xca, 0x3f, 0x0f, 0x02, 0xc1, 0xaf, 0xbd, 0x03, 0x01, 0x13, 0x8a, 0x6b, /*7*/
0x3a, 0x91, 0x11, 0x41, 0x4f, 0x67, 0xdc, 0xea, 0x97, 0xf2, 0xcf, 0xce, 0xf0, 0xb4, 0xe6, 0x73, /*8*/
0x96, 0xac, 0x74, 0x22, 0xe7, 0xad, 0x35, 0x85, 0xe2, 0xf9, 0x37, 0xe8, 0x1c, 0x75, 0xdf, 0x6e, /*9*/
0x47, 0xf1, 0x1a, 0x71, 0x1d, 0x29, 0xc5, 0x89, 0x6f, 0xb7, 0x62, 0x0e, 0xaa, 0x18, 0xbe, 0x1b, /*a*/
0xfc, 0x56, 0x3e, 0x4b, 0xc6, 0xd2, 0x79, 0x20, 0x9a, 0xdb, 0xc0, 0xfe, 0x78, 0xcd, 0x5a, 0xf4, /*b*/
0x1f, 0xdd, 0xa8, 0x33, 0x88, 0x07, 0xc7, 0x31, 0xb1, 0x12, 0x10, 0x59, 0x27, 0x80, 0xec, 0x5f, /*c*/
0x60, 0x51, 0x7f, 0xa9, 0x19, 0xb5, 0x4a, 0x0d, 0x2d, 0xe5, 0x7a, 0x9f, 0x93, 0xc9, 0x9c, 0xef, /*d*/
0xa0, 0xe0, 0x3b, 0x4d, 0xae, 0x2a, 0xf5, 0xb0, 0xc8, 0xeb, 0xbb, 0x3c, 0x83, 0x53, 0x99, 0x61, /*e*/
0x17, 0x2b, 0x04, 0x7e, 0xba, 0x77, 0xd6, 0x26, 0xe1, 0x69, 0x14, 0x63, 0x55, 0x21, 0x0c, 0x7d /*f*/
};
byte[] Var = new byte[16] { 0xD1, 0xD5, 0x2E, 0x15, 0xF9, 0x6A, 0x16, 0x41, 0x17, 0x81, 0x33, 0x35, 0x42, 0x4B, 0x5F, 0x1E };
byte[] Sbox = new byte[256];
byte[] InvSbox = new byte[256];
byte[, ,] w = new byte[11, 4, 4];
//---------------------------------------------------------------------------------------------------------------
public void ISeedToIOKeyArray(byte[] iSeedArray, out byte[] ioKeyArray, int level)
{
byte[] temp = new byte[16];
//unsigned int Size = 0;
byte dat = (byte)level;
byte[] data = new byte[16];
int i;
ioKeyArray = new byte[4];
if (level != 0x01 && level != 0x03 && level != 0x11)
return;
AES_Init(ref Var);
for (i = 0; i < 16; i++)
{
temp[i] = dat;
}
for (i = 0; i < 4; i++)
{
temp[i] = iSeedArray[i];
}
AES_Cipher(ref temp);
for (i = 0; i < 8; i++)
{
data[i] = (byte)((uint)temp[i] ^ (uint)temp[15 - i]);
}
for (i = 0; i < 4; i++)
{
data[i] = (byte)((uint)data[i] ^ (uint)data[3 - i]);
}
for (i = 0; i < 4; i++)
{
ioKeyArray[i] = data[i];
}
}
private void AES_Init(ref byte[] key)
{
sBox.CopyTo(Sbox, 0);
invsBox.CopyTo(InvSbox, 0);
KeyExpansion(ref key, ref w);
}
private byte[] AES_Cipher(ref byte[] input)
{
byte[,] state = new byte[4, 4];
int i, r, c;
for (r = 0; r < 4; r++)
{
for (c = 0; c < 4; c++)
{
state[r, c] = input[c * 4 + r];
}
}
//AddRoundKey(state, w[0]);
AddRoundKey(ref state, ref w, 0);
for (i = 1; i <= 10; i++)
{
SubBytes(ref state);
ShiftRows(ref state);
if (i != 10) MixColumns(ref state);
//AddRoundKey(state, w[i]);
AddRoundKey(ref state, ref w, i);
}
for (r = 0; r < 4; r++)
{
for (c = 0; c < 4; c++)
{
input[c * 4 + r] = state[r, c];
}
}
return input;
}
byte[] AES_InvCipher(ref byte[] input)
{
byte[,] state = new byte[4, 4];
int i, r, c;
for (r = 0; r < 4; r++)
{
for (c = 0; c < 4; c++)
{
state[r, c] = input[c * 4 + r];
}
}
//AddRoundKey(state, w[10]);
AddRoundKey(ref state, ref w, 10);
for (i = 9; i >= 0; i--)
{
InvShiftRows(ref state);
InvSubBytes(ref state);
//AddRoundKey(state, w[i]);
AddRoundKey(ref state, ref w, i);
if (i != 0)
{
InvMixColumns(ref state);
}
}
for (r = 0; r < 4; r++)
{
for (c = 0; c < 4; c++)
{
input[c * 4 + r] = state[r, c];
}
}
return input;
}
//----------------------------------------------------------------------------------------------------------
void KeyExpansion(ref byte[] key, ref byte[, ,] w)
{
uint i, j, r, c;
byte[] rc = new byte[] { 0x01, 0x02, 0x04, 0x08, 0x10, 0x20, 0x40, 0x80, 0x1b, 0x36 };
for (r = 0; r < 4; r++)
{
for (c = 0; c < 4; c++)
{
w[0, r, c] = key[r + c * 4];
}
}
for (i = 1; i <= 10; i++)
{
for (j = 0; j < 4; j++)
{
byte[] t = new byte[4];
for (r = 0; r < 4; r++)
{
//t[r] = j ? w[i][r][j - 1] : w[i - 1][r][3];
if (0 == j)
{
t[r] = w[i - 1, r, 3];
}
else
{
t[r] = w[i, r, j - 1];
}
}
if (j == 0)
{
byte temp = t[0];
for (r = 0; r < 3; r++)
{
t[r] = Sbox[t[(r + 1) % 4]];
}
t[3] = Sbox[temp];
//t[0] ^= rc[i - 1];
t[0] = (byte)((uint)t[0] ^ (uint)rc[i - 1]);
}
for (r = 0; r < 4; r++)
{
w[i, r, j] = (byte)((uint)w[i - 1, r, j] ^ (uint)t[r]);
}
}
}
}
byte FFmul(byte a, byte b)
{
byte[] bw = new byte[4];
byte res = 0;
int i;
bw[0] = b;
for (i = 1; i < 4; i++)
{
bw[i] = (byte)(((uint)bw[i - 1] << 1) & 0xff);
if (((int)bw[i - 1] & 0x80) == 0x80)
{
//bw[i] ^= 0x1b;
bw[i] = (byte)((uint)bw[i] ^ 0x1b);
}
}
for (i = 0; i < 4; i++)
{
if ((((uint)a >> i) & 0x01) == 0x01)
{
//res ^= bw[i];
res = (byte)((uint)res ^ (uint)bw[i]);
}
}
return res;
}
void SubBytes(ref byte[,] state)
{
int r, c;
for (r = 0; r < 4; r++)
{
for (c = 0; c < 4; c++)
{
state[r, c] = Sbox[state[r, c]];
}
}
}
void ShiftRows(ref byte[,] state)
{
byte[] t = new byte[4];
int r, c;
for (r = 1; r < 4; r++)
{
for (c = 0; c < 4; c++)
{
t[c] = state[r, (c + r) % 4];
}
for (c = 0; c < 4; c++)
{
state[r, c] = t[c];
}
}
}
void MixColumns(ref byte[,] state)
{
byte[] t = new byte[4];
uint r, c;
for (c = 0; c < 4; c++)
{
for (r = 0; r < 4; r++)
{
t[r] = state[r, c];
}
for (r = 0; r < 4; r++)
{
state[r, c] = (byte)((uint)FFmul(0x02, t[r])
^ (uint)FFmul(0x03, t[(r + 1) % 4])
^ (uint)FFmul(0x01, t[(r + 2) % 4])
^ (uint)FFmul(0x01, t[(r + 3) % 4]));
}
}
}
//void AddRoundKey(byte[,] state, byte[,] k)
void AddRoundKey(ref byte[,] state, ref byte[, ,] k, int index)
{
uint r, c;
for (c = 0; c < 4; c++)
{
for (r = 0; r < 4; r++)
{
//state[r][c] ^= k[r][c];
state[r, c] = (byte)((uint)state[r, c] ^ (uint)k[index, r, c]);
}
}
}
void InvSubBytes(ref byte[,] state)
{
uint r, c;
for (r = 0; r < 4; r++)
{
for (c = 0; c < 4; c++)
{
state[r, c] = InvSbox[state[r, c]];
}
}
}
void InvShiftRows(ref byte[,] state)
{
byte[] t = new byte[4];
uint r, c;
for (r = 1; r < 4; r++)
{
for (c = 0; c < 4; c++)
{
t[c] = state[r, (c - r + 4) % 4];
}
for (c = 0; c < 4; c++)
{
state[r, c] = t[c];
}
}
}
void InvMixColumns(ref byte[,] state)
{
byte[] t = new byte[4];
int r, c;
for (c = 0; c < 4; c++)
{
for (r = 0; r < 4; r++)
{
t[r] = state[r, c];
}
for (r = 0; r < 4; r++)
{
state[r, c] = (byte)((uint)FFmul(0x0e, t[r])
^ (uint)FFmul(0x0b, t[(r + 1) % 4])
^ (uint)FFmul(0x0d, t[(r + 2) % 4])
^ (uint)FFmul(0x09, t[(r + 3) % 4]));
}
}
}
[DllImport(@"GAC_SA_HUD.dll", EntryPoint = "GenerateKeyEx", CallingConvention = CallingConvention.Cdecl)]
public extern static int GenerateKeyEx(byte[] ipSeedArray,
UInt32 iSeedArraySize,
UInt32 iSecurityLevel,
byte[] ipVariant,
byte[] iopKeyArray,
UInt32 iKeyArraySize,
ref UInt32 oSize);
public static void ISeedToIOKeyArrayDll(byte[] iSeedArray, out byte[] ioKeyArray, int level)
{
UInt32 outSize = 0;
ioKeyArray = new byte[4];
GenerateKeyEx(iSeedArray, 4, (UInt32)level, new byte[4], ioKeyArray, 4, ref outSize);
}
}
class SecurityAlgorithmDF
{
private void SA_GenerateKey(byte[] RndSeed, byte length, ref byte[] key, ref byte returnlength)
{
int i;
byte[] seed;
byte[] SeedTemp = new byte[4];
byte[] SeedChange1 = new byte[4];
byte[] SeedChange2 = new byte[4];
byte[] SeedChange3 = new byte[4];
byte[] KeyTemp = new byte[4];
byte[] Xor = new byte[4]{0x2C,0x51,0x82,0x39};
seed=RndSeed;
if(seed[0]==0 && seed[1]==0 && seed[2]==0 && seed[3]==0)
{
returnlength = 0;
return;
}
for(i=0;i<4;i++)
{
SeedTemp[i] = seed[i];
SeedChange1[i] = (byte)((SeedTemp[i] & 0x07) << 5);
SeedChange1[i] |= (byte)((SeedTemp[i] & 0xF8) >> 3);
SeedChange2[i] = (byte)((SeedChange1[i] & 0x55) << 1);
SeedChange2[i] |= (byte)((SeedChange1[i] & 0xAA) >> 1);
}
SeedChange3[0] = (byte)((SeedChange2[0] & 0x1F) << 3);
SeedChange3[0] |= (byte)((SeedChange2[1] & 0xE0) >> 5);
SeedChange3[1] = (byte)((SeedChange2[1] & 0x1F) << 3);
SeedChange3[1] |= (byte)((SeedChange2[0] & 0xE0) >> 5);
SeedChange3[2] = (byte)((SeedChange2[2] & 0x1F) << 3);
SeedChange3[2] |= (byte)((SeedChange2[3] & 0xE0) >> 5);
SeedChange3[3] = (byte)((SeedChange2[3] & 0x1F) << 3);
SeedChange3[3] |= (byte)((SeedChange2[2] & 0xE0) >> 5);
for(i=0;i<4;i++)
{
KeyTemp[i] = (byte)(SeedChange3[i] ^ Xor[i]);
key[i] = (byte)(~KeyTemp[i]);
}
returnlength=length;
}
public void ISeedToIOKeyArray(byte[] iSeedArray, out byte[] ioKeyArray, int level)
{
byte len = 0;
ioKeyArray = new byte[4];
this.SA_GenerateKey(iSeedArray, 4, ref ioKeyArray, ref len);
}
}
class SecurityAlgorithmJK
{
public void ISeedToIOKeyArray(byte[] iSeedArray, out byte[] ioKeyArray, int level)
{
byte[] cal = new byte[4];
byte[] seed = new byte[4];
byte[] xor = new byte[4] {0x57, 0xb2, 0x28, 0x4d };
ioKeyArray = new byte[4];
/*seed[0] = iSeedArray[3];
seed[1] = iSeedArray[2];
seed[2] = iSeedArray[1];
seed[3] = iSeedArray[0];*/
seed[0] = iSeedArray[0];
seed[1] = iSeedArray[1];
seed[2] = iSeedArray[2];
seed[3] = iSeedArray[3];
for (int i = 0; i < 4; i++)
{
cal[i] = (byte)(seed[i] ^ xor[i]);
}
if (0x01 == level)
{
ioKeyArray[0] = (byte)(((cal[0] & 0x0f) << 4) | (cal[1] & 0xf0));
ioKeyArray[1] = (byte)(((cal[1] & 0x0f) << 4) | ((cal[2] & 0xf0) >> 4));
ioKeyArray[2] = (byte)((cal[2] & 0xf0) | ((cal[3] & 0xf0) >> 4));
ioKeyArray[3] = (byte)(((cal[3] & 0x0f) << 4) | (cal[0] & 0x0f));
}
else if (0x09 == level)
{
ioKeyArray[0] = (byte)(((cal[0] & 0x0f) << 4) | (cal[1] & 0x0f));
ioKeyArray[1] = (byte)(((cal[1] & 0xf0) >> 4) | ((cal[2] & 0x0f) << 4));
ioKeyArray[2] = (byte)(((cal[2] & 0xf0) >> 4) | (cal[3] & 0xf0));
ioKeyArray[3] = (byte)((cal[3] & 0x0f) | ((cal[0] & 0xf0) >> 4));
}
}
}
class SecurityAlgorithmVF
{
[DllImport(@"GenerateKeyExVF.dll", EntryPoint = "GenerateKeyEx", CallingConvention = CallingConvention.Cdecl)]
public extern static int GenerateKeyEx(byte[] ipSeedArray,
UInt32 iSeedArraySize,
UInt32 iSecurityLevel,
byte[] ipVariant,
byte[] iopKeyArray,
UInt32 iKeyArraySize,
ref UInt32 oSize);
public static void ISeedToIOKeyArray(byte[] iSeedArray, out byte[] ioKeyArray, int level)
{
UInt32 outSize = 0;
ioKeyArray = new byte[16];
GenerateKeyEx(iSeedArray, 16, (UInt32)level, new byte[4], ioKeyArray, 16, ref outSize);
}
}
class SecurityAlgorithmBYD
{
[DllImport(@"SecurityDll_FBY226.dll", EntryPoint = "GenerateKeyExOpt", CallingConvention = CallingConvention.Cdecl)]
public extern static int GenerateKeyExOpt(byte[] ipSeedArray,
UInt32 iSeedArraySize,
UInt32 iSecurityLevel,
byte[] ipVariant,
byte[] iOpt,
byte[] iopKeyArray,
UInt32 iKeyArraySize,
ref UInt32 oSize);
public static void ISeedToIOKeyArray(byte[] iSeedArray, out byte[] ioKeyArray, int level)
{
UInt32 outSize = 0;
ioKeyArray = new byte[4];
GenerateKeyExOpt(iSeedArray, 16, (UInt32)level, new byte[4], new byte[4], ioKeyArray, 16, ref outSize);
}
}
class SecurityAlgorithmHR
{
[DllImport(@"GenerateKeyExHR.dll", EntryPoint = "GenerateKeyEx", CallingConvention = CallingConvention.Cdecl)]
public extern static int GenerateKeyEx(byte[] ipSeedArray,
UInt32 iSeedArraySize,
UInt32 iSecurityLevel,
byte[] ipVariant,
byte[] iopKeyArray,
UInt32 iMaxKeyArraySize,
ref UInt32 oSize);
public static void ISeedToIOKeyArray(byte[] iSeedArray, out byte[] ioKeyArray, int level)
{
UInt32 outSize = 0;
ioKeyArray = new byte[4];
GenerateKeyEx(iSeedArray, 16, (UInt32)level, new byte[4], ioKeyArray, 16, ref outSize);
}
}
public class TestDebug
{
}
}

425
CAN_Tool/UDS.cs Normal file
View File

@ -0,0 +1,425 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace UDS
{
public enum UDSFrameType
{
SingleFrame = 0,
FirstFrame = 1,
ConsecutiveFrames = 2,
FlowControlFrame = 3,
};
public delegate void ReceivePackageEventHandler(byte[] data, int len);
public delegate void SendMessageEventHandler(UInt32 id, byte[] data, int len);
public class UDSBase
{
public UInt32 CANPhyDevRxId;
public UInt32 CANPhyDevTxId;
public UInt32 CANFuncDevRxId;
//是否是功能寻址
protected bool IsFunc;
protected int CANDL;
//发送的数据
protected byte[] SendData;
//发送包的大小
protected int SendPackageSize;
protected int NowSendDataIndex;
//用于判断接收到流控后 是否需要发送连续帧
protected bool IsSendFirstFrame;
//接收到的数据
protected byte[] ReceiveData;
//接收到包的大小
protected int ReceivePackageSize;
//当前接收到数据的在整个接收包的下标
protected int NowReceiveDataIndex;
protected byte ConsecutiveFramesHead;
//发送和接受事件
public event ReceivePackageEventHandler ReceivedPackage;
public event SendMessageEventHandler SendMessage;
//设置ID
public void SetId(UInt32 phyDevRxId, UInt32 phyDevTxId, UInt32 funcDevRxId)
{
this.CANPhyDevRxId = phyDevRxId;
this.CANPhyDevTxId = phyDevTxId;
this.CANFuncDevRxId = funcDevRxId;
}
public void SetCANDL(int canDL)
{
this.CANDL = canDL;
}
//触发发送报文事件
protected void SendMessageInvoke(byte[] data, int len)
{
UInt32 id;
if (this.IsFunc)
{
id = this.CANFuncDevRxId;
}
else
{
id = this.CANPhyDevRxId;
}
if (null != this.SendMessage)
{
this.SendMessage.Invoke(id, data, len);
}
}
//触发事件
protected void ReceivedPackageInvoke()
{
if (null != this.ReceivedPackage)
{
this.ReceivedPackage.Invoke(this.ReceiveData, this.ReceivePackageSize);
}
}
//发送一个包
virtual public void SendPackage(byte[] data, int len, bool isFunc)
{
}
//将数据插入接受缓存中
virtual public int InsertReceiveData(UInt32 id, byte[] data)
{
return 1;
}
//注册发送报文的事件
public void RegisterSendMessageEvent(SendMessageEventHandler func)
{
this.SendMessage += func;
}
//删除发送报文的事件
public void UnregisterSendMessageEvent(SendMessageEventHandler func)
{
this.SendMessage -= func;
}
//删除所有发送报文的事件
public void UnregisterSendMessageEventAll()
{
this.SendMessage = null;
}
//注册接收完成一个包的事件
public void RegisterReceivedPackageEvent(ReceivePackageEventHandler func)
{
this.ReceivedPackage += func;
}
//删除接收完成一个包的事件
public void UnregisterReceivedPackageEvent(ReceivePackageEventHandler func)
{
this.ReceivedPackage -= func;
}
//删除所有接收完成一个包的事件
public void UnregisterReceivedPackageEventAll()
{
this.ReceivedPackage = null;
}
}
public class UDSInfo : UDSBase
{
public UDSInfo(UInt32 phyDevRxId = 0, UInt32 phyDevTxId = 0, UInt32 funcDevRxId = 0, int canDL = 8)
{
//设置ID
this.SetId(phyDevRxId, phyDevTxId, funcDevRxId);
this.CANDL = canDL;
IsFunc = false;
IsSendFirstFrame = false;
//加一帧数据的大小 防止填充溢出
this.SendData = new byte[65535 + 64];
this.ReceiveData = new byte[65535 + 64];
}
//发送一个包 需要多帧则发送首帧后等待流控
override public void SendPackage(byte[] data, int len, bool isFunc)
{
byte[] dataFrame = new byte[8];
//byte[] dataFrame_64 = new byte[64];
this.SendPackageSize = len;
//是否发送首帧 先置false
IsSendFirstFrame = false;
//拷贝数据到缓存中
Array.Copy(data, 0, this.SendData, 0, len);
/*************************ISO15765-2******************************/
//8字节内单帧
//if ((this.CANDL <= 8)&& (len <= (this.CANDL - 1)))
if (len > 7)
{
//填充
for (int i = len; i < len + (7 - (len - 6 % 7)); i++)
{
this.SendData[i] = 0xAA;
}
//设置头数据
dataFrame[0] = (byte)(0x10 | ((len >> 8) & 0x0f));
dataFrame[1] = (byte)(len & 0xff);
Array.Copy(this.SendData, 0, dataFrame, 2, 6);
//发送了首帧
IsSendFirstFrame = true;
NowSendDataIndex = 6;
}
else
{
//填充
for (int i = len; i < 8; i++)
{
this.SendData[i] = 0xAA;
}
//设置头数据
dataFrame[0] = (byte)(len & 0xff);
Array.Copy(this.SendData, 0, dataFrame, 1, 7);
}
this.IsFunc = isFunc;
SendMessageInvoke(dataFrame, 8/*this.CANDL*/);
}
//发送连续帧
//内部调用
private void SendConsecutiveFrames()
{
byte[] dataFrame = new byte[this.CANDL];
int frameHead = 0x21;
//计算需要发送的连续帧数量
int framesNum = (this.SendPackageSize - this.NowSendDataIndex) / (this.CANDL - 1) + 1;
//未发送首帧 不应发送连续帧
if (!this.IsSendFirstFrame)
{
return;
}
//发送连续帧
for (int i = 0; i < framesNum; i++)
{
dataFrame[0] = (byte)frameHead;
Array.Copy(SendData, this.NowSendDataIndex, dataFrame, 1, this.CANDL - 1);
frameHead++;
if (0x30 == frameHead)
{
frameHead = 0x20;
}
this.NowSendDataIndex += this.CANDL - 1;
SendMessageInvoke(dataFrame, this.CANDL);
}
//发送完成后 将发送首帧标志置0
this.IsSendFirstFrame = false;
}
//发送流控帧
private void SendFlowControlFrame()
{
byte[] data = new byte[8] { 0x30, 0x00, 0x0A, 0x00, 0x00, 0x00, 0x00, 0x00 };
this.IsFunc = false;
SendMessageInvoke(data, 8);
}
//插入单帧
//内部调用
private void InsertSingleFrameData(byte[] data)
{
//获取大小
this.ReceivePackageSize = data[1];
//判断单帧格式
if (0 != data[0])
{
this.ReceivePackageSize = data[0];
//拷贝数据
Array.Copy(data, 1, this.ReceiveData, 0, this.ReceivePackageSize);
}
else
{
this.ReceivePackageSize = data[1];
//拷贝数据
Array.Copy(data, 2, this.ReceiveData, 0, this.ReceivePackageSize);
}
//方便字符串截取
this.ReceiveData[this.ReceivePackageSize] = 0;
//触发事件
this.ReceivedPackageInvoke();
}
//插入首帧
//内部调用
private void InsertFirstFrameData(byte[] data)
{
//获取大小
this.ReceivePackageSize = (((int)data[0] & 0x0f) << 8) | (int)data[1];
if (0 != ReceivePackageSize)
{
//拷贝首帧数据
Array.Copy(data, 2, this.ReceiveData, 0, this.CANDL - 2);
NowReceiveDataIndex = this.CANDL - 2;
}
else
{
//拷贝首帧数据
Array.Copy(data, 6, this.ReceiveData, 0, this.CANDL - 6);
NowReceiveDataIndex = this.CANDL - 6;
}
//连续帧头设置为0x20方便后面累加计算
ConsecutiveFramesHead = 0x20;
//发送流控帧
this.SendFlowControlFrame();
}
//插入的是连续帧
//内部调用
private int InsertConsecutiveFramesData(byte[] data)
{
int ret = 0;
int readDataLen;
//对上一次的头累加
ConsecutiveFramesHead++;
if (0x30 == ConsecutiveFramesHead)
{
ConsecutiveFramesHead = 0x20;
}
//判断是否连续
if (data[0] == ConsecutiveFramesHead)
{
//判断需要读取的长度
if ((this.NowReceiveDataIndex + this.CANDL - 1) > this.ReceivePackageSize)
{
readDataLen = this.ReceivePackageSize - this.NowReceiveDataIndex;
}
else
{
readDataLen = this.CANDL - 1;
}
Array.Copy(data, 1, this.ReceiveData, this.NowReceiveDataIndex, readDataLen);
this.NowReceiveDataIndex += readDataLen;
//判断接收一个包是否完成
if (this.NowReceiveDataIndex == this.ReceivePackageSize)
{
//方便字符串截取
this.ReceiveData[this.ReceivePackageSize] = 0;
//触发事件
this.ReceivedPackageInvoke();
}
ret = 0;
}
else
{
ret = 1;
}
return ret;
}
//插入接收数据解析
//在接收到数据时使用 传入一帧的数据 完成一包的接收后触发事件
override public int InsertReceiveData(UInt32 id, byte[] data)
{
int ret = 0;
if (id != this.CANPhyDevTxId)
{
return 1;
}
//取出帧类型
UDSFrameType frameType = (UDSFrameType)((uint)data[0] >> 4);
//判断帧类型
switch (frameType)
{
case UDSFrameType.SingleFrame://收到单帧
InsertSingleFrameData(data);
break;
case UDSFrameType.FirstFrame://收到首帧
InsertFirstFrameData(data);
break;
case UDSFrameType.ConsecutiveFrames://收到连续帧
ret = InsertConsecutiveFramesData(data);
break;
case UDSFrameType.FlowControlFrame://收到流控帧
//发送连续帧
this.SendConsecutiveFrames();
break;
default:
ret = 1;
break;
}
return ret;
}
}
}

View File

@ -0,0 +1,220 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace CanTool
{
enum UpdateReplyStatus
{
OK, //肯定回复
NoReply, //未回复
ContinueSend, //继续发送
}
delegate void ISeedToIOKeyArrayFunc(byte[] iSeedArray, out byte[] ioKeyArray, int level);
delegate void UpdateSendFunc();
delegate UpdateReplyStatus UpdateReplyFunc(byte[] data, UInt32 len);
struct UpdateStepItem
{
public UpdateSendFunc SendFunc;
public UpdateReplyFunc ReplyFunc;
public UpdateStepItem(UpdateSendFunc sendFunc, UpdateReplyFunc replyFunc)
{
SendFunc = sendFunc;
ReplyFunc = replyFunc;
}
}
class UpdateConfigParams
{
static public bool IsUpdate;//是否在升级中
static public int UpdateStepNum;//升级的步骤
static public bool UpdateSendCmdFlag; //升级中要发送数据
public UInt32 CANPhyDevRxId; //物理寻址ID PCAN发送 HUD接收
public UInt32 CANFuncDevRxId; //功能寻址ID PCAN发送 HUD接收
public UInt32 CANPhyDevTxId; //HUD响应ID PCAN接收 HUD发送
public byte[] FlashCheckMemoryParams = new byte[2];/*启动FLASH校验例程*/
public byte[] AppCheckMemoryParams = new byte[2];/*启动APP校验例程*/
public byte[] CheckProgramCondParams = new byte[2];/*编程预条件检查*/
public byte[] EraseMemoryParams = new byte[2];/*启动擦除内存*/
public byte[] CheckCompatibilityParams = new byte[2];/*逻辑块依赖性检查*/
public byte RequestSeedL1; //请求种子 1级
public byte SendKeyL1; //发送密钥 1级
public byte RequestSeedL2; //请求种子 2级
public byte SendKeyL2; //发送密钥 2级
public byte RequestSeedL3; //请求种子 3级
public byte SendKeyL3; //发送密钥 3级
public byte RequestSeedL4; //请求种子 4级
public byte SendKeyL4; //发送密钥 4级
public byte[] WriteFingerprintDID = new byte[2]; //写入指纹DID
//加密算法委托
public ISeedToIOKeyArrayFunc ISeedToIOKeyArray;
public UpdateStepItem[] UpdateStepItemArray;
public uint FlashDriveUpdateStartAddr; //flashdriver起始地址
public uint UIFlashDriveUpdateStartAddr; //UI的flashdriver起始地址
public uint AppUpdateStartAddr; //APP起始地址
public uint UIUpdateStartAddr; //UI起始地址
public uint RectifyStartAddr; //矫正参数的起始地址
//37 服务是否需要CRC校验
public bool IsUpdateDataCRC;
public bool CrcIsLsb;
//FlashDrive文件开头偏移 去掉头的信息
public int FlashDriveFileOffset;
//App文件开头偏移 去掉头的信息
public int AppFileOffset;
//UI文件开头偏移 去掉头的信息
public int UIFileOffset;
//矫正文件开头偏移 去掉头的信息
public int RectifyFileOffset;
//UDS最大一个包的数量 单位
public int UDSMsgLengthMax;
//构造函数
public UpdateConfigParams()
{
}
//拷贝函数
public void CopyFrom(UpdateConfigParams Params)
{
this.CANFuncDevRxId = Params.CANFuncDevRxId;
this.CANPhyDevRxId = Params.CANPhyDevRxId;
this.CANPhyDevTxId = Params.CANPhyDevTxId;
this.RequestSeedL1 = Params.RequestSeedL1;
this.SendKeyL1 = Params.SendKeyL1;
this.RequestSeedL2 = Params.RequestSeedL2;
this.SendKeyL2 = Params.SendKeyL2;
Params.FlashCheckMemoryParams.CopyTo(this.FlashCheckMemoryParams, 0);
Params.AppCheckMemoryParams.CopyTo(this.AppCheckMemoryParams, 0);
Params.CheckProgramCondParams.CopyTo(this.CheckProgramCondParams, 0);
Params.EraseMemoryParams.CopyTo(this.EraseMemoryParams, 0);
Params.CheckCompatibilityParams.CopyTo(this.CheckCompatibilityParams, 0);
this.ISeedToIOKeyArray = Params.ISeedToIOKeyArray;
this.UpdateStepItemArray = Params.UpdateStepItemArray;
this.FlashDriveUpdateStartAddr = Params.FlashDriveUpdateStartAddr;
this.UIFlashDriveUpdateStartAddr = Params.UIFlashDriveUpdateStartAddr;
this.AppUpdateStartAddr = Params.AppUpdateStartAddr;
this.UIUpdateStartAddr = Params.UIUpdateStartAddr;
this.RectifyStartAddr = Params.RectifyStartAddr;
this.IsUpdateDataCRC = Params.IsUpdateDataCRC;
this.CrcIsLsb = Params.CrcIsLsb;
this.FlashDriveFileOffset = Params.FlashDriveFileOffset;
this.AppFileOffset = Params.AppFileOffset;
this.UIFileOffset = Params.UIFileOffset;
this.RectifyFileOffset = Params.RectifyFileOffset;
this.UDSMsgLengthMax = Params.UDSMsgLengthMax;
}
public void UpdateSendLoop()
{
UpdateSendFunc sendFunc;
UpdateReplyFunc replyFunc;
if ((IsUpdate)
&& (UpdateSendCmdFlag)
)
{
sendFunc = UpdateStepItemArray[UpdateStepNum].SendFunc;
replyFunc = UpdateStepItemArray[UpdateStepNum].ReplyFunc;
if (sendFunc != null)
{
sendFunc();
}
//无需等待回复 直接到下一步
if (replyFunc == null)
{
UpdateStepNum++;
}
else
{
UpdateSendCmdFlag = false;
}
}
}
public void UpdateReply(byte[] data, UInt32 len)
{
UpdateReplyFunc replyFunc;
UpdateReplyStatus replyStatus;
if (IsUpdate)
{
replyFunc = UpdateStepItemArray[UpdateStepNum].ReplyFunc;
if (replyFunc != null)
{
replyStatus = replyFunc(data, len);
if (replyStatus == UpdateReplyStatus.OK)
{
++UpdateStepNum;
UpdateSendCmdFlag = true;
}
else if (replyStatus == UpdateReplyStatus.ContinueSend)
{
UpdateSendCmdFlag = true;
}
else if (replyStatus == UpdateReplyStatus.NoReply)
{
}
else
{
}
}
}
}
}
}

View File

@ -0,0 +1,21 @@
<?xml version="1.0" encoding="utf-8"?>
<asmv1:assembly xsi:schemaLocation="urn:schemas-microsoft-com:asm.v1 assembly.adaptive.xsd" manifestVersion="1.0" xmlns:asmv1="urn:schemas-microsoft-com:asm.v1" xmlns="urn:schemas-microsoft-com:asm.v2" xmlns:asmv2="urn:schemas-microsoft-com:asm.v2" xmlns:xrml="urn:mpeg:mpeg21:2003:01-REL-R-NS" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:asmv3="urn:schemas-microsoft-com:asm.v3" xmlns:dsig="http://www.w3.org/2000/09/xmldsig#" xmlns:co.v1="urn:schemas-microsoft-com:clickonce.v1" xmlns:co.v2="urn:schemas-microsoft-com:clickonce.v2">
<assemblyIdentity name="CanTool.application" version="1.0.0.1" publicKeyToken="0000000000000000" language="neutral" processorArchitecture="msil" xmlns="urn:schemas-microsoft-com:asm.v1" />
<description asmv2:publisher="Microsoft" asmv2:product="CanTool" xmlns="urn:schemas-microsoft-com:asm.v1" />
<deployment install="true" mapFileExtensions="true" />
<compatibleFrameworks xmlns="urn:schemas-microsoft-com:clickonce.v2">
<framework targetVersion="4.8" profile="Full" supportedRuntime="4.0.30319" />
</compatibleFrameworks>
<dependency>
<dependentAssembly dependencyType="install" codebase="CanTool.exe.manifest" size="4074">
<assemblyIdentity name="CanTool.exe" version="1.0.0.1" publicKeyToken="0000000000000000" language="neutral" processorArchitecture="msil" type="win32" />
<hash>
<dsig:Transforms>
<dsig:Transform Algorithm="urn:schemas-microsoft-com:HashTransforms.Identity" />
</dsig:Transforms>
<dsig:DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha256" />
<dsig:DigestValue>Sy9ylKWrFbd9KeJ59V76jUWUp8FPTOdM4Tz0rdkSwp8=</dsig:DigestValue>
</hash>
</dependentAssembly>
</dependency>
</asmv1:assembly>

Binary file not shown.

View File

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.8"/>
</startup>
</configuration>

View File

@ -0,0 +1,77 @@
<?xml version="1.0" encoding="utf-8"?>
<asmv1:assembly xsi:schemaLocation="urn:schemas-microsoft-com:asm.v1 assembly.adaptive.xsd" manifestVersion="1.0" xmlns:asmv1="urn:schemas-microsoft-com:asm.v1" xmlns="urn:schemas-microsoft-com:asm.v2" xmlns:asmv2="urn:schemas-microsoft-com:asm.v2" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:co.v1="urn:schemas-microsoft-com:clickonce.v1" xmlns:asmv3="urn:schemas-microsoft-com:asm.v3" xmlns:dsig="http://www.w3.org/2000/09/xmldsig#" xmlns:co.v2="urn:schemas-microsoft-com:clickonce.v2">
<asmv1:assemblyIdentity name="CanTool.exe" version="1.0.0.1" publicKeyToken="0000000000000000" language="neutral" processorArchitecture="msil" type="win32" />
<application />
<entryPoint>
<assemblyIdentity name="CanTool" version="1.0.0.0" language="neutral" processorArchitecture="msil" />
<commandLine file="CanTool.exe" parameters="" />
</entryPoint>
<trustInfo>
<security>
<applicationRequestMinimum>
<PermissionSet Unrestricted="true" ID="Custom" SameSite="site" />
<defaultAssemblyRequest permissionSetReference="Custom" />
</applicationRequestMinimum>
<requestedPrivileges xmlns="urn:schemas-microsoft-com:asm.v3">
<!--
UAC 清单选项
如果要更改 Windows 用户帐户控制级别,请用以下节点之一替换
requestedExecutionLevel 节点。
<requestedExecutionLevel level="asInvoker" uiAccess="false" />
<requestedExecutionLevel level="requireAdministrator" uiAccess="false" />
<requestedExecutionLevel level="highestAvailable" uiAccess="false" />
如果要利用文件和注册表虚拟化提供
向后兼容性,请删除 requestedExecutionLevel 节点。
-->
<requestedExecutionLevel level="asInvoker" uiAccess="false" />
</requestedPrivileges>
</security>
</trustInfo>
<dependency>
<dependentOS>
<osVersionInfo>
<os majorVersion="5" minorVersion="1" buildNumber="2600" servicePackMajor="0" />
</osVersionInfo>
</dependentOS>
</dependency>
<dependency>
<dependentAssembly dependencyType="preRequisite" allowDelayedBinding="true">
<assemblyIdentity name="Microsoft.Windows.CommonLanguageRuntime" version="4.0.30319.0" />
</dependentAssembly>
</dependency>
<dependency>
<dependentAssembly dependencyType="install" allowDelayedBinding="true" codebase="CanTool.exe" size="117248">
<assemblyIdentity name="CanTool" version="1.0.0.0" language="neutral" processorArchitecture="msil" />
<hash>
<dsig:Transforms>
<dsig:Transform Algorithm="urn:schemas-microsoft-com:HashTransforms.Identity" />
</dsig:Transforms>
<dsig:DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha256" />
<dsig:DigestValue>OxFesbJMFlyYsuPilhufcJBAg7CkGd6jmC8a2FjUL5k=</dsig:DigestValue>
</hash>
</dependentAssembly>
</dependency>
<dependency>
<dependentAssembly dependencyType="install" allowDelayedBinding="true" codebase="Interop.TSMasterAPI.dll" size="37888">
<assemblyIdentity name="Interop.TSMasterAPI" version="1.0.0.0" language="neutral" processorArchitecture="msil" />
<hash>
<dsig:Transforms>
<dsig:Transform Algorithm="urn:schemas-microsoft-com:HashTransforms.Identity" />
</dsig:Transforms>
<dsig:DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha256" />
<dsig:DigestValue>AaNDHl0yvTBa3tYB17+6REdC4ZioiH0LH0ZGOHnvQ/w=</dsig:DigestValue>
</hash>
</dependentAssembly>
</dependency>
<file name="CanTool.exe.config" size="184">
<hash>
<dsig:Transforms>
<dsig:Transform Algorithm="urn:schemas-microsoft-com:HashTransforms.Identity" />
</dsig:Transforms>
<dsig:DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha256" />
<dsig:DigestValue>FihlZtVNgcNyH37Pf0Jtll3jZOm+L55ijXNjtoS2/mo=</dsig:DigestValue>
</hash>
</file>
</asmv1:assembly>

Binary file not shown.

View File

@ -0,0 +1,21 @@
<?xml version="1.0" encoding="utf-8"?>
<asmv1:assembly xsi:schemaLocation="urn:schemas-microsoft-com:asm.v1 assembly.adaptive.xsd" manifestVersion="1.0" xmlns:asmv1="urn:schemas-microsoft-com:asm.v1" xmlns="urn:schemas-microsoft-com:asm.v2" xmlns:asmv2="urn:schemas-microsoft-com:asm.v2" xmlns:xrml="urn:mpeg:mpeg21:2003:01-REL-R-NS" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:asmv3="urn:schemas-microsoft-com:asm.v3" xmlns:dsig="http://www.w3.org/2000/09/xmldsig#" xmlns:co.v1="urn:schemas-microsoft-com:clickonce.v1" xmlns:co.v2="urn:schemas-microsoft-com:clickonce.v2">
<assemblyIdentity name="CanTool.application" version="1.0.0.1" publicKeyToken="0000000000000000" language="neutral" processorArchitecture="msil" xmlns="urn:schemas-microsoft-com:asm.v1" />
<description asmv2:publisher="CanTool" asmv2:product="CanTool" xmlns="urn:schemas-microsoft-com:asm.v1" />
<deployment install="true" mapFileExtensions="true" />
<compatibleFrameworks xmlns="urn:schemas-microsoft-com:clickonce.v2">
<framework targetVersion="4.5" profile="Full" supportedRuntime="4.0.30319" />
</compatibleFrameworks>
<dependency>
<dependentAssembly dependencyType="install" codebase="CanTool.exe.manifest" size="4074">
<assemblyIdentity name="CanTool.exe" version="1.0.0.1" publicKeyToken="0000000000000000" language="neutral" processorArchitecture="msil" type="win32" />
<hash>
<dsig:Transforms>
<dsig:Transform Algorithm="urn:schemas-microsoft-com:HashTransforms.Identity" />
</dsig:Transforms>
<dsig:DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha256" />
<dsig:DigestValue>opbIGH9ZUQFYAzM67Tf6wzsa48Q+BizjOgigv/PIh74=</dsig:DigestValue>
</hash>
</dependentAssembly>
</dependency>
</asmv1:assembly>

Binary file not shown.

View File

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5" />
</startup>
</configuration>

View File

@ -0,0 +1,77 @@
<?xml version="1.0" encoding="utf-8"?>
<asmv1:assembly xsi:schemaLocation="urn:schemas-microsoft-com:asm.v1 assembly.adaptive.xsd" manifestVersion="1.0" xmlns:asmv1="urn:schemas-microsoft-com:asm.v1" xmlns="urn:schemas-microsoft-com:asm.v2" xmlns:asmv2="urn:schemas-microsoft-com:asm.v2" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:co.v1="urn:schemas-microsoft-com:clickonce.v1" xmlns:asmv3="urn:schemas-microsoft-com:asm.v3" xmlns:dsig="http://www.w3.org/2000/09/xmldsig#" xmlns:co.v2="urn:schemas-microsoft-com:clickonce.v2">
<asmv1:assemblyIdentity name="CanTool.exe" version="1.0.0.1" publicKeyToken="0000000000000000" language="neutral" processorArchitecture="msil" type="win32" />
<application />
<entryPoint>
<assemblyIdentity name="CanTool" version="1.0.0.0" language="neutral" processorArchitecture="msil" />
<commandLine file="CanTool.exe" parameters="" />
</entryPoint>
<trustInfo>
<security>
<applicationRequestMinimum>
<PermissionSet Unrestricted="true" ID="Custom" SameSite="site" />
<defaultAssemblyRequest permissionSetReference="Custom" />
</applicationRequestMinimum>
<requestedPrivileges xmlns="urn:schemas-microsoft-com:asm.v3">
<!--
UAC 清单选项
如果要更改 Windows 用户帐户控制级别,请用以下节点之一替换
requestedExecutionLevel 节点。
<requestedExecutionLevel level="asInvoker" uiAccess="false" />
<requestedExecutionLevel level="requireAdministrator" uiAccess="false" />
<requestedExecutionLevel level="highestAvailable" uiAccess="false" />
如果要利用文件和注册表虚拟化提供
向后兼容性,请删除 requestedExecutionLevel 节点。
-->
<requestedExecutionLevel level="asInvoker" uiAccess="false" />
</requestedPrivileges>
</security>
</trustInfo>
<dependency>
<dependentOS>
<osVersionInfo>
<os majorVersion="5" minorVersion="1" buildNumber="2600" servicePackMajor="0" />
</osVersionInfo>
</dependentOS>
</dependency>
<dependency>
<dependentAssembly dependencyType="preRequisite" allowDelayedBinding="true">
<assemblyIdentity name="Microsoft.Windows.CommonLanguageRuntime" version="4.0.30319.0" />
</dependentAssembly>
</dependency>
<dependency>
<dependentAssembly dependencyType="install" allowDelayedBinding="true" codebase="CanTool.exe" size="168448">
<assemblyIdentity name="CanTool" version="1.0.0.0" language="neutral" processorArchitecture="msil" />
<hash>
<dsig:Transforms>
<dsig:Transform Algorithm="urn:schemas-microsoft-com:HashTransforms.Identity" />
</dsig:Transforms>
<dsig:DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha256" />
<dsig:DigestValue>ak8GQSYc7yTmAnE7dzjn07mtaitP5H5/x8UfrDrPImE=</dsig:DigestValue>
</hash>
</dependentAssembly>
</dependency>
<dependency>
<dependentAssembly dependencyType="install" allowDelayedBinding="true" codebase="Interop.TSMasterAPI.dll" size="37888">
<assemblyIdentity name="Interop.TSMasterAPI" version="1.0.0.0" language="neutral" processorArchitecture="msil" />
<hash>
<dsig:Transforms>
<dsig:Transform Algorithm="urn:schemas-microsoft-com:HashTransforms.Identity" />
</dsig:Transforms>
<dsig:DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha256" />
<dsig:DigestValue>AaNDHl0yvTBa3tYB17+6REdC4ZioiH0LH0ZGOHnvQ/w=</dsig:DigestValue>
</hash>
</dependentAssembly>
</dependency>
<file name="CanTool.exe.config" size="187">
<hash>
<dsig:Transforms>
<dsig:Transform Algorithm="urn:schemas-microsoft-com:HashTransforms.Identity" />
</dsig:Transforms>
<dsig:DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha256" />
<dsig:DigestValue>xm4bo26HQ0LNVwz1vdPYtzhkpMnp2AI5i+f0b+OahTI=</dsig:DigestValue>
</hash>
</file>
</asmv1:assembly>

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -0,0 +1,66 @@
:020000040802F0
:20380000485230315F4150502020202020202020AA55AA55AA55AA55AA55AA55AA55AA5575
:20382000AA55AA55AA55AA55AA55AA55AA55AA55AA55AA55AA55AA55AA55AA55AA55AA5598
:20384000AA55AA55AA55AA55AA55AA55AA55AA55AA55AA55AA55AA55AA55AA55AA55AA5578
:20386000AA55AA55AA55AA55AA55AA55AA55AA55AA55AA55AA55AA55AA55AA55AA55AA5558
:20388000AA55AA55AA55AA55AA55AA55AA55AA55AA55AA55AA55AA55AA55AA55AA55AA5538
:2038A000AA55AA55AA55AA55AA55AA55AA55AA55AA55AA55AA55AA55AA55AA55AA55AA5518
:2038C000AA55AA55AA55AA55AA55AA55AA55AA55AA55AA55AA55AA55AA55AA55AA55AA55F8
:2038E000AA55AA55AA55AA55AA55AA55AA55AA55AA55AA55AA55AA55AA55AA55AA55AA55D8
:20390000AA55AA55AA55AA55AA55AA55AA55AA55AA55AA55AA55AA55AA55AA55AA55AA55B7
:20392000AA55AA55AA55AA55AA55AA55AA55AA55AA55AA55AA55AA55AA55AA55AA55AA5597
:20394000AA55AA55AA55AA55AA55AA55AA55AA55AA55AA55AA55AA55AA55AA55AA55AA5577
:20396000AA55AA55AA55AA55AA55AA55AA55AA55AA55AA55AA55AA55AA55AA55AA55AA5557
:20398000AA55AA55AA55AA55AA55AA55AA55AA55AA55AA55AA55AA55AA55AA55AA55AA5537
:2039A000AA55AA55AA55AA55AA55AA55AA55AA55AA55AA55AA55AA55AA55AA55AA55AA5517
:2039C000AA55AA55AA55AA55AA55AA55AA55AA55AA55AA55AA55AA55AA55AA55AA55AA55F7
:2039E000AA55AA55AA55AA55AA55AA55AA55AA55AA55AA55AA55AA55AA55AA55AA55AA55D7
:203A0000AA55AA55AA55AA55AA55AA55AA55AA55AA55AA55AA55AA55AA55AA55AA55AA55B6
:203A2000AA55AA55AA55AA55AA55AA55AA55AA55AA55AA55AA55AA55AA55AA55AA55AA5596
:203A4000AA55AA55AA55AA55AA55AA55AA55AA55AA55AA55AA55AA55AA55AA55AA55AA5576
:203A6000AA55AA55AA55AA55AA55AA55AA55AA55AA55AA55AA55AA55AA55AA55AA55AA5556
:203A8000AA55AA55AA55AA55AA55AA55AA55AA55AA55AA55AA55AA55AA55AA55AA55AA5536
:203AA000AA55AA55AA55AA55AA55AA55AA55AA55AA55AA55AA55AA55AA55AA55AA55AA5516
:203AC000AA55AA55AA55AA55AA55AA55AA55AA55AA55AA55AA55AA55AA55AA55AA55AA55F6
:203AE000AA55AA55AA55AA55AA55AA55AA55AA55AA55AA55AA55AA55AA55AA55AA55AA55D6
:203B0000AA55AA55AA55AA55AA55AA55AA55AA55AA55AA55AA55AA55AA55AA55AA55AA55B5
:203B2000AA55AA55AA55AA55AA55AA55AA55AA55AA55AA55AA55AA55AA55AA55AA55AA5595
:203B4000AA55AA55AA55AA55AA55AA55AA55AA55AA55AA55AA55AA55AA55AA55AA55AA5575
:203B6000AA55AA55AA55AA55AA55AA55AA55AA55AA55AA55AA55AA55AA55AA55AA55AA5555
:203B8000AA55AA55AA55AA55AA55AA55AA55AA55AA55AA55AA55AA55AA55AA55AA55AA5535
:203BA000AA55AA55AA55AA55AA55AA55AA55AA55AA55AA55AA55AA55AA55AA55AA55AA5515
:203BC000AA55AA55AA55AA55AA55AA55AA55AA55AA55AA55AA55AA55AA55AA55AA55AA55F5
:203BE000AA55AA55AA55AA55AA55AA55AA55AA55AA55AA55AA55AA55AA55AA55AA55AA55D5
:203C0000AA55AA55AA55AA55AA55AA55AA55AA55AA55AA55AA55AA55AA55AA55AA55AA55B4
:203C2000AA55AA55AA55AA55AA55AA55AA55AA55AA55AA55AA55AA55AA55AA55AA55AA5594
:203C4000AA55AA55AA55AA55AA55AA55AA55AA55AA55AA55AA55AA55AA55AA55AA55AA5574
:203C6000AA55AA55AA55AA55AA55AA55AA55AA55AA55AA55AA55AA55AA55AA55AA55AA5554
:203C8000AA55AA55AA55AA55AA55AA55AA55AA55AA55AA55AA55AA55AA55AA55AA55AA5534
:203CA000AA55AA55AA55AA55AA55AA55AA55AA55AA55AA55AA55AA55AA55AA55AA55AA5514
:203CC000AA55AA55AA55AA55AA55AA55AA55AA55AA55AA55AA55AA55AA55AA55AA55AA55F4
:203CE000AA55AA55AA55AA55AA55AA55AA55AA55AA55AA55AA55AA55AA55AA55AA55AA55D4
:203D0000AA55AA55AA55AA55AA55AA55AA55AA55AA55AA55AA55AA55AA55AA55AA55AA55B3
:203D2000AA55AA55AA55AA55AA55AA55AA55AA55AA55AA55AA55AA55AA55AA55AA55AA5593
:203D4000AA55AA55AA55AA55AA55AA55AA55AA55AA55AA55AA55AA55AA55AA55AA55AA5573
:203D6000AA55AA55AA55AA55AA55AA55AA55AA55AA55AA55AA55AA55AA55AA55AA55AA5553
:203D8000AA55AA55AA55AA55AA55AA55AA55AA55AA55AA55AA55AA55AA55AA55AA55AA5533
:203DA000AA55AA55AA55AA55AA55AA55AA55AA55AA55AA55AA55AA55AA55AA55AA55AA5513
:203DC000AA55AA55AA55AA55AA55AA55AA55AA55AA55AA55AA55AA55AA55AA55AA55AA55F3
:203DE000AA55AA55AA55AA55AA55AA55AA55AA55AA55AA55AA55AA55AA55AA55AA55AA55D3
:203E0000AA55AA55AA55AA55AA55AA55AA55AA55AA55AA55AA55AA55AA55AA55AA55AA55B2
:203E2000AA55AA55AA55AA55AA55AA55AA55AA55AA55AA55AA55AA55AA55AA55AA55AA5592
:203E4000AA55AA55AA55AA55AA55AA55AA55AA55AA55AA55AA55AA55AA55AA55AA55AA5572
:203E6000AA55AA55AA55AA55AA55AA55AA55AA55AA55AA55AA55AA55AA55AA55AA55AA5552
:203E8000AA55AA55AA55AA55AA55AA55AA55AA55AA55AA55AA55AA55AA55AA55AA55AA5532
:203EA000AA55AA55AA55AA55AA55AA55AA55AA55AA55AA55AA55AA55AA55AA55AA55AA5512
:203EC000AA55AA55AA55AA55AA55AA55AA55AA55AA55AA55AA55AA55AA55AA55AA55AA55F2
:203EE000AA55AA55AA55AA55AA55AA55AA55AA55AA55AA55AA55AA55AA55AA55AA55AA55D2
:203F0000AA55AA55AA55AA55AA55AA55AA55AA55AA55AA55AA55AA55AA55AA55AA55AA55B1
:203F2000AA55AA55AA55AA55AA55AA55AA55AA55AA55AA55AA55AA55AA55AA55AA55AA5591
:203F4000AA55AA55AA55AA55AA55AA55AA55AA55AA55AA55AA55AA55AA55AA55AA55AA5571
:203F6000AA55AA55AA55AA55AA55AA55AA55AA55AA55AA55AA55AA55AA55AA55AA55AA5551
:203F8000AA55AA55AA55AA55AA55AA55AA55AA55AA55AA55AA55AA55AA55AA55AA55AA5531
:203FA000AA55AA55AA55AA55AA55AA55AA55AA55AA55AA55AA55AA55AA55AA55AA55AA5511
:203FC000AA55AA55AA55AA55AA55AA55AA55AA55AA55AA55AA55AA55AA55AA55AA55AA55F1
:203FE000AA55AA55AA55AA55AA55AA55AA55AA55AA55AA55AA55AA55AA55AA55AA55AA55D1
:00000001FF

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,29 @@
:020000042000DA
:10F0000039F1002057F10020F1F0002070B50546DD
:10F010004FF43026304600F059F8042811D1094C3D
:10F02000206940F0020020616561206940F04000E5
:10F030002061304600F04AF8216941F6FD72114026
:10F04000216170BD0020024008490420CA68D2072F
:10F0500001D001207047CA68520701D502207047CD
:10F06000C968C906FBD50320704700000020024094
:10F070000248016941F080010161704700200240AF
:10F08000F0B506464FF400570D46384600F01EF81E
:10F0900004280CD1064C206940F001002061358025
:10F0A000384600F013F82169BA1E11402161F0BD05
:10F0B0000020024003480249416003494160704713
:10F0C0002301674500200240AB89EFCD00B5034620
:10F0D000FFF7BAFF03E000BFFFF7B6FF5B1E012892
:10F0E00003D0002B00D1052000BD002BF4D1FAE79E
:10F0F000F0B50E4604004FF0000708D03EB172B6DE
:10F10000FFF7D8FF0B493520C86000250BE0012030
:10F11000F0BD2046FFF77AFF042801D0012704E064
:10F1200004F500646D1CB542F3D3FFF7A1FF62B68E
:10F130003846F0BD0020024030B50446002041B101
:10F140003AB1002302E0E55CCD545B1C9342FAD354
:10F1500030BD012030BD2DE9F0414FF000081546CB
:10F160000E460700444605D025B11EB172B6FFF722
:10F17000A1FF0FE00120BDE8F08106EB440001880B
:10F1800007EB4400FFF77CFF042802D04FF0010892
:10F1900003E0641CB4EB550FEFD3FFF769FF62B6D1
:04F1A0004046E8E716
:00000001FF

View File

@ -0,0 +1,28 @@
S3152000F00039F1002057F10020F1F0002070B50546B7
S3152000F0104FF43026304600F059F8042811D1094C17
S3152000F020206940F0020020616561206940F04000BF
S3152000F0302061304600F04AF8216941F6FD72114000
S3152000F040216170BD0020024008490420CA68D20709
S3152000F05001D001207047CA68520701D502207047A7
S3152000F060C968C906FBD5032070470000002002406E
S3152000F0700248016941F08001016170470020024089
S3152000F080F0B506464FF400570D46384600F01EF8F8
S3152000F09004280CD1064C206940F0010020613580FF
S3152000F0A0384600F013F82169BA1E11402161F0BDDF
S3152000F0B000200240034802494160034941607047ED
S3152000F0C02301674500200240AB89EFCD00B50346FA
S3152000F0D0FFF7BAFF03E000BFFFF7B6FF5B1E01286C
S3152000F0E003D0002B00D1052000BD002BF4D1FAE778
S3152000F0F0F0B50E4604004FF0000708D03EB172B6B8
S3152000F100FFF7D8FF0B493520C86000250BE001200A
S3152000F110F0BD2046FFF77AFF042801D0012704E03E
S3152000F12004F500646D1CB542F3D3FFF7A1FF62B668
S3152000F1303846F0BD0020024030B50446002041B1DB
S3152000F1403AB1002302E0E55CCD545B1C9342FAD32E
S3152000F15030BD012030BD2DE9F0414FF000081546A5
S3152000F1600E460700444605D025B11EB172B6FFF7FC
S3152000F170A1FF0FE00120BDE8F08106EB44000188E5
S3152000F18007EB4400FFF77CFF042802D04FF001086C
S3152000F19003E0641CB4EB550FEFD3FFF769FF62B6AB
S3092000F1A04046E8E7F0
S70500000000FA

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,4 @@
// <autogenerated />
using System;
using System.Reflection;
[assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")]

Binary file not shown.

View File

@ -0,0 +1,21 @@
<?xml version="1.0" encoding="utf-8"?>
<asmv1:assembly xsi:schemaLocation="urn:schemas-microsoft-com:asm.v1 assembly.adaptive.xsd" manifestVersion="1.0" xmlns:asmv1="urn:schemas-microsoft-com:asm.v1" xmlns="urn:schemas-microsoft-com:asm.v2" xmlns:asmv2="urn:schemas-microsoft-com:asm.v2" xmlns:xrml="urn:mpeg:mpeg21:2003:01-REL-R-NS" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:asmv3="urn:schemas-microsoft-com:asm.v3" xmlns:dsig="http://www.w3.org/2000/09/xmldsig#" xmlns:co.v1="urn:schemas-microsoft-com:clickonce.v1" xmlns:co.v2="urn:schemas-microsoft-com:clickonce.v2">
<assemblyIdentity name="CanTool.application" version="1.0.0.1" publicKeyToken="0000000000000000" language="neutral" processorArchitecture="msil" xmlns="urn:schemas-microsoft-com:asm.v1" />
<description asmv2:publisher="Microsoft" asmv2:product="CanTool" xmlns="urn:schemas-microsoft-com:asm.v1" />
<deployment install="true" mapFileExtensions="true" />
<compatibleFrameworks xmlns="urn:schemas-microsoft-com:clickonce.v2">
<framework targetVersion="4.8" profile="Full" supportedRuntime="4.0.30319" />
</compatibleFrameworks>
<dependency>
<dependentAssembly dependencyType="install" codebase="CanTool.exe.manifest" size="4074">
<assemblyIdentity name="CanTool.exe" version="1.0.0.1" publicKeyToken="0000000000000000" language="neutral" processorArchitecture="msil" type="win32" />
<hash>
<dsig:Transforms>
<dsig:Transform Algorithm="urn:schemas-microsoft-com:HashTransforms.Identity" />
</dsig:Transforms>
<dsig:DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha256" />
<dsig:DigestValue>Sy9ylKWrFbd9KeJ59V76jUWUp8FPTOdM4Tz0rdkSwp8=</dsig:DigestValue>
</hash>
</dependentAssembly>
</dependency>
</asmv1:assembly>

Binary file not shown.

View File

@ -0,0 +1,77 @@
<?xml version="1.0" encoding="utf-8"?>
<asmv1:assembly xsi:schemaLocation="urn:schemas-microsoft-com:asm.v1 assembly.adaptive.xsd" manifestVersion="1.0" xmlns:asmv1="urn:schemas-microsoft-com:asm.v1" xmlns="urn:schemas-microsoft-com:asm.v2" xmlns:asmv2="urn:schemas-microsoft-com:asm.v2" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:co.v1="urn:schemas-microsoft-com:clickonce.v1" xmlns:asmv3="urn:schemas-microsoft-com:asm.v3" xmlns:dsig="http://www.w3.org/2000/09/xmldsig#" xmlns:co.v2="urn:schemas-microsoft-com:clickonce.v2">
<asmv1:assemblyIdentity name="CanTool.exe" version="1.0.0.1" publicKeyToken="0000000000000000" language="neutral" processorArchitecture="msil" type="win32" />
<application />
<entryPoint>
<assemblyIdentity name="CanTool" version="1.0.0.0" language="neutral" processorArchitecture="msil" />
<commandLine file="CanTool.exe" parameters="" />
</entryPoint>
<trustInfo>
<security>
<applicationRequestMinimum>
<PermissionSet Unrestricted="true" ID="Custom" SameSite="site" />
<defaultAssemblyRequest permissionSetReference="Custom" />
</applicationRequestMinimum>
<requestedPrivileges xmlns="urn:schemas-microsoft-com:asm.v3">
<!--
UAC 清单选项
如果要更改 Windows 用户帐户控制级别,请用以下节点之一替换
requestedExecutionLevel 节点。
<requestedExecutionLevel level="asInvoker" uiAccess="false" />
<requestedExecutionLevel level="requireAdministrator" uiAccess="false" />
<requestedExecutionLevel level="highestAvailable" uiAccess="false" />
如果要利用文件和注册表虚拟化提供
向后兼容性,请删除 requestedExecutionLevel 节点。
-->
<requestedExecutionLevel level="asInvoker" uiAccess="false" />
</requestedPrivileges>
</security>
</trustInfo>
<dependency>
<dependentOS>
<osVersionInfo>
<os majorVersion="5" minorVersion="1" buildNumber="2600" servicePackMajor="0" />
</osVersionInfo>
</dependentOS>
</dependency>
<dependency>
<dependentAssembly dependencyType="preRequisite" allowDelayedBinding="true">
<assemblyIdentity name="Microsoft.Windows.CommonLanguageRuntime" version="4.0.30319.0" />
</dependentAssembly>
</dependency>
<dependency>
<dependentAssembly dependencyType="install" allowDelayedBinding="true" codebase="CanTool.exe" size="117248">
<assemblyIdentity name="CanTool" version="1.0.0.0" language="neutral" processorArchitecture="msil" />
<hash>
<dsig:Transforms>
<dsig:Transform Algorithm="urn:schemas-microsoft-com:HashTransforms.Identity" />
</dsig:Transforms>
<dsig:DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha256" />
<dsig:DigestValue>OxFesbJMFlyYsuPilhufcJBAg7CkGd6jmC8a2FjUL5k=</dsig:DigestValue>
</hash>
</dependentAssembly>
</dependency>
<dependency>
<dependentAssembly dependencyType="install" allowDelayedBinding="true" codebase="Interop.TSMasterAPI.dll" size="37888">
<assemblyIdentity name="Interop.TSMasterAPI" version="1.0.0.0" language="neutral" processorArchitecture="msil" />
<hash>
<dsig:Transforms>
<dsig:Transform Algorithm="urn:schemas-microsoft-com:HashTransforms.Identity" />
</dsig:Transforms>
<dsig:DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha256" />
<dsig:DigestValue>AaNDHl0yvTBa3tYB17+6REdC4ZioiH0LH0ZGOHnvQ/w=</dsig:DigestValue>
</hash>
</dependentAssembly>
</dependency>
<file name="CanTool.exe.config" size="184">
<hash>
<dsig:Transforms>
<dsig:Transform Algorithm="urn:schemas-microsoft-com:HashTransforms.Identity" />
</dsig:Transforms>
<dsig:DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha256" />
<dsig:DigestValue>FihlZtVNgcNyH37Pf0Jtll3jZOm+L55ijXNjtoS2/mo=</dsig:DigestValue>
</hash>
</file>
</asmv1:assembly>

Binary file not shown.

Binary file not shown.

View File

@ -0,0 +1 @@
de7bf1db613257b0cb89efa5a9577d1dda72ec4e6ffa7df7818c520682bb55c0

View File

@ -0,0 +1,32 @@
E:\liudagui\project\HONGRI\code\dev\uds_tools\CAN_Tool\obj\Debug\uds_tools.csproj.AssemblyReference.cache
E:\liudagui\project\HONGRI\code\dev\uds_tools\CAN_Tool\obj\Debug\CanTool.MessageConfigForm.resources
E:\liudagui\project\HONGRI\code\dev\uds_tools\CAN_Tool\obj\Debug\CanTool.uds_tools.resources
E:\liudagui\project\HONGRI\code\dev\uds_tools\CAN_Tool\obj\Debug\CanTool.Properties.Resources.resources
E:\liudagui\project\HONGRI\code\dev\uds_tools\CAN_Tool\obj\Debug\uds_tools.csproj.GenerateResource.cache
E:\liudagui\project\HONGRI\code\dev\uds_tools\CAN_Tool\obj\Debug\uds_tools.csproj.CoreCompileInputs.cache
E:\liudagui\project\HONGRI\code\dev\uds_tools\CAN_Tool\bin\Debug\CanTool.exe.config
E:\liudagui\project\HONGRI\code\dev\uds_tools\CAN_Tool\bin\Debug\CanTool.exe.manifest
E:\liudagui\project\HONGRI\code\dev\uds_tools\CAN_Tool\bin\Debug\CanTool.application
E:\liudagui\project\HONGRI\code\dev\uds_tools\CAN_Tool\bin\Debug\CanTool.exe
E:\liudagui\project\HONGRI\code\dev\uds_tools\CAN_Tool\bin\Debug\CanTool.pdb
E:\liudagui\project\HONGRI\code\dev\uds_tools\CAN_Tool\obj\Debug\CanTool.exe.manifest
E:\liudagui\project\HONGRI\code\dev\uds_tools\CAN_Tool\obj\Debug\CanTool.application
E:\liudagui\project\HONGRI\code\dev\uds_tools\CAN_Tool\obj\Debug\uds_tools.csproj.Up2Date
E:\liudagui\project\HONGRI\code\dev\uds_tools\CAN_Tool\obj\Debug\CanTool.exe
E:\liudagui\project\HONGRI\code\dev\uds_tools\CAN_Tool\obj\Debug\CanTool.pdb
E:\liudagui\project\HONGRI\code\git\uds_tools\CAN_Tool\bin\Debug\CanTool.exe.config
E:\liudagui\project\HONGRI\code\git\uds_tools\CAN_Tool\bin\Debug\CanTool.exe.manifest
E:\liudagui\project\HONGRI\code\git\uds_tools\CAN_Tool\bin\Debug\CanTool.application
E:\liudagui\project\HONGRI\code\git\uds_tools\CAN_Tool\bin\Debug\CanTool.exe
E:\liudagui\project\HONGRI\code\git\uds_tools\CAN_Tool\bin\Debug\CanTool.pdb
E:\liudagui\project\HONGRI\code\git\uds_tools\CAN_Tool\obj\Debug\uds_tools.csproj.AssemblyReference.cache
E:\liudagui\project\HONGRI\code\git\uds_tools\CAN_Tool\obj\Debug\CanTool.MessageConfigForm.resources
E:\liudagui\project\HONGRI\code\git\uds_tools\CAN_Tool\obj\Debug\CanTool.uds_tools.resources
E:\liudagui\project\HONGRI\code\git\uds_tools\CAN_Tool\obj\Debug\CanTool.Properties.Resources.resources
E:\liudagui\project\HONGRI\code\git\uds_tools\CAN_Tool\obj\Debug\uds_tools.csproj.GenerateResource.cache
E:\liudagui\project\HONGRI\code\git\uds_tools\CAN_Tool\obj\Debug\uds_tools.csproj.CoreCompileInputs.cache
E:\liudagui\project\HONGRI\code\git\uds_tools\CAN_Tool\obj\Debug\CanTool.exe.manifest
E:\liudagui\project\HONGRI\code\git\uds_tools\CAN_Tool\obj\Debug\CanTool.application
E:\liudagui\project\HONGRI\code\git\uds_tools\CAN_Tool\obj\Debug\uds_tools.csproj.Up2Date
E:\liudagui\project\HONGRI\code\git\uds_tools\CAN_Tool\obj\Debug\CanTool.exe
E:\liudagui\project\HONGRI\code\git\uds_tools\CAN_Tool\obj\Debug\CanTool.pdb

956
CAN_Tool/uds_tools.Designer.cs generated Normal file
View File

@ -0,0 +1,956 @@
namespace CanTool
{
partial class uds_tools
{
/// <summary>
/// 必需的设计器变量。
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// 清理所有正在使用的资源。
/// </summary>
/// <param name="disposing">如果应释放托管资源,为 true否则为 false。</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows
/// <summary>
/// 设计器支持所需的方法 - 不要
/// 使用代码编辑器修改此方法的内容。
/// </summary>
private void InitializeComponent()
{
this.components = new System.ComponentModel.Container();
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(uds_tools));
this.label1 = new System.Windows.Forms.Label();
this.cbbDeviceType = new System.Windows.Forms.ComboBox();
this.btnConnect = new System.Windows.Forms.Button();
this.timerReadMsg = new System.Windows.Forms.Timer(this.components);
this.timerUDS = new System.Windows.Forms.Timer(this.components);
this.cbbIdFilterSelect = new System.Windows.Forms.ComboBox();
this.label2 = new System.Windows.Forms.Label();
this.button1 = new System.Windows.Forms.Button();
this.btProgram = new System.Windows.Forms.Button();
this.btDefault = new System.Windows.Forms.Button();
this.btlev1 = new System.Windows.Forms.Button();
this.btlev2 = new System.Windows.Forms.Button();
this.timerSendMsg = new System.Windows.Forms.Timer(this.components);
this.btClrDial = new System.Windows.Forms.Button();
this.btComOff = new System.Windows.Forms.Button();
this.btComOn = new System.Windows.Forms.Button();
this.timerFlashMain = new System.Windows.Forms.Timer(this.components);
this.timer1s = new System.Windows.Forms.Timer(this.components);
this.groupBox4 = new System.Windows.Forms.GroupBox();
this.btnSecurityAccessLevel3 = new System.Windows.Forms.Button();
this.btnSecurityAccessLevel4 = new System.Windows.Forms.Button();
this.btnECUReset = new System.Windows.Forms.Button();
this.btnStartUpdataBoot = new System.Windows.Forms.Button();
this.btnResetSecurityKey = new System.Windows.Forms.Button();
this.btnRelease = new System.Windows.Forms.Button();
this.tabControl1 = new System.Windows.Forms.TabControl();
this.UpgradeFunctionTest = new System.Windows.Forms.TabPage();
this.label5 = new System.Windows.Forms.Label();
this.ckbIsCrcLsb = new System.Windows.Forms.CheckBox();
this.groupBox1 = new System.Windows.Forms.GroupBox();
this.rbtnUiSelect = new System.Windows.Forms.RadioButton();
this.rbtnAppSelect = new System.Windows.Forms.RadioButton();
this.txtUIUpdateFilePath = new System.Windows.Forms.TextBox();
this.btnUIUpdateFileSwitch = new System.Windows.Forms.Button();
this.textBoxTimeEscape = new System.Windows.Forms.TextBox();
this.label33 = new System.Windows.Forms.Label();
this.lbUpdateProgress = new System.Windows.Forms.Label();
this.btUpgrade = new System.Windows.Forms.Button();
this.progressBar1 = new System.Windows.Forms.ProgressBar();
this.textBoxApp = new System.Windows.Forms.TextBox();
this.textBoxFlash = new System.Windows.Forms.TextBox();
this.btAPP = new System.Windows.Forms.Button();
this.btFlashDriver = new System.Windows.Forms.Button();
this.ProductFunctionTest_1 = new System.Windows.Forms.TabPage();
this.selfDiagTabPage = new System.Windows.Forms.TabPage();
this.btVersionInfo = new System.Windows.Forms.Button();
this.cbbCarType = new System.Windows.Forms.ComboBox();
this.label35 = new System.Windows.Forms.Label();
this.txtIdFilterStrat = new System.Windows.Forms.TextBox();
this.txtIdFilterEnd = new System.Windows.Forms.TextBox();
this.ckbIsCanFd = new System.Windows.Forms.CheckBox();
this.ckbIsCycleReceive = new System.Windows.Forms.CheckBox();
this.ckbIsEventReceive = new System.Windows.Forms.CheckBox();
this.rtxtMessagesLog = new System.Windows.Forms.RichTextBox();
this.ctmsMessageLog = new System.Windows.Forms.ContextMenuStrip(this.components);
this.tsmiMessagesLogStop = new System.Windows.Forms.ToolStripMenuItem();
this.toolStripSeparator2 = new System.Windows.Forms.ToolStripSeparator();
this.tsmiMessagesLogClear = new System.Windows.Forms.ToolStripMenuItem();
this.toolStripSeparator1 = new System.Windows.Forms.ToolStripSeparator();
this.tsmiLookAllMessagesLog = new System.Windows.Forms.ToolStripMenuItem();
this.tsmiLookDiagMessagesLog = new System.Windows.Forms.ToolStripMenuItem();
this.tsmiLookAppMessagesLog = new System.Windows.Forms.ToolStripMenuItem();
this.toolStripSeparator3 = new System.Windows.Forms.ToolStripSeparator();
this.tsmiSaveMessagesLog = new System.Windows.Forms.ToolStripMenuItem();
this.rtxtLog = new System.Windows.Forms.RichTextBox();
this.ctmsLog = new System.Windows.Forms.ContextMenuStrip(this.components);
this.tsmiLogClear = new System.Windows.Forms.ToolStripMenuItem();
this.lsvSendMessagesTable = new System.Windows.Forms.ListView();
this.clhSendMessageId = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
this.clhSendMessageLen = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
this.clhSendMessageData = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
this.ctmsSendMessagesTable = new System.Windows.Forms.ContextMenuStrip(this.components);
this.tsmiAddMessage = new System.Windows.Forms.ToolStripMenuItem();
this.tsmiDeleteMessage = new System.Windows.Forms.ToolStripMenuItem();
this.tsmiEditMessage = new System.Windows.Forms.ToolStripMenuItem();
this.timer1 = new System.Windows.Forms.Timer(this.components);
this.timer2 = new System.Windows.Forms.Timer(this.components);
this.groupBox4.SuspendLayout();
this.tabControl1.SuspendLayout();
this.UpgradeFunctionTest.SuspendLayout();
this.groupBox1.SuspendLayout();
this.ProductFunctionTest_1.SuspendLayout();
this.ctmsMessageLog.SuspendLayout();
this.ctmsLog.SuspendLayout();
this.ctmsSendMessagesTable.SuspendLayout();
this.SuspendLayout();
//
// label1
//
this.label1.AutoSize = true;
this.label1.Location = new System.Drawing.Point(21, 17);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(65, 12);
this.label1.TabIndex = 33;
this.label1.Text = "选择设备:";
//
// cbbDeviceType
//
this.cbbDeviceType.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
this.cbbDeviceType.Font = new System.Drawing.Font("Consolas", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.cbbDeviceType.FormattingEnabled = true;
this.cbbDeviceType.Items.AddRange(new object[] {
"TOSUN",
"PCAN",
"GC_USBCAN_II",
"TOOMOSS"});
this.cbbDeviceType.Location = new System.Drawing.Point(23, 32);
this.cbbDeviceType.Name = "cbbDeviceType";
this.cbbDeviceType.Size = new System.Drawing.Size(114, 21);
this.cbbDeviceType.TabIndex = 34;
//
// btnConnect
//
this.btnConnect.Location = new System.Drawing.Point(269, 30);
this.btnConnect.Name = "btnConnect";
this.btnConnect.Size = new System.Drawing.Size(74, 23);
this.btnConnect.TabIndex = 36;
this.btnConnect.Text = "连接";
this.btnConnect.UseVisualStyleBackColor = true;
this.btnConnect.Click += new System.EventHandler(this.btnConnect_Click);
//
// timerReadMsg
//
this.timerReadMsg.Interval = 10;
this.timerReadMsg.Tick += new System.EventHandler(this.timerReadMsg_Tick);
//
// timerUDS
//
this.timerUDS.Interval = 2000;
this.timerUDS.Tick += new System.EventHandler(this.timerUDS_Tick);
//
// cbbIdFilterSelect
//
this.cbbIdFilterSelect.FormattingEnabled = true;
this.cbbIdFilterSelect.Items.AddRange(new object[] {
"暂停报文显示",
"查看诊断和应用报文",
"查看诊断报文",
"查看应用报文"});
this.cbbIdFilterSelect.Location = new System.Drawing.Point(650, 38);
this.cbbIdFilterSelect.Name = "cbbIdFilterSelect";
this.cbbIdFilterSelect.Size = new System.Drawing.Size(134, 20);
this.cbbIdFilterSelect.TabIndex = 43;
//
// label2
//
this.label2.AutoSize = true;
this.label2.Location = new System.Drawing.Point(567, 41);
this.label2.Name = "label2";
this.label2.Size = new System.Drawing.Size(89, 12);
this.label2.TabIndex = 38;
this.label2.Text = "报文过滤选项:";
//
// button1
//
this.button1.Location = new System.Drawing.Point(164, 19);
this.button1.Name = "button1";
this.button1.Size = new System.Drawing.Size(75, 23);
this.button1.TabIndex = 41;
this.button1.Text = "扩展会话";
this.button1.UseVisualStyleBackColor = true;
this.button1.Click += new System.EventHandler(this.btExtn_Click);
//
// btProgram
//
this.btProgram.Location = new System.Drawing.Point(83, 19);
this.btProgram.Name = "btProgram";
this.btProgram.Size = new System.Drawing.Size(75, 23);
this.btProgram.TabIndex = 41;
this.btProgram.Text = "编程会话";
this.btProgram.UseVisualStyleBackColor = true;
this.btProgram.Click += new System.EventHandler(this.btProgram_Click);
//
// btDefault
//
this.btDefault.Location = new System.Drawing.Point(4, 19);
this.btDefault.Name = "btDefault";
this.btDefault.Size = new System.Drawing.Size(75, 23);
this.btDefault.TabIndex = 41;
this.btDefault.Text = "默认会话";
this.btDefault.UseVisualStyleBackColor = true;
this.btDefault.Click += new System.EventHandler(this.btDefault_Click);
//
// btlev1
//
this.btlev1.Location = new System.Drawing.Point(4, 50);
this.btlev1.Name = "btlev1";
this.btlev1.Size = new System.Drawing.Size(65, 23);
this.btlev1.TabIndex = 45;
this.btlev1.Text = "一级解锁";
this.btlev1.UseVisualStyleBackColor = true;
this.btlev1.Click += new System.EventHandler(this.btlev1_Click);
//
// btlev2
//
this.btlev2.Location = new System.Drawing.Point(75, 50);
this.btlev2.Name = "btlev2";
this.btlev2.Size = new System.Drawing.Size(65, 23);
this.btlev2.TabIndex = 45;
this.btlev2.Text = "二级解锁";
this.btlev2.UseVisualStyleBackColor = true;
this.btlev2.Click += new System.EventHandler(this.btlev2_Click);
//
// timerSendMsg
//
this.timerSendMsg.Interval = 20;
this.timerSendMsg.Tick += new System.EventHandler(this.timerSendMsg_Tick);
//
// btClrDial
//
this.btClrDial.Location = new System.Drawing.Point(6, 115);
this.btClrDial.Name = "btClrDial";
this.btClrDial.Size = new System.Drawing.Size(75, 23);
this.btClrDial.TabIndex = 47;
this.btClrDial.Text = "清除故障码";
this.btClrDial.UseVisualStyleBackColor = true;
this.btClrDial.Click += new System.EventHandler(this.btClrDial_Click);
//
// btComOff
//
this.btComOff.Location = new System.Drawing.Point(4, 144);
this.btComOff.Name = "btComOff";
this.btComOff.Size = new System.Drawing.Size(151, 23);
this.btComOff.TabIndex = 47;
this.btComOff.Text = "失能应用报文发送和接收";
this.btComOff.UseVisualStyleBackColor = true;
this.btComOff.Click += new System.EventHandler(this.btComOff_Click);
//
// btComOn
//
this.btComOn.Location = new System.Drawing.Point(161, 144);
this.btComOn.Name = "btComOn";
this.btComOn.Size = new System.Drawing.Size(147, 23);
this.btComOn.TabIndex = 47;
this.btComOn.Text = "使能应用报文发送和接收";
this.btComOn.UseVisualStyleBackColor = true;
this.btComOn.Click += new System.EventHandler(this.btComOn_Click);
//
// timerFlashMain
//
this.timerFlashMain.Tick += new System.EventHandler(this.timer1Calib_Tick);
//
// timer1s
//
this.timer1s.Interval = 1000;
this.timer1s.Tick += new System.EventHandler(this.timer500ms_Tick);
//
// groupBox4
//
this.groupBox4.Controls.Add(this.btnSecurityAccessLevel3);
this.groupBox4.Controls.Add(this.btnSecurityAccessLevel4);
this.groupBox4.Controls.Add(this.btnECUReset);
this.groupBox4.Controls.Add(this.btnStartUpdataBoot);
this.groupBox4.Controls.Add(this.btnResetSecurityKey);
this.groupBox4.Controls.Add(this.btDefault);
this.groupBox4.Controls.Add(this.button1);
this.groupBox4.Controls.Add(this.btProgram);
this.groupBox4.Controls.Add(this.btlev1);
this.groupBox4.Controls.Add(this.btlev2);
this.groupBox4.Controls.Add(this.btClrDial);
this.groupBox4.Controls.Add(this.btComOff);
this.groupBox4.Controls.Add(this.btComOn);
this.groupBox4.Location = new System.Drawing.Point(206, 9);
this.groupBox4.Name = "groupBox4";
this.groupBox4.Size = new System.Drawing.Size(314, 173);
this.groupBox4.TabIndex = 59;
this.groupBox4.TabStop = false;
this.groupBox4.Text = "诊断操作";
//
// btnSecurityAccessLevel3
//
this.btnSecurityAccessLevel3.Location = new System.Drawing.Point(146, 50);
this.btnSecurityAccessLevel3.Name = "btnSecurityAccessLevel3";
this.btnSecurityAccessLevel3.Size = new System.Drawing.Size(65, 23);
this.btnSecurityAccessLevel3.TabIndex = 52;
this.btnSecurityAccessLevel3.Text = "三级解锁";
this.btnSecurityAccessLevel3.UseVisualStyleBackColor = true;
this.btnSecurityAccessLevel3.Click += new System.EventHandler(this.btnSecurityAccessLevel3_Click);
//
// btnSecurityAccessLevel4
//
this.btnSecurityAccessLevel4.Location = new System.Drawing.Point(217, 50);
this.btnSecurityAccessLevel4.Name = "btnSecurityAccessLevel4";
this.btnSecurityAccessLevel4.Size = new System.Drawing.Size(65, 23);
this.btnSecurityAccessLevel4.TabIndex = 51;
this.btnSecurityAccessLevel4.Text = "四级解锁";
this.btnSecurityAccessLevel4.UseVisualStyleBackColor = true;
this.btnSecurityAccessLevel4.Click += new System.EventHandler(this.btnSecurityAccessLevel4_Click);
//
// btnECUReset
//
this.btnECUReset.Location = new System.Drawing.Point(167, 115);
this.btnECUReset.Name = "btnECUReset";
this.btnECUReset.Size = new System.Drawing.Size(75, 23);
this.btnECUReset.TabIndex = 50;
this.btnECUReset.Text = "复位ECU";
this.btnECUReset.UseVisualStyleBackColor = true;
this.btnECUReset.Click += new System.EventHandler(this.btnECUReset_Click);
//
// btnStartUpdataBoot
//
this.btnStartUpdataBoot.Location = new System.Drawing.Point(86, 115);
this.btnStartUpdataBoot.Name = "btnStartUpdataBoot";
this.btnStartUpdataBoot.Size = new System.Drawing.Size(75, 23);
this.btnStartUpdataBoot.TabIndex = 49;
this.btnStartUpdataBoot.Text = "升级boot";
this.btnStartUpdataBoot.UseVisualStyleBackColor = true;
this.btnStartUpdataBoot.Click += new System.EventHandler(this.btnStartUpdataBoot_Click);
//
// btnResetSecurityKey
//
this.btnResetSecurityKey.Location = new System.Drawing.Point(6, 79);
this.btnResetSecurityKey.Name = "btnResetSecurityKey";
this.btnResetSecurityKey.Size = new System.Drawing.Size(104, 23);
this.btnResetSecurityKey.TabIndex = 48;
this.btnResetSecurityKey.Text = "重置安全密钥";
this.btnResetSecurityKey.UseVisualStyleBackColor = true;
this.btnResetSecurityKey.Click += new System.EventHandler(this.btnResetSecurityKey_Click);
//
// btnRelease
//
this.btnRelease.Enabled = false;
this.btnRelease.Location = new System.Drawing.Point(349, 30);
this.btnRelease.Name = "btnRelease";
this.btnRelease.Size = new System.Drawing.Size(74, 23);
this.btnRelease.TabIndex = 62;
this.btnRelease.Text = "断开连接";
this.btnRelease.UseVisualStyleBackColor = true;
this.btnRelease.Click += new System.EventHandler(this.btnRelease_Click);
//
// tabControl1
//
this.tabControl1.Controls.Add(this.UpgradeFunctionTest);
this.tabControl1.Controls.Add(this.ProductFunctionTest_1);
this.tabControl1.Controls.Add(this.selfDiagTabPage);
this.tabControl1.Location = new System.Drawing.Point(23, 59);
this.tabControl1.Name = "tabControl1";
this.tabControl1.SelectedIndex = 0;
this.tabControl1.Size = new System.Drawing.Size(534, 456);
this.tabControl1.TabIndex = 72;
//
// UpgradeFunctionTest
//
this.UpgradeFunctionTest.Controls.Add(this.label5);
this.UpgradeFunctionTest.Controls.Add(this.ckbIsCrcLsb);
this.UpgradeFunctionTest.Controls.Add(this.groupBox1);
this.UpgradeFunctionTest.Controls.Add(this.txtUIUpdateFilePath);
this.UpgradeFunctionTest.Controls.Add(this.btnUIUpdateFileSwitch);
this.UpgradeFunctionTest.Controls.Add(this.textBoxTimeEscape);
this.UpgradeFunctionTest.Controls.Add(this.label33);
this.UpgradeFunctionTest.Controls.Add(this.lbUpdateProgress);
this.UpgradeFunctionTest.Controls.Add(this.btUpgrade);
this.UpgradeFunctionTest.Controls.Add(this.progressBar1);
this.UpgradeFunctionTest.Controls.Add(this.textBoxApp);
this.UpgradeFunctionTest.Controls.Add(this.textBoxFlash);
this.UpgradeFunctionTest.Controls.Add(this.btAPP);
this.UpgradeFunctionTest.Controls.Add(this.btFlashDriver);
this.UpgradeFunctionTest.Location = new System.Drawing.Point(4, 22);
this.UpgradeFunctionTest.Name = "UpgradeFunctionTest";
this.UpgradeFunctionTest.Size = new System.Drawing.Size(526, 430);
this.UpgradeFunctionTest.TabIndex = 2;
this.UpgradeFunctionTest.Text = "升级功能";
this.UpgradeFunctionTest.UseVisualStyleBackColor = true;
//
// label5
//
this.label5.AutoSize = true;
this.label5.Location = new System.Drawing.Point(13, 9);
this.label5.Name = "label5";
this.label5.Size = new System.Drawing.Size(221, 12);
this.label5.TabIndex = 86;
this.label5.Text = "提示:请先选择了正确的车厂再选择文件";
//
// ckbIsCrcLsb
//
this.ckbIsCrcLsb.AutoSize = true;
this.ckbIsCrcLsb.Location = new System.Drawing.Point(14, 33);
this.ckbIsCrcLsb.Name = "ckbIsCrcLsb";
this.ckbIsCrcLsb.Size = new System.Drawing.Size(282, 16);
this.ckbIsCrcLsb.TabIndex = 85;
this.ckbIsCrcLsb.Text = "CRC校验是否是小端选确定是否勾选再选文件";
this.ckbIsCrcLsb.UseVisualStyleBackColor = true;
//
// groupBox1
//
this.groupBox1.Controls.Add(this.rbtnUiSelect);
this.groupBox1.Controls.Add(this.rbtnAppSelect);
this.groupBox1.Location = new System.Drawing.Point(15, 199);
this.groupBox1.Name = "groupBox1";
this.groupBox1.Size = new System.Drawing.Size(496, 46);
this.groupBox1.TabIndex = 79;
this.groupBox1.TabStop = false;
this.groupBox1.Text = "升级文件选择";
//
// rbtnUiSelect
//
this.rbtnUiSelect.AutoSize = true;
this.rbtnUiSelect.Location = new System.Drawing.Point(70, 20);
this.rbtnUiSelect.Name = "rbtnUiSelect";
this.rbtnUiSelect.Size = new System.Drawing.Size(35, 16);
this.rbtnUiSelect.TabIndex = 79;
this.rbtnUiSelect.TabStop = true;
this.rbtnUiSelect.Text = "UI";
this.rbtnUiSelect.UseVisualStyleBackColor = true;
//
// rbtnAppSelect
//
this.rbtnAppSelect.AutoSize = true;
this.rbtnAppSelect.Location = new System.Drawing.Point(6, 20);
this.rbtnAppSelect.Name = "rbtnAppSelect";
this.rbtnAppSelect.Size = new System.Drawing.Size(41, 16);
this.rbtnAppSelect.TabIndex = 78;
this.rbtnAppSelect.TabStop = true;
this.rbtnAppSelect.Text = "APP";
this.rbtnAppSelect.UseVisualStyleBackColor = true;
//
// txtUIUpdateFilePath
//
this.txtUIUpdateFilePath.Location = new System.Drawing.Point(116, 124);
this.txtUIUpdateFilePath.Name = "txtUIUpdateFilePath";
this.txtUIUpdateFilePath.Size = new System.Drawing.Size(395, 21);
this.txtUIUpdateFilePath.TabIndex = 73;
//
// btnUIUpdateFileSwitch
//
this.btnUIUpdateFileSwitch.Location = new System.Drawing.Point(14, 122);
this.btnUIUpdateFileSwitch.Name = "btnUIUpdateFileSwitch";
this.btnUIUpdateFileSwitch.Size = new System.Drawing.Size(82, 23);
this.btnUIUpdateFileSwitch.TabIndex = 72;
this.btnUIUpdateFileSwitch.Text = "UI";
this.btnUIUpdateFileSwitch.UseVisualStyleBackColor = true;
this.btnUIUpdateFileSwitch.Click += new System.EventHandler(this.btnUIUpdateFileSwitch_Click);
//
// textBoxTimeEscape
//
this.textBoxTimeEscape.Location = new System.Drawing.Point(84, 300);
this.textBoxTimeEscape.Name = "textBoxTimeEscape";
this.textBoxTimeEscape.Size = new System.Drawing.Size(42, 21);
this.textBoxTimeEscape.TabIndex = 71;
//
// label33
//
this.label33.AutoSize = true;
this.label33.Location = new System.Drawing.Point(13, 303);
this.label33.Name = "label33";
this.label33.Size = new System.Drawing.Size(65, 12);
this.label33.TabIndex = 70;
this.label33.Text = "升级用时:";
//
// lbUpdateProgress
//
this.lbUpdateProgress.AutoSize = true;
this.lbUpdateProgress.ForeColor = System.Drawing.Color.Blue;
this.lbUpdateProgress.Location = new System.Drawing.Point(194, 332);
this.lbUpdateProgress.Name = "lbUpdateProgress";
this.lbUpdateProgress.Size = new System.Drawing.Size(17, 12);
this.lbUpdateProgress.TabIndex = 69;
this.lbUpdateProgress.Text = "0%";
//
// btUpgrade
//
this.btUpgrade.Location = new System.Drawing.Point(436, 327);
this.btUpgrade.Name = "btUpgrade";
this.btUpgrade.Size = new System.Drawing.Size(75, 23);
this.btUpgrade.TabIndex = 68;
this.btUpgrade.Text = "升级";
this.btUpgrade.UseVisualStyleBackColor = true;
this.btUpgrade.Click += new System.EventHandler(this.btUpgrade_Click);
//
// progressBar1
//
this.progressBar1.Location = new System.Drawing.Point(15, 327);
this.progressBar1.Name = "progressBar1";
this.progressBar1.Size = new System.Drawing.Size(404, 23);
this.progressBar1.TabIndex = 67;
//
// textBoxApp
//
this.textBoxApp.Location = new System.Drawing.Point(116, 95);
this.textBoxApp.Name = "textBoxApp";
this.textBoxApp.Size = new System.Drawing.Size(395, 21);
this.textBoxApp.TabIndex = 66;
//
// textBoxFlash
//
this.textBoxFlash.Location = new System.Drawing.Point(116, 66);
this.textBoxFlash.Name = "textBoxFlash";
this.textBoxFlash.Size = new System.Drawing.Size(395, 21);
this.textBoxFlash.TabIndex = 65;
//
// btAPP
//
this.btAPP.Location = new System.Drawing.Point(14, 93);
this.btAPP.Name = "btAPP";
this.btAPP.Size = new System.Drawing.Size(82, 23);
this.btAPP.TabIndex = 64;
this.btAPP.Text = "APP";
this.btAPP.UseVisualStyleBackColor = true;
this.btAPP.Click += new System.EventHandler(this.btAPP_Click);
//
// btFlashDriver
//
this.btFlashDriver.Location = new System.Drawing.Point(15, 64);
this.btFlashDriver.Name = "btFlashDriver";
this.btFlashDriver.Size = new System.Drawing.Size(82, 23);
this.btFlashDriver.TabIndex = 63;
this.btFlashDriver.Text = "FlashDriver";
this.btFlashDriver.UseVisualStyleBackColor = true;
this.btFlashDriver.Click += new System.EventHandler(this.btFlashDriver_Click);
//
// ProductFunctionTest_1
//
this.ProductFunctionTest_1.Controls.Add(this.groupBox4);
this.ProductFunctionTest_1.Location = new System.Drawing.Point(4, 22);
this.ProductFunctionTest_1.Name = "ProductFunctionTest_1";
this.ProductFunctionTest_1.Padding = new System.Windows.Forms.Padding(3);
this.ProductFunctionTest_1.Size = new System.Drawing.Size(526, 430);
this.ProductFunctionTest_1.TabIndex = 1;
this.ProductFunctionTest_1.Text = "版本号";
this.ProductFunctionTest_1.UseVisualStyleBackColor = true;
//
// selfDiagTabPage
//
this.selfDiagTabPage.Location = new System.Drawing.Point(4, 22);
this.selfDiagTabPage.Name = "selfDiagTabPage";
this.selfDiagTabPage.Padding = new System.Windows.Forms.Padding(3);
this.selfDiagTabPage.Size = new System.Drawing.Size(526, 430);
this.selfDiagTabPage.TabIndex = 7;
this.selfDiagTabPage.Text = "其它";
this.selfDiagTabPage.UseVisualStyleBackColor = true;
//
// btVersionInfo
//
this.btVersionInfo.Location = new System.Drawing.Point(960, 11);
this.btVersionInfo.Name = "btVersionInfo";
this.btVersionInfo.Size = new System.Drawing.Size(75, 23);
this.btVersionInfo.TabIndex = 77;
this.btVersionInfo.Text = "版本信息";
this.btVersionInfo.UseVisualStyleBackColor = true;
this.btVersionInfo.Click += new System.EventHandler(this.btVersionInfo_Click);
//
// cbbCarType
//
this.cbbCarType.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
this.cbbCarType.FormattingEnabled = true;
this.cbbCarType.Items.AddRange(new object[] {
"鸿日",
"比亚迪"});
this.cbbCarType.Location = new System.Drawing.Point(434, 32);
this.cbbCarType.Name = "cbbCarType";
this.cbbCarType.Size = new System.Drawing.Size(94, 20);
this.cbbCarType.TabIndex = 79;
this.cbbCarType.SelectedIndexChanged += new System.EventHandler(this.cobCarType_SelectedIndexChanged);
//
// label35
//
this.label35.AutoSize = true;
this.label35.Location = new System.Drawing.Point(150, 16);
this.label35.Name = "label35";
this.label35.Size = new System.Drawing.Size(89, 12);
this.label35.TabIndex = 80;
this.label35.Text = "硬件ID过滤器";
//
// txtIdFilterStrat
//
this.txtIdFilterStrat.Location = new System.Drawing.Point(152, 32);
this.txtIdFilterStrat.Name = "txtIdFilterStrat";
this.txtIdFilterStrat.Size = new System.Drawing.Size(42, 21);
this.txtIdFilterStrat.TabIndex = 81;
this.txtIdFilterStrat.Text = "600";
this.txtIdFilterStrat.TextChanged += new System.EventHandler(this.idStratTextBox_TextChanged);
//
// txtIdFilterEnd
//
this.txtIdFilterEnd.Location = new System.Drawing.Point(200, 32);
this.txtIdFilterEnd.Name = "txtIdFilterEnd";
this.txtIdFilterEnd.Size = new System.Drawing.Size(42, 21);
this.txtIdFilterEnd.TabIndex = 83;
this.txtIdFilterEnd.Text = "7ff";
//
// ckbIsCanFd
//
this.ckbIsCanFd.AutoSize = true;
this.ckbIsCanFd.Location = new System.Drawing.Point(269, 8);
this.ckbIsCanFd.Name = "ckbIsCanFd";
this.ckbIsCanFd.Size = new System.Drawing.Size(54, 16);
this.ckbIsCanFd.TabIndex = 84;
this.ckbIsCanFd.Text = "CANFD";
this.ckbIsCanFd.UseVisualStyleBackColor = true;
this.ckbIsCanFd.CheckedChanged += new System.EventHandler(this.ckbIsCanFd_CheckedChanged);
//
// ckbIsCycleReceive
//
this.ckbIsCycleReceive.AutoSize = true;
this.ckbIsCycleReceive.Location = new System.Drawing.Point(338, 8);
this.ckbIsCycleReceive.Name = "ckbIsCycleReceive";
this.ckbIsCycleReceive.Size = new System.Drawing.Size(72, 16);
this.ckbIsCycleReceive.TabIndex = 85;
this.ckbIsCycleReceive.Text = "周期接收";
this.ckbIsCycleReceive.UseVisualStyleBackColor = true;
//
// ckbIsEventReceive
//
this.ckbIsEventReceive.AutoSize = true;
this.ckbIsEventReceive.Location = new System.Drawing.Point(416, 8);
this.ckbIsEventReceive.Name = "ckbIsEventReceive";
this.ckbIsEventReceive.Size = new System.Drawing.Size(72, 16);
this.ckbIsEventReceive.TabIndex = 86;
this.ckbIsEventReceive.Text = "事件接收";
this.ckbIsEventReceive.UseVisualStyleBackColor = true;
//
// rtxtMessagesLog
//
this.rtxtMessagesLog.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
this.rtxtMessagesLog.ContextMenuStrip = this.ctmsMessageLog;
this.rtxtMessagesLog.HideSelection = false;
this.rtxtMessagesLog.Location = new System.Drawing.Point(566, 64);
this.rtxtMessagesLog.Name = "rtxtMessagesLog";
this.rtxtMessagesLog.ReadOnly = true;
this.rtxtMessagesLog.ScrollBars = System.Windows.Forms.RichTextBoxScrollBars.ForcedBoth;
this.rtxtMessagesLog.Size = new System.Drawing.Size(466, 374);
this.rtxtMessagesLog.TabIndex = 87;
this.rtxtMessagesLog.Text = "";
this.rtxtMessagesLog.WordWrap = false;
//
// ctmsMessageLog
//
this.ctmsMessageLog.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.tsmiMessagesLogStop,
this.toolStripSeparator2,
this.tsmiMessagesLogClear,
this.toolStripSeparator1,
this.tsmiLookAllMessagesLog,
this.tsmiLookDiagMessagesLog,
this.tsmiLookAppMessagesLog,
this.toolStripSeparator3,
this.tsmiSaveMessagesLog});
this.ctmsMessageLog.Name = "ctmsMessageLog";
this.ctmsMessageLog.Size = new System.Drawing.Size(161, 154);
//
// tsmiMessagesLogStop
//
this.tsmiMessagesLogStop.Name = "tsmiMessagesLogStop";
this.tsmiMessagesLogStop.Size = new System.Drawing.Size(160, 22);
this.tsmiMessagesLogStop.Text = "暂停";
this.tsmiMessagesLogStop.Click += new System.EventHandler(this.tsmiMessagesLogStop_Click);
//
// toolStripSeparator2
//
this.toolStripSeparator2.Name = "toolStripSeparator2";
this.toolStripSeparator2.Size = new System.Drawing.Size(157, 6);
//
// tsmiMessagesLogClear
//
this.tsmiMessagesLogClear.Name = "tsmiMessagesLogClear";
this.tsmiMessagesLogClear.Size = new System.Drawing.Size(160, 22);
this.tsmiMessagesLogClear.Text = "清除";
this.tsmiMessagesLogClear.Click += new System.EventHandler(this.ToolStripMenuItem_Click);
//
// toolStripSeparator1
//
this.toolStripSeparator1.Name = "toolStripSeparator1";
this.toolStripSeparator1.Size = new System.Drawing.Size(157, 6);
//
// tsmiLookAllMessagesLog
//
this.tsmiLookAllMessagesLog.Name = "tsmiLookAllMessagesLog";
this.tsmiLookAllMessagesLog.Size = new System.Drawing.Size(160, 22);
this.tsmiLookAllMessagesLog.Text = "查看全部报文";
this.tsmiLookAllMessagesLog.Click += new System.EventHandler(this.tsmiLookAllMessagesLog_Click);
//
// tsmiLookDiagMessagesLog
//
this.tsmiLookDiagMessagesLog.Name = "tsmiLookDiagMessagesLog";
this.tsmiLookDiagMessagesLog.Size = new System.Drawing.Size(160, 22);
this.tsmiLookDiagMessagesLog.Text = "仅查看诊断报文";
this.tsmiLookDiagMessagesLog.Click += new System.EventHandler(this.tsmiLookDiagMessagesLog_Click);
//
// tsmiLookAppMessagesLog
//
this.tsmiLookAppMessagesLog.Name = "tsmiLookAppMessagesLog";
this.tsmiLookAppMessagesLog.Size = new System.Drawing.Size(160, 22);
this.tsmiLookAppMessagesLog.Text = "仅查看应用报文";
this.tsmiLookAppMessagesLog.Click += new System.EventHandler(this.tsmiLookAppMessagesLog_Click);
//
// toolStripSeparator3
//
this.toolStripSeparator3.Name = "toolStripSeparator3";
this.toolStripSeparator3.Size = new System.Drawing.Size(157, 6);
//
// tsmiSaveMessagesLog
//
this.tsmiSaveMessagesLog.Name = "tsmiSaveMessagesLog";
this.tsmiSaveMessagesLog.Size = new System.Drawing.Size(160, 22);
this.tsmiSaveMessagesLog.Text = "保存Log";
this.tsmiSaveMessagesLog.Click += new System.EventHandler(this.SaveLogToolStripMenuItem_Click);
//
// rtxtLog
//
this.rtxtLog.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
this.rtxtLog.ContextMenuStrip = this.ctmsLog;
this.rtxtLog.HideSelection = false;
this.rtxtLog.Location = new System.Drawing.Point(566, 444);
this.rtxtLog.Name = "rtxtLog";
this.rtxtLog.ReadOnly = true;
this.rtxtLog.ScrollBars = System.Windows.Forms.RichTextBoxScrollBars.ForcedBoth;
this.rtxtLog.Size = new System.Drawing.Size(464, 226);
this.rtxtLog.TabIndex = 88;
this.rtxtLog.Text = "";
this.rtxtLog.WordWrap = false;
//
// ctmsLog
//
this.ctmsLog.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.tsmiLogClear});
this.ctmsLog.Name = "ctmsLog";
this.ctmsLog.Size = new System.Drawing.Size(101, 26);
//
// tsmiLogClear
//
this.tsmiLogClear.Name = "tsmiLogClear";
this.tsmiLogClear.Size = new System.Drawing.Size(100, 22);
this.tsmiLogClear.Text = "清除";
this.tsmiLogClear.Click += new System.EventHandler(this.tsmiLogClear_Click);
//
// lsvSendMessagesTable
//
this.lsvSendMessagesTable.Columns.AddRange(new System.Windows.Forms.ColumnHeader[] {
this.clhSendMessageId,
this.clhSendMessageLen,
this.clhSendMessageData});
this.lsvSendMessagesTable.ContextMenuStrip = this.ctmsSendMessagesTable;
this.lsvSendMessagesTable.FullRowSelect = true;
this.lsvSendMessagesTable.HideSelection = false;
this.lsvSendMessagesTable.Location = new System.Drawing.Point(23, 521);
this.lsvSendMessagesTable.Name = "lsvSendMessagesTable";
this.lsvSendMessagesTable.Size = new System.Drawing.Size(534, 149);
this.lsvSendMessagesTable.TabIndex = 89;
this.lsvSendMessagesTable.UseCompatibleStateImageBehavior = false;
this.lsvSendMessagesTable.View = System.Windows.Forms.View.Details;
this.lsvSendMessagesTable.DoubleClick += new System.EventHandler(this.lsvSendMessagesTable_DoubleClick);
//
// clhSendMessageId
//
this.clhSendMessageId.Text = "ID(Hex)";
this.clhSendMessageId.Width = 54;
//
// clhSendMessageLen
//
this.clhSendMessageLen.Text = "Len";
this.clhSendMessageLen.Width = 62;
//
// clhSendMessageData
//
this.clhSendMessageData.Text = "Data(Hex)";
this.clhSendMessageData.Width = 382;
//
// ctmsSendMessagesTable
//
this.ctmsSendMessagesTable.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.tsmiAddMessage,
this.tsmiDeleteMessage,
this.tsmiEditMessage});
this.ctmsSendMessagesTable.Name = "ctmsSendMessagesTable";
this.ctmsSendMessagesTable.Size = new System.Drawing.Size(125, 70);
//
// tsmiAddMessage
//
this.tsmiAddMessage.Name = "tsmiAddMessage";
this.tsmiAddMessage.Size = new System.Drawing.Size(124, 22);
this.tsmiAddMessage.Text = "添加报文";
this.tsmiAddMessage.Click += new System.EventHandler(this.tsmiAddMessage_Click);
//
// tsmiDeleteMessage
//
this.tsmiDeleteMessage.Name = "tsmiDeleteMessage";
this.tsmiDeleteMessage.Size = new System.Drawing.Size(124, 22);
this.tsmiDeleteMessage.Text = "删除";
this.tsmiDeleteMessage.Click += new System.EventHandler(this.tsmiDeleteMessage_Click);
//
// tsmiEditMessage
//
this.tsmiEditMessage.Name = "tsmiEditMessage";
this.tsmiEditMessage.Size = new System.Drawing.Size(124, 22);
this.tsmiEditMessage.Text = "编辑";
this.tsmiEditMessage.Click += new System.EventHandler(this.tsmiEditMessage_Click);
//
// timer1
//
this.timer1.Tick += new System.EventHandler(this.timer1_Tick);
//
// timer2
//
this.timer2.Tick += new System.EventHandler(this.timer2_Tick);
//
// uds_tools
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.AutoSize = true;
this.BackColor = System.Drawing.Color.White;
this.ClientSize = new System.Drawing.Size(1042, 682);
this.Controls.Add(this.lsvSendMessagesTable);
this.Controls.Add(this.rtxtLog);
this.Controls.Add(this.rtxtMessagesLog);
this.Controls.Add(this.ckbIsEventReceive);
this.Controls.Add(this.ckbIsCycleReceive);
this.Controls.Add(this.ckbIsCanFd);
this.Controls.Add(this.txtIdFilterEnd);
this.Controls.Add(this.txtIdFilterStrat);
this.Controls.Add(this.label35);
this.Controls.Add(this.cbbCarType);
this.Controls.Add(this.btVersionInfo);
this.Controls.Add(this.tabControl1);
this.Controls.Add(this.btnRelease);
this.Controls.Add(this.cbbIdFilterSelect);
this.Controls.Add(this.label2);
this.Controls.Add(this.btnConnect);
this.Controls.Add(this.label1);
this.Controls.Add(this.cbbDeviceType);
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle;
this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
this.MaximizeBox = false;
this.Name = "uds_tools";
this.Text = "鸿日uds升级程序";
this.FormClosed += new System.Windows.Forms.FormClosedEventHandler(this.CanToolForm_FormClosed);
this.Load += new System.EventHandler(this.btClrDia_Load);
this.groupBox4.ResumeLayout(false);
this.tabControl1.ResumeLayout(false);
this.UpgradeFunctionTest.ResumeLayout(false);
this.UpgradeFunctionTest.PerformLayout();
this.groupBox1.ResumeLayout(false);
this.groupBox1.PerformLayout();
this.ProductFunctionTest_1.ResumeLayout(false);
this.ctmsMessageLog.ResumeLayout(false);
this.ctmsLog.ResumeLayout(false);
this.ctmsSendMessagesTable.ResumeLayout(false);
this.ResumeLayout(false);
this.PerformLayout();
}
#endregion
private System.Windows.Forms.Label label1;
private System.Windows.Forms.ComboBox cbbDeviceType;
private System.Windows.Forms.Button btnConnect;
private System.Windows.Forms.Timer timerReadMsg;
private System.Windows.Forms.Timer timerUDS;
private System.Windows.Forms.ComboBox cbbIdFilterSelect;
private System.Windows.Forms.Label label2;
private System.Windows.Forms.Button button1;
private System.Windows.Forms.Button btProgram;
private System.Windows.Forms.Button btDefault;
private System.Windows.Forms.Button btlev1;
private System.Windows.Forms.Button btlev2;
private System.Windows.Forms.Timer timerSendMsg;
private System.Windows.Forms.Button btClrDial;
private System.Windows.Forms.Button btComOff;
private System.Windows.Forms.Button btComOn;
private System.Windows.Forms.Timer timerFlashMain;
private System.Windows.Forms.Timer timer1s;
private System.Windows.Forms.GroupBox groupBox4;
private System.Windows.Forms.Button btnRelease;
private System.Windows.Forms.TabControl tabControl1;
private System.Windows.Forms.TabPage ProductFunctionTest_1;
private System.Windows.Forms.TabPage UpgradeFunctionTest;
private System.Windows.Forms.TextBox textBoxApp;
private System.Windows.Forms.TextBox textBoxFlash;
private System.Windows.Forms.Button btAPP;
private System.Windows.Forms.Button btFlashDriver;
private System.Windows.Forms.Button btUpgrade;
private System.Windows.Forms.ProgressBar progressBar1;
private System.Windows.Forms.Label lbUpdateProgress;
private System.Windows.Forms.TextBox textBoxTimeEscape;
private System.Windows.Forms.Label label33;
private System.Windows.Forms.Button btVersionInfo;
private System.Windows.Forms.ComboBox cbbCarType;
private System.Windows.Forms.Label label35;
private System.Windows.Forms.TextBox txtIdFilterStrat;
private System.Windows.Forms.TextBox txtIdFilterEnd;
private System.Windows.Forms.TabPage selfDiagTabPage;
private System.Windows.Forms.TextBox txtUIUpdateFilePath;
private System.Windows.Forms.Button btnUIUpdateFileSwitch;
private System.Windows.Forms.Button btnResetSecurityKey;
private System.Windows.Forms.CheckBox ckbIsCanFd;
private System.Windows.Forms.Button btnStartUpdataBoot;
private System.Windows.Forms.CheckBox ckbIsCrcLsb;
private System.Windows.Forms.GroupBox groupBox1;
private System.Windows.Forms.RadioButton rbtnUiSelect;
private System.Windows.Forms.RadioButton rbtnAppSelect;
private System.Windows.Forms.CheckBox ckbIsCycleReceive;
private System.Windows.Forms.CheckBox ckbIsEventReceive;
private System.Windows.Forms.RichTextBox rtxtMessagesLog;
private System.Windows.Forms.ContextMenuStrip ctmsMessageLog;
private System.Windows.Forms.ToolStripMenuItem tsmiMessagesLogClear;
private System.Windows.Forms.ToolStripMenuItem tsmiSaveMessagesLog;
private System.Windows.Forms.ToolStripMenuItem tsmiMessagesLogStop;
private System.Windows.Forms.ToolStripSeparator toolStripSeparator2;
private System.Windows.Forms.ToolStripSeparator toolStripSeparator1;
private System.Windows.Forms.ToolStripMenuItem tsmiLookAllMessagesLog;
private System.Windows.Forms.ToolStripMenuItem tsmiLookDiagMessagesLog;
private System.Windows.Forms.ToolStripMenuItem tsmiLookAppMessagesLog;
private System.Windows.Forms.ToolStripSeparator toolStripSeparator3;
private System.Windows.Forms.Label label5;
private System.Windows.Forms.RichTextBox rtxtLog;
private System.Windows.Forms.ContextMenuStrip ctmsLog;
private System.Windows.Forms.ToolStripMenuItem tsmiLogClear;
private System.Windows.Forms.Button btnECUReset;
private System.Windows.Forms.ListView lsvSendMessagesTable;
private System.Windows.Forms.ColumnHeader clhSendMessageId;
private System.Windows.Forms.ColumnHeader clhSendMessageLen;
private System.Windows.Forms.ColumnHeader clhSendMessageData;
private System.Windows.Forms.ContextMenuStrip ctmsSendMessagesTable;
private System.Windows.Forms.ToolStripMenuItem tsmiAddMessage;
private System.Windows.Forms.ToolStripMenuItem tsmiDeleteMessage;
private System.Windows.Forms.ToolStripMenuItem tsmiEditMessage;
private System.Windows.Forms.Button btnSecurityAccessLevel3;
private System.Windows.Forms.Button btnSecurityAccessLevel4;
private System.Windows.Forms.Timer timer1;
private System.Windows.Forms.Timer timer2;
}
}

1998
CAN_Tool/uds_tools.cs Normal file

File diff suppressed because it is too large Load Diff

183
CAN_Tool/uds_tools.csproj Normal file
View File

@ -0,0 +1,183 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{F7B5DB9E-0890-47ED-813C-324B0AF56390}</ProjectGuid>
<OutputType>WinExe</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>CanTool</RootNamespace>
<AssemblyName>CanTool</AssemblyName>
<TargetFrameworkVersion>v4.8</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<IsWebBootstrapper>false</IsWebBootstrapper>
<PublishUrl>C:\Users\X52304\Desktop\</PublishUrl>
<Install>true</Install>
<InstallFrom>Disk</InstallFrom>
<UpdateEnabled>false</UpdateEnabled>
<UpdateMode>Foreground</UpdateMode>
<UpdateInterval>7</UpdateInterval>
<UpdateIntervalUnits>Days</UpdateIntervalUnits>
<UpdatePeriodically>false</UpdatePeriodically>
<UpdateRequired>false</UpdateRequired>
<MapFileExtensions>true</MapFileExtensions>
<ApplicationRevision>1</ApplicationRevision>
<ApplicationVersion>1.0.0.%2a</ApplicationVersion>
<UseApplicationTrust>false</UseApplicationTrust>
<PublishWizardCompleted>true</PublishWizardCompleted>
<BootstrapperEnabled>true</BootstrapperEnabled>
<TargetFrameworkProfile />
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup>
<ManifestCertificateThumbprint>55023BEBF2AEE2FBE07432DC66BDF5DF2EBC74A3</ManifestCertificateThumbprint>
</PropertyGroup>
<PropertyGroup>
<ManifestKeyFile>uds_tools_TemporaryKey.pfx</ManifestKeyFile>
</PropertyGroup>
<PropertyGroup>
<GenerateManifests>true</GenerateManifests>
</PropertyGroup>
<PropertyGroup>
<SignManifests>false</SignManifests>
</PropertyGroup>
<ItemGroup>
<Reference Include="Interop.TSMasterAPI">
<HintPath>..\..\..\..\PLink上位机\PLinkTool\PLinkTool\bin\Debug\Interop.TSMasterAPI.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.Windows.Forms.DataVisualization" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="Microsoft.CSharp" />
<Reference Include="System.Data" />
<Reference Include="System.Deployment" />
<Reference Include="System.Drawing" />
<Reference Include="System.Windows.Forms" />
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="CanDevice\CanDevice.cs" />
<Compile Include="CanDevice\GCCAN\GC_ECAN.cs" />
<Compile Include="CanDevice\GCCAN\GC_ECANBasic.cs" />
<Compile Include="CanDevice\TOOMOSS\TooMoss.cs" />
<Compile Include="CanDevice\TOOMOSS\usb2can.cs" />
<Compile Include="CanDevice\TOOMOSS\usb2canfd.cs" />
<Compile Include="CanDevice\TOOMOSS\usb_device.cs" />
<Compile Include="Diag.cs" />
<Compile Include="CanToolForm.Diag.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="MessageConfigForm.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="MessageConfigForm.Designer.cs">
<DependentUpon>MessageConfigForm.cs</DependentUpon>
</Compile>
<Compile Include="CanDevice\PCAN\Pcan.cs" />
<Compile Include="S19File.cs" />
<Compile Include="CRC32Cls.cs" />
<Compile Include="uds_tools.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="uds_tools.Designer.cs">
<DependentUpon>uds_tools.cs</DependentUpon>
</Compile>
<Compile Include="CanDevice\PCAN\PCANBasic.cs" />
<Compile Include="Program.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="SecurityAlgorithm.cs" />
<Compile Include="CanDevice\TOSUN\ToSun.cs" />
<Compile Include="UDS.cs" />
<Compile Include="UpdateConfigParams.cs" />
<Compile Include="CanToolForm.Update.cs">
<SubType>Form</SubType>
</Compile>
<EmbeddedResource Include="MessageConfigForm.resx">
<DependentUpon>MessageConfigForm.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="uds_tools.resx">
<DependentUpon>uds_tools.cs</DependentUpon>
<SubType>Designer</SubType>
</EmbeddedResource>
<EmbeddedResource Include="Properties\Resources.resx">
<Generator>ResXFileCodeGenerator</Generator>
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
<SubType>Designer</SubType>
</EmbeddedResource>
<Compile Include="Properties\Resources.Designer.cs">
<AutoGen>True</AutoGen>
<DependentUpon>Resources.resx</DependentUpon>
<DesignTime>True</DesignTime>
</Compile>
<None Include="Properties\Settings.settings">
<Generator>SettingsSingleFileGenerator</Generator>
<LastGenOutput>Settings.Designer.cs</LastGenOutput>
</None>
<Compile Include="Properties\Settings.Designer.cs">
<AutoGen>True</AutoGen>
<DependentUpon>Settings.settings</DependentUpon>
<DesignTimeSharedInput>True</DesignTimeSharedInput>
</Compile>
<None Include="uds_tools_TemporaryKey.pfx" />
</ItemGroup>
<ItemGroup>
<None Include="App.config" />
</ItemGroup>
<ItemGroup>
<BootstrapperPackage Include=".NETFramework,Version=v4.5">
<Visible>False</Visible>
<ProductName>Microsoft .NET Framework 4.5 %28x86 和 x64%29</ProductName>
<Install>true</Install>
</BootstrapperPackage>
<BootstrapperPackage Include="Microsoft.Net.Client.3.5">
<Visible>False</Visible>
<ProductName>.NET Framework 3.5 SP1 Client Profile</ProductName>
<Install>false</Install>
</BootstrapperPackage>
<BootstrapperPackage Include="Microsoft.Net.Framework.3.5.SP1">
<Visible>False</Visible>
<ProductName>.NET Framework 3.5 SP1</ProductName>
<Install>false</Install>
</BootstrapperPackage>
</ItemGroup>
<ItemGroup />
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<PropertyGroup>
<PreBuildEvent>del $(ProjectDir)obj\Debug\*.txt
del $(ProjectDir)obj\Debug\*.cs
del $(ProjectDir)obj\Debug\*.cache</PreBuildEvent>
</PropertyGroup>
<PropertyGroup>
<PostBuildEvent>
</PostBuildEvent>
</PropertyGroup>
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
<Target Name="BeforeBuild">
</Target>
<Target Name="AfterBuild">
</Target>
-->
</Project>

View File

@ -0,0 +1,17 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="12.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<ProjectView>ProjectFiles</ProjectView>
<PublishUrlHistory>C:\Users\X52304\Desktop\|发布\</PublishUrlHistory>
<InstallUrlHistory />
<SupportUrlHistory />
<UpdateUrlHistory />
<BootstrapperUrlHistory />
<ErrorReportUrlHistory />
<FallbackCulture>zh-CN</FallbackCulture>
<VerifyUploadedFiles>false</VerifyUploadedFiles>
</PropertyGroup>
<PropertyGroup>
<EnableSecurityDebugging>false</EnableSecurityDebugging>
</PropertyGroup>
</Project>

230
CAN_Tool/uds_tools.resx Normal file
View File

@ -0,0 +1,230 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<metadata name="timerReadMsg.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>15, 22</value>
</metadata>
<metadata name="timerUDS.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>558, 21</value>
</metadata>
<metadata name="timerSendMsg.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>203, 21</value>
</metadata>
<metadata name="timerFlashMain.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>380, 22</value>
</metadata>
<metadata name="timer1s.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>703, 20</value>
</metadata>
<metadata name="ctmsMessageLog.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>799, 20</value>
</metadata>
<metadata name="ctmsLog.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>953, 20</value>
</metadata>
<metadata name="ctmsSendMessagesTable.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>1055, 20</value>
</metadata>
<metadata name="timer1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>1254, 20</value>
</metadata>
<metadata name="timer2.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>1344, 20</value>
</metadata>
<metadata name="$this.TrayHeight" type="System.Int32, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>78</value>
</metadata>
<assembly alias="System.Drawing" name="System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
<data name="$this.Icon" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>
AAABAAEAICAAAAEAIACoEAAAFgAAACgAAAAgAAAAQAAAAAEAIAAAAAAAABAAAAAAAAAAAAAAAAAAAAAA
AAD/////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////+vr6//vb29/7Gx
sf//////////////////////////////////////////////////////////////////////////////
/////////////8G/wf+3vLj/srW2/+zu7P///////////////////////////////////////f39/wAA
AP8AAAD/AAAA////////////////////////////////////////////////////////////////////
////////////////////////DBYM/wAAAP8AAAD/srax////////////////////////////////////
///+/v7/AAAA/wsLC/8AAAD/////////////////////////////////////////////////////////
//////////////////////////////////8dIx//CQAA/wAAAP+5uL//////////////////////////
//////////////////8AAAD/BgYG/wAAAP/8/Pz/fX19/wAAAP8AAAD/AAAA/wAAAP8AAAD/AAAA/wAA
AP8AAAD/AAAA/wAAAP8AAAD/AAAA/wAAAP87Ozv//////ykYGf8ACAD/AAAA/7q5uP//////////////
/////////////////////////////wAAAP8EBAT/CgoK/wAAAP8DAwP/CAgI/wkJCf8GBgb/BgYG/xoa
Gv8HBwf/CAgI/wcHB/8ICAj/BwcH/wYGBv8aGhr/CQkJ/wUFBf8AAAD/AwUE/wsJE/8AAAD/vbm5////
////////////////////////////////////////AAAA/yAgIP9FPTb/Qjgy/0A7Nf8/Pz//Pj4+/1tb
W/9NTU3/TU1N/zU1Nf80NDT/NDQ0/0pKSv9MTEz/T09P/0FBQf8+Pj7/QT46/0E3MP9EOjH/MjQx/wAA
AP+5ub7///////////////////////////////////////7+/v8AAAD/HhYP/wZXq/8Dbaj/CUWE/yEb
Ff8mJib/CQkJ/w0NDf8AAAD/////////////////Hx8f/x8fH/8MDAz/HR0d/yQgHP8BIkj/BG62/wJt
zv8aEAj/AAAA/7e3uP///////////////////////////////////////v7+/wAAAP8oKCj/CgMA/xII
Av8QCgX/IiIi/x4eHv8CAgL/BQUF/wAAAP/BwcH/vb29/8zMzP8UFBT/AAAA/wgICP8XFxf/ISEh/xoW
Ev8PBQD/BwAA/ycnJ/8ABQD/t7y3///////////////////////////////////////+/v7/AAAA/xcX
F/8XFxf/FhYW/xcXF/8nJyf/QUFB/3d3d/95eXn/ZGRk/1JSUv9LS0v/VFRU/1paWv90dHT/dnZ2/1BQ
UP8uLi7/FhYW/xcXF/8XFxf/FBQU/wAAAP+3t7f///////////////////////////////////////n5
+f8VFBP/tLGv/5uamv+srKz/kJCQ/3Z2dv8WFhb/cnJy/3t7e/96enr/e3t7/3V1df95eXn/eXl5/3l5
ef91dXX/LS0t/1paWv+Kior/nZ2d/6qqqv+ppqT/R0VE/6+vr///////////////////////////////
//////////79/wAAAP8AEB3/ERIT/w4NDf8XFxf/AAAA/w8PD/8/Pz//AAAA/wYGBv8RERH/FRUV/xgY
GP8JCQn/AAAA/zIyMv8XFxf/CQkJ/xYWFv8QEBD/EhAO/wMRHf8AAAD/v728////////////////////
////////////////////+vf/AA8p/wCA/v/x/////vv4//////9oaGj/TExM/wcHB/8DAwP/AAAA/42N
jf99fX3/kpKS/xUVFf8AAAD/CgoK/0lJSf8gICD//////+np6f//////AG/0/wA+cf+5sKr/////////
//////////////////////////////37+/8AAAD/FT9f/3uBif9dW1r/Z2dn/x8fH/8eHh7/BAQE/woK
Cv8EBAT/AAAA/wAAAP8AAAD/AwMD/wsLC/8JCQn/GRkZ/w4ODv9tbW3/WFdX/5OPi/8JNFv/Bhge/7Wy
sf///////////////////////////////////////v7+/xsZGP+LhoL/c3Fw/3d3d/+NjY3/j4+P/6mp
qf+Ojo7/r6+v/6+vr/+oqKj/r6+v/62trf+np6f/tLS0/5CQkP+mpqb/h4eH/5GRkf92dnb/gYCA/2Rf
W/9OTEr/s7Oz///////////////////////////////////////T09P/mZmZ/ysrK/9PT0//UlJS/0hI
SP9KSkr/QkJC/0VFRf9CQkL/QkJC/0FBQf9AQED/QEBA/0JCQv9CQkL/RUVF/0NDQ/9GRkb/TU1N/09P
T/9FRUX/UlJS/1VVVf/X19f//////////////////////////////////////wAAAP8AAAD/Ly8v/1pa
Wv8qKir/QEBA/zIyMv8sLCz/LS0t/y0tLf8rKyv/Pj4+/z09Pf8/Pz//Li4u/ywsLP8tLS3/LS0t/y4u
Lv8/Pz//Ly8v/0FBQf92dnb/AAAA/wAAAP/7+/v/////////////////////////////////wcHB/8zM
zP9AQED/jIyM/wAAAP8kJCT/AwMD/wAAAP8AAAD/AAAA/wAAAP8gICD/Hh4e/yIiIv8AAAD/AAAA/wAA
AP8AAAD/AAAA/yUlJf8AAAD/g4OD/xwcHP/Q0ND/ubm5////////////////////////////////////
/////////////3V1df+JiYn/AAAA/yIiIv8mJib/AAAA/yMjI/8MDAz/GRkZ/yQkJP8jIyP/IyMj/yMj
I/8BAQH/JCQk/wMDA/8jIyP/IyMj/wAAAP+fn5//MDAw////////////////////////////////////
/////////////////////////////wwMDP96enr/AAAA/ycnJ/8MDAz/BwcH/wcHB/8eHh7/FBQU/xQU
FP8dHR3/IyMj/wcHB/8HBwf/BwcH/yUlJf8ODg7/TU1N/wAAAP//////////////////////////////
////////////////////////////////////////tra2/z4+Pv8GBgb/FRUV/yEhIf8hISH/ISEh/yEh
If8KCgr/AAAA/xoaGv8fHx//ISEh/yEhIf8hISH/Gxsb/woKCv8zMzP/iIiI////////////////////
////////////////////////////////////////////////////////AAAA/5OTk/86Ojr/QEBA/z4+
Pv8+Pj7/Pj4+/z8/P/87Ozv/Pz8//z4+Pv8+Pj7/Pj4+/z8/P/9AQED/aGho/x0dHf/c3Nz/////////
///////////////////////////////////////////////////////////////////5+fn/ERER/wAA
AP8lJSX/Nzc3/zU1Nf81NTX/NTU1/zU1Nf81NTX/NTU1/zU1Nf81NTX/NDQ0/wAAAP8bGxv/tra2////
////////////////////////////////////////////////////////////////////////////////
////////kJCQ/25ubv+QkJD/jY2N/42Njf+NjY3/jY2N/42Njf+NjY3/jY2N/4+Pj/9+fn7/Xl5e////
////////////////////////////////////////////////////////////////////////////////
////////////////////////sLCw/6enp/+oqKj/qKio/6ioqP+oqKj/qKio/6ioqP+oqKj/qKio/6Ki
ov/5+fn/////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////
////////////////////////AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA=
</value>
</data>
</root>

Binary file not shown.

Binary file not shown.

BIN
说明.txt Normal file

Binary file not shown.