Skip to main content

Notice: This Wiki is now read only and edits are no longer possible. Please see: https://gitlab.eclipse.org/eclipsefdn/helpdesk/-/wikis/Wiki-shutdown-plan for the plan.

Jump to: navigation, search

Difference between revisions of "DSDP/TML/Creating TmL Plugins update"

< DSDP‎ | TML
(Defining the device state machine)
(Defining the device state machine)
Line 29: Line 29:
 
* The operations that can be performed when the device is at a given status. That is, how the possible states constrain the operations. Examples of such constraints: The '''turn on''' operation can be performed only if the device is on '''turned off''' state, '''start phonebook application''' operation cannot be performed if device is on '''turned off''' state.
 
* The operations that can be performed when the device is at a given status. That is, how the possible states constrain the operations. Examples of such constraints: The '''turn on''' operation can be performed only if the device is on '''turned off''' state, '''start phonebook application''' operation cannot be performed if device is on '''turned off''' state.
  
It is highly recommended that you draw a graph which represents the device state machine you are creating in TmL. As an example, see the graph below:
+
With all this information well known, you are ready to define the state machine for the device you want to configure to use with TmL.
 +
 
 +
It is good practice to draw a graph which represents the device state machine you are creating. As an example, see the following state machine graph:
  
 
[[Image:state-machine-graph.jpg]]
 
[[Image:state-machine-graph.jpg]]
 +
 +
This state machine considers four states that the device can be at: '''Off''', '''Idle''', '''Running Phonebook''' and '''Running Calendar'''.
 +
It also contains the information regarding the operation constraints according to the device state.
 +
For instance, from this state machine you can tell that in order to start an application ('''Phonebook''' or '''Calendar''') the phone has to be on '''Idle''' state. It also tells that you can turn the device off regardless of its state (except if the device is already on '''Off''' state). Another conclusion, is that you would no be able to start '''Calendar''' and '''Phonebook''' somultaneously.
  
 
=== Instantiating the new device on the TmL framework ===
 
=== Instantiating the new device on the TmL framework ===

Revision as of 16:52, 5 December 2008

Creating TmL devices

Purpose and Target audience

This tutorial provides directions on creating devices:LINK_CONCEPT for TmL.

The target audience is anyone who wants to create a device:LINK_CONCEPT in TmL context.

Initial requirements

Here follows the steps necessary to prepare the environment to create TmL devices.

  1. Download and install the most recent Eclipse Europa (3.3) version. Click here for the eclipse download site.
  2. Connect to Eclipse CVS Repository and get the project set for Common utilities (see instructions here).

After that, your workspace should contain a new project named org.eclipse.tml.common.utilities.

Creating a TmL device

The process of creating a TmL device consists of the following:

  1. Defining the state machine which describes the device behavior in what concerns the TmL framework.
  2. Creating an eclipse extension which instantiates the device you want to create.
  3. Creating the device state machine on the TmL framwork. This comprises the following steps:
    1. Creating one eclipse extension to represent each of the states pertaining to the device state machine.
    2. For each possible event on the device state machine, create an eclipse extension to represent the state changes which occur as a consequence of this event.

Defining the device state machine

In order to define the device state machine you should consider three points:

  • The operations that can be performed on the device. That is, the events. Examples of events: turn device on, turn device off, start phonebook application.
  • The status the device assumes as a consequence of these operations. That is, the sates. Examples of states: turned on, turned off, running phonebook application.
  • The operations that can be performed when the device is at a given status. That is, how the possible states constrain the operations. Examples of such constraints: The turn on operation can be performed only if the device is on turned off state, start phonebook application operation cannot be performed if device is on turned off state.

With all this information well known, you are ready to define the state machine for the device you want to configure to use with TmL.

It is good practice to draw a graph which represents the device state machine you are creating. As an example, see the following state machine graph:

State-machine-graph.jpg

This state machine considers four states that the device can be at: Off, Idle, Running Phonebook and Running Calendar. It also contains the information regarding the operation constraints according to the device state. For instance, from this state machine you can tell that in order to start an application (Phonebook or Calendar) the phone has to be on Idle state. It also tells that you can turn the device off regardless of its state (except if the device is already on Off state). Another conclusion, is that you would no be able to start Calendar and Phonebook somultaneously.

Instantiating the new device on the TmL framework

Creating the device state machine on the TmL framwork

Creating the states for the device state machine

Creating the states for the device state machine

  1. Create a new Plug-in project using the Eclipse New Project Wizard.
    Step1.jpg
  2. If this plug-in will be contributed to TmL certify that it is using the naming conventions in Development Conventions and Guidelines or check with TmL committer the best name for that. (ex: org.eclipse.tml.sample)
    Step2.jpg
  3. Fill provider, version and name and change the default name for activator to this format "<your-plugin-name>Plugin". (ex: SamplePlugin)
    Step3.jpg
  4. Uncheck option to select a code template.
    Step4.jpg

Configuring the plugin to work with the TmL framework

  1. Open plugin.xml in the dependencies tab
  2. Add org.eclipse.tml.common.utilities
    Tml plugin dependencies.jpg

Defining Icons

Inserting I18N support

Inserting LOG support

Inserting Exception support

Conclusion

Back to the top