Skip to content

Commit 4c3c584

Browse files
committed
Address review comments
1 parent 66cacf0 commit 4c3c584

File tree

12 files changed

+372
-98
lines changed

12 files changed

+372
-98
lines changed

examples/oven-app/oven-app-common/include/CookSurfaceEndpoint.h

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,14 +34,15 @@ class CookSurfaceEndpoint
3434

3535
/**
3636
* @brief Initialize the CookSurface endpoint.
37+
*
38+
* @return returns CHIP_NO_ERROR on success, or an error code on failure.
3739
*/
3840
CHIP_ERROR Init();
3941

40-
/**
41-
* @brief Handle the "off" command for the CookSurface.
42-
*/
4342
void HandleOffCommand();
4443

44+
EndpointId GetEndpointId() const { return mEndpointId; }
45+
4546
private:
4647
bool currentOnOffState = false;
4748
EndpointId mEndpointId = kInvalidEndpointId;

examples/oven-app/oven-app-common/include/CookTopEndpoint.h

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,12 +33,11 @@ class CookTopEndpoint
3333

3434
/**
3535
* @brief Initialize the cooktop endpoint.
36+
*
37+
* @return returns CHIP_NO_ERROR on success, or an error code on failure.
3638
*/
3739
CHIP_ERROR Init();
3840

39-
/**
40-
* @brief Handle the "off" command for the cooktop.
41-
*/
4241
void HandleOffCommand();
4342

4443
private:

examples/oven-app/oven-app-common/include/OvenEndpoint.h

