Resources | developer.brewmp.com Resources | developer.brewmp.com

Developer

resources

Backlight code, part 4

Part 4 demonstrates how the IBacklight interface was implemented. It demonstrates how the AEEBacklight_GetBacklightInfo() function obtains backlight information.

This part of the backlight code sample demonstrates a function that obtains backlight information.

/**************************************************************************

  This part demonstrates a function that obtains backlight information.

***************************************************************************

Function: AEEBacklight_GetBacklightInfo

Description:
   Returns information about the current state of the backlight.
 
***************************************************************************/

static int AEEBacklight_GetBacklightInfo(IBacklight *pme, AEEBacklightInfo * pBacklightInfo)
{
   int nErr;
   disp_info_type disp_info;
   FARF(BACKLIGHT, ("==>  AEEBacklight_GetBacklightInfo"));

   if(NULL == pBacklightInfo)
   {
      return EBADPARM;
   }

   switch (pme->uCls)
   {
      case AEECLSID_BACKLIGHT_DISPLAY1:
         disp_info = disp_get_info();
         nErr = SUCCESS;
         break;

   #ifdef FEATURE_BACKLIGHT_DISPLAY2
      case AEECLSID_BACKLIGHT_DISPLAY2:
         disp_info = disp_get_info2();
         nErr = SUCCESS;
         break;
   #endif

      default:
         nErr = EUNSUPPORTED;
         break;
   }

   if(SUCCESS == nErr)
   {
      pBacklightInfo->dwBacklightColor = disp_info.contrast_default;
      pBacklightInfo->dwDefaultBrightnessLevel = disp_info.backlight_default;
      pBacklightInfo->dwMaxBrightnessLevel = disp_info.backlight_max;
      pBacklightInfo->dwMinBrightnessLevel = disp_info.backlight_min;
   }

   return nErr;
}