@matter/protocol 0.13.1-alpha.0-20250520-d699cd56d → 0.14.0-alpha.0-20250524-51a7e1721
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.
- package/dist/cjs/action/Interactable.d.ts +1 -1
- package/dist/cjs/action/Interactable.d.ts.map +1 -1
- package/dist/cjs/action/client/ClientInteraction.d.ts +1 -1
- package/dist/cjs/action/client/ClientInteraction.d.ts.map +1 -1
- package/dist/cjs/action/client/ClientInteraction.js +50 -8
- package/dist/cjs/action/client/ClientInteraction.js.map +1 -1
- package/dist/cjs/action/protocols.d.ts +49 -15
- package/dist/cjs/action/protocols.d.ts.map +1 -1
- package/dist/cjs/action/request/Invoke.d.ts +10 -1
- package/dist/cjs/action/request/Invoke.d.ts.map +1 -1
- package/dist/cjs/action/request/Invoke.js +17 -5
- package/dist/cjs/action/request/Invoke.js.map +1 -1
- package/dist/cjs/action/request/Read.d.ts.map +1 -1
- package/dist/cjs/action/request/Read.js +1 -1
- package/dist/cjs/action/request/Read.js.map +1 -1
- package/dist/cjs/action/request/Write.d.ts +2 -0
- package/dist/cjs/action/request/Write.d.ts.map +1 -1
- package/dist/cjs/action/request/Write.js.map +1 -1
- package/dist/cjs/action/response/InvokeResult.d.ts +22 -6
- package/dist/cjs/action/response/InvokeResult.d.ts.map +1 -1
- package/dist/cjs/action/server/AttributeReadResponse.d.ts.map +1 -1
- package/dist/cjs/action/server/AttributeReadResponse.js +1 -2
- package/dist/cjs/action/server/AttributeReadResponse.js.map +2 -2
- package/dist/cjs/action/server/AttributeWriteResponse.d.ts.map +1 -1
- package/dist/cjs/action/server/AttributeWriteResponse.js +1 -14
- package/dist/cjs/action/server/AttributeWriteResponse.js.map +1 -1
- package/dist/cjs/action/server/CommandInvokeResponse.d.ts +25 -0
- package/dist/cjs/action/server/CommandInvokeResponse.d.ts.map +1 -0
- package/dist/cjs/action/server/CommandInvokeResponse.js +331 -0
- package/dist/cjs/action/server/CommandInvokeResponse.js.map +6 -0
- package/dist/cjs/action/server/EventReadResponse.js +1 -1
- package/dist/cjs/action/server/ServerInteraction.d.ts +1 -3
- package/dist/cjs/action/server/ServerInteraction.d.ts.map +1 -1
- package/dist/cjs/action/server/ServerInteraction.js +4 -2
- package/dist/cjs/action/server/ServerInteraction.js.map +1 -1
- package/dist/cjs/action/server/index.d.ts +1 -0
- package/dist/cjs/action/server/index.d.ts.map +1 -1
- package/dist/cjs/action/server/index.js +1 -0
- package/dist/cjs/action/server/index.js.map +1 -1
- package/dist/cjs/cluster/client/AttributeClient.d.ts +2 -0
- package/dist/cjs/cluster/client/AttributeClient.d.ts.map +1 -1
- package/dist/cjs/cluster/client/AttributeClient.js +10 -0
- package/dist/cjs/cluster/client/AttributeClient.js.map +1 -1
- package/dist/cjs/cluster/client/ClusterClientTypes.d.ts +0 -4
- package/dist/cjs/cluster/client/ClusterClientTypes.d.ts.map +1 -1
- package/dist/cjs/cluster/index.d.ts +0 -1
- package/dist/cjs/cluster/index.d.ts.map +1 -1
- package/dist/cjs/cluster/index.js +0 -1
- package/dist/cjs/cluster/index.js.map +1 -1
- package/dist/cjs/events/OccurrenceManager.d.ts +10 -2
- package/dist/cjs/events/OccurrenceManager.d.ts.map +1 -1
- package/dist/cjs/events/OccurrenceManager.js +57 -11
- package/dist/cjs/events/OccurrenceManager.js.map +1 -1
- package/dist/cjs/fabric/Fabric.d.ts +2 -11
- package/dist/cjs/fabric/Fabric.d.ts.map +1 -1
- package/dist/cjs/fabric/Fabric.js +1 -38
- package/dist/cjs/fabric/Fabric.js.map +1 -1
- package/dist/cjs/index.d.ts +0 -1
- package/dist/cjs/index.d.ts.map +1 -1
- package/dist/cjs/index.js +0 -1
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/interaction/AttributeDataEncoder.d.ts +1 -1
- package/dist/cjs/interaction/InteractionClient.d.ts +13 -0
- package/dist/cjs/interaction/InteractionClient.d.ts.map +1 -1
- package/dist/cjs/interaction/InteractionClient.js +14 -0
- package/dist/cjs/interaction/InteractionClient.js.map +1 -1
- package/dist/cjs/interaction/InteractionMessenger.d.ts +8 -8
- package/dist/cjs/interaction/index.d.ts +0 -1
- package/dist/cjs/interaction/index.d.ts.map +1 -1
- package/dist/cjs/interaction/index.js +0 -1
- package/dist/cjs/interaction/index.js.map +1 -1
- package/dist/cjs/mdns/MdnsScanner.d.ts +23 -1
- package/dist/cjs/mdns/MdnsScanner.d.ts.map +1 -1
- package/dist/cjs/mdns/MdnsScanner.js +124 -11
- package/dist/cjs/mdns/MdnsScanner.js.map +2 -2
- package/dist/esm/action/Interactable.d.ts +1 -1
- package/dist/esm/action/Interactable.d.ts.map +1 -1
- package/dist/esm/action/client/ClientInteraction.d.ts +1 -1
- package/dist/esm/action/client/ClientInteraction.d.ts.map +1 -1
- package/dist/esm/action/client/ClientInteraction.js +50 -8
- package/dist/esm/action/client/ClientInteraction.js.map +1 -1
- package/dist/esm/action/protocols.d.ts +49 -15
- package/dist/esm/action/protocols.d.ts.map +1 -1
- package/dist/esm/action/request/Invoke.d.ts +10 -1
- package/dist/esm/action/request/Invoke.d.ts.map +1 -1
- package/dist/esm/action/request/Invoke.js +17 -5
- package/dist/esm/action/request/Invoke.js.map +1 -1
- package/dist/esm/action/request/Read.d.ts.map +1 -1
- package/dist/esm/action/request/Read.js +1 -1
- package/dist/esm/action/request/Read.js.map +1 -1
- package/dist/esm/action/request/Write.d.ts +2 -0
- package/dist/esm/action/request/Write.d.ts.map +1 -1
- package/dist/esm/action/request/Write.js.map +1 -1
- package/dist/esm/action/response/InvokeResult.d.ts +22 -6
- package/dist/esm/action/response/InvokeResult.d.ts.map +1 -1
- package/dist/esm/action/server/AttributeReadResponse.d.ts.map +1 -1
- package/dist/esm/action/server/AttributeReadResponse.js +1 -1
- package/dist/esm/action/server/AttributeReadResponse.js.map +1 -1
- package/dist/esm/action/server/AttributeWriteResponse.d.ts.map +1 -1
- package/dist/esm/action/server/AttributeWriteResponse.js +2 -15
- package/dist/esm/action/server/AttributeWriteResponse.js.map +1 -1
- package/dist/esm/action/server/CommandInvokeResponse.d.ts +25 -0
- package/dist/esm/action/server/CommandInvokeResponse.d.ts.map +1 -0
- package/dist/esm/action/server/CommandInvokeResponse.js +317 -0
- package/dist/esm/action/server/CommandInvokeResponse.js.map +6 -0
- package/dist/esm/action/server/EventReadResponse.js +1 -1
- package/dist/esm/action/server/ServerInteraction.d.ts +1 -3
- package/dist/esm/action/server/ServerInteraction.d.ts.map +1 -1
- package/dist/esm/action/server/ServerInteraction.js +4 -2
- package/dist/esm/action/server/ServerInteraction.js.map +1 -1
- package/dist/esm/action/server/index.d.ts +1 -0
- package/dist/esm/action/server/index.d.ts.map +1 -1
- package/dist/esm/action/server/index.js +1 -0
- package/dist/esm/action/server/index.js.map +1 -1
- package/dist/esm/cluster/client/AttributeClient.d.ts +2 -0
- package/dist/esm/cluster/client/AttributeClient.d.ts.map +1 -1
- package/dist/esm/cluster/client/AttributeClient.js +10 -0
- package/dist/esm/cluster/client/AttributeClient.js.map +1 -1
- package/dist/esm/cluster/client/ClusterClientTypes.d.ts +0 -4
- package/dist/esm/cluster/client/ClusterClientTypes.d.ts.map +1 -1
- package/dist/esm/cluster/index.d.ts +0 -1
- package/dist/esm/cluster/index.d.ts.map +1 -1
- package/dist/esm/cluster/index.js +0 -1
- package/dist/esm/cluster/index.js.map +1 -1
- package/dist/esm/events/OccurrenceManager.d.ts +10 -2
- package/dist/esm/events/OccurrenceManager.d.ts.map +1 -1
- package/dist/esm/events/OccurrenceManager.js +62 -12
- package/dist/esm/events/OccurrenceManager.js.map +1 -1
- package/dist/esm/fabric/Fabric.d.ts +2 -11
- package/dist/esm/fabric/Fabric.d.ts.map +1 -1
- package/dist/esm/fabric/Fabric.js +1 -38
- package/dist/esm/fabric/Fabric.js.map +1 -1
- package/dist/esm/index.d.ts +0 -1
- package/dist/esm/index.d.ts.map +1 -1
- package/dist/esm/index.js +0 -1
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/interaction/AttributeDataEncoder.d.ts +1 -1
- package/dist/esm/interaction/InteractionClient.d.ts +13 -0
- package/dist/esm/interaction/InteractionClient.d.ts.map +1 -1
- package/dist/esm/interaction/InteractionClient.js +14 -0
- package/dist/esm/interaction/InteractionClient.js.map +1 -1
- package/dist/esm/interaction/InteractionMessenger.d.ts +8 -8
- package/dist/esm/interaction/index.d.ts +0 -1
- package/dist/esm/interaction/index.d.ts.map +1 -1
- package/dist/esm/interaction/index.js +0 -1
- package/dist/esm/interaction/index.js.map +1 -1
- package/dist/esm/mdns/MdnsScanner.d.ts +23 -1
- package/dist/esm/mdns/MdnsScanner.d.ts.map +1 -1
- package/dist/esm/mdns/MdnsScanner.js +127 -11
- package/dist/esm/mdns/MdnsScanner.js.map +2 -2
- package/package.json +6 -6
- package/src/action/Interactable.ts +1 -1
- package/src/action/client/ClientInteraction.ts +53 -16
- package/src/action/protocols.ts +70 -16
- package/src/action/request/Invoke.ts +32 -5
- package/src/action/request/Read.ts +1 -1
- package/src/action/request/Write.ts +4 -1
- package/src/action/response/InvokeResult.ts +26 -6
- package/src/action/response/ReadResult.ts +1 -1
- package/src/action/server/AttributeReadResponse.ts +1 -1
- package/src/action/server/AttributeWriteResponse.ts +2 -20
- package/src/action/server/CommandInvokeResponse.ts +427 -0
- package/src/action/server/EventReadResponse.ts +1 -1
- package/src/action/server/ServerInteraction.ts +6 -5
- package/src/action/server/index.ts +1 -0
- package/src/cluster/client/AttributeClient.ts +12 -0
- package/src/cluster/client/ClusterClientTypes.ts +0 -6
- package/src/cluster/index.ts +0 -1
- package/src/events/OccurrenceManager.ts +91 -11
- package/src/fabric/Fabric.ts +1 -49
- package/src/index.ts +0 -1
- package/src/interaction/InteractionClient.ts +24 -0
- package/src/interaction/index.ts +0 -1
- package/src/mdns/MdnsScanner.ts +187 -12
- package/dist/cjs/cluster/server/AttributeServer.d.ts +0 -307
- package/dist/cjs/cluster/server/AttributeServer.d.ts.map +0 -1
- package/dist/cjs/cluster/server/AttributeServer.js +0 -736
- package/dist/cjs/cluster/server/AttributeServer.js.map +0 -6
- package/dist/cjs/cluster/server/ClusterDatasource.d.ts +0 -16
- package/dist/cjs/cluster/server/ClusterDatasource.d.ts.map +0 -1
- package/dist/cjs/cluster/server/ClusterDatasource.js +0 -22
- package/dist/cjs/cluster/server/ClusterDatasource.js.map +0 -6
- package/dist/cjs/cluster/server/ClusterServer.d.ts +0 -40
- package/dist/cjs/cluster/server/ClusterServer.d.ts.map +0 -1
- package/dist/cjs/cluster/server/ClusterServer.js +0 -22
- package/dist/cjs/cluster/server/ClusterServer.js.map +0 -6
- package/dist/cjs/cluster/server/CommandServer.d.ts +0 -34
- package/dist/cjs/cluster/server/CommandServer.d.ts.map +0 -1
- package/dist/cjs/cluster/server/CommandServer.js +0 -76
- package/dist/cjs/cluster/server/CommandServer.js.map +0 -6
- package/dist/cjs/cluster/server/EventServer.d.ts +0 -42
- package/dist/cjs/cluster/server/EventServer.d.ts.map +0 -1
- package/dist/cjs/cluster/server/EventServer.js +0 -152
- package/dist/cjs/cluster/server/EventServer.js.map +0 -6
- package/dist/cjs/cluster/server/index.d.ts +0 -11
- package/dist/cjs/cluster/server/index.d.ts.map +0 -1
- package/dist/cjs/cluster/server/index.js +0 -28
- package/dist/cjs/cluster/server/index.js.map +0 -6
- package/dist/cjs/endpoint/EndpointInterface.d.ts +0 -37
- package/dist/cjs/endpoint/EndpointInterface.d.ts.map +0 -1
- package/dist/cjs/endpoint/EndpointInterface.js +0 -22
- package/dist/cjs/endpoint/EndpointInterface.js.map +0 -6
- package/dist/cjs/endpoint/EndpointStructureLogger.d.ts +0 -31
- package/dist/cjs/endpoint/EndpointStructureLogger.d.ts.map +0 -1
- package/dist/cjs/endpoint/EndpointStructureLogger.js +0 -230
- package/dist/cjs/endpoint/EndpointStructureLogger.js.map +0 -6
- package/dist/cjs/endpoint/index.d.ts +0 -8
- package/dist/cjs/endpoint/index.d.ts.map +0 -1
- package/dist/cjs/endpoint/index.js +0 -25
- package/dist/cjs/endpoint/index.js.map +0 -6
- package/dist/cjs/interaction/InteractionEndpointStructure.d.ts +0 -95
- package/dist/cjs/interaction/InteractionEndpointStructure.d.ts.map +0 -1
- package/dist/cjs/interaction/InteractionEndpointStructure.js +0 -359
- package/dist/cjs/interaction/InteractionEndpointStructure.js.map +0 -6
- package/dist/esm/cluster/server/AttributeServer.d.ts +0 -307
- package/dist/esm/cluster/server/AttributeServer.d.ts.map +0 -1
- package/dist/esm/cluster/server/AttributeServer.js +0 -729
- package/dist/esm/cluster/server/AttributeServer.js.map +0 -6
- package/dist/esm/cluster/server/ClusterDatasource.d.ts +0 -16
- package/dist/esm/cluster/server/ClusterDatasource.d.ts.map +0 -1
- package/dist/esm/cluster/server/ClusterDatasource.js +0 -6
- package/dist/esm/cluster/server/ClusterDatasource.js.map +0 -6
- package/dist/esm/cluster/server/ClusterServer.d.ts +0 -40
- package/dist/esm/cluster/server/ClusterServer.d.ts.map +0 -1
- package/dist/esm/cluster/server/ClusterServer.js +0 -6
- package/dist/esm/cluster/server/ClusterServer.js.map +0 -6
- package/dist/esm/cluster/server/CommandServer.d.ts +0 -34
- package/dist/esm/cluster/server/CommandServer.d.ts.map +0 -1
- package/dist/esm/cluster/server/CommandServer.js +0 -56
- package/dist/esm/cluster/server/CommandServer.js.map +0 -6
- package/dist/esm/cluster/server/EventServer.d.ts +0 -42
- package/dist/esm/cluster/server/EventServer.d.ts.map +0 -1
- package/dist/esm/cluster/server/EventServer.js +0 -141
- package/dist/esm/cluster/server/EventServer.js.map +0 -6
- package/dist/esm/cluster/server/index.d.ts +0 -11
- package/dist/esm/cluster/server/index.d.ts.map +0 -1
- package/dist/esm/cluster/server/index.js +0 -11
- package/dist/esm/cluster/server/index.js.map +0 -6
- package/dist/esm/endpoint/EndpointInterface.d.ts +0 -37
- package/dist/esm/endpoint/EndpointInterface.d.ts.map +0 -1
- package/dist/esm/endpoint/EndpointInterface.js +0 -6
- package/dist/esm/endpoint/EndpointInterface.js.map +0 -6
- package/dist/esm/endpoint/EndpointStructureLogger.d.ts +0 -31
- package/dist/esm/endpoint/EndpointStructureLogger.d.ts.map +0 -1
- package/dist/esm/endpoint/EndpointStructureLogger.js +0 -210
- package/dist/esm/endpoint/EndpointStructureLogger.js.map +0 -6
- package/dist/esm/endpoint/index.d.ts +0 -8
- package/dist/esm/endpoint/index.d.ts.map +0 -1
- package/dist/esm/endpoint/index.js +0 -8
- package/dist/esm/endpoint/index.js.map +0 -6
- package/dist/esm/interaction/InteractionEndpointStructure.d.ts +0 -95
- package/dist/esm/interaction/InteractionEndpointStructure.d.ts.map +0 -1
- package/dist/esm/interaction/InteractionEndpointStructure.js +0 -355
- package/dist/esm/interaction/InteractionEndpointStructure.js.map +0 -6
- package/src/cluster/server/AttributeServer.ts +0 -997
- package/src/cluster/server/ClusterDatasource.ts +0 -17
- package/src/cluster/server/ClusterServer.ts +0 -46
- package/src/cluster/server/CommandServer.ts +0 -89
- package/src/cluster/server/EventServer.ts +0 -202
- package/src/cluster/server/index.ts +0 -11
- package/src/endpoint/EndpointInterface.ts +0 -41
- package/src/endpoint/EndpointStructureLogger.ts +0 -270
- package/src/endpoint/index.ts +0 -8
- package/src/interaction/InteractionEndpointStructure.ts +0 -510
package/src/action/protocols.ts
CHANGED
|
@@ -8,15 +8,24 @@ import { InteractionSession } from "#action/Interactable.js";
|
|
|
8
8
|
import { OccurrenceManager } from "#events/OccurrenceManager.js";
|
|
9
9
|
import { MaybePromise, Observable } from "#general";
|
|
10
10
|
import { DataModelPath, MatterModel } from "#model";
|
|
11
|
-
import type {
|
|
12
|
-
|
|
11
|
+
import type {
|
|
12
|
+
AttributeId,
|
|
13
|
+
ClusterId,
|
|
14
|
+
CommandId,
|
|
15
|
+
DeviceTypeId,
|
|
16
|
+
EndpointNumber,
|
|
17
|
+
FabricIndex,
|
|
18
|
+
NodeId,
|
|
19
|
+
TlvSchema,
|
|
20
|
+
} from "#types";
|
|
21
|
+
import { AttributePath, CommandPath, EventId, EventPath } from "#types";
|
|
13
22
|
import { AccessControl } from "./server/AccessControl.js";
|
|
14
23
|
import { Val } from "./Val.js";
|
|
15
24
|
|
|
16
|
-
export
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
25
|
+
export type CommandInvokeHandler = (
|
|
26
|
+
args: Val.Struct | undefined,
|
|
27
|
+
session: InteractionSession,
|
|
28
|
+
) => MaybePromise<Val.Struct | void>;
|
|
20
29
|
|
|
21
30
|
/**
|
|
22
31
|
* Optimized Matter protocol<->JS object interface
|
|
@@ -65,7 +74,7 @@ export interface NodeProtocol extends CollectionProtocol<EndpointProtocol> {
|
|
|
65
74
|
/**
|
|
66
75
|
* Inspects an Attribute- or Event path and log in human-readable form if possible
|
|
67
76
|
*/
|
|
68
|
-
inspectPath(path: AttributePath | EventPath): string;
|
|
77
|
+
inspectPath(path: AttributePath | EventPath | CommandPath): string;
|
|
69
78
|
}
|
|
70
79
|
|
|
71
80
|
/**
|
|
@@ -74,6 +83,11 @@ export interface NodeProtocol extends CollectionProtocol<EndpointProtocol> {
|
|
|
74
83
|
export interface EndpointProtocol
|
|
75
84
|
extends CollectionProtocol<ClusterProtocol>,
|
|
76
85
|
AddressableElementProtocol<EndpointNumber> {
|
|
86
|
+
/**
|
|
87
|
+
* Bitmap with each wildcard path flag bit set where this value should be skipped.
|
|
88
|
+
*/
|
|
89
|
+
wildcardPathFlags: number;
|
|
90
|
+
|
|
77
91
|
/**
|
|
78
92
|
* Path to the endpoint within the data model.
|
|
79
93
|
*/
|
|
@@ -118,6 +132,11 @@ export interface ClusterProtocol {
|
|
|
118
132
|
* session. So doing is the responsibility of the node implementation.
|
|
119
133
|
*/
|
|
120
134
|
openForWrite(session: InteractionSession): Promise<Val.ProtocolStruct>;
|
|
135
|
+
|
|
136
|
+
/**
|
|
137
|
+
* Invoke handler for the commands of the cluster
|
|
138
|
+
*/
|
|
139
|
+
commands: Record<CommandId, CommandInvokeHandler>;
|
|
121
140
|
}
|
|
122
141
|
|
|
123
142
|
/**
|
|
@@ -126,6 +145,11 @@ export interface ClusterProtocol {
|
|
|
126
145
|
* TODO - commands
|
|
127
146
|
*/
|
|
128
147
|
export interface ClusterTypeProtocol extends AddressableElementProtocol<ClusterId> {
|
|
148
|
+
/**
|
|
149
|
+
* Bitmap with each wildcard path flag bit set where this value should be skipped.
|
|
150
|
+
*/
|
|
151
|
+
wildcardPathFlags: number;
|
|
152
|
+
|
|
129
153
|
/**
|
|
130
154
|
* Attribute metadata.
|
|
131
155
|
*/
|
|
@@ -135,12 +159,22 @@ export interface ClusterTypeProtocol extends AddressableElementProtocol<ClusterI
|
|
|
135
159
|
* Event metadata.
|
|
136
160
|
*/
|
|
137
161
|
events: CollectionProtocol<EventTypeProtocol>;
|
|
162
|
+
|
|
163
|
+
/**
|
|
164
|
+
* Command metadata.
|
|
165
|
+
*/
|
|
166
|
+
commands: CollectionProtocol<CommandTypeProtocol>;
|
|
138
167
|
}
|
|
139
168
|
|
|
140
169
|
/**
|
|
141
|
-
* Descriptor for a specific property type.
|
|
170
|
+
* Descriptor for a specific attribute property type.
|
|
142
171
|
*/
|
|
143
172
|
export interface AttributeTypeProtocol extends AddressableElementProtocol<AttributeId> {
|
|
173
|
+
/**
|
|
174
|
+
* Bitmap with each wildcard path flag bit set where this value should be skipped.
|
|
175
|
+
*/
|
|
176
|
+
wildcardPathFlags: number;
|
|
177
|
+
|
|
144
178
|
/**
|
|
145
179
|
* The TLV schema for this property.
|
|
146
180
|
*/
|
|
@@ -163,16 +197,41 @@ export interface AttributeTypeProtocol extends AddressableElementProtocol<Attrib
|
|
|
163
197
|
}
|
|
164
198
|
|
|
165
199
|
/**
|
|
166
|
-
* Descriptor for a specific property type.
|
|
200
|
+
* Descriptor for a specific event property type.
|
|
167
201
|
*/
|
|
168
|
-
export interface EventTypeProtocol extends
|
|
202
|
+
export interface EventTypeProtocol extends AddressableElementProtocol<EventId> {
|
|
169
203
|
/**
|
|
170
204
|
* The TLV schema for this property.
|
|
171
205
|
*/
|
|
172
206
|
tlv: TlvSchema<unknown>;
|
|
173
207
|
|
|
174
208
|
/**
|
|
175
|
-
* Access control information for the
|
|
209
|
+
* Access control information for the event.
|
|
210
|
+
*/
|
|
211
|
+
limits: AccessControl.Limits;
|
|
212
|
+
}
|
|
213
|
+
|
|
214
|
+
/**
|
|
215
|
+
* Descriptor for a specific command property type.
|
|
216
|
+
*/
|
|
217
|
+
export interface CommandTypeProtocol extends AddressableElementProtocol<CommandId> {
|
|
218
|
+
/**
|
|
219
|
+
* The TLV schema for the command request.
|
|
220
|
+
*/
|
|
221
|
+
requestTlv: TlvSchema<unknown>;
|
|
222
|
+
|
|
223
|
+
/**
|
|
224
|
+
* The TLV schema for the command response.
|
|
225
|
+
*/
|
|
226
|
+
responseTlv: TlvSchema<unknown>;
|
|
227
|
+
|
|
228
|
+
/**
|
|
229
|
+
* The Response command Id
|
|
230
|
+
*/
|
|
231
|
+
responseId: CommandId;
|
|
232
|
+
|
|
233
|
+
/**
|
|
234
|
+
* Access control information for the command.
|
|
176
235
|
*/
|
|
177
236
|
limits: AccessControl.Limits;
|
|
178
237
|
}
|
|
@@ -190,11 +249,6 @@ export interface AddressableElementProtocol<N extends number> {
|
|
|
190
249
|
* Human readable name of the element.
|
|
191
250
|
*/
|
|
192
251
|
name: string;
|
|
193
|
-
|
|
194
|
-
/**
|
|
195
|
-
* Bitmap with each wildcard path flag bit set where this value should be skipped.
|
|
196
|
-
*/
|
|
197
|
-
wildcardPathFlags: number;
|
|
198
252
|
}
|
|
199
253
|
|
|
200
254
|
/**
|
|
@@ -10,26 +10,53 @@ import { MalformedRequestError } from "./MalformedRequestError.js";
|
|
|
10
10
|
import { Specifier } from "./Specifier.js";
|
|
11
11
|
|
|
12
12
|
export interface Invoke extends InvokeRequest {
|
|
13
|
+
/** Timeout only relevant for Client Interactions */
|
|
13
14
|
timeout?: number;
|
|
14
15
|
}
|
|
15
16
|
|
|
16
17
|
/**
|
|
17
18
|
* Request invocation of one or more commands.
|
|
18
19
|
*/
|
|
19
|
-
export function Invoke(
|
|
20
|
+
export function Invoke(options: Invoke.Definition): Invoke;
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* Request invocation multiple commands with defined options
|
|
24
|
+
*/
|
|
25
|
+
export function Invoke(options: Invoke.Definition, ...commands: CommandData[]): Invoke;
|
|
26
|
+
|
|
27
|
+
/**
|
|
28
|
+
* Request invocation multiple commands as list of Commands with default options.
|
|
29
|
+
*/
|
|
30
|
+
export function Invoke(...commands: CommandData[]): Invoke;
|
|
31
|
+
|
|
32
|
+
export function Invoke(optionsOrData: Invoke.Definition | CommandData, ...commands: CommandData[]): Invoke {
|
|
33
|
+
let options;
|
|
34
|
+
if ("commands" in optionsOrData) {
|
|
35
|
+
options = optionsOrData;
|
|
36
|
+
} else {
|
|
37
|
+
commands = [optionsOrData, ...commands];
|
|
38
|
+
options = {};
|
|
39
|
+
}
|
|
40
|
+
|
|
20
41
|
const {
|
|
21
|
-
commands,
|
|
42
|
+
commands: invokeRequests = [],
|
|
22
43
|
interactionModelRevision = FALLBACK_INTERACTIONMODEL_REVISION,
|
|
23
44
|
suppressResponse = false,
|
|
24
45
|
timed: timedRequest = false,
|
|
25
|
-
} =
|
|
46
|
+
} = options;
|
|
47
|
+
|
|
48
|
+
if (commands.length) {
|
|
49
|
+
for (const entry of commands) {
|
|
50
|
+
invokeRequests.push(entry);
|
|
51
|
+
}
|
|
52
|
+
}
|
|
26
53
|
|
|
27
|
-
if (!
|
|
54
|
+
if (!invokeRequests?.length) {
|
|
28
55
|
throw new MalformedRequestError(`Invocation requires at least one command`);
|
|
29
56
|
}
|
|
30
57
|
|
|
31
58
|
return {
|
|
32
|
-
invokeRequests
|
|
59
|
+
invokeRequests,
|
|
33
60
|
interactionModelRevision,
|
|
34
61
|
suppressResponse,
|
|
35
62
|
timedRequest,
|
|
@@ -4,6 +4,7 @@
|
|
|
4
4
|
* SPDX-License-Identifier: Apache-2.0
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
|
+
import { camelize } from "#general";
|
|
7
8
|
import { FALLBACK_INTERACTIONMODEL_REVISION } from "#session/Session.js";
|
|
8
9
|
import type {
|
|
9
10
|
AttributePath,
|
|
@@ -14,7 +15,6 @@ import type {
|
|
|
14
15
|
GlobalAttributes,
|
|
15
16
|
ReadRequest,
|
|
16
17
|
} from "#types";
|
|
17
|
-
import { camelize } from "@matter/general";
|
|
18
18
|
import { MalformedRequestError } from "./MalformedRequestError.js";
|
|
19
19
|
import { Specifier } from "./Specifier.js";
|
|
20
20
|
|
|
@@ -9,7 +9,10 @@ import { AttributeData, ClusterType, WriteRequest } from "#types";
|
|
|
9
9
|
import { MalformedRequestError } from "./MalformedRequestError.js";
|
|
10
10
|
import { Specifier } from "./Specifier.js";
|
|
11
11
|
|
|
12
|
-
export interface Write extends WriteRequest {
|
|
12
|
+
export interface Write extends WriteRequest {
|
|
13
|
+
/** Timeout only relevant for Client Interactions */
|
|
14
|
+
timeout?: number;
|
|
15
|
+
}
|
|
13
16
|
|
|
14
17
|
/**
|
|
15
18
|
* Formulate a write-request using Matter numeric IDs.
|
|
@@ -4,13 +4,33 @@
|
|
|
4
4
|
* SPDX-License-Identifier: Apache-2.0
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
|
-
import type {
|
|
8
|
-
import type { CommandData } from "#types";
|
|
7
|
+
import type { ClusterId, CommandId, CommandPath, EndpointNumber, StatusCode, TlvStream } from "#types";
|
|
9
8
|
|
|
10
|
-
export type InvokeResult
|
|
11
|
-
? Promise<void>
|
|
12
|
-
: AsyncIterable<InvokeResult.Chunk>;
|
|
9
|
+
export type InvokeResult = AsyncIterable<InvokeResult.Chunk>;
|
|
13
10
|
|
|
14
11
|
export namespace InvokeResult {
|
|
15
|
-
export type Chunk =
|
|
12
|
+
export type Chunk = Iterable<Data>;
|
|
13
|
+
|
|
14
|
+
export type Data = CommandStatus | CommandResponse;
|
|
15
|
+
|
|
16
|
+
export interface ConcreteCommandPath extends CommandPath {
|
|
17
|
+
endpointId: EndpointNumber;
|
|
18
|
+
clusterId: ClusterId;
|
|
19
|
+
commandId: CommandId;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
export interface CommandStatus {
|
|
23
|
+
kind: "cmd-status";
|
|
24
|
+
path: ConcreteCommandPath;
|
|
25
|
+
commandRef?: number;
|
|
26
|
+
status: StatusCode;
|
|
27
|
+
clusterStatus?: number;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
export interface CommandResponse {
|
|
31
|
+
kind: "cmd-response";
|
|
32
|
+
path: ConcreteCommandPath;
|
|
33
|
+
commandRef?: number;
|
|
34
|
+
data: TlvStream;
|
|
35
|
+
}
|
|
16
36
|
}
|
|
@@ -47,7 +47,7 @@ export namespace ReadResult {
|
|
|
47
47
|
path: ConcreteAttributePath;
|
|
48
48
|
value: unknown;
|
|
49
49
|
version: number;
|
|
50
|
-
tlv: TlvSchema<unknown>;
|
|
50
|
+
tlv: TlvSchema<unknown>; // TODO: Remove when we also move encoding to the new format
|
|
51
51
|
}
|
|
52
52
|
|
|
53
53
|
export interface AttributeStatus {
|
|
@@ -9,7 +9,7 @@ import { AttributeTypeProtocol, ClusterProtocol, EndpointProtocol, NodeProtocol
|
|
|
9
9
|
import { Write } from "#action/request/Write.js";
|
|
10
10
|
import { WriteResult } from "#action/response/WriteResult.js";
|
|
11
11
|
import { AccessControl } from "#action/server/AccessControl.js";
|
|
12
|
-
import { DataResponse, FallbackLimits
|
|
12
|
+
import { DataResponse, FallbackLimits } from "#action/server/DataResponse.js";
|
|
13
13
|
import { Diagnostic, InternalError, Logger } from "#general";
|
|
14
14
|
import { AttributeModel, DataModelPath, ElementTag, FabricIndex as FabricIndexField } from "#model";
|
|
15
15
|
import {
|
|
@@ -39,7 +39,6 @@ export class AttributeWriteResponse<
|
|
|
39
39
|
#currentEndpoint?: EndpointProtocol;
|
|
40
40
|
#currentCluster?: ClusterProtocol;
|
|
41
41
|
#previousProcessedAttributePath?: WriteResult.ConcreteAttributePath;
|
|
42
|
-
#wildcardPathFlags = 0;
|
|
43
42
|
|
|
44
43
|
// Count how many attribute status (on error) and attribute values (on success) we have emitted
|
|
45
44
|
#statusCount = 0;
|
|
@@ -101,15 +100,12 @@ export class AttributeWriteResponse<
|
|
|
101
100
|
* Validate a wildcard path and update internal state.
|
|
102
101
|
*/
|
|
103
102
|
async #processWildcard(path: AttributePath, value: TlvStream) {
|
|
104
|
-
const { nodeId, endpointId
|
|
103
|
+
const { nodeId, endpointId } = path;
|
|
105
104
|
|
|
106
105
|
if (nodeId !== undefined && nodeId !== this.nodeId) {
|
|
107
106
|
return;
|
|
108
107
|
}
|
|
109
108
|
|
|
110
|
-
// TODO clarify isf that's needed or not
|
|
111
|
-
this.#wildcardPathFlags = wildcardPathFlags ? WildcardPathFlagsCodec.encode(wildcardPathFlags) : 0;
|
|
112
|
-
|
|
113
109
|
// TODO: Add Group handling and validation
|
|
114
110
|
/*
|
|
115
111
|
if (isGroupSession && endpointId !== undefined) {
|
|
@@ -248,8 +244,6 @@ export class AttributeWriteResponse<
|
|
|
248
244
|
* Emits previous chunk if it exists and was not for this endpoint. This means that our chunk size is one endpoint
|
|
249
245
|
* worth of data, except for the initial error chunk if there are path errors.
|
|
250
246
|
*
|
|
251
|
-
* {@link this.#wildcardPathFlags} to numeric bitmap must be set prior to invocation.
|
|
252
|
-
*
|
|
253
247
|
* TODO - skip endpoints for which subject is unauthorized as optimization
|
|
254
248
|
*/
|
|
255
249
|
#writeEndpointForWildcard(endpoint: EndpointProtocol, path: AttributePath, value: TlvStream) {
|
|
@@ -261,10 +255,6 @@ export class AttributeWriteResponse<
|
|
|
261
255
|
);
|
|
262
256
|
}
|
|
263
257
|
|
|
264
|
-
if (endpoint.wildcardPathFlags & this.#wildcardPathFlags) {
|
|
265
|
-
return; // TODO ???
|
|
266
|
-
}
|
|
267
|
-
|
|
268
258
|
if (this.#currentEndpoint !== endpoint) {
|
|
269
259
|
this.#currentEndpoint = endpoint;
|
|
270
260
|
this.#currentCluster = undefined;
|
|
@@ -284,10 +274,6 @@ export class AttributeWriteResponse<
|
|
|
284
274
|
* TODO - skip clusters for which subject is unauthorized
|
|
285
275
|
*/
|
|
286
276
|
#writeClusterForWildcard(cluster: ClusterProtocol, path: AttributePath, value: TlvStream) {
|
|
287
|
-
if (cluster.type.wildcardPathFlags & this.#wildcardPathFlags) {
|
|
288
|
-
return; // TODO ???
|
|
289
|
-
}
|
|
290
|
-
|
|
291
277
|
if (this.#currentCluster !== cluster) {
|
|
292
278
|
this.#currentCluster = cluster;
|
|
293
279
|
}
|
|
@@ -313,10 +299,6 @@ export class AttributeWriteResponse<
|
|
|
313
299
|
return;
|
|
314
300
|
}
|
|
315
301
|
|
|
316
|
-
if (attribute.wildcardPathFlags & this.#wildcardPathFlags) {
|
|
317
|
-
return; // TODO ????
|
|
318
|
-
}
|
|
319
|
-
|
|
320
302
|
if (
|
|
321
303
|
!attribute.limits.writable ||
|
|
322
304
|
this.session.authorityAt(attribute.limits.readLevel, this.#guardedCurrentCluster.location) !==
|