AGHAF  4.5.1
Annecy electronique Generic Hardware Access Framework
Global

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

enum  AGHAF_BOOL { AGHAF_FALSE = 0 , AGHAF_TRUE = 1 }
 enumerator to get a bool definition More...
 
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
}
 enumerator to define the error type in aghaf functions More...
 
enum  AGHAF_ConnectionMode { AGHAF_OFFLINE , AGHAF_USB , AGHAF_ETH }
 deprecated More...
 
enum  AGHAF_DeviceEvent { AGHAF_Device_noEvent , AGHAF_Device_Arrival , AGHAF_Device_Leave , AGHAF_Device_Present }
 device event fot hotplug management More...
 
enum  AGHAF_TypeEvent {
  AGHAF_TypeNoEvent , AGHAF_TypeDeviceEvent , AGHAF_TypeEthernetEvent , AGHAF_TypeCanEvent ,
  AGHAF_TypeDoCanEvent
}
 type of event received in a callback More...
 
enum  AGHAF_DeviceState { AGHAF_DeviceState_error = 0 , AGHAF_DeviceState_boot , AGHAF_DeviceState_ready }
 current state of the device (in the boot or in the application part of the firmware) More...
 
typedef void * AGHAF_Device
 handle on an exxotest device
 
typedef void * AGHAF_Event
 Typedef of a native event handle that can be used to wait for events.
 
typedef void(* AGHAF_Callback) (AGHAF_Event event, void *userContext)
 callback for the devices hotplug management More...
 
typedef enum AGHAF_DeviceState AGHAF_DeviceState
 current state of the device (in the boot or in the application part of the firmware)
 
typedef struct AGHAF_DeviceInfo AGHAF_DeviceInfo
 structure containing the informtions about a device
 
typedef struct AGHAF_EventInfo AGHAF_EventInfo
 generic stucture to read an event in a callback
 
uint32_t AGHAF_getVersion ()
 Return the version from Aghaf. More...
 
uint32_t AGHAF_getServiceVersion ()
 Return the version from aeds. More...
 
char const * AGHAF_getVersionString ()
 Return the version from Aghaf. More...
 
AGHAF_BOOL AGHAF_isServiceRunning ()
 Inform if ghaston is running or not. More...
 
char const * AGHAF_DeviceEvent_getProductName (AGHAF_Event event)
 return the product name from the device which emitted the device event More...
 
char const * AGHAF_DeviceEvent_getProductNumber (AGHAF_Event event)
 return the product number from the device which emitted the device event More...
 
char const * AGHAF_DeviceEvent_getSerialNumber (AGHAF_Event event)
 return the serial number from the device which emitted the device event More...
 
uint8_t const * AGHAF_DeviceEvent_getHardwareUniqueId (AGHAF_Event event)
 return the hardware unique id from the device which emitted the device event More...
 
uint32_t AGHAF_getDeviceCount ()
 Return the number of devices onnected. More...
 
AGHAF_Status AGHAF_getDeviceList (AGHAF_DeviceInfo **devices, uint32_t *size)
 Provide the list of devices connected. More...
 
void AGHAF_freeDeviceList (AGHAF_DeviceInfo *devices)
 Free the memory allocated with AGHAF_getDeviceList. More...
 
AGHAF_Status AGHAF_refreshDeviceList ()
 Call the device event callbacks with the devices connected. More...
 
AGHAF_Device AGHAF_getDeviceBySN (const char *productNumber, const char *serialNumber)
 Return the handle on the specified device. More...
 
AGHAF_Device AGHAF_getDeviceByHardID (uint8_t const *hardwareID)
 AGHAF_getDeviceByHardID. More...
 
AGHAF_Status AGHAF_getDeviceInfo (AGHAF_Device device, AGHAF_DeviceInfo *deviceInfo)
 Return the informations from a device. More...
 
AGHAF_ConnectionMode AGHAF_Device_getConnectionMode (AGHAF_Device device)
 AGHAF_Device_getConnectionMode. More...
 
void AGHAF_Device_getFriendlyNameEthCard (AGHAF_Device device, char **name)
 AGHAF_Device_getFriendlyNameEthCard. More...
 
void AGHAF_Device_freeFriendlyName (char *friendlyName)
 Free the memory allocated with AGHAF_Device_getFriendlyNameEthCard. More...
 
AGHAF_Status AGHAF_Device_getUsbInfo (AGHAF_Device device, uint16_t *vid, uint16_t *pid, uint16_t *rev)
 AGHAF_Device_getUsbInfo. More...
 
AGHAF_Status AGHAF_openDevice (AGHAF_Device device)
 Open a device. More...
 
AGHAF_Status AGHAF_closeDevice (AGHAF_Device device)
 close the device More...
 
AGHAF_Status AGHAF_Device_getTimestamp (AGHAF_Device device, uint64_t *timestamp)
 Return the current timestamp on the device. More...
 
