Qt Service Framework |
Element | SubElement | Description |
---|---|---|
service | The service tag can contain an arbitrary number of interface tags and one description tag. | |
" | description | A user readable description of the purpose of the service. |
" | filepath | The absolute path and name of the plug-in to be loaded when this service is requested. Alternatively if the plug-in name only is provided the standard library paths (see QCoreApplication::libraryPaths()) are used to find the plug-in. Note that if the plugin name is given only, platform specific parts such as the suffix ".dll" and ".so" or plugin prefix "lib" should be removed to enable cross platform resolution. QLibrary is used to determine the platform specific parts of the plugin. |
" | name | The name of the service. |
interface | The interface describes the properties of the interface. | |
" | capabilities | This property is a list of arbitrary strings which are interpreted as permissions/capabilities. This list can be empty. |
" | name | The name of the interface using the Java class name notation. (e.g. com.nokia.qt.TestService) |
" | version | This property contains the interface and implementation version. The version tag follows the major.minor notation. The major version indicates the interface version the minor version the implementation version. The version number must be greater than 1.0. The version cannot be less than 1.0 because the Service Framework is dependent on the fact that services must be binary compatible between major versions, and services with versions less than 1.0 are unlikely to be binary compatible with later versions. |
" | description | A user readable description of the purpose of the interface. |
" | customproperty | An implementation specific key value pair which can be used for filtering or as description. |
An example for a valid XML service description could be the following TestService:
<?xml version="1.0" encoding="utf-8" ?> <service> <name>TestService</name> <filepath>testserviceplugin</filepath> <description>Test service description</description> <interface> <name>com.nokia.qt.ILocation</name> <version>1.4</version> <capabilities></capabilities> <description>Interface that provides location support</description> </interface> <interface> <name>com.nokia.qt.ILocation</name> <version>1.5</version> <capabilities></capabilities> <description>Interface that provides location support</description> </interface> <interface> <name>com.nokia.qt.ISysInfo</name> <capabilities>ReadUserData</capabilities> <version>2.3</version> <description>Interface that provides system information support</description> <customproperty key="key1">value1</customproperty> <customproperty key="key2">value2</customproperty> </interface> </service>
The framework includes a GUI tool under tools/servicexmlgen for generating and inspecting service XML files. This makes it easy to enter service metadata and interface details and generate the appropriate XML to describe the service. It can also be used to load and inspect existing service XML files.
Here is a screenshot of the application, loaded with the TestService XML description provided above.
New services can be added and removed at any time via QServiceManager::addService() and QServiceManager::removeService().
On Symbian devices a service can be installed using the Symbian package installer. More details about this process can be found in the Qt Service Framework on Symbian documentation.
Each implementation is identified by a service name, an interface name and its version. This information is encapsulated by QServiceInterfaceDescriptor which can be used to request references to service objects.
QServiceFilter simplifies the lookup of already installed services. Developers specifies the criteria used during the meta data lookup. The subsequent example demonstrates the interaction between QServiceInterfaceDescriptor and QServiceFilter by creating references to all services that implement the interface com.nokia.qt.ILocation:
QServiceManager mgr;
QServiceFilter filter;
filter.setInterfaceName("com.nokia.qt.ILocation");
QList<QServiceInterfaceDescriptor> list = mgr.findInterfaces(filter);
for(int i = 0; i < list.size(); i++) {
QObject *serviceObject;
serviceObject = mgr.loadInterface(list[i]);
// returned object owned by client
if (serviceObject)
serviceObject->setParent(this);
}
There are two ways in which to upgrade a service. The first is an incremental approach whereby QServiceManager::addService() is used to register an XML descriptor whose service name already exists but defines new interface implementations. For example an already existing service, "ovi" may define version 1.0 of interface,"IDownload". QServiceManager::addService() is then called with an XML descriptor that declares itself as belonging the "ovi" service, but implements version 1.1 of the interface "IDownload". Both implementation versions will be available for use.
The second method is a replacement approach whereby an existing service is completely removed and replaced by a new service.
As an example the already existing "ovi" service may implement interface "IDownload" version 1.0, the new "ovi" service may implement "IDownload" version 1.0 and version 1.1. In this case the old service implementation must be first be removed using QServiceManager::removeService() to make way for the new service implementation.
QAbstractSecuritySession | Generic mechanism to enable permission checks for services |
---|---|
QServiceContext | Context information to services |
QServiceFilter | Defines criteria for defining a sub-set of all available services |
QServiceInterfaceDescriptor | Identifies a service implementation |
QServiceManager | Enables the loading of service plugins and the (de)registration of services |
QServicePluginInterface | Defines the interface that every plug-in based service must implement |
Cette page est une traduction d'une page de la documentation de Qt, écrite par Nokia Corporation and/or its subsidiary(-ies). Les éventuels problèmes résultant d'une mauvaise traduction ne sont pas imputables à Nokia. | Qt qtmobility-1.0-tp | |
Copyright © 2012 Developpez LLC. Tous droits réservés Developpez LLC. Aucune reproduction, même partielle, ne peut être faite de ce site et de l'ensemble de son contenu : textes, documents et images sans l'autorisation expresse de Developpez LLC. Sinon, vous encourez selon la loi jusqu'à 3 ans de prison et jusqu'à 300 000 E de dommages et intérêts. Cette page est déposée à la SACD. | ||
Vous avez déniché une erreur ? Un bug ? Une redirection cassée ? Ou tout autre problème, quel qu'il soit ? Ou bien vous désirez participer à ce projet de traduction ? N'hésitez pas à nous contacter ou par MP ! |
Copyright © 2000-2012 - www.developpez.com