Kvaser J1939 Library
kvj1939lib.h
Go to the documentation of this file.
1#ifndef KVJ1939LIB_H
2#define KVJ1939LIB_H
3
12#ifdef __cplusplus
13extern "C" {
14#endif
15
16/* Platform detection */
17#if defined(_WIN32)
18#define WIN32_LEAN_AND_MEAN
19#include <windows.h>
20#define KVJ1939_API __declspec(dllimport)
21#define KVJ1939_CALL WINAPI
22#else
23#define KVJ1939_API
24#define KVJ1939_CALL
25#endif
26
27/* API types */
28#include "kvj1939lib_types.h"
29
30/* API function declarations */
31
37KVJ1939_API J1939Result KVJ1939_CALL j1939_start_log();
38
50
58KVJ1939_API J1939ChannelResult KVJ1939_CALL j1939_create_channel(const J1939ChannelParams params);
59
68
77
86
100KVJ1939_API J1939Result KVJ1939_CALL j1939_register_callbacks(J1939ChannelHandle hnd, void* context,
101 J1939RxCallback rx_callback,
102 J1939TxCallback tx_callback,
103 J1939AcCallback ac_callback);
104
112KVJ1939_API J1939Result KVJ1939_CALL j1939_write(J1939ChannelHandle hnd,
113 const J1939WriteParams message);
114
125KVJ1939_API J1939ReadResult KVJ1939_CALL j1939_read(J1939ChannelHandle hnd, uint8_t* buffer,
126 uint32_t buffer_len, int32_t timeout_ms);
127
137KVJ1939_API J1939Result KVJ1939_CALL j1939_claim_address(J1939ChannelHandle hnd, uint8_t address,
138 uint64_t name);
139
148 uint8_t address);
149
159 J1939ChannelOption option,
160 uint32_t value);
161
169KVJ1939_API J1939ChannelOptionResult KVJ1939_CALL
171
172#ifdef __cplusplus
173}
174#endif
175
176#endif /* KVJ1939LIB_H */
J1939Result j1939_remove_address_claim(J1939ChannelHandle hnd, uint8_t address)
Stop claiming a J1939 address on the bus.
J1939Result j1939_write(J1939ChannelHandle hnd, const J1939WriteParams message)
Send a J1939 message.
J1939Result j1939_claim_address(J1939ChannelHandle hnd, uint8_t address, uint64_t name)
Claim a J1939 address on the bus.
J1939ChannelOptionResult j1939_get_channel_option(J1939ChannelHandle hnd, J1939ChannelOption option)
Get the value of a J1939 channel option.
J1939ReadResult j1939_read(J1939ChannelHandle hnd, uint8_t *buffer, uint32_t buffer_len, int32_t timeout_ms)
Read a J1939 message.
J1939ChannelResult j1939_create_channel(const J1939ChannelParams params)
Create a J1939 channel.
J1939Result j1939_destroy_channel(J1939ChannelHandle hnd)
Destroy a J1939 channel.
J1939Result j1939_set_channel_option(J1939ChannelHandle hnd, J1939ChannelOption option, uint32_t value)
Set a J1939 channel option.
J1939Result j1939_register_callbacks(J1939ChannelHandle hnd, void *context, J1939RxCallback rx_callback, J1939TxCallback tx_callback, J1939AcCallback ac_callback)
Set callbacks for a J1939 channel.
J1939Result j1939_close_channel(J1939ChannelHandle hnd)
Close a J1939 channel and go off bus.
J1939Result j1939_configure_shared_address_table()
Configure shared address table size.
J1939Result j1939_open_channel(J1939ChannelHandle hnd)
Open a J1939 channel and go on bus.
J1939Result j1939_start_log()
Start logging to stdout and file "kvj1939lib.log".
Type definitions for the KVJ1939 Library.
uint32_t J1939ChannelHandle
A handle to a J1939 channel.
Definition: kvj1939lib_types.h:72
void(* J1939AcCallback)(J1939ChannelHandle hnd, void *context, uint8_t address, bool valid)
Callback prototype for notifying the upper layers that a source address claim has been either complet...
Definition: kvj1939lib_types.h:192
J1939Result
Return status codes, indicating the result of an operation.
Definition: kvj1939lib_types.h:16
J1939ChannelOption
Properties that can be configured on a J1939 channel.
Definition: kvj1939lib_types.h:42
void(* J1939TxCallback)(J1939ChannelHandle hnd, void *context, uint32_t request_handle, J1939Identifier id, uint64_t timestamp, bool error)
Callback prototype for notifying the upper layers that a J1939 message has been sent on the CAN bus,...
Definition: kvj1939lib_types.h:180
void(* J1939RxCallback)(J1939ChannelHandle hnd, void *context, J1939Identifier id, uint64_t timestamp, const uint8_t *payload, uint32_t payload_length, bool error)
Callback prototype for notifying the upper layers that a complete message has been received,...
Definition: kvj1939lib_types.h:165
A struct that holds the result and value for a J1939 channel option.
Definition: kvj1939lib_types.h:146
A struct that holds the parameters for creating a j1939 channel.
Definition: kvj1939lib_types.h:77
A struct that holds the result and handle for creating a j1939 channel.
Definition: kvj1939lib_types.h:91
A struct that holds the result and header information for a J1939 read operation.
Definition: kvj1939lib_types.h:131
A struct that holds the parameters for a J1939 write request.
Definition: kvj1939lib_types.h:115