PDF

AGHAF  4.3.5
Annecy electronique Generic Hardware Access Framework
Global

API to interrogate AEDS about connected devices. More...

enum  AGHAF_BOOL { AGHAF_FALSE = 0, AGHAF_TRUE = 1 }
 
enum  AGHAF_Status {
  AGHAF_STATUS_OK = 0, AGHAF_ERROR_PARAM, AGHAF_ERROR_NOT_ENOUGH_MEMORY, AGHAF_ERROR_OUT_OF_MEMORY,
  AGHAF_ERROR_NOT_IMPLEMENTED, AGHAF_ERROR_END_REACHED, AGHAF_INTERNAL_ERROR, AGHAF_ERROR_CONNECTION,
  AGHAF_ERROR_BUS_NOT_FOUND, AGHAF_ERROR_PENDING, AGHAF_ERROR_WRONG_STATE, AGHAF_ERROR_NOT_ENOUGH_BUS,
  AGHAF_WRONG_SERVICE_VERSION, AGHAF_TIMEOUT_COM, AGHAF_DEPRECATED, AGHAF_ERROR_SEQUENCE,
  AGHAF_ERROR_FIFOFULL, AGHAF_ERROR_ALREADY_OPEN, AGHAF_ERROR_BUSY, AGHAF_ERROR_NOMORECHANNEL,
  AGHAF_ERROR_UNKNOWN, AGHAF_ERROR_WRONG_SESSION_TYPE, AGHAF_ERROR_NO_DATA = 0xff
}
 
enum  AGHAF_ConnectionMode { AGHAF_OFFLINE, AGHAF_USB, AGHAF_ETH }
 
enum  AGHAF_DeviceEvent { AGHAF_Device_noEvent, AGHAF_Device_Arrival, AGHAF_Device_Leave, AGHAF_Device_Present }
 
enum  AGHAF_TypeEvent {
  AGHAF_TypeNoEvent, AGHAF_TypeDeviceEvent, AGHAF_TypeEthernetEvent, AGHAF_TypeCanEvent,
  AGHAF_TypeDoCanEvent
}
 
enum  AGHAF_DeviceState { AGHAF_DeviceState_error = 0, AGHAF_DeviceState_boot, AGHAF_DeviceState_ready }
 
typedef int AGHAF_EventHandle
 
typedef void * AGHAF_Device
 
typedef void * AGHAF_Event
 
typedef void(* AGHAF_Callback) (AGHAF_Event event, void *)
 
typedef enum AGHAF_DeviceState AGHAF_DeviceState
 
typedef struct AGHAF_DeviceInfo AGHAF_DeviceInfo
 
typedef struct AGHAF_IpAddress AGHAF_IpAddress
 represent an IP address
 
typedef struct AGHAF_EventInfo AGHAF_EventInfo
 
uint32_t AGHAF_API AGHAF_getVersion (void)
 Return the version from Aghaf. More...
 
const char *AGHAF_API AGHAF_getVersionString (void)
 Return the version from Aghaf. More...
 
uint32_t AGHAF_API AGHAF_getServiceVersion (void)
 Return the version from aeds. More...
 
AGHAF_BOOL AGHAF_API AGHAF_isServiceRunning (void)
 Inform if ghaston is running or not. More...
 
char const *AGHAF_API AGHAF_DeviceEvent_getProductName (AGHAF_Event event)
 return the product name from the device which emitted the device event More...
 
char const *AGHAF_API AGHAF_DeviceEvent_getProductNumber (AGHAF_Event event)
 return the product number from the device which emitted the device event More...
 
char const *AGHAF_API AGHAF_DeviceEvent_getSerialNumber (AGHAF_Event event)
 return the serial number from the device which emitted the device event More...
 
uint8_t const *AGHAF_API AGHAF_DeviceEvent_getHardwareUniqueId (AGHAF_Event event)
 return the hardware unique id from the device which emitted the device event More...
 
uint32_t AGHAF_API AGHAF_getDeviceCount (void)
 Return the number of devices onnected. More...
 
AGHAF_Status AGHAF_API AGHAF_getDeviceList (AGHAF_DeviceInfo **devices, uint32_t *size)
 Provide the list of devices connected. More...
 
void AGHAF_API AGHAF_freeDeviceList (AGHAF_DeviceInfo *devices)
 Free the memory allocated with AGHAF_getDeviceList. More...
 
