@science-corporation/synapse 0.12.0 → 1.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (64) hide show
  1. package/README.md +4 -2
  2. package/dist/api/api.d.ts +124 -6
  3. package/dist/api/api.js +293 -20
  4. package/dist/api/api.js.map +1 -1
  5. package/dist/api/proto.json +25 -2
  6. package/dist/config.d.ts.map +1 -1
  7. package/dist/config.js +2 -0
  8. package/dist/config.js.map +1 -1
  9. package/dist/demo.js +21 -9
  10. package/dist/demo.js.map +1 -1
  11. package/dist/nodes/disk_writer.d.ts +11 -0
  12. package/dist/nodes/disk_writer.d.ts.map +1 -0
  13. package/dist/nodes/disk_writer.js +28 -0
  14. package/dist/nodes/disk_writer.js.map +1 -0
  15. package/dist/nodes/index.d.ts +1 -0
  16. package/dist/nodes/index.d.ts.map +1 -1
  17. package/dist/nodes/index.js +3 -1
  18. package/dist/nodes/index.js.map +1 -1
  19. package/dist/nodes/stream_out.d.ts +12 -5
  20. package/dist/nodes/stream_out.d.ts.map +1 -1
  21. package/dist/nodes/stream_out.js +58 -40
  22. package/dist/nodes/stream_out.js.map +1 -1
  23. package/dist/utils/ip.d.ts +2 -0
  24. package/dist/utils/ip.d.ts.map +1 -0
  25. package/dist/utils/ip.js +52 -0
  26. package/dist/utils/ip.js.map +1 -0
  27. package/package.json +6 -5
  28. package/scripts/postinstall.sh +50 -10
  29. package/src/api/api.d.ts +124 -6
  30. package/src/api/api.js +311 -20
  31. package/src/api/proto.json +25 -2
  32. package/src/config.ts +2 -0
  33. package/src/demo.ts +21 -9
  34. package/src/nodes/disk_writer.ts +30 -0
  35. package/src/nodes/index.ts +1 -0
  36. package/src/nodes/stream_out.ts +67 -50
  37. package/src/utils/ip.ts +35 -0
  38. package/synapse-api/README.md +1 -1
  39. package/synapse-api/api/nodes/stream_out.proto +31 -1
  40. package/dist/api-science-device/api.d.ts +0 -3
  41. package/dist/api-science-device/api.d.ts.map +0 -1
  42. package/dist/api-science-device/api.js +0 -3822
  43. package/dist/api-science-device/api.js.map +0 -1
  44. package/dist/api-science-device/proto.json +0 -258
  45. package/dist/nodejs.d.ts +0 -8
  46. package/dist/nodejs.d.ts.map +0 -1
  47. package/dist/nodejs.js +0 -32
  48. package/dist/nodejs.js.map +0 -1
  49. package/dist/science-device-api/api.d.ts +0 -3
  50. package/dist/science-device-api/api.d.ts.map +0 -1
  51. package/dist/science-device-api/api.js +0 -3822
  52. package/dist/science-device-api/api.js.map +0 -1
  53. package/dist/types/index.d.ts +0 -3
  54. package/dist/types/index.d.ts.map +0 -1
  55. package/dist/types/index.js +0 -19
  56. package/dist/types/index.js.map +0 -1
  57. package/dist/types.d.ts +0 -5
  58. package/dist/types.d.ts.map +0 -1
  59. package/dist/types.js +0 -19
  60. package/dist/types.js.map +0 -1
  61. package/dist/utils/device-management.d.ts +0 -37
  62. package/dist/utils/device-management.d.ts.map +0 -1
  63. package/dist/utils/device-management.js +0 -126
  64. package/dist/utils/device-management.js.map +0 -1
package/src/api/api.js CHANGED
@@ -3264,6 +3264,233 @@
3264
3264
  return DiskWriterConfig;
3265
3265
  })();
3266
3266
 
