Skip to content

Commit

Permalink
Fan Control Spec Editorial Alignment (#27434)
Browse files Browse the repository at this point in the history
* Aligned Fan Control with editorial update to spec, mainly around the naming and use of types

* Modified FAN TC 2_1 to have the new types, addressed syntax issues in fan control server

* Removing chip:: from the types where not required, as per comments in PR
  • Loading branch information
mhazley authored and pull[bot] committed Aug 4, 2023
1 parent a37c95c commit a08bc7c
Show file tree
Hide file tree
Showing 35 changed files with 871 additions and 706 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3696,12 +3696,17 @@ server cluster FanControl = 514 {
kReverse = 1;
}

enum DirectionEnum : ENUM8 {
kIncrease = 0;
kDecrease = 1;
enum FanModeEnum : ENUM8 {
kOff = 0;
kLow = 1;
kMedium = 2;
kHigh = 3;
kOn = 4;
kAuto = 5;
kSmart = 6;
}

enum FanModeSequenceType : ENUM8 {
enum FanModeSequenceEnum : ENUM8 {
kOffLowMedHigh = 0;
kOffLowHigh = 1;
kOffLowMedHighAuto = 2;
Expand All @@ -3710,14 +3715,9 @@ server cluster FanControl = 514 {
kOffOn = 5;
}

enum FanModeType : ENUM8 {
kOff = 0;
kLow = 1;
kMedium = 2;
kHigh = 3;
kOn = 4;
kAuto = 5;
kSmart = 6;
enum StepDirectionEnum : ENUM8 {
kIncrease = 0;
kDecrease = 1;
}

bitmap Feature : BITMAP32 {
Expand All @@ -3729,33 +3729,28 @@ server cluster FanControl = 514 {
kAirflowDirection = 0x20;
}

bitmap RockSupportMask : BITMAP8 {
bitmap RockBitmap : BITMAP8 {
kRockLeftRight = 0x1;
kRockUpDown = 0x2;
kRockRound = 0x4;
}

bitmap WindSettingMask : BITMAP8 {
kSleepWind = 0x1;
kNaturalWind = 0x2;
}

bitmap WindSupportMask : BITMAP8 {
bitmap WindBitmap : BITMAP8 {
kSleepWind = 0x1;
kNaturalWind = 0x2;
}

attribute FanModeType fanMode = 0;
attribute FanModeSequenceType fanModeSequence = 1;
attribute nullable int8u percentSetting = 2;
readonly attribute int8u percentCurrent = 3;
attribute FanModeEnum fanMode = 0;
attribute FanModeSequenceEnum fanModeSequence = 1;
attribute nullable Percent percentSetting = 2;
readonly attribute Percent percentCurrent = 3;
readonly attribute int8u speedMax = 4;
attribute nullable int8u speedSetting = 5;
readonly attribute int8u speedCurrent = 6;
readonly attribute bitmap8 rockSupport = 7;
attribute bitmap8 rockSetting = 8;
readonly attribute bitmap8 windSupport = 9;
attribute bitmap8 windSetting = 10;
readonly attribute RockBitmap rockSupport = 7;
attribute RockBitmap rockSetting = 8;
readonly attribute WindBitmap windSupport = 9;
attribute WindBitmap windSetting = 10;
attribute AirflowDirectionEnum airflowDirection = 11;
readonly attribute command_id generatedCommandList[] = 65528;
readonly attribute command_id acceptedCommandList[] = 65529;
Expand All @@ -3765,7 +3760,7 @@ server cluster FanControl = 514 {
readonly attribute int16u clusterRevision = 65533;

request struct StepRequest {
DirectionEnum direction = 0;
StepDirectionEnum direction = 0;
optional boolean wrap = 1;
optional boolean lowestOff = 2;
}
Expand Down Expand Up @@ -6471,12 +6466,12 @@ endpoint 1 {
ram attribute speedMax default = 100;
ram attribute speedSetting default = 0x00;
ram attribute speedCurrent default = 0x00;
ram attribute rockSupport default = 0x00;
ram attribute rockSupport default = 0x03;
ram attribute rockSetting default = 0x00;
ram attribute windSupport default = 0x00;
ram attribute windSupport default = 0x03;
ram attribute windSetting default = 0x00;
ram attribute airflowDirection default = 0;
ram attribute featureMap default = 0x0F;
ram attribute featureMap default = 0x3F;
ram attribute clusterRevision default = 2;
}

Expand Down
36 changes: 18 additions & 18 deletions examples/all-clusters-app/all-clusters-common/all-clusters-app.zap
Original file line number Diff line number Diff line change
Expand Up @@ -16,19 +16,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 @@ -18482,7 +18482,7 @@
"code": 0,
"mfgCode": null,
"side": "server",
"type": "FanModeType",
"type": "FanModeEnum",
"included": 1,
"storageOption": "RAM",
"singleton": 0,
Expand All @@ -18498,7 +18498,7 @@
"code": 1,
"mfgCode": null,
"side": "server",
"type": "FanModeSequenceType",
"type": "FanModeSequenceEnum",
"included": 1,
"storageOption": "RAM",
"singleton": 0,
Expand All @@ -18514,7 +18514,7 @@
"code": 2,
"mfgCode": null,
"side": "server",
"type": "int8u",
"type": "Percent",
"included": 1,
"storageOption": "RAM",
"singleton": 0,
Expand All @@ -18530,7 +18530,7 @@
"code": 3,
"mfgCode": null,
"side": "server",
"type": "int8u",
"type": "Percent",
"included": 1,
"storageOption": "RAM",
"singleton": 0,
Expand Down Expand Up @@ -18594,12 +18594,12 @@
"code": 7,
"mfgCode": null,
"side": "server",
"type": "bitmap8",
"type": "RockBitmap",
"included": 1,
"storageOption": "RAM",
"singleton": 0,
"bounded": 0,
"defaultValue": "0x00",
"defaultValue": "0x03",
"reportable": 1,
"minInterval": 1,
"maxInterval": 65534,
Expand All @@ -18610,7 +18610,7 @@
"code": 8,
"mfgCode": null,
"side": "server",
"type": "bitmap8",
"type": "RockBitmap",
"included": 1,
"storageOption": "RAM",
"singleton": 0,
Expand All @@ -18626,12 +18626,12 @@
"code": 9,
"mfgCode": null,
"side": "server",
"type": "bitmap8",
"type": "WindBitmap",
"included": 1,
"storageOption": "RAM",
"singleton": 0,
"bounded": 0,
"defaultValue": "0x00",
"defaultValue": "0x03",
"reportable": 1,
"minInterval": 1,
"maxInterval": 65534,
Expand All @@ -18642,7 +18642,7 @@
"code": 10,
"mfgCode": null,
"side": "server",
"type": "bitmap8",
"type": "WindBitmap",
"included": 1,
"storageOption": "RAM",
"singleton": 0,
Expand Down Expand Up @@ -18727,7 +18727,7 @@
"storageOption": "RAM",
"singleton": 0,
"bounded": 0,
"defaultValue": "0x0F",
"defaultValue": "0x3F",
"reportable": 1,
"minInterval": 1,
"maxInterval": 65534,
Expand Down Expand Up @@ -32125,4 +32125,4 @@
}
],
"log": []
}
}
12 changes: 2 additions & 10 deletions examples/all-clusters-app/all-clusters-common/src/fan-stub.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -57,9 +57,9 @@ class FanAttrAccess : public AttributeAccessInterface
CHIP_ERROR FanAttrAccess::ReadPercentCurrent(EndpointId endpoint, AttributeValueEncoder & aEncoder)
{
// Return PercentSetting attribute value for now
DataModel::Nullable<uint8_t> percentSetting;
DataModel::Nullable<Percent> percentSetting;
PercentSetting::Get(endpoint, percentSetting);
uint8_t ret = 0;
Percent ret = 0;
if (!percentSetting.IsNull())
{
ret = percentSetting.Value();
Expand Down Expand Up @@ -103,13 +103,5 @@ CHIP_ERROR FanAttrAccess::Read(const ConcreteReadAttributePath & aPath, Attribut

void emberAfFanControlClusterInitCallback(EndpointId endpoint)
{
uint32_t featureMap = 0;

featureMap |= to_underlying(FanControl::Feature::kMultiSpeed);
featureMap |= to_underlying(FanControl::Feature::kMultiSpeed);
featureMap |= to_underlying(FanControl::Feature::kAuto);

FeatureMap::Set(endpoint, featureMap);

registerAttributeAccessOverride(&gAttrAccess);
}
Original file line number Diff line number Diff line change
Expand Up @@ -2792,12 +2792,17 @@ server cluster FanControl = 514 {
kReverse = 1;
}

enum DirectionEnum : ENUM8 {
kIncrease = 0;
kDecrease = 1;
enum FanModeEnum : ENUM8 {
kOff = 0;
kLow = 1;
kMedium = 2;
kHigh = 3;
kOn = 4;
kAuto = 5;
kSmart = 6;
}

enum FanModeSequenceType : ENUM8 {
enum FanModeSequenceEnum : ENUM8 {
kOffLowMedHigh = 0;
kOffLowHigh = 1;
kOffLowMedHighAuto = 2;
Expand All @@ -2806,14 +2811,9 @@ server cluster FanControl = 514 {
kOffOn = 5;
}

enum FanModeType : ENUM8 {
kOff = 0;
kLow = 1;
kMedium = 2;
kHigh = 3;
kOn = 4;
kAuto = 5;
kSmart = 6;
enum StepDirectionEnum : ENUM8 {
kIncrease = 0;
kDecrease = 1;
}

bitmap Feature : BITMAP32 {
Expand All @@ -2825,26 +2825,21 @@ server cluster FanControl = 514 {
kAirflowDirection = 0x20;
}

bitmap RockSupportMask : BITMAP8 {
bitmap RockBitmap : BITMAP8 {
kRockLeftRight = 0x1;
kRockUpDown = 0x2;
kRockRound = 0x4;
}

bitmap WindSettingMask : BITMAP8 {
kSleepWind = 0x1;
kNaturalWind = 0x2;
}

bitmap WindSupportMask : BITMAP8 {
bitmap WindBitmap : BITMAP8 {
kSleepWind = 0x1;
kNaturalWind = 0x2;
}

attribute FanModeType fanMode = 0;
attribute FanModeSequenceType fanModeSequence = 1;
attribute nullable int8u percentSetting = 2;
readonly attribute int8u percentCurrent = 3;
attribute FanModeEnum fanMode = 0;
attribute FanModeSequenceEnum fanModeSequence = 1;
attribute nullable Percent percentSetting = 2;
readonly attribute Percent percentCurrent = 3;
readonly attribute command_id generatedCommandList[] = 65528;
readonly attribute command_id acceptedCommandList[] = 65529;
readonly attribute event_id eventList[] = 65530;
Expand Down
Loading

0 comments on commit a08bc7c

Please sign in to comment.