Example #1
0
/*******************************************************************************
  Function:	
    void WF_PsPollEnable(bool rxDtim,  bool aggressive)

  Summary:
    Enables PS Poll mode.

  Description:
    Enables PS Poll mode.  PS-Poll (Power-Save Poll) is a mode allowing for 
    longer battery life.  The MRF24W coordinates with the Access Point to go 
    to sleep and wake up at periodic intervals to check for data messages, which 
    the Access Point will buffer.  The listenInterval in the Connection 
    Algorithm defines the sleep interval.  By default, PS-Poll mode is disabled.

    When PS Poll is enabled, the WF Host Driver will automatically force the 
    MRF24W to wake up each time the Host sends Tx data or a control message 
    to the MRF24W.  When the Host message transaction is complete the 
    MRF24W driver will automatically re-enable PS Poll mode.

    When the application is likely to experience a high volume of data traffic 
    then PS-Poll mode should be disabled for two reasons:
    1. No power savings will be realized in the presence of heavy data traffic.
    2. Performance will be impacted adversely as the WiFi Host Driver 
        continually activates and deactivates PS-Poll mode via SPI messages.

  Precondition:
  	MACInit must be called first.

  Parameters:
    rxDtim - true if MRF24W should wake up periodically and check for
             buffered broadcast messages, else false

  Returns:
  	None.
  	
  Remarks:
  	None.
  *****************************************************************************/
void WF_PsPollEnable(bool rxDtim, bool aggressive)
{
    tWFPwrModeReq   pwrModeReq;
    
    if (isWiFiVer1209OrLater() && !WFisConnected())
    {
        // save caller parameters for later, when we can enable this mode    
        g_rxDtim = rxDtim;
        g_aggressivePs = aggressive;
        SetAppPowerSaveMode(true);        
        return;
    }    

    /* fill in request structure and send message to MRF24W */
    pwrModeReq.mode     = PS_POLL_ENABLED;
    pwrModeReq.wake     = 0;
    pwrModeReq.rcvDtims = rxDtim;
	pwrModeReq.reserved = aggressive;
    SendPowerModeMsg(&pwrModeReq);
    
    if (rxDtim == true)
    {
        SetPowerSaveState(WF_PS_PS_POLL_DTIM_ENABLED);
    }    
    else
    {
        SetPowerSaveState(WF_PS_PS_POLL_DTIM_DISABLED);
    }    
    
    WFConfigureLowPowerMode(WF_LOW_POWER_MODE_ON);
    SetAppPowerSaveMode(true);
    
}
Example #2
0
/*******************************************************************************
  Function:
    void WF_PsPollEnable(t_psPollContext *p_context)

  Summary:
    Enables PS Poll mode.

  Description:
    Enables PS Poll mode.  PS-Poll (Power-Save Poll) is a mode allowing for
    longer battery life.  The MRF24W coordinates with the Access Point to go
    to sleep and wake up at periodic intervals to check for data messages, which
    the Access Point will buffer.  The listenInterval in the Connection
    Algorithm defines the sleep interval.  By default, PS-Poll mode is disabled.

    When PS Poll is enabled, the WF Host Driver will automatically force the
    MRF24W to wake up each time the Host sends Tx data or a control message
    to the MRF24W.  When the Host message transaction is complete the
    MRF24W driver will automatically re-enable PS Poll mode.

    When the application is likely to experience a high volume of data traffic
    then PS-Poll mode should be disabled for two reasons:
    1. No power savings will be realized in the presence of heavy data traffic.
    2. Performance will be impacted adversely as the WiFi Host Driver
        continually activates and deactivates PS-Poll mode via SPI messages.

  Precondition:
    MACInit must be called first.

  Parameters:
    p_context -  pointer to ps poll context

  Returns:
    None.

  Remarks:
    None.
  *****************************************************************************/
void WF_PsPollEnable(t_psPollContext *p_context)
{
    t_WFPwrModeReq   pwrModeReq;

    // if not currently connected then return
    if(UdGetConnectionState() != CS_CONNECTED)
    {
        EventEnqueue(WF_EVENT_ERROR, UD_INVALID_PS_POLL_ERROR);
        return;
    }

    // save the Ps-Poll context
    UdEnablePsPoll(p_context);

    SetListenInterval(p_context->listenInterval);
    SetDtimInterval(p_context->dtimInterval);

    // fill in request structure and send message to MRF24WG
    pwrModeReq.mode     = PS_POLL_ENABLED;
    pwrModeReq.wake     = 0;
    pwrModeReq.rcvDtims = p_context->useDtim;
    SendPowerModeMsg(&pwrModeReq);

    WFConfigureLowPowerMode(WF_LOW_POWER_MODE_ON);

    if (p_context->useDtim)
    {
        PowerStateSet(WF_PS_PS_POLL_DTIM_ENABLED);
    }
    else
    {
        PowerStateSet(WF_PS_PS_POLL_DTIM_DISABLED);
    }
}
/*******************************************************************************
  Function:	
    void WF_PsPollDisable(void)

  Summary:
    Disables PS-Poll mode.

  Description:
    Disables PS Poll mode.  The MRF24WB0M will stay active and not go sleep.

  Precondition:
  	MACInit must be called first.

  Parameters:
    None.

  Returns:
  	None.
  	
  Remarks:
  	None.
  *****************************************************************************/