AGHAF_Status AGHAF_Event_getInfo (AGHAF_Event event, AGHAF_EventInfo *info)
 AGHAF_Event_getInfo. More...
 
void AGHAF_registerCallback (AGHAF_Callback callback, void *userContext)
 Register a callback for the device event. More...
 
void 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_Callback

AGHAF_Callback

callback for the devices hotplug management

Parameters
eventhandle on the event
userContextcontext given in AGHAF_registerCallback
Note
Do not delete an event within the body of a callback function.

Enumeration Type Documentation

◆ AGHAF_BOOL

enum AGHAF_BOOL

enumerator to get a bool definition

Enumerator
AGHAF_FALSE 

false

AGHAF_TRUE 

true

◆ AGHAF_ConnectionMode

deprecated

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

device event fot hotplug management

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

current state of the device (in the boot or in the application part of the firmware)

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 to define the error type in aghaf functions

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.

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

type of event received in a callback

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_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, DoCan_FD/main.cpp, LIN_EventTriggered/main.cpp, LIN_Sporadic/main.cpp, and LIN_UnconditionalFrame/main.cpp.

◆ AGHAF_deregisterCallback()

void AGHAF_deregisterCallback ( AGHAF_Callback  callback)

Deregister a callback.

Parameters
callback
Examples
DeviceManagement/main.cpp.

◆ AGHAF_Device_freeFriendlyName()

void AGHAF_Device_freeFriendlyName ( char *  friendlyName)

Free the memory allocated with AGHAF_Device_getFriendlyNameEthCard.

Parameters
friendlyNamename to free

◆ AGHAF_Device_getConnectionMode()

AGHAF_ConnectionMode AGHAF_Device_getConnectionMode ( AGHAF_Device  device)

AGHAF_Device_getConnectionMode.

Parameters
device
Returns

◆ AGHAF_Device_getFriendlyNameEthCard()

void AGHAF_Device_getFriendlyNameEthCard ( AGHAF_Device  device,
char **  name 
)

AGHAF_Device_getFriendlyNameEthCard.

Parameters
device
name
Returns

◆ AGHAF_Device_getTimestamp()

AGHAF_Status AGHAF_Device_getTimestamp ( AGHAF_Device  device,
uint64_t *  timestamp 
)

Return the current timestamp on the device.

Parameters
devicehandle on the device
timestampwill be filled with the timestamp if request success
Returns
status request information

◆ AGHAF_Device_getUsbInfo()

AGHAF_Status 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_DeviceEvent_getHardwareUniqueId ( AGHAF_Event  event)

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

Parameters
event
Returns
hardware unique id

◆ AGHAF_DeviceEvent_getProductName()

char const* 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_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_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_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_freeDeviceList ( AGHAF_DeviceInfo devices)

Free the memory allocated with AGHAF_getDeviceList.

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

◆ AGHAF_getDeviceByHardID()

AGHAF_Device AGHAF_getDeviceByHardID ( uint8_t const *  hardwareID)

AGHAF_getDeviceByHardID.

Parameters
hardwareID
Returns

◆ AGHAF_getDeviceBySN()

AGHAF_Device 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, DoCan_FD/main.cpp, LIN_EventTriggered/main.cpp, LIN_Sporadic/main.cpp, and LIN_UnconditionalFrame/main.cpp.

◆ AGHAF_getDeviceCount()

uint32_t AGHAF_getDeviceCount ( void  )

Return the number of devices onnected.

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

◆ AGHAF_getDeviceInfo()

AGHAF_Status 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_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, DoCan_FD/main.cpp, LIN_EventTriggered/main.cpp, LIN_Sporadic/main.cpp, and LIN_UnconditionalFrame/main.cpp.

◆ AGHAF_getServiceVersion()

uint32_t AGHAF_getServiceVersion ( void  )

Return the version from aeds.

Returns
AEDS's version

◆ AGHAF_getVersion()

uint32_t AGHAF_getVersion ( void  )

Return the version from Aghaf.

Returns
Aghaf version

◆ AGHAF_getVersionString()

char const* AGHAF_getVersionString ( void  )

Return the version from Aghaf.

Returns
Aghaf version

◆ AGHAF_isServiceRunning()

AGHAF_BOOL AGHAF_isServiceRunning ( void  )

Inform if ghaston is running or not.

Returns
AGHAF_TRUE ? ghaston is running : ghaston is not running

◆ AGHAF_openDevice()

AGHAF_Status 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, DoCan_FD/main.cpp, LIN_EventTriggered/main.cpp, LIN_Sporadic/main.cpp, and LIN_UnconditionalFrame/main.cpp.

◆ AGHAF_refreshDeviceList()

AGHAF_Status AGHAF_refreshDeviceList ( void  )

Call the device event callbacks with the devices connected.

Returns
status request information

◆ AGHAF_registerCallback()

void AGHAF_registerCallback ( AGHAF_Callback  callback,
void *  userContext 
)

Register a callback for the device event.

Parameters
callback
userContext
Examples
DeviceManagement/main.cpp.