Skip to content

Commit

Permalink
Add a command and attribute that require timed interaction to TestClu…
Browse files Browse the repository at this point in the history
…ster. (#12380)
  • Loading branch information
bzbarsky-apple authored Dec 1, 2021
1 parent 18f959b commit 1e67398
Show file tree
Hide file tree
Showing 32 changed files with 2,592 additions and 18 deletions.
23 changes: 23 additions & 0 deletions examples/all-clusters-app/all-clusters-common/all-clusters-app.zap
Original file line number Diff line number Diff line change
Expand Up @@ -15319,6 +15319,14 @@
"source": "client",
"incoming": 1,
"outgoing": 0
},
{
"name": "TimedInvokeRequest",
"code": 18,
"mfgCode": null,
"source": "client",
"incoming": 1,
"outgoing": 0
}
],
"attributes": [
Expand Down Expand Up @@ -16027,6 +16035,21 @@
"maxInterval": 65534,
"reportableChange": 0
},
{
"name": "timed_write_boolean",
"code": 48,
"mfgCode": null,
"side": "server",
"included": 1,
"storageOption": "RAM",
"singleton": 0,
"bounded": 0,
"defaultValue": "",
"reportable": 1,
"minInterval": 1,
"maxInterval": 65534,
"reportableChange": 0
},
{
"name": "unsupported",
"code": 255,
Expand Down
7 changes: 7 additions & 0 deletions src/app/clusters/test-cluster-server/test-cluster-server.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -548,6 +548,13 @@ bool emberAfTestClusterClusterSimpleStructEchoRequestCallback(CommandHandler * c
return true;
}

bool emberAfTestClusterClusterTimedInvokeRequestCallback(CommandHandler * commandObj, const ConcreteCommandPath & commandPath,
const Commands::TimedInvokeRequest::DecodableType & commandData)
{
commandObj->AddStatus(commandPath, Protocols::InteractionModel::Status::Success);
return true;
}

// -----------------------------------------------------------------------------
// Plugin initialization

Expand Down
9 changes: 7 additions & 2 deletions src/app/util/af-types.h
Original file line number Diff line number Diff line change
Expand Up @@ -173,8 +173,8 @@ union EmberAfDefaultOrMinMaxAttributeValue
#define ATTRIBUTE_MASK_TOKENIZE (0x02)
// Attribute that has this mask has a min/max values
#define ATTRIBUTE_MASK_MIN_MAX (0x04)
// Manufacturer specific attribute
#define ATTRIBUTE_MASK_MANUFACTURER_SPECIFIC (0x08)
// Attribute requires a timed interaction to write
#define ATTRIBUTE_MASK_MUST_USE_TIMED_WRITE (0x08)
// Attribute deferred to external storage
#define ATTRIBUTE_MASK_EXTERNAL_STORAGE (0x10)
// Attribute is singleton
Expand Down Expand Up @@ -223,6 +223,11 @@ struct EmberAfAttributeMetadata
* Check whether this attribute is readonly.
*/
bool IsReadOnly() const { return !(mask & ATTRIBUTE_MASK_WRITABLE); }

/**
* Check whether this attribute requires a timed write.
*/
bool MustUseTimedWrite() const { return mask & ATTRIBUTE_MASK_MUST_USE_TIMED_WRITE; }
};

/**
Expand Down
7 changes: 0 additions & 7 deletions src/app/util/af.h
Original file line number Diff line number Diff line change
Expand Up @@ -401,13 +401,6 @@ uint8_t emberAfGetDataSize(uint8_t dataType);
*/
#define emberAfAttributeIsSingleton(metadata) (((metadata)->mask & ATTRIBUTE_MASK_SINGLETON) != 0)

/**
* @brief macro that returns true if attribute is manufacturer specific
*
* @param metadata EmberAfAttributeMetadata* to consider.
*/
#define emberAfAttributeIsManufacturerSpecific(metadata) (((metadata)->mask & ATTRIBUTE_MASK_MANUFACTURER_SPECIFIC) != 0)

