Fleet Manager Plugin SDK – Getting started¶
Warning
Please note, that Fleet Manager is going to be replaced by Operations Insight. Therefore this SDK is not maintained anymore.
Use the Operations Insight Plugin SDK from now, which has been enhanced with further functionality and is fully compatible with this SDK.
In the FAQ you can also find a description, how to update.
A Fleet Manager plugin is developed as a web application and may use any framework and library. Every plugin must implement the Fleet Manager Plugin SDK for communicating with Fleet Manager.
Installation Instructions¶
Download the Fleet Manager Plugin SDK from the Siemens Industry Online Support (SIOS) Portal. Install it using the following command, replacing {version}
by the respective version number:
npm i mindsphere-fleetmanager-plugin-sdk-{version}.tgz
Booting the Plugin¶
When booting a plugin, it must first boot the fmPluginBootsstrapper
in order to connect to the Fleet Manager as shown below:
import {fmPluginBootstrapper} from "@mindsphere/fleetmanager-plugin-sdk";
fmPluginBootstrapper.boot();
The boot
function optionally takes some startup options to initially apply:
import {fmPluginBootstrapper, DateRange, TimeZone} from "@mindsphere/fleetmanager-plugin-sdk";
fmPluginBootstrapper.boot({
// selects a specific asset
assetId: 'f9f1ff3ccaa1401a98cf37d0c9144c7e',
// navigate to another plugin
pluginId: 'Aspects',
// apply a date time range
dateRange: new DateRange({
start: new Date(2018,5,15),
end: new Date(2018,6,15),
timeZone: TimeZone.Local
}),
// enable the date time range picker in the plugin header
enableDateTimeRangePicker: true,
// provide an i18n map for the app's legal information
appInfoI18n: {
en: {
displayName: 'My Fancy FleetManager Plugin',
appCopyright: 'Copyright (C) 2019, Acme Inc.',
appVersion: '1.3.2',
links: {
default: [
{
'type': AppInfoLinkType.WWW,
'name': 'Third-Party Software',
'value': 'https://acme.inc/assets/ossReadme.html'
},
{
'type': AppInfoLinkType.WWW,
'name': 'Documentation',
'value': 'https://acme.inc/assets/documentation.html'
},
],
},
},
de: {/* ... */},
// you may add any other language here that is supported by the FleetManager
},
});
The boot
function returns a promise, but it is not necessary to wait for the connection to be established. The SDK retains any emitted output parameters and emits the latest parameters once the connection is available.
Receiving Input Parameters¶
Input parameters are provided to plugins as RxJS Observables. Plugins must subscribe to the respective proxy property as shown below for receiving the latest value and getting notifications on updates:
import {fmProxy} from "@mindsphere/fleetmanager-plugin-sdk";
// if true, the plugin tab is currently active
fmProxy.active.subscribe(active =>
console.log(`component is ${active ? 'active' : 'inactive'}`
));
// the ID of the currently selected asset
fmProxy.assetId.subscribe(assetId => console.log(assetId));
// the currently chosen date time range
fmProxy.dateRange.subscribe(({start, end, timeZone} = {}) => {
console.log(`from ${start} to ${end}`);
console.log(`preferred time zone is ${timeZone}`);
});
// the current language selection ('en'|'de')
fmProxy.language.subscribe(language => console.log(language));
Sending Output Parameters¶
Plugins can send output parameters to Fleet Manager as shown below:
import {fmProxy, DateRange, TimeZone} from "@mindsphere/fleetmanager-plugin-sdk";
// select an asset
fmProxy.setAssetId('f9f1ff3ccaa1401a98cf37d0c9144c7e');
// apply a date time range
fmProxy.setDateRange(new DateRange({
start: new Date(2018,5,15),
end: new Date(2018,6,15),
timeZone: TimeZone.Local
}));
// navigate to another plugin, select an asset and/or apply a date time range
// (all properties are optional)
fmProxy.navigate({
pluginId: 'Aspects',
assetId: 'f9f1ff3ccaa1401a98cf37d0c9144c7e',
dateRange: new DateRange({
start: new Date(2018,5,15),
end: new Date(2018,6,15),
timeZone: TimeZone.Local // optional
})
});
// en- or disable the date time range picker in the plugin header
fmProxy.enableDateTimeRangePicker();
fmProxy.disableDateTimeRangePicker();
// provide an i18n map for the app's legal information
fmProxy.setAppInfoI18n({
appInfoI18n: {
en: {
displayName: 'My Fancy FleetManager Plugin',
appCopyright: 'Copyright (C) 2019, Acme Inc.',
appVersion: '1.3.2',
links: {
default: [
{
'type': AppInfoLinkType.WWW,
'name': 'Third-Party Software',
'value': '/assets/ossReadme.html'
},
{
'type': AppInfoLinkType.WWW,
'name': 'Documentation',
'value': '/assets/documentation.html'
},
],
},
},
de: {/* ... */},
},
})
If a plugin only outputs Observables, it is sufficient to subscribe to the provided Observers:
import {fmProxy, DateRange, TimeZone} from "@mindsphere/fleetmanager-plugin-sdk";
myAssetIdObservable.subscribe(fmProxy.assetIdObserver);
myDateRangeObservable.subscribe(fmProxy.dateRangeObserver);
myNavigationObservable.subscribe(fmProxy.navigationObserver);
myDateTimeRangePickerOptionsObservable.subscribe(fmProxy.dateTimeRangePickerOptionsObserver);
Any questions left?
Except where otherwise noted, content on this site is licensed under the Development License Agreement.