All Files Functions Typedefs Enumerations Enumerator Macros Pages
Macros | Functions
BconAdapterApi.h File Reference

Definition of the BCON adapter interface. More...

#include <stddef.h>
#include "BconAdapterDefines.h"
#include "BconAdapterTypes.h"

Macros

#define BCON_ADAPTER_API_MAJORVERSION   1u
 Current major version of the BCON adapter API. A change to the major version number indicates a breaking change. The BCON adapter will not be loaded if the version is different from the supported version.
 
#define BCON_ADAPTER_API_MINORVERSION   0u
 Current minor version of the BCON adapter API. If only the minor version number differs, the API differences will be handled correctly by the caller.
 

Functions

BCONSTATUS BCON_ADAPTER_CALL BconAdapterInit (BconTraceFunc pTraceFunc)
 Initializes/opens the BCON adapter layer. This function is called when the library is loaded. Re-initialization is possible after calling BconAdapterExit(). More...
 
BCONSTATUS BCON_ADAPTER_CALL BconAdapterExit (void)
 Closes the BCON adapter layer. This function is called before the library is unloaded. It should free all resources. More...
 
BCONSTATUS BCON_ADAPTER_CALL BconAdapterGetVersion (unsigned int *apiMajorVersion, unsigned int *apiMinorVersion, unsigned int *adapterMajorVersion, unsigned int *adapterMinorVersion)
 Returns the version of the library. This function is called to check the API version implemented by the library. Two different sets of major/minor version numbers are returned: More...
 
BCONSTATUS BCON_ADAPTER_CALL BconAdapterGetStatusMessage (BCONSTATUS statusToDecode, char *pBuffer, size_t bufferSize, size_t *pRequiredSize)
 Retrieves the message text of a status code. This function is called to decode a user-defined status code into a readable string. More...
 

Detailed Description

Definition of the BCON adapter interface.

Function Documentation

BCONSTATUS BCON_ADAPTER_CALL BconAdapterExit ( void  )

Closes the BCON adapter layer. This function is called before the library is unloaded. It should free all resources.

Returns
Status of the library.
Return values
BCON_OKif resources were freed.
Anyother BCON adapter error code otherwise.
Precondition
Library was successfully initialized.
Postcondition
Library resources are freed and can be unloaded.
Thread Safety:
This function does not need to be thread-safe. All created objects are destroyed before BconAdapterExit() is called.
Note
This function must be implemented.
BCONSTATUS BCON_ADAPTER_CALL BconAdapterGetStatusMessage ( BCONSTATUS  statusToDecode,
char *  pBuffer,
size_t  bufferSize,
size_t *  pRequiredSize 
)

Retrieves the message text of a status code. This function is called to decode a user-defined status code into a readable string.

Parameters
[in]statusToDecodeStatus to decode into string.
[in]pBufferOptional. The buffer for the returned string. This parameter can be NULL to retrieve the required buffer size.
[in]bufferSizeSize in number of characters. This parameter can be 0 to retrieve the required buffer size.
[in,out]pRequiredSizeOptional. Required size of the buffer including terminating 0. If the buffer is not large enough to hold the full string and is at least of one byte size, an empty string is returned.
Returns
Status of the retrieval.
Return values
BCON_OKon success.
BCON_E_INSUFFICIENT_BUFFERif the buffer provided is too small.
BCON_E_NOT_FOUNDif the status code was not found.
Anyother BCON adapter error code otherwise.
Thread Safety:
This function must be thread-safe.
Note
This function can be implemented.
BCONSTATUS BCON_ADAPTER_CALL BconAdapterGetVersion ( unsigned int *  apiMajorVersion,
unsigned int *  apiMinorVersion,
unsigned int *  adapterMajorVersion,
unsigned int *  adapterMinorVersion 
)

Returns the version of the library. This function is called to check the API version implemented by the library. Two different sets of major/minor version numbers are returned:

  • Version of the BCON adapter API implemented by the library.
  • Version of the adapter library. Only used for display.
Parameters
[out]apiMajorVersionMajor version of the BCON adapter API (BCON_ADAPTER_API_MAJORVERSION ).
[out]apiMinorVersionMinor version of the BCON adapter API (BCON_ADAPTER_API_MINORVERSION ).
[out]adapterMajorVersionMajor version of the adapter library.
[out]adapterMinorVersionMinor version of the adapter library.
Returns
Status of the retrieval.
Return values
BCON_OKon success.
Anyother BCON adapter error code otherwise.
Thread Safety:
This function must be thread-safe.
Note
This function must be implemented.
BCONSTATUS BCON_ADAPTER_CALL BconAdapterInit ( BconTraceFunc  pTraceFunc)

Initializes/opens the BCON adapter layer. This function is called when the library is loaded. Re-initialization is possible after calling BconAdapterExit().

Parameters
[in]pTraceFuncOptional. Pointer to a function. If this parameter is not NULL, you can call this to write to the host application.
Returns
Initialization status.
Return values
BCON_OKon success.
Anyother BCON adapter error code otherwise.
Postcondition
Library is ready to use.
Thread Safety:
This function is only called once before BconAdapterExit() is called. This function does not need to be thread-safe.
Note
This function must be implemented.

BCONAdapterAPI 1.0
© 2016 Basler AG (Thu Aug 11 2016 18:01:25)