/**
* @brief macro that returns size of attribute in bytes.
*
Expand Down
3 changes: 3 additions & 0 deletions src/app/zap-templates/templates/app/cluster-objects.zapt
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,8 @@ public:
{{else}}
DataModel::NullObjectType;
{{/if}}

static constexpr bool MustUseTimedInvoke() { return {{mustUseTimedInvoke}}; }
};

struct DecodableType {
Expand Down Expand Up @@ -176,6 +178,7 @@ namespace {{asUpperCamelCase label}} {

static constexpr ClusterId GetClusterId() { return Clusters::{{asUpperCamelCase parent.name}}::Id; }
static constexpr AttributeId GetAttributeId() { return Attributes::{{asUpperCamelCase label}}::Id; }
static constexpr bool MustUseTimedWrite() { return {{mustUseTimedWrite}}; }
};
} // namespace {{asUpperCamelCase label}}
{{#last}}
Expand Down
10 changes: 10 additions & 0 deletions src/app/zap-templates/zcl/data-model/chip/test-cluster.xml
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,8 @@ limitations under the License.
<attribute side="server" code="0x0027" define="RANGE_RESTRICTED_INT8s" type="int8s" min="-40" max="50" writable="true" optional="false" default="-5">range_restricted_int8s</attribute>
<attribute side="server" code="0x0028" define="RANGE_RESTRICTED_INT16U" type="int16u" min="100" max="1000" writable="true" optional="false" default="200">range_restricted_int16u</attribute>
<attribute side="server" code="0x0029" define="RANGE_RESTRICTED_INT16s" type="int16s" min="-150" max="200" writable="true" optional="false" default="-5">range_restricted_int16s</attribute>
<attribute side="server" code="0x0030" define="TIMED_WRITE_BOOLEAN"
type="BOOLEAN" writable="true" mustUseTimedWrite="true">timed_write_boolean</attribute>

<attribute side="server" code="0x8000" define="NULLABLE_BOOLEAN" type="BOOLEAN" writable="true" default="false" isNullable="true" optional="false">nullable_boolean</attribute>
<attribute side="server" code="0x8001" define="NULLABLE_BITMAP8" type="BITMAP8" writable="true" default="0" isNullable="true" optional="false">nullable_bitmap8</attribute>
Expand Down Expand Up @@ -352,6 +354,14 @@ limitations under the License.
<arg name="arg1" type="SimpleStruct"/>
</command>

<command source="client" code="0x12" name="TimedInvokeRequest"
mustUseTimedInvoke="true" optional="false">
<description>
Command that just responds with a success status if the timed invoke
conditions are met.
</description>
</command>

<command source="server" code="0x00" name="TestSpecificResponse" optional="false" disableDefaultResponse="true">
<description>
Simple response for TestWithResponse with a simple return value
Expand Down
23 changes: 23 additions & 0 deletions src/controller/data_model/controller-clusters.zap
Original file line number Diff line number Diff line change
Expand Up @@ -11585,6 +11585,14 @@
"source": "client",
"incoming": 0,
"outgoing": 1
},
{
"name": "TimedInvokeRequest",
"code": 18,
"mfgCode": null,
"source": "client",
"incoming": 0,
"outgoing": 1
}
],
"attributes": [
Expand Down Expand Up @@ -12301,6 +12309,21 @@
"maxInterval": 65534,
"reportableChange": 0
},
{
"name": "timed_write_boolean",
"code": 48,
"mfgCode": null,
"side": "server",
"included": 1,
"storageOption": "RAM",
"singleton": 0,
"bounded": 0,
"defaultValue": "",
"reportable": 0,
"minInterval": 1,
"maxInterval": 65534,
"reportableChange": 0
},
{
"name": "unsupported",
"code": 255,
Expand Down
2 changes: 2 additions & 0 deletions src/controller/java/zap-generated/CHIPCallbackTypes.h

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

73 changes: 73 additions & 0 deletions src/controller/java/zap-generated/CHIPClusters-JNI.cpp

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

34 changes: 34 additions & 0 deletions src/controller/java/zap-generated/CHIPClustersRead-JNI.cpp

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.

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.

Loading

0 comments on commit 1e67398

Please sign in to comment.