Lines changed: 20 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -33,17 +33,20 @@ namespace TemperatureControlledCabinet {
3333
class OvenModeDelegate : public ModeBase::Delegate
3434
{
3535
public:
36-
// Oven mode constants - made static and public for potential reuse
37-
static constexpr uint8_t kModeBake = 0;
38-
static constexpr uint8_t kModeConvection = 1;
39-
static constexpr uint8_t kModeGrill = 2;
40-
static constexpr uint8_t kModeRoast = 3;
41-
static constexpr uint8_t kModeClean = 4;
42-
static constexpr uint8_t kModeConvectionBake = 5;
43-
static constexpr uint8_t kModeConvectionRoast = 6;
44-
static constexpr uint8_t kModeWarming = 7;
45-
static constexpr uint8_t kModeProofing = 8;
46-
static constexpr uint8_t kModeCount = 9;
36+
// Oven mode enum for better type safety and code clarity
37+
enum class OvenModes : uint8_t
38+
{
39+
kModeBake = 0,
40+
kModeConvection = 1,
41+
kModeGrill = 2,
42+
kModeRoast = 3,
43+
kModeClean = 4,
44+
kModeConvectionBake = 5,
45+
kModeConvectionRoast = 6,
46+
kModeWarming = 7,
47+
kModeProofing = 8,
48+
kModeCount = 9,
49+
};
4750

4851
OvenModeDelegate(EndpointId endpointId) : mEndpointId(endpointId) {}
4952

@@ -75,11 +78,13 @@ class TemperatureControlledCabinetEndpoint
7578
{
7679
public:
7780
TemperatureControlledCabinetEndpoint(EndpointId endpointId) :
78-
mEndpointId(endpointId), mOvenModeDelegate(endpointId), mOvenModeInstance(&mOvenModeDelegate, mEndpointId, OvenMode::Id, 0)
81+
mEndpointId(endpointId), mOvenModeDelegate(mEndpointId), mOvenModeInstance(&mOvenModeDelegate, mEndpointId, OvenMode::Id, 0)
7982
{}
8083

8184
/**
82-
* Initialize the temperature controlled cabinet endpoint.
85+
* @brief Initialize the temperature controlled cabinet endpoint. Sets the oven mode cluster instance with the appropriate delegate.
86+
*
87+
* @return returns CHIP_NO_ERROR on success, or an error code on failure.
8388
*/
8489
CHIP_ERROR Init();
8590

@@ -102,6 +107,8 @@ class OvenEndpoint
102107

103108
/**
104109
* @brief Initialize the oven endpoint.
110+
*
111+
* @return returns CHIP_NO_ERROR on success, or an error code on failure.
105112
*/
106113
CHIP_ERROR Init();
107114
};

examples/oven-app/oven-app-common/oven-app.matter

Lines changed: 89 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -761,6 +761,83 @@ cluster OtaSoftwareUpdateProvider = 41 {
761761
command NotifyUpdateApplied(NotifyUpdateAppliedRequest): DefaultSuccess = 4;
762762
}
763763

764+
/** Provides an interface for downloading and applying OTA software updates */
765+
cluster OtaSoftwareUpdateRequestor = 42 {
766+
revision 1; // NOTE: Default/not specifically set
767+
768+
enum AnnouncementReasonEnum : enum8 {
769+
kSimpleAnnouncement = 0;
770+
kUpdateAvailable = 1;
771+
kUrgentUpdateAvailable = 2;
772+
}
773+
774+
enum ChangeReasonEnum : enum8 {
775+
kUnknown = 0;
776+
kSuccess = 1;
777+
kFailure = 2;
778+
kTimeOut = 3;
779+
kDelayByProvider = 4;
780+
}
781+
782+
enum UpdateStateEnum : enum8 {
783+
kUnknown = 0;
784+
kIdle = 1;
785+
kQuerying = 2;
786+
kDelayedOnQuery = 3;
787+
kDownloading = 4;
788+
kApplying = 5;
789+
kDelayedOnApply = 6;
790+
kRollingBack = 7;
791+
kDelayedOnUserConsent = 8;
792+
}
793+
794+
fabric_scoped struct ProviderLocation {
795+
node_id providerNodeID = 1;
796+
endpoint_no endpoint = 2;
797+
fabric_idx fabricIndex = 254;
798+
}
799+
800+
info event StateTransition = 0 {
801+
UpdateStateEnum previousState = 0;
802+
UpdateStateEnum newState = 1;
803+
ChangeReasonEnum reason = 2;
804+
nullable int32u targetSoftwareVersion = 3;
805+
}
806+
807+
critical event VersionApplied = 1 {
808+
int32u softwareVersion = 0;
809+
int16u productID = 1;
810+
}
811+
812+
info event DownloadError = 2 {
813+
int32u softwareVersion = 0;
814+
int64u bytesDownloaded = 1;
815+
nullable int8u progressPercent = 2;
816+
nullable int64s platformCode = 3;
817+
}
818+
819+
attribute access(write: administer) ProviderLocation defaultOTAProviders[] = 0;
820+
readonly attribute boolean updatePossible = 1;
821+
readonly attribute UpdateStateEnum updateState = 2;
822+
readonly attribute nullable int8u updateStateProgress = 3;
823+
readonly attribute command_id generatedCommandList[] = 65528;
824+
readonly attribute command_id acceptedCommandList[] = 65529;
825+
readonly attribute attrib_id attributeList[] = 65531;
826+
readonly attribute bitmap32 featureMap = 65532;
827+
readonly attribute int16u clusterRevision = 65533;
828+
829+
request struct AnnounceOTAProviderRequest {
830+
node_id providerNodeID = 0;
831+
vendor_id vendorID = 1;
832+
AnnouncementReasonEnum announcementReason = 2;
833+
optional octet_string<512> metadataForNode = 3;
834+
endpoint_no endpoint = 4;
835+
}
836+
837+
/** Announce the presence of an OTA Provider */
838+
command access(invoke: administer) AnnounceOTAProvider(AnnounceOTAProviderRequest): DefaultSuccess = 0;
839+
}
840+
764841
/** This cluster is used to manage global aspects of the Commissioning flow. */
765842
cluster GeneralCommissioning = 48 {
766843
revision 2;
@@ -2051,6 +2128,18 @@ endpoint 0 {
20512128
callback attribute clusterRevision;
20522129
}
20532130

2131+
server cluster OtaSoftwareUpdateRequestor {
2132+
callback attribute defaultOTAProviders;
2133+
ram attribute updatePossible default = true;
2134+
ram attribute updateState default = 0;
2135+
ram attribute updateStateProgress;
2136+
callback attribute generatedCommandList;
2137+
callback attribute acceptedCommandList;
2138+
callback attribute attributeList;
2139+
ram attribute featureMap default = 0;
2140+
ram attribute clusterRevision default = 1;
2141+
}
2142+
20542143
server cluster GeneralCommissioning {
20552144
callback attribute breadcrumb;
20562145
callback attribute basicCommissioningInfo;

examples/oven-app/oven-app-common/oven-app.zap

Lines changed: 154 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -902,6 +902,160 @@
902902
}
903903
]
904904
},
905+
{
906+
"name": "OTA Software Update Requestor",
907+
"code": 42,
908+
"mfgCode": null,
909+
"define": "OTA_SOFTWARE_UPDATE_REQUESTOR_CLUSTER",
910+
"side": "server",
911+
"enabled": 1,
912+
"attributes": [
913+
{
914+
"name": "DefaultOTAProviders",
915+
"code": 0,
916+
"mfgCode": null,
917+
"side": "server",
918+
"type": "array",
919+
"included": 1,
920+
"storageOption": "External",
921+
"singleton": 0,
922+
"bounded": 0,
923+
"defaultValue": null,
924+
"reportable": 1,
925+
"minInterval": 1,
926+
"maxInterval": 65534,
927+
"reportableChange": 0
928+
},
929+
{
930+
"name": "UpdatePossible",
931+
"code": 1,
932+
"mfgCode": null,
933+
"side": "server",
934+
"type": "boolean",
935+
"included": 1,
936+
"storageOption": "RAM",
937+
"singleton": 0,
938+
"bounded": 0,
939+
"defaultValue": "true",
940+
"reportable": 1,
941+
"minInterval": 1,
942+
"maxInterval": 65534,
943+
"reportableChange": 0
944+
},
945+
{
946+
"name": "UpdateState",
947+
"code": 2,
948+
"mfgCode": null,
949+
"side": "server",
950+
"type": "UpdateStateEnum",
951+
"included": 1,
952+
"storageOption": "RAM",
953+
"singleton": 0,
954+
"bounded": 0,
955+
"defaultValue": "0",
956+
"reportable": 1,
957+
"minInterval": 1,
958+
"maxInterval": 65534,
959+
"reportableChange": 0
960+
},
961+
{
962+
"name": "UpdateStateProgress",
963+
"code": 3,
964+
"mfgCode": null,
965+
"side": "server",
966+
"type": "int8u",
967+
"included": 1,
968+
"storageOption": "RAM",
969+
"singleton": 0,
970+
"bounded": 0,
971+
"defaultValue": "",
972+
"reportable": 1,
973+
"minInterval": 1,
974+
"maxInterval": 65534,
975+
"reportableChange": 0
976+
},
977+
{
978+
"name": "GeneratedCommandList",
979+
"code": 65528,
980+
"mfgCode": null,
981+
"side": "server",
982+
"type": "array",
983+
"included": 1,
984+
"storageOption": "External",
985+
"singleton": 0,
986+
"bounded": 0,
987+
"defaultValue": null,
988+
"reportable": 1,
989+
"minInterval": 1,
990+
"maxInterval": 65534,
991+
"reportableChange": 0
992+
},
993+
{
994+
"name": "AcceptedCommandList",
995+
"code": 65529,
996+
"mfgCode": null,
997+
"side": "server",
998+
"type": "array",
999+
"included": 1,
1000+
"storageOption": "External",
1001+
"singleton": 0,
1002+
"bounded": 0,
1003+
"defaultValue": null,
1004+
"reportable": 1,
1005+
"minInterval": 1,
1006+
"maxInterval": 65534,
1007+
"reportableChange": 0
1008+
},
1009+
{
1010+
"name": "AttributeList",
1011+
"code": 65531,
1012+
"mfgCode": null,
1013+
"side": "server",
1014+
"type": "array",
1015+
"included": 1,
1016+
"storageOption": "External",
1017+
"singleton": 0,
1018+
"bounded": 0,
1019+
"defaultValue": null,
1020+
"reportable": 1,
1021+
"minInterval": 1,
1022+
"maxInterval": 65534,
1023+
"reportableChange": 0
1024+
},
1025+
{
1026+
"name": "FeatureMap",
1027+
"code": 65532,
1028+
"mfgCode": null,
1029+
"side": "server",
1030+
"type": "bitmap32",
1031+
"included": 1,
1032+
"storageOption": "RAM",
1033+
"singleton": 0,
1034+
"bounded": 0,
1035+
"defaultValue": "0",
1036+
"reportable": 1,
1037+
"minInterval": 1,
1038+
"maxInterval": 65534,
1039+
"reportableChange": 0
1040+
},
1041+
{
1042+
"name": "ClusterRevision",
1043+
"code": 65533,
1044+
"mfgCode": null,
1045+
"side": "server",
1046+
"type": "int16u",
1047+
"included": 1,
1048+
"storageOption": "RAM",
1049+
"singleton": 0,
1050+
"bounded": 0,
1051+
"defaultValue": "1",
1052+
"reportable": 1,
1053+
"minInterval": 1,
1054+
"maxInterval": 65534,
1055+
"reportableChange": 0
1056+
}
1057+
]
1058+
},
9051059
{
9061060
"name": "General Commissioning",
9071061
"code": 48,

0 commit comments

Comments
 (0)