Skip to content

Commit

Permalink
Merge pull request #9 from uv-software/development
Browse files Browse the repository at this point in the history
Release Candidate 1 for Version 0.4.5
  • Loading branch information
uv-software authored Aug 25, 2023
2 parents 501c6e6 + 301e1d7 commit 0b3f025
Show file tree
Hide file tree
Showing 113 changed files with 34,545 additions and 1,324 deletions.
8 changes: 8 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,14 @@ Utilities/can_test/Debug
Utilities/can_test/Release
Utilities/can_test/*.sln
Utilities/can_test/*.vcxproj.user
Tests/.vs
Tests/x64
Tests/x86
Tests/Debug
Tests/Release
Tests/*.sln
Tests/*.vcxproj.user
Tests/TestSpecs
PeakCANBasic-cppcheck-build-dir
artifacts
Binaries
Expand Down
62 changes: 31 additions & 31 deletions Deployment.md
Original file line number Diff line number Diff line change
@@ -1,27 +1,31 @@
### Wrapper Library for PEAK PCAN® Interfaces (Windows®)
### CAN API V3 Wrapper Library for PEAK PCAN® Interfaces (Windows®)

_Copyright © 2005-2022 Uwe Vogt, UV Software, Berlin ([email protected])_
_Copyright © 2005-2023 Uwe Vogt, UV Software, Berlin ([email protected])_ \
_All rights reserved._

# Deployment

## Release Candidate
## Create the Release Candidate

### Precondition

- **_All changes are made exclusively on a feature branch!_**

### Preparation

1. Update the CAN API V3 sources in `$(PROJROOT)\Sources\CANAPI` from SVN repo
1. Update the PCANBasic DLL in `$(PROJROOT)\Sources\PCANBasic` from PEAK�s website
when required and commit them with commit comment:
- `Update PEAK's PCANBasic DLL (version `_n_`.`_n_`.`_n_`)` \
`- `_list of major changes (optional)_
2. Update the CAN API V3 sources in `$(PROJROOT)\Sources\CANAPI` from SVN repo
when required and commit them with commit comment:
- `Update CAN API V3 sources to rev. `_nnn_ \
`- `_list of major changes (optional)_
2. Update the PCANBasic DLL in `$(PROJROOT)\Sources\PCANBasic` from PEAK´s website
3. Update the CAN API V3 testing sources in `$(PROJROOT)\Tests` from SVN repo
when required and commit them with commit comment:
- `Update PEAK´s PCANBasic DLL (version `_n_`.`_nn_`)` \
- `Update CAN API V3 testing sources to rev. `_nnn_ \
`- `_list of major changes (optional)_
2. Check and update the version and date information in the following files:
4. Check and update the version and date information in the following files:
- `$(PROJROOT)\Sources\PeakCAN.h`
- `$(PROJROOT)\Sources\PeakCAN.cpp`
- `$(PROJROOT)\Sources\Wrapper\can_api.cpp`
Expand All @@ -38,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 `build_86.bat` and `build_64.bat` in the project root directory.
3. Run `x86_build.bat` and `x64_build.bat` in the project root directory.
- _**There should be absolute 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 All @@ -47,46 +51,42 @@ _All rights reserved._
5. Try out the utilities with different options.
- _**There should be no crash, hangup, or any other error.**_
- _If there is an error then fix it or create an issue in the repo._
6. Build and try out the examples (repair them when necessary);
6. Build and try out the examples (repair them if necessary);
- `$(PROJROOT)\Examples\C++`
- `$(PROJROOT)\Examples\Python`

### Pull Request

1. Update the `README.md` (e.g. development environment, supported devices, etc.).
2. Push the feature branch onto the remote repo.
3. Create a pull request and name it somehow like '**Release Candidate #**_n_'.
3. Create a pull request and name it somehow like '**Release Candidate _n_ for** ...'.
4. Review the changes and merge the feature branch into the default branch.

## Release Tag
## Create the Release Tag

### Preparation

1. Pull or clone the default branch on all development systems.
2. Double check all version numbers again (see above).
3. Run the batch file in the project root directory:
3. Run the batch files in the project root directory:
- `C:\Users\haumea>cd C:\Projects\CAN\Drivers\PeakCAN`
- `C:\Projects\CAN\Drivers\PeakCAN>build_86.bat`
- `C:\Projects\CAN\Drivers\PeakCAN>build_64.bat`
- `C:\Projects\CAN\Drivers\PeakCAN>install_86.bat`
- `C:\Projects\CAN\Drivers\PeakCAN>install_64.bat`
4. Update and build the CAN API V3 Loader Library:
- `C:\Users\haumea>cd C:\Projects\CAN\Library`
- `C:\Projects\CAN\Library>build_86.bat`
- `C:\Projects\CAN\Library>install_86.bat`
5. Update and build the CAN API V3 GoogleTest:
- `C:\Users\haumea>cd C:\Projects\CAN\Library\Testing\Windows`
- `C:\Projects\CAN\Library\Testing\Windows>build_86.bat`
6. Run the CAN API V3 GoogleTest with two PCAN-USB device:
- `C:\Projects\CAN\Library\Testing\Windows>Debug\can_testing --can_path=C:\Projects\CAN\API\json --can_dut1=PCAN-USB1 --can_dut2=PCAN-USB2 --gtest_output=xml:TestReport_PCAN-USB.xml --gtest_filter=-SmokeTest.* --sunnyday_traffic=2048` [...]
- `C:\Projects\CAN\Drivers\PeakCAN>x86_build.bat`
- `C:\Projects\CAN\Drivers\PeakCAN>x64_build.bat`
- `C:\Projects\CAN\Drivers\PeakCAN>x86_install.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`
5. Run the CAN API V3 GoogleTest with two PCAN-USB device:
- `C:\Projects\CAN\Drivers\PeakCAN\Tests>Debug\pcb_testing --can_dut1=PCAN-USB1 --can_dut2=PCAN-USB2 --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 binaries directory `$(PROJROOT)\Binaries`.
6. Run the CAN API V3 GoogleTest with two PCAN-USB FD device:
- `C:\Projects\CAN\Library\Testing\Windows>Debug\can_testing --can_path=C:\Projects\CAN\API\json --can_dut1=PCAN-USB3 --can_dut2=PCAN-USB4 --gtest_output=xml:TestReport_PCAN-USB_FD.xml --gtest_filter=-SmokeTest.* --sunnyday_traffic=2048` [...]
- `C:\Projects\CAN\Drivers\PeakCAN\Tests>Debug\pcb_testing --can_dut1=PCAN-USB3 --can_dut2=PCAN-USB4 --gtest_output=xml:TestReport_PCAN-USB_FD.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 binaries directory `$(PROJROOT)\Binaries`.
6. Run the CAN API V3 GoogleTest with the dual-channel PCAN-USB Pro FDdevice:
- `C:\Projects\CAN\Library\Testing\Windows>Debug\can_testing --can_path=C:\Projects\CAN\API\json --can_dut1=PCAN-USB5 --can_dut2=PCAN-USB6 --gtest_output=xml:TestReport_PCAN-USB_Pro_FD.xml --gtest_filter=-SmokeTest.* --sunnyday_traffic=2048` [...]
6. Run the CAN API V3 GoogleTest with the dual-channel PCAN-USB Pro FD device:
- `C:\Projects\CAN\Drivers\PeakCAN\Tests>Debug\pcb_testing --can_dut1=PCAN-USB5 --can_dut2=PCAN-USB6 --gtest_output=xml:TestReport_PCAN-USB_Pro_FD.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 binaries directory `$(PROJROOT)\Binaries`.
7. Pack the artifacts into a .zip-archive, e.g. `artifacts.zip`:
Expand All @@ -100,13 +100,13 @@ _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.2.1` (cf. semantic versioning)
- Tag version: e.g `v0.4.5` (cf. semantic versioning)
- Target: `main` (default branch)
- Release title: e.g. `Release of June 3, 2021`
- Release title: e.g. `Release of August 25, 2023`
- Change-log: list all major changes, e.g. from commit comments
- Assets: drag and drop the artifacts archive (see above)
3. Click on `Publish release`.
4. That´s all folks!
4. Thats all folks!

### Announcement

Expand Down
Binary file modified Libraries/CANAPI/Resource.rc
Binary file not shown.
18 changes: 9 additions & 9 deletions Libraries/CANAPI/uvcanpcb.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -44,52 +44,52 @@
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug_dll|Win32'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<PlatformToolset>v142</PlatformToolset>
<PlatformToolset>v143</PlatformToolset>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug_lib|Win32'" Label="Configuration">
<ConfigurationType>StaticLibrary</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<PlatformToolset>v142</PlatformToolset>
<PlatformToolset>v143</PlatformToolset>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release_dll|Win32'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<PlatformToolset>v142</PlatformToolset>
<PlatformToolset>v143</PlatformToolset>
<WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release_lib|Win32'" Label="Configuration">
<ConfigurationType>StaticLibrary</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<PlatformToolset>v142</PlatformToolset>
<PlatformToolset>v143</PlatformToolset>
<WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug_dll|x64'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<PlatformToolset>v142</PlatformToolset>
<PlatformToolset>v143</PlatformToolset>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug_lib|x64'" Label="Configuration">
<ConfigurationType>StaticLibrary</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<PlatformToolset>v142</PlatformToolset>
<PlatformToolset>v143</PlatformToolset>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release_dll|x64'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<PlatformToolset>v142</PlatformToolset>
<PlatformToolset>v143</PlatformToolset>
<WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release_lib|x64'" Label="Configuration">
<ConfigurationType>StaticLibrary</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<PlatformToolset>v142</PlatformToolset>
<PlatformToolset>v143</PlatformToolset>
<WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
Expand Down Expand Up @@ -366,4 +366,4 @@
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
</ImportGroup>
</Project>
</Project>
16 changes: 8 additions & 8 deletions Libraries/PeakCAN/PeakCAN.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -44,52 +44,52 @@
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug_dll|Win32'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<PlatformToolset>v142</PlatformToolset>
<PlatformToolset>v143</PlatformToolset>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug_lib|Win32'" Label="Configuration">
<ConfigurationType>StaticLibrary</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<PlatformToolset>v142</PlatformToolset>
<PlatformToolset>v143</PlatformToolset>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release_dll|Win32'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<PlatformToolset>v142</PlatformToolset>
<PlatformToolset>v143</PlatformToolset>
<WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release_lib|Win32'" Label="Configuration">
<ConfigurationType>StaticLibrary</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<PlatformToolset>v142</PlatformToolset>
<PlatformToolset>v143</PlatformToolset>
<WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug_dll|x64'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<PlatformToolset>v142</PlatformToolset>
<PlatformToolset>v143</PlatformToolset>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug_lib|x64'" Label="Configuration">
<ConfigurationType>StaticLibrary</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<PlatformToolset>v142</PlatformToolset>
<PlatformToolset>v143</PlatformToolset>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release_dll|x64'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<PlatformToolset>v142</PlatformToolset>
<PlatformToolset>v143</PlatformToolset>
<WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release_lib|x64'" Label="Configuration">
<ConfigurationType>StaticLibrary</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<PlatformToolset>v142</PlatformToolset>
<PlatformToolset>v143</PlatformToolset>
<WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
Expand Down
Binary file modified Libraries/PeakCAN/Resource.rc
Binary file not shown.
20 changes: 10 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
### CAN API V3 Wrapper Library for Peak-System PCAN&reg; Interfaces (Windows&reg;)

_Copyright &copy; 2005-2022 Uwe Vogt, UV Software, Berlin ([email protected])_
_Copyright &copy; 2005-2023 Uwe Vogt, UV Software, Berlin ([email protected])_

# CAN API V3 for PCAN Interfaces

Expand Down Expand Up @@ -75,16 +75,16 @@ 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 `build_86.bat`.
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>build_86.bat
C:\Projects\CAN\Drivers\PeakCAN>x86_build.bat
```
To build all 64-bit targets (x64) run the script `build_86.bat`.
To build all 64-bit targets (x64) run the script `x64_build.bat`.
```
C:\Users\haumea>cd C:\Projects\CAN\Drivers\PeakCAN
C:\Projects\CAN\Drivers\PeakCAN>build_64.bat
C:\Projects\CAN\Drivers\PeakCAN>x64_build.bat
```
#### uvPeakCAN (DLL)
Expand Down Expand Up @@ -118,18 +118,18 @@ Type `can_test /?` to display all program options.
### Development Environment
- Microsoft Visual Studio Community 2019 (Version 16.11.17)
- Microsoft Visual Studio Community 2022 (Version 17.7.2)
### Required PCANBasic DLL
- Version 4.5 or later _(Latest is Greatest!)_
### Tested CAN Hardware
- PCAN-USB - single channel, CAN 2.0 (Peak´s item no.: IPEH-002021, IPEH-002021)
- PCAN-USB FD - single channel, CAN 2.0 and CAN FD (Peak´s item no.: IPEH-004022)
- PCAN-USB Pro FD - dual channel, CAN 2.0 and CAN FD (Peak´s item no.: IPEH-004061)
### Required PCANBasic DLL
- Version 4.5 or later _(Latest is Greatest!)_
## Known Bugs and Caveats
For a list of known bugs and caveats see tab [Issues](https://github.com/uv-software/PCANBasic-Wrapper/issues) in the GitHub repo.
Expand Down
16 changes: 8 additions & 8 deletions Sources/CANAPI/CANAPI.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
//
// CAN Interface API, Version 3 (Interface Definition)
//
// Copyright (c) 2004-2022 Uwe Vogt, UV Software, Berlin ([email protected])
// Copyright (c) 2004-2023 Uwe Vogt, UV Software, Berlin ([email protected])
// All rights reserved.
//
// This file is part of CAN API V3.
Expand Down Expand Up @@ -73,9 +73,9 @@
/// zero to compile your program with the CAN API source files or to
/// link your program with the static library at compile-time.
///
/// \author $Author: makemake $
/// \author $Author: haumea $
//
/// \version $Rev: 1033 $
/// \version $Rev: 1143 $
//
/// \defgroup can_api CAN Interface API, Version 3
/// \{
Expand Down Expand Up @@ -155,7 +155,7 @@ class CANCPP CCanApi {
MessageLost = CANERR_MSG_LST, ///< message lost
TransmitterBusy = CANERR_TX_BUSY, ///< transmitter busy
ReceiverEmpty = CANERR_RX_EMPTY, ///< receiver empty
ErrorFrame = CANERR_ERR_FRAME, ///< error frame
QueueOverrun = CANERR_QUE_OVR, ///< queue overrun
Timeout = CANERR_TIMEOUT, ///< timed out
ResourceError = CANERR_RESOURCE, ///< resource allocation
InvalidBaudrate = CANERR_BAUDRATE, ///< illegal baudrate
Expand Down Expand Up @@ -440,8 +440,8 @@ class CANCPP CCanApi {
/// \{
public:
static CANAPI_Return_t MapIndex2Bitrate(int32_t index, CANAPI_Bitrate_t &bitrate);
static CANAPI_Return_t MapString2Bitrate(const char *string, CANAPI_Bitrate_t &bitrate);
static CANAPI_Return_t MapBitrate2String(CANAPI_Bitrate_t bitrate, char *string, size_t length);
static CANAPI_Return_t MapString2Bitrate(const char *string, CANAPI_Bitrate_t &bitrate, bool &data, bool &sam);
static CANAPI_Return_t MapBitrate2String(CANAPI_Bitrate_t bitrate, char *string, size_t length, bool data = false, bool sam = false);
static CANAPI_Return_t MapBitrate2Speed(CANAPI_Bitrate_t bitrate, CANAPI_BusSpeed_t &speed);
/// \}

Expand All @@ -457,7 +457,7 @@ class CANCPP CCanApi {
0U, 1U, 2U, 3U, 4U, 5U, 6U, 7U, 8U, 8U, 8U, 8U, 8U, 8U, 8U, 8U
#endif
};
return dlc_table[dlc & 0xFU];
return dlc_table[(dlc < 16U) ? dlc : 15U];
}
static uint8_t Len2Dlc(uint8_t len) {
#if (OPTION_CAN_2_0_ONLY == 0)
Expand All @@ -478,4 +478,4 @@ class CANCPP CCanApi {
/// \}
#endif // CANAPI_H_INCLUDED
/// \}
// $Id: CANAPI.h 1033 2022-01-11 19:58:04Z makemake $ Copyright (c) UV Software //
// $Id: CANAPI.h 1143 2023-08-13 17:50:24Z haumea $ Copyright (c) UV Software //
Loading

0 comments on commit 0b3f025

Please sign in to comment.