Skip to content

Commit

Permalink
Laundry dryer controls cluster sdk (#30285)
Browse files Browse the repository at this point in the history
* Steps 1.1, 1.2

* update cluster list and build.gn

This reverts commit feabe0b.

run zap and update build, clusters list

zap_regen_all & build chip-tool

regen zap

updated zap and regen

updated zap and regen

zap_regen_all & build chip-tool

Revert "regen zap"

This reverts commit f259abf.

* controller-clusters.zap and regen_all

* setting optional=false for clusters

* zap_regen_all

* run zap and update build, clusters list

* zap_regen_all & build chip-tool

* Fisrt Pass at SDK code

* SDK is building and running

* now registers laundry controls delegate

added function definitions to override weak definitions that do nothing.

* adding the cluster to preAttributeChange list

* Restyled by clang-format

* Restyled by gn

* regenerated all zap

* reverting submodule changes

* regenerate_zap_all

* update all-clusters zap

* Updated cluster-enums.h path

* Revert "run zap and update build, clusters list"

This reverts commit 17642c9.

* Restyled by clang-format

* update zap

* Attribute fix for SelectedDrynessLevel

* Added Attribute in zcl.json

* Revert "Added Attribute in zcl.json"

This reverts commit 4ee377f.

* adding SupportedDrynessLevels to JSON bits

* Updated zcl test json

* Fix Dryer delegate init on Linux all-clusters

* Restyled by clang-format

* Added static assert for Enum and removed dryer from .json bits

---------

Co-authored-by: Restyled.io <[email protected]>
Co-authored-by: OmAmbalkar <[email protected]>
Co-authored-by: [email protected] <[email protected]>
  • Loading branch information
4 people authored Dec 22, 2023
1 parent 061ff86 commit b096c88
Show file tree
Hide file tree
Showing 13 changed files with 595 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2785,6 +2785,28 @@ cluster BooleanState = 69 {
readonly attribute int16u clusterRevision = 65533;
}

/** This cluster supports remotely monitoring and controling the different typs of
functionality available to a drying device, such as a laundry dryer. */
cluster LaundryDryerControls = 74 {
revision 1; // NOTE: Default/not specifically set

enum DrynessLevelEnum : enum8 {
kLow = 0;
kNormal = 1;
kExtra = 2;
kMax = 3;
}

readonly attribute DrynessLevelEnum supportedDrynessLevels[] = 0;
attribute nullable DrynessLevelEnum selectedDrynessLevel = 1;
readonly attribute command_id generatedCommandList[] = 65528;
readonly attribute command_id acceptedCommandList[] = 65529;
readonly attribute event_id eventList[] = 65530;
readonly attribute attrib_id attributeList[] = 65531;
readonly attribute bitmap32 featureMap = 65532;
readonly attribute int16u clusterRevision = 65533;
}

/** Attributes and commands for selecting a mode from a list of supported options. */
cluster ModeSelect = 80 {
revision 2;
Expand Down Expand Up @@ -7038,6 +7060,17 @@ endpoint 1 {
ram attribute clusterRevision default = 1;
}

server cluster LaundryDryerControls {
callback attribute supportedDrynessLevels;
ram attribute selectedDrynessLevel;
callback attribute generatedCommandList;
callback attribute acceptedCommandList;
callback attribute eventList;
callback attribute attributeList;
ram attribute featureMap default = 0;
ram attribute clusterRevision default = 1;
}

server cluster ModeSelect {
ram attribute description default = "Coffee";
ram attribute standardNamespace default = 0;
Expand Down
141 changes: 140 additions & 1 deletion examples/all-clusters-app/all-clusters-common/all-clusters-app.zap
Original file line number Diff line number Diff line change
Expand Up @@ -8408,6 +8408,144 @@
}
]
},
{
"name": "Laundry Dryer Controls",
"code": 74,
"mfgCode": null,
"define": "LAUNDRY_DRYER_CONTROLS_CLUSTER",
"side": "server",
"enabled": 1,
"attributes": [
{
"name": "SupportedDrynessLevels",
"code": 0,
"mfgCode": null,
"side": "server",
"type": "array",
"included": 1,
"storageOption": "External",
"singleton": 0,
"bounded": 0,
"defaultValue": "",
"reportable": 1,
"minInterval": 1,
"maxInterval": 65534,
"reportableChange": 0
},
{
"name": "SelectedDrynessLevel",
"code": 1,
"mfgCode": null,
"side": "server",
"type": "DrynessLevelEnum",
"included": 1,
"storageOption": "RAM",
"singleton": 0,
"bounded": 0,
"defaultValue": "",
"reportable": 1,
"minInterval": 1,
"maxInterval": 65534,
"reportableChange": 0
},
{
"name": "GeneratedCommandList",
"code": 65528,
"mfgCode": null,
"side": "server",
"type": "array",
"included": 1,
"storageOption": "External",
"singleton": 0,
"bounded": 0,
"defaultValue": "",
"reportable": 1,
"minInterval": 1,
"maxInterval": 65534,
"reportableChange": 0
},
{
"name": "AcceptedCommandList",
"code": 65529,
"mfgCode": null,
"side": "server",
"type": "array",
"included": 1,
"storageOption": "External",
"singleton": 0,
"bounded": 0,
"defaultValue": "",
"reportable": 1,
"minInterval": 1,
"maxInterval": 65534,
"reportableChange": 0
},
{
"name": "EventList",
"code": 65530,
"mfgCode": null,
"side": "server",
"type": "array",
"included": 1,
"storageOption": "External",
"singleton": 0,
"bounded": 0,
"defaultValue": "",
"reportable": 1,
"minInterval": 1,
"maxInterval": 65534,
"reportableChange": 0
},
{
"name": "AttributeList",
"code": 65531,
"mfgCode": null,
"side": "server",
"type": "array",
"included": 1,
"storageOption": "External",
"singleton": 0,
"bounded": 0,
"defaultValue": "",
"reportable": 1,
"minInterval": 1,
"maxInterval": 65534,
"reportableChange": 0
},
{
"name": "FeatureMap",
"code": 65532,
"mfgCode": null,
"side": "server",
"type": "bitmap32",
"included": 1,
"storageOption": "RAM",
"singleton": 0,
"bounded": 0,
"defaultValue": "0",
"reportable": 1,
"minInterval": 1,
"maxInterval": 65534,
"reportableChange": 0
},
{
"name": "ClusterRevision",
"code": 65533,
"mfgCode": null,
"side": "server",
"type": "int16u",
"included": 1,
"storageOption": "RAM",
"singleton": 0,
"bounded": 0,
"defaultValue": "1",
"reportable": 1,
"minInterval": 1,
"maxInterval": 65534,
"reportableChange": 0
}
]
},
{
"name": "Mode Select",
"code": 80,
Expand Down Expand Up @@ -22522,4 +22660,5 @@
}
],
"log": []
}
}

Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
/*
*
* Copyright (c) 2023 Project CHIP Authors
* All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

#pragma once

#include <app/clusters/laundry-dryer-controls-server/laundry-dryer-controls-delegate.h>
#include <app/clusters/laundry-dryer-controls-server/laundry-dryer-controls-server.h>
#include <app/util/af.h>
#include <app/util/config.h>
#include <cstring>

namespace chip {
namespace app {
namespace Clusters {
namespace LaundryDryerControls {

/**
* The application delegate to statically define the options.
*/

