1 51 Tizen v 2 3 System App

  • Slides: 51
Download presentation
1 51 Tizen v 2. 3 System & App Framework Embedded Software Lab. @

1 51 Tizen v 2. 3 System & App Framework Embedded Software Lab. @ SKKU

Contents 2 51 • Overview – System & App FW – What is Ecore?

Contents 2 51 • Overview – System & App FW – What is Ecore? • System Framework – – Overview Deviced Inter-process Communication Sensor Framework • App Framework – – – Overview Appcore AUL App Service Package Manager, AIL, RUA Embedded Software Lab. @ SKKU

Overview 3 51 • System Framework – System managements and Device Abstractions • System

Overview 3 51 • System Framework – System managements and Device Abstractions • System condition management Low memory, Low battery, process, CPU frequency handling • Device abstraction and control display, mmc, earjack, GPS, haptic, etc. – System logging dlog – Sensor management sensor server and client library • App Framework – – Application main loop Inter-app communication and launching Application Install & Uninstall System event callback Embedded Software Lab. @ SKKU

4 51 System Framework Embedded Software Lab. @ SKKU

4 51 System Framework Embedded Software Lab. @ SKKU

System FW Overview 5 51 Embedded Software Lab. @ SKKU

System FW Overview 5 51 Embedded Software Lab. @ SKKU

Deviced Architecture 6 51 Embedded Software Lab. @ SKKU

Deviced Architecture 6 51 Embedded Software Lab. @ SKKU

Deviced (framework/system/deviced/core) 7 51 • System monitoring, managing, notifying – Battery, display, vibrator, led,

Deviced (framework/system/deviced/core) 7 51 • System monitoring, managing, notifying – Battery, display, vibrator, led, mmc, power, USB, storage, extcon devices • Use Ecore main_loop for event handling – main() (main. c) • ecore_init(): initializing Ecore • deviced_main() – edbus_init: initializing Ecore dbus – deviced_init(): initializing deviced components » Display, storage, USB, lowbat … etc. – notification to systemd – ecore_main_loop_begin(): start main loop of ecore Embedded Software Lab. @ SKKU

Deviced (framework/system/deviced/core) 8 51 DD_LIST_APPEND(device_ops, List) Embedded Software Lab. @ SKKU

Deviced (framework/system/deviced/core) 8 51 DD_LIST_APPEND(device_ops, List) Embedded Software Lab. @ SKKU

What is Ecore? (Event main loop) 9 51 • Ecore: EFL core library for

What is Ecore? (Event main loop) 9 51 • Ecore: EFL core library for application – “Operating system abstraction and integration”, http: //enlightenment. org – Event-driven main loop Because GUI application is event-driven. • Many GUI Toolkit use event-driven main loop, ex) Glib – Frequently switch between IDLE / Event handling • save core resource – Can handle file descriptor and signal event • socket, pipe, vconf, IPC, etc. • Also able to use in non-GUI event driven program Embedded Software Lab. @ SKKU

list. h 10 51 • Double linked list to handle device operation – “eina_list_*”

