kuzzleio/kuzzle-device-manager

Assets & Devices: capabilities

Closed this issue · 0 comments

Capabilities

Assets & Devices can be localized on a map. Assets or devices with this capability should expose which field must be used to get the position.

Usecase: an asset can have a position stored in metadata rather than a measure so a client need to know where to look for the position inside the document

The capabilities should be stored by the family and the sub-family

// Asset document
{
  measures: [
    {
      type: 'position',
      name: "GPS Position" // match with this
      unit: {
        name: 'GPS',
        type: 'geo_point',
      },
      values: {
        accuracy: 123,
        position: {
          lat: 42.2,
          lon: 3.42
        },
      },
      measuredAt: 1610793427950,
      origin: {
        id: 'DummyTemp-attached_ayse_linked',
        type: 'device',
        model: 'DummyTemp',
        reference: 'attached_ayse_linked',
        payloadUuids: ['some-uuid'],
      }
    },
  ],
  capabilities: {
    localizable: {
      // type of field for the position
      type: 'measure',
      // name of the measure linked to the asset
      name: 'GPS position',
    }
  }
}

// Asset document
{
  metadata: {
    Location: { // match with this
      lat: 42.3,
      lon: 3.42,
    }
  },
  capabilities: {
    localizable: {
      // type of field for the position
      type: 'metadata',
      // name of the metadata containing the position
      name: 'Location',
    }
  }
}

// Device document
{
  measures: [
    {
      type: 'position', // match with this
      unit: {
        name: 'GPS',
        type: 'geo_point',
      },
      values: {
        accuracy: 123,
        position: {
          lat: 42.2,
          lon: 3.42
        },
      },
      measuredAt: 1610793427950,
      origin: {
        id: 'DummyTemp-attached_ayse_linked',
        type: 'device',
        model: 'DummyTemp',
        reference: 'attached_ayse_linked',
        payloadUuids: ['some-uuid'],
      }
    },
  ],
  capabilities: {
    localizable: {
      // type of field for the position
      type: 'measure',
      // type of the measure
      type: 'position',
    }
  }
}