Skip to content

Commit 52f5dfc

Browse files
committed
Added OTA requester
1 parent b09507b commit 52f5dfc

5 files changed

+1092
-10
lines changed

examples/refrigerator-app/silabs/build_for_wifi_args.gni

+1-1
Original file line numberDiff line numberDiff line change
@@ -17,5 +17,5 @@ import("${chip_root}/config/standalone/args.gni")
1717
silabs_sdk_target = get_label_info(":sdk", "label_no_toolchain")
1818
import("${chip_root}/src/platform/silabs/wifi_args.gni")
1919
chip_enable_wifi = true
20-
chip_enable_ota_requestor = false
20+
chip_enable_ota_requestor = true
2121
app_data_model = "${chip_root}/examples/refrigerator-app/silabs/data_model:silabs-refrigerator"

examples/refrigerator-app/silabs/data_model/refrigerator-thread-app.matter

+266-1
Original file line numberDiff line numberDiff line change
@@ -496,6 +496,160 @@ cluster BasicInformation = 40 {
496496
command MfgSpecificPing(): DefaultSuccess = 0;
497497
}
498498

499+
/** Provides an interface for providing OTA software updates */
500+
cluster OtaSoftwareUpdateProvider = 41 {
501+
revision 1; // NOTE: Default/not specifically set
502+
503+
enum ApplyUpdateActionEnum : enum8 {
504+
kProceed = 0;
505+
kAwaitNextAction = 1;
506+
kDiscontinue = 2;
507+
}
508+
509+
enum DownloadProtocolEnum : enum8 {
510+
kBDXSynchronous = 0;
511+
kBDXAsynchronous = 1;
512+
kHTTPS = 2;
513+
kVendorSpecific = 3;
514+
}
515+
516+
enum StatusEnum : enum8 {
517+
kUpdateAvailable = 0;
518+
kBusy = 1;
519+
kNotAvailable = 2;
520+
kDownloadProtocolNotSupported = 3;
521+
}
522+
523+
readonly attribute command_id generatedCommandList[] = 65528;
524+
readonly attribute command_id acceptedCommandList[] = 65529;
525+
readonly attribute event_id eventList[] = 65530;
526+
readonly attribute attrib_id attributeList[] = 65531;
527+
readonly attribute bitmap32 featureMap = 65532;
528+
readonly attribute int16u clusterRevision = 65533;
529+
530+
request struct QueryImageRequest {
531+
vendor_id vendorID = 0;
532+
int16u productID = 1;
533+
int32u softwareVersion = 2;
534+
DownloadProtocolEnum protocolsSupported[] = 3;
535+
optional int16u hardwareVersion = 4;
536+
optional char_string<2> location = 5;
537+
optional boolean requestorCanConsent = 6;
538+
optional octet_string<512> metadataForProvider = 7;
539+
}
540+
541+
response struct QueryImageResponse = 1 {
542+
StatusEnum status = 0;
543+
optional int32u delayedActionTime = 1;
544+
optional char_string<256> imageURI = 2;
545+
optional int32u softwareVersion = 3;
546+
optional char_string<64> softwareVersionString = 4;
547+
optional octet_string<32> updateToken = 5;
548+
optional boolean userConsentNeeded = 6;
549+
optional octet_string<512> metadataForRequestor = 7;
550+
}
551+
552+
request struct ApplyUpdateRequestRequest {
553+
octet_string<32> updateToken = 0;
554+
int32u newVersion = 1;
555+
}
556+
557+
response struct ApplyUpdateResponse = 3 {
558+
ApplyUpdateActionEnum action = 0;
559+
int32u delayedActionTime = 1;
560+
}
561+
562+
request struct NotifyUpdateAppliedRequest {
563+
octet_string<32> updateToken = 0;
564+
int32u softwareVersion = 1;
565+
}
566+
567+
/** Determine availability of a new Software Image */
568+
command QueryImage(QueryImageRequest): QueryImageResponse = 0;
569+
/** Determine next action to take for a downloaded Software Image */
570+
command ApplyUpdateRequest(ApplyUpdateRequestRequest): ApplyUpdateResponse = 2;
571+
/** Notify OTA Provider that an update was applied */
572+
command NotifyUpdateApplied(NotifyUpdateAppliedRequest): DefaultSuccess = 4;
573+
}
574+
575+
/** Provides an interface for downloading and applying OTA software updates */
576+
cluster OtaSoftwareUpdateRequestor = 42 {
577+
revision 1; // NOTE: Default/not specifically set
578+
579+
enum AnnouncementReasonEnum : enum8 {
580+
kSimpleAnnouncement = 0;
581+
kUpdateAvailable = 1;
582+
kUrgentUpdateAvailable = 2;
583+
}
584+
585+
enum ChangeReasonEnum : enum8 {
586+
kUnknown = 0;
587+
kSuccess = 1;
588+
kFailure = 2;
589+
kTimeOut = 3;
590+
kDelayByProvider = 4;
591+
}
592+
593+
enum UpdateStateEnum : enum8 {
594+
kUnknown = 0;
595+
kIdle = 1;
596+
kQuerying = 2;
597+
kDelayedOnQuery = 3;
598+
kDownloading = 4;
599+
kApplying = 5;
600+
kDelayedOnApply = 6;
601+
kRollingBack = 7;
602+
kDelayedOnUserConsent = 8;
603+
}
604+
605+
fabric_scoped struct ProviderLocation {
606+
node_id providerNodeID = 1;
607+
endpoint_no endpoint = 2;
608+
fabric_idx fabricIndex = 254;
609+
}
610+
611+
info event StateTransition = 0 {
612+
UpdateStateEnum previousState = 0;
613+
UpdateStateEnum newState = 1;
614+
ChangeReasonEnum reason = 2;
615+
nullable int32u targetSoftwareVersion = 3;
616+
}
617+
618+
critical event VersionApplied = 1 {
619+
int32u softwareVersion = 0;
620+
int16u productID = 1;
621+
}
622+
623+
info event DownloadError = 2 {
624+
int32u softwareVersion = 0;
625+
int64u bytesDownloaded = 1;
626+
nullable int8u progressPercent = 2;
627+
nullable int64s platformCode = 3;
628+
}
629+
630+
attribute access(write: administer) ProviderLocation defaultOTAProviders[] = 0;
631+
readonly attribute boolean updatePossible = 1;
632+
readonly attribute UpdateStateEnum updateState = 2;
633+
readonly attribute nullable int8u updateStateProgress = 3;
634+
readonly attribute command_id generatedCommandList[] = 65528;
635+
readonly attribute command_id acceptedCommandList[] = 65529;
636+
readonly attribute event_id eventList[] = 65530;
637+
readonly attribute attrib_id attributeList[] = 65531;
638+
readonly attribute bitmap32 featureMap = 65532;
639+
readonly attribute int16u clusterRevision = 65533;
640+
641+
request struct AnnounceOTAProviderRequest {
642+
node_id providerNodeID = 0;
643+
vendor_id vendorID = 1;
644+
AnnouncementReasonEnum announcementReason = 2;
645+
optional octet_string<512> metadataForNode = 3;
646+
endpoint_no endpoint = 4;
647+
}
648+
649+
/** Announce the presence of an OTA Provider */
650+
command AnnounceOTAProvider(AnnounceOTAProviderRequest): DefaultSuccess = 0;
651+
}
652+
499653
/** This cluster is used to manage global aspects of the Commissioning flow. */
500654
cluster GeneralCommissioning = 48 {
501655
revision 1; // NOTE: Default/not specifically set
@@ -535,7 +689,6 @@ cluster GeneralCommissioning = 48 {
535689
provisional readonly attribute access(read: administer) optional int16u TCMinRequiredVersion = 6;
536690
provisional readonly attribute access(read: administer) optional bitmap16 TCAcknowledgements = 7;
537691
provisional readonly attribute access(read: administer) optional boolean TCAcknowledgementsRequired = 8;
538-
provisional readonly attribute access(read: administer) optional int32u TCUpdateDeadline = 9;
539692
readonly attribute command_id generatedCommandList[] = 65528;
540693
readonly attribute command_id acceptedCommandList[] = 65529;
541694
readonly attribute event_id eventList[] = 65530;
@@ -1547,6 +1700,34 @@ endpoint 0 {
15471700
ram attribute clusterRevision default = 3;
15481701
}
15491702

1703+
server cluster OtaSoftwareUpdateProvider {
1704+
callback attribute generatedCommandList;
1705+
callback attribute acceptedCommandList;
1706+
callback attribute eventList;
1707+
callback attribute attributeList;
1708+
ram attribute featureMap default = 0;
1709+
ram attribute clusterRevision default = 1;
1710+
1711+
handle command QueryImage;
1712+
handle command QueryImageResponse;
1713+
handle command ApplyUpdateRequest;
1714+
handle command ApplyUpdateResponse;
1715+
handle command NotifyUpdateApplied;
1716+
}
1717+
1718+
server cluster OtaSoftwareUpdateRequestor {
1719+
callback attribute defaultOTAProviders;
1720+
ram attribute updatePossible default = true;
1721+
ram attribute updateState default = Unknown;
1722+
ram attribute updateStateProgress;
1723+
callback attribute generatedCommandList;
1724+
callback attribute acceptedCommandList;
1725+
callback attribute eventList;
1726+
callback attribute attributeList;
1727+
ram attribute featureMap default = 0;
1728+
ram attribute clusterRevision default = 1;
1729+
}
1730+
15501731
server cluster GeneralCommissioning {
15511732
ram attribute breadcrumb default = 0x0000000000000000;
15521733
callback attribute basicCommissioningInfo;
@@ -1728,6 +1909,34 @@ endpoint 1 {
17281909
callback attribute clusterRevision;
17291910
}
17301911

1912+
server cluster OtaSoftwareUpdateProvider {
1913+
callback attribute generatedCommandList;
1914+
callback attribute acceptedCommandList;
1915+
callback attribute eventList;
1916+
callback attribute attributeList;
1917+
ram attribute featureMap default = 0;
1918+
ram attribute clusterRevision default = 1;
1919+
1920+
handle command QueryImage;
1921+
handle command QueryImageResponse;
1922+
handle command ApplyUpdateRequest;
1923+
handle command ApplyUpdateResponse;
1924+
handle command NotifyUpdateApplied;
1925+
}
1926+
1927+
server cluster OtaSoftwareUpdateRequestor {
1928+
callback attribute defaultOTAProviders;
1929+
ram attribute updatePossible default = true;
1930+
ram attribute updateState default = Unknown;
1931+
ram attribute updateStateProgress;
1932+
callback attribute generatedCommandList;
1933+
callback attribute acceptedCommandList;
1934+
callback attribute eventList;
1935+
callback attribute attributeList;
1936+
ram attribute featureMap default = 0;
1937+
ram attribute clusterRevision default = 1;
1938+
}
1939+
17311940
server cluster RefrigeratorAndTemperatureControlledCabinetMode {
17321941
callback attribute supportedModes;
17331942
callback attribute currentMode;
@@ -1770,6 +1979,34 @@ endpoint 2 {
17701979
callback attribute clusterRevision;
17711980
}
17721981

1982+
server cluster OtaSoftwareUpdateProvider {
1983+
callback attribute generatedCommandList;
1984+
callback attribute acceptedCommandList;
1985+
callback attribute eventList;
1986+
callback attribute attributeList;
1987+
ram attribute featureMap default = 0;
1988+
ram attribute clusterRevision default = 1;
1989+
1990+
handle command QueryImage;
1991+
handle command QueryImageResponse;
1992+
handle command ApplyUpdateRequest;
1993+
handle command ApplyUpdateResponse;
1994+
handle command NotifyUpdateApplied;
1995+
}
1996+
1997+
server cluster OtaSoftwareUpdateRequestor {
1998+
callback attribute defaultOTAProviders;
1999+
ram attribute updatePossible default = true;
2000+
ram attribute updateState default = Unknown;
2001+
ram attribute updateStateProgress;
2002+
callback attribute generatedCommandList;
2003+
callback attribute acceptedCommandList;
2004+
callback attribute eventList;
2005+
callback attribute attributeList;
2006+
ram attribute featureMap default = 0;
2007+
ram attribute clusterRevision default = 1;
2008+
}
2009+
17732010
server cluster TemperatureControl {
17742011
ram attribute temperatureSetpoint;
17752012
ram attribute minTemperature;
@@ -1800,6 +2037,34 @@ endpoint 3 {
18002037
callback attribute clusterRevision;
18012038
}
18022039

2040+
server cluster OtaSoftwareUpdateProvider {
2041+
callback attribute generatedCommandList;
2042+
callback attribute acceptedCommandList;
2043+
callback attribute eventList;
2044+
callback attribute attributeList;
2045+
ram attribute featureMap default = 0;
2046+
ram attribute clusterRevision default = 1;
2047+
2048+
handle command QueryImage;
2049+
handle command QueryImageResponse;
2050+
handle command ApplyUpdateRequest;
2051+
handle command ApplyUpdateResponse;
2052+
handle command NotifyUpdateApplied;
2053+
}
2054+
2055+
server cluster OtaSoftwareUpdateRequestor {
2056+
callback attribute defaultOTAProviders;
2057+
ram attribute updatePossible default = true;
2058+
ram attribute updateState default = Unknown;
2059+
ram attribute updateStateProgress;
2060+
callback attribute generatedCommandList;
2061+
callback attribute acceptedCommandList;
2062+
callback attribute eventList;
2063+
callback attribute attributeList;
2064+
ram attribute featureMap default = 0;
2065+
ram attribute clusterRevision default = 1;
2066+
}
2067+
18032068
server cluster TemperatureControl {
18042069
ram attribute temperatureSetpoint;
18052070
ram attribute minTemperature;

0 commit comments

Comments
 (0)