first commit
This commit is contained in:
parent
a7eb3fb3d9
commit
0f8ea19850
31
.vscode/compile_commands.json
vendored
Normal file
31
.vscode/compile_commands.json
vendored
Normal file
@ -0,0 +1,31 @@
|
||||
[
|
||||
{
|
||||
"directory": "c:\\Users\\anonymous\\Desktop\\NewProject\\Other\\UniversalCanCore",
|
||||
"arguments": ["c:/applications/program custom/msys2/mingw64/bin/g++.exe", "-c", "-std=c++17", "-IInc", "-IPackages\\asio-1.36.0\\include", "-IDevice\\ScHHS", "-IDevice\\ScHHS\\Port", "-IDevice\\Zlg\\Port", "-fexceptions", "-o", "build\\.objs\\UniversalCanCore\\windows\\x64\\release\\Device\\ScHHS\\Port\\ScHHS.cpp.obj", "Device\\ScHHS\\Port\\ScHHS.cpp"],
|
||||
"file": "Device\\ScHHS\\Port\\ScHHS.cpp"
|
||||
},
|
||||
{
|
||||
"directory": "c:\\Users\\anonymous\\Desktop\\NewProject\\Other\\UniversalCanCore",
|
||||
"arguments": ["c:/applications/program custom/msys2/mingw64/bin/g++.exe", "-c", "-std=c++17", "-IInc", "-IPackages\\asio-1.36.0\\include", "-IDevice\\ScHHS", "-IDevice\\ScHHS\\Port", "-IDevice\\Zlg\\Port", "-fexceptions", "-o", "build\\.objs\\UniversalCanCore\\windows\\x64\\release\\Device\\Zlg\\Port\\Zlg.cpp.obj", "Device\\Zlg\\Port\\Zlg.cpp"],
|
||||
"file": "Device\\Zlg\\Port\\Zlg.cpp"
|
||||
},
|
||||
{
|
||||
"directory": "c:\\Users\\anonymous\\Desktop\\NewProject\\Other\\UniversalCanCore",
|
||||
"arguments": ["c:/applications/program custom/msys2/mingw64/bin/g++.exe", "-c", "-std=c++17", "-IInc", "-IPackages\\asio-1.36.0\\include", "-IDevice\\ScHHS", "-IDevice\\ScHHS\\Port", "-IDevice\\Zlg\\Port", "-fexceptions", "-o", "build\\.objs\\UniversalCanCore\\windows\\x64\\release\\Src\\CanProtocol.cpp.obj", "Src\\CanProtocol.cpp"],
|
||||
"file": "Src\\CanProtocol.cpp"
|
||||
},
|
||||
{
|
||||
"directory": "c:\\Users\\anonymous\\Desktop\\NewProject\\Other\\UniversalCanCore",
|
||||
"arguments": ["c:/applications/program custom/msys2/mingw64/bin/g++.exe", "-c", "-std=c++17", "-IInc", "-IPackages\\asio-1.36.0\\include", "-IDevice\\ScHHS", "-IDevice\\ScHHS\\Port", "-IDevice\\Zlg\\Port", "-fexceptions", "-o", "build\\.objs\\UniversalCanCore\\windows\\x64\\release\\Src\\main.cpp.obj", "Src\\main.cpp"],
|
||||
"file": "Src\\main.cpp"
|
||||
},
|
||||
{
|
||||
"directory": "c:\\Users\\anonymous\\Desktop\\NewProject\\Other\\UniversalCanCore",
|
||||
"arguments": ["c:/applications/program custom/msys2/mingw64/bin/g++.exe", "-c", "-std=c++17", "-IInc", "-IPackages\\asio-1.36.0\\include", "-IDevice\\ScHHS", "-IDevice\\ScHHS\\Port", "-IDevice\\Zlg\\Port", "-fexceptions", "-o", "build\\.objs\\UniversalCanCore\\windows\\x64\\release\\Src\\SocketApiProtocol.cpp.obj", "Src\\SocketApiProtocol.cpp"],
|
||||
"file": "Src\\SocketApiProtocol.cpp"
|
||||
},
|
||||
{
|
||||
"directory": "c:\\Users\\anonymous\\Desktop\\NewProject\\Other\\UniversalCanCore",
|
||||
"arguments": ["c:/applications/program custom/msys2/mingw64/bin/g++.exe", "-c", "-std=c++17", "-IInc", "-IPackages\\asio-1.36.0\\include", "-IDevice\\ScHHS", "-IDevice\\ScHHS\\Port", "-IDevice\\Zlg\\Port", "-fexceptions", "-o", "build\\.objs\\UniversalCanCore\\windows\\x64\\release\\Src\\System.cpp.obj", "Src\\System.cpp"],
|
||||
"file": "Src\\System.cpp"
|
||||
}]
|
||||
4
.xmake/windows/x64/cache/config
vendored
4
.xmake/windows/x64/cache/config
vendored
@ -1,9 +1,9 @@
|
||||
{
|
||||
recheck = false,
|
||||
options = {
|
||||
toolchain = "mingw64"
|
||||
},
|
||||
recheck = false,
|
||||
mtimes = {
|
||||
["xmake.lua"] = 1765270728
|
||||
["xmake.lua"] = 1766566526
|
||||
}
|
||||
}
|
||||
88
.xmake/windows/x64/cache/detect
vendored
88
.xmake/windows/x64/cache/detect
vendored
@ -1,55 +1,55 @@
|
||||
{
|
||||
find_program_mingw64_arch_x64_plat_windows_checktoolcc = {
|
||||
["C:/Applications/Program Custom/msys2/mingw64/bin/gcc.exe"] = "c:/applications/program custom/msys2/mingw64/bin/gcc.exe"
|
||||
},
|
||||
["core.tools.gcc.has_cflags"] = {
|
||||
["c:/applications/program custom/msys2/mingw64/bin/g++.exe_"] = {
|
||||
["-print-multi-directory"] = true,
|
||||
["-dumpmachine"] = true,
|
||||
["-o"] = true,
|
||||
["-Xlinker"] = true,
|
||||
["-print-search-dirs"] = true,
|
||||
["-print-sysroot-headers-suffix"] = true,
|
||||
["--help"] = true,
|
||||
["-shared"] = true,
|
||||
["-v"] = true,
|
||||
["-save-temps"] = true,
|
||||
["-x"] = true,
|
||||
["-print-libgcc-file-name"] = true,
|
||||
["--param"] = true,
|
||||
["--version"] = true,
|
||||
["-S"] = true,
|
||||
["-pipe"] = true,
|
||||
["-print-multi-os-directory"] = true,
|
||||
["-pie"] = true,
|
||||
["-c"] = true,
|
||||
["-no-canonical-prefixes"] = true,
|
||||
["-print-sysroot"] = true,
|
||||
["-E"] = true,
|
||||
["-Xassembler"] = true,
|
||||
["-print-multi-lib"] = true,
|
||||
["-print-multiarch"] = true,
|
||||
["-B"] = true,
|
||||
["-dumpspecs"] = true,
|
||||
["-pass-exit-codes"] = true,
|
||||
["-Xpreprocessor"] = true,
|
||||
["-dumpversion"] = true,
|
||||
["-time"] = true,
|
||||
["--target-help"] = true
|
||||
}
|
||||
},
|
||||
find_program_mingw64_arch_x64_plat_windows_checktoolcxx = {
|
||||
["C:/Applications/Program Custom/msys2/mingw64/bin/g++.exe"] = "c:/applications/program custom/msys2/mingw64/bin/g++.exe"
|
||||
},
|
||||
find_program_mingw64_arch_x64_plat_windows_checktoolld = {
|
||||
["C:/Applications/Program Custom/msys2/mingw64/bin/g++.exe"] = "c:/applications/program custom/msys2/mingw64/bin/g++.exe"
|
||||
},
|
||||
find_program = {
|
||||
["c:/applications/program custom/msys2/mingw64/bin/g++.exe"] = "c:/applications/program custom/msys2/mingw64/bin/g++.exe"
|
||||
},
|
||||
find_program_mingw64_arch_x64_plat_windows_checktoolld = {
|
||||
["C:/Applications/Program Custom/msys2/mingw64/bin/g++.exe"] = "c:/applications/program custom/msys2/mingw64/bin/g++.exe"
|
||||
},
|
||||
["lib.detect.has_flags"] = {
|
||||
["windows_x64_c:/applications/program custom/msys2/mingw64/bin/g++.exe__cxx_cxflags__-fdiagnostics-color=always"] = true,
|
||||
["windows_x64_c:/applications/program custom/msys2/mingw64/bin/g++.exe__cxx_cxflags__-Wno-gnu-line-marker -Werror"] = true,
|
||||
["windows_x64_c:/applications/program custom/msys2/mingw64/bin/g++.exe__cxx_cxflags__-MMD -MF"] = true,
|
||||
["windows_x64_c:/applications/program custom/msys2/mingw64/bin/g++.exe__cxx_cxflags__-fdiagnostics-color=always"] = true
|
||||
["windows_x64_c:/applications/program custom/msys2/mingw64/bin/g++.exe__cxx_cxflags__-MMD -MF"] = true
|
||||
},
|
||||
find_program_mingw64_arch_x64_plat_windows_checktoolcc = {
|
||||
["C:/Applications/Program Custom/msys2/mingw64/bin/gcc.exe"] = "c:/applications/program custom/msys2/mingw64/bin/gcc.exe"
|
||||
},
|
||||
["core.tools.gcc.has_cflags"] = {
|
||||
["c:/applications/program custom/msys2/mingw64/bin/g++.exe_"] = {
|
||||
["-print-search-dirs"] = true,
|
||||
["-dumpspecs"] = true,
|
||||
["-dumpversion"] = true,
|
||||
["-print-multi-lib"] = true,
|
||||
["-Xpreprocessor"] = true,
|
||||
["-print-multi-os-directory"] = true,
|
||||
["-save-temps"] = true,
|
||||
["--help"] = true,
|
||||
["-print-sysroot"] = true,
|
||||
["-E"] = true,
|
||||
["-print-sysroot-headers-suffix"] = true,
|
||||
["-no-canonical-prefixes"] = true,
|
||||
["-Xlinker"] = true,
|
||||
["--version"] = true,
|
||||
["-o"] = true,
|
||||
["--target-help"] = true,
|
||||
["--param"] = true,
|
||||
["-print-libgcc-file-name"] = true,
|
||||
["-B"] = true,
|
||||
["-c"] = true,
|
||||
["-pie"] = true,
|
||||
["-shared"] = true,
|
||||
["-print-multi-directory"] = true,
|
||||
["-S"] = true,
|
||||
["-dumpmachine"] = true,
|
||||
["-v"] = true,
|
||||
["-print-multiarch"] = true,
|
||||
["-x"] = true,
|
||||
["-time"] = true,
|
||||
["-Xassembler"] = true,
|
||||
["-pipe"] = true,
|
||||
["-pass-exit-codes"] = true
|
||||
}
|
||||
}
|
||||
}
|
||||
77
.xmake/windows/x64/cache/history
vendored
77
.xmake/windows/x64/cache/history
vendored
@ -1,69 +1,24 @@
|
||||
{
|
||||
cmdlines = {
|
||||
"xmake ",
|
||||
[[xmake l c:\Users\anonymous\.vscode\extensions\tboox.xmake-vscode-2.4.1\assets\config.lua]],
|
||||
[[xmake l c:\Users\anonymous\.vscode\extensions\tboox.xmake-vscode-2.4.1\assets\update_intellisense.lua .vscode clangd]],
|
||||
"xmake check",
|
||||
[[xmake l c:\Users\anonymous\.vscode\extensions\tboox.xmake-vscode-2.4.1\assets\explorer.lua]],
|
||||
[[xmake l c:\Users\anonymous\.vscode\extensions\tboox.xmake-vscode-2.4.1\assets\update_intellisense.lua .vscode clangd]],
|
||||
[[xmake l c:\Users\anonymous\.vscode\extensions\tboox.xmake-vscode-2.4.1\assets\config.lua]],
|
||||
[[xmake l c:\Users\anonymous\.vscode\extensions\tboox.xmake-vscode-2.4.1\assets\explorer.lua]],
|
||||
[[xmake l c:\Users\anonymous\.vscode\extensions\tboox.xmake-vscode-2.4.1\assets\config.lua]],
|
||||
[[xmake l c:\Users\anonymous\.vscode\extensions\tboox.xmake-vscode-2.4.1\assets\update_intellisense.lua .vscode clangd]],
|
||||
[[xmake l c:\Users\anonymous\.vscode\extensions\tboox.xmake-vscode-2.4.1\assets\explorer.lua]],
|
||||
[[xmake l c:\Users\anonymous\.vscode\extensions\tboox.xmake-vscode-2.4.1\assets\update_intellisense.lua .vscode clangd]],
|
||||
[[xmake l c:\Users\anonymous\.vscode\extensions\tboox.xmake-vscode-2.4.1\assets\config.lua]],
|
||||
[[xmake l c:\Users\anonymous\.vscode\extensions\tboox.xmake-vscode-2.4.1\assets\update_intellisense.lua .vscode clangd]],
|
||||
"xmake check",
|
||||
"xmake ",
|
||||
"xmake ",
|
||||
[[xmake l c:\Users\anonymous\.vscode\extensions\tboox.xmake-vscode-2.4.1\assets\config.lua]],
|
||||
[[xmake l c:\Users\anonymous\.vscode\extensions\tboox.xmake-vscode-2.4.1\assets\explorer.lua]],
|
||||
"xmake check",
|
||||
[[xmake l c:\Users\anonymous\.vscode\extensions\tboox.xmake-vscode-2.4.1\assets\config.lua]],
|
||||
"xmake f -c",
|
||||
"xmake f --toolchain=mingw64",
|
||||
"xmake ",
|
||||
[[xmake lua "C:\\Program Files\\xmake\\modules\\private\\utils\\statistics.lua"]],
|
||||
[[xmake lua "C:\\Program Files\\xmake\\actions\\build\\cleaner.lua"]],
|
||||
"xmake ",
|
||||
"xmake ",
|
||||
"xmake ",
|
||||
"xmake ",
|
||||
"xmake ",
|
||||
"xmake ",
|
||||
"xmake ",
|
||||
"xmake ",
|
||||
"xmake ",
|
||||
"xmake ",
|
||||
"xmake ",
|
||||
"xmake ",
|
||||
"xmake ",
|
||||
"xmake ",
|
||||
"xmake ",
|
||||
"xmake ",
|
||||
"xmake ",
|
||||
"xmake ",
|
||||
"xmake ",
|
||||
"xmake ",
|
||||
"xmake ",
|
||||
"xmake ",
|
||||
"xmake ",
|
||||
"xmake ",
|
||||
"xmake ",
|
||||
"xmake ",
|
||||
"xmake ",
|
||||
"xmake ",
|
||||
"xmake ",
|
||||
"xmake ",
|
||||
[[xmake l c:\Users\anonymous\.vscode\extensions\tboox.xmake-vscode-2.4.1\assets\explorer.lua]],
|
||||
[[xmake l c:\Users\anonymous\.vscode\extensions\tboox.xmake-vscode-2.4.1\assets\config.lua]],
|
||||
"xmake ",
|
||||
"xmake ",
|
||||
"xmake ",
|
||||
"xmake ",
|
||||
"xmake ",
|
||||
"xmake ",
|
||||
"xmake ",
|
||||
"xmake ",
|
||||
"xmake ",
|
||||
"xmake ",
|
||||
"xmake ",
|
||||
"xmake ",
|
||||
"xmake ",
|
||||
"xmake ",
|
||||
"xmake ",
|
||||
"xmake ",
|
||||
"xmake ",
|
||||
"xmake ",
|
||||
"xmake ",
|
||||
"xmake ",
|
||||
"xmake ",
|
||||
"xmake "
|
||||
"xmake check"
|
||||
}
|
||||
}
|
||||
48
.xmake/windows/x64/cache/toolchain
vendored
48
.xmake/windows/x64/cache/toolchain
vendored
@ -1,38 +1,38 @@
|
||||
{
|
||||
tool_target_UniversalCanCore_windows_x64_ld = {
|
||||
program = "c:/applications/program custom/msys2/mingw64/bin/g++.exe",
|
||||
toolchain_info = {
|
||||
cachekey = "mingw64_arch_x64_plat_windows",
|
||||
plat = "windows",
|
||||
name = "mingw64",
|
||||
arch = "x64"
|
||||
},
|
||||
toolname = "gxx"
|
||||
},
|
||||
mingw64_arch_x64_plat_windows = {
|
||||
__global = true,
|
||||
plat = "windows",
|
||||
arch = "x64",
|
||||
__checked = true
|
||||
},
|
||||
tool_target_UniversalCanCore_windows_x64_cxx = {
|
||||
program = "c:/applications/program custom/msys2/mingw64/bin/g++.exe",
|
||||
toolname = "gxx",
|
||||
toolchain_info = {
|
||||
cachekey = "mingw64_arch_x64_plat_windows",
|
||||
plat = "windows",
|
||||
name = "mingw64",
|
||||
arch = "x64"
|
||||
},
|
||||
toolname = "gxx"
|
||||
arch = "x64",
|
||||
name = "mingw64"
|
||||
}
|
||||
},
|
||||
tool_target_UniversalCanCore_windows_x64_cc = {
|
||||
program = "c:/applications/program custom/msys2/mingw64/bin/gcc.exe",
|
||||
toolname = "gcc",
|
||||
toolchain_info = {
|
||||
cachekey = "mingw64_arch_x64_plat_windows",
|
||||
plat = "windows",
|
||||
name = "mingw64",
|
||||
arch = "x64"
|
||||
},
|
||||
toolname = "gcc"
|
||||
arch = "x64",
|
||||
name = "mingw64"
|
||||
}
|
||||
},
|
||||
mingw64_arch_x64_plat_windows = {
|
||||
arch = "x64",
|
||||
plat = "windows",
|
||||
__global = true,
|
||||
__checked = true
|
||||
},
|
||||
tool_target_UniversalCanCore_windows_x64_ld = {
|
||||
program = "c:/applications/program custom/msys2/mingw64/bin/g++.exe",
|
||||
toolname = "gxx",
|
||||
toolchain_info = {
|
||||
cachekey = "mingw64_arch_x64_plat_windows",
|
||||
plat = "windows",
|
||||
arch = "x64",
|
||||
name = "mingw64"
|
||||
}
|
||||
}
|
||||
}
|
||||
BIN
Device/ScHHS/HCanbus.dll
Normal file
BIN
Device/ScHHS/HCanbus.dll
Normal file
Binary file not shown.
119
Device/ScHHS/HCanbus.h
Normal file
119
Device/ScHHS/HCanbus.h
Normal file
@ -0,0 +1,119 @@
|
||||
|
||||
#ifndef HCANBUS_H
|
||||
#define HCANBUS_H
|
||||
|
||||
#if defined(_WIN32) || defined(__CYGWIN__) || defined(_WIN32_WCE)
|
||||
#define LIBUSB_CALL WINAPI
|
||||
#else
|
||||
#define LIBUSB_CALL
|
||||
#endif
|
||||
|
||||
typedef struct _Dev_Info {
|
||||
char HW_Type[32]; //设备型号 字符串
|
||||
char HW_Ser[32]; //设备序列号 字符串
|
||||
char HW_Ver[32]; //硬件版本 字符串
|
||||
char FW_Ver[32]; //软件版本 字符串
|
||||
char MF_Date[32]; //生产日期 字符串
|
||||
} Dev_Info, *PDev_Info;
|
||||
|
||||
typedef struct _Can_Config {
|
||||
unsigned int Baudrate;
|
||||
unsigned char Config; //配置信息:0x01接通内部电阻 0x02离线唤醒 0x04自动重传
|
||||
unsigned char Pres; // Pres,Tseg1,Tseg2如果与Baudrate不匹配,动态库会自动按
|
||||
unsigned char Tseg1; // Baudrate重新计算Pres,Tseg1,Tseg2,SJW并且采样点设置为
|
||||
unsigned char Tseg2; // 75%左右。一般情况可以只设置波特率,Pres,Tseg1,Tseg2填0
|
||||
unsigned char Model; //工作模式:0 正常模式,1 环回模式,2 静默模式,3 静默环回模式
|
||||
unsigned char SJW;
|
||||
unsigned char Reserved1; //保留
|
||||
unsigned char Reserved2;
|
||||
}Can_Config, *P_Can_Config;
|
||||
|
||||
typedef struct _CanFD_Config {
|
||||
unsigned int NomBaud; //常规波特率
|
||||
unsigned int DatBaud; //数据波特率
|
||||
unsigned char NomPre; // NomPre,NomTseg1,NomTseg2如果与NomBaud不匹配,动态库会自动按
|
||||
unsigned char NomTseg1; // NomBaud重新计算NomPre,NomTseg1,NomTseg2,NomSJW并且采样点设置为
|
||||
unsigned char NomTseg2; // 75%左右。这些值可借助波特率计算器计算后设置
|
||||
unsigned char NomSJW;
|
||||
unsigned char DatPre; // DatPre,DatTseg1,DatTseg2如果与DatBaud不匹配,动态库会自动按
|
||||
unsigned char DatTseg1; // DatBaud重新计算DatPre,DatTseg1,DatTseg2,DatSJW并且采样点设置为
|
||||
unsigned char DatTseg2; // 75%左右。这些值可借助波特率计算器计算后设置
|
||||
unsigned char DatSJW;
|
||||
unsigned char Config; //配置信息:0x01接通内部电阻 0x02离线唤醒 0x04自动重传
|
||||
unsigned char Model; //工作模式:0 正常模式,1 环回模式,2 静默模式,3 静默环回模式
|
||||
unsigned char Cantype; //CAN模式:0 CAN,1 IOS CANFD,2 Non-ISO CANFD
|
||||
unsigned char Reserved; //保留
|
||||
}CanFD_Config, *P_CanFD_Config;
|
||||
|
||||
typedef struct _Can_Msg {
|
||||
unsigned int ID; //报文ID
|
||||
unsigned int TimeStamp; //微秒级时间戳
|
||||
unsigned char FrameType; //帧类型
|
||||
unsigned char DataLen; //有效字节数
|
||||
unsigned char Data[8]; //报文数据
|
||||
unsigned char ExternFlag; //扩展帧标识:0标准帧,1扩展帧
|
||||
unsigned char RemoteFlag; //远程帧标识:0数据帧,1远程帧
|
||||
unsigned char BusSatus; //总线状态
|
||||
unsigned char ErrSatus; //错误状态
|
||||
unsigned char TECounter; //发送错误计数
|
||||
unsigned char RECounter; //接收错误计数
|
||||
}Can_Msg, *P_Can_Msg;
|
||||
|
||||
typedef struct _CanFD_Msg {
|
||||
unsigned int ID; //报文ID
|
||||
unsigned int TimeStamp; //微秒级时间戳
|
||||
unsigned char FrameType; //帧类型
|
||||
unsigned char DLC; //DLC不等于数据长度。最大值15,对于数据长度64
|
||||
unsigned char ExternFlag; //扩展帧标识:0标准帧,1扩展帧
|
||||
unsigned char RemoteFlag; //远程帧标识:0数据帧,1远程帧
|
||||
unsigned char BusSatus; //总线状态
|
||||
unsigned char ErrSatus; //错误状态
|
||||
unsigned char TECounter; //发送错误计数
|
||||
unsigned char RECounter; //接收错误计数
|
||||
unsigned char Data[64]; //报文数据
|
||||
}CanFD_Msg, *P_CanFD_Msg;
|
||||
|
||||
typedef struct _Can_Status {
|
||||
unsigned char BusSatus; //总线状态
|
||||
unsigned char ErrSatus; //错误状态
|
||||
unsigned char TECounter; //发送错误计数
|
||||
unsigned char RECounter; //接收错误计数
|
||||
unsigned int TimeStamp; //产生状态时的时间戳
|
||||
}Can_Status, *P_Can_Status;
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
int __stdcall Reg_HotPlug_Func(void(*pfunc)(void)); //热拔插函数
|
||||
int __stdcall CAN_ScanDevice(void); //扫描CAN,CANFD设备
|
||||
int __stdcall CAN_GeDevType(unsigned int devNum); //获取CAN,CANFD类型 0:常规CAN,1:CANFD
|
||||
int __stdcall CAN_GeDevPlck(unsigned int devNum); //获取CAN,CANFD主频
|
||||
|
||||
int __stdcall CAN_OpenDevice(unsigned int devNum); //打开CAN,CANFD设备
|
||||
int __stdcall CAN_CloseDevice(unsigned int devNum); //关闭CAN,CANFD设备
|
||||
int __stdcall CAN_ReadDevInfo(unsigned int devNum, PDev_Info devinfo); //读取CAN,CANFD设备信息
|
||||
|
||||
int __stdcall CAN_SetFilter(unsigned int devNum,char namber, char type, unsigned int ftID, unsigned int ftMask, char enable); //设置CAN,CANFD硬件屏蔽
|
||||
int __stdcall CAN_Reset(unsigned int devNum); //复位CAN,CANFD设备
|
||||
int __stdcall CAN_GetStatus(unsigned int devNum,P_Can_Status status); //获取CAN,CANFD设备状态
|
||||
|
||||
int __stdcall CAN_Init(unsigned int devNum,P_Can_Config pInitConfig); //初始化CAN设备
|
||||
int __stdcall CAN_Transmit(unsigned int devNum, P_Can_Msg canmsg, unsigned int items, int timeou); //发送CAN报文
|
||||
int __stdcall CAN_TransmitRt(unsigned int devNum, P_Can_Msg canmsg, unsigned int items, unsigned int *txitems, int timeou); //定时发送CAN报文
|
||||
int __stdcall CAN_GetReceiveNum(unsigned int devNum); //获取接收缓冲区中接收到但尚未被读取的帧数量
|
||||
int __stdcall CAN_Receive(unsigned int devNum,P_Can_Msg canmsg, int Len, int timeou); //接收CAN报文
|
||||
|
||||
int __stdcall CANFD_Init(unsigned int devNum, P_CanFD_Config pInitConfig);
|
||||
int __stdcall CANFD_Transmit(unsigned int devNum, P_CanFD_Msg canmsg, unsigned int items, int timeout);
|
||||
int __stdcall CANFD_TransmitRt(unsigned int devNum, P_CanFD_Msg canmsg, unsigned int items, unsigned int *txitems, int timeou); //定时发送CAN报文
|
||||
int __stdcall CANFD_GetReceiveNum(unsigned int devNum);//获取接收缓冲区中接收到但尚未被读取的帧数量
|
||||
int __stdcall CANFD_Receive(unsigned int devNum, P_CanFD_Msg canmsg, unsigned int Len, int timeout); //接收CANFD报文
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
BIN
Device/ScHHS/HCanbus.lib
Normal file
BIN
Device/ScHHS/HCanbus.lib
Normal file
Binary file not shown.
3
Device/ScHHS/Port/ScHHS.cpp
Normal file
3
Device/ScHHS/Port/ScHHS.cpp
Normal file
@ -0,0 +1,3 @@
|
||||
#include "ScHHS.h"
|
||||
|
||||
|
||||
8
Device/ScHHS/Port/ScHHS.h
Normal file
8
Device/ScHHS/Port/ScHHS.h
Normal file
@ -0,0 +1,8 @@
|
||||
#ifndef __SCHHS_H__
|
||||
#define __SCHHS_H__
|
||||
|
||||
#include "HCanbus.h"
|
||||
|
||||
|
||||
|
||||
#endif
|
||||
BIN
Device/Zlg/ControlCAN.dll
Normal file
BIN
Device/Zlg/ControlCAN.dll
Normal file
Binary file not shown.
262
Device/Zlg/ControlCAN.h
Normal file
262
Device/Zlg/ControlCAN.h
Normal file
@ -0,0 +1,262 @@
|
||||
#ifndef CONTROLCAN_H
|
||||
#define CONTROLCAN_H
|
||||
|
||||
//接口卡类型定义
|
||||
#define VCI_PCI5121 1
|
||||
#define VCI_PCI9810 2
|
||||
#define VCI_USBCAN1 3
|
||||
#define VCI_USBCAN2 4
|
||||
#define VCI_USBCAN2A 4
|
||||
#define VCI_PCI9820 5
|
||||
#define VCI_CAN232 6
|
||||
#define VCI_PCI5110 7
|
||||
#define VCI_CANLITE 8
|
||||
#define VCI_ISA9620 9
|
||||
#define VCI_ISA5420 10
|
||||
#define VCI_PC104CAN 11
|
||||
#define VCI_CANETUDP 12
|
||||
#define VCI_CANETE 12
|
||||
#define VCI_DNP9810 13
|
||||
#define VCI_PCI9840 14
|
||||
#define VCI_PC104CAN2 15
|
||||
#define VCI_PCI9820I 16
|
||||
#define VCI_CANETTCP 17
|
||||
#define VCI_PEC9920 18
|
||||
#define VCI_PCIE_9220 18
|
||||
#define VCI_PCI5010U 19
|
||||
#define VCI_USBCAN_E_U 20
|
||||
#define VCI_USBCAN_2E_U 21
|
||||
#define VCI_PCI5020U 22
|
||||
#define VCI_EG20T_CAN 23
|
||||
#define VCI_PCIE9221 24
|
||||
#define VCI_WIFICAN_TCP 25
|
||||
#define VCI_WIFICAN_UDP 26
|
||||
#define VCI_PCIe9120 27
|
||||
#define VCI_PCIe9110 28
|
||||
#define VCI_PCIe9140 29
|
||||
#define VCI_USBCAN_4E_U 31
|
||||
#define VCI_CANDTU_200UR 32
|
||||
#define VCI_CANDTU_MINI 33
|
||||
#define VCI_USBCAN_8E_U 34
|
||||
#define VCI_CANREPLAY 35
|
||||
#define VCI_CANDTU_NET 36
|
||||
#define VCI_CANDTU_100UR 37
|
||||
|
||||
//CAN错误码
|
||||
#define ERR_CAN_OVERFLOW 0x0001 //CAN控制器内部FIFO溢出
|
||||
#define ERR_CAN_ERRALARM 0x0002 //CAN控制器错误报警
|
||||
#define ERR_CAN_PASSIVE 0x0004 //CAN控制器消极错误
|
||||
#define ERR_CAN_LOSE 0x0008 //CAN控制器仲裁丢失
|
||||
#define ERR_CAN_BUSERR 0x0010 //CAN控制器总线错误
|
||||
#define ERR_CAN_BUSOFF 0x0020 //总线关闭错误
|
||||
#define ERR_CAN_BUFFER_OVERFLOW 0x0040 //CAN控制器内部BUFFER溢出
|
||||
//通用错误码
|
||||
#define ERR_DEVICEOPENED 0x0100 //设备已经打开
|
||||
#define ERR_DEVICEOPEN 0x0200 //打开设备错误
|
||||
#define ERR_DEVICENOTOPEN 0x0400 //设备没有打开
|
||||
#define ERR_BUFFEROVERFLOW 0x0800 //缓冲区溢出
|
||||
#define ERR_DEVICENOTEXIST 0x1000 //此设备不存在
|
||||
#define ERR_LOADKERNELDLL 0x2000 //装载动态库失败
|
||||
#define ERR_CMDFAILED 0x4000 //执行命令失败错误码
|
||||
#define ERR_BUFFERCREATE 0x8000 //内存不足
|
||||
|
||||
//CANET错误码
|
||||
#define ERR_CANETE_PORTOPENED 0x00010000 //端口已经被打开
|
||||
#define ERR_CANETE_INDEXUSED 0x00020000 //设备索引号已经被占用
|
||||
#define ERR_REF_TYPE_ID 0x00030000 //SetReference或GetReference传递的RefType不存在
|
||||
#define ERR_CREATE_SOCKET 0x00030002 //创建Socket失败
|
||||
#define ERR_OPEN_CONNECT 0x00030003 //打开Socket的连接时失败,可能设备连接已经存在
|
||||
#define ERR_NO_STARTUP 0x00030004 //设备没启动
|
||||
#define ERR_NO_CONNECTED 0x00030005 //设备无连接
|
||||
#define ERR_SEND_PARTIAL 0x00030006 //只发送了部分的CAN帧
|
||||
#define ERR_SEND_TOO_FAST 0x00030007 //数据发得太快,Socket缓冲区满了
|
||||
|
||||
//函数调用返回状态值
|
||||
#define STATUS_OK 1
|
||||
#define STATUS_ERR 0
|
||||
|
||||
#define CMD_DESIP 0
|
||||
#define CMD_DESPORT 1
|
||||
#define CMD_CHGDESIPANDPORT 2
|
||||
#define CMD_SRCPORT 2
|
||||
#define CMD_TCP_TYPE 4 //tcp 工作方式,服务器:1 或是客户端:0
|
||||
#define TCP_CLIENT 0
|
||||
#define TCP_SERVER 1
|
||||
//服务器方式下有效
|
||||
#define CMD_CLIENT_COUNT 5 //连接上的客户端计数
|
||||
#define CMD_CLIENT 6 //连接上的客户端
|
||||
#define CMD_DISCONN_CLINET 7 //断开一个连接
|
||||
#define CMD_SET_RECONNECT_TIME 8 //使能自动重连
|
||||
//CANDTU_NET支持GPS
|
||||
#define CMD_GET_GPS 9
|
||||
#define CMD_GET_GPS_NUM 10 //获取GPS信息的数目
|
||||
|
||||
typedef unsigned long DWORD, ULONG;
|
||||
typedef int INT;
|
||||
typedef void* HANDLE;
|
||||
typedef unsigned char BYTE;
|
||||
typedef unsigned short USHORT;
|
||||
typedef char CHAR;
|
||||
typedef unsigned int UINT;
|
||||
typedef unsigned char UCHAR;
|
||||
typedef unsigned short UINT16;
|
||||
typedef void* PVOID;
|
||||
|
||||
typedef struct tagRemoteClient{
|
||||
int iIndex;
|
||||
DWORD port;
|
||||
HANDLE hClient;
|
||||
char szip[32];
|
||||
}REMOTE_CLIENT;
|
||||
|
||||
typedef struct _tagChgDesIPAndPort
|
||||
{
|
||||
char szpwd[10];
|
||||
char szdesip[20];
|
||||
int desport;
|
||||
BYTE blistenonly;
|
||||
}CHGDESIPANDPORT;
|
||||
|
||||
//1.ZLGCAN系列接口卡信息的数据类型。
|
||||
typedef struct _VCI_BOARD_INFO{
|
||||
USHORT hw_Version;
|
||||
USHORT fw_Version;
|
||||
USHORT dr_Version;
|
||||
USHORT in_Version;
|
||||
USHORT irq_Num;
|
||||
BYTE can_Num;
|
||||
CHAR str_Serial_Num[20];
|
||||
CHAR str_hw_Type[40];
|
||||
USHORT Reserved[4];
|
||||
} VCI_BOARD_INFO,*PVCI_BOARD_INFO;
|
||||
|
||||
//2.定义CAN信息帧的数据类型。
|
||||
typedef struct _VCI_CAN_OBJ{
|
||||
UINT ID;
|
||||
UINT TimeStamp;
|
||||
BYTE TimeFlag;
|
||||
BYTE SendType;
|
||||
BYTE RemoteFlag;//是否是远程帧
|
||||
BYTE ExternFlag;//是否是扩展帧
|
||||
BYTE DataLen;
|
||||
BYTE Data[8];
|
||||
BYTE Reserved[3]; //Reserved[0] 第0位表示特殊的空行或者高亮帧
|
||||
}VCI_CAN_OBJ,*PVCI_CAN_OBJ;
|
||||
|
||||
//3.定义CAN控制器状态的数据类型。
|
||||
typedef struct _VCI_CAN_STATUS{
|
||||
UCHAR ErrInterrupt;
|
||||
UCHAR regMode;
|
||||
UCHAR regStatus;
|
||||
UCHAR regALCapture;
|
||||
UCHAR regECCapture;
|
||||
UCHAR regEWLimit;
|
||||
UCHAR regRECounter;
|
||||
UCHAR regTECounter;
|
||||
DWORD Reserved;
|
||||
}VCI_CAN_STATUS,*PVCI_CAN_STATUS;
|
||||
|
||||
//4.定义错误信息的数据类型。
|
||||
typedef struct _VCI_ERR_INFO{
|
||||
UINT ErrCode;
|
||||
BYTE Passive_ErrData[3];
|
||||
BYTE ArLost_ErrData;
|
||||
} VCI_ERR_INFO,*PVCI_ERR_INFO;
|
||||
|
||||
//5.定义初始化CAN的数据类型
|
||||
typedef struct _VCI_INIT_CONFIG{
|
||||
DWORD AccCode;
|
||||
DWORD AccMask;
|
||||
DWORD Reserved;
|
||||
UCHAR Filter;
|
||||
UCHAR Timing0;
|
||||
UCHAR Timing1;
|
||||
UCHAR Mode;
|
||||
}VCI_INIT_CONFIG,*PVCI_INIT_CONFIG;
|
||||
|
||||
///////// new add struct for filter /////////
|
||||
typedef struct _VCI_FILTER_RECORD{
|
||||
DWORD ExtFrame; //是否为扩展帧
|
||||
DWORD Start;
|
||||
DWORD End;
|
||||
}VCI_FILTER_RECORD,*PVCI_FILTER_RECORD;
|
||||
|
||||
//定时自动发送帧结构
|
||||
typedef struct _VCI_AUTO_SEND_OBJ{
|
||||
BYTE Enable; //使能本条报文 0:禁能 1:使能
|
||||
BYTE Index; //报文编号 最大支持32条报文
|
||||
DWORD Interval; //定时发送时间 1ms为单位
|
||||
VCI_CAN_OBJ obj; //报文
|
||||
}VCI_AUTO_SEND_OBJ,*PVCI_AUTO_SEND_OBJ;
|
||||
|
||||
//设置指示灯状态结构
|
||||
typedef struct _VCI_INDICATE_LIGHT{
|
||||
BYTE Indicate; //指示灯编号
|
||||
BYTE AttribRedMode:2; //Red LED灭/亮/闪烁/自控
|
||||
BYTE AttribGreenMode:2; //Green LED灭/亮/闪烁/自控
|
||||
BYTE AttribReserved:4; //保留暂时不用
|
||||
BYTE FrequenceRed:2; //Red LED闪烁频率
|
||||
BYTE FrequenceGreen:2; //Green LED闪烁频率
|
||||
BYTE FrequenceReserved:4; //保留暂时不用
|
||||
} VCI_INDICATE_LIGHT,*PVCI_INDICATE_LIGHT;
|
||||
|
||||
//设置转发结构
|
||||
typedef struct _VCI_CAN_OBJ_REDIRECT{
|
||||
BYTE Action; //标识开启或停止转发
|
||||
BYTE DestCanIndex; //CAN目标通道
|
||||
} VCI_CAN_OBJ_REDIRECT,*PVCI_CAN_OBJ_REDIRECT;
|
||||
|
||||
typedef struct _CANDTUTIME {
|
||||
UINT16 wYear;
|
||||
UINT16 wMonth;
|
||||
UINT16 wDay;
|
||||
UINT16 wHour;
|
||||
UINT16 wMinute;
|
||||
UINT16 wSecond;
|
||||
} CANDTUTIME;
|
||||
|
||||
//GPS数据结构
|
||||
typedef struct _tagCANDTUGPSData
|
||||
{
|
||||
float fLatitude; //纬度
|
||||
float fLongitude; //经度
|
||||
float fSpeed; //速度
|
||||
CANDTUTIME candtuTime;
|
||||
}CANDTUGPSData, *PCANDTUGPSData;
|
||||
|
||||
//获取GPS结构
|
||||
typedef struct _VCI_CANDTU_GPS_DATA
|
||||
{
|
||||
PCANDTUGPSData pGPSData; //用户提供接收GPS数据的缓冲区地址
|
||||
ULONG nGPSDataCnt; //可以容纳的GPS数据个数
|
||||
}VCI_CANDTU_GPS_DATA, *PVCI_CANDTU_GPS_DATA;
|
||||
|
||||
#ifdef __cplusplus
|
||||
#define EXTERNC extern "C"
|
||||
#define DEF(a) = a
|
||||
#else
|
||||
#define EXTERNC
|
||||
#define DEF(a)
|
||||
#endif
|
||||
|
||||
EXTERNC DWORD __stdcall VCI_OpenDevice(DWORD DeviceType,DWORD DeviceInd,DWORD Reserved);
|
||||
EXTERNC DWORD __stdcall VCI_CloseDevice(DWORD DeviceType,DWORD DeviceInd);
|
||||
EXTERNC DWORD __stdcall VCI_InitCAN(DWORD DeviceType, DWORD DeviceInd, DWORD CANInd, PVCI_INIT_CONFIG pInitConfig);
|
||||
|
||||
EXTERNC DWORD __stdcall VCI_ReadBoardInfo(DWORD DeviceType,DWORD DeviceInd,PVCI_BOARD_INFO pInfo);
|
||||
EXTERNC DWORD __stdcall VCI_ReadErrInfo(DWORD DeviceType,DWORD DeviceInd,DWORD CANInd,PVCI_ERR_INFO pErrInfo);
|
||||
EXTERNC DWORD __stdcall VCI_ReadCANStatus(DWORD DeviceType,DWORD DeviceInd,DWORD CANInd,PVCI_CAN_STATUS pCANStatus);
|
||||
|
||||
EXTERNC DWORD __stdcall VCI_GetReference(DWORD DeviceType,DWORD DeviceInd,DWORD CANInd,DWORD RefType,PVOID pData);
|
||||
EXTERNC DWORD __stdcall VCI_SetReference(DWORD DeviceType,DWORD DeviceInd,DWORD CANInd,DWORD RefType,PVOID pData);
|
||||
|
||||
EXTERNC ULONG __stdcall VCI_GetReceiveNum(DWORD DeviceType,DWORD DeviceInd,DWORD CANInd);
|
||||
EXTERNC DWORD __stdcall VCI_ClearBuffer(DWORD DeviceType,DWORD DeviceInd,DWORD CANInd);
|
||||
|
||||
EXTERNC DWORD __stdcall VCI_StartCAN(DWORD DeviceType,DWORD DeviceInd,DWORD CANInd);
|
||||
EXTERNC DWORD __stdcall VCI_ResetCAN(DWORD DeviceType,DWORD DeviceInd,DWORD CANInd);
|
||||
|
||||
EXTERNC ULONG __stdcall VCI_Transmit(DWORD DeviceType,DWORD DeviceInd,DWORD CANInd,PVCI_CAN_OBJ pSend,ULONG Len);
|
||||
EXTERNC ULONG __stdcall VCI_Receive(DWORD DeviceType,DWORD DeviceInd,DWORD CANInd,PVCI_CAN_OBJ pReceive,ULONG Len,INT WaitTime DEF(-1));
|
||||
|
||||
#endif
|
||||
BIN
Device/Zlg/ControlCAN.lib
Normal file
BIN
Device/Zlg/ControlCAN.lib
Normal file
Binary file not shown.
0
Device/Zlg/Port/Zlg.cpp
Normal file
0
Device/Zlg/Port/Zlg.cpp
Normal file
6
Device/Zlg/Port/Zlg.h
Normal file
6
Device/Zlg/Port/Zlg.h
Normal file
@ -0,0 +1,6 @@
|
||||
#ifndef __ZLG_H__
|
||||
#define __ZLG_H__
|
||||
|
||||
|
||||
|
||||
#endif
|
||||
BIN
Device/Zlg/kerneldlls/CANDTU_NET.dll
Normal file
BIN
Device/Zlg/kerneldlls/CANDTU_NET.dll
Normal file
Binary file not shown.
BIN
Device/Zlg/kerneldlls/CANETE.dll
Normal file
BIN
Device/Zlg/kerneldlls/CANETE.dll
Normal file
Binary file not shown.
BIN
Device/Zlg/kerneldlls/CANET_TCP.dll
Normal file
BIN
Device/Zlg/kerneldlls/CANET_TCP.dll
Normal file
Binary file not shown.
BIN
Device/Zlg/kerneldlls/CANWIFI_TCP.dll
Normal file
BIN
Device/Zlg/kerneldlls/CANWIFI_TCP.dll
Normal file
Binary file not shown.
BIN
Device/Zlg/kerneldlls/CANWIFI_UDP.dll
Normal file
BIN
Device/Zlg/kerneldlls/CANWIFI_UDP.dll
Normal file
Binary file not shown.
BIN
Device/Zlg/kerneldlls/USBCAN.dll
Normal file
BIN
Device/Zlg/kerneldlls/USBCAN.dll
Normal file
Binary file not shown.
BIN
Device/Zlg/kerneldlls/USBCAN_8E_U_x64.dll
Normal file
BIN
Device/Zlg/kerneldlls/USBCAN_8E_U_x64.dll
Normal file
Binary file not shown.
42
Device/Zlg/kerneldlls/kerneldll.ini
Normal file
42
Device/Zlg/kerneldlls/kerneldll.ini
Normal file
@ -0,0 +1,42 @@
|
||||
[KERNELDLL]
|
||||
COUNT=40
|
||||
1=PCI5121.dll
|
||||
2=PCI9810.dll
|
||||
3=USBCAN.dll
|
||||
4=USBCAN.dll
|
||||
5=PCI9820.dll
|
||||
6=CAN232.dll
|
||||
7=PCI5121.dll
|
||||
8=CANLite.dll
|
||||
9=ISA9620B.dll
|
||||
10=ISA5420.dll
|
||||
11=PC104CAN.dll
|
||||
12=CANETE.dll
|
||||
13=DNP9810B.dll
|
||||
14=PCI9840B.dll
|
||||
15=PC104C2.dll
|
||||
16=PCI9820I.dll
|
||||
17=CANET_TCP.dll
|
||||
18=pec9920.dll
|
||||
19=pci5010u.dll
|
||||
20=USBCAN_E_64.dll
|
||||
21=USBCAN_E_64.dll
|
||||
22=pci50xx_u_x64.dll
|
||||
23=topcliff_can_x64.dll
|
||||
24=pcie9221_X64.dll
|
||||
25=CANWIFI_TCP.dll
|
||||
26=CANWIFI_UDP.dll
|
||||
27=pcie9120.dll
|
||||
28=pcie9110.dll
|
||||
29=pcie9140.dll
|
||||
30=pci5010p_x64.dll
|
||||
31=USBCAN_4E_U_X64.dll
|
||||
32=CANDTU_x64.dll
|
||||
33=CANDTU_MINI_x64.dll
|
||||
34=USBCAN_8E_U_x64.dll
|
||||
35=CAN_REPLAY_x64.dll
|
||||
36=CANDTU_NET.dll
|
||||
37=CANDTU_x64.dll
|
||||
38=zpcfd_x64.dll
|
||||
39=zpcfd_x64.dll
|
||||
40=zpcfd_x64.dll
|
||||
BIN
Device/Zlg/kerneldlls/pci9810b.dll
Normal file
BIN
Device/Zlg/kerneldlls/pci9810b.dll
Normal file
Binary file not shown.
BIN
Device/Zlg/kerneldlls/pci9820b.dll
Normal file
BIN
Device/Zlg/kerneldlls/pci9820b.dll
Normal file
Binary file not shown.
BIN
Device/Zlg/kerneldlls/pci9820i.dll
Normal file
BIN
Device/Zlg/kerneldlls/pci9820i.dll
Normal file
Binary file not shown.
BIN
Device/Zlg/kerneldlls/pci9840b.dll
Normal file
BIN
Device/Zlg/kerneldlls/pci9840b.dll
Normal file
Binary file not shown.
BIN
Device/Zlg/kerneldlls/pcie9140_x64.dll
Normal file
BIN
Device/Zlg/kerneldlls/pcie9140_x64.dll
Normal file
Binary file not shown.
BIN
Device/Zlg/kerneldlls/pec9920.dll
Normal file
BIN
Device/Zlg/kerneldlls/pec9920.dll
Normal file
Binary file not shown.
16
Inc/CanProtocol.h
Normal file
16
Inc/CanProtocol.h
Normal file
@ -0,0 +1,16 @@
|
||||
#ifndef __CAN_PROTOCOL_H__
|
||||
#define __CAN_PROTOCOL_H__
|
||||
|
||||
#include "System.h"
|
||||
#include "HCanbus.h" //所有CAN使用这个结构体方便处理
|
||||
|
||||
#define SC_HHS 0
|
||||
#define ZLG 1
|
||||
#define GC 2
|
||||
#define PEAK_CAN 3
|
||||
|
||||
uint8_t CanOpen(uint8_t Product, int DeviceType, int Chnl, int Baud, int OtherTyp1, int OtherType2);
|
||||
void CanClose(void);
|
||||
void CanSendPkg(void);
|
||||
|
||||
#endif
|
||||
@ -1,6 +0,0 @@
|
||||
#ifndef __CAN_RECEIVE_TASK_H__
|
||||
#define __CAN_RECEIVE_TASK_H__
|
||||
|
||||
#include "System.h"
|
||||
|
||||
#endif
|
||||
@ -1,4 +1,5 @@
|
||||
#include "CanReceiveTask.h"
|
||||
#include "CanProtocol.h"
|
||||
#include "System.h"
|
||||
|
||||
// 一个任务函数,C 风格
|
||||
void Task1(void* param) {
|
||||
@ -25,4 +26,22 @@ void CanRecive(void)
|
||||
// 如果想模拟 FreeRTOS,通常任务一直运行,主函数也可以阻塞
|
||||
t1.join();
|
||||
t2.join();
|
||||
}
|
||||
|
||||
//打开CAN盒子,同时如果有初始化,这里也会初始化
|
||||
uint8_t CanOpen(uint8_t Product, int DeviceType, int Chnl, int Baud, int OtherTyp1, int OtherType2)
|
||||
{
|
||||
switch (Product)
|
||||
{
|
||||
case SC_HHS:
|
||||
break;
|
||||
case ZLG:
|
||||
break;
|
||||
case GC:
|
||||
break;
|
||||
case PEAK_CAN:
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -1,7 +1,7 @@
|
||||
#include <time.h>
|
||||
#include "SocketApiProtocol.h"
|
||||
|
||||
#define RECV_BUFFER_SIZE 26 //接收缓冲区大小
|
||||
#define RECV_BUFFER_SIZE 82 //接收缓冲区大小
|
||||
|
||||
#define PKG_CORE_STATUS 0x00 //读取核心状态
|
||||
#define PKG_CAN_STATUS 0x01 //CAN盒子状态
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
#include "CanReceiveTask.h" /* CAN接收任务 */
|
||||
#include "CanProtocol.h" /* CAN接收任务 */
|
||||
#include "SocketApiProtocol.h"
|
||||
|
||||
#define LISTEN_PORT 12345 //监听端口
|
||||
|
||||
BIN
build/.build_cache/01/01cffc828321a7947acacc75767abb9a
Normal file
BIN
build/.build_cache/01/01cffc828321a7947acacc75767abb9a
Normal file
Binary file not shown.
23
build/.build_cache/01/01cffc828321a7947acacc75767abb9a.txt
Normal file
23
build/.build_cache/01/01cffc828321a7947acacc75767abb9a.txt
Normal file
@ -0,0 +1,23 @@
|
||||
{
|
||||
errdata = "In file included from \27[01m\27[KPackages\\asio-1.36.0\\include/asio/any_completion_executor.hpp:18\27[m\27[K,\
|
||||
from \27[01m\27[KPackages\\asio-1.36.0\\include/asio.hpp:18\27[m\27[K,\
|
||||
from \27[01m\27[KInc/System.h:4\27[m\27[K,\
|
||||
from \27[01m\27[KInc/CanProtocol.h:4\27[m\27[K,\
|
||||
from \27[01m\27[KSrc\\CanProtocol.cpp:1\27[m\27[K:\
|
||||
\27[01m\27[KPackages\\asio-1.36.0\\include/asio/detail/config.hpp:748:5:\27[m\27[K \27[01;35m\27[Kwarning: \27[m\27[K#warning Please define _WIN32_WINNT or _WIN32_WINDOWS appropriately. [\27[01;35m\27[K-Wcpp\27[m\27[K]\
|
||||
748 | # \27[01;35m\27[Kwarning\27[m\27[K Please define _WIN32_WINNT or _WIN32_WINDOWS appropriately.\
|
||||
| \27[01;35m\27[K^~~~~~~\27[m\27[K\
|
||||
\27[01m\27[KPackages\\asio-1.36.0\\include/asio/detail/config.hpp:749:5:\27[m\27[K \27[01;35m\27[Kwarning: \27[m\27[K#warning For example, add -D_WIN32_WINNT=0x0601 to the compiler command line. [\27[01;35m\27[K-Wcpp\27[m\27[K]\
|
||||
749 | # \27[01;35m\27[Kwarning\27[m\27[K For example, add -D_WIN32_WINNT=0x0601 to the compiler command line.\
|
||||
| \27[01;35m\27[K^~~~~~~\27[m\27[K\
|
||||
\27[01m\27[KPackages\\asio-1.36.0\\include/asio/detail/config.hpp:750:5:\27[m\27[K \27[01;35m\27[Kwarning: \27[m\27[K#warning Assuming _WIN32_WINNT=0x0601 (i.e. Windows 7 target). [\27[01;35m\27[K-Wcpp\27[m\27[K]\
|
||||
750 | # \27[01;35m\27[Kwarning\27[m\27[K Assuming _WIN32_WINNT=0x0601 (i.e. Windows 7 target).\
|
||||
| \27[01;35m\27[K^~~~~~~\27[m\27[K\
|
||||
\27[01m\27[KSrc\\CanProtocol.cpp:\27[m\27[K In function '\27[01m\27[Kuint8_t\27[01;32m\27[K CanOpen\27[m\27[K(uint8_t, int, int, int, int, int)\27[m\27[K':\
|
||||
\27[01m\27[KSrc\\CanProtocol.cpp:47:1:\27[m\27[K \27[01;35m\27[Kwarning: \27[m\27[Kno return statement in function returning non-void [\27[01;35m\27[K-Wreturn-type\27[m\27[K]\
|
||||
47 | \27[01;35m\27[K}\27[m\27[K\
|
||||
| \27[01;35m\27[K^\27[m\27[K\
|
||||
At global scope:\
|
||||
\27[01m\27[Kcc1plus.exe:\27[m\27[K \27[01;36m\27[Knote: \27[m\27[Kunrecognized command-line option '\27[01m\27[K-Wno-gnu-line-marker\27[m\27[K' may have been intended to silence earlier diagnostics\
|
||||
"
|
||||
}
|
||||
BIN
build/.build_cache/3e/3e7d166244180d2209ef54ce9a8a0ec0
Normal file
BIN
build/.build_cache/3e/3e7d166244180d2209ef54ce9a8a0ec0
Normal file
Binary file not shown.
BIN
build/.build_cache/5c/5c1c93bb544c40d6571d5f636aa146e2
Normal file
BIN
build/.build_cache/5c/5c1c93bb544c40d6571d5f636aa146e2
Normal file
Binary file not shown.
BIN
build/.build_cache/70/70445d69d2047f3d2a2e6359ced0a3c4
Normal file
BIN
build/.build_cache/70/70445d69d2047f3d2a2e6359ced0a3c4
Normal file
Binary file not shown.
17
build/.build_cache/70/70445d69d2047f3d2a2e6359ced0a3c4.txt
Normal file
17
build/.build_cache/70/70445d69d2047f3d2a2e6359ced0a3c4.txt
Normal file
@ -0,0 +1,17 @@
|
||||
{
|
||||
errdata = "In file included from \27[01m\27[KPackages\\asio-1.36.0\\include/asio/any_completion_executor.hpp:18\27[m\27[K,\
|
||||
from \27[01m\27[KPackages\\asio-1.36.0\\include/asio.hpp:18\27[m\27[K,\
|
||||
from \27[01m\27[KInc/System.h:4\27[m\27[K,\
|
||||
from \27[01m\27[KInc/CanProtocol.h:4\27[m\27[K,\
|
||||
from \27[01m\27[KSrc\\main.cpp:1\27[m\27[K:\
|
||||
\27[01m\27[KPackages\\asio-1.36.0\\include/asio/detail/config.hpp:748:5:\27[m\27[K \27[01;35m\27[Kwarning: \27[m\27[K#warning Please define _WIN32_WINNT or _WIN32_WINDOWS appropriately. [\27[01;35m\27[K-Wcpp\27[m\27[K]\
|
||||
748 | # \27[01;35m\27[Kwarning\27[m\27[K Please define _WIN32_WINNT or _WIN32_WINDOWS appropriately.\
|
||||
| \27[01;35m\27[K^~~~~~~\27[m\27[K\
|
||||
\27[01m\27[KPackages\\asio-1.36.0\\include/asio/detail/config.hpp:749:5:\27[m\27[K \27[01;35m\27[Kwarning: \27[m\27[K#warning For example, add -D_WIN32_WINNT=0x0601 to the compiler command line. [\27[01;35m\27[K-Wcpp\27[m\27[K]\
|
||||
749 | # \27[01;35m\27[Kwarning\27[m\27[K For example, add -D_WIN32_WINNT=0x0601 to the compiler command line.\
|
||||
| \27[01;35m\27[K^~~~~~~\27[m\27[K\
|
||||
\27[01m\27[KPackages\\asio-1.36.0\\include/asio/detail/config.hpp:750:5:\27[m\27[K \27[01;35m\27[Kwarning: \27[m\27[K#warning Assuming _WIN32_WINNT=0x0601 (i.e. Windows 7 target). [\27[01;35m\27[K-Wcpp\27[m\27[K]\
|
||||
750 | # \27[01;35m\27[Kwarning\27[m\27[K Assuming _WIN32_WINNT=0x0601 (i.e. Windows 7 target).\
|
||||
| \27[01;35m\27[K^~~~~~~\27[m\27[K\
|
||||
"
|
||||
}
|
||||
BIN
build/.build_cache/85/85de886e47a0776289d35302c944f9aa
Normal file
BIN
build/.build_cache/85/85de886e47a0776289d35302c944f9aa
Normal file
Binary file not shown.
BIN
build/.build_cache/ae/ae308a330d6cdff14ae537df5f1279dd
Normal file
BIN
build/.build_cache/ae/ae308a330d6cdff14ae537df5f1279dd
Normal file
Binary file not shown.
17
build/.build_cache/ae/ae308a330d6cdff14ae537df5f1279dd.txt
Normal file
17
build/.build_cache/ae/ae308a330d6cdff14ae537df5f1279dd.txt
Normal file
@ -0,0 +1,17 @@
|
||||
{
|
||||
errdata = "In file included from \27[01m\27[KPackages\\asio-1.36.0\\include/asio/any_completion_executor.hpp:18\27[m\27[K,\
|
||||
from \27[01m\27[KPackages\\asio-1.36.0\\include/asio.hpp:18\27[m\27[K,\
|
||||
from \27[01m\27[KInc/System.h:4\27[m\27[K,\
|
||||
from \27[01m\27[KInc/CanProtocol.h:4\27[m\27[K,\
|
||||
from \27[01m\27[KSrc\\main.cpp:1\27[m\27[K:\
|
||||
\27[01m\27[KPackages\\asio-1.36.0\\include/asio/detail/config.hpp:748:5:\27[m\27[K \27[01;35m\27[Kwarning: \27[m\27[K#warning Please define _WIN32_WINNT or _WIN32_WINDOWS appropriately. [\27[01;35m\27[K-Wcpp\27[m\27[K]\
|
||||
748 | # \27[01;35m\27[Kwarning\27[m\27[K Please define _WIN32_WINNT or _WIN32_WINDOWS appropriately.\
|
||||
| \27[01;35m\27[K^~~~~~~\27[m\27[K\
|
||||
\27[01m\27[KPackages\\asio-1.36.0\\include/asio/detail/config.hpp:749:5:\27[m\27[K \27[01;35m\27[Kwarning: \27[m\27[K#warning For example, add -D_WIN32_WINNT=0x0601 to the compiler command line. [\27[01;35m\27[K-Wcpp\27[m\27[K]\
|
||||
749 | # \27[01;35m\27[Kwarning\27[m\27[K For example, add -D_WIN32_WINNT=0x0601 to the compiler command line.\
|
||||
| \27[01;35m\27[K^~~~~~~\27[m\27[K\
|
||||
\27[01m\27[KPackages\\asio-1.36.0\\include/asio/detail/config.hpp:750:5:\27[m\27[K \27[01;35m\27[Kwarning: \27[m\27[K#warning Assuming _WIN32_WINNT=0x0601 (i.e. Windows 7 target). [\27[01;35m\27[K-Wcpp\27[m\27[K]\
|
||||
750 | # \27[01;35m\27[Kwarning\27[m\27[K Assuming _WIN32_WINNT=0x0601 (i.e. Windows 7 target).\
|
||||
| \27[01;35m\27[K^~~~~~~\27[m\27[K\
|
||||
"
|
||||
}
|
||||
BIN
build/.build_cache/d1/d1e40b76da381e98aadf878a0fea94c2
Normal file
BIN
build/.build_cache/d1/d1e40b76da381e98aadf878a0fea94c2
Normal file
Binary file not shown.
17
build/.build_cache/d1/d1e40b76da381e98aadf878a0fea94c2.txt
Normal file
17
build/.build_cache/d1/d1e40b76da381e98aadf878a0fea94c2.txt
Normal file
@ -0,0 +1,17 @@
|
||||
{
|
||||
errdata = "In file included from \27[01m\27[KPackages\\asio-1.36.0\\include/asio/any_completion_executor.hpp:18\27[m\27[K,\
|
||||
from \27[01m\27[KPackages\\asio-1.36.0\\include/asio.hpp:18\27[m\27[K,\
|
||||
from \27[01m\27[KInc/System.h:4\27[m\27[K,\
|
||||
from \27[01m\27[KInc/CanProtocol.h:4\27[m\27[K,\
|
||||
from \27[01m\27[KSrc\\main.cpp:1\27[m\27[K:\
|
||||
\27[01m\27[KPackages\\asio-1.36.0\\include/asio/detail/config.hpp:748:5:\27[m\27[K \27[01;35m\27[Kwarning: \27[m\27[K#warning Please define _WIN32_WINNT or _WIN32_WINDOWS appropriately. [\27[01;35m\27[K-Wcpp\27[m\27[K]\
|
||||
748 | # \27[01;35m\27[Kwarning\27[m\27[K Please define _WIN32_WINNT or _WIN32_WINDOWS appropriately.\
|
||||
| \27[01;35m\27[K^~~~~~~\27[m\27[K\
|
||||
\27[01m\27[KPackages\\asio-1.36.0\\include/asio/detail/config.hpp:749:5:\27[m\27[K \27[01;35m\27[Kwarning: \27[m\27[K#warning For example, add -D_WIN32_WINNT=0x0601 to the compiler command line. [\27[01;35m\27[K-Wcpp\27[m\27[K]\
|
||||
749 | # \27[01;35m\27[Kwarning\27[m\27[K For example, add -D_WIN32_WINNT=0x0601 to the compiler command line.\
|
||||
| \27[01;35m\27[K^~~~~~~\27[m\27[K\
|
||||
\27[01m\27[KPackages\\asio-1.36.0\\include/asio/detail/config.hpp:750:5:\27[m\27[K \27[01;35m\27[Kwarning: \27[m\27[K#warning Assuming _WIN32_WINNT=0x0601 (i.e. Windows 7 target). [\27[01;35m\27[K-Wcpp\27[m\27[K]\
|
||||
750 | # \27[01;35m\27[Kwarning\27[m\27[K Assuming _WIN32_WINNT=0x0601 (i.e. Windows 7 target).\
|
||||
| \27[01;35m\27[K^~~~~~~\27[m\27[K\
|
||||
"
|
||||
}
|
||||
BIN
build/.build_cache/ff/ffce00e850ab21e5001230195ffa6755
Normal file
BIN
build/.build_cache/ff/ffce00e850ab21e5001230195ffa6755
Normal file
Binary file not shown.
@ -0,0 +1,20 @@
|
||||
{
|
||||
depfiles = "ScHHS.o: Device\\ScHHS\\Port\\ScHHS.cpp Device\\ScHHS\\Port\\ScHHS.h Device\\ScHHS/HCanbus.h\
|
||||
",
|
||||
values = {
|
||||
"c:/applications/program custom/msys2/mingw64/bin/g++.exe",
|
||||
{
|
||||
"-std=c++17",
|
||||
"-IInc",
|
||||
[[-IPackages\asio-1.36.0\include]],
|
||||
[[-IDevice\ScHHS]],
|
||||
[[-IDevice\ScHHS\Port]],
|
||||
[[-IDevice\Zlg\Port]],
|
||||
"-fexceptions"
|
||||
}
|
||||
},
|
||||
files = {
|
||||
[[Device\ScHHS\Port\ScHHS.cpp]]
|
||||
},
|
||||
depfiles_format = "gcc"
|
||||
}
|
||||
@ -0,0 +1,20 @@
|
||||
{
|
||||
depfiles = "Zlg.o: Device\\Zlg\\Port\\Zlg.cpp\
|
||||
",
|
||||
values = {
|
||||
"c:/applications/program custom/msys2/mingw64/bin/g++.exe",
|
||||
{
|
||||
"-std=c++17",
|
||||
"-IInc",
|
||||
[[-IPackages\asio-1.36.0\include]],
|
||||
[[-IDevice\ScHHS]],
|
||||
[[-IDevice\ScHHS\Port]],
|
||||
[[-IDevice\Zlg\Port]],
|
||||
"-fexceptions"
|
||||
}
|
||||
},
|
||||
files = {
|
||||
[[Device\Zlg\Port\Zlg.cpp]]
|
||||
},
|
||||
depfiles_format = "gcc"
|
||||
}
|
||||
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@ -1,6 +1,8 @@
|
||||
{
|
||||
files = {
|
||||
[[build\.objs\UniversalCanCore\windows\x64\release\Src\CanReceiveTask.cpp.obj]],
|
||||
[[build\.objs\UniversalCanCore\windows\x64\release\Device\ScHHS\Port\ScHHS.cpp.obj]],
|
||||
[[build\.objs\UniversalCanCore\windows\x64\release\Device\Zlg\Port\Zlg.cpp.obj]],
|
||||
[[build\.objs\UniversalCanCore\windows\x64\release\Src\CanProtocol.cpp.obj]],
|
||||
[[build\.objs\UniversalCanCore\windows\x64\release\Src\main.cpp.obj]],
|
||||
[[build\.objs\UniversalCanCore\windows\x64\release\Src\SocketApiProtocol.cpp.obj]],
|
||||
[[build\.objs\UniversalCanCore\windows\x64\release\Src\System.cpp.obj]]
|
||||
@ -8,6 +10,8 @@
|
||||
values = {
|
||||
"c:/applications/program custom/msys2/mingw64/bin/g++.exe",
|
||||
{
|
||||
[[-LDevice\ScHHS]],
|
||||
"-lHCanbus",
|
||||
"-lws2_32"
|
||||
}
|
||||
}
|
||||
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
4
test.txt
4
test.txt
@ -1,4 +1,4 @@
|
||||
1、读取核心状态
|
||||
55 00 E9 07 01 01 01 01 01 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 AA
|
||||
55 00 E9 07 01 01 01 01 01 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 AA
|
||||
1、获取控制权限
|
||||
55 FF E9 07 01 01 01 01 01 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 AA
|
||||
55 FF E9 07 01 01 01 01 01 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 AA
|
||||
|
||||
11
xmake.lua
11
xmake.lua
@ -12,9 +12,16 @@ set_languages("c++17")
|
||||
target("UniversalCanCore")
|
||||
set_kind("binary") -- 静态库
|
||||
add_includedirs("Inc") -- 头文件目录
|
||||
add_includedirs("Packages/asio-1.36.0/include")
|
||||
add_includedirs("Packages/asio-1.36.0/include")
|
||||
add_includedirs("Device/ScHHS/") -- 四川何华盛的can盒子
|
||||
add_includedirs("Device/ScHHS/Port") -- 四川何华盛的can盒子port
|
||||
add_files("Device/ScHHS/Port/*.cpp") -- 源文件
|
||||
add_linkdirs("Device/ScHHS/") -- 链接.lib文件(注意:只写库名,不要扩展名)
|
||||
add_links("HCanbus") -- 假设库文件名为 HCANBus.lib
|
||||
add_includedirs("Device/Zlg/Port") -- zlg的can盒子
|
||||
add_files("Device/Zlg/Port/*.cpp") -- 源文件
|
||||
add_files("Src/*.cpp") -- 源文件
|
||||
add_links("ws2_32")
|
||||
add_links("ws2_32") -- 声明win32
|
||||
|
||||
-- 自定义 MinGW 工具链
|
||||
toolchain("mingw64")
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user