Skip to content

MindSphere Fleet Manager Plugin SDK – Getting started

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:

1
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:

1
2
3
import {fmPluginBootstrapper} from "@mindsphere/fleetmanager-plugin-sdk";

fmPluginBootstrapper.boot();

The boot function optionally takes some startup options to initially apply:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
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:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
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:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
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:

1
2
3
4
5
6
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?

Ask the community


Except where otherwise noted, content on this site is licensed under the MindSphere Development License Agreement.