3267
+ synapse.UDPUnicastConfig = (function() {
3268
+
3269
+ /**
3270
+ * Properties of a UDPUnicastConfig.
3271
+ * @memberof synapse
3272
+ * @interface IUDPUnicastConfig
3273
+ * @property {string|null} [destinationAddress] UDPUnicastConfig destinationAddress
3274
+ * @property {number|null} [destinationPort] UDPUnicastConfig destinationPort
3275
+ */
3276
+
3277
+ /**
3278
+ * Constructs a new UDPUnicastConfig.
3279
+ * @memberof synapse
3280
+ * @classdesc UDPUnicastConfig defines the configuration parameters for UDP unicast transport.
3281
+ * @implements IUDPUnicastConfig
3282
+ * @constructor
3283
+ * @param {synapse.IUDPUnicastConfig=} [properties] Properties to set
3284
+ */
3285
+ function UDPUnicastConfig(properties) {
3286
+ if (properties)
3287
+ for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i)
3288
+ if (properties[keys[i]] != null)
3289
+ this[keys[i]] = properties[keys[i]];
3290
+ }
3291
+
3292
+ /**
3293
+ * UDPUnicastConfig destinationAddress.
3294
+ * @member {string} destinationAddress
3295
+ * @memberof synapse.UDPUnicastConfig
3296
+ * @instance
3297
+ */
3298
+ UDPUnicastConfig.prototype.destinationAddress = "";
3299
+
3300
+ /**
3301
+ * UDPUnicastConfig destinationPort.
3302
+ * @member {number} destinationPort
3303
+ * @memberof synapse.UDPUnicastConfig
3304
+ * @instance
3305
+ */
3306
+ UDPUnicastConfig.prototype.destinationPort = 0;
3307
+
3308
+ /**
3309
+ * Creates a new UDPUnicastConfig instance using the specified properties.
3310
+ * @function create
3311
+ * @memberof synapse.UDPUnicastConfig
3312
+ * @static
3313
+ * @param {synapse.IUDPUnicastConfig=} [properties] Properties to set
3314
+ * @returns {synapse.UDPUnicastConfig} UDPUnicastConfig instance
3315
+ */
3316
+ UDPUnicastConfig.create = function create(properties) {
3317
+ return new UDPUnicastConfig(properties);
3318
+ };
3319
+
3320
+ /**
3321
+ * Encodes the specified UDPUnicastConfig message. Does not implicitly {@link synapse.UDPUnicastConfig.verify|verify} messages.
3322
+ * @function encode
3323
+ * @memberof synapse.UDPUnicastConfig
3324
+ * @static
3325
+ * @param {synapse.IUDPUnicastConfig} message UDPUnicastConfig message or plain object to encode
3326
+ * @param {$protobuf.Writer} [writer] Writer to encode to
3327
+ * @returns {$protobuf.Writer} Writer
3328
+ */
3329
+ UDPUnicastConfig.encode = function encode(message, writer) {
3330
+ if (!writer)
3331
+ writer = $Writer.create();
3332
+ if (message.destinationAddress != null && Object.hasOwnProperty.call(message, "destinationAddress"))
3333
+ writer.uint32(/* id 1, wireType 2 =*/10).string(message.destinationAddress);
3334
+ if (message.destinationPort != null && Object.hasOwnProperty.call(message, "destinationPort"))
3335
+ writer.uint32(/* id 2, wireType 0 =*/16).uint32(message.destinationPort);
3336
+ return writer;
3337
+ };
3338
+
3339
+ /**
3340
+ * Encodes the specified UDPUnicastConfig message, length delimited. Does not implicitly {@link synapse.UDPUnicastConfig.verify|verify} messages.
3341
+ * @function encodeDelimited
3342
+ * @memberof synapse.UDPUnicastConfig
3343
+ * @static
3344
+ * @param {synapse.IUDPUnicastConfig} message UDPUnicastConfig message or plain object to encode
3345
+ * @param {$protobuf.Writer} [writer] Writer to encode to
3346
+ * @returns {$protobuf.Writer} Writer
3347
+ */
3348
+ UDPUnicastConfig.encodeDelimited = function encodeDelimited(message, writer) {
3349
+ return this.encode(message, writer).ldelim();
3350
+ };
3351
+
3352
+ /**
3353
+ * Decodes a UDPUnicastConfig message from the specified reader or buffer.
3354
+ * @function decode
3355
+ * @memberof synapse.UDPUnicastConfig
3356
+ * @static
3357
+ * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from
3358
+ * @param {number} [length] Message length if known beforehand
3359
+ * @returns {synapse.UDPUnicastConfig} UDPUnicastConfig
3360
+ * @throws {Error} If the payload is not a reader or valid buffer
3361
+ * @throws {$protobuf.util.ProtocolError} If required fields are missing
3362
+ */
3363
+ UDPUnicastConfig.decode = function decode(reader, length) {
3364
+ if (!(reader instanceof $Reader))
3365
+ reader = $Reader.create(reader);
3366
+ var end = length === undefined ? reader.len : reader.pos + length, message = new $root.synapse.UDPUnicastConfig();
3367
+ while (reader.pos < end) {
3368
+ var tag = reader.uint32();
3369
+ switch (tag >>> 3) {
3370
+ case 1: {
3371
+ message.destinationAddress = reader.string();
3372
+ break;
3373
+ }
3374
+ case 2: {
3375
+ message.destinationPort = reader.uint32();
3376
+ break;
3377
+ }
3378
+ default:
3379
+ reader.skipType(tag & 7);
3380
+ break;
3381
+ }
3382
+ }
3383
+ return message;
3384
+ };
3385
+
3386
+ /**
3387
+ * Decodes a UDPUnicastConfig message from the specified reader or buffer, length delimited.
3388
+ * @function decodeDelimited
3389
+ * @memberof synapse.UDPUnicastConfig
3390
+ * @static
3391
+ * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from
3392
+ * @returns {synapse.UDPUnicastConfig} UDPUnicastConfig
3393
+ * @throws {Error} If the payload is not a reader or valid buffer
3394
+ * @throws {$protobuf.util.ProtocolError} If required fields are missing
3395
+ */
3396
+ UDPUnicastConfig.decodeDelimited = function decodeDelimited(reader) {
3397
+ if (!(reader instanceof $Reader))
3398
+ reader = new $Reader(reader);
3399
+ return this.decode(reader, reader.uint32());
3400
+ };
3401
+
3402
+ /**
3403
+ * Verifies a UDPUnicastConfig message.
3404
+ * @function verify
3405
+ * @memberof synapse.UDPUnicastConfig
3406
+ * @static
3407
+ * @param {Object.<string,*>} message Plain object to verify
3408
+ * @returns {string|null} `null` if valid, otherwise the reason why it is not
3409
+ */
3410
+ UDPUnicastConfig.verify = function verify(message) {
3411
+ if (typeof message !== "object" || message === null)
3412
+ return "object expected";
3413
+ if (message.destinationAddress != null && message.hasOwnProperty("destinationAddress"))
3414
+ if (!$util.isString(message.destinationAddress))
3415
+ return "destinationAddress: string expected";
3416
+ if (message.destinationPort != null && message.hasOwnProperty("destinationPort"))
3417
+ if (!$util.isInteger(message.destinationPort))
3418
+ return "destinationPort: integer expected";
3419
+ return null;
3420
+ };
3421
+
3422
+ /**
3423
+ * Creates a UDPUnicastConfig message from a plain object. Also converts values to their respective internal types.
3424
+ * @function fromObject
3425
+ * @memberof synapse.UDPUnicastConfig
3426
+ * @static
3427
+ * @param {Object.<string,*>} object Plain object
3428
+ * @returns {synapse.UDPUnicastConfig} UDPUnicastConfig
3429
+ */
3430
+ UDPUnicastConfig.fromObject = function fromObject(object) {
3431
+ if (object instanceof $root.synapse.UDPUnicastConfig)
3432
+ return object;
3433
+ var message = new $root.synapse.UDPUnicastConfig();
3434
+ if (object.destinationAddress != null)
3435
+ message.destinationAddress = String(object.destinationAddress);
3436
+ if (object.destinationPort != null)
3437
+ message.destinationPort = object.destinationPort >>> 0;
3438
+ return message;
3439
+ };
3440
+
3441
+ /**
3442
+ * Creates a plain object from a UDPUnicastConfig message. Also converts values to other types if specified.
3443
+ * @function toObject
3444
+ * @memberof synapse.UDPUnicastConfig
3445
+ * @static
3446
+ * @param {synapse.UDPUnicastConfig} message UDPUnicastConfig
3447
+ * @param {$protobuf.IConversionOptions} [options] Conversion options
3448
+ * @returns {Object.<string,*>} Plain object
3449
+ */
3450
+ UDPUnicastConfig.toObject = function toObject(message, options) {
3451
+ if (!options)
3452
+ options = {};
3453
+ var object = {};
3454
+ if (options.defaults) {
3455
+ object.destinationAddress = "";
3456
+ object.destinationPort = 0;
3457
+ }
3458
+ if (message.destinationAddress != null && message.hasOwnProperty("destinationAddress"))
3459
+ object.destinationAddress = message.destinationAddress;
3460
+ if (message.destinationPort != null && message.hasOwnProperty("destinationPort"))
3461
+ object.destinationPort = message.destinationPort;
3462
+ return object;
3463
+ };
3464
+
3465
+ /**
3466
+ * Converts this UDPUnicastConfig to JSON.
3467
+ * @function toJSON
3468
+ * @memberof synapse.UDPUnicastConfig
3469
+ * @instance
3470
+ * @returns {Object.<string,*>} JSON object
3471
+ */
3472
+ UDPUnicastConfig.prototype.toJSON = function toJSON() {
3473
+ return this.constructor.toObject(this, $protobuf.util.toJSONOptions);
3474
+ };
3475
+
3476
+ /**
3477
+ * Gets the default type url for UDPUnicastConfig
3478
+ * @function getTypeUrl
3479
+ * @memberof synapse.UDPUnicastConfig
3480
+ * @static
3481
+ * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com")
3482
+ * @returns {string} The default type url
3483
+ */
3484
+ UDPUnicastConfig.getTypeUrl = function getTypeUrl(typeUrlPrefix) {
3485
+ if (typeUrlPrefix === undefined) {
3486
+ typeUrlPrefix = "type.googleapis.com";
3487
+ }
3488
+ return typeUrlPrefix + "/synapse.UDPUnicastConfig";
3489
+ };
3490
+
3491
+ return UDPUnicastConfig;
3492
+ })();
3493
+
3267
3494
  synapse.StreamOutConfig = (function() {
3268
3495
 
3269
3496
  /**
@@ -3271,13 +3498,14 @@
3271
3498
  * @memberof synapse
3272
3499
  * @interface IStreamOutConfig
3273
3500
  * @property {string|null} [label] StreamOutConfig label
3274
- * @property {string|null} [multicastGroup] StreamOutConfig multicastGroup
3501
+ * @property {synapse.IUDPUnicastConfig|null} [udpUnicast] StreamOutConfig udpUnicast
3275
3502
  */
3276
3503
 
3277
3504
  /**
3278
3505
  * Constructs a new StreamOutConfig.
3279
3506
  * @memberof synapse
3280
- * @classdesc Represents a StreamOutConfig.
3507
+ * @classdesc StreamOutConfig defines the configuration for an outbound data stream.
3508
+ * Clients can request to create a new outbound stream by providing a transport
3281
3509
  * @implements IStreamOutConfig
3282
3510
  * @constructor
3283
3511
  * @param {synapse.IStreamOutConfig=} [properties] Properties to set
@@ -3298,12 +3526,26 @@
3298
3526
  StreamOutConfig.prototype.label = "";
3299
3527
 
3300
3528
  /**
3301
- * StreamOutConfig multicastGroup.
3302
- * @member {string} multicastGroup
3529
+ * StreamOutConfig udpUnicast.
3530
+ * @member {synapse.IUDPUnicastConfig|null|undefined} udpUnicast
3303
3531
  * @memberof synapse.StreamOutConfig
3304
3532
  * @instance
3305
3533
  */
3306
- StreamOutConfig.prototype.multicastGroup = "";
3534
+ StreamOutConfig.prototype.udpUnicast = null;
3535
+
3536
+ // OneOf field names bound to virtual getters and setters
3537
+ var $oneOfFields;
3538
+
3539
+ /**
3540
+ * StreamOutConfig transport.
3541
+ * @member {"udpUnicast"|undefined} transport
3542
+ * @memberof synapse.StreamOutConfig
3543
+ * @instance
3544
+ */
3545
+ Object.defineProperty(StreamOutConfig.prototype, "transport", {
3546
+ get: $util.oneOfGetter($oneOfFields = ["udpUnicast"]),
3547
+ set: $util.oneOfSetter($oneOfFields)
3548
+ });
3307
3549
 
3308
3550
  /**
3309
3551
  * Creates a new StreamOutConfig instance using the specified properties.
@@ -3331,8 +3573,8 @@
3331
3573
  writer = $Writer.create();
3332
3574
  if (message.label != null && Object.hasOwnProperty.call(message, "label"))
3333
3575
  writer.uint32(/* id 1, wireType 2 =*/10).string(message.label);
3334
- if (message.multicastGroup != null && Object.hasOwnProperty.call(message, "multicastGroup"))
3335
- writer.uint32(/* id 2, wireType 2 =*/18).string(message.multicastGroup);
3576
+ if (message.udpUnicast != null && Object.hasOwnProperty.call(message, "udpUnicast"))
3577
+ $root.synapse.UDPUnicastConfig.encode(message.udpUnicast, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim();
3336
3578
  return writer;
3337
3579
  };
3338
3580
 
@@ -3372,7 +3614,7 @@
3372
3614
  break;
3373
3615
  }
