Skip to content

Commit

Permalink
Rename CecKeyCode to CecKeyCodeEnum to match spec (project-chip#30497)
Browse files Browse the repository at this point in the history
* Rename CecKeyCode to CecKeyCodeEnum to match spec

* Fix PR number

* Ran zap_convert_all.py

* Restyle

* Minor change to kick CI

* Fix for compilation

* Restyle

* Mass rename CecKeyCodeEnum to CECKeyCodeEnum

* Zap regen

* Update Darwin availability annotations.

---------

Co-authored-by: Andrei Litvin <[email protected]>
Co-authored-by: Boris Zbarsky <[email protected]>
  • Loading branch information
3 people authored Nov 20, 2023
1 parent 65a10e2 commit d12edc4
Show file tree
Hide file tree
Showing 27 changed files with 487 additions and 129 deletions.
4 changes: 2 additions & 2 deletions data_model/clusters/KeypadInput.xml
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ Davis, CA 95616, USA
</feature>
</features>
<dataTypes>
<enum name="CecKeyCodeEnum">
<enum name="CECKeyCodeEnum">
<item value="0" name="Select">
<mandatoryConform/>
</item>
Expand Down Expand Up @@ -348,7 +348,7 @@ Davis, CA 95616, USA
<command id="0x00" name="SendKey" response="SendKeyResponse">
<access invokePrivilege="operate"/>
<mandatoryConform/>
<field id="0" name="KeyCode" type="CecKeyCodeEnum">
<field id="0" name="KeyCode" type="CECKeyCodeEnum">
<mandatoryConform/>
</field>
</command>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3366,7 +3366,7 @@ server cluster LowPower = 1288 {

/** This cluster provides an interface for controlling a device like a TV using action commands such as UP, DOWN, and SELECT. */
server cluster KeypadInput = 1289 {
enum CecKeyCode : enum8 {
enum CECKeyCodeEnum : enum8 {
kSelect = 0;
kUp = 1;
kDown = 2;
Expand Down Expand Up @@ -3475,7 +3475,7 @@ server cluster KeypadInput = 1289 {
readonly attribute int16u clusterRevision = 65533;

request struct SendKeyRequest {
CecKeyCode keyCode = 0;
CECKeyCodeEnum keyCode = 0;
}

response struct SendKeyResponse = 1 {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1313,7 +1313,7 @@ server cluster LowPower = 1288 {

/** This cluster provides an interface for controlling a device like a TV using action commands such as UP, DOWN, and SELECT. */
server cluster KeypadInput = 1289 {
enum CecKeyCode : enum8 {
enum CECKeyCodeEnum : enum8 {
kSelect = 0;
kUp = 1;
kDown = 2;
Expand Down Expand Up @@ -1422,7 +1422,7 @@ server cluster KeypadInput = 1289 {
readonly attribute int16u clusterRevision = 65533;

request struct SendKeyRequest {
CecKeyCode keyCode = 0;
CECKeyCodeEnum keyCode = 0;
}

response struct SendKeyResponse = 1 {
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 @@ -5829,7 +5829,7 @@ client cluster LowPower = 1288 {

/** This cluster provides an interface for controlling a device like a TV using action commands such as UP, DOWN, and SELECT. */
client cluster KeypadInput = 1289 {
enum CecKeyCode : enum8 {
enum CECKeyCodeEnum : enum8 {
kSelect = 0;
kUp = 1;
kDown = 2;
Expand Down Expand Up @@ -5938,7 +5938,7 @@ client cluster KeypadInput = 1289 {
readonly attribute int16u clusterRevision = 65533;

request struct SendKeyRequest {
CecKeyCode keyCode = 0;
CECKeyCodeEnum keyCode = 0;
}

response struct SendKeyResponse = 1 {
Expand All @@ -5951,7 +5951,7 @@ client cluster KeypadInput = 1289 {

/** This cluster provides an interface for controlling a device like a TV using action commands such as UP, DOWN, and SELECT. */
server cluster KeypadInput = 1289 {
enum CecKeyCode : enum8 {
enum CECKeyCodeEnum : enum8 {
kSelect = 0;
kUp = 1;
kDown = 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 @@ -5788,7 +5788,7 @@ client cluster LowPower = 1288 {

/** This cluster provides an interface for controlling a device like a TV using action commands such as UP, DOWN, and SELECT. */
client cluster KeypadInput = 1289 {
enum CecKeyCode : enum8 {
enum CECKeyCodeEnum : enum8 {
kSelect = 0;
kUp = 1;
kDown = 2;
Expand Down Expand Up @@ -5897,7 +5897,7 @@ client cluster KeypadInput = 1289 {
readonly attribute int16u clusterRevision = 65533;

request struct SendKeyRequest {
CecKeyCode keyCode = 0;
CECKeyCodeEnum keyCode = 0;
}

response struct SendKeyResponse = 1 {
Expand All @@ -5910,7 +5910,7 @@ client cluster KeypadInput = 1289 {

/** This cluster provides an interface for controlling a device like a TV using action commands such as UP, DOWN, and SELECT. */
server cluster KeypadInput = 1289 {
enum CecKeyCode : enum8 {
enum CECKeyCodeEnum : enum8 {
kSelect = 0;
kUp = 1;
kDown = 2;
Expand Down
2 changes: 1 addition & 1 deletion examples/tv-app/android/java/KeypadInputManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ void KeypadInputManager::NewManager(jint endpoint, jobject manager)
chip::app::Clusters::KeypadInput::SetDefaultDelegate(static_cast<EndpointId>(endpoint), mgr);
}

void KeypadInputManager::HandleSendKey(CommandResponseHelper<SendKeyResponseType> & helper, const CecKeyCode & keyCode)
void KeypadInputManager::HandleSendKey(CommandResponseHelper<SendKeyResponseType> & helper, const CECKeyCodeEnum & keyCode)
{
Commands::SendKeyResponse::Type response;

Expand Down
2 changes: 1 addition & 1 deletion examples/tv-app/android/java/KeypadInputManager.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ class KeypadInputManager : public KeypadInputDelegate
void InitializeWithObjects(jobject managerObject);

void HandleSendKey(CommandResponseHelper<SendKeyResponseType> & helper,
const chip::app::Clusters::KeypadInput::CecKeyCode & keyCode) override;
const chip::app::Clusters::KeypadInput::CECKeyCodeEnum & keyCode) override;

uint32_t GetFeatureMap(chip::EndpointId endpoint) override;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
using chip::app::CommandResponseHelper;
using KeypadInputDelegate = chip::app::Clusters::KeypadInput::Delegate;
using SendKeyResponseType = chip::app::Clusters::KeypadInput::Commands::SendKeyResponse::Type;
using CecKeyCodeType = chip::app::Clusters::KeypadInput::CecKeyCode;
using CecKeyCodeType = chip::app::Clusters::KeypadInput::CECKeyCodeEnum;

class KeypadInputManager : public KeypadInputDelegate
{
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 @@ -2107,7 +2107,7 @@ server cluster LowPower = 1288 {

/** This cluster provides an interface for controlling a device like a TV using action commands such as UP, DOWN, and SELECT. */
server cluster KeypadInput = 1289 {
enum CecKeyCode : enum8 {
enum CECKeyCodeEnum : enum8 {
kSelect = 0;
kUp = 1;
kDown = 2;
Expand Down Expand Up @@ -2216,7 +2216,7 @@ server cluster KeypadInput = 1289 {
readonly attribute int16u clusterRevision = 65533;

request struct SendKeyRequest {
CecKeyCode keyCode = 0;
CECKeyCodeEnum keyCode = 0;
}

response struct SendKeyResponse = 1 {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1663,7 +1663,7 @@ JNI_METHOD(jboolean, keypadInput_1sendKey)
ChipLogError(AppServer, "MatterCallbackHandlerJNI.SetUp failed %" CHIP_ERROR_FORMAT, err.Format()));

err = CastingServer::GetInstance()->KeypadInput_SendKey(
&endpoint, static_cast<chip::app::Clusters::KeypadInput::CecKeyCode>(keyCode),
&endpoint, static_cast<chip::app::Clusters::KeypadInput::CECKeyCodeEnum>(keyCode),
[](CHIP_ERROR err) { TvCastingAppJNIMgr().getMediaCommandResponseHandler(KeypadInput_SendKey).Handle(err); });
VerifyOrExit(CHIP_NO_ERROR == err,
ChipLogError(AppServer, "CastingServer.KeypadInput_SendKey failed %" CHIP_ERROR_FORMAT, err.Format()));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2154,7 +2154,7 @@ - (void)keypadInput_sendKey:(ContentApp * _Nonnull)contentApp
[ConversionUtils convertToCppTargetEndpointInfoFrom:contentApp outTargetEndpointInfo:endpoint];

return castingServer->KeypadInput_SendKey(&endpoint,
static_cast<chip::app::Clusters::KeypadInput::CecKeyCode>(keyCode), responseFunction);
static_cast<chip::app::Clusters::KeypadInput::CECKeyCodeEnum>(keyCode), responseFunction);
}];
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -303,7 +303,7 @@ class CastingServer : public AppDelegate
/**
* @brief Keypad Input cluster
*/
CHIP_ERROR KeypadInput_SendKey(TargetEndpointInfo * endpoint, const chip::app::Clusters::KeypadInput::CecKeyCode keyCode,
CHIP_ERROR KeypadInput_SendKey(TargetEndpointInfo * endpoint, const chip::app::Clusters::KeypadInput::CECKeyCodeEnum keyCode,
std::function<void(CHIP_ERROR)> responseCallback);

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,5 +29,6 @@ class SendKeyCommand : public MediaCommandBase<chip::app::Clusters::KeypadInput:
public:
SendKeyCommand() : MediaCommandBase(chip::app::Clusters::KeypadInput::Id) {}

CHIP_ERROR Invoke(const chip::app::Clusters::KeypadInput::CecKeyCode keyCode, std::function<void(CHIP_ERROR)> responseCallback);
CHIP_ERROR Invoke(const chip::app::Clusters::KeypadInput::CECKeyCodeEnum keyCode,
std::function<void(CHIP_ERROR)> responseCallback);
};
Original file line number Diff line number Diff line change
Expand Up @@ -1100,7 +1100,7 @@ CHIP_ERROR CastingServer::TargetNavigator_SubscribeToCurrentTarget(
* @brief Keypad Input cluster
*/
CHIP_ERROR CastingServer::KeypadInput_SendKey(TargetEndpointInfo * endpoint,
const chip::app::Clusters::KeypadInput::CecKeyCode keyCode,
const chip::app::Clusters::KeypadInput::CECKeyCodeEnum keyCode,
std::function<void(CHIP_ERROR)> responseCallback)
{
ReturnErrorOnFailure(mSendKeyCommand.SetTarget(mActiveTargetVideoPlayerInfo, endpoint->GetEndpointId()));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
using namespace chip;
using namespace chip::app::Clusters;

CHIP_ERROR SendKeyCommand::Invoke(const chip::app::Clusters::KeypadInput::CecKeyCode keyCode,
CHIP_ERROR SendKeyCommand::Invoke(const chip::app::Clusters::KeypadInput::CECKeyCodeEnum keyCode,
std::function<void(CHIP_ERROR)> responseCallback)
{
KeypadInput::Commands::SendKey::Type request;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1626,7 +1626,7 @@ client cluster LowPower = 1288 {

/** This cluster provides an interface for controlling a device like a TV using action commands such as UP, DOWN, and SELECT. */
client cluster KeypadInput = 1289 {
enum CecKeyCode : enum8 {
enum CECKeyCodeEnum : enum8 {
kSelect = 0;
kUp = 1;
kDown = 2;
Expand Down Expand Up @@ -1735,7 +1735,7 @@ client cluster KeypadInput = 1289 {
readonly attribute int16u clusterRevision = 65533;

request struct SendKeyRequest {
CecKeyCode keyCode = 0;
CECKeyCodeEnum keyCode = 0;
}

response struct SendKeyResponse = 1 {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3250,7 +3250,7 @@ server cluster LowPower = 1288 {
}

server cluster KeypadInput = 1289 {
enum CecKeyCode : ENUM8 {
enum CECKeyCodeEnum : ENUM8 {
kSelect = 0;
kUp = 1;
kDown = 2;
Expand Down Expand Up @@ -3355,7 +3355,7 @@ server cluster KeypadInput = 1289 {
readonly attribute int16u clusterRevision = 65533;

request struct SendKeyRequest {
CecKeyCode keyCode = 0;
CECKeyCodeEnum keyCode = 0;
}

response struct SendKeyResponse = 1 {
Expand Down
3 changes: 2 additions & 1 deletion src/app/CompatEnumNames.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
* is meant to be included at the end of cluster-enums.h, after all the normal
* enum definitions are available.
*/

#pragma once

namespace chip {
Expand Down Expand Up @@ -61,6 +60,8 @@ using ApplicationLauncherStatusEnum = StatusEnum;
namespace KeypadInput {
// https://github.com/project-chip/connectedhomeip/pull/30316 renamed this
using KeypadInputStatusEnum = StatusEnum;
// https://github.com/project-chip/connectedhomeip/pull/30497 renamed this
using CecKeyCode = CECKeyCodeEnum;
} // namespace KeypadInput

namespace Channel {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ namespace KeypadInput {
class Delegate
{
public:
virtual void HandleSendKey(CommandResponseHelper<Commands::SendKeyResponse::Type> & helper, const CecKeyCode & keyCode) = 0;
virtual void HandleSendKey(CommandResponseHelper<Commands::SendKeyResponse::Type> & helper, const CECKeyCodeEnum & keyCode) = 0;

bool HasFeature(chip::EndpointId endpoint, Feature feature);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ limitations under the License.

<command source="client" code="0x00" name="SendKey" response="SendKeyResponse" optional="false">
<description>Upon receipt, this SHALL process a keycode as input to the media device.</description>
<arg name="KeyCode" type="CecKeyCode"/>
<arg name="KeyCode" type="CECKeyCodeEnum"/>
</command>

<command source="server" code="0x01" name="SendKeyResponse" optional="false">
Expand All @@ -44,7 +44,7 @@ limitations under the License.
<item name="InvalidKeyInCurrentState" value="0x02"/>
</enum>

<enum name="CecKeyCode" type="enum8">
<enum name="CECKeyCodeEnum" type="enum8">
<cluster code="0x0509"/>
<item name="Select" value="0x00"/>
<item name="Up" value="0x01"/>
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 @@ -6582,7 +6582,7 @@ client cluster LowPower = 1288 {

/** This cluster provides an interface for controlling a device like a TV using action commands such as UP, DOWN, and SELECT. */
client cluster KeypadInput = 1289 {
enum CecKeyCode : enum8 {
enum CECKeyCodeEnum : enum8 {
kSelect = 0;
kUp = 1;
kDown = 2;
Expand Down Expand Up @@ -6691,7 +6691,7 @@ client cluster KeypadInput = 1289 {
readonly attribute int16u clusterRevision = 65533;

request struct SendKeyRequest {
CecKeyCode keyCode = 0;
CECKeyCodeEnum keyCode = 0;
}

response struct SendKeyResponse = 1 {
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.

Loading

0 comments on commit d12edc4

Please sign in to comment.