1.1.2.4.9 DRV_G3_MACRT_TxCfmCallbackRegister Function

C

void DRV_G3_MACRT_TxCfmCallbackRegister (
    const DRV_HANDLE handle,
    const DRV_G3_MACRT_TX_CFM_CALLBACK callback
);

Summary

Allows a client to set a G3 MAC RT data confirm event handling function for the driver to call back when the requested transmission has finished.

Description

This function allows a client to register a G3 MAC RT data confirm event handling function for the driver to call back when a data confirmation PLC event occurs.

The event handler should be set before the client submits any transmission requests that could generate 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

// Event is received when the transmission is finished
void APP_PLC_Tx_Cfm_callback(MAC_RT_TX_CFM_OBJ *cfmObj)
{
    if (cfmObj->result == MAC_RT_STATUS_SUCCESS) {
        // This means the data was transferred successfully.
    } else {
        // Error handling here.
    }
}

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

// Client registers a TX confirm callback with driver. This is done once
// 'myHandle', returned from DRV_G3_MACRT_Open previously called
DRV_G3_MACRT_TxCfmCallbackRegister( myAppObj.myHandle, APP_PLC_Tx_Cfm_callback );

DRV_G3_MACRT_TxRequest(myAppObj.myHandle, myAppObj.pData, myAppObj.dataLength);

Remarks

None.