3374
3616
  case 2: {
3375
- message.multicastGroup = reader.string();
3617
+ message.udpUnicast = $root.synapse.UDPUnicastConfig.decode(reader, reader.uint32());
3376
3618
  break;
3377
3619
  }
3378
3620
  default:
@@ -3410,12 +3652,18 @@
3410
3652
  StreamOutConfig.verify = function verify(message) {
3411
3653
  if (typeof message !== "object" || message === null)
3412
3654
  return "object expected";
3655
+ var properties = {};
3413
3656
  if (message.label != null && message.hasOwnProperty("label"))
3414
3657
  if (!$util.isString(message.label))
3415
3658
  return "label: string expected";
3416
- if (message.multicastGroup != null && message.hasOwnProperty("multicastGroup"))
3417
- if (!$util.isString(message.multicastGroup))
3418
- return "multicastGroup: string expected";
3659
+ if (message.udpUnicast != null && message.hasOwnProperty("udpUnicast")) {
3660
+ properties.transport = 1;
3661
+ {
3662
+ var error = $root.synapse.UDPUnicastConfig.verify(message.udpUnicast);
3663
+ if (error)
3664
+ return "udpUnicast." + error;
3665
+ }
3666
+ }
3419
3667
  return null;
3420
3668
  };
3421
3669
 
