Ignore:
Timestamp:
Sep 27, 2001, 10:29:02 PM (24 years ago)
Author:
umoeller
Message:

Misc changes.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/helpers/apmh.c

    r93 r105  
    158158 *      After this, the status fields in APM
    159159 *      are valid (if NO_ERROR is returned).
    160  */
    161 
    162 APIRET apmhReadStatus(PAPM pApm)        // in: APM structure created by apmhOpen
    163 {
    164     APIRET arc = NO_ERROR;
     160 *      If the values changed since the previous
     161 *      call, *pfChanged is set to TRUE; FALSE
     162 *      otherwise.
     163 */
     164
     165APIRET apmhReadStatus(PAPM pApm,        // in: APM structure created by apmhOpen
     166                      PBOOL pfChanged)  // out: values changed (ptr can be NULL)
     167{
     168    APIRET  arc = NO_ERROR;
     169    BOOL    fChanged = FALSE;
    165170
    166171    if ((pApm) && (pApm->hfAPMSys))
     
    174179                              PowerStatus.ParmLength)))
    175180        {
    176             pApm->ulBatteryStatus = PowerStatus.BatteryStatus;
    177             pApm->ulBatteryLife = PowerStatus.BatteryLife;
     181            if (    (pApm->fAlreadyRead)
     182                 || (pApm->ulBatteryStatus != PowerStatus.BatteryStatus)
     183                 || (pApm->ulBatteryLife != PowerStatus.BatteryLife)
     184               )
     185            {
     186                pApm->ulBatteryStatus = PowerStatus.BatteryStatus;
     187                pApm->ulBatteryLife = PowerStatus.BatteryLife;
     188
     189                pApm->fAlreadyRead = FALSE;
     190                fChanged = TRUE;
     191            }
    178192        }
     193
     194        if (pfChanged)
     195            *pfChanged = fChanged;
    179196    }
    180197    else
Note: See TracChangeset for help on using the changeset viewer.