Jump to main content

# 1.1.2.4.10 DRV_G3_MACRT_DataIndCallbackRegister Function

## C

    void DRV_G3_MACRT_DataIndCallbackRegister (
        const DRV_HANDLE handle,
        const DRV_G3_MACRT_DATA_IND_CALLBACK callback
    );

## Summary

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

## Description

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

Before this callback is set, any received frame by the PLC transceiver will not be notified. 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

Param | Description
--- | ---
handle | A valid instance handle, returned from the driver's open routine.
callback | Pointer to the callback function.

## Returns

None.

## Example

    // Event is received when a frame is received
    void APP_PLC_Data_Ind_callback(uint8_t *pData, uint16_t length)
    {
        // Reception handling here.
        if (length)
        {
            memcpy(myAppObj->pDataRcv, pData, length);
            myAppObj->lengthDataRcv = length;
        }
    }

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

    // Client registers a data indication callback with driver. This is done once
    // 'myHandle', returned from DRV_G3_MACRT_Open previously called
    DRV_G3_MACRT_DataIndCallbackRegister( myAppObj.myHandle, APP_PLC_Data_Ind_callback );

## Remarks

None.

Rev: G