@@ -3433,8 +3681,11 @@
3433
3681
  var message = new $root.synapse.StreamOutConfig();
3434
3682
  if (object.label != null)
3435
3683
  message.label = String(object.label);
3436
- if (object.multicastGroup != null)
3437
- message.multicastGroup = String(object.multicastGroup);
3684
+ if (object.udpUnicast != null) {
3685
+ if (typeof object.udpUnicast !== "object")
3686
+ throw TypeError(".synapse.StreamOutConfig.udpUnicast: object expected");
3687
+ message.udpUnicast = $root.synapse.UDPUnicastConfig.fromObject(object.udpUnicast);
3688
+ }
3438
3689
  return message;
3439
3690
  };
3440
3691
 
@@ -3451,14 +3702,15 @@
3451
3702
  if (!options)
3452
3703
  options = {};
3453
3704
  var object = {};
3454
- if (options.defaults) {
3705
+ if (options.defaults)
3455
3706
  object.label = "";
3456
- object.multicastGroup = "";
3457
- }
3458
3707
  if (message.label != null && message.hasOwnProperty("label"))
3459
3708
  object.label = message.label;
3460
- if (message.multicastGroup != null && message.hasOwnProperty("multicastGroup"))
3461
- object.multicastGroup = message.multicastGroup;
3709
+ if (message.udpUnicast != null && message.hasOwnProperty("udpUnicast")) {
3710
+ object.udpUnicast = $root.synapse.UDPUnicastConfig.toObject(message.udpUnicast, options);
3711
+ if (options.oneofs)
3712
+ object.transport = "udpUnicast";
3713
+ }
3462
3714
  return object;
3463
3715
  };
3464
3716
 
@@ -3498,12 +3750,14 @@
3498
3750
  * @memberof synapse
3499
3751
  * @interface IStreamOutStatus
3500
3752
  * @property {number|null} [throughputMbps] StreamOutStatus throughputMbps
3753
+ * @property {Long|null} [failedSendCount] StreamOutStatus failedSendCount
3501
3754
  */
3502
3755
 
3503
3756
  /**
3504
3757
  * Constructs a new StreamOutStatus.
3505
3758
  * @memberof synapse
3506
- * @classdesc Represents a StreamOutStatus.
3759
+ * @classdesc StreamOutStatus provides status information for an outbound stream.
3760
+ * It contains data about the instantaneous performance of the stream
3507
3761
  * @implements IStreamOutStatus
3508
3762
  * @constructor
3509
3763
  * @param {synapse.IStreamOutStatus=} [properties] Properties to set
@@ -3523,6 +3777,14 @@
3523
3777
  */
3524
3778
  StreamOutStatus.prototype.throughputMbps = 0;
3525
3779
 
3780
+ /**
3781
+ * StreamOutStatus failedSendCount.
3782
+ * @member {Long} failedSendCount
3783
+ * @memberof synapse.StreamOutStatus
3784
+ * @instance
3785
+ */
3786
+ StreamOutStatus.prototype.failedSendCount = $util.Long ? $util.Long.fromBits(0,0,true) : 0;
3787
+
3526
3788
  /**
3527
3789
  * Creates a new StreamOutStatus instance using the specified properties.
3528
3790
  * @function create
@@ -3549,6 +3811,8 @@
3549
3811
  writer = $Writer.create();
3550
3812
  if (message.throughputMbps != null && Object.hasOwnProperty.call(message, "throughputMbps"))
3551
3813
  writer.uint32(/* id 1, wireType 5 =*/13).float(message.throughputMbps);
