Go to the documentation of this file.00001
00019 #ifndef __J1587LIB_H
00020 #define __J1587LIB_H
00021
00027 #include <windows.h>
00028
00032 typedef int J1587Handle;
00033
00037 #define j1587INVALID_HANDLE ((J1587Handle)(-1))
00038
00044 #define canTRANSCEIVER_TYPE_LINX_LIN 64
00045 #define canTRANSCEIVER_TYPE_LINX_J1708 66
00046 #define canTRANSCEIVER_TYPE_LINX_K 68
00047 #define canTRANSCEIVER_TYPE_LINX_SWC 70
00048 #define canTRANSCEIVER_TYPE_LINX_LS 72
00049
00056 #define EEPROM_OP_MODE_NONE 0x00
00057 #define EEPROM_OP_MODE_J1587_NORMAL 0x01
00058 #define EEPROM_OP_MODE_J1587_NODE 0x02
00059
00066 #define j1587FLAG_CHECKSUM 0x80
00067 #define j1587FLAG_FRAMEDELAY 0x40
00068 #define j1587FLAG_BYTEDELAY 0x20
00069 #define j1587FLAG_STOPBIT 0x10
00070 #define j1587FLAG_OVERRUN 0x08
00071
00078 typedef enum {
00079 j1587OK = 0,
00080 j1587ERR_NOMSG = -1,
00081 j1587ERR_NOTRUNNING = -3,
00082 j1587ERR_RUNNING = -4,
00083 j1587ERR_NORMALONLY = -5,
00084 j1587ERR_NODEONLY = -6,
00085 j1587ERR_PARAM = -7,
00086 j1587ERR_NOTFOUND = -8,
00087 j1587ERR_NOMEM = -9,
00088 j1587ERR_NOCHANNELS = -10,
00089 j1587ERR_TIMEOUT = -11,
00090 j1587ERR_NOTINITIALIZED = -12,
00091 j1587ERR_NOHANDLES = -13,
00092 j1587ERR_INVHANDLE = -14,
00093 j1587ERR_CANERROR = -15,
00094 j1587ERR_ERRRESP = -16,
00095 j1587ERR_WRONGRESP = -17,
00096 j1587ERR_DRIVER = -18,
00097 j1587ERR_DRIVERFAILED = -19,
00098 j1587ERR_NOCARD = -20,
00099 j1587ERR_LICENSE = -21,
00100 j1587ERR_INTERNAL = -22,
00101 j1587ERR_NO_ACCESS = -23,
00102 j1587ERR_VERSION = -24
00103 } J1587Status;
00109 #define J1587LIB_VERSION 1
00110
00111
00112 #include <pshpack1.h>
00113
00114
00115
00123 typedef struct {
00127 unsigned char version;
00128
00132 unsigned char flags;
00133
00139 unsigned char frameDelay;
00140
00141 union {
00146 unsigned char checkSum;
00150 unsigned char retries;
00151 };
00152
00157 unsigned long timestamp;
00158
00163 unsigned long frameLength;
00164
00169 unsigned short bitrate;
00170
00174 unsigned short reserved;
00175 } J1587MessageInfo;
00176 #include <poppack.h>
00177
00178
00179
00180
00181
00182 #ifndef J1587LIBAPI
00183 # if defined(__BORLANDC__)
00184 # define J1587LIBAPI __stdcall
00185 # elif defined(_MSC_VER) || defined(__MWERKS__) || defined(__GNUC__)
00186 # define J1587LIBAPI __stdcall
00187 # endif
00188 #endif
00189
00190 #ifdef __cplusplus
00191 extern "C" {
00192 #endif
00193
00197 void J1587LIBAPI j1587InitializeLibrary(void);
00198
00199
00220 J1587Handle J1587LIBAPI j1587OpenChannel(int channel, int flags);
00221
00227 #define J1587_NORMAL 1
00228 #define J1587_NODE 2
00229 #define J1587_READ 4
00230 #define J1587_WRITE 8
00231
00244 J1587Status J1587LIBAPI j1587Close(J1587Handle h);
00245
00277 J1587Status J1587LIBAPI j1587GetFirmwareVersion(J1587Handle h,
00278 unsigned char *bootVerMajor,
00279 unsigned char *bootVerMinor,
00280 unsigned char *bootVerBuild,
00281 unsigned char *appVerMajor,
00282 unsigned char *appVerMinor,
00283 unsigned char *appVerBuild);
00284
00296 J1587Status J1587LIBAPI j1587SetBitrate(J1587Handle h, unsigned int bps);
00297
00307 J1587Status J1587LIBAPI j1587BusOn(J1587Handle h);
00308
00318 J1587Status J1587LIBAPI j1587BusOff(J1587Handle h);
00319
00331 unsigned long J1587LIBAPI j1587ReadTimer(J1587Handle h);
00332
00345 J1587Status J1587LIBAPI j1587WriteMessageWait(J1587Handle h, const void *msg,
00346 unsigned int length,
00347 unsigned int priority,
00348 DWORD timeout);
00349
00366 J1587Status J1587LIBAPI j1587ReadMessageWait(J1587Handle h, void *msg,
00367 unsigned int *msgLength,
00368 J1587MessageInfo *msgInfo,
00369 DWORD timeout);
00370
00386 J1587Status J1587LIBAPI j1587WriteSync (J1587Handle h,
00387 J1587MessageInfo *msgInfo,
00388 DWORD timeout);
00389
00407 J1587Status J1587LIBAPI j1587Configure(J1587Handle h, unsigned int flags);
00408
00409
00410
00416 #define J1587_INTER_CHAR_DELAY_MASK 0x0f ///< Inter character delay mask
00417 #define J1587_REPORT_BAD_CHECKSUM 0x10 ///< Default off
00418 #define J1587_REPORT_FRAME_DELAY 0x20 ///< Default off
00419 #define J1587_REPORT_CHAR_DELAY 0x40 ///< Default off
00420
00432 J1587Status J1587LIBAPI j1587GetCanHandle(J1587Handle h, unsigned int *canHandle);
00433
00434 #ifdef __cplusplus
00435 }
00436 #endif
00437
00440 #endif // __J1587LIB_H