Signal K
    Preparing search index...

    Interface StreamBundle

    interface StreamBundle {
        getAvailablePaths(): Path[];
        getBus(path?: Path): Bus<unknown, NormalizedDelta>;
        getSelfBus(path: Path): Bus<unknown, NormalizedDelta>;
        getSelfStream(path?: Path): Bus<unknown, Value>;
    }
    Index

    Methods

    • Get a list of available full data model paths maintained by the server.

      Returns Path[]

      app.streambundle.getAvailablePaths();
      

      Returns

      [
      "navigation.speedOverGround",
      "navigation.courseOverGroundTrue",
      "navigation.courseGreatCircle.nextPoint.position",
      "navigation.position",
      "navigation.gnss.antennaAltitude",
      "navigation.gnss.satellites",
      "navigation.gnss.horizontalDilution",
      "navigation.gnss.positionDilution",
      "navigation.gnss.geoidalSeparation",
      "navigation.gnss.type","navigation.gnss.methodQuality",
      "navigation.gnss.integrity",
      "navigation.magneticVariation",
      ]
    • Get a Bacon JS 1.0 stream for a Signal K path that will stream values from any context.

      Stream values are objects with the following structure:

        {
      path: ...,
      value: ...,
      context: ...,
      source: ...,
      $source: ...,
      timestamp: ...
      }

      Parameters

      • Optionalpath: Path

        If it is not provided the returned stream produces values for all paths.

      Returns Bus<unknown, NormalizedDelta>

      app.streambundle
      .getBus('navigation.position')
      .onValue(pos => app.debug(pos));

      /* output
      {
      path: 'navigation.position',
      value: { longitude: 24.7366117, latitude: 59.72493 },
      context: 'vessels.urn:mrn:imo:mmsi:2766160',
      source: {
      label: 'n2k-sample-data',
      type: 'NMEA2000',
      pgn: 129039,
      src: '43'
      },
      '$source': 'n2k-sample-data.43',
      timestamp: '2014-08-15T19:00:02.392Z'
      }
      {
      path: 'navigation.position',
      value: { longitude: 24.82365, latitude: 58.159598 },
      context: 'vessels.urn:mrn:imo:mmsi:2766140',
      source: {
      label: 'n2k-sample-data',
      type: 'NMEA2000',
      pgn: 129025,
      src: '160'
      },
      '$source': 'n2k-sample-data.160',
      timestamp: '2014-08-15T19:00:02.544Z'
      }
      */
    • Get a Bacon JS stream for path from the vessels.self context.

      Parameters

      • path: Path

        If it is not provided the returned stream produces values for all paths.

      Returns Bus<unknown, NormalizedDelta>

       app.streambundle
      .getSelfBus('navigation.position')
      .onValue(pos => app.debug(pos));

      Output:

      {
      path: 'navigation.position',
      value: { longitude: 24.7366117, latitude: 59.72493 },
      context: 'vessels.urn:mrn:signalk:uuid:a9d2c3b1-611b-4b00-8628-0b89d014ed60',
      source: {
      label: 'n2k-sample-data',
      type: 'NMEA2000',
      pgn: 129039,
      src: '43'
      },
      '$source': 'n2k-sample-data.43',
      timestamp: '2014-08-15T19:00:02.392Z'
      }
      {
      path: 'navigation.position',
      value: { longitude: 24.7366208, latitude: 59.7249198 },
      context: 'vessels.urn:mrn:signalk:uuid:a9d2c3b1-611b-4b00-8628-0b89d014ed60',
      source: {
      label: 'n2k-sample-data',
      type: 'NMEA2000',
      pgn: 129025,
      src: '160'
      },
      '$source': 'n2k-sample-data.160',
      timestamp: '2014-08-15T19:00:02.544Z'
      }
    • Get a Bacon JS stream for a path in the vessels.self context.

      Note

      This is similar to getSelfBus, except that the stream values contain only the value property from the incoming deltas.

      Parameters

      Returns Bus<unknown, Value>

      app.streambundle
      .getSelfStream('navigation.position')
      .onValue(pos => app.debug(pos));

      Output:

        my-signalk-plugin { longitude: 24.736677, latitude: 59.7250108 } +600ms
      my-signalk-plugin { longitude: 24.736645, latitude: 59.7249883 } +321ms
      my-signalk-plugin { longitude: 24.7366563, latitude: 59.7249807 } +174ms
      my-signalk-plugin { longitude: 24.7366563, latitude: 59.724980699999996 } +503ms

      @param path -