void WF_PsPollDisable(void)
{
   tWFPwrModeReq   pwrModeReq;
    
    pwrModeReq.mode     = PS_POLL_DISABLED;
    pwrModeReq.wake     = 1;
    pwrModeReq.rcvDtims = 1;
    SendPowerModeMsg(&pwrModeReq);

    SetPowerSaveState(WF_PS_OFF);
    WFConfigureLowPowerMode(WF_LOW_POWER_MODE_OFF);    
}   
Example #4
0
/*******************************************************************************
  Function:
    void DRV_WIFI_PsPollDisable(void)

  Summary:
    Disables PS-Poll mode.

  Description:
    Disables PS Poll mode.  The MRF24W will stay active and not go sleep.

  Parameters:
    None.

  Returns:
    None.

  Remarks:
    None.
*******************************************************************************/
void DRV_WIFI_PsPollDisable(void)
{
    t_wfPwrModeReq   pwrModeReq;

    pwrModeReq.mode     = PS_POLL_DISABLED;
    pwrModeReq.wake     = 1;
    pwrModeReq.rcvDtims = 1;
    SendPowerModeMsg(&pwrModeReq);

    SetPowerSaveState(DRV_WIFI_PS_OFF);
    WFConfigureLowPowerMode(WF_LOW_POWER_MODE_OFF);
    SetAppPowerSaveMode(false);
}
Example #5
0
/*******************************************************************************
  Function:
    void WF_PsPollDisable(void)

  Summary:
    Disables PS-Poll mode.

  Description:
    Disables PS Poll mode.  The MRF24W will stay active and not go sleep.

  Precondition:
    MACInit must be called first.

  Parameters:
    None.

  Returns:
    None.

  Remarks:
    None.
  *****************************************************************************/
void WF_PsPollDisable(void)
{
    UdDisablePsPoll();

    t_WFPwrModeReq   pwrModeReq;

    pwrModeReq.mode     = PS_POLL_DISABLED;
    pwrModeReq.wake     = 1;
    pwrModeReq.rcvDtims = 1;
    pwrModeReq.reserved = 0;
    SendPowerModeMsg(&pwrModeReq);

    WFConfigureLowPowerMode(WF_LOW_POWER_MODE_OFF);
    PowerStateSet(WF_PS_OFF);
}
/*******************************************************************************
  Function:	
    void WF_PsPollEnable(BOOL rxDtim)

  Summary:
    Enables PS Poll mode.

  Description:
    Enables PS Poll mode.  PS-Poll (Power-Save Poll) is a mode allowing for 
    longer battery life.  The MRF24WB0M coordinates with the Access Point to go 
    to sleep and wake up at periodic intervals to check for data messages, which 
    the Access Point will buffer.  The listenInterval in the Connection 
    Algorithm defines the sleep interval.  By default, PS-Poll mode is disabled.

    When PS Poll is enabled, the WF Host Driver will automatically force the 
    MRF24WB0M to wake up each time the Host sends Tx data or a control message 
    to the MRF24WB0M.  When the Host message transaction is complete the 
    MRF24WB0M driver will automatically re-enable PS Poll mode.

    When the application is likely to experience a high volume of data traffic 
    then PS-Poll mode should be disabled for two reasons:
    1. No power savings will be realized in the presence of heavy data traffic.
    2. Performance will be impacted adversely as the WiFi Host Driver 
        continually activates and deactivates PS-Poll mode via SPI messages.

  Precondition:
  	MACInit must be called first.

  Parameters:
    rxDtim -- TRUE if MRF24WB0M should wake up periodically and check for
              buffered broadcast messages, else FALSE

  Returns:
  	None.
  	
  Remarks:
  	None.
  *****************************************************************************/
void WF_PsPollEnable(BOOL rxDtim)
{
    tWFPwrModeReq   pwrModeReq;
    
    /* fill in request structure and send message to MRF24WB0M */
    pwrModeReq.mode     = PS_POLL_ENABLED;
    pwrModeReq.wake     = 0;
    pwrModeReq.rcvDtims = rxDtim;
    SendPowerModeMsg(&pwrModeReq);
    
    if (rxDtim == TRUE)
    {
        SetPowerSaveState(WF_PS_PS_POLL_DTIM_ENABLED);
    }    
    else
    {
        SetPowerSaveState(WF_PS_PS_POLL_DTIM_DISABLED);
    }    
    
    WFConfigureLowPowerMode(WF_LOW_POWER_MODE_ON);
}
/*******************************************************************************
  Function:    
    void WF_PsPollEnable(BOOL rxDtim,  BOOL aggressive)

  Summary:
    Enables PS Poll mode.

  Description:
    Enables PS Poll mode.  PS-Poll (Power-Save Poll) is a mode allowing for 
    longer battery life.  The MRF24W coordinates with the Access Point to go 
    to sleep and wake up at periodic intervals to check for data messages, which 
    the Access Point will buffer.  The listenInterval in the Connection 
    Algorithm defines the sleep interval.  By default, PS-Poll mode is disabled.

    When PS Poll is enabled, the WF Host Driver will automatically force the 
    MRF24W to wake up each time the Host sends Tx data or a control message 
    to the MRF24W.  When the Host message transaction is complete the 
    MRF24W driver will automatically re-enable PS Poll mode.

    When the application is likely to experience a high volume of data traffic 
    then PS-Poll mode should be disabled for two reasons:
    1. No power savings will be realized in the presence of heavy data traffic.
    2. Performance will be impacted adversely as the WiFi Host Driver 
        continually activates and deactivates PS-Poll mode via SPI messages.

  Precondition:
    MACInit must be called first.

  Parameters:
    rxDtim -  TRUE listens at the DTIM interval and FALSE listens at the CASetListenInterval

  Returns:
    None.
      
  Remarks:
    None.
  *****************************************************************************/
