diff --git a/AnalyzerFrameTable.h b/AnalyzerFrameTable.h index 77cf872..97f45ea 100644 --- a/AnalyzerFrameTable.h +++ b/AnalyzerFrameTable.h @@ -5,7 +5,6 @@ #include #include #include "canal.h" -#include "canal_a.h" #include "messagetypes.h" diff --git a/Libraries/canal.lib b/Libraries/canal.lib new file mode 100644 index 0000000..1b36843 Binary files /dev/null and b/Libraries/canal.lib differ diff --git a/Libraries/canald.lib b/Libraries/canald.lib new file mode 100644 index 0000000..5c57c57 Binary files /dev/null and b/Libraries/canald.lib differ diff --git a/StreamFrameTable.h b/StreamFrameTable.h index 999f6d1..e274bce 100644 --- a/StreamFrameTable.h +++ b/StreamFrameTable.h @@ -5,7 +5,6 @@ #include #include #include "canal.h" -#include "canal_a.h" #include "messagetypes.h" diff --git a/can_usb.pro b/can_usb.pro index 69cad69..db62a02 100644 --- a/can_usb.pro +++ b/can_usb.pro @@ -13,7 +13,7 @@ TEMPLATE = app RC_ICONS = icon.ico -VERSION = 1.0.7 +VERSION = 1.0.8 QMAKE_TARGET_COMPANY = RUSOKU Technologies QMAKE_TARGET_PRODUCT = CANAL View QMAKE_TARGET_DESCRIPTION = Demo software for CANAL library @@ -57,7 +57,6 @@ HEADERS += \ messagetypes.h \ rxworkerthread.h \ portablesleep.h \ - canal_a.h \ txworkerthread.h \ dialogabout.h \ dialoginitstring.h @@ -71,21 +70,21 @@ FORMS += \ # QT_NO_CAST_TO_ASCII #INCLUDEPATH += "$$PWD/ucrt" -#LIBS += -L"$$PWD/Libraries" +LIBS += -L"$$PWD/Libraries" # Default rules for deployment. -qnx: target.path = /tmp/$${TARGET}/bin -else: unix:!android: target.path = /opt/$${TARGET}/bin -!isEmpty(target.path): INSTALLS += target - -contains(QT_ARCH, i386) { - CONFIG(release, debug|release): LIBS += -L$$PWD/Libraries -lcanal32 - CONFIG(debug, debug|release): LIBS += -L$$PWD/Libraries -lcanal32d - -} else { - CONFIG(release, debug|release): LIBS += -L$$PWD/Libraries -lcanal64 - CONFIG(debug, debug|release): LIBS += -L$$PWD/Libraries -lcanal64d -} +#qnx: target.path = /tmp/$${TARGET}/bin +#else: unix:!android: target.path = /opt/$${TARGET}/bin +#!isEmpty(target.path): INSTALLS += target + +#contains(QT_ARCH, i386) { + CONFIG(release, debug|release): LIBS += -L$$PWD/Libraries -lcanal + CONFIG(debug, debug|release): LIBS += -L$$PWD/Libraries -lcanald + +#} else { +# CONFIG(release, debug|release): LIBS += -L$$PWD/Libraries -lcanal +# CONFIG(debug, debug|release): LIBS += -L$$PWD/Libraries -lcanal +#} RESOURCES += \ resource.qrc diff --git a/can_usb.pro.user b/can_usb.pro.user index 9fd65cf..d2fdb8a 100644 --- a/can_usb.pro.user +++ b/can_usb.pro.user @@ -1,14 +1,14 @@ - + EnvironmentId - {a8408b7b-0c08-4dd7-961d-8fcdc51ab540} + {e7ed461c-089a-41cd-9475-4d3364226464} ProjectExplorer.Project.ActiveTarget - 0 + 0 ProjectExplorer.Project.EditorSettings @@ -28,7 +28,7 @@ QmlJSGlobal - 2 + 2 UTF-8 false 4 @@ -37,72 +37,82 @@ true true 1 + false true false - 2 + 0 true true 0 8 true + false 1 true true true + *.md, *.MD, Makefile false + true + true ProjectExplorer.Project.PluginSettings - - -fno-delayed-template-parsing - - true + + true + false + true + true + true + true + + + 0 + true + true true - Builtin.TidyAndClazy + Builtin.DefaultTidyAndClazy 4 - - C:/QTprojects/can_usb/can_usb.pro - + true + + false + true + ProjectExplorer.Project.Target.0 - Desktop Qt 5.14.2 MSVC2017 32bit - Desktop Qt 5.14.2 MSVC2017 32bit - qt.qt5.5142.win32_msvc2017_kit - 1 - 0 - 0 + Desktop + Desktop Qt 5.15.2 MSVC2019 64bit + Desktop Qt 5.15.2 MSVC2019 64bit + qt.qt5.5152.win64_msvc2019_64_kit + 1 + 0 + 0 - C:/QTprojects/build-can_usb-Desktop_Qt_5_14_2_MSVC2017_32bit-Debug + 0 + D:\Work\build-can_usb-Desktop_Qt_5_15_2_MSVC2019_64bit-Debug + D:/Work/build-can_usb-Desktop_Qt_5_15_2_MSVC2019_64bit-Debug true QtProjectManager.QMakeBuildStep - true - false - false - false + true Qt4ProjectManager.MakeStep - - false - - - false - 2 + 2 Build Build ProjectExplorer.BuildSteps.Build @@ -111,46 +121,37 @@ true Qt4ProjectManager.MakeStep - - true clean - - false - 1 + 1 Clean Clean ProjectExplorer.BuildSteps.Clean 2 false + + false Debug Qt4ProjectManager.Qt4BuildConfiguration 2 - C:/QTprojects/build-can_usb-Desktop_Qt_5_14_2_MSVC2017_32bit-Release + D:\Work\build-can_usb-Desktop_Qt_5_15_2_MSVC2019_64bit-Release + D:/Work/build-can_usb-Desktop_Qt_5_15_2_MSVC2019_64bit-Release true QtProjectManager.QMakeBuildStep - false - false - false - true + true Qt4ProjectManager.MakeStep - - false - - - false - 2 + 2 Build Build ProjectExplorer.BuildSteps.Build @@ -159,46 +160,39 @@ true Qt4ProjectManager.MakeStep - - true clean - - false - 1 + 1 Clean Clean ProjectExplorer.BuildSteps.Clean 2 false + + false Release Qt4ProjectManager.Qt4BuildConfiguration 0 + 0 - C:/QTprojects/build-can_usb-Desktop_Qt_5_14_2_MSVC2017_32bit-Profile + 0 + D:\Work\build-can_usb-Desktop_Qt_5_15_2_MSVC2019_64bit-Profile + D:/Work/build-can_usb-Desktop_Qt_5_15_2_MSVC2019_64bit-Profile true QtProjectManager.QMakeBuildStep - true - false - true - true + true Qt4ProjectManager.MakeStep - - false - - - false - 2 + 2 Build Build ProjectExplorer.BuildSteps.Build @@ -207,145 +201,412 @@ true Qt4ProjectManager.MakeStep - - true clean - - false - 1 + 1 Clean Clean ProjectExplorer.BuildSteps.Clean 2 false + + false Profile Qt4ProjectManager.Qt4BuildConfiguration 0 + 0 + 0 - 3 + 3 - 0 + 0 Deploy Deploy ProjectExplorer.BuildSteps.Deploy 1 + + false ProjectExplorer.DefaultDeployConfiguration - 1 - + 1 - dwarf - - cpu-cycles - - - 250 - - -e - cpu-cycles - --call-graph - dwarf,4096 - -F - 250 - - -F true - 4096 - false - false - 1000 - true - - false - false - false - false - true - 0.01 - 10 - true - kcachegrind - 1 - 25 - - 1 true - false - true - valgrind - - 0 - 1 - 2 - 3 - 4 - 5 - 6 - 7 - 8 - 9 - 10 - 11 - 12 - 13 - 14 - + 2 - Qt4ProjectManager.Qt4RunConfiguration:C:/QTprojects/can_usb/can_usb.pro - C:/QTprojects/can_usb/can_usb.pro - - false - + can_usb2 + Qt4ProjectManager.Qt4RunConfiguration:D:/Work/CANAL-View-1.0.8/can_usb.pro + D:/Work/CANAL-View-1.0.8/can_usb.pro false true true - false false true - - C:/QTprojects/build-can_usb-Desktop_Qt_5_14_2_MSVC2017_32bit-Release + D:/Work/build-can_usb-Desktop_Qt_5_15_2_MSVC2019_64bit-Release - 1 + 1 ProjectExplorer.Project.Target.1 - Desktop Qt 5.14.2 MSVC2017 64bit - Desktop Qt 5.14.2 MSVC2017 64bit - qt.qt5.5142.win64_msvc2017_64_kit - 1 - 0 - 0 + Desktop + Desktop Qt 5.15.2 MSVC2015 64bit + Desktop Qt 5.15.2 MSVC2015 64bit + qt.qt5.5152.win64_msvc2015_64_kit + 0 + 0 + 0 + + 0 + D:\Work\CANAL-View-1.0.7rc2\..\build-can_usb-Desktop_Qt_5_15_2_MSVC2015_64bit-Debug + D:/Work/build-can_usb-Desktop_Qt_5_15_2_MSVC2015_64bit-Debug + + + true + QtProjectManager.QMakeBuildStep + false + + + + true + Qt4ProjectManager.MakeStep + + 2 + Build + Build + ProjectExplorer.BuildSteps.Build + + + + true + Qt4ProjectManager.MakeStep + clean + + 1 + Clean + Clean + ProjectExplorer.BuildSteps.Clean + + 2 + false + + false + + Debug + Qt4ProjectManager.Qt4BuildConfiguration + 2 + + + D:\Work\CANAL-View-1.0.7rc2\..\build-can_usb-Desktop_Qt_5_15_2_MSVC2015_64bit-Release + D:/Work/build-can_usb-Desktop_Qt_5_15_2_MSVC2015_64bit-Release + + + true + QtProjectManager.QMakeBuildStep + false + + + + true + Qt4ProjectManager.MakeStep + + 2 + Build + Build + ProjectExplorer.BuildSteps.Build + + + + true + Qt4ProjectManager.MakeStep + clean + + 1 + Clean + Clean + ProjectExplorer.BuildSteps.Clean + + 2 + false + + false + + Release + Qt4ProjectManager.Qt4BuildConfiguration + 0 + 0 + + + 0 + D:\Work\CANAL-View-1.0.7rc2\..\build-can_usb-Desktop_Qt_5_15_2_MSVC2015_64bit-Profile + D:/Work/build-can_usb-Desktop_Qt_5_15_2_MSVC2015_64bit-Profile + + + true + QtProjectManager.QMakeBuildStep + false + + + + true + Qt4ProjectManager.MakeStep + + 2 + Build + Build + ProjectExplorer.BuildSteps.Build + + + + true + Qt4ProjectManager.MakeStep + clean + + 1 + Clean + Clean + ProjectExplorer.BuildSteps.Clean + + 2 + false + + false + + Profile + Qt4ProjectManager.Qt4BuildConfiguration + 0 + 0 + 0 + + 3 + + + 0 + Deploy + Deploy + ProjectExplorer.BuildSteps.Deploy + + 1 + + false + ProjectExplorer.DefaultDeployConfiguration + + 1 + + true + true + true + + 2 + + Qt4ProjectManager.Qt4RunConfiguration:D:/Work/CANAL-View-1.0.7rc2/can_usb.pro + D:/Work/CANAL-View-1.0.7rc2/can_usb.pro + false + true + true + false + true + + 1 + + + + ProjectExplorer.Project.Target.2 + + Desktop + Desktop Qt 5.15.2 MinGW 64-bit + Desktop Qt 5.15.2 MinGW 64-bit + qt.qt5.5152.win64_mingw81_kit + 0 + 0 + 0 + + 0 + D:\Work\CANAL-View-1.0.7rc2\..\build-can_usb-Desktop_Qt_5_15_2_MinGW_64_bit-Debug + D:/Work/build-can_usb-Desktop_Qt_5_15_2_MinGW_64_bit-Debug + + + true + QtProjectManager.QMakeBuildStep + false + + + + true + Qt4ProjectManager.MakeStep + + 2 + Build + Build + ProjectExplorer.BuildSteps.Build + + + + true + Qt4ProjectManager.MakeStep + clean + + 1 + Clean + Clean + ProjectExplorer.BuildSteps.Clean + + 2 + false + + false + + Debug + Qt4ProjectManager.Qt4BuildConfiguration + 2 + + + D:\Work\CANAL-View-1.0.7rc2\..\build-can_usb-Desktop_Qt_5_15_2_MinGW_64_bit-Release + D:/Work/build-can_usb-Desktop_Qt_5_15_2_MinGW_64_bit-Release + + + true + QtProjectManager.QMakeBuildStep + false + + + + true + Qt4ProjectManager.MakeStep + + 2 + Build + Build + ProjectExplorer.BuildSteps.Build + + + + true + Qt4ProjectManager.MakeStep + clean + + 1 + Clean + Clean + ProjectExplorer.BuildSteps.Clean + + 2 + false + + false + + Release + Qt4ProjectManager.Qt4BuildConfiguration + 0 + 0 + + + 0 + D:\Work\CANAL-View-1.0.7rc2\..\build-can_usb-Desktop_Qt_5_15_2_MinGW_64_bit-Profile + D:/Work/build-can_usb-Desktop_Qt_5_15_2_MinGW_64_bit-Profile + + + true + QtProjectManager.QMakeBuildStep + false + + + + true + Qt4ProjectManager.MakeStep + + 2 + Build + Build + ProjectExplorer.BuildSteps.Build + + + + true + Qt4ProjectManager.MakeStep + clean + + 1 + Clean + Clean + ProjectExplorer.BuildSteps.Clean + + 2 + false + + false + + Profile + Qt4ProjectManager.Qt4BuildConfiguration + 0 + 0 + 0 + + 3 + + + 0 + Deploy + Deploy + ProjectExplorer.BuildSteps.Deploy + + 1 + + false + ProjectExplorer.DefaultDeployConfiguration + + 1 + + true + true + true + + 2 + + Qt4ProjectManager.Qt4RunConfiguration:D:/Work/CANAL-View-1.0.7rc2/can_usb.pro + D:/Work/CANAL-View-1.0.7rc2/can_usb.pro + false + true + true + false + true + + 1 + + + + ProjectExplorer.Project.Target.3 + + Desktop + Desktop Qt 5.15.2 MSVC2019 32bit + Desktop Qt 5.15.2 MSVC2019 32bit + qt.qt5.5152.win32_msvc2019_kit + 0 + 0 + 0 - C:/QTprojects/build-can_usb-Desktop_Qt_5_14_2_MSVC2017_64bit-Debug + 0 + D:\Work\CANAL-View-1.0.7rc2\..\build-can_usb-Desktop_Qt_5_15_2_MSVC2019_32bit-Debug + D:/Work/build-can_usb-Desktop_Qt_5_15_2_MSVC2019_32bit-Debug true QtProjectManager.QMakeBuildStep - true - false - false - false + true Qt4ProjectManager.MakeStep - - false - - - false - 2 + 2 Build Build ProjectExplorer.BuildSteps.Build @@ -354,46 +615,37 @@ true Qt4ProjectManager.MakeStep - - true clean - - false - 1 + 1 Clean Clean ProjectExplorer.BuildSteps.Clean 2 false + + false Debug Qt4ProjectManager.Qt4BuildConfiguration 2 - C:/QTprojects/build-can_usb-Desktop_Qt_5_14_2_MSVC2017_64bit-Release + D:\Work\CANAL-View-1.0.7rc2\..\build-can_usb-Desktop_Qt_5_15_2_MSVC2019_32bit-Release + D:/Work/build-can_usb-Desktop_Qt_5_15_2_MSVC2019_32bit-Release true QtProjectManager.QMakeBuildStep - false - false - false - true + true Qt4ProjectManager.MakeStep - - false - - - false - 2 + 2 Build Build ProjectExplorer.BuildSteps.Build @@ -402,46 +654,39 @@ true Qt4ProjectManager.MakeStep - - true clean - - false - 1 + 1 Clean Clean ProjectExplorer.BuildSteps.Clean 2 false + + false Release Qt4ProjectManager.Qt4BuildConfiguration 0 + 0 - C:/QTprojects/build-can_usb-Desktop_Qt_5_14_2_MSVC2017_64bit-Profile + 0 + D:\Work\CANAL-View-1.0.7rc2\..\build-can_usb-Desktop_Qt_5_15_2_MSVC2019_32bit-Profile + D:/Work/build-can_usb-Desktop_Qt_5_15_2_MSVC2019_32bit-Profile true QtProjectManager.QMakeBuildStep - true - false - true - true + true Qt4ProjectManager.MakeStep - - false - - - false - 2 + 2 Build Build ProjectExplorer.BuildSteps.Build @@ -450,117 +695,59 @@ true Qt4ProjectManager.MakeStep - - true clean - - false - 1 + 1 Clean Clean ProjectExplorer.BuildSteps.Clean 2 false + + false Profile Qt4ProjectManager.Qt4BuildConfiguration 0 + 0 + 0 - 3 + 3 - 0 + 0 Deploy Deploy ProjectExplorer.BuildSteps.Deploy 1 + + false ProjectExplorer.DefaultDeployConfiguration - 1 - + 1 - dwarf - - cpu-cycles - - - 250 - - -e - cpu-cycles - --call-graph - dwarf,4096 - -F - 250 - - -F true - 4096 - false - false - 1000 - true - - false - false - false - false - true - 0.01 - 10 - true - kcachegrind - 1 - 25 - - 1 true - false - true - valgrind - - 0 - 1 - 2 - 3 - 4 - 5 - 6 - 7 - 8 - 9 - 10 - 11 - 12 - 13 - 14 - + 2 - Qt4ProjectManager.Qt4RunConfiguration:C:/QTprojects/can_usb/can_usb.pro - C:/QTprojects/can_usb/can_usb.pro - - false - + Qt4ProjectManager.Qt4RunConfiguration:D:/Work/CANAL-View-1.0.7rc2/can_usb.pro + D:/Work/CANAL-View-1.0.7rc2/can_usb.pro false true true - false false true - - - 1 + 1 ProjectExplorer.Project.TargetCount - 2 + 4 ProjectExplorer.Project.Updater.FileVersion diff --git a/can_usb.pro.user.a8408b7 b/can_usb.pro.user.a8408b7 new file mode 100644 index 0000000..9fd65cf --- /dev/null +++ b/can_usb.pro.user.a8408b7 @@ -0,0 +1,573 @@ + + + + + + EnvironmentId + {a8408b7b-0c08-4dd7-961d-8fcdc51ab540} + + + ProjectExplorer.Project.ActiveTarget + 0 + + + ProjectExplorer.Project.EditorSettings + + true + false + true + + Cpp + + CppGlobal + + + + QmlJS + + QmlJSGlobal + + + 2 + UTF-8 + false + 4 + false + 80 + true + true + 1 + true + false + 2 + true + true + 0 + 8 + true + 1 + true + true + true + false + + + + ProjectExplorer.Project.PluginSettings + + + -fno-delayed-template-parsing + + true + + true + Builtin.TidyAndClazy + 4 + + C:/QTprojects/can_usb/can_usb.pro + + + + true + + + + + ProjectExplorer.Project.Target.0 + + Desktop Qt 5.14.2 MSVC2017 32bit + Desktop Qt 5.14.2 MSVC2017 32bit + qt.qt5.5142.win32_msvc2017_kit + 1 + 0 + 0 + + C:/QTprojects/build-can_usb-Desktop_Qt_5_14_2_MSVC2017_32bit-Debug + + + true + QtProjectManager.QMakeBuildStep + true + + false + false + false + + + true + Qt4ProjectManager.MakeStep + + false + + + false + + 2 + Build + Build + ProjectExplorer.BuildSteps.Build + + + + true + Qt4ProjectManager.MakeStep + + true + clean + + false + + 1 + Clean + Clean + ProjectExplorer.BuildSteps.Clean + + 2 + false + + Debug + Qt4ProjectManager.Qt4BuildConfiguration + 2 + + + C:/QTprojects/build-can_usb-Desktop_Qt_5_14_2_MSVC2017_32bit-Release + + + true + QtProjectManager.QMakeBuildStep + false + + false + false + true + + + true + Qt4ProjectManager.MakeStep + + false + + + false + + 2 + Build + Build + ProjectExplorer.BuildSteps.Build + + + + true + Qt4ProjectManager.MakeStep + + true + clean + + false + + 1 + Clean + Clean + ProjectExplorer.BuildSteps.Clean + + 2 + false + + Release + Qt4ProjectManager.Qt4BuildConfiguration + 0 + + + C:/QTprojects/build-can_usb-Desktop_Qt_5_14_2_MSVC2017_32bit-Profile + + + true + QtProjectManager.QMakeBuildStep + true + + false + true + true + + + true + Qt4ProjectManager.MakeStep + + false + + + false + + 2 + Build + Build + ProjectExplorer.BuildSteps.Build + + + + true + Qt4ProjectManager.MakeStep + + true + clean + + false + + 1 + Clean + Clean + ProjectExplorer.BuildSteps.Clean + + 2 + false + + Profile + Qt4ProjectManager.Qt4BuildConfiguration + 0 + + 3 + + + 0 + Deploy + Deploy + ProjectExplorer.BuildSteps.Deploy + + 1 + ProjectExplorer.DefaultDeployConfiguration + + 1 + + + dwarf + + cpu-cycles + + + 250 + + -e + cpu-cycles + --call-graph + dwarf,4096 + -F + 250 + + -F + true + 4096 + false + false + 1000 + + true + + false + false + false + false + true + 0.01 + 10 + true + kcachegrind + 1 + 25 + + 1 + true + false + true + valgrind + + 0 + 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 10 + 11 + 12 + 13 + 14 + + 2 + + Qt4ProjectManager.Qt4RunConfiguration:C:/QTprojects/can_usb/can_usb.pro + C:/QTprojects/can_usb/can_usb.pro + + false + + false + true + true + false + false + true + + C:/QTprojects/build-can_usb-Desktop_Qt_5_14_2_MSVC2017_32bit-Release + + 1 + + + + ProjectExplorer.Project.Target.1 + + Desktop Qt 5.14.2 MSVC2017 64bit + Desktop Qt 5.14.2 MSVC2017 64bit + qt.qt5.5142.win64_msvc2017_64_kit + 1 + 0 + 0 + + C:/QTprojects/build-can_usb-Desktop_Qt_5_14_2_MSVC2017_64bit-Debug + + + true + QtProjectManager.QMakeBuildStep + true + + false + false + false + + + true + Qt4ProjectManager.MakeStep + + false + + + false + + 2 + Build + Build + ProjectExplorer.BuildSteps.Build + + + + true + Qt4ProjectManager.MakeStep + + true + clean + + false + + 1 + Clean + Clean + ProjectExplorer.BuildSteps.Clean + + 2 + false + + Debug + Qt4ProjectManager.Qt4BuildConfiguration + 2 + + + C:/QTprojects/build-can_usb-Desktop_Qt_5_14_2_MSVC2017_64bit-Release + + + true + QtProjectManager.QMakeBuildStep + false + + false + false + true + + + true + Qt4ProjectManager.MakeStep + + false + + + false + + 2 + Build + Build + ProjectExplorer.BuildSteps.Build + + + + true + Qt4ProjectManager.MakeStep + + true + clean + + false + + 1 + Clean + Clean + ProjectExplorer.BuildSteps.Clean + + 2 + false + + Release + Qt4ProjectManager.Qt4BuildConfiguration + 0 + + + C:/QTprojects/build-can_usb-Desktop_Qt_5_14_2_MSVC2017_64bit-Profile + + + true + QtProjectManager.QMakeBuildStep + true + + false + true + true + + + true + Qt4ProjectManager.MakeStep + + false + + + false + + 2 + Build + Build + ProjectExplorer.BuildSteps.Build + + + + true + Qt4ProjectManager.MakeStep + + true + clean + + false + + 1 + Clean + Clean + ProjectExplorer.BuildSteps.Clean + + 2 + false + + Profile + Qt4ProjectManager.Qt4BuildConfiguration + 0 + + 3 + + + 0 + Deploy + Deploy + ProjectExplorer.BuildSteps.Deploy + + 1 + ProjectExplorer.DefaultDeployConfiguration + + 1 + + + dwarf + + cpu-cycles + + + 250 + + -e + cpu-cycles + --call-graph + dwarf,4096 + -F + 250 + + -F + true + 4096 + false + false + 1000 + + true + + false + false + false + false + true + 0.01 + 10 + true + kcachegrind + 1 + 25 + + 1 + true + false + true + valgrind + + 0 + 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 10 + 11 + 12 + 13 + 14 + + 2 + + Qt4ProjectManager.Qt4RunConfiguration:C:/QTprojects/can_usb/can_usb.pro + C:/QTprojects/can_usb/can_usb.pro + + false + + false + true + true + false + false + true + + + + 1 + + + + ProjectExplorer.Project.TargetCount + 2 + + + ProjectExplorer.Project.Updater.FileVersion + 22 + + + Version + 22 + + diff --git a/canal.h b/canal.h index db7b1c8..7b17b2a 100644 --- a/canal.h +++ b/canal.h @@ -1,428 +1,88 @@ -/////////////////////////////////////////////////////////////////////////////// -// canal.h -// -// This file is part is part of CANAL (CAN Abstraction Layer) -// http://can.sourceforge.net) -// -// Copyright (C) 2000-2008 Ake Hedman, eurosource, -// -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License, or (at your option) any later version. -// -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -// -// $RCSfile: canal.h,v $ -// $Date: 2005/08/30 20:22:14 $ -// $Author: akhe $ -// $Revision: 1.36 $ -/////////////////////////////////////////////////////////////////////////////// - - -#ifndef ___CANAL_H___ -#define ___CANAL_H___ - - -// This was needed to compile as a service - Don't know why??? -#ifndef EXPORT -#define EXPORT -#endif - - +/* + * CANAL interface DLL for RUSOKU technologies for TouCAN, TouCAN Marine, TouCAN Duo USB to CAN bus converter + * + * Copyright (C) 2005-2023 Gediminas Simanskis (gediminas@rusoku.com) + * + * This program is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published + * by the Free Software Foundation; version 3.0 of the License. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program. + * + */ + +//https://learn.microsoft.com/en-us/cpp/build/exporting-from-a-dll-using-declspec-dllexport?view=msvc-170 +//https://learn.microsoft.com/en-us/cpp/build/exporting-functions-from-a-dll-by-ordinal-rather-than-by-name?view=msvc-170 +//https://learn.microsoft.com/en-us/cpp/build/linking-an-executable-to-a-dll?view=msvc-170#determining-which-linking-method-to-use +//https://learn.microsoft.com/en-us/cpp/build/run-time-library-behavior?view=msvc-170#initializing-a-dll +//https://stackoverflow.com/questions/39330898/c-winapi-call-exported-function-via-getprocaddress + +#pragma once #ifdef WIN32 -#ifndef WINAPI -#define WINAPI __stdcall -#endif -#else - +#define DllExport __declspec(dllexport) +#define WINAPI __stdcall #endif - -#define CAN_MAX_STANDARD_ID 0x7ff -#define CAN_MAX_EXTENDED_ID 0x1fffffff - - -// CANAL version -// ============= -// This value is steped for each new version when -// the i/f is changed. This will hopefully not -// happen but probably will. - -#define CANAL_MAIN_VERSION 1 -#define CANAL_MINOR_VERSION 0 -#define CANAL_SUB_VERSION 14 - - // Canal Levels #define CANAL_LEVEL_STANDARD 1 #define CANAL_LEVEL_USES_TCPIP 2 -// VSCP daemon version information positions -#define POS_VSCPD_MAJOR_VERSION 1 -#define POS_VSCPD_MINOR_VERSION 2 -#define POS_VSCPD_SUB_VERSION 3 - - // VSCP Daemon client Open types #define CANAL_COMMAND_OPEN_VSCP_LEVEL1 1 // VSCP Level I channel (CAN) #define CANAL_COMMAND_OPEN_VSCP_LEVEL2 2 // VSCP Level II channel #define CANAL_COMMAND_OPEN_VSCP_CONTROL 3 // Daemon Control channel -/// Interprocess success/failure codes -#define COMMAND_FAILURE 0 -#define COMMAND_SUCCESS 1 - -/// Return types - -#define PACKAGE_ACK 0 -#define PACKAGE_NACK 1 - -#define PACKAGE_TIMEOUT -1 -#define PACKAGE_UNKNOWN -1 - -#define PACKAGE_FAILURE 0 -#define PACKAGE_SUCCESS 1 - -#ifdef __cplusplus -extern "C" { -#endif - - -/// * * * Data Structures - -/*! - CanalMsg - - This is the general message structure -*/ - -typedef struct structCanalMsg { - unsigned long flags; // CAN message flags - unsigned long obid; // Used by driver for channel info etc. - unsigned long id; // CAN id (11-bit or 29-bit) - unsigned char sizeData; // Data size 0-8 - unsigned char data[8]; // CAN Data - unsigned long timestamp; // Relative time stamp for package in microseconds -} canalMsg; - -typedef canalMsg * PCANALMSG; - +#define CANAL_MAIN_VERSION 1 +#define CANAL_MINOR_VERSION 0 +#define CANAL_SUB_VERSION 15 -/*! - CanalStatistics - - This is the general statistics structure -*/ - -typedef struct structCanalStatistics { - unsigned long cntReceiveFrames; // # of receive frames - unsigned long cntTransmitFrames; // # of transmitted frames - unsigned long cntReceiveData; // # of received data bytes - unsigned long cntTransmitData; // # of transmitted data bytes - unsigned long cntOverruns; // # of overruns - unsigned long cntBusWarnings; // # of bys warnings - unsigned long cntBusOff; // # of bus off's -} canalStatistics; - -typedef canalStatistics *PCANALSTATISTICS; - -/*! - CanalStatus - - This is the general channel state structure -*/ - -typedef struct structCanalStatus { - unsigned long channel_status; // Current state for channel - unsigned long lasterrorcode; // Last error code - unsigned long lasterrorsubcode; // Last error subcode - char lasterrorstr[80]; // Last error string -} canalStatus; +#define CAN_MAX_STANDARD_ID 0x7ff +#define CAN_MAX_EXTENDED_ID 0x1fffffff +#define COMMAND_FAILURE (0) +#define COMMAND_SUCCESS (1) +#define PACKAGE_ACK (0) +#define PACKAGE_NACK (1) +#define PACKAGE_TIMEOUT (-1) +#define PACKAGE_UNKNOWN (-1) +#define PACKAGE_FAILURE (0) +#define PACKAGE_SUCCESS (1) -typedef canalStatus * PCANALSTATUS; - - -// This is the define for the received callback method -#ifdef WIN32 -typedef void ( __stdcall * LPFNDLL_CANAL_RECEIVE_CALLBACK) ( canalMsg *pMsg ); -#endif - -// CAN driver open handle -typedef long CANHANDLE; - - -// * * * Prototypes - -/*! - Open a CANAL device and get a handle to it. - - flags - Give extra info to the CANAL i/F - - @param pDevice Physical device to connect to. - @return Handle of device or -1 if error. -*/ -#ifdef WIN32 -long WINAPI EXPORT CanalOpen( const char *pDevice, unsigned long flags ); -#else -long CanalOpen( const char *pDevice, unsigned long flags ); -#endif - - -/*! - Close a CANAL chanel. - - @param handle - Handle to open physical CANAL channel. - @return zero on success or error-code on failure. -*/ -#ifdef WIN32 -int WINAPI EXPORT CanalClose( long handle ); -#else -int CanalClose( long handle ); -#endif - -/*! - Get CANAL DLL supported level - - @return level for CANAL dll implemention. -*/ -#ifdef WIN32 -unsigned long WINAPI EXPORT CanalGetLevel( long handle ); -#else -unsigned long CanalGetLevel( long handle ); -#endif - -/*! - Send a message on a CANAL channel. - - The instruction should block if not instructed not to - do so when the interface was opened. - - @param handle - Handle to open physical CANAL channel. - @param pCanMsg - Message to send. - @return zero on success or error-code on failure. -*/ -#ifdef WIN32 -int WINAPI EXPORT CanalSend( long handle, const PCANALMSG pCanalMsg ); -#else -int CanalSend( long handle, PCANALMSG pCanalMsg ); -#endif - - -/*! - Send a blocking message on a CANAL channel. - - The instruction should block if not instructed not to - do so when the interface was opened. - - @param handle - Handle to open physical CANAL channel. - @param pCanMsg - Message to send. - @param timeout - timout in ms. 0 is forever. - @return zero on success or error-code on failure. -*/ -#ifdef WIN32 -int WINAPI EXPORT CanalBlockingSend( long handle, PCANALMSG pCanalMsg, unsigned long timeout ); -#else -int CanalBlockingSend( long handle, PCANALMSG pCanalMsg, unsigned long timeout ); -#endif - -/*! - Receieve a message on a CANAL channel. - - The instruction should block if not instructed not to - do so when the interface was opened. - - @param handle - Handle to open physical CANAL channel. - @param pCanMsg - Message to send. - @return zero on success or error-code on failure. -*/ -#ifdef WIN32 -int WINAPI EXPORT CanalReceive( long handle, PCANALMSG pCanalMsg ); -#else -int CanalReceive( long handle, PCANALMSG pCanalMsg ); -#endif - - -/*! - Blocking receieve a message on a CANAL channel. - - The instruction should block if not instructed not to - do so when the interface was opened. - - @param handle - Handle to open physical CANAL channel. - @param pCanMsg - Message to send. - @param timeout - timout in ms. 0 is forever. - @return zero on success or error-code on failure. -*/ -#ifdef WIN32 -int WINAPI EXPORT CanalBlockingReceive( long handle, PCANALMSG pCanalMsg, unsigned long timeout ); -#else -int CanalBlockingReceive( long handle, PCANALMSG pCanalMsg, unsigned long timeout ); -#endif - -/*! - Check a CANAL channel for message availability. - - @param handle - Handle to open physical CANAL channel. - @return Zero if no message is available or the number of messages is - there are messages waiting to be received. -*/ -#ifdef WIN32 -int WINAPI EXPORT CanalDataAvailable( long handle ); -#else -int CanalDataAvailable( long handle ); -#endif - -/*! - Get status for a CANAL channel - - @param handle Handle to open physical CANAL channel. - @param pCanStatus Pointer to a CANAL status structure. - @return zero on success or error-code on failure. -*/ -#ifdef WIN32 -int WINAPI EXPORT CanalGetStatus( long handle, PCANALSTATUS pCanalStatus ); -#else -int CanalGetStatus( long handle, PCANALSTATUS pCanalStatus ); -#endif - -/*! - Get statistics for a CANAL channel - - @param handle Handle to open physical CANAL channel. - @param pCanStatistics Pointer to a CANAL statistics structure. - @return zero on success or error-code on failure. -*/ -#ifdef WIN32 -int WINAPI EXPORT CanalGetStatistics( long handle, PCANALSTATISTICS pCanalStatistics ); -#else -int CanalGetStatistics( long handle, PCANALSTATISTICS pCanalStatistics ); -#endif - -/*! - Set the filter for a CANAL channel - - @param handle Handle to open physical CANAL channel. - @param pCanStatistics Pointer to a CANAL statistics structure. - @return zero on success or error-code on failure. -*/ -#ifdef WIN32 -int WINAPI EXPORT CanalSetFilter( long handle, unsigned long filter ); -#else -int CanalSetFilter( long handle, unsigned long filter ); -#endif - -/*! - Set the mask for a CANAL channel - - @param handle Handle to open physical CANAL channel. - @param mask for - @return zero on success or error-code on failure. -*/ -#ifdef WIN32 -int WINAPI EXPORT CanalSetMask( long handle, unsigned long mask ); -#else -int CanalSetMask( long handle, unsigned long mask ); -#endif - -/*! - Set the baudrate for a CANAL channel - - @param handle Handle to open physical CANAL channel. - @param baudrate Baudrate for the channel - @return zero on success or error-code on failure. -*/ -#ifdef WIN32 -int WINAPI EXPORT CanalSetBaudrate( long handle, unsigned long baudrate ); -#else -int CanalSetBaudrate( long handle, unsigned long baudrate ); -#endif - -/*! - Get CANAL version - - @return version for CANAL i/f. -*/ -#ifdef WIN32 -unsigned long WINAPI EXPORT CanalGetVersion( void ); -#else -unsigned long CanalGetVersion( void ); -#endif - -/*! - Get CANAL DLL version - - @return version for CANAL dll implemention. -*/ -#ifdef WIN32 -unsigned long WINAPI EXPORT CanalGetDllVersion( void ); -#else -unsigned long CanalGetDllVersion( void ); -#endif - -/*! - Get CANAL vendor string - - @return version for CANAL dll implemention. -*/ -#ifdef WIN32 -const char * WINAPI EXPORT CanalGetVendorString( void ); -#else -const char * CanalGetVendorString( void ); -#endif - -/*! - Get CANAL driver properties -*/ -#ifdef WIN32 -const char * WINAPI EXPORT CanalGetDriverInfo( void ); -#else -const char * CanalGetDriverInfo( void ); -#endif - -// * * * * Constants * * * * - -/// CANAL Open i/f flags -#define CANAL_NONBLOCK 1 - - -// read/write are none blocking +#define CANAL_NONBLOCK 1 /// ID flags -#define CANAL_IDFLAG_STANDARD 0x00000000 // Standard message id (11-bit) -#define CANAL_IDFLAG_EXTENDED 0x00000001 // Extended message id (29-bit) -#define CANAL_IDFLAG_RTR 0x00000002 // RTR-Frame -#define CANAL_IDFLAG_STATUS 0x00000004 // This package is a status indication (id holds error code) -#define CANAL_IDFLAG_SEND 0x80000000 // Reserved for use by application software to indicate send +#define CANAL_IDFLAG_STANDARD 0x00000000 // Standard message id (11-bit) +#define CANAL_IDFLAG_EXTENDED 0x00000001 // Extended message id (29-bit) +#define CANAL_IDFLAG_RTR 0x00000002 // RTR-Frame +#define CANAL_IDFLAG_STATUS 0x00000004 // This package is a status indication (id holds error code) +#define CANAL_IDFLAG_SEND 0x80000000 // Reserved for use by application software to indicate send /// Communicaton speeds -#define CANAL_BAUD_USER 0 // User specified (In CANAL i/f DLL). -#define CANAL_BAUD_1000 1 // 1 Mbit -#define CANAL_BAUD_800 2 // 800 Kbit -#define CANAL_BAUD_500 3 // 500 Kbit -#define CANAL_BAUD_250 4 // 250 Kbit -#define CANAL_BAUD_125 5 // 125 Kbit -#define CANAL_BAUD_100 6 // 100 Kbit -#define CANAL_BAUD_50 7 // 50 Kbit -#define CANAL_BAUD_20 8 // 20 Kbit -#define CANAL_BAUD_10 9 // 10 Kbit +#define CANAL_BAUD_USER 0 // User specified (In CANAL i/f DLL). +#define CANAL_BAUD_1000 1 // 1 Mbit +#define CANAL_BAUD_800 2 // 800 Kbit +#define CANAL_BAUD_500 3 // 500 Kbit +#define CANAL_BAUD_250 4 // 250 Kbit +#define CANAL_BAUD_125 5 // 125 Kbit +#define CANAL_BAUD_100 6 // 100 Kbit +#define CANAL_BAUD_50 7 // 50 Kbit +#define CANAL_BAUD_20 8 // 20 Kbit +#define CANAL_BAUD_10 9 // 10 Kbit /// Status message codes ( in received message ) -#define CANAL_STATUSMSG_OK 0x00 // Normal condition. -#define CANAL_STATUSMSG_OVERRUN 0x01 // Overrun occured when sending data to CAN bus. -#define CANAL_STATUSMSG_BUSLIGHT 0x02 // Error counter has reached 96. -#define CANAL_STATUSMSG_BUSHEAVY 0x03 // Error counter has reached 128. -#define CANAL_STATUSMSG_BUSOFF 0x04 // Device is in BUSOFF. CANAL_STATUS_OK is - // sent when returning to operational mode. +#define CANAL_STATUSMSG_OK 0x00 // Normal condition. +#define CANAL_STATUSMSG_OVERRUN 0x01 // Overrun occured when sending data to CAN bus. +#define CANAL_STATUSMSG_BUSLIGHT 0x02 // Error counter has reached 96. +#define CANAL_STATUSMSG_BUSHEAVY 0x03 // Error counter has reached 128. +#define CANAL_STATUSMSG_BUSOFF 0x04 // Device is in BUSOFF. CANAL_STATUS_OK is +// sent when returning to operational mode. #define CANAL_STATUSMSG_STUFF 0x20 // Stuff Error. #define CANAL_STATUSMSG_FORM 0x21 // Form Error. #define CANAL_STATUSMSG_ACK 0x23 // Ack Error. @@ -456,11 +116,11 @@ const char * CanalGetDriverInfo( void ); #define CANAL_ERROR_FIFO_EMPTY 8 // FIFO is empty #define CANAL_ERROR_FIFO_FULL 9 // FIFI is full #define CANAL_ERROR_FIFO_SIZE 10 // FIFO size error -#define CANAL_ERROR_FIFO_WAIT 11 +#define CANAL_ERROR_FIFO_WAIT 11 #define CANAL_ERROR_GENERIC 12 // Generic error #define CANAL_ERROR_HARDWARE 13 // Hardware error #define CANAL_ERROR_INIT_FAIL 14 // Initialization failed -#define CANAL_ERROR_INIT_MISSING 15 +#define CANAL_ERROR_INIT_MISSING 15 #define CANAL_ERROR_INIT_READY 16 #define CANAL_ERROR_NOT_SUPPORTED 17 // Not supported #define CANAL_ERROR_OVERRUN 18 // Overrun @@ -484,86 +144,321 @@ const char * CanalGetDriverInfo( void ); #define CANAL_ERROR_INTERNAL 36 // Some kind of internal program error #define CANAL_ERROR_COMMUNICATION 37 // Some kind of communication error #define CANAL_ERROR_USER 38 // Login error - + // CANAL commands sent over the pipe interface (depricated) -#define CANAL_COMMAND_NOOP 0 // No command -#define CANAL_COMMAND_OPEN 1 // Open channel -#define CANAL_COMMAND_CLOSE 2 // Close channel -#define CANAL_COMMAND_SEND 3 // Send message -#define CANAL_COMMAND_RECEIVE 4 // Receive message -#define CANAL_COMMAND_CHECKDATA 5 // Check if data is available -#define CANAL_COMMAND_BAUDRATE 6 // Set Baudrate -#define CANAL_COMMAND_STATUS 7 // Get status -#define CANAL_COMMAND_STATISTICS 8 // Get statistics -#define CANAL_COMMAND_FILTER 9 // Set filter -#define CANAL_COMMAND_MASK 10 // Set mask -#define CANAL_COMMAND_VERSION 11 // CANAL version -#define CANAL_COMMAND_DLL_VERSION 12 // CANAL DLL version -#define CANAL_COMMAND_VENDOR_STRING 13 // CANAL vendor string -#define CANAL_COMMAND_LEVEL 14 // CANAL Level bitarray +#define CANAL_COMMAND_NOOP 0 // No command +#define CANAL_COMMAND_OPEN 1 // Open channel +#define CANAL_COMMAND_CLOSE 2 // Close channel +#define CANAL_COMMAND_SEND 3 // Send message +#define CANAL_COMMAND_RECEIVE 4 // Receive message +#define CANAL_COMMAND_CHECKDATA 5 // Check if data is available +#define CANAL_COMMAND_BAUDRATE 6 // Set Baudrate +#define CANAL_COMMAND_STATUS 7 // Get status +#define CANAL_COMMAND_STATISTICS 8 // Get statistics +#define CANAL_COMMAND_FILTER 9 // Set filter +#define CANAL_COMMAND_MASK 10 // Set mask +#define CANAL_COMMAND_VERSION 11 // CANAL version +#define CANAL_COMMAND_DLL_VERSION 12 // CANAL DLL version +#define CANAL_COMMAND_VENDOR_STRING 13 // CANAL vendor string +#define CANAL_COMMAND_LEVEL 14 // CANAL Level bitarray // CANAL responses sent over the pipe interface (depricated) -#define CANAL_RESPONSE_NONE 0 // -#define CANAL_RESPONSE_SUCCESS 1 // OK message -#define CANAL_RESPONSE_ERROR 2 // ERROR message -#define CANAL_RESPONSE_MESSAGE 3 // Response to read +#define CANAL_RESPONSE_NONE 0 // +#define CANAL_RESPONSE_SUCCESS 1 // OK message +#define CANAL_RESPONSE_ERROR 2 // ERROR message +#define CANAL_RESPONSE_MESSAGE 3 // Response to read -// CANAL error codes sent over the client interface +// CANAL error codes sent over the client interface // on error responses -#define CANAL_IFERROR_GENERAL 128 // General error -#define CANAL_IFERROR_UNKNOWN_COMMAND 129 -#define CANAL_IFERROR_CHANNEL_OPEN 130 -#define CANAL_IFERROR_CHANNEL_CLOSED 131 -#define CANAL_IFERROR_SEND_SUCCESS 132 +#define CANAL_IFERROR_GENERAL 128 // General error +#define CANAL_IFERROR_UNKNOWN_COMMAND 129 +#define CANAL_IFERROR_CHANNEL_OPEN 130 +#define CANAL_IFERROR_CHANNEL_CLOSED 131 +#define CANAL_IFERROR_SEND_SUCCESS 132 #define CANAL_IFERROR_SEND_MSG_ALLOCATON 133 -#define CANAL_IFERROR_BUFFER_EMPTY 134 -#define CANAL_IFERROR_BUFFER_FULL 135 -#define CANAL_IFERROR_READ_FAILURE 136 -#define CANAL_IFERROR_SEND_STORAGE 137 - +#define CANAL_IFERROR_BUFFER_EMPTY 134 +#define CANAL_IFERROR_BUFFER_FULL 135 +#define CANAL_IFERROR_READ_FAILURE 136 +#define CANAL_IFERROR_SEND_STORAGE 137 // * * * TCP/IP FAST mode interface constants // FAST mode primary states -#define CANAL_BINARY_FRAME_TYPE_VSCP 0 // VSCP event -#define CANAL_BINARY_FRAME_TYPE_ERROR 1 // ACK/NACK/errors +#define CANAL_BINARY_FRAME_TYPE_VSCP 0 // VSCP event +#define CANAL_BINARY_FRAME_TYPE_ERROR 1 // ACK/NACK/errors #define CANAL_BINARY_FRAME_TYPE_COMMAND 2 // Command frame -#define CANAL_BINARY_FRAME_TYPE_CAN 3 // CAN Frame +#define CANAL_BINARY_FRAME_TYPE_CAN 3 // CAN Frame -#define CANAL_BINARY_COMMAND_NOOP 0 // No operation -#define CANAL_BINARY_COMMAND_READ 1 // Read one frame -#define CANAL_BINARY_COMMAND_CLOSE 2 // Close communication channel +#define CANAL_BINARY_COMMAND_NOOP 0 // No operation +#define CANAL_BINARY_COMMAND_READ 1 // Read one frame +#define CANAL_BINARY_COMMAND_CLOSE 2 // Close communication channel // FAST error codes -#define CANAL_BINARY_ERROR_NONE 0 // OK -#define CANAL_BINARY_ERROR_GENERAL 1 // General error -#define CANAL_BINARY_ERROR_TO_SMALL 2 // Packet smaller then min packet -#define CANAL_BINARY_ERROR_FORMAT 3 // Packet have bad format +#define CANAL_BINARY_ERROR_NONE 0 // OK +#define CANAL_BINARY_ERROR_GENERAL 1 // General error +#define CANAL_BINARY_ERROR_TO_SMALL 2 // Packet smaller then min packet +#define CANAL_BINARY_ERROR_FORMAT 3 // Packet have bad format #define CANAL_BINARY_ERROR_UNKNOW_FRAME 4 // Unknown frame type -#define CANAL_BINARY_ERROR_MEMORY 5 // No room for event -#define CANAL_BINARY_ERROR_NO_DATA 6 // No data available +#define CANAL_BINARY_ERROR_MEMORY 5 // No room for event +#define CANAL_BINARY_ERROR_NO_DATA 6 // No data available #define CANAL_BINARY_ERROR_INVALID_CMD 7 // Command not recognized. // Filter mask settings -#define CANUSB_ACCEPTANCE_FILTER_ALL 0x00000000 -#define CANUSB_ACCEPTANCE_MASK_ALL 0xFFFFFFFF +#define CANUSB_ACCEPTANCE_FILTER_ALL 0x00000000 +#define CANUSB_ACCEPTANCE_MASK_ALL 0xFFFFFFFF + +#define CANAL_DEVLIST_SIZE_MAX 64 + +typedef struct struct_CANAL_DEV_INFO { + unsigned int DeviceId; + unsigned int vid; + unsigned int pid; + char SerialNumber[10]; +} canal_dev_info, *pcanal_dev_info; + +typedef struct struct_CANAL_DEV_LIST{ + canal_dev_info canDevInfo[CANAL_DEVLIST_SIZE_MAX]; + unsigned int canDevCount; +} canal_dev_list, *pcanal_dev_list; + +/** @name CanalMsg + * @brief CANAL CAN message structure +*/ + +typedef struct structCanalMsg { + unsigned long flags; // CAN message flags + unsigned long obid; // Used by driver for channel info etc. + unsigned long id; // CAN id (11-bit or 29-bit) + unsigned char sizeData; // Data size 0-8 + unsigned char data[8]; // CAN Data + unsigned long timestamp; // Relative time stamp for package in microseconds +} canalMsg; +typedef canalMsg* PCANALMSG; + +/** @name CanalStatistics + * @brief CANAL statistics structure +*/ +typedef struct structCanalStatistics { + unsigned long cntReceiveFrames; // # of receive frames + unsigned long cntTransmitFrames; // # of transmitted frames + unsigned long cntReceiveData; // # of received data bytes + unsigned long cntTransmitData; // # of transmitted data bytes + unsigned long cntOverruns; // # of overruns + unsigned long cntBusWarnings; // # of bys warnings + unsigned long cntBusOff; // # of bus off's +} canalStatistics; +typedef canalStatistics* PCANALSTATISTICS; + +/** @name CanalStatus + * @brief CANAL status structure +*/ +typedef struct structCanalStatus { + unsigned long channel_status; // Current state for channel + unsigned long lasterrorcode; // Last error code + unsigned long lasterrorsubcode; // Last error subcode + char lasterrorstr[80]; // Last error string +} canalStatus; +typedef canalStatus* PCANALSTATUS; + +/** @name CANHANDLE + * @brief CAN driver open handle +*/ +typedef long CANHANDLE; #ifdef __cplusplus -} +extern "C" { #endif +/** @name CanalOpen + @brief CAN driver open handle. + @param pDevice Physical device to connect to. + @param flags Give extra info to the CANAL i/F. + @return Handle of device or -1 if error. +*/ +DllExport long WINAPI CanalOpen(const char *pDevice, unsigned long flags); -#endif //___CANAL_H___ +/** @name CanalClose + @brief Close a CANAL chanel. + @param handle Handle to close physical CANAL channel. + @return zero on success or error-code on failure. +*/ +DllExport long WINAPI CanalClose(long handle); +/** @name CanalGetLevel + @brief + @param handle Handle to close physical CANAL channel. + @return +*/ +DllExport long WINAPI CanalGetLevel(long handle); +/** + @name CanalSend + @brief Send a message on a CANAL channel + @param handle - Handle to open physical CANAL channel. + @param pCanMsg - Message to send. + @return zero on success or error-code on failure. +*/ +DllExport int WINAPI CanalSend(long handle, PCANALMSG pCanalMsg); + +/** + @name CanalBlockingSend + @brief Send a message on a CANAL channel + @param handle - Handle to open physical CANAL channel. + @param pCanMsg - Message to send. + @param @param timeout - Timeout in ms. 0 is forever. + @return zero on success or error-code on failure. +*/ +DllExport int WINAPI CanalBlockingSend(long handle, PCANALMSG pCanalMsg, unsigned long timeout); -// History -// ======= -// -// 2007-10-31 AKHE - Blocking and driver properties added -// 2006-05-16 AKHE - Added fastmode defines. -// 2005-08-09 AKHE - Added error info to canalStatus structure. +/** + @name CanalSend + @brief Receive a message from a CANAL channel + @param handle - Handle to open physical CANAL channel. + @param pCanMsg - Message to receive. + @return zero on success or error-code on failure. +*/ +DllExport int WINAPI CanalReceive(long handle, PCANALMSG pCanalMsg); + +/** + @name CanalBlockingSend + @brief Receive a message from a CANAL channel + @param handle - Handle to open physical CANAL channel. + @param pCanMsg - Message to receive. + @param @param timeout - Timeout in ms. 0 is forever. + @return zero on success or error-code on failure. +*/ +DllExport int WINAPI CanalBlockingReceive(long handle, PCANALMSG pCanalMsg, unsigned long timeout); +/** + @name CanalDataAvailable + @brief Check a CANAL channel for message availability + @param handle - Handle to open physical CANAL channel. + @return Zero if no message is available or the number of messages is + there are messages waiting to be received. +*/ +DllExport int WINAPI CanalDataAvailable(long handle); + +/** + @name CanalGetStatus + @brief Get status for a CANAL channel. + @param handle - Handle to open physical CANAL channel. + @param pCanStatus Pointer to a CANAL status structure. + @param zero on success or error-code on failure. +*/ +DllExport int WINAPI CanalGetStatus(long handle, PCANALSTATUS pCanalStatus); + +/** + @name CanalGetStatistics + @brief Get statistics for a CANAL channel. + @param handle - Handle to open physical CANAL channel. + @param pCanStatus Pointer to a CANAL status structure. + @param zero on success or error-code on failure. +*/ +DllExport int WINAPI CanalGetStatistics(long handle, PCANALSTATISTICS pCanalStatistics); + +/** + @name CanalSetFilter + @brief Set the filter for a CANAL channel. + @param handle - Handle to open physical CANAL channel. + @param filter + @param zero on success or error-code on failure. +*/ +DllExport int WINAPI CanalSetFilter(long handle, unsigned long filter); + +/** + @name CanalSetMask + @brief Set the mask for a CANAL channel. + @param handle - Handle to open physical CANAL channel. + @param filter + @param zero on success or error-code on failure. +*/ +DllExport int WINAPI CanalSetMask(long handle, unsigned long mask); + +/** + @name CanalSetBaudrate + @brief Set the baudrate for a CANAL channel. + @param handle - Handle to open physical CANAL channel. + @param baudrate Baudrate for the channel + @param zero on success or error-code on failure. +*/ +DllExport int WINAPI CanalSetBaudrate(long handle, unsigned long baudrate); +/** + @name CanalGetVersion + @brief Get CANAL version. + @return version for CANAL i/f. +*/ +DllExport unsigned long WINAPI CanalGetVersion(void); +/** + @name CanalGetDllVersion + @brief Get CANAL DLL version. + @return version for CANAL dll implemention. +*/ +DllExport unsigned long WINAPI CanalGetDllVersion(void); + +/** + @name CanalGetDriverInfo + @brief Get CANAL driver properties. + @return driver info string. +*/ +DllExport const char* WINAPI CanalGetVendorString(void); + +/** + @name CanalGetDriverInfo + @brief Get CANAL vendor string. + @return vendor string. +*/ +DllExport const char* WINAPI CanalGetDriverInfo(void); + +/************************************************************* + * EXTENDED NON STANDARD API LIST + */ + +/* FILTER req type */ +typedef enum { + FILTER_ACCEPT_ALL = 0, + FILTER_REJECT_ALL, + FILTER_VALUE, +}Filter_Type_TypeDef; + +/*! + Set the 11bit filter ID, Mask for a CANAL channel + + @param handle Handle to open physical CANAL channel. + @return zero on success or error-code on failure. +*/ + +DllExport int WINAPI CanalSetFilter11bit( long handle, Filter_Type_TypeDef type, unsigned long list, unsigned long mask ); + +/*! + Set the 29bit filter ID, Mask for a CANAL channel + + @param handle Handle to open physical CANAL channel. + @return zero on success or error-code on failure. +*/ +DllExport int WINAPI CanalSetFilter29bit( long handle, Filter_Type_TypeDef type, unsigned long list, unsigned long mask ); + +/*! + Get bootloader ver + + @param handle Handle to open physical CANAL channel. + @return zero on success or error-code on failure. +*/ +DllExport int WINAPI CanalGetBootloaderVersion(long handle, unsigned long* bootloader_version); + +DllExport int WINAPI CanalGetHardwareVersion(long handle, unsigned long* hardware_version); +DllExport int WINAPI CanalGetFirmwareVersion(long handle, unsigned long* firmware_version); +DllExport int WINAPI CanalGetSerialNumber(long handle, unsigned long* serial); +DllExport int WINAPI CanalGetVidPid(long handle, unsigned long* vidpid); +DllExport int WINAPI CanalGetDeviceId(long handle, unsigned long* deviceid); +DllExport int WINAPI CanalGetVendor(long handle, unsigned int size, char* vendor); +DllExport int WINAPI CanalInterfaceStart(long handle); +DllExport int WINAPI CanalInterfaceStop(long handle); +DllExport int WINAPI CanalGetDeviceList(pcanal_dev_list canalDeviceList, int canalDeviceListSize); + +#ifdef __cplusplus +} +#endif +//DWORD WINAPI ReadThread(LPVOID lParam); diff --git a/canal_a.h b/canal_a.h deleted file mode 100644 index 98a8b9d..0000000 --- a/canal_a.h +++ /dev/null @@ -1,145 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// canal_ext.h -// -// This file is part is part of CANAL_A API list (CAN Abstraction Layer) -// -// Copyright (C) 2018 Gediminas Simanskis, RUSOKU Technologies, www.rusoku.com -// -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License, or (at your option) any later version. -// -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -// -/////////////////////////////////////////////////////////////////////////////// - - -#ifndef ___CANAL_A_H___ -#define ___CANAL_A_H___ - - -#ifndef EXPORT -#define EXPORT -#endif - - - -#ifdef WIN32 -#ifndef WINAPI -#define WINAPI __stdcall -#endif -#else - -#endif - -/* FILTER req type */ -typedef enum { - FILTER_ACCEPT_ALL = 0, - FILTER_REJECT_ALL, - FILTER_VALUE, -}Filter_Type_TypeDef; - - -#ifdef __cplusplus -extern "C" { -#endif - -/*! - Set the 11bit filter ID, Mask for a CANAL channel - - @param handle Handle to open physical CANAL channel. - @return zero on success or error-code on failure. -*/ -#ifdef WIN32 -int WINAPI EXPORT CanalSetFilter11bit( long handle, Filter_Type_TypeDef type, unsigned long list, unsigned long mask ); -#else -int CanalSetFilter11bit( long handle, Filter_Type_TypeDef type, unsigned long id, unsigned long mask ); -#endif - -/*! - Set the 29bit filter ID, Mask for a CANAL channel - - @param handle Handle to open physical CANAL channel. - @return zero on success or error-code on failure. -*/ -#ifdef WIN32 -int WINAPI EXPORT CanalSetFilter29bit( long handle, Filter_Type_TypeDef type, unsigned long list, unsigned long mask ); -#else -int CanalSetFilter29bit( long handle, Filter_Type_TypeDef type, unsigned long id, unsigned long mask ); -#endif - -/*! - Get bootloader ver - - @param handle Handle to open physical CANAL channel. - @return zero on success or error-code on failure. -*/ -#ifdef WIN32 -int WINAPI EXPORT CanalGetBootloaderVersion(long handle, unsigned long *bootloader_version); -#else -int CanalGetBootloaderVersion(long handle, unsigned long *bootloader_version); -#endif - - -#ifdef WIN32 -int WINAPI EXPORT CanalGetHardwareVersion(long handle, unsigned long *hardware_version); -#else -int CanalGetHardwareVersion(long handle, unsigned long *hardware_version); -#endif - - -#ifdef WIN32 -int WINAPI EXPORT CanalGetFirmwareVersion(long handle, unsigned long *firmware_version); -#else -int CanalGetFirmwareVersion(long handle, unsigned long *firmware_version); -#endif - -#ifdef WIN32 -int WINAPI EXPORT CanalGetSerialNumber(long handle, unsigned long *serial); -#else -int CanalGetSerialNumber(long handle, unsigned long *serial); -#endif - -#ifdef WIN32 -int WINAPI EXPORT CanalGetVidPid(long handle, unsigned long *vidpid); -#else -int CanalGetVidPid(long handle, unsigned long *vidpid); -#endif - -#ifdef WIN32 -int WINAPI EXPORT CanalGetDeviceId(long handle, unsigned long *deviceid); -#else -int CanalGetDeviceId(long handle, unsigned long *deviceid); -#endif - -#ifdef WIN32 -int WINAPI EXPORT CanalGetVendor(long handle, unsigned int size, char *vendor); -#else -int CanalGetVendor(long handle, unsigned long *bootloader_version); -#endif - -#ifdef WIN32 -int WINAPI EXPORT CanalInterfaceStart(long handle); -#else -int CanalInterfaceStart(long handle); -#endif - -#ifdef WIN32 -int WINAPI EXPORT CanalInterfaceStop(long handle); -#else -int CanalInterfaceStop(long handle); -#endif - -#ifdef __cplusplus -} -#endif - -#endif //___CANAL_A_H___ diff --git a/dialogabout.ui b/dialogabout.ui index 7e6f0e4..f8bc7ec 100644 --- a/dialogabout.ui +++ b/dialogabout.ui @@ -41,7 +41,7 @@ - CANAL view 1.0.7rc2 32bit version + CANAL view 1.0.8 64bit version licensed under GPL 3.0 license ©RUSOKU Technologies Ltd diff --git a/main.cpp b/main.cpp index d2622e2..52e1b24 100644 --- a/main.cpp +++ b/main.cpp @@ -30,23 +30,10 @@ int main(int argc, char *argv[]) //QApplication::setStyle(QStyleFactory::create("Fusion")); qRegisterMetaType("canalMsg"); -// QApplication::addLibraryPath(a.applicationDirPath() + "dll"); -// QStringList paths = QCoreApplication::libraryPaths(); -// paths.append("."); -// paths.append("imageformats"); -// paths.append("platforms"); -// paths.append("dll"); -// QCoreApplication::setLibraryPaths(paths); - - - QApplication app(argc, argv); app.setWindowIcon(QIcon(":/resources/img/Rusoku_Icon.png")); app.setStyle("fusion"); - //QApplication::addLibraryPath(a.applicationDirPath() + "/dll/"); - //qDebug() << a.applicationDirPath() + "/dll/"; - QApplication::setOrganizationDomain("RUSOKU Technologies"); QApplication::setApplicationName("CANAL View"); diff --git a/mainwindow.cpp b/mainwindow.cpp index 8d4ba8e..e1a3b02 100644 --- a/mainwindow.cpp +++ b/mainwindow.cpp @@ -21,8 +21,7 @@ #include "ui_mainwindow.h" #include "dialogabout.h" #include "canal.h" -#include "canal_a.h" -#include "rxworkerthread.h" +//#include "rxworkerthread.h" #include "QValidator" #include #include @@ -66,7 +65,8 @@ MainWindow::MainWindow(QWidget *parent) : //timerStatistics = new QTimer; //connect(timerStatistics, &QTimer::timeout,this, &MainWindow::statisticsTimerTimeout); //connect(RxTableModel, &QAbstractTableModel::dataChanged, AnalyzerTableModel, &AnalyzerFrameTable::on_doAnalyze); - //connect(ui->RxMsgTableView-> + //connect(ui->RxMsgTableView-> + } MainWindow::~MainWindow() @@ -736,13 +736,12 @@ void MainWindow::on_pushButton_2_clicked() //QGuiApplication::setOverrideCursor(Qt::ArrowCursor); } - void MainWindow::StreamTable_scroll_down() { QModelIndex index; index.siblingAtRow(m_RxTableModel->getStreamDatabasePointer()->size()-1); - //QVector *temp_RxCanFrames = m_RxTableModel->getStreamDatabasePointer(); + //QVector *temp_RxCanFrames = m_RxTableModel->getStreamDatabasePointer(); ui->RxMsgTableView->scrollToBottom(); @@ -753,3 +752,23 @@ void MainWindow::StreamTable_scroll_down() //ui->RxMsgTableView->setFocus(); //ui->RxMsgTableView->selectRow(0); } + +void MainWindow::on_ListButton_clicked() +{ + canal_dev_list CanDevList; + QString deviceListStr; + qint8 cnt; + + ui->listDevices->clear(); + + if(CANAL_ERROR_SUCCESS == CanalGetDeviceList(&CanDevList,8)) + cnt = CanDevList.canDevCount; + else + return; + + for(int x = 0; x < cnt; x++ ){ + deviceListStr.clear(); + deviceListStr.append(CanDevList.canDevInfo[x].SerialNumber); + ui->listDevices->addItem(deviceListStr); + } +} diff --git a/mainwindow.h b/mainwindow.h index 227b26d..6ef7788 100644 --- a/mainwindow.h +++ b/mainwindow.h @@ -177,6 +177,9 @@ private slots: void on_le_txcount_textChanged(const QString &arg1); + + void on_ListButton_clicked(); + private: Ui::MainWindow *ui; diff --git a/mainwindow.ui b/mainwindow.ui index 8920d6a..02a0f58 100644 --- a/mainwindow.ui +++ b/mainwindow.ui @@ -6,7 +6,7 @@ 0 0 - 1380 + 1546 884 @@ -230,6 +230,38 @@ + + + + Device list + + + + + + + + + Qt::Vertical + + + + 20 + 40 + + + + + + + + Get device list + + + + + + @@ -368,7 +400,6 @@ - 50 false @@ -1505,7 +1536,7 @@ 0 0 - 1380 + 1546 21 diff --git a/mainwindowfiles.cpp b/mainwindowfiles.cpp index ac32fb9..3e4cc40 100644 --- a/mainwindowfiles.cpp +++ b/mainwindowfiles.cpp @@ -20,7 +20,6 @@ #include "mainwindow.h" #include "ui_mainwindow.h" #include "canal.h" -#include "canal_a.h" #include "rxworkerthread.h" #include "QValidator" #include diff --git a/mainwindowsendcanmsg.cpp b/mainwindowsendcanmsg.cpp index 5ab8608..6da96af 100644 --- a/mainwindowsendcanmsg.cpp +++ b/mainwindowsendcanmsg.cpp @@ -20,7 +20,6 @@ #include "mainwindow.h" #include "ui_mainwindow.h" #include "canal.h" -#include "canal_a.h" #include "rxworkerthread.h" #include "QValidator" #include diff --git a/mainwindowsettings.cpp b/mainwindowsettings.cpp index 8d4bba4..fec5c5e 100644 --- a/mainwindowsettings.cpp +++ b/mainwindowsettings.cpp @@ -62,7 +62,7 @@ void MainWindow::loadSettings() //settings->setPath(QSettings::IniFormat,QSettings::SystemScope,"settings.ini"); //setObjectName(name); - setWindowTitle("CANAL view v.1.0.7rc2"); + setWindowTitle("CANAL view v.1.0.8"); settings->beginGroup("OpenFlags"); ui->cb_SilentMode->setChecked(settings->value("Silent",false).toBool()); diff --git a/mainwindowwidgitsinit.cpp b/mainwindowwidgitsinit.cpp index 602423d..9056299 100644 --- a/mainwindowwidgitsinit.cpp +++ b/mainwindowwidgitsinit.cpp @@ -20,8 +20,7 @@ #include "mainwindow.h" #include "ui_mainwindow.h" #include "canal.h" -#include "canal_a.h" -#include "rxworkerthread.h" +//#include "rxworkerthread.h" #include "QValidator" #include #include @@ -240,6 +239,15 @@ void MainWindow::WidgetValuesInit() str = QString("%1.%2.%3").arg(temp_u32 & 0xFF).arg((temp_u32>>8) & 0xFF).arg(temp_u32>>16 & 0xFF); ui->label_Canal->setText(str); temp_u32 = CanalGetDllVersion(); + + unsigned char maj = temp_u32 & 0xff; + unsigned char min = (temp_u32>>8) & 0xff; + unsigned char patch = (temp_u32 >>16) & 0xff; + + if(( maj < 1) || (min < 0) || (patch < 5)){ + QMessageBox::critical(this,"Error","Wrong CANAL DLL version, 1.0.5 or later"); + } + str = QString("%1.%2.%3").arg(temp_u32 & 0xFF).arg((temp_u32>>8) & 0xFF).arg(temp_u32>>16 & 0xFF); ui->label_CanalDll->setText(str); diff --git a/messagetypes.h b/messagetypes.h index 858049d..bfbda80 100644 --- a/messagetypes.h +++ b/messagetypes.h @@ -3,7 +3,6 @@ #include #include "canal.h" -#include "canal_a.h" enum { diff --git a/rxworkerthread.h b/rxworkerthread.h index e4cf45e..356d06d 100644 --- a/rxworkerthread.h +++ b/rxworkerthread.h @@ -22,7 +22,6 @@ #define RXWORKERTHREAD_H #include "canal.h" -#include "canal_a.h" #include #include #include diff --git a/txworkerthread.h b/txworkerthread.h index c7070a1..40d6c6c 100644 --- a/txworkerthread.h +++ b/txworkerthread.h @@ -21,7 +21,6 @@ #define TXWORKERTHREAD_H #include "canal.h" -#include "canal_a.h" #include "portablesleep.h" #include #include