Wishlist/Extension Framework

From Openmoko

(Difference between revisions)
Jump to: navigation, search
 
m
Line 34: Line 34:
 
=== Example of a Method Call with the Framework Handler ===
 
=== Example of a Method Call with the Framework Handler ===
  
For the following advantage we assume that gsmd is enabled for the extension framework.  A pictorial representation of the framework is shown in .
+
For the following advantage we assume that gsmd is enabled for the extension framework.  A pictorial representation of the framework is shown below.
 +
 
 +
[[Image:Extensionframework_method.png]]
  
 
#As gsmd gets ready to make a 'phone call it reaches the stage where it has set up all of its parameters and is about to start the process of making a call.  It is at this point that the method call to the extension framework is made, by calling outgoingcall() with the following parameters:
 
#As gsmd gets ready to make a 'phone call it reaches the stage where it has set up all of its parameters and is about to start the process of making a call.  It is at this point that the method call to the extension framework is made, by calling outgoingcall() with the following parameters:

Revision as of 14:38, 21 July 2007

Wishes warning! This article or section documents one or more OpenMoko Wish List items, the features described here may or may not be implemented in the future.

The extension framework is an application for handling extensions to the core OpenMoko functionality. It is designed to allow developers to build extensions that can affect the core functionality of the device without requiring extensive knowledge of, or even access to, the code that exists to carry out core functionality. It also allows for multiple extensions to affect the same core functionality, handling ordering and chaining of the extensions to ensure consistent results.

The rationale behind such a framework is to allow developers to create piecemeal functionality rather than having to alter or extend a large existing piece of code. Taking an outgoing call as an example there are a number of things that may be required around it, such as:

  • only allow certain numbers to be dialed at certain times of the day
  • only allow numbers in the addressbook to be dialed at certain times of the day, or a maximum number of times per day
  • reroute calls using calling cards, low-cost numbers or similar methods
  • reroute calls through a VOIP gateway
  • mask caller ID depending on if the number called is in the addressbook
  • update twitter with the fact that you are attempting to call someone, perhaps with details of the number (or name if they are in the addressbook)

Some of the above features are generally useful and would be expected to be made available in any complete 'phone implementation. Others are very unlikely to make it in to a core codebase. But all of them may be useful in a given situation, so for openmoko to be as flexible as possible these all need to be possible. As such, an extension framework that puts each user in control of what the 'phone will do in any given situation is the only way of providing both the required functionality as well as the core stability and speed that is required.

The extension framework consists of a number of entities, namely the extension manager, the extension configuration GUI and the extension handler. Each of these are discussed in more detail below.

Scope

The extension framework is initially aimed at providing a way of extending the core functionality of an OpenMoko device, and even more specifically of extending the abilities of the device in the area of making and receiving 'phone calls. However, there will be nothing in the design that limits it to handling just this area and indeed the design will allow for any type of extension given the correct method calls within the core code.

Note that the extension framework is not designed to manage GUI updating and interaction, although it is possible it could be used for this it is not designed to be a UI event bus and no consideration is given to this type of fucntionality.

Components

The extension framework will consist of three main components which will manage various aspects of managing and using the extensions. These components may or may not be separate processes, although there is a reliability advantage to having the handler separate from the other components. The names and functions of the three components are:

  • The extension manager handles registration and activation of extensions as well as providing them a clean interface to store preference and configuration information.
  • The extension handler carries out the work of receiving method calls to the extension manager, passing them to the relevant extensions and providing a final reply back to the calling method.
  • The extension configuration GUI provides end users with the ability to configure each extension along with altering preferences and enabling/disabling specific features of each extension.

A final component of the extension framework will be a C library will provide extension developers with helper functions to achieve common tasks. This should allow extensions to be developed as quickly and efficiently as possible.

Example of a Method Call with the Framework Handler

For the following advantage we assume that gsmd is enabled for the extension framework. A pictorial representation of the framework is shown below.

Extensionframework method.png

  1. As gsmd gets ready to make a 'phone call it reaches the stage where it has set up all of its parameters and is about to start the process of making a call. It is at this point that the method call to the extension framework is made, by calling outgoingcall() with the following parameters:
    • originalnumber: a string that contains the number that gsmd was planning to dial (populated with the number passed in to the function)
    • dialnumber: a string that contains the number that gsmd will dial on return (populated with the number passed in to the function)
    • sendid: whether or not to send caller ID (as per system default)
  2. When the extension handler receives this method it carries out a lookup of the extensions that are currently registered and active and puts together a list of which extensions should be contacted in which order. In this case two extensions are returned as being interested in the information, along with the order in which they should be approached.
  3. The first relevant extension is contacted and carries out its work.
  4. The first relevant extension returns the parameters that it could change (dialnumber and sendid) and also two additional parameters: authorized and authreason. These two parameters allow for any operation to be blocked by a suitable extension if required. If the extension handler ever sees a return parameter stating that an operation is not authorized then it will immediately send a suitable reply to the calling method informing it of the lack of authorization along with a text string containing a message suitable to be displayed to an end user explaining why it was not authorized.
  5. The second relevant extension is contacted and carries out its work. Note that the parameters sent to this module include the updated dialnumber and sendid from the first relevant extension.
  6. The second relevant extension returns the parameters that it could change (dialnumber and sendid) and also the authorization parameters as above.
  7. The extension handler returns the final results in the reply to the calling method. At this stage gsmd should update its parameters and carry on with the process of making the call, possibly with different parameters than when it started. It should also confirm that it is authorized to continue with the operation, and if not abort appropriately.
