Jump to main content

# 1.1.2.4.19 DRV_G3_MACRT_SleepIndCallbackRegister Function

## C

    void DRV_G3_MACRT_SleepIndCallbackRegister (
        const DRV_HANDLE handle,
        const DRV_G3_MACRT_SLEEP_IND_CALLBACK callback
    );

## Summary

Allows a client to set a Sleep mode disable event handling function for the driver to call back when the G3 MAC RT driver is active again.

## Description

This function allows a client to register a PLC Sleep mode disable event handling function for the driver to call back when Sleep mode is disabled and G3 MAC RT driver has been restarted.

The event handler should be set before the client submits a wake-up request using the DRV_G3_MACRT_Sleep function. 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

    void APP_PLC_SleepModeDisableCb( void )
    {
        // Sleep Disable handling here.
    }

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

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

    // Event is received when PLC device comes out of sleep mode and becomes active again.

## Remarks

This function is only available if Sleep mode is enabled in MCC.

Rev: G