Peno sensor

Post on 11-Feb-2017

238 views 1 download

Transcript of Peno sensor

Android Sensor Framework

Yucheng Jin, Sven Charleer, Robin De CroonJoris Klerkx

Augment Human @ HCI 7 October 2015

SensorsHardware devices that measure the physical environment.

• Motion sensorsaccelerometers, gravity sensors, gyroscopes, etc.• Environmental sensorsbarometers, photometers, and thermometers.• Position sensorsGPS, orientation sensors and magnetometers.

Sensor FrameworkAccess sensors and and acquire raw sensor data.Android Sensor Framework includes three classes and one interface.

• SensorManager• Sensor• SensorEvent• SensorEventListener

http://developer.android.com/guide/topics/sensors/sensors_overview.html

• Identifying sensors and sensor capabilities• Monitor sensor events

SensorManager• Methods

Access the device's sensors

mSensorManager = (SensorManager)getSystemService(SENSOR_SERVICE);

mAccelerometer = mSensorManager.getDefaultSensor(Sensor.TYPE_ACCELEROMETER);

Registering and unregistering sensor event listeners

mSensorManager.registerListener(this, mAccelerometer, SensorManager.SENSOR_DELAY_NORMAL);

mSensorManager.unregisterListener(this);

• Constants

Sensor accuracy,

Set data acquisition rates

Calibrate sensors

http://developer.android.com/reference/android/hardware/SensorManager.html

SensorCreate an specific sensor object.

• Methods

Check a sensor's capabilities.

e.g. getStringType ()

• Constants

……

http://developer.android.com/reference/android/hardware/Sensor.html

SensorEventThis class represents a sensor event and holds information

such as the sensor's type, the time-stamp, accuracy and sensor's data.

• Methods

event.sensor.getType()

event.values[]• Constants

……

http://developer.android.com/reference/android/hardware/SensorEvent.html

SensorEventListenerReceiving notifications from the SensorManager when sensor values have changed.

such as the sensor's type, the time-stamp, accuracy and sensor's data.

• Methods

http://developer.android.com/reference/android/hardware/SensorEventListener.html

PracticeModify the app and show the actual values of listed sensors on your device.http://www.tutorialspoint.com/android/android_sensors.htmhttp://developer.android.com/guide/topics/sensors/sensors_overview.html

Thanks & Questions?