cc327ec05b11c8eb4b5d39360841032c.ppt
- Количество слайдов: 29
1 29 Tizen v 2. 3 Application Model Sungkyunkwan University Embedded Software Lab. @ SKKU
2 29 1. Web Application Model Embedded Software Lab. @ SKKU
What is Web app and Web Runtime • Web application – Using web based technologies (HTML/JS/CSS/etc. ) – Accessing local device / platform resources – Can be installed on the device • Web Runtime – – Package management (installation, update, etc. ) Execution and lifecycle (launching, pause, resume, etc. ) Runtime security (API/network access, sandboxing, etc. ) Device and platform integration Embedded Software Lab. @ SKKU 3 29
Tizen Web App Ecosystem Embedded Software Lab. @ SKKU 4 29
Web Runtime on Tizen v 2. 3 • • Environment within which all web applications run on Tizen To access local device and platform resources Embedded Software Lab. @ SKKU 5 29
Tizen v 2. 3 Web Runtime Internal Blocks Embedded Software Lab. @ SKKU 6 29
config. xml • • 7 29 Describes the web application itself Follows W 3 C widget Spec, and Tizenspecific features •
Tizen Web UI framework • Based on open-source javascript libraries – Such as j. Query. Mobile, j. Query, Globalize • Provide a large set of widgets that have the same look and feel Embedded Software Lab. @ SKKU 8 29
j. Query Mobile • • 9 29 Overview – Touch-optimized Java. Script framework for developing mobile web application – Includes optimized functions such as UI controls, event handler, animation effects, and Ajax communication – Consists of HTML, CSS, Java. Script – HTML 5 -based user interface system designed to make responsive web sites and apps – data-* attributes: data-role, data-theme, data-position, data-transition, dataicon Supported platforms – Apple i. OS, Android, Windows Phone, Blackberry, Palm Web. OS, Firefox Mobile, Chrome for Android, Skyfire, Opera Mobile, Meego, Tizen, Samsung Bada, Kindle, … Downloads – From jquerymobile. com or using j. Query Mobile CDN (Contents Delivery Network) Comparison with Sencha Touch – Superior in terms of portability, performance, entry barrier, and library size Embedded Software Lab. @ SKKU
j. Query Mobile (example) 10 29 j. Query Mobile stylesheets j. Query library j. Query Mobile library Embedded Software Lab. @ SKKU
Globalization 11 29 • designing and developing applications that function for multiple cultures • j. Query. glob. all. js includes around 350 cultures (date, number, currency) Embedded Software Lab. @ SKKU
12 29 2. Native Application Model Embedded Software Lab. @ SKKU
Native Application • 13 UI applications – Which have a graphical user interface – Only one of them can be in the foreground at a time • Service applications – Which do not have a graphical user interface (background) – Displayed by Task switcher (which provides the list of all running applications), but no event occurs if the user selects – Useful in performing activities that need to run periodically or continuously, but do not require any user intervention Embedded Software Lab. @ SKKU 29
Native Application Model • • • 14 29 Multitasking in Tizen – Supported but only one Tizen UI application can run in the foreground while the remaining applications run in the background – Determine which UI application is running on the foreground • Using the task switcher • Using main menu icons – Termination when the End key or the system memory is low Out of Memory Policy – low-memory killer will zap background applications in least-recentlyused order until memory pressure has been relieved. Multitasking priority level Low Background UI applications Service applications Background media players Foreground UI application Foreground media player Application launcher High Voice or video call, or other system applications Embedded Software Lab. @ SKKU
Native Application Model • 15 Handling System Events – Battery Events • Check the battery level of the device using On. Battery. Level. Changed() or On. Battery. Level. Changed. In. Percentage() event handler • Ex) EMPTY; terminate the application, CRITICAL; stop using multimedia features – Memory Events • Free unused memory form the heap using the On. Low. Memory() event handler – Screen Events (applicable only to UI applications) • When the On. Screen. Off(), reduce power consumption by releasing the activated resources (such as 3 D, media, and sensors) which are no longer used to enter the sleep mode – Checkpoint Events • To avoid losing data due to unexpected termination, save the application state or context to the application registry or to the device storage using On. App. Chechpointing() event handler Embedded Software Lab. @ SKKU 29
Life Cycle of Native Applications • A frame is created by UI application, initialized with app_create_cb() • After the application is initialized, it can handle events and its state is set to running • The application gets to release its resources when the app_terminate_cb() event handler is called Embedded Software Lab. @ SKKU 16 29
Launching Application • 17 Launching – UI app; from the main menu, task switcher, a running application or when a registered condition is met – Service app; from another application • When starts, – Process Manager loads the necessary libraries and executable binary into the memory – Instance of the application is created, executed in main() • Initializing, previous application states are loaded, ui_app_main() Embedded Software Lab. @ SKKU 29
Terminating Application • 18 When, – Tizen native application itself calls the Terminate() – The system forced the application to shut down • Memory or battery power is extremely low – Handled in the app_terminate_cb() • Free its resources and terminates • Allocated UI controls, such as the form and its child controls are also released • save the application's states into application registry • urgent termination – triggered by the power-off and OOM – this method is not likely to be called, so the application should save the critical data as often as possible. (check point or callback for low memory) • normal termination – triggered by self or other applications – this method is executed properly (more time but limit of 3 -5 seconds) Embedded Software Lab. @ SKKU 29
Application State Transition Initializing • App framework initializes the application • The app data saved on the previous run is restored • For UI app, the app's frame must be created and added explicitly in app_create_cb() Running • While the UI app is running, it can switch between the background and foreground • During the switch, the window state of the app changes • The service app always runs in the background Terminated • App framework removes the app from memory Paused • Application is not visible for the user Embedded Software Lab. @ SKKU 19 29
Tizen User Interface • 20 full-screen Tizen: : Ui: : Controls: : Frame container that creates the top-level window – There must be at least one frame per application • The form in turn contains the indicator bar, header, footer, and UI controls – There can be multiple forms per application Embedded Software Lab. @ SKKU 29
Frame State Transition • • One frame in a UI application which is the top-level main window The frame has three states State: Activated Status: Fully visible, receive input Triggered by: 1. User selects the application on task switcher 2. User presses the main menu icon 3. A window that had caused the application to become deactivated is terminated State: Deactivated Status: No input to deactivated frame, partially shown Triggered by: 1. Another frame is located on top of the current frame 2. Another window, such as an incoming call, pop-up, or alarm is displayed State: Minimized Status: Invisible, Graphic / media processing and sensor manipulations are discontinued Triggered by: 1. HOME key is pressed 2. Another UI application has been launched Embedded Software Lab. @ SKKU 21 29
Registering a Launch Condition • 22 29 Register application with specific launch conditions – When the launch conditions are met, the registered application is launched automatically • Registration – At runtime, App. Manager: : Register. App. Launch() method with privilege • http: //tizen. org/privilege/application. launch – At application installation, by specifying the condition in the manifest file Type Condition format Description Due time L"Date. Time= 'mm/dd/yyyy hh: mm: ss'" Launch at the wall time, 'mm/dd/yyyy hh: mm: ss'. Period L"Due. Time= 'mm/dd/yyyy hh: mm: ss' Launch. Period='mm'" Launch at the wall time, 'mm/dd/yyyy hh: mm: ss', and every 'mm' minutes. The launch period must be between 60 minutes and 10 years. Serial L"Serial='keyword'" Launch when receiving 'keyword' as serial communication input. NFC L"NFC='command'" Launch when receiving 'command' as Near Field Communication (NFC) tag with NFC Data Exchange Format (NDEF) data. Embedded Software Lab. @ SKKU
Message Port • 23 29 Tizen: : Io: : Message. Port. Manager class – All Tizen native applications can communicate with each other using a Message. Port – The message data type is a map data which consists of a key and value pair (Tizen: : Base: : String) • 2 types of message ports – The Tizen: : Io: : Local. Message. Port class • To receive messages from the another application, set the Tizen: : Io: : IMessage. Port. Listener interface from the local message port. – The Tizen: : Io: : Remote. Message. Port class • To send messages to other applications • The local message port information can be sent to the other application for bidirectional communication Embedded Software Lab. @ SKKU
Uni-directional Communication • Send. Message() – send messages to another application • On. Message. Received. N() – Another application can receive the messages Embedded Software Lab. @ SKKU 24 29
Uni-directional Communication • 25 In the server application, – Tizen: : Io: : Local. Message. Port: : Request. Local. Message. Port() • Requests a Local. Message. Port instance with the specified message port name – Add. Message. Port. Listener() • Receive message from the client application – On. Message. Received. N() • Handle the received messages from the client application • In the client application, – Tizen: : Io: : Local. Message. Port: : Request. Remote. Message. Port() • Retrieve the Remote. Message. Port instance with specified remote application ID and message port name – Send. Message() • Send messages from the client application to the server application Embedded Software Lab. @ SKKU 29
Bi-directional Communication • 26 29 Send. Message() – Send messages and local message port information to another application – This local message port information can be used to send the response messages from the other application which receives these messages • On. Message. Received. N() – Receive the messages – The remote message port information can be used to send response messages to the application which sends the messages Embedded Software Lab. @ SKKU
Bi-directional Communication • 27 In the server application, – Tizen: : Io: : Local. Message. Port: : Request. Local. Message. Port() • Requests a Local. Message. Port instance with the specified message port name – Add. Message. Port. Listener() • Receive message from the client application – On. Message. Received. N() • Handle the received messages from the client application • Respond back using the Remote. Message. Port instance received from the client application • In the client application, – Request. Remote. Message. Port() / Request. Local. Message. Port() • Retrieve the Remote. Message. Port/Local. Message. Port instance with specified remote application ID and message port name / just message port name – Send. Message() • Send messages from the client application to the server application – On. Message. Received. N() • Handle the received messages from the server application Embedded Software Lab. @ SKKU 29
Trusted Communication • 28 Application controls and data controls – Create the author certificated and register the created certificate to IDE • Execute certificate-generator. sh or certificate-generator. bat with shell • Output is pkcs 12 file – Give permission by application certificate in the manifest editor • Other applications with which have the same permission can access the exported functionality of the application • Message port communication – Request. Trustd. Local. Message. Port(), Request. Trusted. Remote. Message. Port() • Get the trusted message port instance • Only if both applications are signed with a certificate that is uniquely assigned to its developer Embedded Software Lab. @ SKKU 29
Trusted Communication • Trusted shared directory – To share trusted data – Get. App. Shared. Path() • to get the trusted shared directory of the target application • If other applications try to access this path, the E_ILLEGAL_ACCESS error Embedded Software Lab. @ SKKU 29 29