3814
+ if (message.failedSendCount != null && Object.hasOwnProperty.call(message, "failedSendCount"))
3815
+ writer.uint32(/* id 2, wireType 0 =*/16).uint64(message.failedSendCount);
3552
3816
  return writer;
3553
3817
  };
3554
3818
 
@@ -3587,6 +3851,10 @@
3587
3851
  message.throughputMbps = reader.float();
3588
3852
  break;
3589
3853
  }
3854
+ case 2: {
3855
+ message.failedSendCount = reader.uint64();
3856
+ break;
3857
+ }
3590
3858
  default:
3591
3859
  reader.skipType(tag & 7);
3592
3860
  break;
@@ -3625,6 +3893,9 @@
3625
3893
  if (message.throughputMbps != null && message.hasOwnProperty("throughputMbps"))
3626
3894
  if (typeof message.throughputMbps !== "number")
3627
3895
  return "throughputMbps: number expected";
3896
+ if (message.failedSendCount != null && message.hasOwnProperty("failedSendCount"))
3897
+ if (!$util.isInteger(message.failedSendCount) && !(message.failedSendCount && $util.isInteger(message.failedSendCount.low) && $util.isInteger(message.failedSendCount.high)))
3898
+ return "failedSendCount: integer|Long expected";
3628
3899
  return null;
3629
3900
  };
3630
3901
 
@@ -3642,6 +3913,15 @@
3642
3913
  var message = new $root.synapse.StreamOutStatus();
3643
3914
  if (object.throughputMbps != null)
3644
3915
  message.throughputMbps = Number(object.throughputMbps);
3916
+ if (object.failedSendCount != null)
3917
+ if ($util.Long)
3918
+ (message.failedSendCount = $util.Long.fromValue(object.failedSendCount)).unsigned = true;
3919
+ else if (typeof object.failedSendCount === "string")
3920
+ message.failedSendCount = parseInt(object.failedSendCount, 10);
3921
+ else if (typeof object.failedSendCount === "number")
3922
+ message.failedSendCount = object.failedSendCount;
3923
+ else if (typeof object.failedSendCount === "object")
3924
+ message.failedSendCount = new $util.LongBits(object.failedSendCount.low >>> 0, object.failedSendCount.high >>> 0).toNumber(true);
3645
3925
  return message;
3646
3926
  };
3647
3927
 
@@ -3658,10 +3938,21 @@
3658
3938
  if (!options)
3659
3939
  options = {};
3660
3940
  var object = {};
