PropVariantInit(&lightLevel); // Get the sensor reading from the ISensorDataReport object pNewData->GetSensorValue( SENSOR_DATA_TYPE_LIGHT_LEVEL_LUX, &lightLevel); // Extract the float value from the PROPVARIANT object luxValue = lightLevel.fltVal; // Normalize the light sensor data double lightNormalized = ::log10(luxValue) / 5.0; // Handle UI changes on the normalized lux data // which ranges from 0.0 - 1.0 for a lux range of // 0 lux to 100,000 lux, this method represents such a // handler that would be implemented in your application UpdateUI(lightNormalized); PropVariantClear(&lightLevel); return S_OK; } Light Sensor Data Types Three common light sensor data types may be exposed by typical ambient light sensors. These sensor data types for ambient light sensors are based on the definitions in the ACPI 3.0b specification for ambient light sensors (section 9.2). The following is a brief overview of the common light sensor data types, and how they are defined in the Windows 7 sensor platform. Illuminance Illuminance is a measure of the overall magnitude of the ambient light level. The units for illuminance are lux. The sensor platform definition for illuminance is: SENSOR_DATA_TYPE_LIGHT_LEVEL_LUX Color Temperature Color temperature is a measure of the warmth or coolness of light. Color temperature corresponds to the color of light given off by a black body radiator heated to a particular temperature. The corresponding units for color temperature are degrees Kelvin. The sensor platform definition for color temperature is: SENSOR_DATA_TYPE_LIGHT_TEMPERATURE_KELVIN Chromacity (also known as Chromaticity) Chromacity is a spectral characteristic of light based on a 2D coordinate system (CIE Yxy color model). For more information about chromacity, see the ACPI specification. The sensor platform definition for chromacity is: SENSOR_DATA_TYPE_LIGHT_CHROMACITY
PropVariantInit(&lightLevel); // Get the sensor reading from the ISensorDataReport object pNewData->GetSensorValue( SENSOR_DATA_TYPE_LIGHT_LEVEL_LUX, &lightLevel); // Extract the float value from the PROPVARIANT object luxValue = lightLevel.fltVal; // Normalize the light sensor data double lightNormalized = ::log10(luxValue) / 5.0; // Handle UI changes on the normalized lux data // which ranges from 0.0 - 1.0 for a lux range of // 0 lux to 100,000 lux, this method represents such a // handler that would be implemented in your application UpdateUI(lightNormalized); PropVariantClear(&lightLevel); return S_OK; } Light Sensor Data Types Three common light sensor data types may be exposed by typical ambient light sensors. These sensor data types for ambient light sensors are based on the definitions in the ACPI 3.0b specification for ambient light sensors (section 9.2). The following is a brief overview of the common light sensor data types, and how they are defined in the Windows 7 sensor platform. Illuminance Illuminance is a measure of the overall magnitude of the ambient light level. The units for illuminance are lux. The sensor platform definition for illuminance is: SENSOR_DATA_TYPE_LIGHT_LEVEL_LUX Color Temperature Color temperature is a measure of the warmth or coolness of light. Color temperature corresponds to the color of light given off by a black body radiator heated to a particular temperature. The corresponding units for color temperature are degrees Kelvin. The sensor platform definition for color temperature is: SENSOR_DATA_TYPE_LIGHT_TEMPERATURE_KELVIN Chromacity (also known as Chromaticity) Chromacity is a spectral characteristic of light based on a 2D coordinate system (CIE Yxy color model). For more information about chromacity, see the ACPI specification. The sensor platform definition for chromacity is: SENSOR_DATA_TYPE_LIGHT_CHROMACITY
Implementing_Light_Aware_UI.docx