Kvaser ISO-TP SDK
Loading...
Searching...
No Matches
IsoTpApi Struct Reference

A struct with all function pointers for the ISO-TP API. More...

#include <kvisotplib.h>

Data Fields

void * handle
 Handle to the loaded library.
 
bool is_valid
 A flag indicating if the library was successfully loaded and if the API is available.
 
isotp_start_log_t isotp_start_log
 Start logging.
 
isotp_create_t isotp_create
 Create a new ISO-TP channel.
 
isotp_destroy_t isotp_destroy
 Destroy an existing ISO-TP channel.
 
isotp_register_callbacks_t isotp_register_callbacks
 Register callback functions.
 
isotp_set_full_duplex_t isotp_set_full_duplex
 Set full duplex mode.
 
isotp_set_j1939_priority_masking_t isotp_set_j1939_priority_masking
 Set J1939 priority masking.
 
isotp_set_pad_value_t isotp_set_pad_value
 Set padding value.
 
isotp_set_block_size_t isotp_set_block_size
 Set block size.
 
isotp_set_min_separation_time_t isotp_set_min_separation_time
 Set minimum separation time.
 
isotp_set_block_size_override_t isotp_set_block_size_override
 Set block size override.
 
isotp_set_min_separation_time_override_t isotp_set_min_separation_time_override
 Set minimum separation time override.
 
isotp_set_cr_max_t isotp_set_cr_max
 Set N_Cr_Max timeout.
 
isotp_set_a_max_t isotp_set_a_max
 Set N_As_Max and N_Ar_Max timeout.
 
isotp_set_bs_max_t isotp_set_bs_max
 Set N_Bs_Max timeout.
 
isotp_set_wft_max_t isotp_set_wft_max
 Set wft_max setting.
 
isotp_open_t isotp_open
 Open the ISO-TP channel.
 
isotp_close_t isotp_close
 Close the ISO-TP channel.
 
isotp_write_t isotp_write
 Write a message to the ISO-TP channel.
 

Detailed Description

A struct with all function pointers for the ISO-TP API.

Code Snippet:
// Load the Kvaser Iso-TP library
IsoTpApi api = load_library(LIBRARY_PATH);
if (!api.is_valid)
{
fprintf(stderr, "Failed to load Kvaser Iso-TP library!\n");
return 1;
}
// Create an ISO-TP channel
AddressInfo local_address = {0x7E8, false, 0, false, false};
AddressInfo remote_address = {0x7E0, false, 0, false, false};
CanMode can_mode = data_phase_bit_rate == 0 ? Can : CanFd;
CreateParams create_params = {
channel,
can_mode,
true, // support_virtual
bit_rate,
data_phase_bit_rate,
local_address,
remote_address,
};
int isotp_handle = api.isotp_create(&create_params);
if (isotp_handle < 0)
{
fprintf(stderr, "Failed to create ISO-TP channel!\n");
return 1;
}
// Close the ISO-TP channel
if (api.isotp_close(isotp_handle) != 0)
{
fprintf(stderr, "Failed to close ISO-TP channel!\n");
}
else
{
printf("ISO-TP channel closed successfully!\n");
}
// Destroy the ISO-TP channel
api.isotp_destroy(isotp_handle);
IsoTpApi load_library(const char *lib_path)
Load the Kvaser ISO-TP library.
Definition kvisotplib.h:737
CanMode
Possible CAN modes.
Definition kvisotplib.h:40
@ Can
Classic CAN mode.
Definition kvisotplib.h:42
@ CanFd
CAN FD mode.
Definition kvisotplib.h:44
void unload_library(IsoTpApi *pApi)
Unload the Kvaser ISO-TP library and clear the API structure.
Definition kvisotplib.h:712
ISO-TP address information.
Definition kvisotplib.h:115
A struct that holds the parameters for creating an ISO-TP channel.
Definition kvisotplib.h:132
A struct with all function pointers for the ISO-TP API.
Definition kvisotplib.h:575
isotp_destroy_t isotp_destroy
Destroy an existing ISO-TP channel.
Definition kvisotplib.h:595
bool is_valid
A flag indicating if the library was successfully loaded and if the API is available.
Definition kvisotplib.h:583
isotp_create_t isotp_create
Create a new ISO-TP channel.
Definition kvisotplib.h:591
isotp_close_t isotp_close
Close the ISO-TP channel.
Definition kvisotplib.h:651
See also
load_library
Examples
/examples/c_obd_reader/obd_reader.c.

Field Documentation

◆ handle

void* IsoTpApi::handle

Handle to the loaded library.

HMODULE on Windows, void* on Linux.


The documentation for this struct was generated from the following file: