Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Here is a list of the configuration options that the SDK constructor takes as parameters.

Code Block
languagejs
constructor (token: string, exhibitId: number, manifestLocation: string, options = {})

...

The directory path to the manifest.

gb
Code Block
languagejs
gumbandSDK.setManifest('./path/to/manifest.json');

...

Get the current operating mode for the exhibit from Gumband.

Code Block
languagejs
let operatingMode = await gbgumbandSDK.getOperatingMode();

console.log(`Operating Mode: ${operatingMode}`);
// Operating Mode: true

...

The target operating mode.

Code Block
languagejs
await gbgumbandSDK.setOperatingMode(true);

getStatus(statusName: string): Promise<string>

...

The “id” field of the status in the manifest.

Code Block
languagejs
let statusValue = await gbgumbandSDK.getStatus('cpu-usage');

console.log(`CPU Usage: ${statusValue}`);
// CPU Usage: 50%

...

The target value to which the status should be set.

Code Block
languagejs
await gbgumbandSDK.setStatus('cpu-usage', "50%");

...

The “id” field of the setting in the manifest.

Code Block
languagejs
let motorRPM = await gbgumbandSDK.getSetting('motor-rpm');

console.log(`Motor RPM: ${motorRPM}`);
// Motor RPM: 30

...

The target value to which the setting should be set.

Code Block
languagejs
await gumbandSDK.setSetting('motor-rpm', '30');

...

Get all settings as a map, where the key is the “id” field of each setting in the manifest.

Code Block
languagejs
console.log(await gbgumbandSDK.getAllSettings());

//{
//  'motor-rpm': {
//    id: 14,
//    manifestId: 'motor-rpm',
//    exhibitId: 1,
//    type: 'IntegerInput',
//    display: 'Motor RPM',
//    enabledOpMode: null,
//    value: 30,
//    default: 0,
//    order: 0,
//    touchless: null,
//    listId: null,
//    groupId: null,
//    read: true,
//    write: true
//  }
//}

...

Get all setting lists in the manifest as an array.

Code Block
languagejs
console.log(await gbgumbandSDK.getAllSettingLists());

//[
//  {
//    id: 1,
//    exhibitId: 1,
//    manifestId: 'my-list',
//    listDisplay: 'List Label',
//    listParent: null,
//    schema: [ [Object], [Object] ],
//    listItemCount: 1,
//    order: [ 'item 1' ],
//    orderSelf: null,
//    groupId: null,
//    settinglistitems: [ [Object] ],
//    type: 'SettingsList'
//  }
//]

...

Get the list of Gumband Hardware that are currently connected to the SDK.

Code Block
languagejs
console.log(gbgumbandSDK.getOnlineHardware());

//[
//  {
//    hardwareId: 83,
//    name: 'Gumband SDK Tutorial',
//    peripherals: { Button: [Object], LED: [Object] }
//  }
//]

...

Get the full manifest of this exhibit from Gumband.

Code Block
languagejs
console.log(await gbgumbandSDK.exhibit.getManifest());

//{
//  manifest: {
//    id: 249,
//    siteId: 34,
//    name: 'Gumband SDK Tutorial',
//    mqttPath: '',
//    online: true,
//    manifestLocked: false,
//    opMode: 'On',
//    settingLists: [],
//    settingGroups: [ [Object], [Object] ],
//    settings: [ [Object] ],
//    statuses: [ [Object], [Object], [Object] ],
//    controls: [ [Object], [Object] ],
//    strapiContent: []
//  }
//}

...

The new value to which the property will be set.

Code Block
languagejs
//gmbnd_bool property type
await gbgumbandSDK.hardware.set("1/My Peripheral/My Property", 1);

...

Get all hardware associated with this exhibit in the Gumband UI.

Code Block
languagejs
console.log(await gbgumbandSDK.hardware.getExhibitHardware());

//{
//  response: 'success',
//  hardware: [
//    {
//      id: 83,
//      siteId: 34,
//      exhibitId: 249,
//      mac: '16:95:62:21:1h:h2',
//      name: 'Gumband SDK Tutorial',
//      lastHeartbeat: '2023-08-21T16:02:12.133Z',
//      online: true,
//      numPeripherals: 2,
//      controlDebug: true,
//      gumband_fw: '47',
//      user_fw: '0',
//      ip: '192.168.2.2',
//      exhibitIP: '192.168.83.17:1884',
//      exhibitState: 1,
//      temp: '43.217',
//      voltage: '4.609',
//      uptime: '49',
//      createdAt: '2023-08-08T17:42:11.390Z',
//      updatedAt: '2023-08-21T16:02:12.131Z'
//    }
//  ]
//}

...

Get a list of all remote file names. These file names will match the files list under the Exhibit/Files tab in the Gumband UI.

Code Block
languagejs
let remoteFiles = await gbgumbandSDK.content.getRemoteFileList();

console.log(remoteFiles);
//{
//  response: 'OK',
//  files: [
//    {
//      file: 'gumband-cassette.png',
//      name: 'gumband-cassette.png',
//      hash: 'SlTZJxaq+s5YH4R1KX6wHA==',
//      lastUpdated: '2023-08-14T19:22:08.547Z',
//      size: '81204'
//    }
//  ],
//  errors: []
//}

...

Get a list of all locally saved file names for the exhibit.

Code Block
languagejs
let localFiles = gumbandSDK.content.getLocalFileList();

console.log(localFiles);
//{
//  files: [
//    {
//      file: 'gumband-cassette.png',
//      name: 'gumband-cassette.png',
//      hash: 'SlTZJxaq+s5YH4R1KX6wHA==',
//      lastUpdated: '2023-08-14T19:22:08.547Z',
//      size: '81204'
//    }
//  ]
//}

...

Sync locally saved files with the list of remote files. This is called whenever the SDK makes a connection to Gumband if local files is enabled.

Code Block
languagejs
await gumbandSDK.content.sync();

content.uploadFile(fileStream: ReadStream): Promise<void>

...

A stream of data from a function such as fs.createReadStream("path/to/file").

Code Block
languagejs
const fileStream = fs.createReadStream("path/to/file");
await gbgumbandSDK.content.uploadFile(fileStream);

...

The name of the file.

Code Block
languagejs
await gbgumbandSDK.content.downloadFile("gumband-cassette.png");

...

Any data object to be associated with the event.

Code Block
languagejs
await gbgumbandSDK.event.create("Red Button Pressed", { holdTime: 2.52 });

...

The message for the log.

Code Block
languagejs
await gbgumbandSDK.logger.info("This is an info log message");

...

The message for the log.

Code Block
languagejs
await gbgumbandSDK.logger.debug("This is a debug log message");

...

The message for the log.

Code Block
languagejs
await gbgumbandSDK.logger.warn("This is a warning log message");

...

The message for the log.

Code Block
languagejs
await gbgumbandSDK.logger.error("This is an error log message");

...

The message for the custom email notification.

Code Block
languagejs
await gbgumbandSDK.notification.email("Your exhibit requires maintenance");

...

This is a list of the possible websocket events that may be emitted by the SDK; for example:

Code Block
languagejs
const { Sockets } = require("@deeplocal/gumband-node-sdk");

gbgumbandSDK.on(Sockets.CONTROL_RECEIVED, (payload) => {
  //code reached when the SDK emits a Sockets.CONTROL_RECEIVED event
});

...