AGHAF_Status AGHAF_API AGHAF_refreshDeviceList (void)
 Call the device event callbacks with the devices connected. More...
 
AGHAF_Device AGHAF_API AGHAF_getDeviceBySN (const char *productNumber, const char *serialNumber)
 Return the handle on the specified device. More...
 
AGHAF_Device AGHAF_API AGHAF_getDeviceByHardID (uint8_t const *hardwareID)
 AGHAF_getDeviceByHardID. More...
 
AGHAF_Status AGHAF_API AGHAF_getDeviceInfo (AGHAF_Device device, AGHAF_DeviceInfo *deviceInfo)
 Return the informations from a device. More...
 
AGHAF_ConnectionMode AGHAF_API AGHAF_Device_getConnectionMode (AGHAF_Device device)
 AGHAF_Device_getConnectionMode. More...
 
void AGHAF_API AGHAF_Device_getFriendlyNameEthCard (AGHAF_Device device, char **name)
 AGHAF_Device_getFriendlyNameEthCard. More...
 
void AGHAF_API AGHAF_Device_freeFriendlyName (char *friendlyName)
 Free the memory allocated with AGHAF_Device_getFriendlyNameEthCard. More...
 
AGHAF_Status AGHAF_API AGHAF_Device_getUsbInfo (AGHAF_Device device, uint16_t *vid, uint16_t *pid, uint16_t *rev)
 AGHAF_Device_getUsbInfo. More...
 
AGHAF_Status AGHAF_API AGHAF_openDevice (AGHAF_Device device)
 Open a device. More...
 
AGHAF_Status AGHAF_API AGHAF_closeDevice (AGHAF_Device device)
 close the device More...
 
AGHAF_Status AGHAF_API AGHAF_Event_getInfo (AGHAF_Event event, AGHAF_EventInfo *info)
 AGHAF_Event_getInfo. More...
 
void AGHAF_API AGHAF_registerCallback (AGHAF_Callback callback, void *userData)
 Register a callback for the device event. More...
 
void AGHAF_API AGHAF_deregisterCallback (AGHAF_Callback callback)
 Deregister a callback. More...
 

Detailed Description

API to interrogate AEDS about connected devices.

Warning
A device whose Leave event happened must not be used anymore. In deed, the object is destroyed in the library and is no more usable.

Typedef Documentation

◆ AGHAF_EventHandle

Typedef of a native event handle that can be used to wait on events.

Enumeration Type Documentation

◆ AGHAF_BOOL

enum AGHAF_BOOL
Enumerator
AGHAF_FALSE 

false

AGHAF_TRUE 

true

◆ AGHAF_ConnectionMode

Enumerator
AGHAF_OFFLINE 

The device is disconnected.

AGHAF_USB 

The device is connected using USB.

AGHAF_ETH 

The device is connected over a network (Ethernet of WiFi)

◆ AGHAF_DeviceEvent

Enumerator
AGHAF_Device_noEvent 

No event. Event is invalid.

AGHAF_Device_Arrival 

A device was connected to this PC.

AGHAF_Device_Leave 

A device was disconnected from this PC.

AGHAF_Device_Present 

A device was present.

◆ AGHAF_DeviceState

Enumerator
AGHAF_DeviceState_error 

No state. Information is invalid.

AGHAF_DeviceState_boot 

Device is in boot state. no firmware detected.

AGHAF_DeviceState_ready 

Device is ready to use.

◆ AGHAF_Status

Enumerator
AGHAF_STATUS_OK 

The operation succeeded.

AGHAF_ERROR_PARAM 

One or more parameters are invalid.

AGHAF_ERROR_NOT_ENOUGH_MEMORY 

Not enough memory. Generally means that the output buffer of a function is too small to hold all the data.

AGHAF_ERROR_OUT_OF_MEMORY 

This is an internal error meaning that the library or its underlying elements have run out of memory.

AGHAF_ERROR_NOT_IMPLEMENTED 

The function is not yet implemented. This error probably means that you are using an unstable development version. Please contact software support to get the latest stable version.

AGHAF_ERROR_END_REACHED 

There was not enough elements left and the end has been reached. This error happens when trying to access at least 1 element after the end, i.e. reading the last element does not trigger this error.

AGHAF_INTERNAL_ERROR 

There was an error in internal object management.

AGHAF_ERROR_CONNECTION 

This error happens when communication with service is lost.

