Skip to content

Commit

Permalink
add todo renames
Browse files Browse the repository at this point in the history
  • Loading branch information
Apollon77 committed Mar 10, 2023
1 parent 1b8feef commit 3a595f0
Show file tree
Hide file tree
Showing 8 changed files with 13 additions and 13 deletions.
2 changes: 1 addition & 1 deletion src/Device.ts
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ class Device {
}, {}),
new ClusterServer(GeneralCommissioningCluster, {}, {
breadcrumb: BigInt(0),
commissioningInfo: {
basicCommissioningInfo: {
failSafeExpiryLengthSeconds: 60 /* 1min */,
maxCumulativeFailsafeSeconds: 900 /* Recommended according to Specs */,
},
Expand Down
4 changes: 2 additions & 2 deletions src/matter/MatterController.ts
Original file line number Diff line number Diff line change
Expand Up @@ -86,8 +86,8 @@ export class MatterController {

// Do the commissioning
let generalCommissioningClusterClient = ClusterClient(interactionClient, 0, GeneralCommissioningCluster);
this.ensureSuccess(await generalCommissioningClusterClient.armFailSafe({ breadcrumbStep: BigInt(1), expiryLengthSeconds: 60 }));
this.ensureSuccess(await generalCommissioningClusterClient.setRegulatoryConfig({ breadcrumbStep: BigInt(2), newRegulatoryConfig: RegulatoryLocationType.IndoorOutdoor, countryCode: "US"}));
this.ensureSuccess(await generalCommissioningClusterClient.armFailSafe({ breadcrumb: BigInt(1), expiryLengthSeconds: 60 }));
this.ensureSuccess(await generalCommissioningClusterClient.setRegulatoryConfig({ breadcrumb: BigInt(2), newRegulatoryConfig: RegulatoryLocationType.IndoorOutdoor, countryCode: "US"}));

const operationalCredentialsClusterClient = ClusterClient(interactionClient, 0, OperationalCredentialsCluster);
const { certificate: deviceAttestation } = await operationalCredentialsClusterClient.requestCertChain({ type: CertificateChainType.DeviceAttestation });
Expand Down
4 changes: 2 additions & 2 deletions src/matter/cluster/BooleanStateCluster.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* SPDX-License-Identifier: Apache-2.0
*/

import { Attribute, Event, EventPriority, OptionalAttribute, Cluster, Command, TlvNoArguments, TlvNoResponse } from "./Cluster";
import { Attribute, EventPriority, Cluster, OptionalEvent } from "./Cluster";
import { TlvField, TlvBoolean, MatterApplicationClusterSpecificationV1_0 } from "@project-chip/matter.js";

/**
Expand All @@ -29,6 +29,6 @@ export const BooleanStateCluster = Cluster({
/** @see {@link MatterApplicationClusterSpecificationV1_0 1.7.5} */
events: {
/** generated when the StateValue attribute changes */
stateChange: Event(0, EventPriority.Info, { stateValue: TlvField(0, TlvBoolean) }),
stateChange: OptionalEvent(0, EventPriority.Info, { stateValue: TlvField(0, TlvBoolean) }),

This comment has been minimized.

Copy link
@JimBuzbee

JimBuzbee Mar 10, 2023

Contributor

Good catch.

This comment has been minimized.

Copy link
@Apollon77

Apollon77 Mar 10, 2023

Author Collaborator

not really catch ... project-chip/connectedhomeip#25605

This comment has been minimized.

Copy link
@JimBuzbee

JimBuzbee Mar 10, 2023

Contributor

Glad the responsible people take comments regarding inconsistencies. Maybe it will be cleared up in version 1.1

},
});
2 changes: 1 addition & 1 deletion src/matter/cluster/DescriptorCluster.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import { MatterCoreSpecificationV1_0, TlvArray, TlvField, TlvObject, TlvUInt16 }
*/
const TlvDeviceType = TlvObject({
/** Indicates the device type definition */
type: TlvField(0, TlvDeviceTypeId), // TODO rename deviceType
deviceType: TlvField(0, TlvDeviceTypeId),

/** Indicates the implemented revision of the device type definition */
revision: TlvField(1, TlvUInt16.bound({ min: 1 })),
Expand Down
6 changes: 3 additions & 3 deletions src/matter/cluster/GeneralCommissioningCluster.ts
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ const TlvArmFailSafeRequest = TlvObject({
expiryLengthSeconds: TlvField(0, TlvUInt16), /* default: 900 */

/** Value to atomically set the Breadcrumb attribute on success of this command. */
breadcrumbStep: TlvField(1, TlvUInt64), // TODO rename breadcrumb
breadcrumb: TlvField(1, TlvUInt64),
});

/** @see {@link MatterCoreSpecificationV1_0} § 11.9.7.4 */
Expand All @@ -91,7 +91,7 @@ const TlvSetRegulatoryConfigRequest = TlvObject({
countryCode: TlvField(1, TlvString.bound({ length: 2 })),

/** Value to atomically set the Breadcrumb attribute on success of this command. */
breadcrumbStep: TlvField(2, TlvUInt64), // TODO rename breadcrumb
breadcrumb: TlvField(2, TlvUInt64),
});

/**
Expand All @@ -112,7 +112,7 @@ export const GeneralCommissioningCluster = Cluster({
breadcrumb: WritableAttribute(0, TlvUInt64, { default: BigInt(0), writeAcl: AccessLevel.Administer }),

/** Describe critical parameters needed at the beginning of commissioning flow. */
commissioningInfo: Attribute(1, TlvBasicCommissioningInfo), // TODO rename basicCommissioningInfo
basicCommissioningInfo: Attribute(1, TlvBasicCommissioningInfo),

/** Indicates the regulatory configuration for the product. */
regulatoryConfig: Attribute(2, TlvEnum<RegulatoryLocationType>()), /* default: value of locationCapability */
Expand Down
4 changes: 2 additions & 2 deletions src/matter/cluster/server/GeneralCommissioningServer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,15 +18,15 @@ const SuccessResponse = {errorCode: CommissioningError.Ok, debugText: ""};
const logger = Logger.get("GeneralCommissioningClusterHandler");

export const GeneralCommissioningClusterHandler: ClusterServerHandlers<typeof GeneralCommissioningCluster> = {
armFailSafe: async ({ request: {breadcrumbStep}, attributes: {breadcrumb}, session }) => {
armFailSafe: async ({ request: { breadcrumb: breadcrumbStep }, attributes: {breadcrumb}, session }) => {
// TODO Add handling for ExpiryLengthSeconds field and Error handling, see 11.9.7.2

session.getContext().armFailSafe();
breadcrumb.set(breadcrumbStep);
return SuccessResponse;
},

setRegulatoryConfig: async ({request: {breadcrumbStep, newRegulatoryConfig, countryCode}, attributes: {breadcrumb, regulatoryConfig, locationCapability} }) => {
setRegulatoryConfig: async ({request: { breadcrumb: breadcrumbStep, newRegulatoryConfig, countryCode}, attributes: {breadcrumb, regulatoryConfig, locationCapability} }) => {
const locationCapabilityValue = locationCapability.get();

let validValues;
Expand Down
2 changes: 1 addition & 1 deletion src/matter/interaction/InteractionServer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ export class InteractionServer implements ProtocolHandler<MatterDevice> {
addEndpoint(endpointId: number, device: {name: string, code: number}, clusters: ClusterServer<any, any, any, any>[]) {
// Add the descriptor cluster
const descriptorCluster = new ClusterServer(DescriptorCluster, {}, {
deviceTypeList: [{revision: 1, type: new DeviceTypeId(device.code)}],
deviceTypeList: [{revision: 1, deviceType: new DeviceTypeId(device.code)}],
serverList: [],
clientList: [],
partsList: [],
Expand Down
2 changes: 1 addition & 1 deletion test/IntegrationTest.ts
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ describe("Integration", () => {
}, {}),
new ClusterServer(GeneralCommissioningCluster, {}, {
breadcrumb: BigInt(0),
commissioningInfo: {
basicCommissioningInfo: {
failSafeExpiryLengthSeconds: 60 /* 1min */,
maxCumulativeFailsafeSeconds: 60 * 60 /* 1h */,
},
Expand Down

0 comments on commit 3a595f0

Please sign in to comment.