-
Notifications
You must be signed in to change notification settings - Fork 2
Open
Description
Test program, tested on a Google Nexus 6 with Android 5.1.1:
getsensor = dy_import_module("getsensor.r2py")
# Try the sensor calls that require that `start_sensing`
# has already been called
for sensor_function in [getsensor.get_magnetic_field,
getsensor.get_acceleration, getsensor.get_light]:
try:
log(sensor_function(), "\n")
except Exception, e:
log(repr(sensor_function), "failed with", repr(e), "\n")Problem: get_magnetic_field and get_acceleration request a sensor value before starting the sensor.
(get_light does too, but this doesn't seem to be a problem.)
Log:
========================================
Running program: dylink.r2py
Arguments: ['sensorfails.r2py']
========================================
Using port 63104 to get sensor data.
Something went wrong!
<function get_magnetic_field at 0xb5daecb0> failed with SensorException(u"java.lang.NullPointerException: Null pointer exception during instruction 'monitor-enter v1'",)
Something went wrong!
<function get_acceleration at 0xb5daec70> failed with SensorException(u"java.lang.NullPointerException: Null pointer exception during instruction 'monitor-enter v1'",)
None
Possible solution: Implement a state machine around start_sensing, stop_sensing that ensures that the sensors queried are already set up to return data.
Metadata
Metadata
Assignees
Labels
No labels