Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,14 @@ Utilities/can_moni/Release
Utilities/can_moni/can_moni
Utilities/can_moni/*.sln
Utilities/can_moni/*.vcxproj.user
Utilities/can_send/.vs
Utilities/can_send/x64
Utilities/can_send/x86
Utilities/can_send/Debug
Utilities/can_send/Release
Utilities/can_send/can_send
Utilities/can_send/*.sln
Utilities/can_send/*.vcxproj.user
Utilities/can_test/.vs
Utilities/can_test/x64
Utilities/can_test/x86
Expand Down
24 changes: 10 additions & 14 deletions Deployment.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,23 +17,22 @@ _All rights reserved._
from PEAK's website and commit it with commit comment:
- `Update PEAK's PCANBasic DLL (version `_n_`.`_n_`.`_n_`)` \
`- `_list of major changes (optional)_
2. If necessary, update the CAN API V3 sources in `$(PROJROOT)\Sources\CANAPI`
1. If necessary, update the CAN API V3 sources in `$(PROJROOT)\Sources\CANAPI`
from the SVN repo and commit them with commit comment:
- `Update CAN API V3 sources to rev. `_nnn_ \
`- `_list of major changes (optional)_
3. If necessary, update the CAN API V3 testing sources in `$(PROJROOT)\Tests`
1. If necessary, update the CAN API V3 testing sources in `$(PROJROOT)\Tests`
from the SVN repo and commit them with commit comment:
- `Update CAN API V3 testing sources to rev. `_nnn_ \
`- `_list of major changes (optional)_
4. Check and update the version and date information in the following files:
1. Check and update the version and date information in the following files:
- `$(PROJROOT)\Sources\Version.h`
- `$(PROJROOT)\Sources\PeakCAN.h`
- `$(PROJROOT)\Sources\PeakCAN.cpp`
- `$(PROJROOT)\Sources\Wrapper\can_api.c`
- `$(PROJROOT)\Libraries\CANAPI\uvcanpcb.rc`
- `$(PROJROOT)\Libraries\PeakCAN\PeakCAN.rc`
- `$(PROJROOT)\Utilities\can_moni\Driver.h`
- `$(PROJROOT)\Utilities\can_test\Driver.h`
- `$(PROJROOT)/Utilities/can_moni/README.md`
- `$(PROJROOT)/Utilities/can_port/README.md`
- `$(PROJROOT)/Utilities/can_send/README.md`
- `$(PROJROOT)/Utilities/can_test/README.md`

### Procedure

Expand All @@ -43,7 +42,7 @@ _All rights reserved._
2. Open the trial program with Visual Studio and run a code analysis.
- _**There should not be any serious finding.**_
- _If there are findings then fix them or create an issue in the repo._
3. Run `x86_build.bat` and `x64_build.bat` in the project root directory.
3. Run `x64_build.bat` in the project root directory.
- _**There should be absolutely no compiler or linker error!**_
- _If there are compiler or linker warnings then think twice._
4. Try out the trial program with different options.
Expand Down Expand Up @@ -71,16 +70,13 @@ _All rights reserved._
2. Double check all version numbers again (see above).
3. Run the batch files in the project root directory:
- `C:\Users\haumea>cd C:\Projects\CAN\Drivers\PeakCAN`
- `C:\Projects\CAN\Drivers\PeakCAN>x86_build.bat`
- `C:\Projects\CAN\Drivers\PeakCAN>x86_install.bat`
- `C:\Projects\CAN\Drivers\PeakCAN>x64_build.bat`
- `C:\Projects\CAN\Drivers\PeakCAN>x64_install.bat`
4. Build the CAN API V3 GoogleTest program:
- `C:\Users\haumea>cd C:\Projects\CAN\Drivers\PeakCAN\Tests`
- `C:\Projects\CAN\Drivers\PeakCAN\Tests>x86_build.bat`
- `C:\Projects\CAN\Drivers\PeakCAN\Tests>x64_build.bat`
5. Run the CAN API V3 GoogleTest program with two PCAN-USB devices in CAN 2.0 mode:
- `C:\Projects\CAN\Drivers\PeakCAN\Tests>Debug\pcb_testing --can_dut1=PCAN-USB1 --can_dut2=PCAN-USB2 --can_mode=2.0 --can_bitrate=DEFAULT --gtest_output=xml:TestReport_PCAN-USB.xml --run_all=YES --smoketest_frames=100000` [...]
- `C:\Projects\CAN\Drivers\PeakCAN\Tests>x64\Debug\pcb_testing --can_dut1=PCAN-USB1 --can_dut2=PCAN-USB2 --can_mode=2.0 --can_bitrate=DEFAULT --gtest_output=xml:TestReport_PCAN-USB.xml --run_all=YES --smoketest_frames=100000` [...]
- _If there is any error then **stop** here or create an issue for each error in the repo._
- Copy the test report into the binary's directory `$(PROJROOT)\Binaries`.
6. Run the CAN API V3 GoogleTest program with two PCAN-USB FD devices in CAN FD mode:
Expand All @@ -98,7 +94,7 @@ _All rights reserved._

1. Click on `Draft a new release` in the [GitHub](https://github.com/uv-software/PeakCAN-Wrapper) repo.
2. Fill out all required fields:
- Tag version: e.g `v0.5` (cf. semantic versioning)
- Tag version: e.g `v0.6` (cf. semantic versioning)
- Target: `main` (default branch)
- Release title: e.g. `Release of January 19, 2038`
- Change-log: list all major changes, e.g. from commit comments
Expand Down
18 changes: 12 additions & 6 deletions Examples/C++/can_recv.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -54,16 +54,22 @@ int main(/*int argc, const char * argv[]*/) {
std::cerr << "+++ error: interface could not be started" << std::endl;
goto teardown;
}
std::cout << "Press Ctrl+C to abort..." << std::endl;
std::cout << "Press ^C to abort." << std::endl;
while (running) {
if ((retVal = myDriver.ReadMessage(message, CANREAD_INFINITE)) == CCanApi::NoError) {
fprintf(stdout, "%i\t", frames++);
fprintf(stdout, "%7li.%04li\t", (long)message.timestamp.tv_sec, message.timestamp.tv_nsec / 100000);
if (!opMode.fdoe)
fprintf(stdout, "%03X\t%c%c [%u] ", message.id, message.xtd ? 'X' : 'S', message.rtr ? 'R' : ' ', message.dlc);
else
fprintf(stdout, "%03X\t%c%c%c%c%c [%u] ", message.id, message.xtd ? 'X' : 'S', message.rtr ? 'R' : ' ',
message.fdf ? 'F' : ' ', message.brs ? 'B' : ' ', message.esi ? 'E' :' ', CCanApi::Dlc2Len(message.dlc));
fprintf(stdout, "%03X\t", message.id);
if (!message.sts) {
fputc(message.xtd ? 'X' : 'S', stdout);
fputc(message.fdf ? 'F' : '-', stdout);
fputc(message.brs ? 'B' : '-', stdout);
fputc(message.esi ? 'E' : '-', stdout);
fputc(message.rtr ? 'R' : '-', stdout);
} else {
fprintf(stdout, "Error");
}
printf(" [%u]", CCanApi::Dlc2Len(message.dlc));
for (uint8_t i = 0; i < CCanApi::Dlc2Len(message.dlc); i++)
fprintf(stdout, " %02X", message.data[i]);
if (message.sts)
Expand Down
13 changes: 7 additions & 6 deletions Examples/Python/CANAPI.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,9 @@
#
# CAN Interface API, Version 3 (Python Wrapper)
#
# Copyright (c) 2005-2025 Uwe Vogt, UV Software, Berlin (info@uv-software.com)
# All rights reserved.
# Copyright (c) 2005-2012 Uwe Vogt, UV Software, Friedrichshafen
# Copyright (c) 2013-2025 Uwe Vogt, UV Software, Berlin (info@uv-software.com)
# All rights reserved.
#
# This file is part of CAN API V3.
#
Expand All @@ -21,7 +22,7 @@
# this list of conditions and the following disclaimer in the documentation
# and/or other materials provided with the distribution.
#
# CAN API V3 IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS AS IS
# CAN API V3 IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
# DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
Expand Down Expand Up @@ -54,9 +55,9 @@
Interface API for various CAN interfaces from different
vendors running under multiple operating systems.

$Author: quaoar $
$Author: makemake $

$Rev: 1408 $
$Rev: 1416 $
"""
from ctypes import *
import platform
Expand All @@ -71,7 +72,7 @@

# CAN API V3 - Python Wrapper
#
CAN_API_V3_PYTHON = {'major': 0, 'minor': 3, 'patch': 1}
CAN_API_V3_PYTHON = {'major': 0, 'minor': 3, 'patch': 2}

# CAN Identifier Ranges
#
Expand Down
31 changes: 18 additions & 13 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -83,38 +83,43 @@ C:\Projects\CAN\Drivers\PeakCAN>build_no.bat
```
Repeat this step after each `git commit`, `git pull`, `git clone`, etc.

To build all 32-bit targets (x86) run the script `x86_build.bat`.
```
C:\Users\haumea>cd C:\Projects\CAN\Drivers\PeakCAN
C:\Projects\CAN\Drivers\PeakCAN>x86_build.bat
```

To build all 64-bit targets (x64) run the script `x64_build.bat`.
To build all targets (x64) run the script `x64_build.bat`.
```
C:\Users\haumea>cd C:\Projects\CAN\Drivers\PeakCAN
C:\Projects\CAN\Drivers\PeakCAN>x64_build.bat
```
(The version number of the libraries can be adapted by editing the `.rc` files in the corresponding subfolders. Don´t forget to set the version number also in the header file `Version.h`.)

#### uvPeakCAN (DLL)
#### Libraries

##### uvPeakCAN (DLL)

___uvPeakCAN___ is a dynamic link library with a CAN API V3 compatible application programming interface for use in __C++__ applications.
See header file `PeakCAN.h` for a description of all class members.

#### u3canpcb (DLL)
##### u3canpcb (DLL)

___u3canpcb___ is a dynamic link library with a CAN API V3 compatible application programming interface for use in __C__ applications.
See header file `can_api.h` for a description of all API functions.

#### can_moni (CLI)
#### Utilities

##### can_send

`can_send` is a command line tool to send CAN messages that are entered at the program prompt.
The syntax is taken from the Linux SocketCAN utility [can_utils\cansend](https://github.com/linux-can/can-utils/tree/master).

Type `can_send /?` to display all program options.

##### can_moni (CLI)

`can_moni` is a command line tool to view incoming CAN messages.
I hate this messing around with binary masks for identifier filtering.
So I wrote this little program to have an exclude list for single identifiers or identifier ranges (see program option `/EXCLUDE` or just `/X`). Precede the list with a `~` and you get an include list.

Type `can_moni /?` to display all program options.

#### can_test (CLI)
##### can_test (CLI)

`can_test` is a command line tool to test CAN communication.
Originally developed for electronic environmental tests on an embedded Linux system with SocketCAN, I´m using it for many years as a traffic generator for CAN stress-tests.
Expand All @@ -127,7 +132,7 @@ Type `can_test /?` to display all program options.

### Development Environment

- Microsoft Visual Studio Community 2022 (Version 17.12.4)
- Microsoft Visual Studio Community 2022 (Version 17.13.2)

### Required PCANBasic DLL

Expand Down Expand Up @@ -168,7 +173,7 @@ You can choose between one of them if you use these portions of this work in who

Windows is a registered trademark of Microsoft Corporation in the United States and/or other countries. \
PCAN is a registered trademark of PEAK-System Technik GmbH, Darmstadt, Germany. \
Mac and macOS are trademarks of Apple Inc., registered in the U.S. and other countries. \
Mac and macOS are trademarks of Apple Inc., registered in the U.S. and other countries and regions. \
Linux is a registered trademark of Linus Torvalds. \
All other company, product and service names mentioned herein may be trademarks, registered trademarks, or service marks of their respective owners.

Expand Down
3 changes: 1 addition & 2 deletions Sources/CANAPI/.gitignore
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
.svn
# Not realized yet
CANIPC_Message.h
# we don't use the JSON files yet
can_dev.?
vanilla.?
# other blacklisted files
SerialCAN_Defines.h
SocketCAN_Defines.h
RocketCAN_Defines.h
CANIPC_Message.h
8 changes: 4 additions & 4 deletions Sources/CANAPI/CANAPI_Version.h
Original file line number Diff line number Diff line change
Expand Up @@ -53,17 +53,17 @@
*
* @note This is only a dummy file to have a SVN revision number.
*
* @author $Author: makemake $
* @author $Author: quaoar $
*
* @version $Rev: 1407 $
* @version $Rev: 1467 $
*
* @addtogroup can_api
* @{
*/
#ifndef CANAPI_VERSION_H_INCLUDED
#define CANAPI_VERSION_H_INCLUDED
// SVN revision number (update with each commit: III)
#define CAN_API_REV "$Rev: 1407 $"
// SVN revision number (update with each commit: VI)
#define CAN_API_REV "$Rev: 1467 $"
#endif /* CANAPI_VERSION_H_INCLUDED */
/** @}
*/
Expand Down
Loading
Loading