void WF_PsPollEnable(BOOL rxDtim)
{
    #if defined(__18CXX)
        static tWFPwrModeReq   pwrModeReq;
    #else
        tWFPwrModeReq   pwrModeReq;
    #endif
    
    // if not currently connected
#if !defined(MRF24WG)
    if (gRFModuleVer1209orLater && !WFisConnected())
#else
    if (!WFisConnected())
#endif
    {
        // save caller parameters for later, when we can enable this mode    
        g_rxDtim = rxDtim;
        SetAppPowerSaveMode(TRUE);
        return;
    }    
    
    /* fill in request structure and send message to MRF24W */
    pwrModeReq.mode     = PS_POLL_ENABLED;
    pwrModeReq.wake     = 0;
    pwrModeReq.rcvDtims = rxDtim;
    SendPowerModeMsg(&pwrModeReq);
    
    if (rxDtim == TRUE)
    {
        SetPowerSaveState(WF_PS_PS_POLL_DTIM_ENABLED);
    }    
    else
    {
        SetPowerSaveState(WF_PS_PS_POLL_DTIM_DISABLED);
    }  
      
    WFConfigureLowPowerMode(WF_LOW_POWER_MODE_ON);
    SetAppPowerSaveMode(TRUE);
    
}
Example #8
0
/*******************************************************************************
  Function:
    void DRV_WIFI_PsPollEnable(DRV_WIFI_PS_POLL_CONTEXT *p_context);

  Summary:
    Enables PS Poll mode.

  Description:
    Enables PS Poll mode.  PS-Poll (Power-Save Poll) is a mode allowing for
    longer battery life.  The MRF24W coordinates with the Access Point to go
    to sleep and wake up at periodic intervals to check for data messages, which
    the Access Point will buffer.  The listenInterval in the Connection
    Algorithm defines the sleep interval.  By default, PS-Poll mode is disabled.

    When PS Poll is enabled, the WF Host Driver will automatically force the
    MRF24W to wake up each time the Host sends Tx data or a control message
    to the MRF24W.  When the Host message transaction is complete the
    MRF24W driver will automatically re-enable PS Poll mode.

    When the application is likely to experience a high volume of data traffic
    then PS-Poll mode should be disabled for two reasons:
    1. No power savings will be realized in the presence of heavy data traffic.
    2. Performance will be impacted adversely as the WiFi Host Driver
        continually activates and deactivates PS-Poll mode via SPI messages.

  Parameters:
     p_context -  Pointer to ps poll context.  See DRV_WIFI_PS_POLL_CONTEXT
                  structure.

  Returns:
    None.

  Remarks:
    None.
  *****************************************************************************/
void DRV_WIFI_PsPollEnable(DRV_WIFI_PS_POLL_CONTEXT *p_context)
{
    t_wfPwrModeReq   pwrModeReq;

    // if not currently connected
    if (!WFisConnected())
    {
        // save caller parameters for later, when we can enable this mode
        g_savedPsPollContext.listenInterval = p_context->listenInterval;
        g_savedPsPollContext.dtimInterval   = p_context->dtimInterval;
        g_savedPsPollContext.useDtim        = p_context->useDtim;
        SetAppPowerSaveMode(true);
        return;
    }

    SetListenInterval(p_context->listenInterval);
    SetDtimInterval(p_context->dtimInterval);

    // fill in request structure and send message to MRF24WG
    pwrModeReq.mode     = PS_POLL_ENABLED;
    pwrModeReq.wake     = 0;
    pwrModeReq.rcvDtims = p_context->useDtim;
    SendPowerModeMsg(&pwrModeReq);

    if (p_context->useDtim)
    {
        SetPowerSaveState(DRV_WIFI_PS_PS_POLL_DTIM_ENABLED);
    }
    else
    {
        SetPowerSaveState(DRV_WIFI_PS_PS_POLL_DTIM_DISABLED);
    }

    WFConfigureLowPowerMode(WF_LOW_POWER_MODE_ON);
    SetAppPowerSaveMode(true);
}