Skip to content

Commit

Permalink
Rename media cluster commands & command arguments (#13195)
Browse files Browse the repository at this point in the history
* Update xml & test yaml & zap file

* Run zap regen script

* Fix code references

* Update command attributes in xml & yaml & zap files

* Run zap regen script

* Update code references

* Update logic as tests are failing

* Update xml, cpp and other files per comments

* Run zap regen script

* Restyle fix
  • Loading branch information
lazarkov authored and pull[bot] committed Feb 26, 2022
1 parent 380405d commit 3305102
Show file tree
Hide file tree
Showing 127 changed files with 6,254 additions and 11,810 deletions.
374 changes: 167 additions & 207 deletions examples/all-clusters-app/all-clusters-common/all-clusters-app.zap

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions examples/thermostat/thermostat-common/thermostat.zap
Original file line number Diff line number Diff line change
Expand Up @@ -12521,7 +12521,7 @@
"enabled": 0,
"commands": [
{
"name": "NavigateTarget",
"name": "NavigateTargetRequest",
"code": 0,
"mfgCode": null,
"source": "client",
Expand Down Expand Up @@ -13956,4 +13956,4 @@
"deviceIdentifier": 769
}
]
}
}
10 changes: 9 additions & 1 deletion examples/tv-app/android/include/application-basic/Application.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,13 @@

#include <app-common/zap-generated/cluster-objects.h>

namespace chip {
namespace app {
namespace Clusters {
namespace ApplicationBasic {
struct Application
{
using ApplicationBasicStatus = chip::app::Clusters::ApplicationBasic::ApplicationBasicStatus;
using ApplicationBasicStatus = chip::app::Clusters::ApplicationBasic::ApplicationStatusEnum;
char vendorName[32] = "";
char name[32] = "";
char id[32] = "";
Expand All @@ -33,3 +37,7 @@ struct Application
uint16_t allowedVendorList[32] = { 123, 456 };
ApplicationBasicStatus status = ApplicationBasicStatus::kStopped;
};
} // namespace ApplicationBasic
} // namespace Clusters
} // namespace app
} // namespace chip
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ CHIP_ERROR ApplicationBasicManager::Init()
return err;
}

void ApplicationBasicManager::store(chip::EndpointId endpoint, Application * application)
void ApplicationBasicManager::store(chip::EndpointId endpoint, chip::app::Clusters::ApplicationBasic::Application * application)
{
uint8_t bufferMemory[64];
MutableByteSpan zclString(bufferMemory);
Expand Down Expand Up @@ -100,10 +100,10 @@ void ApplicationBasicManager::store(chip::EndpointId endpoint, Application * app
}
}

Application ApplicationBasicManager::getApplicationForEndpoint(chip::EndpointId endpoint)
chip::app::Clusters::ApplicationBasic::Application ApplicationBasicManager::getApplicationForEndpoint(chip::EndpointId endpoint)
{
Application app = {};
uint16_t size = static_cast<uint16_t>(sizeof(app.name));
chip::app::Clusters::ApplicationBasic::Application app = {};
uint16_t size = static_cast<uint16_t>(sizeof(app.name));

std::string section = "endpoint" + std::to_string(endpoint);

Expand Down Expand Up @@ -147,7 +147,7 @@ Application ApplicationBasicManager::getApplicationForEndpoint(chip::EndpointId
}

bool applicationBasicClusterChangeApplicationStatus(chip::EndpointId endpoint,
app::Clusters::ApplicationBasic::ApplicationBasicStatus status)
app::Clusters::ApplicationBasic::ApplicationStatusEnum status)
{
// TODO: Insert code here
ChipLogProgress(Zcl, "Sent an application status change request %d for endpoint %d", to_underlying(status), endpoint);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@ class ApplicationBasicManager
{
public:
CHIP_ERROR Init();
void store(chip::EndpointId endpoint, Application * application);
Application getApplicationForEndpoint(chip::EndpointId endpoint);
void store(chip::EndpointId endpoint, chip::app::Clusters::ApplicationBasic::Application * application);
chip::app::Clusters::ApplicationBasic::Application getApplicationForEndpoint(chip::EndpointId endpoint);

static ApplicationBasicManager & GetInstance()
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
#include <app/clusters/application-launcher-server/application-launcher-server.h>
#include <app/util/af.h>
#include <app/util/basic-types.h>
#include <utility>

using namespace std;

Expand All @@ -43,41 +44,39 @@ CHIP_ERROR ApplicationLauncherManager::proxyGetApplicationList(chip::app::Attrib
});
}