class LaundryDryerControlDelegate : public Delegate
{
static const DrynessLevelEnum supportedDrynessLevelOptions[];
static LaundryDryerControlDelegate instance;

public:
CHIP_ERROR GetSupportedDrynessLevelAtIndex(size_t index, DrynessLevelEnum & supportedDrynessLevel);

LaundryDryerControlDelegate() = default;
~LaundryDryerControlDelegate() = default;

static inline LaundryDryerControlDelegate & getLaundryDryerControlDelegate() { return instance; }
};

} // namespace LaundryDryerControls
} // namespace Clusters
} // namespace app
} // namespace chip
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
/*
*
* Copyright (c) 2023 Project CHIP Authors
* All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include <app/clusters/laundry-dryer-controls-server/laundry-dryer-controls-server.h>
#include <app/util/config.h>
#include <laundry-dryer-controls-delegate-impl.h>

using namespace chip;
using namespace chip::app::Clusters::LaundryDryerControls;

const DrynessLevelEnum LaundryDryerControlDelegate::supportedDrynessLevelOptions[] = { DrynessLevelEnum::kLow,
DrynessLevelEnum::kNormal,
DrynessLevelEnum::kMax };

LaundryDryerControlDelegate LaundryDryerControlDelegate::instance;

// TODO: Add EndpointId to the API so that different values per endpoint may be possible in some implementations.
CHIP_ERROR LaundryDryerControlDelegate::GetSupportedDrynessLevelAtIndex(size_t index, DrynessLevelEnum & supportedDrynessLevel)
{
if (index >= ArraySize(supportedDrynessLevelOptions))
{
return CHIP_ERROR_PROVIDER_LIST_EXHAUSTED;
}
supportedDrynessLevel = supportedDrynessLevelOptions[index];
return CHIP_NO_ERROR;
}
3 changes: 2 additions & 1 deletion examples/all-clusters-app/esp32/main/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,8 @@ set(SRC_DIRS_LIST
"${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/clusters/temperature-control-server"
"${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/clusters/time-synchronization-server"
"${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/clusters/dishwasher-alarm-server"
"${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/clusters/laundry-washer-controls-server"
"${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/clusters/laundry-washer-controls-server"
"${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/clusters/laundry-dryer-controls-server"
"${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/examples/all-clusters-app/all-clusters-common/src"
"${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/clusters/electrical-energy-measurement-server"
)
Expand Down
18 changes: 18 additions & 0 deletions examples/all-clusters-app/esp32/main/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,24 @@ static void InitServer(intptr_t context)
app::Clusters::TemperatureControl::SetInstance(&sAppSupportedTemperatureLevelsDelegate);
}

// #include <laundry-washer-controls-server/laundry-washer-controls-server.h>
#include <examples/all-clusters-app/all-clusters-common/include/laundry-washer-controls-delegate-impl.h>
#include <src/app/clusters/laundry-washer-controls-server/laundry-washer-controls-server.h>

using namespace chip::app::Clusters::LaundryWasherControls;
void emberAfLaundryWasherControlsClusterInitCallback(EndpointId endpoint)
{
LaundryWasherControlsServer::SetDefaultDelegate(1, &LaundryWasherControlDelegate::getLaundryWasherControlDelegate());
}

#include <examples/all-clusters-app/all-clusters-common/include/laundry-dryer-controls-delegate-impl.h>
#include <src/app/clusters/laundry-dryer-controls-server/laundry-dryer-controls-server.h>
using namespace chip::app::Clusters::LaundryDryerControls;
void emberAfLaundryDryerControlsClusterInitCallback(EndpointId endpoint)
{
LaundryDryerControlsServer::SetDefaultDelegate(endpoint, &LaundryDryerControlDelegate::getLaundryDryerControlDelegate());
}

extern "C" void app_main()
{
// Initialize the ESP NVS layer.
Expand Down
1 change: 1 addition & 0 deletions examples/all-clusters-app/linux/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ source_set("chip-all-clusters-common") {
"${chip_root}/examples/all-clusters-app/all-clusters-common/src/dishwasher-mode.cpp",
"${chip_root}/examples/all-clusters-app/all-clusters-common/src/energy-evse-stub.cpp",
"${chip_root}/examples/all-clusters-app/all-clusters-common/src/fan-stub.cpp",
"${chip_root}/examples/all-clusters-app/all-clusters-common/src/laundry-dryer-controls-delegate-impl.cpp",
"${chip_root}/examples/all-clusters-app/all-clusters-common/src/laundry-washer-controls-delegate-impl.cpp",
"${chip_root}/examples/all-clusters-app/all-clusters-common/src/laundry-washer-mode.cpp",
"${chip_root}/examples/all-clusters-app/all-clusters-common/src/microwave-oven-mode.cpp",
Expand Down
8 changes: 8 additions & 0 deletions examples/all-clusters-app/linux/main-common.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
#include "air-quality-instance.h"
#include "dishwasher-mode.h"
#include "include/tv-callbacks.h"
#include "laundry-dryer-controls-delegate-impl.h"
#include "laundry-washer-controls-delegate-impl.h"
#include "laundry-washer-mode.h"
#include "microwave-oven-mode.h"
Expand All @@ -33,6 +34,7 @@
#include <app/CommandHandler.h>
#include <app/att-storage.h>
#include <app/clusters/identify-server/identify-server.h>
#include <app/clusters/laundry-dryer-controls-server/laundry-dryer-controls-server.h>
#include <app/clusters/laundry-washer-controls-server/laundry-washer-controls-server.h>
#include <app/clusters/mode-base-server/mode-base-server.h>
#include <app/server/Server.h>
Expand Down Expand Up @@ -248,6 +250,12 @@ void emberAfLaundryWasherControlsClusterInitCallback(EndpointId endpoint)
LaundryWasherControlsServer::SetDefaultDelegate(endpoint, &LaundryWasherControlDelegate::getLaundryWasherControlDelegate());
}

using namespace chip::app::Clusters::LaundryDryerControls;
void emberAfLaundryDryerControlsClusterInitCallback(EndpointId endpoint)
{
LaundryDryerControlsServer::SetDefaultDelegate(endpoint, &LaundryDryerControlDelegate::getLaundryDryerControlDelegate());
}

void emberAfLowPowerClusterInitCallback(EndpointId endpoint)
{
ChipLogProgress(NotSpecified, "Setting LowPower default delegate to global manager");
Expand Down
Loading

0 comments on commit b096c88

Please sign in to comment.