j1587lib.h File Reference

Definitions for the J1587lib API. More...

#include <windows.h>
#include <pshpack1.h>
#include <poppack.h>

Go to the source code of this file.

Data Structures

struct  J1587MessageInfo
 
union  J1587MessageInfo.__unnamed__
 

Macros

#define j1587INVALID_HANDLE   ((J1587Handle)(-1))
 
#define J1587LIB_VERSION   1
 
Linx tranceiver types

#define canTRANSCEIVER_TYPE_LINX_LIN   64
 
#define canTRANSCEIVER_TYPE_LINX_J1708   66
 
#define canTRANSCEIVER_TYPE_LINX_K   68
 
#define canTRANSCEIVER_TYPE_LINX_SWC   70
 
#define canTRANSCEIVER_TYPE_LINX_LS   72
 
Operation modes

#define EEPROM_OP_MODE_NONE   0x00
 
#define EEPROM_OP_MODE_J1587_NORMAL   0x01
 
#define EEPROM_OP_MODE_J1587_NODE   0x02
 
Flags for J1587MessageInfo

#define j1587FLAG_CHECKSUM   0x80
 
#define j1587FLAG_FRAMEDELAY   0x40
 
#define j1587FLAG_BYTEDELAY   0x20
 
#define j1587FLAG_STOPBIT   0x10
 
#define j1587FLAG_OVERRUN   0x08
 
Flags for j1587OpenChannel()

#define J1587_NORMAL   1
 
#define J1587_NODE   2
 
#define J1587_READ   4
 
#define J1587_WRITE   8
 
Flags for j1587Configure()

#define J1587_INTER_CHAR_DELAY_MASK   0x0f
 Inter character delay mask. More...
 
#define J1587_REPORT_BAD_CHECKSUM   0x10
 Default off. More...
 
#define J1587_REPORT_FRAME_DELAY   0x20
 Default off. More...
 
#define J1587_REPORT_CHAR_DELAY   0x40
 Default off. More...
 

Typedefs

typedef int J1587Handle
 

Enumerations

enum  J1587Status {
  j1587OK = 0,
  j1587ERR_NOMSG = -1,
  j1587ERR_NOTRUNNING = -3,
  j1587ERR_RUNNING = -4,
  j1587ERR_NORMALONLY = -5,
  j1587ERR_NODEONLY = -6,
  j1587ERR_PARAM = -7,
  j1587ERR_NOTFOUND = -8,
  j1587ERR_NOMEM = -9,
  j1587ERR_NOCHANNELS = -10,
  j1587ERR_TIMEOUT = -11,
  j1587ERR_NOTINITIALIZED = -12,
  j1587ERR_NOHANDLES = -13,
  j1587ERR_INVHANDLE = -14,
  j1587ERR_CANERROR = -15,
  j1587ERR_ERRRESP = -16,
  j1587ERR_WRONGRESP = -17,
  j1587ERR_DRIVER = -18,
  j1587ERR_DRIVERFAILED = -19,
  j1587ERR_NOCARD = -20,
  j1587ERR_LICENSE = -21,
  j1587ERR_INTERNAL = -22,
  j1587ERR_NO_ACCESS = -23,
  j1587ERR_VERSION = -24
}
 

Functions

J1587Status j1587Close (J1587Handle h)
 
J1587Status j1587GetFirmwareVersion (J1587Handle h, unsigned char *bootVerMajor, unsigned char *bootVerMinor, unsigned char *bootVerBuild, unsigned char *appVerMajor, unsigned char *appVerMinor, unsigned char *appVerBuild)
 
J1587Status j1587SetBitrate (J1587Handle h, unsigned int bps)
 
J1587Status j1587BusOn (J1587Handle h)
 
J1587Status j1587BusOff (J1587Handle h)
 
unsigned long j1587ReadTimer (J1587Handle h)
 
J1587Status j1587WriteMessageWait (J1587Handle h, const void *msg, unsigned int length, unsigned int priority, DWORD timeout)
 
J1587Status j1587ReadMessageWait (J1587Handle h, void *msg, unsigned int *msgLength, J1587MessageInfo *msgInfo, DWORD timeout)
 
J1587Status j1587WriteSync (J1587Handle h, J1587MessageInfo *msgInfo, DWORD timeout)
 
J1587Status j1587Configure (J1587Handle h, unsigned int flags)
 
