#include <iostream>
#include <vector>
#define AGHAF_DYNAMIC_LIBRARY_INIT
void onMessageTx(uint64_t timestamp, uint32_t ident, uint8_t flags,
uint16_t dataLen, uint8_t const *data, void *userContext) {
(void)timestamp;
(void)ident;
(void)flags;
(void)dataLen;
(void)data;
(void)userContext;
}
void onMessageRx(uint64_t timestamp, uint32_t ident, uint8_t flags,
uint16_t dataLen, uint8_t const *data, void *userContext) {
(void)timestamp;
(void)ident;
(void)flags;
(void)dataLen;
(void)data;
(void)userContext;
}
void onError(uint64_t timestamp,
AGHAF_CAN_Error error,
void *userContext) {
(void)timestamp;
(void)error;
(void)userContext;
}
void onBusChange(uint64_t timestamp, uint8_t chipState, void *userContext) {
(void)timestamp;
(void)chipState;
(void)userContext;
}
void onBusLoad(uint64_t timestamp, uint8_t chipState, uint8_t busLoad,
(void)timestamp;
(void)chipState;
(void)busLoad;
(void)error;
(void)userContext;
}
int main() {
#ifdef _WIN32
AGHAF_loadLibrary(AGHAF_DEFAULT_FILENAME);
#endif
uint32_t deviceInfoNumber = 0;
std::vector<uint8_t> dataToSend;
dataToSend.push_back(0x01);
dataToSend.size(), dataToSend.data());
} else {
std::cerr << "no CAN on this device\n";
}
} else {
std::cerr << "device is used by another application\n";
}
} else {
std::cerr << "no exxotest device connected\n";
}
#ifdef _WIN32
AGHAF_unloadLibrary();
#endif
return 0;
}
@ CAN_PARAM_TERMINATION
Definition: aghaf_can_enums.h:184
@ CAN_PARAM_LISTEN_ONLY
Definition: aghaf_can_enums.h:178
@ CAN_PARAM_MODE
Definition: aghaf_can_enums.h:140
@ CAN_PARAM_BAUDRATE_FD
Definition: aghaf_can_enums.h:150
@ CAN_PARAM_BAUDRATE
Definition: aghaf_can_enums.h:145
@ AGHAF_CAN_MODE_FD
Definition: aghaf_can_enums.h:122
#define AGHAF_CAN_MSG_FDF
FD format.
Definition: aghaf_can_enums.h:28
AGHAF_CAN_Error
Enumerator to describe the error on the bus.
Definition: aghaf_can_enums.h:100
#define AGHAF_CAN_MSG_BRS
Bit Rate Switch (Only evaluated if FD format is enabled)
Definition: aghaf_can_enums.h:29
@ AGHAF_STATUS_OK
The operation succeeded.
Definition: aghaf_global.h:121
AGHAF_Status AGHAF_CAN_v2_setParam(AGHAF_CAN can, AGHAF_CAN_Param param, uint32_t value)
Set the value from a CAN parameter.
Definition: aghaf_can_v2.cpp:165
AGHAF_Status AGHAF_CAN_v2_activate(AGHAF_CAN can)
activate a CAN bus
Definition: aghaf_can_v2.cpp:116
AGHAF_CAN AGHAF_CAN_v2_get(AGHAF_Device device, uint8_t index)
return the CAN bus at index in parameter
Definition: aghaf_can_v2.cpp:86
uint8_t AGHAF_CAN_v2_getCount(AGHAF_Device device)
return the number of CAN bus from a device
Definition: aghaf_can_v2.cpp:106
void * AGHAF_CAN
handle on CAN
Definition: aghaf_can_v2.h:15
AGHAF_Status AGHAF_CAN_v2_sendMessage(AGHAF_CAN can, uint32_t ident, uint8_t flags, uint16_t dataLen, uint8_t const *data)
send data on a CAN bus
Definition: aghaf_can_v2.cpp:380
void AGHAF_CAN_v2_setOnBusLoadCallback(AGHAF_CAN can, AGHAF_CAN_onBusLoad callback, void *userContext)
set the callback called on a bus noad event
Definition: aghaf_can_v2.cpp:73
void AGHAF_CAN_v2_setOnMessageRxCallback(AGHAF_CAN can, AGHAF_CAN_onMessageRx callback, void *userContext)
set the callback called on a rx event
Definition: aghaf_can_v2.cpp:35
void AGHAF_CAN_v2_setOnBusChangeCallback(AGHAF_CAN can, AGHAF_CAN_onBusChange callback, void *userContext)
set the callback called on a bus change event
Definition: aghaf_can_v2.cpp:60
void AGHAF_CAN_v2_useAPI()
Inform the library tu use the V2 CAN API.
Definition: aghaf_can_v2.cpp:12
void AGHAF_CAN_v2_setOnMessageTxCallback(AGHAF_CAN can, AGHAF_CAN_onMessageTx callback, void *userContext)
set the callback called on a tx event
Definition: aghaf_can_v2.cpp:22
AGHAF_Status AGHAF_CAN_v2_deactivate(AGHAF_CAN can)
deactivate a CAN bus
Definition: aghaf_can_v2.cpp:126
void AGHAF_CAN_v2_setOnErrorCallback(AGHAF_CAN can, AGHAF_CAN_onError callback, void *userContext)
set the callback called on error event
Definition: aghaf_can_v2.cpp:48
uint32_t AGHAF_getDeviceCount()
Return the number of devices onnected.
Definition: aghaf_global.cpp:105
AGHAF_Status AGHAF_getDeviceList(AGHAF_DeviceInfo **devices, uint32_t *size)
Provide the list of devices connected.
Definition: aghaf_global.cpp:117
AGHAF_Device AGHAF_getDeviceBySN(const char *productNumber, const char *serialNumber)
Return the handle on the specified device.
Definition: aghaf_global.cpp:145
void AGHAF_freeDeviceList(AGHAF_DeviceInfo *devices)
Free the memory allocated with AGHAF_getDeviceList.
Definition: aghaf_global.cpp:126
void * AGHAF_Device
handle on an exxotest device
Definition: aghaf_global.h:175
AGHAF_Status AGHAF_closeDevice(AGHAF_Device device)
close the device
Definition: aghaf_global.cpp:241
AGHAF_Status AGHAF_openDevice(AGHAF_Device device)
Open a device.
Definition: aghaf_global.cpp:231
@ AGHAF_FALSE
false
Definition: aghaf_global.h:115
structure containing the informtions about a device
Definition: aghaf_global.h:215