list. h 10 51 • Double linked list to handle device operation – “eina_list_*” functions are provided by enlightenment – eina_list_append(Eina_List *list, const void *data) • Append the given data to the given linked list. – eina_list_nth(const Eina_List * list, unsigned int n) • Get the n`th member's data pointer in a list. Display • EINA_LIST_APPEND(lcdon_ops, ops); Gpio • DD_LIST_APPEND(gpio_head, (void*)gpio); USB • DD_LIST_APPEND(storage_job, job); MMC • DD_LIST_APPEND(fs_head, (void*)fs); Various list types Embedded Software Lab. @ SKKU

devices. c 11 51 • Perform device registration and management – add_device() / remove_device()

devices. c 11 51 • Perform device registration and management – add_device() / remove_device() / find_device() • Use “eina_list_*” functions – devices_init() / device_exit() / device_start() / device_stop() / device_execute() • Execute each function of device_ops Start/Stop flags Embedded Software Lab. @ SKKU

Device Registration Example 12 51 • . /touchscreen. c – Enable / Disable touchscreen

Device Registration Example 12 51 • . /touchscreen. c – Enable / Disable touchscreen on specific status Check flag sys_get_int(path, value) • provides access to kernel device driver node parameters Each device is registered automatically in module initializing process Embedded Software Lab. @ SKKU

device-notifier. c 13 51 • register_notifier() – Register Notification (Function) for specific status •

device-notifier. c 13 51 • register_notifier() – Register Notification (Function) for specific status • device_notify() – Execute registered function Embedded Software Lab. @ SKKU

udev. h / device-change-handler. c 14 51 • Provide information and callback function for

udev. h / device-change-handler. c 14 51 • Provide information and callback function for device status change – Use udev • basic way to get a event from kernel in deviced – Support below devices • Input / extcon / power_supply / USB / block device • Register_uevent_control(“Subsystem & Handler”) • Unregister_uevent_control(“Subsystem & Handler”) – Event control management Subsystem / Path Handler Embedded Software Lab. @ SKKU

Deviced Schema 15 51 Embedded Software Lab. @ SKKU

Deviced Schema 15 51 Embedded Software Lab. @ SKKU

Others 16 51 • Other system events (battery, USB connection, Device change, MMC device)

Others 16 51 • Other system events (battery, USB connection, Device change, MMC device) are also similar as touchscreen – Module structure – Register device operation functions • Init / Exit / Start / Stop / Status / Execute – Use device flags • Handle only the system-level events for devices • Storage I/O will not be handled from deviced Embedded Software Lab. @ SKKU

Inter-process communication 17 51 • Various Inter-process communication – – – heynoti ss_sysnoti socket

Inter-process communication 17 51 • Various Inter-process communication – – – heynoti ss_sysnoti socket pipe vconf dbus Embedded Software Lab. @ SKKU

heynoti (framework/appfw/heynoti) 18 51 • lig. Ht, Easy, speed. Y • light-weight notification library

heynoti (framework/appfw/heynoti) 18 51 • lig. Ht, Easy, speed. Y • light-weight notification library – using inotify mechanism • alert filesystem event – doesn't support data delivery, just send event notification. – To send event with data like integer, string, use DBus for IPC. – simple mechanism • make inotify fd for specific name • subscribe for specific name • sender publishes notification • App notifies and handles notification Embedded Software Lab. @ SKKU

ss_sysnoti 19 51 • Send event into system-server – Enable run_queue (in system-server) to

ss_sysnoti 19 51 • Send event into system-server – Enable run_queue (in system-server) to handle the event from proper handler – Using socket communication • /libslp-sysman – Helper library to notify the message to system-server – sysnoti. c • sysnoti_send(msg): send socket msg into /tmp/sn • sysman_call_predef_action(): request into system-server to run predefined function for the event Embedded Software Lab. @ SKKU

vconf (framework/appfw/vconf) 20 51 • Key-value fair + inotify – Various functionality than heynoti

vconf (framework/appfw/vconf) 20 51 • Key-value fair + inotify – Various functionality than heynoti • Store system configuration using SQLite (libsqlfs) • Able to communicate between inter-process using inotify Embedded Software Lab. @ SKKU

dbus 21 51 • Inter-process communication mechanism using socket – Using Dbus daemon, App

dbus 21 51 • Inter-process communication mechanism using socket – Using Dbus daemon, App (or process) can send message into other App (or process) – Access control using SMACK Embedded Software Lab. @ SKKU

libdevice-node 22 51 • Library that manages device node for each device in system

libdevice-node 22 51 • Library that manages device node for each device in system – Not only real device, sysfs node also can be managed. – Add device node into device list, and register the callback function for get and set request OAL Interface Function • device_get_property – Get device information (through corresponding OAL interface function) • device_set_property – Set device status (or command) (with OAL interface function) • OAL Interface – libslp_devman_plugin. so – System developer should make OAL Interface library for each system devices Embedded Software Lab. @ SKKU

Sensor Framework 23 51 • Types of Sensors – Sensor plugins retrieve data from

Sensor Framework 23 51 • Types of Sensors – Sensor plugins retrieve data from sensor hardware and enable the client applications to use the data – Tizen supports individual plugin frameworks for these sensors: • • • Accelerometer sensor Gyroscope sensor Proximity sensor Motion sensor Geomagnetic sensor Light sensor Gravity sensor Orientation sensor Pressure sensor Etc Embedded Software Lab. @ SKKU

Sensor details 24 51 • Accelerometer sensor – The accelerometer sensor is used to

Sensor details 24 51 • Accelerometer sensor – The accelerometer sensor is used to measure the acceleration of the device. The three dimensional coordinate system is used to illustrate the direction of the acceleration. When a phone is moving along an axis, the acceleration is positive if it moves in a positive direction. • Gyroscope sensor – A gyroscope is a device used primarily for navigation and measurement of angular velocity. Gyroscopes measure how quickly an object rotates. This rate of rotation can be measured along any of the three axes X, Y, and Z. • Proximity sensor – A proximity sensor can detect the presence of nearby objects without any physical contact. That is, it indicates if the device is close or not close to the user. • Motion sensor – A motion sensor is a virtual sensor that uses the accelerometer and gyroscope sensors. Motion sensor detects snap, panning, tilt, shake, overturn, and double tap event. • Geomagnetic sensor – A geomagnetic sensor indicates the strength of the geomagnetic flux density in the X, Y, and Z axes. This sensor is used to find the orientation of a body, which is a description of how it is aligned to the space it is in. Embedded Software Lab. @ SKKU

Sensor details 25 51 • Light sensor – A light sensor measures the amount

Sensor details 25 51 • Light sensor – A light sensor measures the amount of light that it receives or the surrounding light conditions. The ambient light state is measured as a step value, where 0 is very dark and 10 is bright sunlight. • Gravity sensor – The gravity sensor is originated from the 3 -axis acceleration sensor. It calculate gravity vector based on measured data of 3 -axis acceleration sensor. The gravity sensor outputs 4 values: 3 Cartesian axis values and a timestamp. • Orientation sensor – The Orientation sensor can determine three angular positions (Azimuth / Pitch / Roll). It is consist of the 3 -axis accelerometer sensor and 3 -axis magnetic sensor • Pressure sensor – The pressure sensor measures pressure, typically the pressure of gases or liquids. The measurement unit is h. Pa. The min value is 260 h. Pa and the max value is 1260 h. Pa. Embedded Software Lab. @ SKKU

Sensor Framework details 26 51 • Components of Sensor Framework – Sensor Server •

Sensor Framework details 26 51 • Components of Sensor Framework – Sensor Server • A daemon which communicates uniquely to sensor drivers in the system and dispatches sensor data to the application. • Takes care of interacting with the sensor driver in hardware initialization, driver configuration, and data fetching, to manage all sensors on the platform. – Sensor Client Library • The application that wants to access the sensor service should communicate with the server through the sensor API library. • Allows the application to access the sensor service. – Sensor Plugins • Retrieve data from sensor hardware and enable the client applications to use the data for specific requirements. • Take care of interacting with the sensor driver. • Process data from sensor drivers and communicate it to the sensor server. Embedded Software Lab. @ SKKU

Sensor Framework details 27 51 • Interfaces of sensor plugins in sensor framework –

Sensor Framework details 27 51 • Interfaces of sensor plugins in sensor framework – Sensor_base • Connect the sensor plugin to the sensor server – Physical_sensor • Pushes sensor event from the plugin to the server event queue. – Sensor_hal • Configure sensor driver and read raw sensor data from the sensor driver. • Type of sensor plugins – Hardware sensor • Sensor_base + physical_sensor + sensor_hal – Virtual sensor • Sensor_base + virtual_sensor Embedded Software Lab. @ SKKU

Sensor Data Acquisition 28 51 • Sensor Data Acquisition – How to acquire sensor

Sensor Data Acquisition 28 51 • Sensor Data Acquisition – How to acquire sensor data from device and notify sensor event of application • Sensor Data Acquisition Policies – Polling: ~Tizen 2. 2 – Event-driven: Tizen 2. 3 Embedded Software Lab. @ SKKU

Sensor Data Acquisition: Polling 29 51 • Application requires sensor data of server periodically.

Sensor Data Acquisition: Polling 29 51 • Application requires sensor data of server periodically. • Used up to Tizen 2. 2 • Problem – Sensor data requests for each application → Too many kernel-device interactions → Sensor event drop occur Embedded Software Lab. @ SKKU

Sensor Data Acquisition: Event-driven 30 51 • Application only register sensor event handler on

Sensor Data Acquisition: Event-driven 30 51 • Application only register sensor event handler on server • Used from Tizen 2. 3 • Sensor event drop problem resolved – Kernel-device interaction is decreased • Problem – Every registered sensor event handlers are called → Increased IPC, Decreased CPU idle time • cf. • Batching in Android 4. 4~, • Model-driven in Brace. Force Embedded Software Lab. @ SKKU

31 51 App Framework Embedded Software Lab. @ SKKU

31 51 App Framework Embedded Software Lab. @ SKKU

App Framework Overview 32 51 Embedded Software Lab. @ SKKU

App Framework Overview 32 51 Embedded Software Lab. @ SKKU

Tizen Core Application Types 33 51 • UI Application – Application with UI (GUI)

Tizen Core Application Types 33 51 • UI Application – Application with UI (GUI) – Developed using EFL + Core APIs • Service Application – Applications without UI – Developed using Ecore (+α) + Core APIs Embedded Software Lab. @ SKKU

Appcore 34 51 • Appcore is the application core handling various important events each

Appcore 34 51 • Appcore is the application core handling various important events each of which application should be ware of. • Using appcore, developers can – Manage application life-cycle • Create, Reset, Pause, Resume, Terminate – Handle System Events • • Low Memory Low Battery Screen orientation Change Language & Region Change Embedded Software Lab. @ SKKU

Appcore Internal callback 35 51 Embedded Software Lab. @ SKKU

Appcore Internal callback 35 51 Embedded Software Lab. @ SKKU

Appcore AUL Handler 36 51 • Appcore registers default internal AUL handler in initialization

Appcore AUL Handler 36 51 • Appcore registers default internal AUL handler in initialization appcore/appcore. c Embedded Software Lab. @ SKKU

Using appcore 37 51 • Include appcore-common. h or appcore-efl. h • fill appcore_ops

Using appcore 37 51 • Include appcore-common. h or appcore-efl. h • fill appcore_ops for proper function pointers • call appcore_efl_main when using EFL appcore/appcore-common. h appcore/appcore-efl. c Embedded Software Lab. @ SKKU

Application Life Cycle: State and Transitions 38 51 Embedded Software Lab. @ SKKU

Application Life Cycle: State and Transitions 38 51 Embedded Software Lab. @ SKKU

Tizen GUI App Structure 39 51 Embedded Software Lab. @ SKKU

Tizen GUI App Structure 39 51 Embedded Software Lab. @ SKKU

Application Utility Library: AUL 40 51 • Application Utility Library (AUL) provides the following

Application Utility Library: AUL 40 51 • Application Utility Library (AUL) provides the following features – Launching/terminating applications – Providing running application information • AUL consists of the following sub -components: – AUL library: Sending/receiving requests for launching and terminating – AUL daemon (a. k. a. launch pad): Handling the requests • Open socket file • wait for recv() at __launchpad_main_loop aul/launchpad. c Embedded Software Lab. @ SKKU

AUL: Launch 41 51 • In case of single-instance application – If app is

AUL: Launch 41 51 • In case of single-instance application – If app is not running, launch application – If app is already running, send reset event to the running application • In case of multi-instance application – launch an app • _launchpad_main_loop() handles launch event Embedded Software Lab. @ SKKU aul/launchpad. c

App to Launchpad 42 51 aul/launch_app. c aul/launch. c Embedded Software Lab. @ SKKU

App to Launchpad 42 51 aul/launch_app. c aul/launch. c Embedded Software Lab. @ SKKU

AUL Overall Architecture 43 51 • Application provides APN(application package name) to launch. •

AUL Overall Architecture 43 51 • Application provides APN(application package name) to launch. • Unix Domain Socket is used to send events between launchpad and applications. • Launchpad daemon is responsible for setup default configuration of application. • DB is used to store / retain default configuration of application. Embedded Software Lab. @ SKKU

App Service (high-level App Launcher) 44 51 • App service exposes general service terms,

App Service (high-level App Launcher) 44 51 • App service exposes general service terms, such as view, create, call, and so forth, to developers in case of launching an application with a specific feature – More desirable asking image view service without knowing what image viewer apps are available. • Each service can be determined by given operation, URI and MIME type. – – Operation: expected action for the request (e. g. , view, edit, call, send. . ) URI: URI information for requested operation (e. g. , http: //. . . file: //. . . ) MIME type: MIME type information for requested operation (e. g. , image/jpeg) Data: Extra data to launched service application(contained in a bundle packet) Embedded Software Lab. @ SKKU

App Service Overall Flow 45 51 Embedded Software Lab. @ SKKU

App Service Overall Flow 45 51 Embedded Software Lab. @ SKKU

App Service Request 46 51 Embedded Software Lab. @ SKKU

App Service Request 46 51 Embedded Software Lab. @ SKKU

Application Data Exchange 47 51 • The actual Application Data Exchange (ADE) occurs as

Application Data Exchange 47 51 • The actual Application Data Exchange (ADE) occurs as an argument between the caller and callee, using a bundle. • Bundle is a type of dictionary abstract data, in which information is stored as key-value pairs. • Bundle contains information regarding the state the app should prepare. Embedded Software Lab. @ SKKU

Package Manager 48 51 • Package manager is responsible for installing, upgrading and uninstalling

Package Manager 48 51 • Package manager is responsible for installing, upgrading and uninstalling of applications and storing their information. • Expandable structure to support various types of applications – Designated installation modules can be added to the manager • Web app, native app, java app, and so forth Embedded Software Lab. @ SKKU

Application Information Library: AIL 49 51 • AIL is the library providing functionalities to

Application Information Library: AIL 49 51 • AIL is the library providing functionalities to execute application information-related tasks. • AIL provides the following features – Adding, updating and removing application information. – Managing application's information –application name, type, icon path, exec path, etc. – Retrieving an application list which meets a given filter. Embedded Software Lab. @ SKKU

App Use History: RUA 50 51 • Recently Used Application (RUA) logs application use

App Use History: RUA 50 51 • Recently Used Application (RUA) logs application use history. – When an application is launched, launch pad updates the history and task manager can either get or clear the history. • RUA also provides below information regarding launching: – – package name launch time application path application launch argument Embedded Software Lab. @ SKKU

References 51 51 • “An Overview of Tizen Application Core Framework”, TDC 2012 •

References 51 51 • “An Overview of Tizen Application Core Framework”, TDC 2012 • “Tizen Core APIs: A Core Framework Layer to Build In. House Applications”, TDC 2014 • Tizen wiki, https: //wiki. tizen. org • Tizen developer guide, https: //developer. tizen. org/devguide/2. 3. 0/ • http: //seoz. egloos. com Embedded Software Lab. @ SKKU