1 | // Copyright (C) 2017 Denis Shienkov <denis.shienkov@gmail.com> |
2 | // Copyright (c) 2020 Andre Hartmann <aha_1980@gmx.de> |
3 | // Copyright (C) 2017 The Qt Company Ltd. |
4 | // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only |
5 | |
6 | #ifndef PEAKCAN_SYMBOLS_P_H |
7 | #define PEAKCAN_SYMBOLS_P_H |
8 | |
9 | // |
10 | // W A R N I N G |
11 | // ------------- |
12 | // |
13 | // This file is not part of the Qt API. It exists purely as an |
14 | // implementation detail. This header file may change from version to |
15 | // version without notice, or even be removed. |
16 | // |
17 | // We mean it. |
18 | // |
19 | |
20 | #include <QtCore/qlibrary.h> |
21 | #include <QtCore/qstring.h> |
22 | #include <QtCore/qdebug.h> |
23 | |
24 | #ifdef Q_OS_WIN32 |
25 | # include <windows.h> |
26 | # define DRV_CALLBACK_TYPE WINAPI |
27 | #else |
28 | # define DRV_CALLBACK_TYPE |
29 | #endif |
30 | |
31 | // Currently defined and supported PCAN channels |
32 | #define PCAN_NONEBUS 0x00U // Undefined/default value for a PCAN bus |
33 | |
34 | #define PCAN_ISABUS1 0x21U // PCAN-ISA interface, channel 1 |
35 | #define PCAN_ISABUS2 0x22U // PCAN-ISA interface, channel 2 |
36 | #define PCAN_ISABUS3 0x23U // PCAN-ISA interface, channel 3 |
37 | #define PCAN_ISABUS4 0x24U // PCAN-ISA interface, channel 4 |
38 | #define PCAN_ISABUS5 0x25U // PCAN-ISA interface, channel 5 |
39 | #define PCAN_ISABUS6 0x26U // PCAN-ISA interface, channel 6 |
40 | #define PCAN_ISABUS7 0x27U // PCAN-ISA interface, channel 7 |
41 | #define PCAN_ISABUS8 0x28U // PCAN-ISA interface, channel 8 |
42 | |
43 | #define PCAN_DNGBUS1 0x31U // PCAN-Dongle/LPT interface, channel 1 |
44 | |
45 | #define PCAN_PCIBUS1 0x41U // PCAN-PCI interface, channel 1 |
46 | #define PCAN_PCIBUS2 0x42U // PCAN-PCI interface, channel 2 |
47 | #define PCAN_PCIBUS3 0x43U // PCAN-PCI interface, channel 3 |
48 | #define PCAN_PCIBUS4 0x44U // PCAN-PCI interface, channel 4 |
49 | #define PCAN_PCIBUS5 0x45U // PCAN-PCI interface, channel 5 |
50 | #define PCAN_PCIBUS6 0x46U // PCAN-PCI interface, channel 6 |
51 | #define PCAN_PCIBUS7 0x47U // PCAN-PCI interface, channel 7 |
52 | #define PCAN_PCIBUS8 0x48U // PCAN-PCI interface, channel 8 |
53 | #define PCAN_PCIBUS9 0x409U // PCAN-PCI interface, channel 9 |
54 | #define PCAN_PCIBUS10 0x40AU // PCAN-PCI interface, channel 10 |
55 | #define PCAN_PCIBUS11 0x40BU // PCAN-PCI interface, channel 11 |
56 | #define PCAN_PCIBUS12 0x40CU // PCAN-PCI interface, channel 12 |
57 | #define PCAN_PCIBUS13 0x40DU // PCAN-PCI interface, channel 13 |
58 | #define PCAN_PCIBUS14 0x40EU // PCAN-PCI interface, channel 14 |
59 | #define PCAN_PCIBUS15 0x40FU // PCAN-PCI interface, channel 15 |
60 | #define PCAN_PCIBUS16 0x410U // PCAN-PCI interface, channel 16 |
61 | |
62 | #define PCAN_USBBUS1 0x51U // PCAN-USB interface, channel 1 |
63 | #define PCAN_USBBUS2 0x52U // PCAN-USB interface, channel 2 |
64 | #define PCAN_USBBUS3 0x53U // PCAN-USB interface, channel 3 |
65 | #define PCAN_USBBUS4 0x54U // PCAN-USB interface, channel 4 |
66 | #define PCAN_USBBUS5 0x55U // PCAN-USB interface, channel 5 |
67 | #define PCAN_USBBUS6 0x56U // PCAN-USB interface, channel 6 |
68 | #define PCAN_USBBUS7 0x57U // PCAN-USB interface, channel 7 |
69 | #define PCAN_USBBUS8 0x58U // PCAN-USB interface, channel 8 |
70 | #define PCAN_USBBUS9 0x509U // PCAN-USB interface, channel 9 |
71 | #define PCAN_USBBUS10 0x50AU // PCAN-USB interface, channel 10 |
72 | #define PCAN_USBBUS11 0x50BU // PCAN-USB interface, channel 11 |
73 | #define PCAN_USBBUS12 0x50CU // PCAN-USB interface, channel 12 |
74 | #define PCAN_USBBUS13 0x50DU // PCAN-USB interface, channel 13 |
75 | #define PCAN_USBBUS14 0x50EU // PCAN-USB interface, channel 14 |
76 | #define PCAN_USBBUS15 0x50FU // PCAN-USB interface, channel 15 |
77 | #define PCAN_USBBUS16 0x510U // PCAN-USB interface, channel 16 |
78 | |
79 | #define PCAN_PCCBUS1 0x61U // PCAN-PC Card interface, channel 1 |
80 | #define PCAN_PCCBUS2 0x62U // PCAN-PC Card interface, channel 2 |
81 | |
82 | #define PCAN_LANBUS1 0x801U // PCAN-LAN interface, channel 1 |
83 | #define PCAN_LANBUS2 0x802U // PCAN-LAN interface, channel 2 |
84 | #define PCAN_LANBUS3 0x803U // PCAN-LAN interface, channel 3 |
85 | #define PCAN_LANBUS4 0x804U // PCAN-LAN interface, channel 4 |
86 | #define PCAN_LANBUS5 0x805U // PCAN-LAN interface, channel 5 |
87 | #define PCAN_LANBUS6 0x806U // PCAN-LAN interface, channel 6 |
88 | #define PCAN_LANBUS7 0x807U // PCAN-LAN interface, channel 7 |
89 | #define PCAN_LANBUS8 0x808U // PCAN-LAN interface, channel 8 |
90 | #define PCAN_LANBUS9 0x809U // PCAN-LAN interface, channel 9 |
91 | #define PCAN_LANBUS10 0x80AU // PCAN-LAN interface, channel 10 |
92 | #define PCAN_LANBUS11 0x80BU // PCAN-LAN interface, channel 11 |
93 | #define PCAN_LANBUS12 0x80CU // PCAN-LAN interface, channel 12 |
94 | #define PCAN_LANBUS13 0x80DU // PCAN-LAN interface, channel 13 |
95 | #define PCAN_LANBUS14 0x80EU // PCAN-LAN interface, channel 14 |
96 | #define PCAN_LANBUS15 0x80FU // PCAN-LAN interface, channel 15 |
97 | #define PCAN_LANBUS16 0x810U // PCAN-LAN interface, channel 16 |
98 | |
99 | // Represent the PCAN error and status codes |
100 | #define PCAN_ERROR_OK 0x00000U // No error |
101 | #define PCAN_ERROR_XMTFULL 0x00001U // Transmit buffer in CAN controller is full |
102 | #define PCAN_ERROR_OVERRUN 0x00002U // CAN controller was read too late |
103 | #define PCAN_ERROR_BUSLIGHT 0x00004U // Bus error: an error counter reached the 'light' limit |
104 | #define PCAN_ERROR_BUSHEAVY 0x00008U // Bus error: an error counter reached the 'heavy' limit |
105 | #define PCAN_ERROR_BUSWARNING PCAN_ERROR_BUSHEAVY // Bus error: an error counter reached the 'warning' limit |
106 | #define PCAN_ERROR_BUSPASSIVE 0x40000U // Bus error: the CAN controller is error passive |
107 | #define PCAN_ERROR_BUSOFF 0x00010U // Bus error: the CAN controller is in bus-off state |
108 | #define PCAN_ERROR_ANYBUSERR (PCAN_ERROR_BUSWARNING | PCAN_ERROR_BUSLIGHT | PCAN_ERROR_BUSHEAVY | PCAN_ERROR_BUSOFF | PCAN_ERROR_BUSPASSIVE) // Mask for all bus errors |
109 | #define PCAN_ERROR_QRCVEMPTY 0x00020U // Receive queue is empty |
110 | #define PCAN_ERROR_QOVERRUN 0x00040U // Receive queue was read too late |
111 | #define PCAN_ERROR_QXMTFULL 0x00080U // Transmit queue is full |
112 | #define PCAN_ERROR_REGTEST 0x00100U // Test of the CAN controller hardware registers failed (no hardware found) |
113 | #define PCAN_ERROR_NODRIVER 0x00200U // Driver not loaded |
114 | #define PCAN_ERROR_HWINUSE 0x00400U // Hardware already in use by a Net |
115 | #define PCAN_ERROR_NETINUSE 0x00800U // A Client is already connected to the Net |
116 | #define PCAN_ERROR_ILLHW 0x01400U // Hardware handle is invalid |
117 | #define PCAN_ERROR_ILLNET 0x01800U // Net handle is invalid |
118 | #define PCAN_ERROR_ILLCLIENT 0x01C00U // Client handle is invalid |
119 | #define PCAN_ERROR_ILLHANDLE (PCAN_ERROR_ILLHW | PCAN_ERROR_ILLNET | PCAN_ERROR_ILLCLIENT) // Mask for all handle errors |
120 | #define PCAN_ERROR_RESOURCE 0x02000U // Resource (FIFO, Client, timeout) cannot be created |
121 | #define PCAN_ERROR_ILLPARAMTYPE 0x04000U // Invalid parameter |
122 | #define PCAN_ERROR_ILLPARAMVAL 0x08000U // Invalid parameter value |
123 | #define PCAN_ERROR_UNKNOWN 0x10000U // Unknown error |
124 | #define PCAN_ERROR_ILLDATA 0x20000U // Invalid data, function, or action |
125 | #define PCAN_ERROR_CAUTION 0x2000000U // An operation was successfully carried out, however, irregularities were registered |
126 | #define PCAN_ERROR_INITIALIZE 0x4000000U // Channel is not initialized [Value was changed from 0x40000 to 0x4000000] |
127 | #define PCAN_ERROR_ILLOPERATION 0x8000000U // Invalid operation [Value was changed from 0x80000 to 0x8000000] |
128 | |
129 | // PCAN devices |
130 | #define PCAN_NONE 0x00U // Undefined, unknown or not selected PCAN device value |
131 | #define PCAN_PEAKCAN 0x01U // PCAN Non-Plug&Play devices. NOT USED WITHIN PCAN-Basic API |
132 | #define PCAN_ISA 0x02U // PCAN-ISA, PCAN-PC/104, and PCAN-PC/104-Plus |
133 | #define PCAN_DNG 0x03U // PCAN-Dongle |
134 | #define PCAN_PCI 0x04U // PCAN-PCI, PCAN-cPCI, PCAN-miniPCI, and PCAN-PCI Express |
135 | #define PCAN_USB 0x05U // PCAN-USB and PCAN-USB Pro |
136 | #define PCAN_PCC 0x06U // PCAN-PC Card |
137 | |
138 | // PCAN parameters |
139 | #define PCAN_DEVICE_ID 0x01U // Device identifier parameter |
140 | #define PCAN_5VOLTS_POWER 0x02U // PCAN-PC Card 5-Volt power parameter |
141 | #define PCAN_RECEIVE_EVENT 0x03U // PCAN receive event handler parameter |
142 | #define PCAN_MESSAGE_FILTER 0x04U // PCAN message filter parameter |
143 | #define PCAN_API_VERSION 0x05U // PCAN-Basic API version parameter |
144 | #define PCAN_CHANNEL_VERSION 0x06U // PCAN device channel version parameter |
145 | #define PCAN_BUSOFF_AUTORESET 0x07U // PCAN Reset-On-Busoff parameter |
146 | #define PCAN_LISTEN_ONLY 0x08U // PCAN Listen-Only parameter |
147 | #define PCAN_LOG_LOCATION 0x09U // Directory path for log files |
148 | #define PCAN_LOG_STATUS 0x0AU // Debug-Log activation status |
149 | #define PCAN_LOG_CONFIGURE 0x0BU // Configuration of the debugged information (LOG_FUNCTION_***) |
150 | #define PCAN_LOG_TEXT 0x0CU // Custom insertion of text into the log file |
151 | #define PCAN_CHANNEL_CONDITION 0x0DU // Availability status of a PCAN-Channel |
152 | #define PCAN_HARDWARE_NAME 0x0EU // PCAN hardware name parameter |
153 | #define PCAN_RECEIVE_STATUS 0x0FU // Message reception status of a PCAN-Channel |
154 | #define PCAN_CONTROLLER_NUMBER 0x10U // CAN-Controller number of a PCAN-Channel |
155 | #define PCAN_TRACE_LOCATION 0x11U // Directory path for PCAN trace files |
156 | #define PCAN_TRACE_STATUS 0x12U // CAN tracing activation status |
157 | #define PCAN_TRACE_SIZE 0x13U // Configuration of the maximum file size of a CAN trace |
158 | #define PCAN_TRACE_CONFIGURE 0x14U // Configuration of the trace file storing mode (TRACE_FILE_***) |
159 | #define PCAN_CHANNEL_IDENTIFYING 0x15U // Physical identification of a USB based PCAN-Channel by blinking its associated LED |
160 | #define PCAN_CHANNEL_FEATURES 0x16U // Capabilities of a PCAN device (FEATURE_***) |
161 | #define PCAN_BITRATE_ADAPTING 0x17U // Using of an existing bit rate (PCAN-View connected to a channel) |
162 | #define PCAN_BITRATE_INFO 0x18U // Configured bit rate as Btr0Btr1 value |
163 | #define PCAN_BITRATE_INFO_FD 0x19U // Configured bit rate as TPCANBitrateFD string |
164 | #define PCAN_BUSSPEED_NOMINAL 0x1AU // Configured nominal CAN Bus speed as Bits per seconds |
165 | #define PCAN_BUSSPEED_DATA 0x1BU // Configured CAN data speed as Bits per seconds |
166 | #define PCAN_IP_ADDRESS 0x1CU // Remote address of a LAN channel as string in IPv4 format |
167 | #define PCAN_LAN_SERVICE_STATUS 0x1DU // Status of the Virtual PCAN-Gateway Service |
168 | #define PCAN_ATTACHED_CHANNELS_COUNT 0x2AU // Get the amount of PCAN channels attached to a system |
169 | #define PCAN_ATTACHED_CHANNELS 0x2BU // Get information about PCAN channels attached to a system |
170 | |
171 | #define FEATURE_FD_CAPABLE 0x01U // Device supports flexible data-rate (CAN-FD) |
172 | |
173 | // PCAN parameter values |
174 | #define PCAN_PARAMETER_OFF 0x00U // The PCAN parameter is not set (inactive) |
175 | #define PCAN_PARAMETER_ON 0x01U // The PCAN parameter is set (active) |
176 | #define PCAN_FILTER_CLOSE 0x00U // The PCAN filter is closed. No messages will be received |
177 | #define PCAN_FILTER_OPEN 0x01U // The PCAN filter is fully opened. All messages will be received |
178 | #define PCAN_FILTER_CUSTOM 0x02U // The PCAN filter is custom configured. Only registered messages will be received |
179 | #define PCAN_CHANNEL_UNAVAILABLE 0x00U // The PCAN-Channel handle is illegal, or its associated hardware is not available |
180 | #define PCAN_CHANNEL_AVAILABLE 0x01U // The PCAN-Channel handle is available to be connected (Plug&Play Hardware: it means furthermore that the hardware is plugged-in) |
181 | #define PCAN_CHANNEL_OCCUPIED 0x02U // The PCAN-Channel handle is valid, and is already being used |
182 | #define PCAN_CHANNEL_PCANVIEW (PCAN_CHANNEL_AVAILABLE | PCAN_CHANNEL_OCCUPIED) // The PCAN-Channel handle is already being used by a PCAN-View application, but is available to connect |
183 | |
184 | #define LOG_FUNCTION_DEFAULT 0x00U // Logs system exceptions / errors |
185 | #define LOG_FUNCTION_ENTRY 0x01U // Logs the entries to the PCAN-Basic API functions |
186 | #define LOG_FUNCTION_PARAMETERS 0x02U // Logs the parameters passed to the PCAN-Basic API functions |
187 | #define LOG_FUNCTION_LEAVE 0x04U // Logs the exits from the PCAN-Basic API functions |
188 | #define LOG_FUNCTION_WRITE 0x08U // Logs the CAN messages passed to the CAN_Write function |
189 | #define LOG_FUNCTION_READ 0x10U // Logs the CAN messages received within the CAN_Read function |
190 | #define LOG_FUNCTION_ALL 0xFFFFU // Logs all possible information within the PCAN-Basic API functions |
191 | |
192 | #define TRACE_FILE_SINGLE 0x00U // A single file is written until it size reaches PAN_TRACE_SIZE |
193 | #define TRACE_FILE_SEGMENTED 0x01U // Traced data is distributed in several files with size PAN_TRACE_SIZE |
194 | #define TRACE_FILE_DATE 0x02U // Includes the date into the name of the trace file |
195 | #define TRACE_FILE_TIME 0x04U // Includes the start time into the name of the trace file |
196 | #define TRACE_FILE_OVERWRITE 0x80U // Causes the overwriting of available traces (same name) |
197 | |
198 | // Other constants |
199 | #define MAX_LENGTH_HARDWARE_NAME 33 // Maximum length of the name of a device: 32 characters + terminator |
200 | #define MAX_LENGTH_VERSION_STRING 18 // Maximum length of a version string: 17 characters + terminator |
201 | |
202 | // PCAN message types |
203 | #define PCAN_MESSAGE_STANDARD 0x00U // The PCAN message is a CAN Standard Frame (11-bit identifier) |
204 | #define PCAN_MESSAGE_RTR 0x01U // The PCAN message is a CAN Remote-Transfer-Request Frame |
205 | #define PCAN_MESSAGE_EXTENDED 0x02U // The PCAN message is a CAN Extended Frame (29-bit identifier) |
206 | #define PCAN_MESSAGE_FD 0x04U // The PCAN message represents a FD frame in terms of CiA Specs |
207 | #define PCAN_MESSAGE_BRS 0x08U // The PCAN message represents a FD bit rate switch (CAN data at a higher bit rate) |
208 | #define PCAN_MESSAGE_ESI 0x10U // The PCAN message represents a FD error state indicator(CAN FD transmitter was error active) |
209 | #define PCAN_MESSAGE_STATUS 0x80U // The PCAN message represents a PCAN status message |
210 | |
211 | // Frame Type / Initialization Mode |
212 | #define PCAN_MODE_STANDARD PCAN_MESSAGE_STANDARD |
213 | #define PCAN_MODE_EXTENDED PCAN_MESSAGE_EXTENDED |
214 | |
215 | // Baud rate codes = BTR0/BTR1 register values for the CAN controller. |
216 | // You can define your own Baud rate with the BTROBTR1 register. |
217 | // Take a look at www.peak-system.com for our free software "BAUDTOOL" |
218 | // to calculate the BTROBTR1 register for every baudrate and sample point. |
219 | #define PCAN_BAUD_1M 0x0014U // 1 MBit/s |
220 | #define PCAN_BAUD_800K 0x0016U // 800 kBit/s |
221 | #define PCAN_BAUD_500K 0x001CU // 500 kBit/s |
222 | #define PCAN_BAUD_250K 0x011CU // 250 kBit/s |
223 | #define PCAN_BAUD_125K 0x031CU // 125 kBit/s |
224 | #define PCAN_BAUD_100K 0x432FU // 100 kBit/s |
225 | #define PCAN_BAUD_95K 0xC34EU // 95,238 kBit/s |
226 | #define PCAN_BAUD_83K 0x852BU // 83,333 kBit/s |
227 | #define PCAN_BAUD_50K 0x472FU // 50 kBit/s |
228 | #define PCAN_BAUD_47K 0x1414U // 47,619 kBit/s |
229 | #define PCAN_BAUD_33K 0x8B2FU // 33,333 kBit/s |
230 | #define PCAN_BAUD_20K 0x532FU // 20 kBit/s |
231 | #define PCAN_BAUD_10K 0x672FU // 10 kBit/s |
232 | #define PCAN_BAUD_5K 0x7F7FU // 5 kBit/s |
233 | #define PCAN_BAUD_INVALID 0xFFFFU // unknown or invalid baudrate |
234 | |
235 | #define PCAN_TYPE_ISA 0x01U // PCAN-ISA 82C200 |
236 | #define PCAN_TYPE_ISA_SJA 0x09U // PCAN-ISA SJA1000 |
237 | #define PCAN_TYPE_ISA_PHYTEC 0x04U // PHYTEC ISA |
238 | #define PCAN_TYPE_DNG 0x02U // PCAN-Dongle 82C200 |
239 | #define PCAN_TYPE_DNG_EPP 0x03U // PCAN-Dongle EPP 82C200 |
240 | #define PCAN_TYPE_DNG_SJA 0x05U // PCAN-Dongle SJA1000 |
241 | #define PCAN_TYPE_DNG_SJA_EPP 0x06U // PCAN-Dongle EPP SJA1000 |
242 | |
243 | // Type definitions |
244 | #define TPCANHandle quint16 // Represents a PCAN hardware channel handle |
245 | #define TPCANStatus quint32 // Represents a PCAN status/error code |
246 | #define TPCANParameter quint8 // Represents a PCAN parameter to be read or set |
247 | #define TPCANDevice quint8 // Represents a PCAN device |
248 | #define TPCANMessageType quint8 // Represents the type of a PCAN message |
249 | #define TPCANType quint8 // Represents the type of PCAN hardware to be initialized |
250 | #define TPCANMode quint8 // Represents a PCAN filter mode |
251 | #define TPCANBaudrate quint16 // Represents a PCAN Baud rate register value |
252 | #define TPCANBitrateFD char * // Represents a PCAN-FD bit rate string |
253 | #define TPCANTimestampFD quint64 // Represents a timestamp of a received PCAN FD message |
254 | |
255 | // Represents a PCAN message |
256 | typedef struct tagTPCANMsg |
257 | { |
258 | quint32 ID; // 11/29-bit message identifier |
259 | TPCANMessageType MSGTYPE; // Type of the message |
260 | quint8 LEN; // Data Length Code of the message (0..8) |
261 | quint8 DATA[8]; // Data of the message (DATA[0]..DATA[7]) |
262 | } TPCANMsg; |
263 | |
264 | // Represents a timestamp of a received PCAN message |
265 | // Total Microseconds = micros + 1000 * millis + 0xFFFFFFFF * 1000 * millis_overflow |
266 | typedef struct tagTPCANTimestamp |
267 | { |
268 | quint32 millis; // Base-value: milliseconds: 0.. 2^32-1 |
269 | quint16 millis_overflow; // Roll-arounds of millis |
270 | quint16 micros; // Microseconds: 0..999 |
271 | } TPCANTimestamp; |
272 | |
273 | // Represents a PCAN message from a FD capable hardware |
274 | typedef struct tagTPCANMsgFD |
275 | { |
276 | quint32 ID; // 11/29-bit message identifier |
277 | TPCANMessageType MSGTYPE; // Type of the message |
278 | quint8 DLC; // Data Length Code of the message (0..15) |
279 | quint8 DATA[64]; // Data of the message (DATA[0]..DATA[63]) |
280 | } TPCANMsgFD; |
281 | |
282 | // Describes an available PCAN channel |
283 | typedef struct tagTPCANChannelInformation |
284 | { |
285 | TPCANHandle channel_handle; // PCAN channel handle |
286 | TPCANDevice device_type; // Kind of PCAN device |
287 | quint8 controller_number; // CAN-Controller number |
288 | quint32 device_features; // Device capabilities flag (see FEATURE_*) |
289 | char device_name[MAX_LENGTH_HARDWARE_NAME]; // Device name |
290 | quint32 device_id; // Device number |
291 | quint32 channel_condition; // Availability status of a PCAN-Channel |
292 | } TPCANChannelInformation; |
293 | |
294 | #define GENERATE_SYMBOL_VARIABLE(returnType, symbolName, ...) \ |
295 | typedef returnType (DRV_CALLBACK_TYPE *fp_##symbolName)(__VA_ARGS__); \ |
296 | static fp_##symbolName symbolName; |
297 | |
298 | #define RESOLVE_SYMBOL(symbolName) \ |
299 | symbolName = reinterpret_cast<fp_##symbolName>(pcanLibrary->resolve(#symbolName)); \ |
300 | if (!symbolName) \ |
301 | return false; |
302 | |
303 | GENERATE_SYMBOL_VARIABLE(TPCANStatus, CAN_Initialize, TPCANHandle, TPCANBaudrate, TPCANType, quint32, quint16) |
304 | GENERATE_SYMBOL_VARIABLE(TPCANStatus, CAN_InitializeFD, TPCANHandle, TPCANBitrateFD) |
305 | GENERATE_SYMBOL_VARIABLE(TPCANStatus, CAN_Uninitialize, TPCANHandle) |
306 | GENERATE_SYMBOL_VARIABLE(TPCANStatus, CAN_Reset, TPCANHandle) |
307 | GENERATE_SYMBOL_VARIABLE(TPCANStatus, CAN_GetStatus, TPCANHandle) |
308 | GENERATE_SYMBOL_VARIABLE(TPCANStatus, CAN_Read, TPCANHandle, TPCANMsg *, TPCANTimestamp *) |
309 | GENERATE_SYMBOL_VARIABLE(TPCANStatus, CAN_ReadFD, TPCANHandle, TPCANMsgFD *, TPCANTimestampFD *) |
310 | GENERATE_SYMBOL_VARIABLE(TPCANStatus, CAN_Write, TPCANHandle, TPCANMsg *) |
311 | GENERATE_SYMBOL_VARIABLE(TPCANStatus, CAN_WriteFD, TPCANHandle, TPCANMsgFD *) |
312 | GENERATE_SYMBOL_VARIABLE(TPCANStatus, CAN_FilterMessages, TPCANHandle, quint32, quint32, TPCANMode) |
313 | GENERATE_SYMBOL_VARIABLE(TPCANStatus, CAN_GetValue, TPCANHandle, TPCANParameter, void *, quint32) |
314 | GENERATE_SYMBOL_VARIABLE(TPCANStatus, CAN_SetValue, TPCANHandle, TPCANParameter, void *, quint32) |
315 | GENERATE_SYMBOL_VARIABLE(TPCANStatus, CAN_GetErrorText, TPCANStatus, quint16, char *) |
316 | |
317 | inline bool resolvePeakCanSymbols(QLibrary *pcanLibrary) |
318 | { |
319 | if (!pcanLibrary->isLoaded()) { |
320 | #ifdef Q_OS_MACOS |
321 | pcanLibrary->setFileName(QStringLiteral("PCBUSB" )); |
322 | #else |
323 | pcanLibrary->setFileName(QStringLiteral("pcanbasic" )); |
324 | #endif |
325 | if (!pcanLibrary->load()) |
326 | return false; |
327 | } |
328 | |
329 | RESOLVE_SYMBOL(CAN_Initialize) |
330 | RESOLVE_SYMBOL(CAN_InitializeFD) |
331 | RESOLVE_SYMBOL(CAN_Uninitialize) |
332 | RESOLVE_SYMBOL(CAN_Reset) |
333 | RESOLVE_SYMBOL(CAN_GetStatus) |
334 | RESOLVE_SYMBOL(CAN_Read) |
335 | RESOLVE_SYMBOL(CAN_ReadFD) |
336 | RESOLVE_SYMBOL(CAN_Write) |
337 | RESOLVE_SYMBOL(CAN_WriteFD) |
338 | RESOLVE_SYMBOL(CAN_FilterMessages) |
339 | RESOLVE_SYMBOL(CAN_GetValue) |
340 | RESOLVE_SYMBOL(CAN_SetValue) |
341 | RESOLVE_SYMBOL(CAN_GetErrorText) |
342 | |
343 | return true; |
344 | } |
345 | |
346 | #endif // PEAKCAN_SYMBOLS_P_H |
347 | |