Skip to content

Commit 4723411

Browse files
hicklinrestyled-commitstcarmelveilleuxbzbarsky-appleplauric
authored andcommitted
Mode base sdk implementation (#27504)
* Added first draft of the ModeBase SDK implementation. * Fixed build files and mode base source files from mode select references. * Fixed final errors. * Removed global accessor functions in place instance attributes. * Renamed internal members to mX. Replaced the use the zap Feature map with and internally managed variable. * Added Command Types and DecodableTypes to the SDK implementation to bypass the limitations of the the current zap generation. * Added ModeBase attributes to the list of attributeAccessInterfaceAttributes to ensure that not RAM memory is allocated for these attibutes. * Merged the mode base delegate into the mode base instance due to attribute accessability following management of attributes by the mode base instance. * Added documentation and readme for the ModeBase alias. * Added the dishwasher mode cluster to the all-clusters-app example. * Added the laundry washer mode cluster to the all-clusters-app example. * Added the refrigerator and temperature controlled cabinet mode cluster to the all-clusters-app example. * Renamed the mode base alias all-clusters-app examples to the correct naming. * Implemented interaction between the ModeBase and OnOff servers. Added ModeBase attribute type infos. Updated documentation. * Restyled by whitespace * Restyled by clang-format * Restyled by gn * Restyled by prettier-markdown * Fixed copy paste issues in the mode base cluster objects. * Moved the ModeBaseAliasesInstanceMap into the ModeBase namespace and added a getter for it. * Moved OnOff server common behavior in a top-level anonymous namespace method. * Apply suggestions from code review Accepted readme suggestions. Co-authored-by: Tennessee Carmel-Veilleux <[email protected]> * Renamed the readme * Added doc to ModeBase instance init. Removed the use of using in made-base-server.h * Added validity checking when updating attributes. * Made ModeBase functions that are required to be implemented by the user pure virtural. * Renamed constants according to the convention. * Made persistant attributes persistant. Experimented with helper accessor functions for persistent attributes. * Fixed code after merge * Regenerats all-clusters-app.matter after merge * Restyled by clang-format * Restyled by prettier-markdown * Simplified IsSupportedMode to make it more readable. * Removed the use of using from header files. * Removed the use of using from mode-base-server.h. * Enabled UpdateModeBaseCurrentModeToOnMode only when the ModeBase plugin is enabled. * Restyled by clang-format * In the OnOff server, include mode-base only when the ModeBase plugin is enabled. * Fixed AliasedCluster's type * Changed to calling of Update sttribute functions when loading persistent attributes on init. * Moved the ChangeToModeResponse command from the accepted commands to the generated commands list. * Renamed isAliasedCluster to isDerivedCluster. * Refactored the supported modes encoding to make the Read switch statement more readable. * Fixed typos in the ModeBase readme. Co-authored-by: Boris Zbarsky <[email protected]> * Simplified the encoding function and some comments. * Fixed var naming and GetModeLabelByIndex return. * Fixed incorrect version number in some ModeBase derived clusters. * Made mode base derived cluster code more readble with using * Removed unneccissary namespace paths. * Removed unneccissary size checking. * Refactored GetModeTagsByIndex to make it more readable. * Added new StatusCode. * Used chip::CharSpan::fromCharString to avoid setting the length. * Added missing function nampspace. * Made the mode-base-cluster-objects.h more readable by removing unneccessery namespace specifications. * Made the mode-base-cluster-objects.h more readable by simplifying the DecodableArgType definition. * Removed redundant processing in the Read function. * Added cluster constants to make the code more readabel. * Changed attribute write errors. * Added attribute getters and setters documentaton. * Added FeatureMap to the list of attributeAccessInterfaceAttributes. * Used std::set instead of std::map to hold the ModeBase Instances. * Removed the BuildModeOptionStruct helper function to avoid giving incorroct expectations to the SDK consumers. * Changed the Delegate's API to remove the need for the GetNumberOfModes method. * Changed checks for essetion setup in the ModeBase init to VerifyOrDie. * Moved the setting of the CurrentMode based on the StartUpMode, OnMode and OnOff cluster values to the ModeBase init function. Added some TODOs from the reviews. * Added documentation about the required lifetime of the ModeBase Instance object. * Refoctored ModeBase to separate out the Delegate functionality into a separate class. * Added generated code after merge * Restyled by clang-format * Restyled by gn * Restyled by prettier-markdown * Added ModeBase to the spellcheck. Allowed the use of set in mode-base-server.h * Removed the ModeBase constraint that the cluster ID given should be of an actual ModeBase derived cluster. * Changed the ModeBase derived cluster's instatiation in the all-clusters-app to make it easier to include for all platforms. * Defined EMBER_AF_PLUGIN_MODE_BASE for the linux all-clustres-app to enable OfOff cluster related code. * Restyled by whitespace * Restyled by clang-format * Restyled by prettier-markdown * Fixed the lock app gni argument chip_project_config_include_dirs as it was pointing to the all-clusters-app's include dir. * Fixed ModeBase derived clusters version numbers in zap. * Apply suggestions from code review Co-authored-by: Boris Zbarsky <[email protected]> * Updated the Mode Base readme afther review. * Removed ModeBase from the .github/.wordlist.txt Co-authored-by: Boris Zbarsky <[email protected]> * Unregister the AttributeAccessOverride when deconstructing a Mode Base instance. * Added // nogncheck to the Mode Base includes in the OnOff server code. * Updated Mode Base function documentatio. * Added read case for the Feature Map. * Restyled by clang-format * Restyled by prettier-markdown * used the feature map's enum instead of a literal number in the Mode Bease examples. * Restyled by clang-format * Fixed return bug in the Mode Base RVC examples. * Update .github/workflows/build.yaml Co-authored-by: Boris Zbarsky <[email protected]> * Fixed attribute get issue in the Mode Base RVC example. Co-authored-by: Petru Lauric <[email protected]> * Checkedout out-of-sync third-party repos to match what is on master. * Restyled by clang-format --------- Co-authored-by: Restyled.io <[email protected]> Co-authored-by: Tennessee Carmel-Veilleux <[email protected]> Co-authored-by: Boris Zbarsky <[email protected]> Co-authored-by: Petru Lauric <[email protected]>
1 parent 00a8502 commit 4723411

36 files changed

+3774
-864
lines changed

examples/all-clusters-app/all-clusters-common/all-clusters-app.matter

+309
Original file line numberDiff line numberDiff line change
@@ -2489,6 +2489,204 @@ server cluster ModeSelect = 80 {
24892489
command ChangeToMode(ChangeToModeRequest): DefaultSuccess = 0;
24902490
}
24912491

2492+
/** Attributes and commands for selecting a mode from a list of supported options. */
2493+
server cluster LaundryWasherMode = 81 {
2494+
enum ModeTag : ENUM16 {
2495+
kNormal = 16384;
2496+
kDelicate = 16385;
2497+
kHeavy = 16386;
2498+
kWhites = 16387;
2499+
}
2500+
2501+
bitmap Feature : BITMAP32 {
2502+
kOnOff = 0x1;
2503+
}
2504+
2505+
struct ModeTagStruct {
2506+
optional vendor_id mfgCode = 0;
2507+
enum16 value = 1;
2508+
}
2509+
2510+
struct ModeOptionStruct {
2511+
char_string<64> label = 0;
2512+
int8u mode = 1;
2513+
ModeTagStruct modeTags[] = 2;
2514+
}
2515+
2516+
readonly attribute ModeOptionStruct supportedModes[] = 0;
2517+
readonly attribute int8u currentMode = 1;
2518+
attribute nullable int8u startUpMode = 2;
2519+
attribute nullable int8u onMode = 3;
2520+
readonly attribute command_id generatedCommandList[] = 65528;
2521+
readonly attribute command_id acceptedCommandList[] = 65529;
2522+
readonly attribute event_id eventList[] = 65530;
2523+
readonly attribute attrib_id attributeList[] = 65531;
2524+
readonly attribute bitmap32 featureMap = 65532;
2525+
readonly attribute int16u clusterRevision = 65533;
2526+
2527+
request struct ChangeToModeRequest {
2528+
INT8U newMode = 0;
2529+
}
2530+
2531+
response struct ChangeToModeResponse = 1 {
2532+
ENUM8 status = 0;
2533+
optional CHAR_STRING statusText = 1;
2534+
}
2535+
2536+
command ChangeToMode(ChangeToModeRequest): ChangeToModeResponse = 0;
2537+
}
2538+
2539+
/** Attributes and commands for selecting a mode from a list of supported options. */
2540+
server cluster RefrigeratorAndTemperatureControlledCabinetMode = 82 {
2541+
enum ModeTag : ENUM16 {
2542+
kRapidCool = 16384;
2543+
kRapidFreeze = 16385;
2544+
}
2545+
2546+
bitmap Feature : BITMAP32 {
2547+
kOnOff = 0x1;
2548+
}
2549+
2550+
struct ModeTagStruct {
2551+
optional vendor_id mfgCode = 0;
2552+
enum16 value = 1;
2553+
}
2554+
2555+
struct ModeOptionStruct {
2556+
char_string<64> label = 0;
2557+
int8u mode = 1;
2558+
ModeTagStruct modeTags[] = 2;
2559+
}
2560+
2561+
readonly attribute ModeOptionStruct supportedModes[] = 0;
2562+
readonly attribute int8u currentMode = 1;
2563+
attribute nullable int8u startUpMode = 2;
2564+
attribute nullable int8u onMode = 3;
2565+
readonly attribute command_id generatedCommandList[] = 65528;
2566+
readonly attribute command_id acceptedCommandList[] = 65529;
2567+
readonly attribute event_id eventList[] = 65530;
2568+
readonly attribute attrib_id attributeList[] = 65531;
2569+
readonly attribute bitmap32 featureMap = 65532;
2570+
readonly attribute int16u clusterRevision = 65533;
2571+
2572+
request struct ChangeToModeRequest {
2573+
INT8U newMode = 0;
2574+
}
2575+
2576+
response struct ChangeToModeResponse = 1 {
2577+
ENUM8 status = 0;
2578+
optional CHAR_STRING statusText = 1;
2579+
}
2580+
2581+
command ChangeToMode(ChangeToModeRequest): ChangeToModeResponse = 0;
2582+
}
2583+
2584+
/** Attributes and commands for selecting a mode from a list of supported options. */
2585+
server cluster RvcRunMode = 84 {
2586+
enum ModeTag : ENUM16 {
2587+
kIdle = 16384;
2588+
kCleaning = 16385;
2589+
}
2590+
2591+
enum StatusCode : ENUM8 {
2592+
kStuck = 65;
2593+
kDustBinMissing = 66;
2594+
kDustBinFull = 67;
2595+
kWaterTankEmpty = 68;
2596+
kWaterTankMissing = 69;
2597+
kWaterTankLidOpen = 70;
2598+
kMopCleaningPadMissing = 71;
2599+
kBatteryLow = 72;
2600+
}
2601+
2602+
bitmap Feature : BITMAP32 {
2603+
kOnOff = 0x1;
2604+
}
2605+
2606+
struct ModeTagStruct {
2607+
optional vendor_id mfgCode = 0;
2608+
enum16 value = 1;
2609+
}
2610+
2611+
struct ModeOptionStruct {
2612+
char_string<64> label = 0;
2613+
int8u mode = 1;
2614+
ModeTagStruct modeTags[] = 2;
2615+
}
2616+
2617+
readonly attribute ModeOptionStruct supportedModes[] = 0;
2618+
readonly attribute int8u currentMode = 1;
2619+
attribute nullable int8u startUpMode = 2;
2620+
attribute nullable int8u onMode = 3;
2621+
readonly attribute command_id generatedCommandList[] = 65528;
2622+
readonly attribute command_id acceptedCommandList[] = 65529;
2623+
readonly attribute event_id eventList[] = 65530;
2624+
readonly attribute attrib_id attributeList[] = 65531;
2625+
readonly attribute bitmap32 featureMap = 65532;
2626+
readonly attribute int16u clusterRevision = 65533;
2627+
2628+
request struct ChangeToModeRequest {
2629+
INT8U newMode = 0;
2630+
}
2631+
2632+
response struct ChangeToModeResponse = 1 {
2633+
ENUM8 status = 0;
2634+
optional CHAR_STRING statusText = 1;
2635+
}
2636+
2637+
command ChangeToMode(ChangeToModeRequest): ChangeToModeResponse = 0;
2638+
}
2639+
2640+
/** Attributes and commands for selecting a mode from a list of supported options. */
2641+
server cluster RvcCleanMode = 85 {
2642+
enum ModeTag : ENUM16 {
2643+
kDeepClean = 16384;
2644+
kVacuum = 16385;
2645+
kMop = 16386;
2646+
}
2647+
2648+
enum StatusCode : ENUM8 {
2649+
kCleaningInProgress = 64;
2650+
}
2651+
2652+
bitmap Feature : BITMAP32 {
2653+
kOnOff = 0x1;
2654+
}
2655+
2656+
struct ModeTagStruct {
2657+
optional vendor_id mfgCode = 0;
2658+
enum16 value = 1;
2659+
}
2660+
2661+
struct ModeOptionStruct {
2662+
char_string<64> label = 0;
2663+
int8u mode = 1;
2664+
ModeTagStruct modeTags[] = 2;
2665+
}
2666+
2667+
readonly attribute ModeOptionStruct supportedModes[] = 0;
2668+
readonly attribute int8u currentMode = 1;
2669+
attribute nullable int8u startUpMode = 2;
2670+
attribute nullable int8u onMode = 3;
2671+
readonly attribute command_id generatedCommandList[] = 65528;
2672+
readonly attribute command_id acceptedCommandList[] = 65529;
2673+
readonly attribute event_id eventList[] = 65530;
2674+
readonly attribute attrib_id attributeList[] = 65531;
2675+
readonly attribute bitmap32 featureMap = 65532;
2676+
readonly attribute int16u clusterRevision = 65533;
2677+
2678+
request struct ChangeToModeRequest {
2679+
INT8U newMode = 0;
2680+
}
2681+
2682+
response struct ChangeToModeResponse = 1 {
2683+
ENUM8 status = 0;
2684+
optional CHAR_STRING statusText = 1;
2685+
}
2686+
2687+
command ChangeToMode(ChangeToModeRequest): ChangeToModeResponse = 0;
2688+
}
2689+
24922690
/** Attributes and commands for configuring the temperature control, and reporting temperature. */
24932691
server cluster TemperatureControl = 86 {
24942692
bitmap Feature : BITMAP32 {
@@ -2538,6 +2736,52 @@ server cluster RefrigeratorAlarm = 87 {
25382736
readonly attribute int16u clusterRevision = 65533;
25392737
}
25402738

2739+
/** Attributes and commands for selecting a mode from a list of supported options. */
2740+
server cluster DishwasherMode = 89 {
2741+
enum ModeTag : ENUM16 {
2742+
kNormal = 16384;
2743+
kHeavy = 16385;
2744+
kLight = 16386;
2745+
}
2746+
2747+
bitmap Feature : BITMAP32 {
2748+
kOnOff = 0x1;
2749+
}
2750+
2751+
struct ModeTagStruct {
2752+
optional vendor_id mfgCode = 0;
2753+
enum16 value = 1;
2754+
}
2755+
2756+
struct ModeOptionStruct {
2757+
char_string<64> label = 0;
2758+
int8u mode = 1;
2759+
ModeTagStruct modeTags[] = 2;
2760+
}
2761+
2762+
readonly attribute ModeOptionStruct supportedModes[] = 0;
2763+
readonly attribute int8u currentMode = 1;
2764+
attribute nullable int8u startUpMode = 2;
2765+
attribute nullable int8u onMode = 3;
2766+
readonly attribute command_id generatedCommandList[] = 65528;
2767+
readonly attribute command_id acceptedCommandList[] = 65529;
2768+
readonly attribute event_id eventList[] = 65530;
2769+
readonly attribute attrib_id attributeList[] = 65531;
2770+
readonly attribute bitmap32 featureMap = 65532;
2771+
readonly attribute int16u clusterRevision = 65533;
2772+
2773+
request struct ChangeToModeRequest {
2774+
INT8U newMode = 0;
2775+
}
2776+
2777+
response struct ChangeToModeResponse = 1 {
2778+
ENUM8 status = 0;
2779+
optional CHAR_STRING statusText = 1;
2780+
}
2781+
2782+
command ChangeToMode(ChangeToModeRequest): ChangeToModeResponse = 0;
2783+
}
2784+
25412785
/** Attributes for reporting air quality classification */
25422786
server cluster AirQuality = 91 {
25432787
enum AirQualityEnum : ENUM8 {
@@ -6243,6 +6487,58 @@ endpoint 1 {
62436487
ram attribute manufacturerExtension default = 255;
62446488
}
62456489

6490+
server cluster LaundryWasherMode {
6491+
callback attribute supportedModes;
6492+
callback attribute currentMode;
6493+
callback attribute startUpMode;
6494+
callback attribute onMode;
6495+
callback attribute generatedCommandList;
6496+
callback attribute acceptedCommandList;
6497+
callback attribute eventList;
6498+
callback attribute attributeList;
6499+
ram attribute featureMap default = 0;
6500+
ram attribute clusterRevision default = 1;
6501+
}
6502+
6503+
server cluster RefrigeratorAndTemperatureControlledCabinetMode {
6504+
callback attribute supportedModes;
6505+
callback attribute currentMode;
6506+
callback attribute startUpMode;
6507+
callback attribute onMode;
6508+
callback attribute generatedCommandList;
6509+
callback attribute acceptedCommandList;
6510+
callback attribute eventList;
6511+
callback attribute attributeList;
6512+
ram attribute featureMap default = 0;
6513+
ram attribute clusterRevision default = 1;
6514+
}
6515+
6516+
server cluster RvcRunMode {
6517+
callback attribute supportedModes;
6518+
callback attribute currentMode;
6519+
callback attribute startUpMode;
6520+
callback attribute onMode;
6521+
callback attribute generatedCommandList;
6522+
callback attribute acceptedCommandList;
6523+
callback attribute eventList;
6524+
callback attribute attributeList;
6525+
ram attribute featureMap default = 0;
6526+
ram attribute clusterRevision default = 1;
6527+
}
6528+
6529+
server cluster RvcCleanMode {
6530+
callback attribute supportedModes;
6531+
callback attribute currentMode;
6532+
callback attribute startUpMode;
6533+
callback attribute onMode;
6534+
callback attribute generatedCommandList;
6535+
callback attribute acceptedCommandList;
6536+
callback attribute eventList;
6537+
callback attribute attributeList;
6538+
ram attribute featureMap default = 0;
6539+
ram attribute clusterRevision default = 1;
6540+
}
6541+
62466542
server cluster TemperatureControl {
62476543
ram attribute selectedTemperatureLevel default = 0;
62486544
callback attribute supportedTemperatureLevels;
@@ -6267,6 +6563,19 @@ endpoint 1 {
62676563
ram attribute clusterRevision default = 1;
62686564
}
62696565

6566+
server cluster DishwasherMode {
6567+
callback attribute supportedModes;
6568+
callback attribute currentMode;
6569+
callback attribute startUpMode;
6570+
callback attribute onMode;
6571+
callback attribute generatedCommandList;
6572+
callback attribute acceptedCommandList;
6573+
callback attribute eventList;
6574+
callback attribute attributeList;
6575+
ram attribute featureMap default = 0;
6576+
ram attribute clusterRevision default = 1;
6577+
}
6578+
62706579
server cluster AirQuality {
62716580
ram attribute airQuality default = 0;
62726581
callback attribute generatedCommandList;

0 commit comments

Comments
 (0)