Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

OvenMode example Implementation #30983

Merged
merged 29 commits into from
Jan 12, 2024
Merged
Show file tree
Hide file tree
Changes from 28 commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
f73539b
Adding oven op state
abeck-riis Nov 7, 2023
a8d50f4
Python regen
abeck-riis Nov 7, 2023
c4625dc
Fixing alignment
abeck-riis Nov 7, 2023
17267e2
regenerate with oven device.
eahove Nov 13, 2023
9e7f957
regenerated zap and chiptool
eahove Nov 13, 2023
c018b1f
oven opState first pass
eahove Nov 15, 2023
aa3f1a1
tentative updates based on RVC
eahove Dec 6, 2023
d0793da
updated cluster name & fix build
eahove Dec 8, 2023
7f13866
regen zap
eahove Dec 8, 2023
f6fa6ae
linux builds with oven mode update.
eahove Dec 8, 2023
9f44394
remove duplicate ovencacvity Entries
eahove Dec 11, 2023
6e233bf
remove duplicate oven cavity entry
eahove Dec 11, 2023
3139803
Revert "remove duplicate ovencacvity Entries"
eahove Dec 11, 2023
96e2402
cleanup for ovenMode
eahove Dec 13, 2023
b34bdf1
cleanup: remove operationalState changes
eahove Dec 13, 2023
59dcae5
update config-data. Regen.
eahove Dec 14, 2023
18f20f4
Restyled by clang-format
restyled-commits Dec 14, 2023
42f1a43
Reverting files.gni, settings.json
eahove Dec 14, 2023
5eb8848
adding to emberAf function to get it compiled
eahove Dec 15, 2023
f2557aa
adding oven-modes.cpp to more make files.
eahove Dec 15, 2023
31e6984
Adding to 2 more make files
eahove Dec 18, 2023
71afa03
removed "server" init(), struck from init list
eahove Dec 20, 2023
2278b8e
removed references to ovenCavityOperationalState
eahove Dec 20, 2023
271100b
Regenerated Zap
eahove Jan 5, 2024
d8520d9
zap regen after rebase
eahove Jan 8, 2024
bc7e43c
updating name of dryer control endpoint count
eahove Jan 8, 2024
7867f1e
fixing merge for telink
eahove Jan 8, 2024
4bb96db
cleanup auto-format changes
eahove Jan 8, 2024
1cbc26f
Fix zap file merge error
eahove Jan 11, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -2785,26 +2785,60 @@ 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 {
/** Attributes and commands for selecting a mode from a list of supported options. */
provisional cluster OvenMode = 73 {
revision 1;

enum DrynessLevelEnum : enum8 {
kLow = 0;
kNormal = 1;
kExtra = 2;
kMax = 3;
enum ModeTag : enum16 {
kBake = 16384;
kConvection = 16385;
kGrill = 16386;
kRoast = 16387;
kClean = 16388;
kConvectionBake = 16389;
kConvectionRoast = 16390;
kWarming = 16391;
kProofing = 16392;
}

bitmap Feature : bitmap32 {
kOnOff = 0x1;
}

struct ModeTagStruct {
optional vendor_id mfgCode = 0;
enum16 value = 1;
}

struct ModeOptionStruct {
char_string<64> label = 0;
int8u mode = 1;
ModeTagStruct modeTags[] = 2;
}

readonly attribute DrynessLevelEnum supportedDrynessLevels[] = 0;
attribute nullable DrynessLevelEnum selectedDrynessLevel = 1;
readonly attribute ModeOptionStruct supportedModes[] = 0;
readonly attribute int8u currentMode = 1;
attribute optional nullable int8u startUpMode = 2;
attribute optional nullable int8u onMode = 3;
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;

request struct ChangeToModeRequest {
int8u newMode = 0;
}

response struct ChangeToModeResponse = 1 {
enum8 status = 0;
optional char_string statusText = 1;
}

/** This command is used to change device modes.
On receipt of this command the device SHALL respond with a ChangeToModeResponse command. */
command ChangeToMode(ChangeToModeRequest): ChangeToModeResponse = 0;
}

/** Attributes and commands for selecting a mode from a list of supported options. */
Expand Down Expand Up @@ -7060,9 +7094,9 @@ endpoint 1 {
ram attribute clusterRevision default = 1;
}

server cluster LaundryDryerControls {
eahove marked this conversation as resolved.
Show resolved Hide resolved
callback attribute supportedDrynessLevels;
ram attribute selectedDrynessLevel;
server cluster OvenMode {
callback attribute supportedModes;
ram attribute currentMode;
callback attribute generatedCommandList;
callback attribute acceptedCommandList;
callback attribute eventList;
Expand Down Expand Up @@ -7387,15 +7421,6 @@ endpoint 1 {
callback attribute attributeList;
ram attribute featureMap default = 0;
ram attribute clusterRevision default = 2;

handle command GetTargetsResponse;
handle command Disable;
handle command EnableCharging;
handle command EnableDischarging;
handle command StartDiagnostics;
handle command SetTargets;
handle command GetTargets;
handle command ClearTargets;
}

server cluster WindowCovering {
Expand Down
104 changes: 19 additions & 85 deletions examples/all-clusters-app/all-clusters-common/all-clusters-app.zap
Original file line number Diff line number Diff line change
Expand Up @@ -17,19 +17,19 @@
}
],
"package": [
{
"pathRelativity": "relativeToZap",
"path": "../../../src/app/zap-templates/app-templates.json",
"type": "gen-templates-json",
"version": "chip-v1"
},
{
"pathRelativity": "relativeToZap",
"path": "../../../src/app/zap-templates/zcl/zcl-with-test-extensions.json",
"type": "zcl-properties",
"category": "matter",
"version": 1,
"description": "Matter SDK ZCL data with some extensions"
},
{
"pathRelativity": "relativeToZap",
"path": "../../../src/app/zap-templates/app-templates.json",
"type": "gen-templates-json",
"version": "chip-v1"
}
],
"endpointTypes": [
Expand Down Expand Up @@ -8409,15 +8409,16 @@
]
},
{
"name": "Laundry Dryer Controls",
"code": 74,
"name": "Oven Mode",
"code": 73,
"mfgCode": null,
"define": "LAUNDRY_DRYER_CONTROLS_CLUSTER",
"define": "OVEN_MODE_CLUSTER",
"side": "server",
"enabled": 1,
"apiMaturity": "provisional",
"attributes": [
{
"name": "SupportedDrynessLevels",
"name": "SupportedModes",
"code": 0,
"mfgCode": null,
"side": "server",
Expand All @@ -8433,11 +8434,11 @@
"reportableChange": 0
},
{
"name": "SelectedDrynessLevel",
"name": "CurrentMode",
"code": 1,
"mfgCode": null,
"side": "server",
"type": "DrynessLevelEnum",
"type": "int8u",
"included": 1,
"storageOption": "RAM",
"singleton": 0,
Expand Down Expand Up @@ -11683,7 +11684,7 @@
"storageOption": "External",
"singleton": 0,
"bounded": 0,
"defaultValue": null,
"defaultValue": "false",
"reportable": 1,
"minInterval": 1,
"maxInterval": 65534,
Expand Down Expand Up @@ -11875,72 +11876,6 @@
"side": "server",
"enabled": 1,
"apiMaturity": "provisional",
"commands": [
{
"name": "GetTargetsResponse",
"code": 0,
"mfgCode": null,
"source": "server",
"isIncoming": 0,
"isEnabled": 1
},
{
"name": "Disable",
"code": 1,
"mfgCode": null,
"source": "client",
"isIncoming": 1,
"isEnabled": 1
},
{
"name": "EnableCharging",
"code": 2,
"mfgCode": null,
"source": "client",
"isIncoming": 1,
"isEnabled": 1
},
{
"name": "EnableDischarging",
"code": 3,
"mfgCode": null,
"source": "client",
"isIncoming": 1,
"isEnabled": 1
},
{
"name": "StartDiagnostics",
"code": 4,
"mfgCode": null,
"source": "client",
"isIncoming": 1,
"isEnabled": 1
},
{
"name": "SetTargets",
"code": 5,
"mfgCode": null,
"source": "client",
"isIncoming": 1,
"isEnabled": 1
},
{
"name": "GetTargets",
"code": 6,
"mfgCode": null,
"source": "client",
"isIncoming": 1,
"isEnabled": 1
},
{
"name": "ClearTargets",
"code": 7,
"mfgCode": null,
"source": "client",
"isIncoming": 1,
"isEnabled": 1
}
],
"attributes": [
{
"name": "State",
Expand Down Expand Up @@ -12352,7 +12287,7 @@
"storageOption": "External",
"singleton": 0,
"bounded": 0,
"defaultValue": null,
"defaultValue": "",
"reportable": 1,
"minInterval": 1,
"maxInterval": 65534,
Expand All @@ -12368,7 +12303,7 @@
"storageOption": "External",
"singleton": 0,
"bounded": 0,
"defaultValue": null,
"defaultValue": "",
"reportable": 1,
"minInterval": 1,
"maxInterval": 65534,
Expand All @@ -12384,7 +12319,7 @@
"storageOption": "External",
"singleton": 0,
"bounded": 0,
"defaultValue": null,
"defaultValue": "",
"reportable": 1,
"minInterval": 1,
"maxInterval": 65534,
Expand All @@ -12400,7 +12335,7 @@
"storageOption": "External",
"singleton": 0,
"bounded": 0,
"defaultValue": null,
"defaultValue": "",
"reportable": 1,
"minInterval": 1,
"maxInterval": 65534,
Expand Down Expand Up @@ -22660,5 +22595,4 @@
}
],
"log": []
}

}
106 changes: 106 additions & 0 deletions examples/all-clusters-app/all-clusters-common/include/oven-modes.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,106 @@
/*
*
* 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/mode-base-server/mode-base-server.h>
#include <app/util/af.h>
#include <app/util/config.h>
#include <cstring>
#include <utility>

namespace chip {
namespace app {
namespace Clusters {

namespace OvenMode {

const uint8_t ModeBake = 0;
const uint8_t ModeConvection = 1;
const uint8_t ModeGrill = 2;
const uint8_t ModeRoast = 3;
const uint8_t ModeClean = 4;
const uint8_t ModeConvectionBake = 5;
const uint8_t ModeConvectionRoast = 6;
const uint8_t ModeWarming = 7;
const uint8_t ModeProofing = 8;

/// This is an application level delegate to handle Oven commands according to the specific business logic.
class OvenModeDelegate : public ModeBase::Delegate
{
private:
using ModeTagStructType = detail::Structs::ModeTagStruct::Type;
ModeTagStructType ModeTagsBake[1] = { { .value = to_underlying(ModeTag::kBake) } };
ModeTagStructType ModeTagsConvection[1] = { { .value = to_underlying(ModeTag::kConvection) } };
ModeTagStructType ModeTagsGrill[1] = { { .value = to_underlying(ModeTag::kGrill) } };
ModeTagStructType ModeTagsRoast[1] = { { .value = to_underlying(ModeTag::kRoast) } };
ModeTagStructType ModeTagsClean[1] = { { .value = to_underlying(ModeTag::kClean) } };
ModeTagStructType ModeTagsConvectionBake[1] = { { .value = to_underlying(ModeTag::kConvectionBake) } };
ModeTagStructType ModeTagsConvectionRoast[1] = { { .value = to_underlying(ModeTag::kConvectionRoast) } };
ModeTagStructType ModeTagsWarming[1] = { { .value = to_underlying(ModeTag::kWarming) } };
ModeTagStructType ModeTagsProofing[1] = { { .value = to_underlying(ModeTag::kProofing) } };

const detail::Structs::ModeOptionStruct::Type kModeOptions[9] = {
detail::Structs::ModeOptionStruct::Type{ .label = CharSpan::fromCharString("Bake"),
.mode = ModeBake,
.modeTags = DataModel::List<const ModeTagStructType>(ModeTagsBake) },
detail::Structs::ModeOptionStruct::Type{ .label = CharSpan::fromCharString("Convection"),
.mode = ModeConvection,
.modeTags = DataModel::List<const ModeTagStructType>(ModeTagsConvection) },
detail::Structs::ModeOptionStruct::Type{ .label = CharSpan::fromCharString("Grill"),
.mode = ModeGrill,
.modeTags = DataModel::List<const ModeTagStructType>(ModeTagsGrill) },
detail::Structs::ModeOptionStruct::Type{ .label = CharSpan::fromCharString("Roast"),
.mode = ModeRoast,
.modeTags = DataModel::List<const ModeTagStructType>(ModeTagsRoast) },
detail::Structs::ModeOptionStruct::Type{ .label = CharSpan::fromCharString("Clean"),
.mode = ModeClean,
.modeTags = DataModel::List<const ModeTagStructType>(ModeTagsClean) },
detail::Structs::ModeOptionStruct::Type{ .label = CharSpan::fromCharString("Convection Bake"),
.mode = ModeConvectionBake,
.modeTags = DataModel::List<const ModeTagStructType>(ModeTagsConvectionBake) },
detail::Structs::ModeOptionStruct::Type{ .label = CharSpan::fromCharString("Convection Roast"),
.mode = ModeConvectionRoast,
.modeTags = DataModel::List<const ModeTagStructType>(ModeTagsConvectionRoast) },
detail::Structs::ModeOptionStruct::Type{ .label = CharSpan::fromCharString("Warming"),
.mode = ModeWarming,
.modeTags = DataModel::List<const ModeTagStructType>(ModeTagsWarming) },
detail::Structs::ModeOptionStruct::Type{ .label = CharSpan::fromCharString("Proofing"),
.mode = ModeProofing,
.modeTags = DataModel::List<const ModeTagStructType>(ModeTagsProofing) },
};

CHIP_ERROR Init() override;
void HandleChangeToMode(uint8_t mode, ModeBase::Commands::ChangeToModeResponse::Type & response) override;

CHIP_ERROR GetModeLabelByIndex(uint8_t modeIndex, MutableCharSpan & label) override;
CHIP_ERROR GetModeValueByIndex(uint8_t modeIndex, uint8_t & value) override;
CHIP_ERROR GetModeTagsByIndex(uint8_t modeIndex, DataModel::List<ModeTagStructType> & tags) override;

public:
~OvenModeDelegate() override = default;
};

ModeBase::Instance * Instance();

void Shutdown();

} // namespace OvenMode
} // namespace Clusters
} // namespace app
} // namespace chip
Loading
Loading