AGHAF
4.4.0
Annecy electronique Generic Hardware Access Framework
|
#include <vector>
#include <iostream>
#define AGHAF_DYNAMIC_LIBRARY_INIT
{
(void) userContext;
break;
switch (eventType) {
break;
uint8_t *data = new uint8_t[size];
delete [] data;
}
break;
}
}
break;
}
}
}
int main()
{
#ifdef _WIN32
AGHAF_loadLibrary(AGHAF_DEFAULT_FILENAME);
#endif
if (count > 0) {
uint32_t deviceInfoNumber = 0;
devicesInfo[0].productNo,
devicesInfo[0].serialNo);
&canBus_callback,
nullptr);
1000000);
5000000);
120);
std::vector<uint8_t> dataToSend;
dataToSend.push_back(0x01);
identifier.
id.
std = 0x100;
dataToSend.data(),
static_cast<uint32_t>(
dataToSend.size()));
}
#ifdef _WIN32
AGHAF_unloadLibrary();
#endif
return 0;
}
AGHAF_CAN_Frame AGHAF_CAN_Frame_new()
Return a handle on a CAN frame.
Definition: aghaf_can.cpp:372
AGHAF_CAN_EventType AGHAF_CAN_typeEvent(AGHAF_EventInfo event)
return the type from the event
Definition: aghaf_can.cpp:574
@ AGHAF_CAN_EVENT_BUSLOAD
Bus load information.
Definition: aghaf_can.h:50
AGHAF_Status AGHAF_CAN_Frame_id(AGHAF_CAN_Frame frame, AGHAF_CAN_Identifier *identifier)
Get the identifier from a CAN frame.
Definition: aghaf_can.cpp:406
AGHAF_Status AGHAF_CAN_Frame_data(AGHAF_CAN_Frame frame, void *data, int64_t size)
Provide the data contained in a frame.
Definition: aghaf_can.cpp:509
void * AGHAF_CAN_Frame
Handle to a CAN frame.
Definition: aghaf_can.h:85
@ AGHAF_CAN_EVENT_MSGTX
End of transmission.
Definition: aghaf_can.h:46
@ CAN_PARAM_BAUDRATE
Definition: aghaf_can_enums.h:60
@ CAN_PARAM_MODE
Definition: aghaf_can_enums.h:55
AGHAF_Status AGHAF_Event_getInfo(AGHAF_Event event, AGHAF_EventInfo *info)
AGHAF_Event_getInfo.
Definition: aghaf_global.cpp:278
void AGHAF_freeDeviceList(AGHAF_DeviceInfo *devices)
Free the memory allocated with AGHAF_getDeviceList.
Definition: aghaf_global.cpp:135
void * AGHAF_CAN_Event
Handle to a CAN event.
Definition: aghaf_can.h:88
@ AGHAF_CAN_IdStd
Standard 11 bit identifier.
Definition: aghaf_can.h:23
uint32_t AGHAF_getDeviceCount()
Return the number of devices onnected.
Definition: aghaf_global.cpp:111
AGHAF_Status AGHAF_openDevice(AGHAF_Device device)
Open a device.
Definition: aghaf_global.cpp:255
int64_t AGHAF_CAN_Frame_dataSize(AGHAF_CAN_Frame frame)
return the size from the data
Definition: aghaf_can.cpp:527
AGHAF_Device AGHAF_getDeviceBySN(const char *productNumber, const char *serialNumber)
Return the handle on the specified device.
Definition: aghaf_global.cpp:156
void AGHAF_CAN_Frame_delete(AGHAF_CAN_Frame frame)
Free the memory from a CAN frame.
Definition: aghaf_can.cpp:381
generic stucture to read an event in a callback
Definition: aghaf_global.h:210
@ CAN_PARAM_LISTEN_ONLY
Definition: aghaf_can_enums.h:93
@ AGHAF_CAN_EVENT_MSGRX
Message has been received.
Definition: aghaf_can.h:47
@ CAN_PARAM_BAUDRATE_FD
Definition: aghaf_can_enums.h:65
@ AGHAF_TRUE
true
Definition: aghaf_global.h:104
@ AGHAF_FALSE
false
Definition: aghaf_global.h:103
@ AGHAF_CAN_EVENT_BUSCHANGE
Chip state has chaged active or passive error ou bus off.
Definition: aghaf_can.h:49
AGHAF_CAN_Frame AGHAF_CAN_Event_frame(AGHAF_CAN_Event event)
return the frame contained in an event
Definition: aghaf_can.cpp:563
AGHAF_Status AGHAF_CAN_sendFrame(AGHAF_CAN_Bus bus, AGHAF_CAN_Frame frame)
send a frame on a CAN bus
Definition: aghaf_can.cpp:539
@ AGHAF_STATUS_OK
The operation succeeded.
Definition: aghaf_global.h:110
AGHAF_Status AGHAF_CAN_Bus_setParam(AGHAF_CAN_Bus bus, AGHAF_CAN_Param param, uint32_t value)
Set the value from a CAN parameter.
Definition: aghaf_can.cpp:123
AGHAF_Status AGHAF_CAN_Frame_setFDF(AGHAF_CAN_Frame frame, AGHAF_BOOL fdf, AGHAF_BOOL esi, AGHAF_BOOL brs)
AGHAF_CAN_Frame_setFDF.
Definition: aghaf_can.cpp:445
@ AGHAF_TypeDoCanEvent
Event from DOCAN.
Definition: aghaf_global.h:175
AGHAF_Status AGHAF_CAN_Frame_setData(AGHAF_CAN_Frame frame, const void *data, int64_t size)
Set the data from a frame.
Definition: aghaf_can.cpp:492
structure containing the informtions about a device
Definition: aghaf_global.h:187
AGHAF_TypeEvent type
Type information. Provide information about origin (device, can, ethernet...).
Definition: aghaf_global.h:212
@ AGHAF_TypeDeviceEvent
Event from Device.
Definition: aghaf_global.h:172
@ AGHAF_CAN_EVENT_ERROR
Bus error.
Definition: aghaf_can.h:48
AGHAF_Status AGHAF_closeDevice(AGHAF_Device device)
close the device
Definition: aghaf_global.cpp:266
AGHAF_CAN_IdentifierType type
Identifier type.
Definition: aghaf_can.h:109
structure to represent an indentifier CAN in the AGHAF library
Definition: aghaf_can.h:107
AGHAF_CAN_Bus AGHAF_CAN_getBus(AGHAF_Device device, uint8_t index)
return the CAN bus at index in parameter
Definition: aghaf_can.cpp:16
@ AGHAF_TypeEthernetEvent
Event from Ethernet.
Definition: aghaf_global.h:173
union AGHAF_CAN_Identifier::@0 id
Identifier.
void AGHAF_CAN_deregisterCallback(AGHAF_CAN_Bus bus, AGHAF_CAN_Callback callback)
deregister a callback
Definition: aghaf_can.cpp:64
void * AGHAF_Device
handle on an exxotest device
Definition: aghaf_global.h:145
@ CAN_PARAM_TERMINATION
Definition: aghaf_can_enums.h:99
AGHAF_Status AGHAF_CAN_Frame_setId(AGHAF_CAN_Frame frame, AGHAF_CAN_Identifier *identifier)
Set the identifier from a CAN frame.
Definition: aghaf_can.cpp:393
AGHAF_Status AGHAF_CAN_Bus_activate(AGHAF_CAN_Bus bus)
activate a CAN bus
Definition: aghaf_can.cpp:183
AGHAF_Status AGHAF_CAN_Bus_deactivate(AGHAF_CAN_Bus bus)
deactivate a CAN bus
Definition: aghaf_can.cpp:194
@ AGHAF_TypeNoEvent
No event. Event is invalid.
Definition: aghaf_global.h:171
AGHAF_Status AGHAF_getDeviceList(AGHAF_DeviceInfo **devices, uint32_t *size)
Provide the list of devices connected.
Definition: aghaf_global.cpp:123
@ AGHAF_CAN_MODE_FD
Definition: aghaf_can_enums.h:37
@ AGHAF_TypeCanEvent
Event from CAN.
Definition: aghaf_global.h:174
AGHAF_CAN_EventType
enumerator to tell the type of the event
Definition: aghaf_can.h:44
@ AGHAF_CAN_EVENT_UNKNOW
Unknown type of event.
Definition: aghaf_can.h:45
void * AGHAF_CAN_Bus
handle to a CAN bus
Definition: aghaf_can.h:82
void AGHAF_CAN_registerCallback(AGHAF_CAN_Bus bus, AGHAF_CAN_Callback callback, void *userContext)
Register a callback for the CAN events from a bus.
Definition: aghaf_can.cpp:50
AGHAF_Status
enumerator to define the error type in aghaf functions
Definition: aghaf_global.h:108
uint16_t std
Standard identifier.
Definition: aghaf_can.h:111