labbCAN_CAPI_Close.cpp

labbCAN C API Shut Down Procedure. The following examples shows how to close the labbCAN library properly when application shuts down.

//===========================================================================
// INCLUDES
//===========================================================================
//===========================================================================
// labbCAN Shutdown
//===========================================================================
TErrCode CloseLabbCAN_API(void)
{
TErrCode Result;
//
// First we set all devices into preoperational state and stop process data
// communication
//
Result = LCB_Stop();
if (ERR_NOERR != Result)
{
// handle error properly here
return Result;
}
// now we can read device parameters to store it into configuration file
//
// Closes the physical connection to the device, fress any resources and
// closes the labbCAN bus library
//
Result = LCB_Close();
if (Result != ERR_NOERR)
{
// handle error properly here
return Result;
}
// now we are are ready to shut down our application
return Result;
}