AGHAF  4.5.5
Annecy electronique Generic Hardware Access Framework
Ethernet/main.cpp
#include <iostream>
#define AGHAF_DYNAMIC_LIBRARY_INIT
#include <aghaf.h>
int main() {
#ifdef _WIN32
AGHAF_loadLibrary(AGHAF_DEFAULT_FILENAME);
#endif
if (AGHAF_getDeviceCount() > 0) {
AGHAF_DeviceInfo *devicesInfo = nullptr;
uint32_t deviceInfoNumber = 0;
AGHAF_getDeviceList(&devicesInfo, &deviceInfoNumber);
AGHAF_Device device =
AGHAF_getDeviceBySN(devicesInfo[0].productNo, devicesInfo[0].serialNo);
AGHAF_freeDeviceList(devicesInfo);
if (AGHAF_ETH_getBusCount(device) > 0) {
AGHAF_EthBus ethBus = AGHAF_ETH_getBus(device, 0);
// activate the DoIP activation line
} else {
std::cerr << "no ethernet 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;
}
@ AGHAF_STATUS_OK
The operation succeeded.
Definition: aghaf_global.h:121
AGHAF_Status AGHAF_ETH_setEthernetDiagLineState(AGHAF_EthBus ethernet, AGHAF_BOOL active)
AGHAF_ETH_setEthernetDiagLineState.
Definition: aghaf_eth.cpp:161
void * AGHAF_EthBus
Handle on a ethernet object.
Definition: aghaf_eth.h:24
AGHAF_EthBus AGHAF_ETH_getBus(AGHAF_Device device, uint8_t index)
return the Ethernet bus at index in parameter
Definition: aghaf_eth.cpp:15
uint8_t AGHAF_ETH_getBusCount(AGHAF_Device device)
return the number of CAN bus from a device
Definition: aghaf_eth.cpp:35
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_TRUE
true
Definition: aghaf_global.h:116
structure containing the informtions about a device
Definition: aghaf_global.h:215