Skip to content

Commit

Permalink
Match Keypad Input Cluster to spec (#30316)
Browse files Browse the repository at this point in the history
* xml rename KeypadInputStatusEnum to StatusEnum

* zap regen

* Rename remaining status usages

* Minor change to kick CI

* Add compat

* Fix typo
  • Loading branch information
andy31415 authored and pull[bot] committed Nov 28, 2023
1 parent 85e52f3 commit 1276800
Show file tree
Hide file tree
Showing 18 changed files with 62 additions and 56 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3429,7 +3429,7 @@ server cluster KeypadInput = 1289 {
kData = 118;
}

enum KeypadInputStatusEnum : enum8 {
enum StatusEnum : enum8 {
kSuccess = 0;
kUnsupportedKey = 1;
kInvalidKeyInCurrentState = 2;
Expand All @@ -3453,7 +3453,7 @@ server cluster KeypadInput = 1289 {
}

response struct SendKeyResponse = 1 {
KeypadInputStatusEnum status = 0;
StatusEnum status = 0;
}

command SendKey(SendKeyRequest): SendKeyResponse = 0;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1400,7 +1400,7 @@ server cluster KeypadInput = 1289 {
kData = 118;
}

enum KeypadInputStatusEnum : enum8 {
enum StatusEnum : enum8 {
kSuccess = 0;
kUnsupportedKey = 1;
kInvalidKeyInCurrentState = 2;
Expand All @@ -1424,7 +1424,7 @@ server cluster KeypadInput = 1289 {
}

response struct SendKeyResponse = 1 {
KeypadInputStatusEnum status = 0;
StatusEnum status = 0;
}

command SendKey(SendKeyRequest): SendKeyResponse = 0;
Expand Down
6 changes: 3 additions & 3 deletions examples/placeholder/linux/apps/app1/config.matter
Original file line number Diff line number Diff line change
Expand Up @@ -5875,7 +5875,7 @@ client cluster KeypadInput = 1289 {
kData = 118;
}

enum KeypadInputStatusEnum : enum8 {
enum StatusEnum : enum8 {
kSuccess = 0;
kUnsupportedKey = 1;
kInvalidKeyInCurrentState = 2;
Expand All @@ -5899,7 +5899,7 @@ client cluster KeypadInput = 1289 {
}

response struct SendKeyResponse = 1 {
KeypadInputStatusEnum status = 0;
StatusEnum status = 0;
}

/** Upon receipt, this SHALL process a keycode as input to the media device. */
Expand Down Expand Up @@ -5997,7 +5997,7 @@ server cluster KeypadInput = 1289 {
kData = 118;
}

enum KeypadInputStatusEnum : enum8 {
enum StatusEnum : enum8 {
kSuccess = 0;
kUnsupportedKey = 1;
kInvalidKeyInCurrentState = 2;
Expand Down
6 changes: 3 additions & 3 deletions examples/placeholder/linux/apps/app2/config.matter
Original file line number Diff line number Diff line change
Expand Up @@ -5834,7 +5834,7 @@ client cluster KeypadInput = 1289 {
kData = 118;
}

enum KeypadInputStatusEnum : enum8 {
enum StatusEnum : enum8 {
kSuccess = 0;
kUnsupportedKey = 1;
kInvalidKeyInCurrentState = 2;
Expand All @@ -5858,7 +5858,7 @@ client cluster KeypadInput = 1289 {
}

response struct SendKeyResponse = 1 {
KeypadInputStatusEnum status = 0;
StatusEnum status = 0;
}

/** Upon receipt, this SHALL process a keycode as input to the media device. */
Expand Down Expand Up @@ -5956,7 +5956,7 @@ server cluster KeypadInput = 1289 {
kData = 118;
}

enum KeypadInputStatusEnum : enum8 {
enum StatusEnum : enum8 {
kSuccess = 0;
kUnsupportedKey = 1;
kInvalidKeyInCurrentState = 2;
Expand Down
4 changes: 2 additions & 2 deletions examples/tv-app/android/java/KeypadInputManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -61,11 +61,11 @@ void KeypadInputManager::HandleSendKey(CommandResponseHelper<SendKeyResponseType
exit:
if (err != CHIP_NO_ERROR)
{
response.status = chip::app::Clusters::KeypadInput::KeypadInputStatusEnum::kInvalidKeyInCurrentState;
response.status = chip::app::Clusters::KeypadInput::StatusEnum::kInvalidKeyInCurrentState;
}
else
{
response.status = static_cast<chip::app::Clusters::KeypadInput::KeypadInputStatusEnum>(ret);
response.status = static_cast<chip::app::Clusters::KeypadInput::StatusEnum>(ret);
}
helper.Success(response);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,67 +31,67 @@ void KeypadInputManager::HandleSendKey(CommandResponseHelper<SendKeyResponseType
switch (keycCode)
{
case CecKeyCodeType::kUp:
response.status = chip::app::Clusters::KeypadInput::KeypadInputStatusEnum::kSuccess;
response.status = chip::app::Clusters::KeypadInput::StatusEnum::kSuccess;
break;
case CecKeyCodeType::kDown:
response.status = chip::app::Clusters::KeypadInput::KeypadInputStatusEnum::kSuccess;
response.status = chip::app::Clusters::KeypadInput::StatusEnum::kSuccess;
break;
case CecKeyCodeType::kLeft:
response.status = chip::app::Clusters::KeypadInput::KeypadInputStatusEnum::kSuccess;
response.status = chip::app::Clusters::KeypadInput::StatusEnum::kSuccess;
break;
case CecKeyCodeType::kRight:
response.status = chip::app::Clusters::KeypadInput::KeypadInputStatusEnum::kSuccess;
response.status = chip::app::Clusters::KeypadInput::StatusEnum::kSuccess;
break;
case CecKeyCodeType::kSelect:
response.status = chip::app::Clusters::KeypadInput::KeypadInputStatusEnum::kSuccess;
response.status = chip::app::Clusters::KeypadInput::StatusEnum::kSuccess;
break;
case CecKeyCodeType::kBackward:
response.status = chip::app::Clusters::KeypadInput::KeypadInputStatusEnum::kSuccess;
response.status = chip::app::Clusters::KeypadInput::StatusEnum::kSuccess;
break;
case CecKeyCodeType::kExit:
response.status = chip::app::Clusters::KeypadInput::KeypadInputStatusEnum::kSuccess;
response.status = chip::app::Clusters::KeypadInput::StatusEnum::kSuccess;
break;
case CecKeyCodeType::kRootMenu:
response.status = chip::app::Clusters::KeypadInput::KeypadInputStatusEnum::kSuccess;
response.status = chip::app::Clusters::KeypadInput::StatusEnum::kSuccess;
break;
case CecKeyCodeType::kSetupMenu:
response.status = chip::app::Clusters::KeypadInput::KeypadInputStatusEnum::kSuccess;
response.status = chip::app::Clusters::KeypadInput::StatusEnum::kSuccess;
break;
case CecKeyCodeType::kEnter:
response.status = chip::app::Clusters::KeypadInput::KeypadInputStatusEnum::kSuccess;
response.status = chip::app::Clusters::KeypadInput::StatusEnum::kSuccess;
break;
case CecKeyCodeType::kNumber0OrNumber10:
response.status = chip::app::Clusters::KeypadInput::KeypadInputStatusEnum::kSuccess;
response.status = chip::app::Clusters::KeypadInput::StatusEnum::kSuccess;
break;
case CecKeyCodeType::kNumbers1:
response.status = chip::app::Clusters::KeypadInput::KeypadInputStatusEnum::kSuccess;
response.status = chip::app::Clusters::KeypadInput::StatusEnum::kSuccess;
break;
case CecKeyCodeType::kNumbers2:
response.status = chip::app::Clusters::KeypadInput::KeypadInputStatusEnum::kSuccess;
response.status = chip::app::Clusters::KeypadInput::StatusEnum::kSuccess;
break;
case CecKeyCodeType::kNumbers3:
response.status = chip::app::Clusters::KeypadInput::KeypadInputStatusEnum::kSuccess;
response.status = chip::app::Clusters::KeypadInput::StatusEnum::kSuccess;
break;
case CecKeyCodeType::kNumbers4:
response.status = chip::app::Clusters::KeypadInput::KeypadInputStatusEnum::kSuccess;
response.status = chip::app::Clusters::KeypadInput::StatusEnum::kSuccess;
break;
case CecKeyCodeType::kNumbers5:
response.status = chip::app::Clusters::KeypadInput::KeypadInputStatusEnum::kSuccess;
response.status = chip::app::Clusters::KeypadInput::StatusEnum::kSuccess;
break;
case CecKeyCodeType::kNumbers6:
response.status = chip::app::Clusters::KeypadInput::KeypadInputStatusEnum::kSuccess;
response.status = chip::app::Clusters::KeypadInput::StatusEnum::kSuccess;
break;
case CecKeyCodeType::kNumbers7:
response.status = chip::app::Clusters::KeypadInput::KeypadInputStatusEnum::kSuccess;
response.status = chip::app::Clusters::KeypadInput::StatusEnum::kSuccess;
break;
case CecKeyCodeType::kNumbers8:
response.status = chip::app::Clusters::KeypadInput::KeypadInputStatusEnum::kSuccess;
response.status = chip::app::Clusters::KeypadInput::StatusEnum::kSuccess;
break;
case CecKeyCodeType::kNumbers9:
response.status = chip::app::Clusters::KeypadInput::KeypadInputStatusEnum::kSuccess;
response.status = chip::app::Clusters::KeypadInput::StatusEnum::kSuccess;
break;
default:
response.status = chip::app::Clusters::KeypadInput::KeypadInputStatusEnum::kUnsupportedKey;
response.status = chip::app::Clusters::KeypadInput::StatusEnum::kUnsupportedKey;
}

helper.Success(response);
Expand Down
4 changes: 2 additions & 2 deletions examples/tv-app/tv-common/tv-app.matter
Original file line number Diff line number Diff line change
Expand Up @@ -2194,7 +2194,7 @@ server cluster KeypadInput = 1289 {
kData = 118;
}

enum KeypadInputStatusEnum : enum8 {
enum StatusEnum : enum8 {
kSuccess = 0;
kUnsupportedKey = 1;
kInvalidKeyInCurrentState = 2;
Expand All @@ -2218,7 +2218,7 @@ server cluster KeypadInput = 1289 {
}

response struct SendKeyResponse = 1 {
KeypadInputStatusEnum status = 0;
StatusEnum status = 0;
}

command SendKey(SendKeyRequest): SendKeyResponse = 0;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1713,7 +1713,7 @@ client cluster KeypadInput = 1289 {
kData = 118;
}

enum KeypadInputStatusEnum : enum8 {
enum StatusEnum : enum8 {
kSuccess = 0;
kUnsupportedKey = 1;
kInvalidKeyInCurrentState = 2;
Expand All @@ -1737,7 +1737,7 @@ client cluster KeypadInput = 1289 {
}

response struct SendKeyResponse = 1 {
KeypadInputStatusEnum status = 0;
StatusEnum status = 0;
}

/** Upon receipt, this SHALL process a keycode as input to the media device. */
Expand Down
5 changes: 5 additions & 0 deletions src/app/CompatEnumNames.h
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,11 @@ namespace ApplicationLauncher {
using ApplicationLauncherStatusEnum = StatusEnum;
} // namespace ApplicationLauncher

namespace KeypadInput {
// https://github.com/project-chip/connectedhomeip/pull/30316 renamed this
using KeypadInputStatusEnum = StatusEnum;
} // namespace KeypadInput

namespace Channel {
using ChannelStatusEnum = StatusEnum;
} // namespace Channel
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,12 +32,12 @@ limitations under the License.

<command source="server" code="0x01" name="SendKeyResponse" optional="false">
<description>This command SHALL be generated in response to a SendKey Request command.</description>
<arg name="Status" type="KeypadInputStatusEnum"/>
<arg name="Status" type="StatusEnum"/>
</command>

</cluster>

<enum name="KeypadInputStatusEnum" type="enum8">
<enum name="StatusEnum" type="enum8">
<cluster code="0x0509"/>
<item name="Success" value="0x00"/>
<item name="UnsupportedKey" value="0x01"/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ limitations under the License.
<server init="false" tick="false">true</server>

<description>This cluster provides an interface for controlling the Input Selector on a media device such as a TV.</description>

<attribute side="server" code="0x0000" define="MEDIA_INPUT_LIST" type="ARRAY" entryType="InputInfoStruct" length="254" writable="false" optional="false">InputList</attribute>
<attribute side="server" code="0x0001" define="MEDIA_INPUT_CURRENT_INPUT" type="int8u" default="0x00" min="0x00" max="0xFF" writable="false" optional="false">CurrentInput</attribute>

Expand Down
4 changes: 2 additions & 2 deletions src/controller/data_model/controller-clusters.matter
Original file line number Diff line number Diff line change
Expand Up @@ -6237,7 +6237,7 @@ client cluster KeypadInput = 1289 {
kData = 118;
}

enum KeypadInputStatusEnum : enum8 {
enum StatusEnum : enum8 {
kSuccess = 0;
kUnsupportedKey = 1;
kInvalidKeyInCurrentState = 2;
Expand All @@ -6261,7 +6261,7 @@ client cluster KeypadInput = 1289 {
}

response struct SendKeyResponse = 1 {
KeypadInputStatusEnum status = 0;
StatusEnum status = 0;
}

/** Upon receipt, this SHALL process a keycode as input to the media device. */
Expand Down
6 changes: 3 additions & 3 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.

8 changes: 4 additions & 4 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.

Original file line number Diff line number Diff line change
Expand Up @@ -408,13 +408,13 @@ def test_tv_ctrl(device, controller):
err, res = send_zcl_command(devCtrl, "KeypadInput", "SendKey", nodeId, endpoint,
dict(keyCode=keyCode), requestTimeoutMs=1000)
assert err == 0
assert res.status == KeypadInput.Enums.KeypadInputStatusEnum.kSuccess
assert res.status == KeypadInput.Enums.StatusEnum.kSuccess

err, res = send_zcl_command(devCtrl, "KeypadInput", "SendKey", nodeId, endpoint,
dict(keyCode=TV_CTRL_TEST_KEY_PAD_UNSUPPORTED_KEY),
requestTimeoutMs=1000)
assert err == 0
assert res.status == KeypadInput.Enums.KeypadInputStatusEnum.kUnsupportedKey
assert res.status == KeypadInput.Enums.StatusEnum.kUnsupportedKey

# TargetNavigator
err, res = read_zcl_attribute(devCtrl, "TargetNavigator", "TargetList", nodeId, endpoint)
Expand Down

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.

0 comments on commit 1276800

Please sign in to comment.