Skip to content

Design: AndrOBD extension plugin framework

fr3ts0n edited this page Dec 30, 2017 · 2 revisions

Design: AndrOBD extension plugin framework

This document describes the concept of a generic extension plugin framework for AndrOBD application.

In order to keep the AndrOBD app rather small and easy, any functional extension to AndrOBD shall be realized as independent plugin to the AndrOBD main app.

Requirements:

  1. Extension plugins shall be installable as a separate apk package.
  2. Extension plugins shall NOT be executable as stand alone application.
  3. Extension plugin packages shall be invoked and utilized by the AndrOBD application.
  4. The operation of AndrOBD shall NOT be dependent on the existence of extension plugin packages.
  5. All configuration activity concerning the extended functionality shall be handled by extension plugins package.
  6. All storage of configuration settings concerning the extended functionality shall be handled by extension plugins package.
  7. Communication between AndrOBD and the installed plugins shall use the common Android system mechanisms.
  8. AndrOBD shall identify all existing extensions at application startup.
  9. AndrOBD shall allow to enable / disable identified extension plugins.
  10. AndrOBD shall allow to initiate a configuration method / dialog for each extension plugin. (if applicable)
  11. AndrOBD shall allow to manually initiate the execution of the extension plugin's intended action. (if applicable)
  12. AndrOBD shall allow processing and display of additional data items received by the extension plugin. (if applicable)

Architecture

Overview

Plugin support package

All classes and interfaces of the plugin framework shall be located in the package:

  • com.fr3ts0n.androbd.plugin

The package shall contain:

  • Generic plugin interfaces
  • Plugin abstract implementation classes
  • Host application (AndrOBD) plugin handler classes

Host application

The host application (AndrOBD) shall use- and adapt to the plugin handler class:

  • com.fr3ts0n.androbd.plugin.PluginHandler

Extension plugins

AndrOBD extension plugin implementations shall be located it their corresponding target packages.

In order to implement above requirements, AndrOBD extension plugins shall extend the abstract class:

  • com.fr3ts0n.androbd.plugin.Plugin.

Design

Extension plugins

Identification of plugins

Every extension plugin shall identify itself with a response to a system broadcast intent of:

  • com.fr3ts0n.androbd.plugin.Plugin.IDENTIFY

Actions:

IDENTIFY:

This request shall contain following information of the host application:

  • NAME: Name
  • VERSION: Version
  • CLASS: Fully qualified class name
  • FEATURES: Supported features (Bitmask)
  • DESCR: Brief description of the extension plugin
  • COPYRIGHT: Information about Author/Copyright
  • LICENSE: Information about license

The response to this intent shall contain the identical information of the responding extension plugin.

Features of plugins

The very central part of the plugin framework is the Identification of plugins and the corresponding features which are supported by each extension.

Therefore the identification method includes the exchange of a value FEATURES, which is a bit-masked integer value.

Each supported feature is indicated by a bit value of 1 within the reported feature bitmask. All combinations of supported features shall be possible.

Following features are currently defined:

0 PLUGIN_CONFIG Configuration of extension supported CONFIGURE
1 MANUAL_ACTION Manual trigger of intended action supported ACTION
2 DATA_UPDATE Host application shall send data updates to extension DATALIST
DATA
3 DATA_PROVISION Extension will provide data updates to host application DATALIST
DATA

PLUGIN_CONFIG

This feature bit bit indicates that the plugin supports a configuration (dialog) to adjust all necessary parameters

This feature contains handling of following intended action notifications:

  • com.fr3ts0n.androbd.plugin.Plugin.CONFIGURE
Actions:
CONFIGURE

On user request AndrOBD shall send an intent for action CONFIGURE to Extension plugins in order to trigger the configuration methods of Extension plugins .

On action request CONFIGURE Extension plugins plugin shall invoke it‘s configuration dialog / methods to allow configuration of all necessary parameters for it‘s operation.

MANUAL_ACTION

The extension plugin supports a manual trigger of it's intended action (in example: publishing received measurements to a server, logging a CSV line of received data, etc.)

This feature contains handling of following intended action notifications:

  • com.fr3ts0n.androbd.plugin.Plugin.ACTION Manual trigger the intended action of the extension plugin
Actions:
ACTION

On user request AndrOBD shall send an intent for action ACTION to extension plugins in order to manually trigger the intended action of extension plugins.

On action request ACTION extension plugins shall invoke it‘s intended action methods to allow the action to be performed on manual trigger.

DATA_UPDATE

The plugin supports handling of data item list and data value updates.

This feature contains handling of following intended action notifications:

  • com.fr3ts0n.androbd.plugin.Plugin.DATALIST Notification of available data items in current service
  • com.fr3ts0n.androbd.plugin.Plugin.DATA Notification of data value updates
Actions
DATALIST

Data item list notification shall contain following information for each data item:

  • Name: Textual unique mnemonic name of data item
  • SVC: OBD service identification
  • PID: OBD PID identification of data item
  • Description: Textual description of data item
  • Units: Physical units of measurement value
DATA

Data item updates shall contain following information:

  • Name: Textual unique mnemonic name of data item
  • Value: Textual representation of data item value

AndrOBD notifies each (activated) extension of data item updates if this feature is supported

All data item updates shall be reported un-filtered.

If any data filtering, aggregation, statistics or any other post-processing of the data is necessary for the function of Extension plugins , it shall be handled by Extension plugins plugin itself.

DATA_PROVISION

This feature bit indicates that the extension plugin is capable of providing additional data to be displayed by the application.

This data provisioning works similar to the DATA_UPDATE feature, but into the opposite direction:

  • Data updates are provided by the extension plugin. indicated by DATA_PROVISION feature support of extension plugin.
  • Data updates are processed by the host application. indicated by DATA_UPDATE feature support of the host application.

This feature uses identical intent actions and data formats as the DATA_UPDATE feature, but into the opposite direction.

  • com.fr3ts0n.androbd.plugin.Plugin.DATALIST Notification of available data items
  • com.fr3ts0n.androbd.plugin.Plugin.DATA Notification of data value updates

DATA_PROVISION intents shall be sent by the extension plugin only, if the host application indicated the DATA_UPDATE feature to be supported!

Actions
DATALIST

Data item list notification shall contain following information for each data item:

  • Name: Textual unique mnemonic name of data item
  • SVC: OBD service identification (may be NULL)
  • PID: OBD PID identification of data item (may be NULL)
  • Description: Textual description of data item
  • Units: Physical units of measurement value
DATA

Data item updates shall contain following information:

  • Name: Textual unique mnemonic name of data item
  • Value: Textual representation of data item value

Host application (AndrOBD)

Plugin handler

AndrOBD shall implement a handler to handle a indefinite number of extension plugins.

AndrOBD shall identify all installed extension plugins by sending a broadcast intent for action: com.fr3ts0n.androbd.plugin.Plugin.IDENTIFY

AndrOBD shall collect the response information to this request and visualize the existence of the identified plugins.

AndrOBD shall allow to enable / disable usage of each identified plugin

AndrOBD shall analyze the reported features of each identified extension plugin to distinguish:

  • Allow trigger of configuration of the extensions
  • Allow trigger of manual execution of the intended action.
  • What intents to be sent to the extension plugin.
  • Expect reception of incoming data updates

AndrOBD shall send data updates to each extension which indicated support of this feature