Skip to content

Commit 8464e5f

Browse files
Add OTA Requestor cluster to energy management app (project-chip#37614)
* ESP32: Disable OTA requestor for energy management app. * Add OTA Requestor cluster to energy management app.
1 parent 0b67ce2 commit 8464e5f

File tree

2 files changed

+409
-0
lines changed

2 files changed

+409
-0
lines changed

examples/energy-management-app/energy-management-common/energy-management-app.matter

+172
Original file line numberDiff line numberDiff line change
@@ -546,6 +546,160 @@ cluster BasicInformation = 40 {
546546
command MfgSpecificPing(): DefaultSuccess = 0;
547547
}
548548

549+
/** Provides an interface for providing OTA software updates */
550+
cluster OtaSoftwareUpdateProvider = 41 {
551+
revision 1; // NOTE: Default/not specifically set
552+
553+
enum ApplyUpdateActionEnum : enum8 {
554+
kProceed = 0;
555+
kAwaitNextAction = 1;
556+
kDiscontinue = 2;
557+
}
558+
559+
enum DownloadProtocolEnum : enum8 {
560+
kBDXSynchronous = 0;
561+
kBDXAsynchronous = 1;
562+
kHTTPS = 2;
563+
kVendorSpecific = 3;
564+
}
565+
566+
enum StatusEnum : enum8 {
567+
kUpdateAvailable = 0;
568+
kBusy = 1;
569+
kNotAvailable = 2;
570+
kDownloadProtocolNotSupported = 3;
571+
}
572+
573+
readonly attribute command_id generatedCommandList[] = 65528;
574+
readonly attribute command_id acceptedCommandList[] = 65529;
575+
readonly attribute event_id eventList[] = 65530;
576+
readonly attribute attrib_id attributeList[] = 65531;
577+
readonly attribute bitmap32 featureMap = 65532;
578+
readonly attribute int16u clusterRevision = 65533;
579+
580+
request struct QueryImageRequest {
581+
vendor_id vendorID = 0;
582+
int16u productID = 1;
583+
int32u softwareVersion = 2;
584+
DownloadProtocolEnum protocolsSupported[] = 3;
585+
optional int16u hardwareVersion = 4;
586+
optional char_string<2> location = 5;
587+
optional boolean requestorCanConsent = 6;
588+
optional octet_string<512> metadataForProvider = 7;
589+
}
590+
591+
response struct QueryImageResponse = 1 {
592+
StatusEnum status = 0;
593+
optional int32u delayedActionTime = 1;
594+
optional char_string<256> imageURI = 2;
595+
optional int32u softwareVersion = 3;
596+
optional char_string<64> softwareVersionString = 4;
597+
optional octet_string<32> updateToken = 5;
598+
optional boolean userConsentNeeded = 6;
599+
optional octet_string<512> metadataForRequestor = 7;
600+
}
601+
602+
request struct ApplyUpdateRequestRequest {
603+
octet_string<32> updateToken = 0;
604+
int32u newVersion = 1;
605+
}
606+
607+
response struct ApplyUpdateResponse = 3 {
608+
ApplyUpdateActionEnum action = 0;
609+
int32u delayedActionTime = 1;
610+
}
611+
612+
request struct NotifyUpdateAppliedRequest {
613+
octet_string<32> updateToken = 0;
614+
int32u softwareVersion = 1;
615+
}
616+
617+
/** Determine availability of a new Software Image */
618+
command QueryImage(QueryImageRequest): QueryImageResponse = 0;
619+
/** Determine next action to take for a downloaded Software Image */
620+
command ApplyUpdateRequest(ApplyUpdateRequestRequest): ApplyUpdateResponse = 2;
621+
/** Notify OTA Provider that an update was applied */
622+
command NotifyUpdateApplied(NotifyUpdateAppliedRequest): DefaultSuccess = 4;
623+
}
624+
625+
/** Provides an interface for downloading and applying OTA software updates */
626+
cluster OtaSoftwareUpdateRequestor = 42 {
627+
revision 1; // NOTE: Default/not specifically set
628+
629+
enum AnnouncementReasonEnum : enum8 {
630+
kSimpleAnnouncement = 0;
631+
kUpdateAvailable = 1;
632+
kUrgentUpdateAvailable = 2;
633+
}
634+
635+
enum ChangeReasonEnum : enum8 {
636+
kUnknown = 0;
637+
kSuccess = 1;
638+
kFailure = 2;
639+
kTimeOut = 3;
640+
kDelayByProvider = 4;
641+
}
642+
643+
enum UpdateStateEnum : enum8 {
644+
kUnknown = 0;
645+
kIdle = 1;
646+
kQuerying = 2;
647+
kDelayedOnQuery = 3;
648+
kDownloading = 4;
649+
kApplying = 5;
650+
kDelayedOnApply = 6;
651+
kRollingBack = 7;
652+
kDelayedOnUserConsent = 8;
653+
}
654+
655+
fabric_scoped struct ProviderLocation {
656+
node_id providerNodeID = 1;
657+
endpoint_no endpoint = 2;
658+
fabric_idx fabricIndex = 254;
659+
}
660+
661+
info event StateTransition = 0 {
662+
UpdateStateEnum previousState = 0;
663+
UpdateStateEnum newState = 1;
664+
ChangeReasonEnum reason = 2;
665+
nullable int32u targetSoftwareVersion = 3;
666+
}
667+
668+
critical event VersionApplied = 1 {
669+
int32u softwareVersion = 0;
670+
int16u productID = 1;
671+
}
672+
673+
info event DownloadError = 2 {
674+
int32u softwareVersion = 0;
675+
int64u bytesDownloaded = 1;
676+
nullable int8u progressPercent = 2;
677+
nullable int64s platformCode = 3;
678+
}
679+
680+
attribute access(write: administer) ProviderLocation defaultOTAProviders[] = 0;
681+
readonly attribute boolean updatePossible = 1;
682+
readonly attribute UpdateStateEnum updateState = 2;
683+
readonly attribute nullable int8u updateStateProgress = 3;
684+
readonly attribute command_id generatedCommandList[] = 65528;
685+
readonly attribute command_id acceptedCommandList[] = 65529;
686+
readonly attribute event_id eventList[] = 65530;
687+
readonly attribute attrib_id attributeList[] = 65531;
688+
readonly attribute bitmap32 featureMap = 65532;
689+
readonly attribute int16u clusterRevision = 65533;
690+
691+
request struct AnnounceOTAProviderRequest {
692+
node_id providerNodeID = 0;
693+
vendor_id vendorID = 1;
694+
AnnouncementReasonEnum announcementReason = 2;
695+
optional octet_string<512> metadataForNode = 3;
696+
endpoint_no endpoint = 4;
697+
}
698+
699+
/** Announce the presence of an OTA Provider */
700+
command AnnounceOTAProvider(AnnounceOTAProviderRequest): DefaultSuccess = 0;
701+
}
702+
549703
/** Nodes should be expected to be deployed to any and all regions of the world. These global regions
550704
may have differing common languages, units of measurements, and numerical formatting
551705
standards. As such, Nodes that visually or audibly convey information need a mechanism by which
@@ -2401,6 +2555,7 @@ provisional cluster DeviceEnergyManagementMode = 159 {
24012555
endpoint 0 {
24022556
device type ma_rootdevice = 22, version 1;
24032557

2558+
binding cluster OtaSoftwareUpdateProvider;
24042559

24052560
server cluster Descriptor {
24062561
callback attribute deviceTypeList;
@@ -2450,6 +2605,23 @@ endpoint 0 {
24502605
ram attribute clusterRevision default = 4;
24512606
}
24522607

2608+
server cluster OtaSoftwareUpdateRequestor {
2609+
emits event StateTransition;
2610+
emits event VersionApplied;
2611+
emits event DownloadError;
2612+
callback attribute defaultOTAProviders;
2613+
ram attribute updatePossible default = true;
2614+
ram attribute updateState default = 0;
2615+
ram attribute updateStateProgress;
2616+
callback attribute generatedCommandList;
2617+
callback attribute acceptedCommandList;
2618+
callback attribute attributeList;
2619+
ram attribute featureMap default = 0;
2620+
ram attribute clusterRevision default = 1;
2621+
2622+
handle command AnnounceOTAProvider;
2623+
}
2624+
24532625
server cluster LocalizationConfiguration {
24542626
ram attribute activeLocale;
24552627
callback attribute supportedLocales;

0 commit comments

Comments
 (0)