QIviServiceManager Class

QIviServiceManager provides the Backends to QIviAbstractFeature More...

Header: #include <QIviServiceManager>
qmake: QT += ivicore
Inherits: QAbstractListModel

Public Types

enum BackendType { ProductionBackend, SimulationBackend }
enum SearchFlag { IncludeProductionBackends, IncludeSimulationBackends, IncludeAll }
flags SearchFlags

Public Functions

~QIviServiceManager()
QList<QIviServiceObject *> findServiceByInterface(const QString &interface, SearchFlags searchFlags = IncludeAll)
bool hasInterface(const QString &interface) const
bool registerService(QObject *serviceBackendInterface, const QStringList &interfaces, BackendType backendType = ProductionBackend)

Reimplemented Public Functions

virtual QVariant data(const QModelIndex &index, int role) const
virtual int rowCount(const QModelIndex &parent = QModelIndex()) const

Static Public Members

QIviServiceManager *instance()
  • 10 static public members inherited from QObject

Additional Inherited Members

Detailed Description

QIviServiceManager provides the Backends to QIviAbstractFeature

QIviServiceManager is the heart of QtIvi and provides you with an easy way to detect which backends and interfaces are available.

By default QIviServiceManager reads the metaData of all plugins within the "qtivi" folder of your plugin path. The plugin itself will be loaded once it's explictly requested by the developer by using findServiceByInterface().

The manager can distinguish between Production and Simulation backends. For the recognition either the filename or the metaData is used.

Simulation Backends can set the simulation key in their plugin metadata to true or use one of two supported plugin postfixes (_simulation, _simulator) in the plugin filename.

The registerService() function can be used to add Backend classes without putting them into a plugin.

The service manager is a process wide singleton and can be accessed through the instance method.

For more detailed information on which plugins are recognized, enable the "qt.ivi.servicemanagement" logging category.

See Dynamic Backend System for more information about how backend loading works.

Note: The QIviServiceManager will only accept plugins, which match the build configuration used for building qtivicore. This means qtivicore "release" build, doesn't accept plugins from a "debug" build.

Member Type Documentation

enum QIviServiceManager::BackendType

ConstantValueDescription
QIviServiceManager::ProductionBackend0A backend controlling a real automotive interface (e.g. a climate control connected over the CAN bus)
QIviServiceManager::SimulationBackend1A backend used for development as it's only returning simulation values and won't be deployed to the final hardware

enum QIviServiceManager::SearchFlag
flags QIviServiceManager::SearchFlags

ConstantValueDescription
QIviServiceManager::IncludeProductionBackends0x01Include production backends in the search result.
QIviServiceManager::IncludeSimulationBackends0x02Include simulation backends in the search result.
QIviServiceManager::IncludeAllIncludeProductionBackends | IncludeSimulationBackendsInclude production and simulation backends in the search result

The SearchFlags type is a typedef for QFlags<SearchFlag>. It stores an OR combination of SearchFlag values.

See also ProductionBackend and SimulationBackend.

Member Function Documentation

QIviServiceManager::~QIviServiceManager()

Destructor.

[virtual] QVariant QIviServiceManager::data(const QModelIndex &index, int role) const

Reimplemented from QAbstractItemModel::data().

Returns the data for index and role.

See also QAbstractListModel::data().

QList<QIviServiceObject *> QIviServiceManager::findServiceByInterface(const QString &interface, SearchFlags searchFlags = IncludeAll)

Returns a list of backends implementing the specified interface.

The searchFlags argument can be used to control which type of backends are included in the search result.

bool QIviServiceManager::hasInterface(const QString &interface) const

Returns true if the specified interface has been registered.

[static] QIviServiceManager *QIviServiceManager::instance()

Returns the global service manager instance.

bool QIviServiceManager::registerService(QObject *serviceBackendInterface, const QStringList &interfaces, BackendType backendType = ProductionBackend)

Register a backend. The provided serviceBackendInterface must implement the QIviServiceInterface else the registration will fail. interfaces is a list with interfaces (at least one) supported by the backend. The backendType indicates the type of the backend and has influence on whether the backend is found by the auto discovery of the Feature.

Returns true if the backend was successfully registered else false.

See also QIviServiceInterface.

[virtual] int QIviServiceManager::rowCount(const QModelIndex &parent = QModelIndex()) const

Reimplemented from QAbstractItemModel::rowCount().

Returns the number of rows for the given parent. Typically parent is an empty model index.

See also QAbstractListModel::data().

© 2018 The Qt Company Ltd. Documentation contributions included herein are the copyrights of their respective owners. The documentation provided herein is licensed under the terms of the GNU Free Documentation License version 1.3 as published by the Free Software Foundation. Qt and respective logos are trademarks of The Qt Company Ltd. in Finland and/or other countries worldwide. All other trademarks are property of their respective owners.