How to use the uuid.unparse function in uuid

To help you get started, we’ve selected a few uuid examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github Streampunk / dynamorse-deprecated / reduser / nodes / spout / 30-nmos-rtp-out.js View on Github external
this.getNMOSFlow(g, function (err, f) {
          if (err) return node.warn(`Failed to resolve NMOS flow ${uuid.unparse(g.flow_id)}: ${err}`);
          this.srcFlow = f;
          this.tags = f.tags;
          clockRate = +f.tags.clockRate[0];
          is4175 = f.tags.encodingName[0] === 'raw';
          is6184 = f.tags.encodingName[0].toLowerCase() === 'h264';
          if (is4175) {
            width = +f.tags.width[0];
            height = +f.tags.height[0];
            byteFactor = getByteFactor(f.tags);
            interlace = f.tags.interlace && (f.tags.interlace[0] === '1' || f.tags.interlace[0] === 'true');
            Packet = RFC4175Packet;
            packetsPerGrain = width * height * byteFactor * 1.1 / 1452|0;
          } else {
            Packet = RTPPacket;
            // contentType = `${f.tags.format[0]}/${f.tags.encodingName[0]}`;
            // if (f.tags.clockRate) contentType += `; rate=${f.tags.clockRate[0]}`;
github Streampunk / dynamorse-deprecated / reduser / nodes / valve / 70-multiviewer.js View on Github external
this.consume(function (err, x, push, next) {
      if (err) {
        push(err);
        next();
      } else if (redioactive.isEnd(x)) {
        stamper.quit(function() {
          push(null, x);
        });
      } else if (Grain.isGrain(x)) {
        var grainFlowId = uuid.unparse(x.flow_id);
        var slotNum = checkSrcFlowIds(grainFlowId);
        if (undefined === slotNum) {
          this.getNMOSFlow(x, function (err, f) {
            if (err) return push("Failed to resolve NMOS flow.");
            slotNum = nextSrcFlow++;
            var firstGrain = this.srcFlows.length === 0;
            this.srcFlows[slotNum] = f;

            if (firstGrain) {
              var dstTags = JSON.parse(JSON.stringify(f.tags));
              dstTags["width"] = [ `${config.dstWidth}` ];
              dstTags["height"] = [ `${config.dstHeight}` ];
              dstTags["packing"] = [ `${config.dstFormat}` ];
              if ("420P" === config.dstFormat) {
                dstTags["depth"] = [ "8" ];
                dstTags["sampling"] = [ "YCbCr-4:2:0" ];
github Streampunk / node-red-contrib-dynamorse-core / util / Multiflows.js View on Github external
multiFlows.prototype.checkID = function(grain) {
  const flowID = uuid.unparse(grain.flow_id);
  const sourceID = uuid.unparse(grain.source_id);
  let queue = null;
  this.flowQueues.find(fqs => {
    queue = fqs.find(fq => fq.matchID(flowID, sourceID));
    return queue;
  });  
  return queue;
};
github Streampunk / node-red-contrib-dynamorse-core / model / Grain.js View on Github external
Grain.prototype.toJSON = function () {
  return {
    payloadCount : Array.isArray(this.buffers) ? this.buffers.length : 0,
    payloadSize : Array.isArray(this.buffers) ?
      this.buffers.reduce((l, r) => l + r.length, 0) : 0,
    ptpSyncTimestamp : this.formatTimestamp(this.ptpSync),
    ptpOriginTimestamp : this.formatTimestamp(this.ptpOrigin),
    timecode : this.formatTimecode(this.timecode),
    flow_id : uuid.unparse(this.flow_id),
    source_id : uuid.unparse(this.source_id),
    duration : this.formatDuration(this.duration)
  };
};
github Streampunk / dynamorse-deprecated / reduser / nodes / valve / 30-switch.js View on Github external
push(null, x);
      } else {
        if ((!this.topFlow) || (!this.btmFlow)) { 
          this.getNMOSFlow(x, function (err, f) {
            if (err) return push("Failed to resolve NMOS flow.");

            if (!this.topFlow)
              this.topFlow = f;
            else if (!this.btmFlow && (f !== this.topFlow))
              this.btmFlow = f;
            push(null, x);
            next();
          }.bind(this));
        } else {
          if (Grain.isGrain(x)) {
            var fid = uuid.unparse(x.flow_id);
            if ((this.active && (fid === this.topFlow.id)) || (!this.active && (fid === this.btmFlow.id))) {
              push(null, x);
            }
            next();
          } else {
            push(null, x);
            next();
          }
        }
      }
    }.bind(this));
    this.on('close', this.close);
github Streampunk / dynamorse-deprecated / util / Redioactive.js View on Github external
this.getNMOSFlow = function (grain, cb) {
    var nodeAPI = node.context().global.get('nodeAPI');
    var flow_id = require('uuid').unparse(grain.flow_id);
    nodeAPI.getResource(flow_id, 'flow', cb);
  }
github Streampunk / node-red-contrib-dynamorse-core / util / Multiflows.js View on Github external
multiFlows.prototype.checkID = function(grain) {
  const flowID = uuid.unparse(grain.flow_id);
  const sourceID = uuid.unparse(grain.source_id);
  let queue = null;
  this.flowQueues.find(fqs => {
    queue = fqs.find(fq => fq.matchID(flowID, sourceID));
    return queue;
  });  
  return queue;
};
github silklabs / silk / bsp-gonk / vendor / silk / silk-bledroid / lib / advertisingDataParser.js View on Github external
}

  if (buffer.length < uuidLength) {
    log.info('Incomplete buffer calling bufferToUUID()');
    return undefined;
  }

  if (buffer.length > uuidLength) {
    buffer = buffer.slice(0, uuidLength);
  }

  buffer = reverseBuffer(buffer);

  let uuidString;
  if (uuidLength === 16) {
    uuidString = uuid.unparse(buffer).toLowerCase();
  } else {
    uuidString = bufferToHexString(buffer);
  }
  invariant(typeof uuidString === 'string');

  if (uuidString.length !== 36 &&
      uuidString.length !== 8 &&
      uuidString.length !== 4) {
    log.info(`Constructed an invalid uuid: '${uuidString}'`);
    return undefined;
  }

  return uuidString;
}
github Streampunk / dynamorse-deprecated / model / Grain.js View on Github external
Grain.prototype.toJSON = function () {
  return {
    payloadCount : Array.isArray(this.buffers) ? this.buffers.length : 0,
    payloadSize : Array.isArray(this.buffers) ?
      this.buffers.reduce(function (l, r) { return l + r.length; }, 0) : 0,
    ptpSyncTimestamp : this.formatTimestamp(this.ptpSync),
    ptpOriginTimestamp : this.formatTimestamp(this.ptpOrigin),
    timecode : this.formatTimecode(this.timecode),
    flow_id : uuid.unparse(this.flow_id),
    source_id : uuid.unparse(this.source_id),
    duration : this.formatDuration(this.duration)
  };
}
github Streampunk / node-red-contrib-dynamorse-core / util / Redioactive.js View on Github external
function getNMOSCable (node, g) {
  if (!g) return Promise.reject();
  var nodeAPI = node.context().global.get('nodeAPI');
  var flow_id = uuid.unparse(g.flow_id);
  return nodeAPI.getResource(flow_id, 'flow')
    .then(f => {
      var c = { };
      var t = makeDynamorseTags(f.tags);
      c[t.format] = [ { tags: t, flowID: flow_id, sourceID: uuid.unparse(g.source_id) } ];
      c.backPressure = `${t.format}[0]`;
      return [c];
    });
}