Skip to content

Commit

Permalink
Add events to Generic Switch XML (#12197)
Browse files Browse the repository at this point in the history
* Add events to Generic Switch

* scripts/tools/zap_regen_all.py
  • Loading branch information
jonsmirl authored and pull[bot] committed Feb 13, 2024
1 parent 2ff8d00 commit 1252408
Show file tree
Hide file tree
Showing 5 changed files with 639 additions and 9 deletions.
47 changes: 39 additions & 8 deletions src/app/zap-templates/zcl/data-model/chip/switch-cluster.xml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ See the License for the specific language governing permissions and
limitations under the License.
-->
<configurator>
<domain name="CHIP"/>
<domain name="CHIP" />
<cluster>
<domain>CHIP</domain>
<name>Switch</name>
Expand All @@ -27,20 +27,51 @@ limitations under the License.
Two types of switch devices are supported: latching switch (e.g. rocker switch) and momentary switch (e.g. push button), distinguished with their feature flags.
Interactions with the switch device are exposed as attributes (for the latching switch) and as events (for both types of switches). An interested party MAY subscribe to these attributes/events and thus be informed of the interactions, and can perform actions based on this, for example by sending commands to perform an action such as controlling a light or a window shade.</description>

<globalAttribute side="server" code="0xFFFC" value="0"/>
<globalAttribute side="server" code="0xFFFD" value="1"/>
<globalAttribute side="server" code="0xFFFC" value="0" />
<globalAttribute side="server" code="0xFFFD" value="1" />

<attribute side="server" code="0x0000" define="NUMBER_OF_POSITIONS" type="INT8U" writable="false" optional="false" default="2" min="2">number of positions</attribute>
<attribute side="server" code="0x0001" define="CURRENT_POSITION" type="INT8U" writable="false" reportable="true" optional="false">current position</attribute>
<attribute side="server" code="0x0002" define="MULTI_PRESS_MAX" type="INT8U" writable="false" optional="false" default="2" min="2">multi press max</attribute>
<event side="server" code="0x00" priority="info" name="SwitchLatched" optional="true">
<description>Switch Latched</description>
<field id="0" name="NewPosition" type="INT8U" />
</event>
<event side="server" code="0x01" priority="info" name="InitialPress" optional="true">
<description>Initial Press</description>
<field id="0" name="NewPosition" type="INT8U" />
</event>
<event side="server" code="0x02" priority="info" name="LongPress" optional="true">
<description>Long Press</description>
<field id="0" name="NewPosition" type="INT8U" />
</event>
<event side="server" code="0x03" priority="info" name="ShortRelease" optional="true">
<description>Short Release</description>
<field id="0" name="PreviousPosition" type="INT8U" />
</event>
<event side="server" code="0x04" priority="info" name="LongRelease" optional="true">
<description>Long Release</description>
<field id="0" name="PreviousPosition" type="INT8U" />
</event>
<event side="server" code="0x05" priority="info" name="MultiPressOngoing" optional="true">
<description>MultiPress Ongoing</description>
<field id="0" name="NewPosition" type="INT8U" />
<field id="1" name="CurrentNumberOfPressesCounted" type="INT8U" />
</event>
<event side="server" code="0x06" priority="info" name="MultiPressComplete" optional="true">
<description>MultiPress Complete</description>
<field id="0" name="NewPosition" type="INT8U" />
<field id="1" name="TotalNumberOfPressesCounted" type="INT8U" />
</event>

</cluster>

<bitmap name="SwitchFeature" type="BITMAP32">
<field name="LatchingSwitch" mask="0x1"/>
<field name="MomentarySwitch" mask="0x2"/>
<field name="MomentarySwitchRelease" mask="0x4"/>
<field name="MomentarySwitchLongPress" mask="0x8"/>
<field name="MomentarySwitchMultiPress" mask="0x10"/>
<field name="LatchingSwitch" mask="0x1" />
<field name="MomentarySwitch" mask="0x2" />
<field name="MomentarySwitchRelease" mask="0x4" />
<field name="MomentarySwitchLongPress" mask="0x8" />
<field name="MomentarySwitchMultiPress" mask="0x10" />
</bitmap>

</configurator>
112 changes: 112 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.

Loading

0 comments on commit 1252408

Please sign in to comment.