Class: DatumStreamMetadata

domain~ DatumStreamMetadata

Metadata about a datum stream.


new DatumStreamMetadata(streamId, zone, kind, objectId, sourceId, iNames, aNames, sNames)

Constructor.

Parameters:
Name Type Description
streamId string

the stream ID

zone string

the time zone ID

kind DatumStreamType

the stream type

objectId number

the node or location ID

sourceId string

the source ID

iNames Array.<string>

the instantaneous property name array

aNames Array.<string>

the accumulating property name array

sNames Array.<string>

the status property name array

Members


accumulatingLength :number

The accumulating property names array length.

Type:
  • number

accumulatingNames :Array.<String>

The accumulating property names array.

Type:
  • Array.<String>

instantaneousLength :number

The instantaneous property names array length.

Type:
  • number

instantaneousNames :Array.<String>

The instantaneous property names array.

Type:
  • Array.<String>

kind :DatumStreamType

The stream type.

Type:

locationId :number

The stream object ID (if the kind is Location), otherewise undefined.

Type:
  • number

nodeId :number

The stream object ID (if the kind is Node), otherwise undefined.

Type:
  • number

objectId :number

The stream objece (node or location) ID.

Type:
  • number

propertyNames :Array.<string>

Get all stream property names, in order of instantaneous, accumulating, and status.

Type:
  • Array.<string>

propertyNamesLength :number

The total number of instantaneous, accumulating, and status property names.

Type:
  • number

sourceId :string

The stream source ID.

Type:
  • string

statusLength :number

The status property names array length.

Type:
  • number

statusNames :Array.<String>

The status property names array.

Type:
  • Array.<String>

streamId :string

The stream ID, for example 7714f762-2361-4ec2-98ab-7e96807b32a6.

Type:
  • string

timeZoneId :string

The stream time zone ID, for example Pacific/Auckland.

Type:
  • string

Methods


<static> fromJsonEncoding(json)

Parse a JSON string into a module:domain~DatumStreamMetadata instance.

The JSON must be encoded the same way module:domain~DatumStreamMetadata#toJsonEncoding does.

Parameters:
Name Type Description
json string

the JSON to parse

Returns:

the stream metadata instance

Type
module:domain~DatumStreamMetadata

<static> fromJsonObject(obj)

Create a metadata instance from an object parsed from a JSON string.

The object must have been parsed from JSON that was encoded the same way module:domain~DatumStreamMetadata#toJsonEncoding does.

Parameters:
Name Type Description
obj string

the object parsed from JSON

Returns:

the stream metadata instance

Type
module:domain~DatumStreamMetadata

<static> locationMetadata(streamId, zone, locationId, sourceId, iNames, aNames, sNames)

Create a new location datum stream metadata instance.

Parameters:
Name Type Description
streamId string

the stream ID

zone string

the time zone ID

locationId number

the location ID

sourceId string

the source ID

iNames Array.<string>

the instantaneous property name array

aNames Array.<string>

the accumulating property name array

sNames Array.<string>

the status property name array

Returns:

the new metadata instance

Type
DatumStreamMetadata

<static> nodeMetadata(streamId, zone, nodeId, sourceId, iNames, aNames, sNames)

Create a new node datum stream metadata instance.

Parameters:
Name Type Description
streamId string

the stream ID

zone string

the time zone ID

nodeId number

the node ID

sourceId string

the source ID

iNames Array.<string>

the instantaneous property name array

aNames Array.<string>

the accumulating property name array

sNames Array.<string>

the status property name array

Returns:

the new metadata instance

Type
DatumStreamMetadata

propertyNamesForType(samplesType)

Get the property names for a given samples type.

Parameters:
Name Type Description
samplesType DatumSamplesType

the type of property names to return; Tag is not supported

Returns:

the property names for the given type, or null if none available

Type
Array.<string>

toJsonEncoding()

Get this object as a standard JSON encoded string value.

An example result looks like this:

{
      "streamId": "7714f762-2361-4ec2-98ab-7e96807b32a6",
      "zone": "Pacific/Auckland",
      "kind": "n",
      "objectId": 123,
      "sourceId": "/power/1",
      "i": ["watts", "current",  "voltage", "frequency"],
      "a": ["wattHours"]
}
Returns:

the JSON encoded string

Type
string