ApplicationLauncherResponse applicationLauncherClusterLaunchApp(chip::EndpointId endpoint, ApplicationLauncherApp application,
ApplicationLauncherResponse applicationLauncherClusterLaunchApp(chip::EndpointId endpoint, Application application,
std::string data)
{
// TODO: Insert your code
ApplicationLauncherResponse response;
const char * testData = "data";
response.data = (uint8_t *) testData;
response.status = EMBER_ZCL_APPLICATION_LAUNCHER_STATUS_SUCCESS;
response.status = chip::to_underlying(chip::app::Clusters::ApplicationLauncher::StatusEnum::kSuccess);
// TODO: Update once storing a structure attribute is supported
// emberAfWriteServerAttribute(endpoint, ZCL_APPLICATION_LAUNCH_CLUSTER_ID, ZCL_APPLICATION_LAUNCHER_CURRENT_APP_APPLICATION_ID,
// (uint8_t *) &application, ZCL_STRUCT_ATTRIBUTE_TYPE);

return response;
}

ApplicationLauncherResponse applicationLauncherClusterStopApp(chip::EndpointId endpoint, ApplicationLauncherApp application,
std::string data)
ApplicationLauncherResponse applicationLauncherClusterStopApp(chip::EndpointId endpoint, Application application, std::string data)
{
ChipLogProgress(Zcl, "ApplicationLauncherManager::applicationLauncherClusterStopApp");

ApplicationLauncherResponse response;
const char * testData = "data";
response.data = (uint8_t *) testData;
response.status = EMBER_ZCL_APPLICATION_LAUNCHER_STATUS_SUCCESS;
response.status = chip::to_underlying(chip::app::Clusters::ApplicationLauncher::StatusEnum::kSuccess);
return response;
}

ApplicationLauncherResponse applicationLauncherClusterHideApp(chip::EndpointId endpoint, ApplicationLauncherApp application,
std::string data)
ApplicationLauncherResponse applicationLauncherClusterHideApp(chip::EndpointId endpoint, Application application, std::string data)
{
ChipLogProgress(Zcl, "ApplicationLauncherManager::applicationLauncherClusterHideApp");

ApplicationLauncherResponse response;
const char * testData = "data";
response.data = (uint8_t *) testData;
response.status = EMBER_ZCL_APPLICATION_LAUNCHER_STATUS_SUCCESS;
response.status = chip::to_underlying(chip::app::Clusters::ApplicationLauncher::StatusEnum::kSuccess);
return response;
}
Original file line number Diff line number Diff line change
Expand Up @@ -49,11 +49,11 @@ CHIP_ERROR AudioOutputManager::proxyGetListOfAudioOutputInfo(chip::app::Attribut

for (int i = 0; i < maximumVectorSize; ++i)
{
chip::app::Clusters::AudioOutput::Structs::AudioOutputInfo::Type audioOutputInfo;
audioOutputInfo.outputType = EMBER_ZCL_AUDIO_OUTPUT_TYPE_HDMI;
audioOutputInfo.name = chip::CharSpan(name, sizeof(name) - 1);
audioOutputInfo.index = static_cast<uint8_t>(1 + i);
ReturnErrorOnFailure(encoder.Encode(audioOutputInfo));
chip::app::Clusters::AudioOutput::Structs::OutputInfo::Type outputInfo;
outputInfo.outputType = chip::app::Clusters::AudioOutput::OutputTypeEnum::kHdmi;
outputInfo.name = chip::CharSpan(name, sizeof(name) - 1);
outputInfo.index = static_cast<uint8_t>(1 + i);
ReturnErrorOnFailure(encoder.Encode(outputInfo));
}
return CHIP_NO_ERROR;
});
Expand Down
2 changes: 1 addition & 1 deletion examples/tv-app/android/include/cluster-init.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ void emberAfApplicationBasicClusterInitCallback(chip::EndpointId endpoint)
err = aManager.Init();
if (CHIP_NO_ERROR == err)
{
Application application = aManager.getApplicationForEndpoint(endpoint);
chip::app::Clusters::ApplicationBasic::Application application = aManager.getApplicationForEndpoint(endpoint);
aManager.store(endpoint, &application);
}
else
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ CHIP_ERROR TargetNavigatorManager::proxyGetTargetInfoList(chip::app::AttributeVa

for (int i = 0; i < maximumVectorSize; ++i)
{
chip::app::Clusters::TargetNavigator::Structs::NavigateTargetTargetInfo::Type targetInfo;
chip::app::Clusters::TargetNavigator::Structs::TargetInfo::Type targetInfo;
targetInfo.name = chip::CharSpan(name, sizeof(name) - 1);
targetInfo.identifier = static_cast<uint8_t>(1 + i);
ReturnErrorOnFailure(encoder.Encode(targetInfo));
Expand All @@ -61,6 +61,6 @@ TargetNavigatorResponse targetNavigatorClusterNavigateTarget(chip::EndpointId en
TargetNavigatorResponse response;
const char * testData = "data response";
response.data = (uint8_t *) testData;
response.status = EMBER_ZCL_APPLICATION_LAUNCHER_STATUS_SUCCESS;
response.status = chip::to_underlying(chip::app::Clusters::TargetNavigator::StatusEnum::kSuccess);
return response;
}
16 changes: 8 additions & 8 deletions examples/tv-app/android/java/ChannelManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -223,7 +223,7 @@ CHIP_ERROR ChannelManager::getChannelLineup(chip::app::AttributeValueEncoder & a
VerifyOrExit(env != NULL, err = CHIP_JNI_ERROR_NO_ENV);

{
chip::app::Clusters::Channel::Structs::ChannelLineupInfo::Type channelLineupInfo;
chip::app::Clusters::Channel::Structs::LineupInfo::Type lineupInfo;

jobject channelLineupObject = env->CallObjectMethod(mChannelManagerObject, mGetLineupMethod);
jclass channelLineupClazz = env->GetObjectClass(channelLineupObject);
Expand All @@ -233,30 +233,30 @@ CHIP_ERROR ChannelManager::getChannelLineup(chip::app::AttributeValueEncoder & a
if (joperatorName != NULL)
{
JniUtfString operatorName(env, joperatorName);
channelLineupInfo.operatorName = operatorName.charSpan();
lineupInfo.operatorName = operatorName.charSpan();
}

jfieldID lineupNameFild = env->GetFieldID(channelLineupClazz, "lineupName", "Ljava/lang/String;");
jstring jlineupName = static_cast<jstring>(env->GetObjectField(channelLineupObject, lineupNameFild));
if (jlineupName != NULL)
{
JniUtfString lineupName(env, jlineupName);
channelLineupInfo.lineupName = lineupName.charSpan();
lineupInfo.lineupName = lineupName.charSpan();
}

jfieldID postalCodeFild = env->GetFieldID(channelLineupClazz, "postalCode", "Ljava/lang/String;");
jstring jpostalCode = static_cast<jstring>(env->GetObjectField(channelLineupObject, postalCodeFild));
if (jpostalCode != NULL)
{
JniUtfString postalCode(env, jpostalCode);
channelLineupInfo.postalCode = postalCode.charSpan();
lineupInfo.postalCode = postalCode.charSpan();
}

jfieldID lineupInfoTypeFild = env->GetFieldID(channelLineupClazz, "lineupInfoType", "I");
jint jlineupInfoType = (env->GetIntField(channelLineupObject, lineupInfoTypeFild));
channelLineupInfo.lineupInfoType = static_cast<app::Clusters::Channel::ChannelLineupInfoType>(jlineupInfoType);
jfieldID lineupInfoTypeFild = env->GetFieldID(channelLineupClazz, "lineupInfoTypeEnum", "I");
jint jlineupInfoType = (env->GetIntField(channelLineupObject, lineupInfoTypeFild));
lineupInfo.lineupInfoType = static_cast<app::Clusters::Channel::LineupInfoTypeEnum>(jlineupInfoType);

ReturnErrorOnFailure(aEncoder.Encode(channelLineupInfo));
ReturnErrorOnFailure(aEncoder.Encode(lineupInfo));

return CHIP_NO_ERROR;
}
Expand Down
22 changes: 10 additions & 12 deletions examples/tv-app/android/java/ContentLauncherManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -45,11 +45,10 @@ using namespace chip;

ContentLauncherManager ContentLauncherManager::sInstance;

ContentLaunchResponse ContentLauncherManager::HandleLaunchContent(chip::EndpointId endpointId,
const std::list<ContentLaunchParamater> & parameterList,
bool autoplay, const chip::CharSpan & data)
LaunchResponse ContentLauncherManager::HandleLaunchContent(chip::EndpointId endpointId, const std::list<Parameter> & parameterList,
bool autoplay, const chip::CharSpan & data)
{
ContentLaunchResponse response;
LaunchResponse response;
CHIP_ERROR err = CHIP_NO_ERROR;
JNIEnv * env = JniReferences::GetInstance().GetEnvForCurrentThread();

Expand Down Expand Up @@ -86,7 +85,7 @@ ContentLaunchResponse ContentLauncherManager::HandleLaunchContent(chip::Endpoint
jstring jdataStr = (jstring) env->GetObjectField(resp, dataFid);
JniUtfString dataStr(env, jdataStr);

response.status = static_cast<chip::app::Clusters::ContentLauncher::ContentLaunchStatus>(status);
response.status = static_cast<chip::app::Clusters::ContentLauncher::StatusEnum>(status);
response.data = dataStr.charSpan();
}

Expand All @@ -100,11 +99,10 @@ ContentLaunchResponse ContentLauncherManager::HandleLaunchContent(chip::Endpoint
return response;
}

ContentLaunchResponse
ContentLauncherManager::HandleLaunchUrl(const chip::CharSpan & contentUrl, const chip::CharSpan & displayString,
const std::list<ContentLaunchBrandingInformation> & brandingInformation)
LaunchResponse ContentLauncherManager::HandleLaunchUrl(const chip::CharSpan & contentUrl, const chip::CharSpan & displayString,
const std::list<BrandingInformation> & brandingInformation)
{
ContentLaunchResponse response;
LaunchResponse response;
CHIP_ERROR err = CHIP_NO_ERROR;
JNIEnv * env = JniReferences::GetInstance().GetEnvForCurrentThread();

Expand Down Expand Up @@ -142,7 +140,7 @@ ContentLauncherManager::HandleLaunchUrl(const chip::CharSpan & contentUrl, const
jstring jdataStr = (jstring) env->GetObjectField(resp, dataFid);
JniUtfString dataStr(env, jdataStr);

response.status = static_cast<chip::app::Clusters::ContentLauncher::ContentLaunchStatus>(status);
response.status = static_cast<chip::app::Clusters::ContentLauncher::StatusEnum>(status);
response.data = dataStr.charSpan();
}

Expand Down Expand Up @@ -260,7 +258,7 @@ void ContentLauncherManager::InitializeWithObjects(jobject managerObject)

mLaunchContentMethod = env->GetMethodID(
ContentLauncherClass, "launchContent",
"([Lcom/tcl/chip/tvapp/ContentLaunchSearchParameter;ZLjava/lang/String;)Lcom/tcl/chip/tvapp/ContentLaunchResponse;");
"([Lcom/tcl/chip/tvapp/ContentLaunchSearchParameter;ZLjava/lang/String;)Lcom/tcl/chip/tvapp/LaunchResponse;");
if (mLaunchContentMethod == nullptr)
{
ChipLogError(Zcl, "Failed to access MediaInputManager 'launchContent' method");
Expand All @@ -269,7 +267,7 @@ void ContentLauncherManager::InitializeWithObjects(jobject managerObject)

mLaunchUrlMethod = env->GetMethodID(ContentLauncherClass, "launchUrl",
"(Ljava/lang/String;Ljava/lang/String;Lcom/tcl/chip/tvapp/"
"ContentLaunchBrandingInformation;)Lcom/tcl/chip/tvapp/ContentLaunchResponse;");
"ContentLaunchBrandingInformation;)Lcom/tcl/chip/tvapp/LaunchResponse;");
if (mLaunchUrlMethod == nullptr)
{
ChipLogError(AppServer, "Failed to access 'launchUrl' method");
Expand Down
8 changes: 4 additions & 4 deletions examples/tv-app/android/java/ContentLauncherManager.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,10 @@ class ContentLauncherManager : public chip::app::Clusters::ContentLauncher::Dele
public:
void InitializeWithObjects(jobject managerObject);

ContentLaunchResponse HandleLaunchContent(chip::EndpointId endpointId, const std::list<ContentLaunchParamater> & parameterList,
bool autoplay, const chip::CharSpan & data) override;
ContentLaunchResponse HandleLaunchUrl(const chip::CharSpan & contentUrl, const chip::CharSpan & displayString,
const std::list<ContentLaunchBrandingInformation> & brandingInformation) override;
LaunchResponse HandleLaunchContent(chip::EndpointId endpointId, const std::list<Parameter> & parameterList, bool autoplay,
const chip::CharSpan & data) override;
LaunchResponse HandleLaunchUrl(const chip::CharSpan & contentUrl, const chip::CharSpan & displayString,
const std::list<BrandingInformation> & brandingInformation) override;
std::list<std::string> HandleGetAcceptHeaderList() override;
uint32_t HandleGetSupportedStreamingProtocols() override;

Expand Down
10 changes: 5 additions & 5 deletions examples/tv-app/android/java/KeypadInputManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,18 +28,18 @@ using namespace chip;

KeypadInputManager KeypadInputManager::sInstance;

EmberAfKeypadInputStatus keypadInputClusterSendKey(EmberAfKeypadInputCecKeyCode keyCode)
chip::app::Clusters::KeypadInput::StatusEnum keypadInputClusterSendKey(chip::app::Clusters::KeypadInput::CecKeyCode keyCode)
{
return KeypadInputMgr().SendKey(keyCode);
}

EmberAfKeypadInputStatus KeypadInputManager::SendKey(EmberAfKeypadInputCecKeyCode keyCode)
chip::app::Clusters::KeypadInput::StatusEnum KeypadInputManager::SendKey(chip::app::Clusters::KeypadInput::CecKeyCode keyCode)
{
jint ret = -1;
CHIP_ERROR err = CHIP_NO_ERROR;
JNIEnv * env = JniReferences::GetInstance().GetEnvForCurrentThread();

ChipLogProgress(Zcl, "Received keypadInputClusterSendKey: %d", keyCode);
ChipLogProgress(Zcl, "Received keypadInputClusterSendKey: %c", to_underlying(keyCode));
VerifyOrExit(mKeypadInputManagerObject != nullptr, err = CHIP_ERROR_INCORRECT_STATE);
VerifyOrExit(mSendKeyMethod != nullptr, err = CHIP_ERROR_INCORRECT_STATE);
VerifyOrExit(env != NULL, err = CHIP_JNI_ERROR_NO_ENV);
Expand All @@ -51,10 +51,10 @@ EmberAfKeypadInputStatus KeypadInputManager::SendKey(EmberAfKeypadInputCecKeyCod
exit:
if (err != CHIP_NO_ERROR)
{
return EMBER_ZCL_KEYPAD_INPUT_STATUS_SUCCESS;
return chip::app::Clusters::KeypadInput::StatusEnum::kSuccess;
}

return static_cast<EmberAfKeypadInputStatus>(ret);
return static_cast<chip::app::Clusters::KeypadInput::StatusEnum>(ret);
}

void KeypadInputManager::InitializeWithObjects(jobject managerObject)
Expand Down
3 changes: 2 additions & 1 deletion examples/tv-app/android/java/KeypadInputManager.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,15 @@
#pragma once

#include <app-common/zap-generated/af-structs.h>
#include <app-common/zap-generated/cluster-objects.h>
#include <jni.h>
#include <lib/core/CHIPError.h>

class KeypadInputManager
{
public:
void InitializeWithObjects(jobject managerObject);
EmberAfKeypadInputStatus SendKey(EmberAfKeypadInputCecKeyCode keyCode);
chip::app::Clusters::KeypadInput::StatusEnum SendKey(chip::app::Clusters::KeypadInput::CecKeyCode keyCode);

private:
friend KeypadInputManager & KeypadInputMgr();
Expand Down
6 changes: 3 additions & 3 deletions examples/tv-app/android/java/MediaInputManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ CHIP_ERROR MediaInputManager::GetInputList(app::AttributeValueEncoder & aEncoder
jint size = env->GetArrayLength(inputArray);
for (int i = 0; i < size; i++)
{
app::Clusters::MediaInput::Structs::MediaInputInfo::Type mediaInput;
app::Clusters::MediaInput::Structs::InputInfo::Type mediaInput;

jobject inputObj = env->GetObjectArrayElement(inputArray, i);
jclass inputClass = env->GetObjectClass(inputObj);
Expand All @@ -127,7 +127,7 @@ CHIP_ERROR MediaInputManager::GetInputList(app::AttributeValueEncoder & aEncoder

jfieldID typeId = env->GetFieldID(inputClass, "type", "I");
jint type = env->GetIntField(inputObj, typeId);
mediaInput.inputType = static_cast<app::Clusters::MediaInput::MediaInputType>(type);
mediaInput.inputType = static_cast<app::Clusters::MediaInput::InputTypeEnum>(type);

jfieldID nameId = env->GetFieldID(inputClass, "name", "Ljava/lang/String;");
jstring jname = static_cast<jstring>(env->GetObjectField(inputObj, nameId));
Expand Down Expand Up @@ -308,7 +308,7 @@ void MediaInputManager::InitializeWithObjects(jobject managerObject)
jclass MediaInputManagerClass = env->GetObjectClass(managerObject);
VerifyOrReturn(MediaInputManagerClass != nullptr, ChipLogError(Zcl, "Failed to get MediaInputManager Java class"));

mGetInputListMethod = env->GetMethodID(MediaInputManagerClass, "getInputList", "()[Lcom/tcl/chip/tvapp/MediaInputInfo;");
mGetInputListMethod = env->GetMethodID(MediaInputManagerClass, "getInputList", "()[Lcom/tcl/chip/tvapp/InputInfo;");
if (mGetInputListMethod == nullptr)
{
ChipLogError(Zcl, "Failed to access MediaInputManager 'getInputList' method");
Expand Down
Loading

0 comments on commit 3305102

Please sign in to comment.