@matter/protocol 0.16.0-alpha.0-20251027-17770fb28 → 0.16.0-alpha.0-20251030-e9ca79f93
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/server/AttributeReadResponse.js +1 -1
- package/dist/cjs/action/server/AttributeReadResponse.js.map +1 -1
- package/dist/cjs/action/server/AttributeWriteResponse.d.ts +1 -1
- package/dist/cjs/action/server/AttributeWriteResponse.js +5 -5
- package/dist/cjs/action/server/AttributeWriteResponse.js.map +1 -1
- package/dist/cjs/interaction/InteractionClient.d.ts +2 -1
- package/dist/cjs/interaction/InteractionClient.d.ts.map +1 -1
- package/dist/cjs/interaction/InteractionClient.js +16 -5
- package/dist/cjs/interaction/InteractionClient.js.map +1 -1
- package/dist/cjs/peer/ControllerCommissioner.js +1 -1
- package/dist/cjs/peer/ControllerCommissioner.js.map +1 -1
- package/dist/cjs/peer/PeerSet.d.ts +1 -3
- package/dist/cjs/peer/PeerSet.d.ts.map +1 -1
- package/dist/cjs/peer/PeerSet.js +4 -16
- package/dist/cjs/peer/PeerSet.js.map +1 -1
- package/dist/cjs/protocol/ExchangeManager.d.ts +3 -3
- package/dist/cjs/protocol/ExchangeManager.d.ts.map +1 -1
- package/dist/cjs/protocol/ExchangeManager.js +4 -4
- package/dist/cjs/protocol/ExchangeManager.js.map +1 -1
- package/dist/esm/action/server/AttributeReadResponse.js +2 -2
- package/dist/esm/action/server/AttributeReadResponse.js.map +1 -1
- package/dist/esm/action/server/AttributeWriteResponse.d.ts +1 -1
- package/dist/esm/action/server/AttributeWriteResponse.js +6 -6
- package/dist/esm/action/server/AttributeWriteResponse.js.map +1 -1
- package/dist/esm/interaction/InteractionClient.d.ts +2 -1
- package/dist/esm/interaction/InteractionClient.d.ts.map +1 -1
- package/dist/esm/interaction/InteractionClient.js +16 -5
- package/dist/esm/interaction/InteractionClient.js.map +1 -1
- package/dist/esm/peer/ControllerCommissioner.js +1 -1
- package/dist/esm/peer/ControllerCommissioner.js.map +1 -1
- package/dist/esm/peer/PeerSet.d.ts +1 -3
- package/dist/esm/peer/PeerSet.d.ts.map +1 -1
- package/dist/esm/peer/PeerSet.js +4 -16
- package/dist/esm/peer/PeerSet.js.map +1 -1
- package/dist/esm/protocol/ExchangeManager.d.ts +3 -3
- package/dist/esm/protocol/ExchangeManager.d.ts.map +1 -1
- package/dist/esm/protocol/ExchangeManager.js +5 -5
- package/dist/esm/protocol/ExchangeManager.js.map +1 -1
- package/package.json +6 -6
- package/src/action/server/AttributeReadResponse.ts +2 -2
- package/src/action/server/AttributeWriteResponse.ts +7 -7
- package/src/interaction/InteractionClient.ts +18 -6
- package/src/peer/ControllerCommissioner.ts +1 -1
- package/src/peer/PeerSet.ts +5 -18
- package/src/protocol/ExchangeManager.ts +6 -6
|
@@ -92,6 +92,7 @@ export interface AttributeStatus {
|
|
|
92
92
|
export class InteractionClientProvider {
|
|
93
93
|
readonly #peers: PeerSet;
|
|
94
94
|
readonly #clients = new PeerAddressMap<InteractionClient>();
|
|
95
|
+
readonly #subscriptionClient = new SubscriptionClient();
|
|
95
96
|
|
|
96
97
|
constructor(peers: PeerSet) {
|
|
97
98
|
this.#peers = peers;
|
|
@@ -109,6 +110,10 @@ export class InteractionClientProvider {
|
|
|
109
110
|
return this.#peers;
|
|
110
111
|
}
|
|
111
112
|
|
|
113
|
+
get subscriptionClient() {
|
|
114
|
+
return this.#subscriptionClient;
|
|
115
|
+
}
|
|
116
|
+
|
|
112
117
|
async connect(
|
|
113
118
|
address: PeerAddress,
|
|
114
119
|
options: PeerConnectionOptions & {
|
|
@@ -126,7 +131,7 @@ export class InteractionClientProvider {
|
|
|
126
131
|
|
|
127
132
|
return new InteractionClient(
|
|
128
133
|
exchangeProvider,
|
|
129
|
-
this.#
|
|
134
|
+
this.#subscriptionClient,
|
|
130
135
|
undefined,
|
|
131
136
|
this.#peers.interactionQueue,
|
|
132
137
|
);
|
|
@@ -146,7 +151,7 @@ export class InteractionClientProvider {
|
|
|
146
151
|
|
|
147
152
|
client = new InteractionClient(
|
|
148
153
|
exchangeProvider,
|
|
149
|
-
this.#
|
|
154
|
+
this.#subscriptionClient,
|
|
150
155
|
address,
|
|
151
156
|
this.#peers.interactionQueue,
|
|
152
157
|
nodeStore,
|
|
@@ -169,14 +174,21 @@ export class InteractionClient {
|
|
|
169
174
|
readonly #exchangeProvider: ExchangeProvider;
|
|
170
175
|
readonly #nodeStore?: PeerDataStore;
|
|
171
176
|
readonly #ownSubscriptionIds = new Set<number>();
|
|
172
|
-
readonly #subscriptionClient: SubscriptionClient;
|
|
173
177
|
readonly #queue?: PromiseQueue;
|
|
174
178
|
readonly #address?: PeerAddress;
|
|
175
179
|
readonly isGroupAddress: boolean;
|
|
176
180
|
|
|
181
|
+
// TODO - SubscriptionClient is used by CommissioningController but not ClientNode. However InteractionClient *is*
|
|
182
|
+
// used by ClientNode to perform commissioning, during which time SubscriptionClient is unnecessary. So this should
|
|
183
|
+
// be set after commissioning
|
|
184
|
+
//
|
|
185
|
+
// If we remove CommissioningController then this entire class goes away; if we first move commissioning to
|
|
186
|
+
// ClientInteraction then this should become required
|
|
187
|
+
readonly #subscriptionClient?: SubscriptionClient;
|
|
188
|
+
|
|
177
189
|
constructor(
|
|
178
190
|
exchangeProvider: ExchangeProvider,
|
|
179
|
-
subscriptionClient
|
|
191
|
+
subscriptionClient?: SubscriptionClient,
|
|
180
192
|
address?: PeerAddress,
|
|
181
193
|
queue?: PromiseQueue,
|
|
182
194
|
nodeStore?: PeerDataStore,
|
|
@@ -214,7 +226,7 @@ export class InteractionClient {
|
|
|
214
226
|
|
|
215
227
|
removeSubscription(subscriptionId: number) {
|
|
216
228
|
this.#ownSubscriptionIds.delete(subscriptionId);
|
|
217
|
-
this.#subscriptionClient
|
|
229
|
+
this.#subscriptionClient?.delete(subscriptionId);
|
|
218
230
|
}
|
|
219
231
|
|
|
220
232
|
async getAllAttributes(
|
|
@@ -892,7 +904,7 @@ export class InteractionClient {
|
|
|
892
904
|
|
|
893
905
|
async #registerSubscription(subscription: RegisteredSubscription, initialReport: DecodedDataReport) {
|
|
894
906
|
this.#ownSubscriptionIds.add(subscription.id);
|
|
895
|
-
this.#subscriptionClient
|
|
907
|
+
this.#subscriptionClient?.add(subscription);
|
|
896
908
|
await subscription.onData(initialReport);
|
|
897
909
|
}
|
|
898
910
|
|
|
@@ -467,7 +467,7 @@ export class ControllerCommissioner {
|
|
|
467
467
|
// Use the created secure session to do the commissioning
|
|
468
468
|
new InteractionClient(
|
|
469
469
|
new DedicatedChannelExchangeProvider(this.#context.exchanges, paseSecureMessageChannel),
|
|
470
|
-
|
|
470
|
+
undefined,
|
|
471
471
|
address,
|
|
472
472
|
),
|
|
473
473
|
this.#context.ca,
|
package/src/peer/PeerSet.ts
CHANGED
|
@@ -32,7 +32,6 @@ import {
|
|
|
32
32
|
Time,
|
|
33
33
|
Timer,
|
|
34
34
|
} from "#general";
|
|
35
|
-
import { SubscriptionClient } from "#interaction/SubscriptionClient.js";
|
|
36
35
|
import { MdnsClient } from "#mdns/MdnsClient.js";
|
|
37
36
|
import { PeerAddress, PeerAddressMap } from "#peer/PeerAddress.js";
|
|
38
37
|
import { ChannelManager } from "#protocol/ChannelManager.js";
|
|
@@ -107,7 +106,6 @@ export interface PeerSetContext {
|
|
|
107
106
|
sessions: SessionManager;
|
|
108
107
|
channels: ChannelManager;
|
|
109
108
|
exchanges: ExchangeManager;
|
|
110
|
-
subscriptionClient: SubscriptionClient;
|
|
111
109
|
scanners: ScannerSet;
|
|
112
110
|
transports: ConnectionlessTransportSet;
|
|
113
111
|
store: PeerAddressStore;
|
|
@@ -120,7 +118,6 @@ export class PeerSet implements ImmutableSet<OperationalPeer>, ObservableSet<Ope
|
|
|
120
118
|
readonly #sessions: SessionManager;
|
|
121
119
|
readonly #channels: ChannelManager;
|
|
122
120
|
readonly #exchanges: ExchangeManager;
|
|
123
|
-
readonly #subscriptionClient: SubscriptionClient;
|
|
124
121
|
readonly #scanners: ScannerSet;
|
|
125
122
|
readonly #transports: ConnectionlessTransportSet;
|
|
126
123
|
readonly #caseClient: CaseClient;
|
|
@@ -138,20 +135,11 @@ export class PeerSet implements ImmutableSet<OperationalPeer>, ObservableSet<Ope
|
|
|
138
135
|
readonly #disconnected = AsyncObservable<[address: PeerAddress]>();
|
|
139
136
|
|
|
140
137
|
constructor(context: PeerSetContext) {
|
|
141
|
-
const {
|
|
142
|
-
sessions,
|
|
143
|
-
channels,
|
|
144
|
-
exchanges,
|
|
145
|
-
subscriptionClient,
|
|
146
|
-
scanners,
|
|
147
|
-
transports: netInterfaces,
|
|
148
|
-
store,
|
|
149
|
-
} = context;
|
|
138
|
+
const { sessions, channels, exchanges, scanners, transports: netInterfaces, store } = context;
|
|
150
139
|
|
|
151
140
|
this.#sessions = sessions;
|
|
152
141
|
this.#channels = channels;
|
|
153
142
|
this.#exchanges = exchanges;
|
|
154
|
-
this.#subscriptionClient = subscriptionClient;
|
|
155
143
|
this.#scanners = scanners;
|
|
156
144
|
this.#transports = netInterfaces;
|
|
157
145
|
this.#store = store;
|
|
@@ -197,6 +185,10 @@ export class PeerSet implements ImmutableSet<OperationalPeer>, ObservableSet<Ope
|
|
|
197
185
|
return this.#peers.deleted;
|
|
198
186
|
}
|
|
199
187
|
|
|
188
|
+
get empty() {
|
|
189
|
+
return this.#peers.empty;
|
|
190
|
+
}
|
|
191
|
+
|
|
200
192
|
get disconnected() {
|
|
201
193
|
return this.#disconnected;
|
|
202
194
|
}
|
|
@@ -237,7 +229,6 @@ export class PeerSet implements ImmutableSet<OperationalPeer>, ObservableSet<Ope
|
|
|
237
229
|
sessions: env.get(SessionManager),
|
|
238
230
|
channels: env.get(ChannelManager),
|
|
239
231
|
exchanges: env.get(ExchangeManager),
|
|
240
|
-
subscriptionClient: env.get(SubscriptionClient),
|
|
241
232
|
scanners: env.get(ScannerSet),
|
|
242
233
|
transports: env.get(ConnectionlessTransportSet),
|
|
243
234
|
store: env.get(PeerAddressStore),
|
|
@@ -250,10 +241,6 @@ export class PeerSet implements ImmutableSet<OperationalPeer>, ObservableSet<Ope
|
|
|
250
241
|
return this.#peers;
|
|
251
242
|
}
|
|
252
243
|
|
|
253
|
-
get subscriptionClient() {
|
|
254
|
-
return this.#subscriptionClient;
|
|
255
|
-
}
|
|
256
|
-
|
|
257
244
|
get interactionQueue() {
|
|
258
245
|
return this.#interactionQueue;
|
|
259
246
|
}
|
|
@@ -10,8 +10,8 @@ import {
|
|
|
10
10
|
Channel,
|
|
11
11
|
ConnectionlessTransport,
|
|
12
12
|
ConnectionlessTransportSet,
|
|
13
|
-
Crypto,
|
|
14
13
|
Diagnostic,
|
|
14
|
+
Entropy,
|
|
15
15
|
Environment,
|
|
16
16
|
Environmental,
|
|
17
17
|
ImplementationError,
|
|
@@ -48,7 +48,7 @@ const MAXIMUM_CONCURRENT_EXCHANGES_PER_SESSION = 5;
|
|
|
48
48
|
* Interfaces {@link ExchangeManager} with other components.
|
|
49
49
|
*/
|
|
50
50
|
export interface ExchangeManagerContext {
|
|
51
|
-
|
|
51
|
+
entropy: Entropy;
|
|
52
52
|
netInterface: ConnectionlessTransportSet;
|
|
53
53
|
sessionManager: SessionManager;
|
|
54
54
|
channelManager: ChannelManager;
|
|
@@ -70,7 +70,7 @@ export class ExchangeManager {
|
|
|
70
70
|
this.#transports = context.netInterface;
|
|
71
71
|
this.#sessionManager = context.sessionManager;
|
|
72
72
|
this.#channelManager = context.channelManager;
|
|
73
|
-
this.#exchangeCounter = new ExchangeCounter(context.
|
|
73
|
+
this.#exchangeCounter = new ExchangeCounter(context.entropy);
|
|
74
74
|
|
|
75
75
|
for (const netInterface of this.#transports) {
|
|
76
76
|
this.#addListener(netInterface);
|
|
@@ -89,7 +89,7 @@ export class ExchangeManager {
|
|
|
89
89
|
|
|
90
90
|
static [Environmental.create](env: Environment) {
|
|
91
91
|
const instance = new ExchangeManager({
|
|
92
|
-
|
|
92
|
+
entropy: env.get(Entropy),
|
|
93
93
|
netInterface: env.get(ConnectionlessTransportSet),
|
|
94
94
|
sessionManager: env.get(SessionManager),
|
|
95
95
|
channelManager: env.get(ChannelManager),
|
|
@@ -480,8 +480,8 @@ export class ExchangeManager {
|
|
|
480
480
|
export class ExchangeCounter {
|
|
481
481
|
#exchangeCounter: number;
|
|
482
482
|
|
|
483
|
-
constructor(
|
|
484
|
-
this.#exchangeCounter =
|
|
483
|
+
constructor(entropy: Entropy) {
|
|
484
|
+
this.#exchangeCounter = entropy.randomUint16;
|
|
485
485
|
}
|
|
486
486
|
|
|
487
487
|
getIncrementedCounter() {
|