Personal tools
Wishes warning! This article or section documents one or more OpenMoko Wish List items, the features described here may or may not be implemented in the future.

The extension framework is an application for handling extensions to the core OpenMoko functionality. It is designed to allow developers to build extensions that can affect the core functionality of the device without requiring extensive knowledge of, or even access to, the code that exists to carry out core functionality. It also allows for multiple extensions to affect the same core functionality, handling ordering and chaining of the extensions to ensure consistent results.

The rationale behind such a framework is to allow developers to create piecemeal functionality rather than having to alter or extend a large existing piece of code. Taking an outgoing call as an example there are a number of things that may be required around it, such as:

  • only allow certain numbers to be dialed at certain times of the day
  • only allow numbers in the addressbook to be dialed at certain times of the day, or a maximum number of times per day
  • reroute calls using calling cards, low-cost numbers or similar methods
  • reroute calls through a VOIP gateway
  • mask caller ID depending on if the number called is in the addressbook
  • update twitter with the fact that you are attempting to call someone, perhaps with details of the number (or name if they are in the addressbook)

Some of the above features are generally useful and would be expected to be made available in any complete 'phone implementation. Others are very unlikely to make it in to a core codebase. But all of them may be useful in a given situation, so for openmoko to be as flexible as possible these all need to be possible. As such, an extension framework that puts each user in control of what the 'phone will do in any given situation is the only way of providing both the required functionality as well as the core stability and speed that is required.

The extension framework consists of a number of entities, namely the extension manager, the extension configuration GUI and the extension handler. Each of these are discussed in more detail below.

Scope

The extension framework is initially aimed at providing a way of extending the core functionality of an OpenMoko device, and even more specifically of extending the abilities of the device in the area of making and receiving 'phone calls. However, there will be nothing in the design that limits it to handling just this area and indeed the design will allow for any type of extension given the correct method calls within the core code.

Note that the extension framework is not designed to manage GUI updating and interaction, although it is possible it could be used for this it is not designed to be a UI event bus and no consideration is given to this type of fucntionality.

Components

The extension framework will consist of three main components which will manage various aspects of managing and using the extensions. These components may or may not be separate processes, although there is a reliability advantage to having the handler separate from the other components. The names and functions of the three components are:

  • The extension manager handles registration and activation of extensions as well as providing them a clean interface to store preference and configuration information.
  • The extension handler carries out the work of receiving method calls to the extension manager, passing them to the relevant extensions and providing a final reply back to the calling method.
  • The extension configuration GUI provides end users with the ability to configure each extension along with altering preferences and enabling/disabling specific features of each extension.

A final component of the extension framework will be a C library will provide extension developers with helper functions to achieve common tasks. This should allow extensions to be developed as quickly and efficiently as possible.

Example of a Method Call with the Framework Handler

For the following advantage we assume that gsmd is enabled for the extension framework. A pictorial representation of the framework is shown in .

  1. As gsmd gets ready to make a 'phone call it reaches the stage where it has set up all of its parameters and is about to start the process of making a call. It is at this point that the method call to the extension framework is made, by calling outgoingcall() with the following parameters:
    • originalnumber: a string that contains the number that gsmd was planning to dial (populated with the number passed in to the function)
    • dialnumber: a string that contains the number that gsmd will dial on return (populated with the number passed in to the function)
    • sendid: whether or not to send caller ID (as per system default)
  2. When the extension handler receives this method it carries out a lookup of the extensions that are currently registered and active and puts together a list of which extensions should be contacted in which order. In this case two extensions are returned as being interested in the information, along with the order in which they should be approached.
  3. The first relevant extension is contacted and carries out its work.
  4. The first relevant extension returns the parameters that it could change (dialnumber and sendid) and also two additional parameters: authorized and authreason. These two parameters allow for any operation to be blocked by a suitable extension if required. If the extension handler ever sees a return parameter stating that an operation is not authorized then it will immediately send a suitable reply to the calling method informing it of the lack of authorization along with a text string containing a message suitable to be displayed to an end user explaining why it was not authorized.
  5. The second relevant extension is contacted and carries out its work. Note that the parameters sent to this module include the updated dialnumber and sendid from the first relevant extension.
  6. The second relevant extension returns the parameters that it could change (dialnumber and sendid) and also the authorization parameters as above.
  7. The extension handler returns the final results in the reply to the calling method. At this stage gsmd should update its parameters and carry on with the process of making the call, possibly with different parameters than when it started. It should also confirm that it is authorized to continue with the operation, and if not abort appropriately.