@libertas-ai/types 0.1.2 → 0.1.3

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 (2) hide show
  1. package/index.d.ts +29 -25
  2. package/package.json +1 -1
package/index.d.ts CHANGED
@@ -92,7 +92,7 @@ declare type LibertasDataStore = number;
92
92
  /**
93
93
  * Used to send broadcast data report in {@link libertasEndpointSendResponse}. It should be 0xffffffff.
94
94
  */
95
- declare const enum LibertasPeer {
95
+ declare enum LibertasPeer {
96
96
  Broadcast = 0xffffffff,
97
97
  }
98
98
 
@@ -105,7 +105,7 @@ declare const enum LibertasPeer {
105
105
  * @see {@link LibertasVirtualDeviceCallback}
106
106
  *
107
107
  */
108
- declare const enum LibertasDeviceAction {
108
+ declare enum LibertasDeviceAction {
109
109
  StatusResponse = 0x01,
110
110
  ReadRequest = 0x02,
111
111
  SubscribeRequest = 0x03,
@@ -352,7 +352,7 @@ declare type LibertasDeviceCallback = (device: LibertasDevice, action: LibertasD
352
352
  /**
353
353
  * Possible interactions of an endpoint connection.
354
354
  */
355
- declare const enum LibertasEndpointAction {
355
+ declare enum LibertasEndpointAction {
356
356
  /// endpoint subscription request opcode.
357
357
  SubscriptionRequest = 3,
358
358
  /// endpoint data message opcode.
@@ -368,17 +368,17 @@ declare const enum LibertasEndpointAction {
368
368
  /**
369
369
  * The signature of a virtual device I/O callback function.
370
370
  *
371
- * @param device A {@link LibertasDevice}.
372
- * @param ref The reference number of the original request. See remarks.
371
+ * @param device A {@link LibertasVirtualDevice}.
372
+ * @param peer Uniquely identifies a peer as subscription ID. See remarks.
373
+ * @param transId The transaction Id of the original request. See remarks.
373
374
  * @param action The {@link LibertasDeviceAction}. See remarks
374
375
  * @param data The request data. It's a union type. The value shall be cast to a type decided by action.
375
376
  * @param tag The arbitrary data passed to {@link libertasSetOnVirtualDevice} with the callback instance.
376
- * @param peer Uniquely identifies a peer as subscription ID. See remarks.
377
377
  *
378
378
  * @see {@link libertasSetOnVirtualDevice}
379
379
  *
380
- * @remarks The callback is used to notify the virtual device of a request. Each request has an internally assigned ref number by the engine.
381
- * The ref number must be passed back in the corresponding response.
380
+ * @remarks The callback is used to notify the virtual device of a request. Each request has an internally assigned transaction ID (transId) by the engine.
381
+ * The transId must be passed back in the corresponding response.
382
382
  *
383
383
  * Valid actions:
384
384
  * {@link LibertasDeviceAction.ReadRequest}, {@link LibertasDeviceAction.SubscribeRequest}, and {@link LibertasDeviceAction.ReportData} all request attribute data. {@link LibertasDeviceAction.ReadRequest}
@@ -387,7 +387,7 @@ declare const enum LibertasEndpointAction {
387
387
  * calculate interval duration for more flexible subscrption delivery. A virtual device may even respond more data than requested if the common dirty-marking algorithm is not adequate.
388
388
  */
389
389
 
390
- declare type LibertasVirtualDeviceCallback = (device: LibertasVirtualDevice, ref: number, action: LibertasDeviceAction, data: LibertasVirtualDeviceReq, tag?: any, peer?: number) => void;
390
+ declare type LibertasVirtualDeviceCallback = (device: LibertasVirtualDevice, peer: number, transId: number, action: LibertasDeviceAction, data: LibertasVirtualDeviceReq, tag?: any) => void;
391
391
 
392
392
  /**
393
393
  * Callback of an endpoint connection.
@@ -570,40 +570,44 @@ declare function libertasVirtualDeviceUpdateEvents(device: LibertasVirtualDevice
570
570
  /**
571
571
  * Update attributes unsolicited, or in response to a ReadRequest or SubscribeRequest.
572
572
  * @param device A {@link LibertasVirtualDevice}.
573
- * @param ref The ref number of the request.
573
+ * @param peer The peer taskId.
574
+ * @param transId The transaction Id of the request.
574
575
  * @param attributes An array of {@link LibertasClusterReport}. Note that the events and eventStatus are undefined. Use {@link libertasVirtualDeviceUpdateEvents} to write events.
575
576
  *
576
577
  * @remarks
577
578
  * The framework will maintain a cache of all attributes.
578
579
  *
579
- * If a ref number is present, a read response or a report in response to this referenced request will be immediately sent out;
580
+ * If a transId is present, a read response or a report in response to this referenced request will be immediately sent out;
580
581
  * otherwise the Libertas OS engine will decide when to send out the subscription reports.
581
582
  */
582
- declare function libertasVirtualDeviceAttributesRsp(device: LibertasVirtualDevice, ref: number, attributes: LibertasClusterReport[]) : void;
583
+ declare function libertasVirtualDeviceAttributesRsp(device: LibertasVirtualDevice, peer: number, transId: number, attributes: LibertasClusterReport[]) : void;
583
584
 
584
- /**
585
+ /**
585
586
  * Send out command responses.
586
587
  * @param device A {@link LibertasVirtualDevice}.
587
- * @param ref The ref number of the request.
588
+ * @param peer The peer taskId.
589
+ * @param transId The transaction Id of the request.
588
590
  * @param rsp A {@link LibertasCommandRsp}.
589
591
  */
590
- declare function libertasVirtualDeviceCommandRsp(device: LibertasVirtualDevice, ref: number, rsp: LibertasCommandRsp) : void;
592
+ declare function libertasVirtualDeviceCommandRsp(device: LibertasVirtualDevice, peer: number, transId: number, rsp: LibertasCommandRsp) : void;
591
593
 
592
- /**
594
+ /**
593
595
  * Send out write response.
594
596
  * @param device A {@link LibertasVirtualDevice}.
595
- * @param ref The ref number of the request.
597
+ * @param peer The peer taskId.
598
+ * @param transId The transaction Id of the request.
596
599
  * @param responses An array of {@link LibertasClusterWriteRsp}.
597
600
  */
598
- declare function libertasVirtualDeviceWriteRsp(device: LibertasVirtualDevice, ref: number, responses: LibertasClusterWriteRsp[]) : void;
601
+ declare function libertasVirtualDeviceWriteRsp(device: LibertasVirtualDevice, peer: number, transId: number, responses: LibertasClusterWriteRsp[]) : void;
599
602
 
600
- /**
603
+ /**
601
604
  * Send out an error status code against an incoming request.
602
605
  * @param device A {@link LibertasVirtualDevice}.
603
- * @param ref The ref number of the request.
606
+ * @param peer The peer taskId.
607
+ * @param transId The transaction Id of the request.
604
608
  * @param status A {@link Matter.Status}.
605
609
  */
606
- declare function libertasVirtualDeviceStatusRsp(device: LibertasVirtualDevice, ref: number, status: number) : void;
610
+ declare function libertasVirtualDeviceStatusRsp(device: LibertasVirtualDevice, peer: number, transId: number, status: number) : void;
607
611
 
608
612
  /**
609
613
  * Listen to a virtual device events.
@@ -772,7 +776,7 @@ declare function libertasTriggerAction(action: LibertasAction): void;
772
776
  * - `AlertHigh`: High alerts.
773
777
  * - `AlertSevere`: Severe alerts.
774
778
  */
775
- declare const enum NotificationImportance {
779
+ declare enum NotificationImportance {
776
780
  Debug = 0,
777
781
  Info = 1,
778
782
  AlertLow = 2,
@@ -785,7 +789,7 @@ declare const enum NotificationImportance {
785
789
  /**
786
790
  * Notification argument variant tags.
787
791
  */
788
- declare const enum NotificationArgTag {
792
+ declare enum NotificationArgTag {
789
793
  /**
790
794
  * A literal string argument included in the message as-is, without being
791
795
  * treated as a resource string. This can be used to include specific text that
@@ -936,7 +940,7 @@ declare interface DataName {
936
940
  arguments: NotificationArgument[];
937
941
  }
938
942
 
939
- declare const enum IndexDirection {
943
+ declare enum IndexDirection {
940
944
  Above,
941
945
  Below,
942
946
  }
@@ -1137,7 +1141,7 @@ declare function libertasDataReadIndexed<T>(
1137
1141
  /**
1138
1142
  * Log levels
1139
1143
  */
1140
- declare const enum LibertasLogLevel {
1144
+ declare enum LibertasLogLevel {
1141
1145
  TRACE,
1142
1146
  DEBUG,
1143
1147
  INFO,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@libertas-ai/types",
3
- "version": "0.1.2",
3
+ "version": "0.1.3",
4
4
  "description": "Libertas TypeScript SDK",
5
5
  "license": "ISC",
6
6
  "author": "Qingjun Wei",