I am working on PhoneSensors and started from the Sensor sample.
I have tried to add new sensor types to the existing list but I get a compilation error on most of the new sensors I've added:
This is my code:
The last five calls to AddSensor all give the same kind of error... :-(
Then I have tried to use numeric constants instead of labels (e.g. 9 instead of ps.TYPE_GRAVITY) and that finally works.
So my suspect is that many sensor types are not defined with labels in the library.
To demonstrate this assumption I've noticed that code prediction for the ps object provides a list of labels which is limited to the sensors used by the default sample code (see screenshot).
Thanks for helping understand or solve the issue.
Regards
Andrea
I have tried to add new sensor types to the existing list but I get a compilation error on most of the new sensors I've added:
Error description: Unknown member: type_gravity
Occurred on line: 35
AddSensor(ps.TYPE_GRAVITY, "GRAVITY", True)
This is my code:
Sub Activity_Create(FirstTime As Boolean)
If FirstTime Then
SensorsMap.Initialize
Dim ps As PhoneSensors 'This object is only used to access the type constants.
AddSensor(ps.TYPE_ACCELEROMETER, "ACCELEROMETER", True)
AddSensor(ps.TYPE_GYROSCOPE, "GYROSCOPE", True)
AddSensor(ps.TYPE_LIGHT, "LIGHT", False)
AddSensor(ps.TYPE_MAGNETIC_FIELD, "MAGNETIC", True)
AddSensor(ps.TYPE_ORIENTATION, "ORIENTATION", True)
AddSensor(ps.TYPE_PRESSURE, "PRESSURE", False)
AddSensor(ps.TYPE_PROXIMITY, "PROXIMITY", False)
AddSensor(ps.TYPE_TEMPERATURE, "TEMPERATURE", False)
AddSensor(ps.TYPE_GRAVITY, "GRAVITY", True)
AddSensor(ps.TYPE_LINEAR_ACCELERATION, "LINEAR ACCELERATION", False)
AddSensor(ps.TYPE_RELATIVE_HUMIDITY, "RELATIVE HUMIDITY", False)
AddSensor(ps.TYPE_ROTATION_VECTOR, "ROTATION VECTOR", True)
AddSensor(ps.TYPE_AMBIENT_TEMPERATURE, "AMBIENT TEMPERATURE", False)
End If
The last five calls to AddSensor all give the same kind of error... :-(
Then I have tried to use numeric constants instead of labels (e.g. 9 instead of ps.TYPE_GRAVITY) and that finally works.
So my suspect is that many sensor types are not defined with labels in the library.
To demonstrate this assumption I've noticed that code prediction for the ps object provides a list of labels which is limited to the sensors used by the default sample code (see screenshot).
Thanks for helping understand or solve the issue.
Regards
Andrea