22//
33// CAN Interface API, Version 3 (Interface Definition)
44//
5- // Copyright (c) 2004-2021 Uwe Vogt, UV Software, Berlin ([email protected] )5+ // Copyright (c) 2004-2022 Uwe Vogt, UV Software, Berlin ([email protected] )66// All rights reserved.
77//
88// This file is part of CAN API V3.
7373// / zero to compile your program with the CAN API source files or to
7474// / link your program with the static library at compile-time.
7575// /
76- // / \author $Author: eris $
76+ // / \author $Author: makemake $
7777//
78- // / \version $Rev: 1013 $
78+ // / \version $Rev: 1033 $
7979//
8080// / \defgroup can_api CAN Interface API, Version 3
8181// / \{
@@ -144,13 +144,6 @@ typedef int CANAPI_Return_t;
144144// / \{
145145class CANCPP CCanApi {
146146public:
147- // / \brief CAN channel states
148- enum EChannelState {
149- ChannelOccupied = CANBRD_OCCUPIED, // /< channel is available, but occupied
150- ChannelAvailable = CANBRD_PRESENT, // /< channel is available and can be used
151- ChannelNotAvailable = CANBRD_NOT_PRESENT, // /< channel is not available
152- ChannelNotTestable = CANBRD_NOT_TESTABLE // /< channel is not testable
153- };
154147 // / \brief Common error codes (CAN API V3 compatible)
155148 enum EErrorCodes {
156149 NoError = CANERR_NOERROR, // /< no error!
@@ -176,6 +169,80 @@ class CANCPP CCanApi {
176169 FatalError = CANERR_FATAL, // /< fatal error
177170 VendorSpecific = CANERR_VENDOR // /< offset for vendor-specific error code
178171 };
172+ // / \brief CAN channel states
173+ enum EChannelState {
174+ ChannelOccupied = CANBRD_OCCUPIED, // /< channel is available, but occupied
175+ ChannelAvailable = CANBRD_PRESENT, // /< channel is available and can be used
176+ ChannelNotAvailable = CANBRD_NOT_PRESENT, // /< channel is not available
177+ ChannelNotTestable = CANBRD_NOT_TESTABLE // /< channel is not testable
178+ };
179+ // / \brief CAN channel information
180+ struct SChannelInfo {
181+ int32_t m_nChannelNo; // /< channel no. at actual index in the interface list
182+ char m_szDeviceName[CANPROP_MAX_BUFFER_SIZE]; // /< device name at actual index in the interface list
183+ char m_szDeviceDllName[CANPROP_MAX_BUFFER_SIZE]; // /< file name of the DLL at actual index in the interface list
184+ int32_t m_nLibraryId; // /< library id at actual index in the interface list
185+ char m_szVendorName[CANPROP_MAX_BUFFER_SIZE]; // /< vendor name at actual index in the interface list
186+ };
187+ #if (OPTION_CANAPI_LIBRARY != 0)
188+ // / \brief CAN API library information
189+ struct SLibraryInfo {
190+ int32_t m_nLibraryId; // /< library id at actual index in the vendor list
191+ char m_szVendorName[CANPROP_MAX_BUFFER_SIZE]; // /< vendor name at actual index in the vendor list
192+ char m_szVendorDllName[CANPROP_MAX_BUFFER_SIZE]; // /< file name of the DLL at actual index in the vendor list
193+ };
194+ // / \brief query library information of the first CAN API library in the
195+ // / list of vendors, if any.
196+ //
197+ // / \param[out] info - the library information of the first entry in the list
198+ //
199+ // / \returns true if library information have been successfully read, or
200+ // / false on error.
201+ //
202+ static bool GetFirstLibrary (SLibraryInfo &info);
203+
204+ // / \brief query library information of the next CAN API library in the
205+ // / list of vendors, if any.
206+ //
207+ // / \param[out] info - the library information of the next entry in the list
208+ //
209+ // / \returns true if library information have been successfully read, or
210+ // / false on error.
211+ //
212+ static bool GetNextLibrary (SLibraryInfo &info);
213+ #endif
214+ // / \brief query channel information of the first CAN interface in the
215+ // / list of CAN interfaces, if any.
216+ //
217+ // / \param[in] library - library id of the CAN interface list, or -1 for all vendors
218+ // / \param[out] info - the channel information of the first entry in the list
219+ // / \param[out] param - pointer to channel-specific parameters
220+ //
221+ // / \returns true if channel information have been successfully read, or
222+ // / false on error.
223+ //
224+ #if (OPTION_CANAPI_LIBRARY != 0)
225+ static bool GetFirstChannel (int32_t library, SChannelInfo &info, void *param = NULL );
226+ #else
227+ static bool GetFirstChannel (SChannelInfo &info, void *param = NULL );
228+ #endif
229+
230+ // / \brief query channel information of the first CAN interface in the
231+ // / list of CAN interfaces, if any.
232+ //
233+ // / \param[in] library - library id of the CAN interface list, or -1 for all vendors
234+ // / \param[out] info - the channel information of the next entry in the list
235+ // / \param[out] param - pointer to channel-specific parameters
236+ //
237+ // / \returns true if channel information have been successfully read, or
238+ // / false on error.
239+ //
240+ #if (OPTION_CANAPI_LIBRARY != 0)
241+ static bool GetNextChannel (int32_t library, SChannelInfo &info, void *param = NULL );
242+ #else
243+ static bool GetNextChannel (SChannelInfo &info, void *param = NULL );
244+ #endif
245+
179246 // / \brief probes if the CAN interface (hardware and driver) given by
180247 // / the argument [ 'library' and ] 'channel' is present,
181248 // / and if the requested operation mode is supported by the
@@ -306,7 +373,7 @@ class CANCPP CCanApi {
306373 //
307374 // / \returns 0 if successful, or a negative value on error.
308375 //
309- virtual CANAPI_Return_t GetBusLoad (uint8_t &load) = 0;
376+ virtual CANAPI_Return_t GetBusLoad (uint8_t &load) = 0; // deprecated
310377
311378 // / \brief retrieves the bit-rate setting of the CAN interface. The
312379 // / CAN controller must be in operation state 'running'.
@@ -351,14 +418,14 @@ class CANCPP CCanApi {
351418 //
352419 // / \returns pointer to a zero-terminated string, or NULL on error.
353420 //
354- virtual char *GetHardwareVersion () = 0;
421+ virtual char *GetHardwareVersion () = 0; // deprecated
355422
356423 // / \brief retrieves the firmware version of the CAN controller
357424 // / board as a zero-terminated string.
358425 //
359426 // / \returns pointer to a zero-terminated string, or NULL on error.
360427 //
361- virtual char *GetFirmwareVersion () = 0;
428+ virtual char *GetFirmwareVersion () = 0; // deprecated
362429
363430 // / \brief retrieves version information of the CAN API V3 driver
364431 // / as a zero-terminated string.
@@ -411,4 +478,4 @@ class CANCPP CCanApi {
411478// / \}
412479#endif // CANAPI_H_INCLUDED
413480// / \}
414- // $Id: CANAPI.h 1013 2021-12-13 21:34:15Z eris $ Copyright (c) UV Software //
481+ // $Id: CANAPI.h 1033 2022-01-11 19:58:04Z makemake $ Copyright (c) UV Software //
0 commit comments