Closed Bug 754199 Opened 12 years ago Closed 6 years ago

Support Ambient light sensor for Windows 7

Categories

(Core :: Hardware Abstraction Layer (HAL), defect)

All
Windows 7
defect
Not set
normal

Tracking

()

RESOLVED WONTFIX

People

(Reporter: m_kato, Assigned: m_kato)

References

Details

Attachments

(1 file)

I have the PC that has ambient light sensor...  We can get it using Sensor API (from Windows 7 or later).
Attached patch fixSplinter Review
Attachment #623602 - Flags: review?(doug.turner)
Comment on attachment 623602 [details] [diff] [review]
fix

Review of attachment 623602 [details] [diff] [review]:
-----------------------------------------------------------------

Looks fine.  Let me know about the filter.  Fix the other two nits if you like.

::: hal/windows/WindowsSensor.cpp
@@ +118,5 @@
> +    HRESULT hr;
> +    InfallibleTArray<float> values;
> +
> +    // Illuminance level, in lux
> +    hr = aReport->GetSensorValue(SENSOR_DATA_TYPE_LIGHT_LEVEL_LUX, &v);

do you know why they are running a filter over the sensor data in this example:

  http://msdn.microsoft.com/en-us/library/windows/desktop/dd318933%28v=vs.85%29.aspx

@@ +140,5 @@
>  {
> +  // Currently implementation is acceleration and ambient light only.
> +  if ((aSensor == SENSOR_ACCELERATION && sAccelerometer) ||
> +      (aSensor == SENSOR_LIGHT && sLight) ||
> +      (aSensor != SENSOR_ACCELERATION && aSensor != SENSOR_LIGHT)) {

This if statement is kind of hard to follow.  I would have two statements - one that just tests if we aren't SENSOR_ACCELERATION or SENSOR_LIGHT.  Have that return early.  

if (aSensor != SENSOR_LIGHT || aSensor != SENSOR_ACCELERATION) {
  return;
}

if ((aSensor == SENSOR_ACCELERATION && !sAccelerometer) ||
    (aSensor == SENSOR_LIGHT && !sLight)  {
...


Up to you.

@@ +194,5 @@
> +                                   getter_AddRefs(values)))) {
> +      if (SUCCEEDED(values->SetUnsignedIntegerValue(
> +                      SENSOR_PROPERTY_CURRENT_REPORT_INTERVAL,
> +                      DEFAULT_SENSOR_POLL))) {
> +        nsRefPtr<IPortableDeviceValues> returns;

While we are here, lets rename returns to result.
Attachment #623602 - Flags: review?(doug.turner) → review+
What happened to this patch? Are you still working on it, Makoto?
ah, I forget this bug.  I will rebase.
Hi Makoto,
again one year over -> patch will come in next time?
Flags: needinfo?(m_kato)
(In reply to Stefan Weiss [:sir_none] from comment #5)
> Hi Makoto,
> again one year over -> patch will come in next time?

I will work this next week
Flags: needinfo?(m_kato)
Depends on: 1359076
This feature will be turned off, so I mark as wontfix.
Status: NEW → RESOLVED
Closed: 6 years ago
Resolution: --- → WONTFIX
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: