Skip to content

Commit

Permalink
Remove last remaining non-enum-class bitmaps that we codegen. (#29193)
Browse files Browse the repository at this point in the history
  • Loading branch information
bzbarsky-apple authored and pull[bot] committed Feb 14, 2024
1 parent a06ef68 commit 1154711
Show file tree
Hide file tree
Showing 11 changed files with 70 additions and 29 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3925,6 +3925,17 @@ server cluster WindowCovering = 258 {

/** This cluster provides control of a barrier (garage door). */
server cluster BarrierControl = 259 {
bitmap BarrierControlCapabilities : BITMAP8 {
kPartialBarrier = 0x1;
}

bitmap BarrierControlSafetyStatus : BITMAP16 {
kRemoteLockout = 0x1;
kTemperDetected = 0x2;
kFailedCommunication = 0x4;
kPositionFailure = 0x8;
}

readonly attribute enum8 barrierMovingState = 1;
readonly attribute bitmap16 barrierSafetyStatus = 2;
readonly attribute bitmap8 barrierCapabilities = 3;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
#include <app/ConcreteCommandPath.h>
#include <app/util/af.h>
#include <app/util/config.h>
#include <lib/support/TypeTraits.h>

#include <assert.h>

Expand Down Expand Up @@ -99,7 +100,7 @@ bool emAfPluginBarrierControlServerIsPartialBarrierSupported(EndpointId endpoint
uint8_t bitmap;
EmberAfStatus status = Attributes::BarrierCapabilities::Get(endpoint, &bitmap);
assert(status == EMBER_ZCL_STATUS_SUCCESS);
return READBITS(bitmap, EMBER_AF_BARRIER_CONTROL_CAPABILITIES_PARTIAL_BARRIER);
return (bitmap & to_underlying(BarrierControlCapabilities::kPartialBarrier)) != 0;
}

static uint16_t getOpenOrClosePeriod(EndpointId endpoint, bool open)
Expand Down Expand Up @@ -139,7 +140,7 @@ uint16_t emAfPluginBarrierControlServerGetSafetyStatus(EndpointId endpoint)
static bool isRemoteLockoutOn(EndpointId endpoint)
{
uint16_t safetyStatus = emAfPluginBarrierControlServerGetSafetyStatus(endpoint);
return READBITS(safetyStatus, EMBER_AF_BARRIER_CONTROL_SAFETY_STATUS_REMOTE_LOCKOUT);
return (safetyStatus & to_underlying(BarrierControlSafetyStatus::kRemoteLockout)) != 0;
}

void emAfPluginBarrierControlServerIncrementEvents(EndpointId endpoint, bool open, bool command)
Expand Down
6 changes: 0 additions & 6 deletions src/app/common/templates/config-data.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,6 @@ WeakEnums:
- RadioFaultEnum
- StepMode

DefineBitmaps:
# Allow-list of bitmaps that we generates as #define as well as enum classes.
# The goal is to drive this down to 0.
- BarrierControlCapabilities
- BarrierControlSafetyStatus

CommandHandlerInterfaceOnlyClusters:
# List of clusters that are implemented entirely with
# CommandHandlerInterface and hence do not need generated command dispatch.
Expand Down
9 changes: 0 additions & 9 deletions src/app/zap-templates/templates/app/enums.zapt
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,3 @@ enum EmberAf{{asType label}} : {{asUnderlyingZclType name}} {
};
{{/if}}
{{/zcl_enums}}

{{#zcl_bitmaps}}
{{#if (isInConfigList label "DefineBitmaps")}}
{{#zcl_bitmap_items}}
#define EMBER_AF_{{asDelimitedMacro parent.label}}_{{asDelimitedMacro label}} ({{mask}})
#define EMBER_AF_{{asDelimitedMacro parent.label}}_{{asDelimitedMacro label}}_OFFSET ({{asOffset mask}})
{{/zcl_bitmap_items}}
{{/if}}
{{/zcl_bitmaps}}
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,12 @@ limitations under the License.
<domain name="Closures"/>

<bitmap name="BarrierControlCapabilities" type="BITMAP8">
<cluster code="0x0103"/>
<field name="partialBarrier" mask="0x01"/>
</bitmap>

<bitmap name="BarrierControlSafetyStatus" type="BITMAP16">
<cluster code="0x0103"/>
<field name="remoteLockout" mask="0x01"/>
<field name="temperDetected" mask="0x02"/>
<field name="failedCommunication" mask="0x04"/>
Expand Down
11 changes: 11 additions & 0 deletions src/controller/data_model/controller-clusters.matter
Original file line number Diff line number Diff line change
Expand Up @@ -4344,6 +4344,17 @@ client cluster WindowCovering = 258 {

/** This cluster provides control of a barrier (garage door). */
client cluster BarrierControl = 259 {
bitmap BarrierControlCapabilities : BITMAP8 {
kPartialBarrier = 0x1;
}

bitmap BarrierControlSafetyStatus : BITMAP16 {
kRemoteLockout = 0x1;
kTemperDetected = 0x2;
kFailedCommunication = 0x4;
kPositionFailure = 0x8;
}

readonly attribute enum8 barrierMovingState = 1;
readonly attribute bitmap16 barrierSafetyStatus = 2;
readonly attribute bitmap8 barrierCapabilities = 3;
Expand Down
10 changes: 10 additions & 0 deletions src/controller/python/chip/clusters/Objects.py

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 5 additions & 0 deletions src/darwin/Framework/CHIP/templates/availability.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7686,3 +7686,8 @@

- release: "Future"
versions: "future"
provisional:
bitmaps:
BarrierControl:
- BarrierControlCapabilities
- BarrierControlSafetyStatus
11 changes: 11 additions & 0 deletions src/darwin/Framework/CHIP/zap-generated/MTRBaseClusters.h

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

11 changes: 0 additions & 11 deletions zzz_generated/app-common/app-common/zap-generated/enums.h

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 1154711

Please sign in to comment.