J1587Status j1587GetCanHandle (J1587Handle h, unsigned int *canHandle)
 
J1587MessageInfo

In certain J1587 bus API calls, the following structure is used to provide more information about the J1587 messages.

void j1587InitializeLibrary (void)
 
J1587Handle j1587OpenChannel (int channel, int flags)
 

Detailed Description

Definitions for the J1587lib API.


Data Structure Documentation

◆ J1587MessageInfo

struct J1587MessageInfo
Data Fields
union J1587MessageInfo __unnamed__
unsigned short bitrate

Bitrate of the message in bits per second. Range [1000 .. 60000] (plus some margin)

unsigned char flags

Miscellaneous flags

unsigned char frameDelay

Frame delay in bit times (up to 255).

  • Read: Length of inter-frame delay.
  • Write: Delay before message transmission could begin.
unsigned long frameLength

Total frame length in microseconds; from the first start bit to the end of the checksum.

unsigned short reserved

Reserved

unsigned long timestamp

Timestamp in ms of the reception/transmission completion of the checksum. Uses the canlib CAN timer.

unsigned char version

To enable future extensions of this structure (see J1587LIB_VERSION).

◆ J1587MessageInfo.__unnamed__

union J1587MessageInfo.__unnamed__
Data Fields
unsigned char checkSum

Checksum as read from the J1587 bus. Might not match the data in case of J1587_CSUM_ERROR.

unsigned char retries

Number of retries before message could be transmitted.

Macro Definition Documentation

◆ canTRANSCEIVER_TYPE_LINX_J1708

#define canTRANSCEIVER_TYPE_LINX_J1708   66

◆ canTRANSCEIVER_TYPE_LINX_K

#define canTRANSCEIVER_TYPE_LINX_K   68

◆ canTRANSCEIVER_TYPE_LINX_LIN

#define canTRANSCEIVER_TYPE_LINX_LIN   64

◆ canTRANSCEIVER_TYPE_LINX_LS

#define canTRANSCEIVER_TYPE_LINX_LS   72

◆ canTRANSCEIVER_TYPE_LINX_SWC

#define canTRANSCEIVER_TYPE_LINX_SWC   70

◆ EEPROM_OP_MODE_J1587_NODE

#define EEPROM_OP_MODE_J1587_NODE   0x02

◆ EEPROM_OP_MODE_J1587_NORMAL

#define EEPROM_OP_MODE_J1587_NORMAL   0x01

◆ EEPROM_OP_MODE_NONE

#define EEPROM_OP_MODE_NONE   0x00

◆ J1587_INTER_CHAR_DELAY_MASK

#define J1587_INTER_CHAR_DELAY_MASK   0x0f

Inter character delay mask.

◆ J1587_NODE

#define J1587_NODE   2

◆ J1587_NORMAL

#define J1587_NORMAL   1

◆ J1587_READ

#define J1587_READ   4

◆ J1587_REPORT_BAD_CHECKSUM

#define J1587_REPORT_BAD_CHECKSUM   0x10

Default off.

Examples:
example/c/j1587/j1587example.c.

◆ J1587_REPORT_CHAR_DELAY

#define J1587_REPORT_CHAR_DELAY   0x40

Default off.

Examples:
example/c/j1587/j1587example.c.

◆ J1587_REPORT_FRAME_DELAY

#define J1587_REPORT_FRAME_DELAY   0x20

Default off.

Examples:
example/c/j1587/j1587example.c.

◆ J1587_WRITE

#define J1587_WRITE   8

◆ j1587FLAG_BYTEDELAY

#define j1587FLAG_BYTEDELAY   0x20

◆ j1587FLAG_CHECKSUM

#define j1587FLAG_CHECKSUM   0x80

◆ j1587FLAG_FRAMEDELAY

#define j1587FLAG_FRAMEDELAY   0x40

◆ j1587FLAG_OVERRUN

#define j1587FLAG_OVERRUN   0x08

◆ j1587FLAG_STOPBIT

#define j1587FLAG_STOPBIT   0x10

◆ j1587INVALID_HANDLE

#define j1587INVALID_HANDLE   ((J1587Handle)(-1))

Invalid J1587 handle

◆ J1587LIB_VERSION

#define J1587LIB_VERSION   1

J1587 library version definition

Typedef Documentation

◆ J1587Handle

typedef int J1587Handle

J1587 handle