The default bug view has changed. See this FAQ.

Support Ambient light sensor for Windows 7

NEW
Assigned to

Status

()

Core
Hardware Abstraction Layer (HAL)
5 years ago
3 years ago

People

(Reporter: m_kato, Assigned: m_kato)

Tracking

({dev-doc-needed})

Trunk
All
Windows 7
dev-doc-needed
Points:
---

Firefox Tracking Flags

(Not tracked)

Details

Attachments

(1 attachment)

(Assignee)

Description

5 years ago
I have the PC that has ambient light sensor...  We can get it using Sensor API (from Windows 7 or later).
(Assignee)

Comment 1

5 years ago
Created attachment 623602 [details] [diff] [review]
fix
(Assignee)

Updated

5 years ago
Attachment #623602 - Flags: review?(doug.turner)

Comment 2

5 years ago
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?
(Assignee)

Comment 4

4 years ago
ah, I forget this bug.  I will rebase.
Hi Makoto,
again one year over -> patch will come in next time?
Flags: needinfo?(m_kato)
Keywords: dev-doc-needed
(Assignee)

Comment 6

3 years ago
(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)
You need to log in before you can comment on or make changes to this bug.