슬라이드 제목 없음 - tizentizen... · 2015. 6. 24. · sw design principles gyroscope...
TRANSCRIPT
11
Spring 2015
Soo Dong Kim, Ph.D.Professor, Department of Computer Science
Software Engineering Laboratory
Soongsil UniversityOffice 02-820-0909 Mobile [email protected] http://soft.ssu.ac.kr
Tizen Sensors(Tizen Ver. 2.3)
22
Unit 6-1.
Sensors of Tizen Ver. 2.3 Specification
3© 2015 Soo Dong KimSW Design Principles
Sensor List of Tizen Ver. 2.3 Accelerometer Sensor
Gravity Sensor
Linear Accelerometer Sensor
Magnetic Sensor
Rotation Vector Sensor
Orientation Sensor
Gyroscope Sensor
Light Sensor
Proximity Sensor
Pressure Sensor
Ultraviolet Sensor
Temperature Sensor
Humidity Sensor
GPS Sensor
4© 2015 Soo Dong KimSW Design Principles
Accelerometer Sensor Functionality
To measure the device's accelerometer vector in 3 axes relative to its body frame
Contexts Acquired
Measurement Type Range Unit
X Float Min value = -19.6Max value = 19.6
m/s2
Y Float Min value = -19.6Max value = 19.6
m/s2
Z Float Min value = -19.6Max value = 19.6
m/s2
5© 2015 Soo Dong KimSW Design Principles
Gravity Sensor Functionality
To measure the vector components of gravity when the device is at rest or moving slowly
Contexts Acquired
Measurement Type Range Unit
X Float Min value = -19.6Max value = 19.6
m/s2
Y Float Min value = -19.6Max value = 19.6
m/s2
Z Float Min value = -19.6Max value = 19.6
m/s2
6© 2015 Soo Dong KimSW Design Principles
Linear Accelerometer Sensor Functionality
To measure user-driven changes in velocity without considering the gravity value
Contexts Acquired
Measurement Type Range Unit
X Float Min value = -19.6Max value = 19.6
m/s2
Y Float Min value = -19.6Max value = 19.6
m/s2
Z Float Min value = -19.6Max value = 19.6
m/s2
7© 2015 Soo Dong KimSW Design Principles
Magnetic Sensor Functionality
To measure magnetic field strength and fluctuations, and splits the measurement into X, Y, and Z components
Contexts Acquired
Measurement Type Unit
X Float μT (micro Tesla)
Y Float μT (micro Tesla)
Z Float μT (micro Tesla)
8© 2015 Soo Dong KimSW Design Principles
Rotation Vector Sensor Functionality
To represents the orientation of the device as a combination of an angle and an axis
Contexts Acquired
Measurement Type Range
X Float Min value = -1Max value = 1
Y Float Min value = -1Max value = 1
Z Float Min value = -1Max value = 1
W Float Min value = -1Max value = 1
9© 2015 Soo Dong KimSW Design Principles
Orientation Sensor Functionality
To combines the 3-axis accelerometer sensor and 3-axis magnetic sensor to determine the angular positions
Contexts Acquired
Measurement Type Range Unit
Azimuth Float Min value = 0Max value = 360
Degrees (°)
Pitch Float Min value = -180Max value = 180
Degrees (°)
Roll Float Min value = -180Max value = 180
Degrees (°)
10© 2015 Soo Dong KimSW Design Principles
Gyroscope Sensor Functionality
To detect angular velocity, which is calculated using the measurement data retrieved from a 3-axis gyroscope
Contexts Acquired
Measurement Type Range Unit
X Float Min value = -573.0Max value = 573.0
Degrees/s (°/s)
Y Float Min value = -573.0Max value = 573.0
Degrees/s (°/s)
Z Float Min value = -573.0Max value = 573.0
Degrees/s (°/s)
11© 2015 Soo Dong KimSW Design Principles
Light Sensor Functionality
To detect the brightness of ambient light
Contexts Acquired
Measurement Type Range Unit
Level Float Min value = 0Max value = 45875
Lux
12© 2015 Soo Dong KimSW Design Principles
Proximity Sensor Functionality
To detect the presence of nearby objects
Contexts Acquired
Measurement Type Range Unit
Proximity Float - -
13© 2015 Soo Dong KimSW Design Principles
Pressure Sensor Functionality
To measure pressure, typically the pressure of gases or liquids
Contexts Acquired
Measurement Type Range Unit
Pressure Float Min value = 260Max value = 1260
hPa
14© 2015 Soo Dong KimSW Design Principles
Ultraviolet Sensor Functionality
To measure the ultraviolet index
Contexts Acquired
Measurement Type Range Unit
UV Index Float Min value = 0Max value = 15
uv index
15© 2015 Soo Dong KimSW Design Principles
Temperature Sensor Functionality
To measure the temperature, just like a thermometer.
Contexts Acquired
Measurement Type Range Unit
Temperature Float Min value = -30Max value = 100
℃
16© 2015 Soo Dong KimSW Design Principles
Humidity Sensor Functionality
To measure Humidity
Contexts Acquired
Measurement Type Range Unit
Humidity Float Min value = 0Max value = 100
%
17© 2015 Soo Dong KimSW Design Principles
GPS Sensor Functionality
To retrieve the current location of the device user
Context Acquired
Measurement Type
Latitude double
Longitude double
1818
Unit 6-2. Sensors of Tizen Devices
19© 2015 Soo Dong KimSW Design Principles
List of Sensors in Samsung Z1 Accelerometer Sensor
GPS Sensor
20© 2015 Soo Dong KimSW Design Principles
Accelerometer Sensor (1) Required Header File
sensor.h
sensor_create_listener ()
To create a sensor listener
Parameters
Return 0 on success, otherwise a negative error value
Type Name Description
sensor_h sensor The sensor handle
sensor_listener_h* listener The new listener handle
21© 2015 Soo Dong KimSW Design Principles
Accelerometer Sensor (2) sensor_listener_set_event_cb ()
To register a callback function to be invoked when a sensor event occurs
Parameters
Return 0 on success, otherwise a negative error value
Type Name Description
sensor_listener_h listener The sensor handle
unsigned int interval_ms The interval at which sensor events are delivered
sensor_event_cb callback The callback function to register
void* data The user data to be passed to the callback function
22© 2015 Soo Dong KimSW Design Principles
Accelerometer Sensor (3) sensor_listener_start ()
To start the sensor server for the given listener
Parameter
Return 0 on success, otherwise a negative error value
Type Name Description
sensor_listener_h listener The listener handle
23© 2015 Soo Dong KimSW Design Principles
Accelerometer Sensor (4) Code Examples
To define a callback function for the accelerometer sensor
To register the callback function and start a sensor listenersensor_h sensor;sensor_listener_h listener;
sensor_get_default_sensor(SENSOR_ACCELEROMETER, &sensor); sensor_create_listener (sensor, &listener); // Creates a sensor listenersensor_listener_set_event_cb( // Registers the callback function
listener, 100, on_sensor_event, user_data);sensor_listener_start(listener); // Starts sensing
void on_sensor_event(sensor_h sensor, sensor_event_s *event, void *user_data){
sensor_type_e type;sensor_get_type(sensor, &type);switch (type) {
case SENSOR_ACCELEROMETER:// Codes go here.
}}
24© 2015 Soo Dong KimSW Design Principles
GPS Sensor (1) Required Header File
locations.h
location_manager_create()
To create a new location manager
Parameters
Return 0 on success otherwise a negative error value
Type Name Description
location_method_e method The location method
location_manager.h* manager The new location manager handle
25© 2015 Soo Dong KimSW Design Principles
GPS Sensor (2) location_manager_set_position_updated_cb ()
To register a callback function to be invoked at defined interval with updated position information
Parameters
Return 0 on success, otherwise a negative error value
Type Name Description
location_manager_h manager The location manager handle
location_position_updated_cb callback The callback function to register
int interval The interval [1 ~ 120] (seconds)
void* user_data The user data to be passed to the callback function
26© 2015 Soo Dong KimSW Design Principles
GPS Sensor (3) location_manager_start ()
To start the location service
Parameter
Return 0 on success, otherwise a negative error value
Type Name Description
location_manager_h manager The location manager handle
27© 2015 Soo Dong KimSW Design Principles
GPS Sensor (4) Code Examples
To define a callback function the GPS sensor
To register the callback function and start a sensor listenerlocation_manager_h manager;
// Creates a location managerlocation_manager_create(LOCATIONS_METHOD_GPS, &manager);// Registers a callback function to the managerlocation_manager_set_service_state_changed_cb(manager, _state_changed_cb, NULL);// Starts the managerlocation_manager_start(manager);
static void _state_changed_cb(location_service_state_e state, void *user_data){
double latitude, longitude;time_t timestamp;
if (state == LOCATIONS_SERVICE_ENABLED) {
// Codes go here.}
}
28© 2015 Soo Dong KimSW Design Principles
Thank You !