WPILibC++ 2023.4.3-108-ge5452e3
Simulator Extensions

HAL Simulator Extensions. More...

Typedefs

typedef int halsim_extension_init_func_t(void)
 

Functions

int HAL_LoadOneExtension (const char *library)
 Loads a single extension from a direct path. More...
 
int HAL_LoadExtensions (void)
 Loads any extra halsim libraries provided in the HALSIM_EXTENSIONS environment variable. More...
 
void HAL_RegisterExtension (const char *name, void *data)
 Registers an extension such that other extensions can discover it. More...
 
void HAL_RegisterExtensionListener (void *param, void(*func)(void *, const char *name, void *data))
 Registers an extension registration listener function. More...
 
void HAL_SetShowExtensionsNotFoundMessages (HAL_Bool showMessage)
 Enables or disables the message saying no HAL extensions were found. More...
 
void HAL_OnShutdown (void *param, void(*func)(void *))
 Registers a function to be called from HAL_Shutdown(). More...
 

Detailed Description

HAL Simulator Extensions.

These are libraries that provide additional simulator functionality.

An extension must expose the HALSIM_InitExtension entry point which is invoked after the library is loaded.

The entry point is expected to return < 0 for errors that should stop the HAL completely, 0 for success, and > 0 for a non fatal error.

Typedef Documentation

◆ halsim_extension_init_func_t

typedef int halsim_extension_init_func_t(void)

Function Documentation

◆ HAL_LoadExtensions()

int HAL_LoadExtensions ( void  )

Loads any extra halsim libraries provided in the HALSIM_EXTENSIONS environment variable.

Returns
the success state of the initialization

◆ HAL_LoadOneExtension()

int HAL_LoadOneExtension ( const char *  library)

Loads a single extension from a direct path.

Expected to be called internally, not by users.

Parameters
librarythe library path
Returns
the success state of the initialization

◆ HAL_OnShutdown()

void HAL_OnShutdown ( void *  param,
void(*)(void *)  func 
)

Registers a function to be called from HAL_Shutdown().

This is intended for use only by simulation extensions.

Parameters
paramparameter data to pass to callback function
funccallback function

◆ HAL_RegisterExtension()

void HAL_RegisterExtension ( const char *  name,
void *  data 
)

Registers an extension such that other extensions can discover it.

The passed data pointer is retained and the extension must keep this pointer valid.

Parameters
nameextension name (may embed version number)
datadata pointer

◆ HAL_RegisterExtensionListener()

void HAL_RegisterExtensionListener ( void *  param,
void(*)(void *, const char *name, void *data func 
)

Registers an extension registration listener function.

The function will be called immediately with any currently registered extensions, and will be called later when any additional extensions are registered.

Parameters
paramparameter data to pass to callback function
funccallback function to be called for each registered extension; parameters are the parameter data, extension name, and extension data pointer passed to HAL_RegisterExtension()

◆ HAL_SetShowExtensionsNotFoundMessages()

void HAL_SetShowExtensionsNotFoundMessages ( HAL_Bool  showMessage)

Enables or disables the message saying no HAL extensions were found.

Some apps don't care, and the message create clutter. For general team code, we want it.

This must be called before HAL_Initialize is called.

This defaults to true.

Parameters
showMessagetrue to show message, false to not.