AGHAF 5.0.9
Annecy electronique Generic Hardware Access Framework
Loading...
Searching...
No Matches
Ethernet/main.cpp
#define AGHAF_DYNAMIC_LIBRARY_INIT
#include <aghaf.h>
#include <iostream>
int main() {
#ifdef _WIN32
AGHAF_loadLibrary(AGHAF_DEFAULT_FILENAME);
#endif
uint32_t deviceCount = 0;
AGHAF_getDeviceCount(&deviceCount);
if (deviceCount > 0) {
AGHAF_DeviceInfo* devicesInfo = nullptr;
uint32_t deviceInfoNumber = 0;
AGHAF_getDeviceList(&devicesInfo, &deviceInfoNumber);
AGHAF_Device device = nullptr;
AGHAF_getDeviceBySN(devicesInfo[0].productNo, devicesInfo[0].serialNo,
&device);
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:29
AGHAF_Status AGHAF_ETH_setEthernetDiagLineState(AGHAF_EthBus ethernet, AGHAF_BOOL active)
AGHAF_ETH_setEthernetDiagLineState.
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
uint8_t AGHAF_ETH_getBusCount(AGHAF_Device device)
return the number of CAN bus from a device
AGHAF_Status AGHAF_getDeviceCount(uint32_t *count)
Return the number of devices onnected.
AGHAF_Status AGHAF_getDeviceList(AGHAF_DeviceInfo **devices, uint32_t *size)
Provide the list of devices connected.
void AGHAF_uninitialize(void)
Uninitialize Aghaf library.
void AGHAF_freeDeviceList(AGHAF_DeviceInfo *devices)
Free the memory allocated with AGHAF_getDeviceList.
void * AGHAF_Device
handle on an exxotest device
Definition aghaf_global.h:87
void AGHAF_initialize(void)
Initialize Aghaf library.
AGHAF_Status AGHAF_getDeviceBySN(char const *productNumber, char const *serialNumber, AGHAF_Device *device)
Return the handle on the specified device.
AGHAF_Status AGHAF_closeDevice(AGHAF_Device device)
close the device
AGHAF_Status AGHAF_openDevice(AGHAF_Device device)
Open a device.
@ AGHAF_TRUE
true
Definition aghaf_global.h:24
structure containing the informtions about a device
Definition aghaf_global.h:127