-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #7 from mac-can/development
Release candidate 1 for version 0.2.3
- Loading branch information
Showing
33 changed files
with
1,116 additions
and
476 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
### macOS® Wrapper Library for PCAN-USB Interfaces from Peak-System | ||
|
||
_Copyright © 2005-2010, 2012-2022 Uwe Vogt, UV Software, Berlin ([email protected])_ | ||
_Copyright © 2005-2010, 2012-2022 Uwe Vogt, UV Software, Berlin ([email protected])_ | ||
|
||
# CAN API V3 for PCAN-USB Interfaces | ||
|
||
|
@@ -31,6 +31,9 @@ public: | |
~CPeakCAN(); | ||
|
||
// CCanApi overrides | ||
static bool GetFirstChannel(SChannelInfo &info, void *param = NULL); | ||
static bool GetNextChannel(SChannelInfo &info, void *param = NULL); | ||
|
||
static CANAPI_Return_t ProbeChannel(int32_t channel, const CANAPI_OpMode_t &opMode, const void *param, EChannelState &state); | ||
static CANAPI_Return_t ProbeChannel(int32_t channel, const CANAPI_OpMode_t &opMode, EChannelState &state); | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
.svn | ||
.svn/ | ||
# we don't use the JSON files yet | ||
can_dev.? |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,7 +2,7 @@ | |
// | ||
// CAN Interface API, Version 3 (Interface Definition) | ||
// | ||
// Copyright (c) 2004-2021 Uwe Vogt, UV Software, Berlin ([email protected]) | ||
// Copyright (c) 2004-2022 Uwe Vogt, UV Software, Berlin ([email protected]) | ||
// All rights reserved. | ||
// | ||
// This file is part of CAN API V3. | ||
|
@@ -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: eris $ | ||
/// \author $Author: makemake $ | ||
// | ||
/// \version $Rev: 1013 $ | ||
/// \version $Rev: 1033 $ | ||
// | ||
/// \defgroup can_api CAN Interface API, Version 3 | ||
/// \{ | ||
|
@@ -144,13 +144,6 @@ typedef int CANAPI_Return_t; | |
/// \{ | ||
class CANCPP CCanApi { | ||
public: | ||
/// \brief CAN channel states | ||
enum EChannelState { | ||
ChannelOccupied = CANBRD_OCCUPIED, ///< channel is available, but occupied | ||
ChannelAvailable = CANBRD_PRESENT, ///< channel is available and can be used | ||
ChannelNotAvailable = CANBRD_NOT_PRESENT, ///< channel is not available | ||
ChannelNotTestable = CANBRD_NOT_TESTABLE ///< channel is not testable | ||
}; | ||
/// \brief Common error codes (CAN API V3 compatible) | ||
enum EErrorCodes { | ||
NoError = CANERR_NOERROR, ///< no error! | ||
|
@@ -176,6 +169,80 @@ class CANCPP CCanApi { | |
FatalError = CANERR_FATAL, ///< fatal error | ||
VendorSpecific = CANERR_VENDOR ///< offset for vendor-specific error code | ||
}; | ||
/// \brief CAN channel states | ||
enum EChannelState { | ||
ChannelOccupied = CANBRD_OCCUPIED, ///< channel is available, but occupied | ||
ChannelAvailable = CANBRD_PRESENT, ///< channel is available and can be used | ||
ChannelNotAvailable = CANBRD_NOT_PRESENT, ///< channel is not available | ||
ChannelNotTestable = CANBRD_NOT_TESTABLE ///< channel is not testable | ||
}; | ||
/// \brief CAN channel information | ||
struct SChannelInfo { | ||
int32_t m_nChannelNo; ///< channel no. at actual index in the interface list | ||
char m_szDeviceName[CANPROP_MAX_BUFFER_SIZE]; ///< device name at actual index in the interface list | ||
char m_szDeviceDllName[CANPROP_MAX_BUFFER_SIZE]; ///< file name of the DLL at actual index in the interface list | ||
int32_t m_nLibraryId; ///< library id at actual index in the interface list | ||
char m_szVendorName[CANPROP_MAX_BUFFER_SIZE]; ///< vendor name at actual index in the interface list | ||
}; | ||
#if (OPTION_CANAPI_LIBRARY != 0) | ||
/// \brief CAN API library information | ||
struct SLibraryInfo { | ||
int32_t m_nLibraryId; ///< library id at actual index in the vendor list | ||
char m_szVendorName[CANPROP_MAX_BUFFER_SIZE]; ///< vendor name at actual index in the vendor list | ||
char m_szVendorDllName[CANPROP_MAX_BUFFER_SIZE]; ///< file name of the DLL at actual index in the vendor list | ||
}; | ||
/// \brief query library information of the first CAN API library in the | ||
/// list of vendors, if any. | ||
// | ||
/// \param[out] info - the library information of the first entry in the list | ||
// | ||
/// \returns true if library information have been successfully read, or | ||
/// false on error. | ||
// | ||
static bool GetFirstLibrary(SLibraryInfo &info); | ||
|
||
/// \brief query library information of the next CAN API library in the | ||
/// list of vendors, if any. | ||
// | ||
/// \param[out] info - the library information of the next entry in the list | ||
// | ||
/// \returns true if library information have been successfully read, or | ||
/// false on error. | ||
// | ||
static bool GetNextLibrary(SLibraryInfo &info); | ||
#endif | ||
/// \brief query channel information of the first CAN interface in the | ||
/// list of CAN interfaces, if any. | ||
// | ||
/// \param[in] library - library id of the CAN interface list, or -1 for all vendors | ||
/// \param[out] info - the channel information of the first entry in the list | ||
/// \param[out] param - pointer to channel-specific parameters | ||
// | ||
/// \returns true if channel information have been successfully read, or | ||
/// false on error. | ||
// | ||
#if (OPTION_CANAPI_LIBRARY != 0) | ||
static bool GetFirstChannel(int32_t library, SChannelInfo &info, void *param = NULL); | ||
#else | ||
static bool GetFirstChannel(SChannelInfo &info, void *param = NULL); | ||
#endif | ||
|
||
/// \brief query channel information of the first CAN interface in the | ||
/// list of CAN interfaces, if any. | ||
// | ||
/// \param[in] library - library id of the CAN interface list, or -1 for all vendors | ||
/// \param[out] info - the channel information of the next entry in the list | ||
/// \param[out] param - pointer to channel-specific parameters | ||
// | ||
/// \returns true if channel information have been successfully read, or | ||
/// false on error. | ||
// | ||
#if (OPTION_CANAPI_LIBRARY != 0) | ||
static bool GetNextChannel(int32_t library, SChannelInfo &info, void *param = NULL); | ||
#else | ||
static bool GetNextChannel(SChannelInfo &info, void *param = NULL); | ||
#endif | ||
|
||
/// \brief probes if the CAN interface (hardware and driver) given by | ||
/// the argument [ 'library' and ] 'channel' is present, | ||
/// and if the requested operation mode is supported by the | ||
|
@@ -306,7 +373,7 @@ class CANCPP CCanApi { | |
// | ||
/// \returns 0 if successful, or a negative value on error. | ||
// | ||
virtual CANAPI_Return_t GetBusLoad(uint8_t &load) = 0; | ||
virtual CANAPI_Return_t GetBusLoad(uint8_t &load) = 0; // deprecated | ||
|
||
/// \brief retrieves the bit-rate setting of the CAN interface. The | ||
/// CAN controller must be in operation state 'running'. | ||
|
@@ -351,14 +418,14 @@ class CANCPP CCanApi { | |
// | ||
/// \returns pointer to a zero-terminated string, or NULL on error. | ||
// | ||
virtual char *GetHardwareVersion() = 0; | ||
virtual char *GetHardwareVersion() = 0; // deprecated | ||
|
||
/// \brief retrieves the firmware version of the CAN controller | ||
/// board as a zero-terminated string. | ||
// | ||
/// \returns pointer to a zero-terminated string, or NULL on error. | ||
// | ||
virtual char *GetFirmwareVersion() = 0; | ||
virtual char *GetFirmwareVersion() = 0; // deprecated | ||
|
||
/// \brief retrieves version information of the CAN API V3 driver | ||
/// as a zero-terminated string. | ||
|
@@ -411,4 +478,4 @@ class CANCPP CCanApi { | |
/// \} | ||
#endif // CANAPI_H_INCLUDED | ||
/// \} | ||
// $Id: CANAPI.h 1013 2021-12-13 21:34:15Z eris $ Copyright (c) UV Software // | ||
// $Id: CANAPI.h 1033 2022-01-11 19:58:04Z makemake $ Copyright (c) UV Software // |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,7 +2,7 @@ | |
/* | ||
* CAN Interface API, Version 3 (Data Types and Defines) | ||
* | ||
* Copyright (c) 2004-2021 Uwe Vogt, UV Software, Berlin ([email protected]) | ||
* Copyright (c) 2004-2022 Uwe Vogt, UV Software, Berlin ([email protected]) | ||
* All rights reserved. | ||
* | ||
* This file is part of CAN API V3. | ||
|
@@ -49,9 +49,9 @@ | |
* | ||
* @brief CAN API V3 for generic CAN Interfaces - Data Types and Defines | ||
* | ||
* @author $Author: makemake $ | ||
* @author $Author: haumea $ | ||
* | ||
* @version $Rev: 1017 $ | ||
* @version $Rev: 1036 $ | ||
* | ||
* @addtogroup can_api | ||
* @{ | ||
|
@@ -292,7 +292,7 @@ extern "C" { | |
#define CANPROP_GET_LIBRARY_ID 4U /**< library id of the library (int32_t) */ | ||
#define CANPROP_GET_LIBRARY_VENDOR 5U /**< vendor name of the library (char[256]) */ | ||
#define CANPROP_GET_LIBRARY_DLLNAME 6U /**< file name of the library DLL (char[256]) */ | ||
#define CANPROP_GET_DEVICE_CHANNEL 10U /**< device type of the CAN interface (int32_t) */ | ||
#define CANPROP_GET_DEVICE_TYPE 10U /**< device type of the CAN interface (int32_t) */ | ||
#define CANPROP_GET_DEVICE_NAME 11U /**< device name of the CAN interface (char[256]) */ | ||
#define CANPROP_GET_DEVICE_VENDOR 12U /**< vendor name of the CAN interface (char[256]) */ | ||
#define CANPROP_GET_DEVICE_DLLNAME 13U /**< file name of the CAN interface DLL (char[256]) */ | ||
|
@@ -302,24 +302,23 @@ extern "C" { | |
#define CANPROP_GET_BITRATE 17U /**< active bit-rate of the CAN controller (can_bitrate_t) */ | ||
#define CANPROP_GET_SPEED 18U /**< active bus speed of the CAN controller (can_speed_t) */ | ||
#define CANPROP_GET_STATUS 19U /**< current status register of the CAN controller (uint8_t) */ | ||
#define CANPROP_GET_BUSLOAD 20U /**< current bus load of the CAN controller (uint8_t) */ | ||
#define CANPROP_GET_BUSLOAD 20U /**< current bus load of the CAN controller (uint16_t) */ | ||
#define CANPROP_GET_NUM_CHANNELS 21U /**< numbers of CAN channels on the CAN interface (uint8_t) */ | ||
#define CANPROP_GET_CAN_CHANNEL 22U /**< active CAN channel on the CAN interface (uint8_t) */ | ||
#define CANPROP_GET_CAN_CLOCKS 23U /**< supported CAN clocks (in [Hz]) (int32_t[64]) */ | ||
#define CANPROP_GET_TX_COUNTER 24U /**< total number of sent messages (uint64_t) */ | ||
#define CANPROP_GET_RX_COUNTER 25U /**< total number of reveiced messages (uint64_t) */ | ||
#define CANPROP_GET_ERR_COUNTER 26U /**< total number of reveiced error frames (uint64_t) */ | ||
#define CANPROP_GET_RX_COUNTER 25U /**< total number of received messages (uint64_t) */ | ||
#define CANPROP_GET_ERR_COUNTER 26U /**< total number of received error frames (uint64_t) */ | ||
#define CANPROP_GET_RCV_QUEUE_SIZE 27U /**< maximum number of message the receive queue can hold (uint32_t) */ | ||
#define CANPROP_GET_RCV_QUEUE_HIGH 28U /**< maximum number of message the receive queue has hold (uint32_t) */ | ||
#define CANPROP_GET_RCV_QUEUE_OVFL 29U /**< overflow counter of the receive queue (uint64_t) */ | ||
#define CANPROP_GET_FLT_11BIT_CODE 32U /**< accecptance filter code of 11-bit identifier (int32_t) */ | ||
#define CANPROP_GET_FLT_11BIT_MASK 33U /**< accecptance filter mask of 11-bit identifier (int32_t) */ | ||
#define CANPROP_GET_FLT_29BIT_CODE 34U /**< accecptance filter code of 29-bit identifier (int32_t) */ | ||
#define CANPROP_GET_FLT_29BIT_MASK 35U /**< accecptance filter mask of 29-bit identifier (int32_t) */ | ||
#define CANPROP_SET_FLT_11BIT_CODE 36U /**< set value for accecptance filter code of 11-bit identifier (int32_t) */ | ||
#define CANPROP_SET_FLT_11BIT_MASK 37U /**< set value for accecptance filter mask of 11-bit identifier (int32_t) */ | ||
#define CANPROP_SET_FLT_29BIT_CODE 38U /**< set value for accecptance filter code of 29-bit identifier (int32_t) */ | ||
#define CANPROP_SET_FLT_29BIT_MASK 39U /**< set value for accecptance filter mask of 29-bit identifier (int32_t) */ | ||
#define CANPROP_GET_FLT_11BIT_CODE 32U /**< acceptance filter code of 11-bit identifier (int32_t) */ | ||
#define CANPROP_GET_FLT_11BIT_MASK 33U /**< acceptance filter mask of 11-bit identifier (int32_t) */ | ||
#define CANPROP_GET_FLT_29BIT_CODE 34U /**< acceptance filter code of 29-bit identifier (int32_t) */ | ||
#define CANPROP_GET_FLT_29BIT_MASK 35U /**< acceptance filter mask of 29-bit identifier (int32_t) */ | ||
#define CANPROP_SET_FLT_11BIT_CODE 36U /**< set value for acceptance filter code of 11-bit identifier (int32_t) */ | ||
#define CANPROP_SET_FLT_11BIT_MASK 37U /**< set value for acceptance filter mask of 11-bit identifier (int32_t) */ | ||
#define CANPROP_SET_FLT_29BIT_CODE 38U /**< set value for acceptance filter code of 29-bit identifier (int32_t) */ | ||
#define CANPROP_SET_FLT_29BIT_MASK 39U /**< set value for acceptance filter mask of 29-bit identifier (int32_t) */ | ||
#if (OPTION_CANAPI_LIBRARY != 0) | ||
/* - - build-in bit-rate conversion - - - - - - - - - - - - - - - - - */ | ||
#define CANPROP_GET_BTR_INDEX 64U /**< bit-rate as CiA index (int32_t) */ | ||
|
@@ -369,25 +368,26 @@ extern "C" { | |
#define CANPROP_GET_VENDOR_NAME 227U /**< get vendor name at actual index in the vendor list (char[256]) */ | ||
#define CANPROP_GET_VENDOR_DLLNAME 228U /**< get file name of the DLL at actual index in the vendor list (char[256]) */ | ||
#endif | ||
#define CANPROP_SET_FIRST_CHANNEL 240U /**< set index to the first entry in the interface list (int32_t) */ | ||
#define CANPROP_SET_FIRST_CHANNEL 240U /**< set index to the first entry in the interface list (int32_t or NULL) */ | ||
#define CANPROP_SET_NEXT_CHANNEL 241U /**< set index to the next entry in the interface list (NULL) */ | ||
#define CANPROP_GET_CHANNEL_NO 242U /**< get channel no. at actual index in the interface list (int32_t) */ | ||
#define CANPROP_GET_CHANNEL_NAME 243U /**< get channel name at actual index in the interface list (char[256]) */ | ||
#define CANPROP_GET_CHANNEL_DLLNAME 244U /**< get file name of the DLL at actual index in the interface list (char[256]) */ | ||
#define CANPROP_GET_CHANNEL_VENDOR_ID 245U /**< get library id at actual index in the interface list (int32_t) */ | ||
#define CANPROP_GET_CHANNEL_VENDOR_NAME 246U /**< get vendor name at actual index in the interface list (char[256]) */ | ||
/* - - search path for JSON files (for C++ wrapper classes) - - - - - */ | ||
#if (OPTION_CANAPI_LIBRARY != 0) | ||
#define CANPROP_SET_SEARCH_PATH 253U /**< set search path for interface configuration files (char[256]) */ | ||
#endif | ||
/* - - access to device handle (for C++ wrapper classes) - - - - - - - */ | ||
#define CANPROP_GET_CPP_BACKDOOR 255U /**< get device handle (int32_t) */ | ||
/* - - access to vendor-specific properties - - - - - - - - - - - - - */ | ||
#define CANPROP_GET_VENDOR_PROP 256U /**< get a vendor-specific property value (void*) */ | ||
#define CANPROP_SET_VENDOR_PROP 512U /**< set a vendor-specific property value (void*) */ | ||
#define CANPROP_GET_VENDOR_PROP 256U /**< offset to get a vendor-specific property value (void*) */ | ||
#define CANPROP_SET_VENDOR_PROP 512U /**< offset to set a vendor-specific property value (void*) */ | ||
#define CANPROP_VENDOR_PROP_RANGE 256U /**< range for vendor-specific property values */ | ||
#define CANPROP_MAX_BUFFER_SIZE 256U /**< max. buffer size for property values */ | ||
#define CANPROP_MAX_STRING_LENGTH 1024U /**< max. length of a formatted message */ | ||
/* - - aliases (legacy names) - - - - - - - - - - - - - - - - - - - - */ | ||
#define CANPROP_GET_DEVICE_TYPE CANPROP_GET_DEVICE_CHANNEL | ||
#define CANPROP_GET_CHANNEL_TYPE CANPROP_GET_CHANNEL_NO | ||
#define CANPROP_GET_RCV_QUEUE_MAX CANPROP_GET_RCV_QUEUE_SIZE | ||
/** @} */ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,7 +3,7 @@ | |
_Copyright © 2004-2022 Uwe Vogt, UV Software, Berlin ([email protected])_ \ | ||
_All rights reserved._ | ||
|
||
Version $Rev: 1020 $ | ||
Version $Rev: 1036 $ | ||
|
||
# A CAN Interface Wrapper Specification | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.