Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unallowed type error when calling get_light() #11

Open
yyzhuang opened this issue Aug 3, 2017 · 8 comments
Open

Unallowed type error when calling get_light() #11

yyzhuang opened this issue Aug 3, 2017 · 8 comments
Labels

Comments

@yyzhuang
Copy link

yyzhuang commented Aug 3, 2017

@bjboyd02 discovered an error when he called get_light():

“6.16102536201 get_light () Internal Error
-- -
Uncaught exception!
-- -
Following is a full traceback, and a user traceback.
The user traceback excludes non-user modules.
The most recent call is displayed last.
Full debugging traceback:
"/data/data/com.sensibility_testbed/files/seattle/seat
tle_repy/repyV2/namespace.py", line 1452, in
wrapped_function

"/data/data/com.sensibility_testbed/files/seattle/seat
tle_repy/repyV2/namespace.py", line 1375, in
_process_retval
User traceback:
Exception(with.class'exception_hierarchy.Internal
RepyError'): Function 'pick2_wrapped_function'
returned with unallowed return type <type 'float&'> :
Invalid retval type: Invalid type <type 'float'>
-- -“
@yyzhuang yyzhuang added the bug label Aug 3, 2017
@aaaaalbert
Copy link

This is interesting --- no other device we tested returned a float for the light sensor yet, see our devices/sensors list.

What device was this, and what Android version does it run?

@bjboyd02
Copy link

bjboyd02 commented Aug 7, 2017 via email

@aaaaalbert
Copy link

Thanks a bunch, perhaps the 7.1.2 API allows for floats now.

@JustinCappos
Copy link

JustinCappos commented Aug 7, 2017 via email

@yyzhuang
Copy link
Author

yyzhuang commented Aug 8, 2017

Currently Android 7.x has about 11% of the market https://developer.android.com/about/dashboards/index.html If we choose option 1, nearly 90% of devices will be affected.

Would there be an intermediate solution?

@aaaaalbert
Copy link

Funnily enough, I didn't find a reference in the Android docs for any change in Android 7's light sensor function.

@bjboyd02, you can patch your local RepyV2 install's namespace.py to allow get_light to return a float value. (Be sure to patch the file in seattle_repy and the repyV2 subdir.)

@SantiagoTorres
Copy link

Funnily enough, I didn't find a reference in the Android docs for any change in Android 7's light sensor function.

It seems that all sensors return an array of float. I don't know if this was the behavior changed. I think it's been like this since API level 3

@yyzhuang
Copy link
Author

Looks like it's returning a float

  public final void onSensorChanged(SensorEvent event) {
    // The light sensor returns a single value.
    // Many sensors return 3 values, one for each axis.
    float lux = event.values[0];
    // Do something with this sensor value.
  }

Our interface doesn't say int or float, but looks like it's expecting an int.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

5 participants