AGHAF_ERROR_BUS_NOT_FOUND 

This error happens when trying to access a bus or device with a invalid handle.

AGHAF_ERROR_PENDING 

Internal use only.

AGHAF_ERROR_WRONG_STATE 

This error happens when user call function in wrong state. see can_table docan_table.

AGHAF_ERROR_NOT_ENOUGH_BUS 

This error happens when user try to access a wrong AGHAF_DoCAN_Bus.

AGHAF_WRONG_SERVICE_VERSION 

This error happens when the service is not compatible with the version of this library.

AGHAF_TIMEOUT_COM 

This error happens when service take too long time to response.

AGHAF_DEPRECATED 

This error happens when a function is deprecated.

AGHAF_ERROR_SEQUENCE 

sequence of function call is wrong

AGHAF_ERROR_FIFOFULL 

intern fifo if full

AGHAF_ERROR_ALREADY_OPEN 

device already opened

AGHAF_ERROR_BUSY 

busy

AGHAF_ERROR_NOMORECHANNEL 

no more do can channels are available

AGHAF_ERROR_UNKNOWN 

unknown error, contact your provider

AGHAF_ERROR_WRONG_SESSION_TYPE 

the type of the session does not match the function called

AGHAF_ERROR_NO_DATA 

This error happens when a problem occur between this library and service.

◆ AGHAF_TypeEvent

Enumerator
AGHAF_TypeNoEvent 

No event. Event is invalid.

AGHAF_TypeDeviceEvent 

Event from Device.

AGHAF_TypeEthernetEvent 

Event from Ethernet.

AGHAF_TypeCanEvent 

Event from CAN.

AGHAF_TypeDoCanEvent 

Event from DOCAN.

Function Documentation

◆ AGHAF_closeDevice()

AGHAF_Status AGHAF_API AGHAF_closeDevice ( AGHAF_Device  device)

close the device

Parameters
devicehandle on the device
Returns
status request information
Examples
Can_FD/main.cpp, Can_LS/main.cpp, and DoCan_FD/main.cpp.

◆ AGHAF_deregisterCallback()

void AGHAF_API AGHAF_deregisterCallback ( AGHAF_Callback  callback)

Deregister a callback.

Parameters
callback
Examples
DeviceManagement/main.cpp.

◆ AGHAF_Device_freeFriendlyName()

void AGHAF_API AGHAF_Device_freeFriendlyName ( char *  friendlyName)

Free the memory allocated with AGHAF_Device_getFriendlyNameEthCard.

Parameters
friendlyNamename to free

◆ AGHAF_Device_getConnectionMode()

AGHAF_ConnectionMode AGHAF_API AGHAF_Device_getConnectionMode ( AGHAF_Device  device)

AGHAF_Device_getConnectionMode.

Parameters
device
Returns

◆ AGHAF_Device_getFriendlyNameEthCard()

void AGHAF_API AGHAF_Device_getFriendlyNameEthCard ( AGHAF_Device  device,
char **  name 
)

AGHAF_Device_getFriendlyNameEthCard.

Parameters
device
name
Returns

◆ AGHAF_Device_getUsbInfo()

AGHAF_Status AGHAF_API AGHAF_Device_getUsbInfo ( AGHAF_Device  device,
uint16_t *  vid,
uint16_t *  pid,
uint16_t *  rev 
)

AGHAF_Device_getUsbInfo.

Parameters
device
vid
pid
rev
Returns

◆ AGHAF_DeviceEvent_getHardwareUniqueId()

uint8_t const* AGHAF_API AGHAF_DeviceEvent_getHardwareUniqueId ( AGHAF_Event  event)

return the hardware unique id from the device which emitted the device event

Parameters
event
Returns
hardware unique id
Examples
DeviceManagement/main.cpp.

◆ AGHAF_DeviceEvent_getProductName()

char const* AGHAF_API AGHAF_DeviceEvent_getProductName ( AGHAF_Event  event)

return the product name from the device which emitted the device event

Parameters
event
Returns
product name
Examples
DeviceManagement/main.cpp.

◆ AGHAF_DeviceEvent_getProductNumber()

char const* AGHAF_API AGHAF_DeviceEvent_getProductNumber ( AGHAF_Event  event)

return the product number from the device which emitted the device event

Parameters
event
Returns
product number
Examples
DeviceManagement/main.cpp.