3661
- if (options.defaults)
3941
+ if (options.defaults) {
3662
3942
  object.throughputMbps = 0;
3943
+ if ($util.Long) {
3944
+ var long = new $util.Long(0, 0, true);
3945
+ object.failedSendCount = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long;
3946
+ } else
3947
+ object.failedSendCount = options.longs === String ? "0" : 0;
3948
+ }
3663
3949
  if (message.throughputMbps != null && message.hasOwnProperty("throughputMbps"))
3664
3950
  object.throughputMbps = options.json && !isFinite(message.throughputMbps) ? String(message.throughputMbps) : message.throughputMbps;
3951
+ if (message.failedSendCount != null && message.hasOwnProperty("failedSendCount"))
3952
+ if (typeof message.failedSendCount === "number")
3953
+ object.failedSendCount = options.longs === String ? String(message.failedSendCount) : message.failedSendCount;
3954
+ else
3955
+ object.failedSendCount = options.longs === String ? $util.Long.prototype.toString.call(message.failedSendCount) : options.longs === Number ? new $util.LongBits(message.failedSendCount.low >>> 0, message.failedSendCount.high >>> 0).toNumber(true) : message.failedSendCount;
3665
3956
  return object;
3666
3957
  };
3667
3958
 
@@ -223,14 +223,33 @@
223
223
  }
224
224
  }
225
225
  },
226
+ "UDPUnicastConfig": {
227
+ "fields": {
228
+ "destinationAddress": {
229
+ "type": "string",
230
+ "id": 1
231
+ },
232
+ "destinationPort": {
233
+ "type": "uint32",
234
+ "id": 2
235
+ }
236
+ }
237
+ },
226
238
  "StreamOutConfig": {
239
+ "oneofs": {
240
+ "transport": {
241
+ "oneof": [
242
+ "udpUnicast"
243
+ ]
244
+ }
245
+ },
227
246
  "fields": {
228
247
  "label": {
229
248
  "type": "string",
230
249
  "id": 1
231
250
  },
232
- "multicastGroup": {
233
- "type": "string",
251
+ "udpUnicast": {
252
+ "type": "UDPUnicastConfig",
234
253
  "id": 2
235
254
  }
236
255
  }
@@ -240,6 +259,10 @@
240
259
  "throughputMbps": {
241
260
  "type": "float",
242
261
  "id": 1
262
+ },
263
+ "failedSendCount": {
264
+ "type": "uint64",
265
+ "id": 2
243
266
  }
244
267
  }
245
268
  },
package/src/config.ts CHANGED
@@ -1,6 +1,7 @@
1
1
  import Node from "./node";
2
2
  import { synapse } from "./api/api";
3
3
  import BroadbandSource from "./nodes/broadband_source";
4
+ import DiskWriter from "./nodes/disk_writer";
4
5
  import ElectricalStimulation from "./nodes/electrical_stimulation";
5
6
  import OpticalStimulation from "./nodes/optical_stimulation";
6
7
  import SpectralFilter from "./nodes/spectral_filter";
@@ -13,6 +14,7 @@ import { Status, StatusCode } from "./utils/status";
13
14
  type Connection = [number, number];
