LibTiePie  0.5
Library for interfacing TiePie engineering instruments
 All Files Functions Typedefs Macros Modules Pages
Library

Description

Functions to initialize and exit the library and retrieve information from the library itself.

After loading the library, it must be initialized first, before functions in the library can be used. Before closing the library, when the application using the library no longer requires it, LibExit() must be called, to clear and free resources used by the library.

The library has a version number and a configuration number that can be queried. These can be used when requesting support from TiePie engineering.

On each library function call a status flag is set, indicating how the function was executed. When a function call behaves different than expected, check the status for possible causes.

Functions

void LibInit (void)
 Create and initialize internal resources used by the library. More...
 
bool8_t LibIsInitialized (void)
 Check whether the library's internal resources are initialized. More...
 
void LibExit (void)
 Clear and free internal resources used by the library. More...
 
TpVersion_t LibGetVersion (void)
 Get the library version number. More...
 
const char * LibGetVersionExtra (void)
 Get the library version postfix. More...
 
uint32_t LibGetConfig (uint8_t *pBuffer, uint32_t dwBufferLength)
 Get the library configuration number. More...
 
LibTiePieStatus_t LibGetLastStatus (void)
 Get the last status value. More...
 
const char * LibGetLastStatusStr (void)
 Get the last status value as text. More...
 

Function Documentation

void LibInit ( void  )

Create and initialize internal resources used by the library.

This function must be called after loading the library, before non library related functions in the library can be used. Calling non library related functions before the library is initialized will set the status flag to LIBTIEPIESTATUS_LIBRARY_NOT_INITIALIZED.

Remarks
LibInit can be called multiple times, an internal reference counter is used to keep track of the number of times it is called. LibExit() must then be called equally often.
Status values
This function does not affect the status flag.
See also
LibIsInitialized
LibExit
Since
0.5
bool8_t LibIsInitialized ( void  )

Check whether the library's internal resources are initialized.

Returns
BOOL8_TRUE if initialized, BOOL8_FALSE otherwise.
Status values
This function does not affect the status flag.
See also
LibInit
LibExit
Since
0.5
void LibExit ( void  )

Clear and free internal resources used by the library.

This function must be called before closing the library, when the application using the library no longer requires it.

Status values
This function does not affect the status flag.
See also
LibInit
LibIsInitialized
Since
0.5
TpVersion_t LibGetVersion ( void  )

Get the library version number.

Returns
The library version number.
Status values
This function does not affect the status flag.
Example
uint16_t wMajor = TPVERSION_MAJOR( Version );
uint16_t wMinor = TPVERSION_MINOR( Version );
uint16_t wRelease = TPVERSION_RELEASE( Version );
uint16_t wBuild = TPVERSION_BUILD( Version );
printf( "LibGetVersion = %u.%u.%u.%u\n" , wMajor , wMinor , wRelease , wBuild );
See also
LibGetVersionExtra
Since
0.4.0
const char* LibGetVersionExtra ( void  )

Get the library version postfix.

Returns
The library version postfix.
Status values
This function does not affect the status flag.
See also
LibGetVersion
Since
0.5
uint32_t LibGetConfig ( uint8_t *  pBuffer,
uint32_t  dwBufferLength 
)

Get the library configuration number.

Parameters
[out]pBufferA pointer to the buffer to write to.
[in]dwBufferLengthThe length of the buffer, in bytes.
Returns
The library configuration number length in bytes.
Status values
This function does not affect the status flag.
Example
uint32_t dwLength = LibGetConfig( NULL , 0 );
uint8_t* pBuffer = malloc( sizeof( uint8_t ) * dwLength );
dwLength = LibGetConfig( Buffer , dwLength );
printf( "LibGetConfig = 0x" );
for( i = 0 ; i < dwLength ; i++ )
printf( "%02x" , pBuffer[ i ] );
printf( "\n" );
free( pBuffer );
Since
0.4.0
LibTiePieStatus_t LibGetLastStatus ( void  )

Get the last status value.

After each call to a library function, a status flag is set, indicating how the function was executed.

Returns
Status code.
Status values
This function does not affect the status flag.
See also
LibGetLastStatusStr
Example
printf( "LibGetLastStatus = %d\n" , LibGetLastStatus() );
Since
0.4.0
const char* LibGetLastStatusStr ( void  )

Get the last status value as text.

After each call to a library function, a status flag is set, indicating how the function was executed.

Returns
Status code as text.
Status values
This function does not affect the status flag.
See also
LibGetLastStatus
Example
printf( "LibGetLastStatusStr = %s\n" , LibGetLastStatusStr() );
Since
0.4.0