◆ AGHAF_DeviceEvent_getSerialNumber()

char const* AGHAF_API AGHAF_DeviceEvent_getSerialNumber ( AGHAF_Event  event)

return the serial number from the device which emitted the device event

Parameters
event
Returns
serial number
Examples
DeviceManagement/main.cpp.

◆ AGHAF_Event_getInfo()

AGHAF_Status AGHAF_API AGHAF_Event_getInfo ( AGHAF_Event  event,
AGHAF_EventInfo info 
)

AGHAF_Event_getInfo.

Parameters
event
info
Returns
Examples
Can_FD/main.cpp, Can_LS/main.cpp, DeviceManagement/main.cpp, and DoCan_FD/main.cpp.

◆ AGHAF_freeDeviceList()

void AGHAF_API AGHAF_freeDeviceList ( AGHAF_DeviceInfo devices)

Free the memory allocated with AGHAF_getDeviceList.

Parameters
devicesarray to free
Examples
Can_FD/main.cpp, Can_LS/main.cpp, and DoCan_FD/main.cpp.

◆ AGHAF_getDeviceByHardID()

AGHAF_Device AGHAF_API AGHAF_getDeviceByHardID ( uint8_t const *  hardwareID)

AGHAF_getDeviceByHardID.

Parameters
hardwareID
Returns

◆ AGHAF_getDeviceBySN()

AGHAF_Device AGHAF_API AGHAF_getDeviceBySN ( const char *  productNumber,
const char *  serialNumber 
)

Return the handle on the specified device.

Parameters
productNumberproduct number of the device
serialNumberserial number of the device
Returns
handle on the device
Examples
Can_FD/main.cpp, Can_LS/main.cpp, DeviceManagement/main.cpp, and DoCan_FD/main.cpp.

◆ AGHAF_getDeviceCount()

uint32_t AGHAF_API AGHAF_getDeviceCount ( )

Return the number of devices onnected.

Returns
number of devices connected
Examples
Can_FD/main.cpp, Can_LS/main.cpp, and DoCan_FD/main.cpp.

◆ AGHAF_getDeviceInfo()

AGHAF_Status AGHAF_API AGHAF_getDeviceInfo ( AGHAF_Device  device,
AGHAF_DeviceInfo deviceInfo 
)

Return the informations from a device.

Parameters
devicehandle on the device
deviceInfopointer to fill with the data
Returns
status request information

◆ AGHAF_getDeviceList()

AGHAF_Status AGHAF_API AGHAF_getDeviceList ( AGHAF_DeviceInfo **  devices,
uint32_t *  size 
)

Provide the list of devices connected.

Parameters
devicespointer to fill with devices
sizenumber of devices in devices
Returns
status request information
Warning
the memory allocated in devices must freed with AGHAF_freeDeviceList
Examples
Can_FD/main.cpp, Can_LS/main.cpp, and DoCan_FD/main.cpp.

◆ AGHAF_getServiceVersion()

uint32_t AGHAF_API AGHAF_getServiceVersion ( )

Return the version from aeds.

Returns
AEDS's version

◆ AGHAF_getVersion()

uint32_t AGHAF_API AGHAF_getVersion ( )

Return the version from Aghaf.

Returns
Aghaf version

◆ AGHAF_getVersionString()

const char* AGHAF_API AGHAF_getVersionString ( )

Return the version from Aghaf.

Returns
Aghaf version

◆ AGHAF_isServiceRunning()

AGHAF_BOOL AGHAF_API AGHAF_isServiceRunning ( )

Inform if ghaston is running or not.

Returns
AGHAF_TRUE ? ghaston is running : ghaston is not running

◆ AGHAF_openDevice()

AGHAF_Status AGHAF_API AGHAF_openDevice ( AGHAF_Device  device)

Open a device.

Parameters
devicehandle on the device
Returns
status request information
Examples
Can_FD/main.cpp, Can_LS/main.cpp, and DoCan_FD/main.cpp.

◆ AGHAF_refreshDeviceList()

AGHAF_Status AGHAF_API AGHAF_refreshDeviceList ( )

Call the device event callbacks with the devices connected.

Returns
status request information

◆ AGHAF_registerCallback()

void AGHAF_API AGHAF_registerCallback ( AGHAF_Callback  callback,
void *  userData 
)

Register a callback for the device event.

Parameters
callback
userData
Examples
DeviceManagement/main.cpp.