1.1.2.4.15 DRV_G3_MACRT_ExceptionCallbackRegister Function

C

void DRV_G3_MACRT_ExceptionCallbackRegister (
    const DRV_HANDLE handle,
    const DRV_G3_MACRT_EXCEPTION_CALLBACK callback
);

Summary

Allows a client to set an exception event handling function for the driver to call back when some error occurs through PLC transceiver communication.

Description

This function allows a client to register a PLC exception event handling function for the driver to call back when a communication SPI error occurs.

The event handler should be set before using the PLC transceiver in order to capture error events. The callback once set, persists until the client closes the driver or sets another callback (which could be a NULL pointer to indicate no callback).

Precondition

DRV_G3_MACRT_Open must have been called to obtain a valid opened device handle.

Parameters

ParamDescription
handleA valid instance handle, returned from the driver's open routine
callbackPointer to the callback function

Returns

None.

Example

void APP_PLC_Exception_callback(DRV_G3_MACRT_EXCEPTION_OBJ *exceptionObj)
{
    // Exception handling here.
}

// myAppObj is an application specific state data object.
MY_APP_OBJ myAppObj;

// Client registers an exception callback with driver. This is done once
// 'myHandle', returned from DRV_G3_MACRT_Open previously called
DRV_G3_MACRT_ExceptionCallbackRegister( myAppObj.myHandle, APP_PLC_Exception_callback );

Remarks

None.