14
15
  const kNodeTypeObjectMap = {
15
16
  [synapse.NodeType.kBroadbandSource]: BroadbandSource,
17
+ [synapse.NodeType.kDiskWriter]: DiskWriter,
16
18
  [synapse.NodeType.kElectricalStimulation]: ElectricalStimulation,
17
19
  [synapse.NodeType.kSpikeSource]: SpikeSource,
18
20
  [synapse.NodeType.kOpticalStimulation]: OpticalStimulation,
package/src/demo.ts CHANGED
@@ -11,15 +11,17 @@ import StreamIn from "./nodes/stream_in";
11
11
  import StreamOut from "./nodes/stream_out";
12
12
  import { discover } from "./utils/discover";
13
13
  import { getName } from "./utils/enum";
14
+ import { getClientIp } from "./utils/ip";
14
15
 
15
16
  const cli = yargs(hideBin(process.argv))
16
17
  .help()
17
18
  .command("discover", "Discover synapse devices")
18
19
  .command("read", "Read from StreamOut node", {
19
- "multicast-group": {
20
- alias: "m",
20
+ "udp-port": {
21
+ alias: "p",
21
22
  type: "string",
22
- description: "Multicast group",
23
+ description: "UDP port",
24
+ default: "50038",
23
25
  },
24
26
  output: {
25
27
  alias: "o",
@@ -93,7 +95,7 @@ const info = async (device: Device) => {
93
95
  const read = async (device: Device, argv: any) => {
94
96
  console.log("Reading from device's StreamOut node...");
95
97
 
96
- const { multicastGroup, output } = argv;
98
+ const { udpPort, output } = argv;
97
99
  let status = null;
98
100
  let stream = null;
99
101
  if (output) {
@@ -111,7 +113,7 @@ const read = async (device: Device, argv: any) => {
111
113
 
112
114
  const config = new Config();
113
115
  const nodeEphys = new ElectricalBroadband({
114
- peripheralId: 3,
116
+ peripheralId: 100,
115
117
  signal: {
116
118
  electrode: {
117
119
  channels: [{ id: 0, referenceId: 0, electrodeId: 1 }],
@@ -122,9 +124,12 @@ const read = async (device: Device, argv: any) => {
122
124
  });
123
125
  const nodeStreamOut = new StreamOut(
124
126
  {
125
- multicastGroup,
127
+ udpUnicast: {
128
+ destinationPort: udpPort,
129
+ destinationAddress: await getClientIp(),
130
+ },
126
131
  },
127
- onMessage
132
+ { onMessage }
128
133
  );
129
134
 
130
135
  status = config.add([nodeEphys, nodeStreamOut]);
@@ -148,7 +153,11 @@ const read = async (device: Device, argv: any) => {
148
153
  return;
149
154
  }
150
155
 
151
- nodeStreamOut.start();
156
+ status = await nodeStreamOut.start();
157
+ if (!status.ok()) {
158
+ console.error("failed to start stream out node: ", status.message);
159
+ return;
160
+ }
152
161
 
153
162
  let running = true;
154
163
  process.on("SIGINT", function () {
@@ -159,6 +168,7 @@ const read = async (device: Device, argv: any) => {
159
168
  running = false;
160
169
  nodeStreamOut.stop();
161
170
  device.stop();
171
+ process.exit();
162
172
  });
163
173
  };
164
174
 
@@ -280,7 +290,9 @@ const main = async () => {
280
290
  if (argv._.includes("discover")) {
281
291
  const devices = await discover();
282
292
  for (const device of devices) {
283
- console.log(`${device.host}:${device.port} ${device.capability} ${device.name} (${device.serial})`);
293
+ const addr = `${device.host}:${device.port}`;
294
+ const serial = `[${device.serial}]`;
295
+ console.log(`${addr.padEnd(21)} ${device.capability.padStart(16)} ${serial.padStart(34)} "${device.name}"`);
284
296
  }
285
297
  return;
286
298
  }
@@ -0,0 +1,30 @@
1
+ import { synapse } from "../api/api";
2
+ import Node from "../node";
3
+
4
+ class DiskWriter extends Node {
5
+ type = synapse.NodeType.kDiskWriter;
6
+ config: synapse.IDiskWriterConfig;
7
+
8
+ constructor(config: synapse.IDiskWriterConfig = {}) {
9
+ super();
10
+
11
+ this.config = config;
12
+ }
13
+
14
+ toProto(): synapse.NodeConfig {
15
+ return super.toProto({
16
+ diskWriter: this.config,
17
+ });
18
+ }
19
+
20
+ static fromProto(proto: synapse.INodeConfig): DiskWriter {
21
+ const { diskWriter } = proto;
22
+ if (!diskWriter) {
23
+ throw new Error("Invalid config, missing diskWriter");
24
+ }
25
+
26
+ return new DiskWriter(proto.diskWriter);
27
+ }
28
+ }
29
+
30
+ export default DiskWriter;
@@ -1,4 +1,5 @@
1
1
  export { default as BroadbandSource } from "./broadband_source";
2
+ export { default as DiskWriter } from "./disk_writer";
2
3
  export { default as ElectricalStimulation } from "./electrical_stimulation";
3
4
  export { default as OpticalStimulation } from "./optical_stimulation";
4
5
  export { default as SpectralFilter } from "./spectral_filter";