Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Zap update tv app again #6526

Merged
merged 2 commits into from
May 6, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
739 changes: 739 additions & 0 deletions examples/tv-app/tv-common/gen/IMClusterCommandHandler.cpp

Large diffs are not rendered by default.

235 changes: 218 additions & 17 deletions examples/tv-app/tv-common/gen/call-command-handler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,15 +35,12 @@ EmberAfStatus emberAfAudioOutputClusterServerCommandParse(EmberAfClusterCommand
EmberAfStatus emberAfColorControlClusterServerCommandParse(EmberAfClusterCommand * cmd);
EmberAfStatus emberAfContentLaunchClusterServerCommandParse(EmberAfClusterCommand * cmd);
EmberAfStatus emberAfGeneralCommissioningClusterServerCommandParse(EmberAfClusterCommand * cmd);
EmberAfStatus emberAfGroupsClusterServerCommandParse(EmberAfClusterCommand * cmd);
EmberAfStatus emberAfIdentifyClusterServerCommandParse(EmberAfClusterCommand * cmd);
EmberAfStatus emberAfKeypadInputClusterServerCommandParse(EmberAfClusterCommand * cmd);
EmberAfStatus emberAfLevelControlClusterServerCommandParse(EmberAfClusterCommand * cmd);
EmberAfStatus emberAfLowPowerClusterServerCommandParse(EmberAfClusterCommand * cmd);
EmberAfStatus emberAfMediaInputClusterServerCommandParse(EmberAfClusterCommand * cmd);
EmberAfStatus emberAfMediaPlaybackClusterServerCommandParse(EmberAfClusterCommand * cmd);
EmberAfStatus emberAfOnOffClusterServerCommandParse(EmberAfClusterCommand * cmd);
EmberAfStatus emberAfScenesClusterServerCommandParse(EmberAfClusterCommand * cmd);
EmberAfStatus emberAfTvChannelClusterServerCommandParse(EmberAfClusterCommand * cmd);
EmberAfStatus emberAfTargetNavigatorClusterServerCommandParse(EmberAfClusterCommand * cmd);
EmberAfStatus emberAfWakeOnLanClusterServerCommandParse(EmberAfClusterCommand * cmd);
Expand Down Expand Up @@ -110,20 +107,11 @@ EmberAfStatus emberAfClusterSpecificCommandParse(EmberAfClusterCommand * cmd)
case ZCL_GENERAL_COMMISSIONING_CLUSTER_ID:
result = emberAfGeneralCommissioningClusterServerCommandParse(cmd);
break;
case ZCL_GROUPS_CLUSTER_ID:
// No commands are enabled for cluster Groups
result = status(false, true, cmd->mfgSpecific);
break;
case ZCL_IDENTIFY_CLUSTER_ID:
// No commands are enabled for cluster Identify
result = status(false, true, cmd->mfgSpecific);
break;
case ZCL_KEYPAD_INPUT_CLUSTER_ID:
result = emberAfKeypadInputClusterServerCommandParse(cmd);
break;
case ZCL_LEVEL_CONTROL_CLUSTER_ID:
// No commands are enabled for cluster Level Control
result = status(false, true, cmd->mfgSpecific);
result = emberAfLevelControlClusterServerCommandParse(cmd);
break;
case ZCL_LOW_POWER_CLUSTER_ID:
result = emberAfLowPowerClusterServerCommandParse(cmd);
Expand All @@ -137,10 +125,6 @@ EmberAfStatus emberAfClusterSpecificCommandParse(EmberAfClusterCommand * cmd)
case ZCL_ON_OFF_CLUSTER_ID:
result = emberAfOnOffClusterServerCommandParse(cmd);
break;
case ZCL_SCENES_CLUSTER_ID:
// No commands are enabled for cluster Scenes
result = status(false, true, cmd->mfgSpecific);
break;
case ZCL_TV_CHANNEL_CLUSTER_ID:
result = emberAfTvChannelClusterServerCommandParse(cmd);
break;
Expand Down Expand Up @@ -458,6 +442,223 @@ EmberAfStatus emberAfKeypadInputClusterServerCommandParse(EmberAfClusterCommand
}
return status(wasHandled, true, cmd->mfgSpecific);
}
EmberAfStatus emberAfLevelControlClusterServerCommandParse(EmberAfClusterCommand * cmd)
{
bool wasHandled = false;

if (!cmd->mfgSpecific)
{
switch (cmd->commandId)
{
case ZCL_MOVE_COMMAND_ID: {
uint16_t payloadOffset = cmd->payloadStartIndex;
uint8_t moveMode;
uint8_t rate;
uint8_t optionMask;
uint8_t optionOverride;

if (cmd->bufLen < payloadOffset + 1)
{
return EMBER_ZCL_STATUS_MALFORMED_COMMAND;
}
moveMode = emberAfGetInt8u(cmd->buffer, payloadOffset, cmd->bufLen);
payloadOffset = static_cast<uint16_t>(payloadOffset + 1);
if (cmd->bufLen < payloadOffset + 1)
{
return EMBER_ZCL_STATUS_MALFORMED_COMMAND;
}
rate = emberAfGetInt8u(cmd->buffer, payloadOffset, cmd->bufLen);
payloadOffset = static_cast<uint16_t>(payloadOffset + 1);
if (cmd->bufLen < payloadOffset + 1)
{
return EMBER_ZCL_STATUS_MALFORMED_COMMAND;
}
optionMask = emberAfGetInt8u(cmd->buffer, payloadOffset, cmd->bufLen);
payloadOffset = static_cast<uint16_t>(payloadOffset + 1);
if (cmd->bufLen < payloadOffset + 1)
{
return EMBER_ZCL_STATUS_MALFORMED_COMMAND;
}
optionOverride = emberAfGetInt8u(cmd->buffer, payloadOffset, cmd->bufLen);

wasHandled = emberAfLevelControlClusterMoveCallback(nullptr, moveMode, rate, optionMask, optionOverride);
break;
}
case ZCL_MOVE_TO_LEVEL_COMMAND_ID: {
uint16_t payloadOffset = cmd->payloadStartIndex;
uint8_t level;
uint16_t transitionTime;
uint8_t optionMask;
uint8_t optionOverride;

if (cmd->bufLen < payloadOffset + 1)
{
return EMBER_ZCL_STATUS_MALFORMED_COMMAND;
}
level = emberAfGetInt8u(cmd->buffer, payloadOffset, cmd->bufLen);
payloadOffset = static_cast<uint16_t>(payloadOffset + 1);
if (cmd->bufLen < payloadOffset + 2)
{
return EMBER_ZCL_STATUS_MALFORMED_COMMAND;
}
transitionTime = emberAfGetInt16u(cmd->buffer, payloadOffset, cmd->bufLen);
payloadOffset = static_cast<uint16_t>(payloadOffset + 2);
if (cmd->bufLen < payloadOffset + 1)
{
return EMBER_ZCL_STATUS_MALFORMED_COMMAND;
}
optionMask = emberAfGetInt8u(cmd->buffer, payloadOffset, cmd->bufLen);
payloadOffset = static_cast<uint16_t>(payloadOffset + 1);
if (cmd->bufLen < payloadOffset + 1)
{
return EMBER_ZCL_STATUS_MALFORMED_COMMAND;
}
optionOverride = emberAfGetInt8u(cmd->buffer, payloadOffset, cmd->bufLen);

wasHandled = emberAfLevelControlClusterMoveToLevelCallback(nullptr, level, transitionTime, optionMask, optionOverride);
break;
}
case ZCL_MOVE_TO_LEVEL_WITH_ON_OFF_COMMAND_ID: {
uint16_t payloadOffset = cmd->payloadStartIndex;
uint8_t level;
uint16_t transitionTime;

if (cmd->bufLen < payloadOffset + 1)
{
return EMBER_ZCL_STATUS_MALFORMED_COMMAND;
}
level = emberAfGetInt8u(cmd->buffer, payloadOffset, cmd->bufLen);
payloadOffset = static_cast<uint16_t>(payloadOffset + 1);
if (cmd->bufLen < payloadOffset + 2)
{
return EMBER_ZCL_STATUS_MALFORMED_COMMAND;
}
transitionTime = emberAfGetInt16u(cmd->buffer, payloadOffset, cmd->bufLen);

wasHandled = emberAfLevelControlClusterMoveToLevelWithOnOffCallback(nullptr, level, transitionTime);
break;
}
case ZCL_MOVE_WITH_ON_OFF_COMMAND_ID: {
uint16_t payloadOffset = cmd->payloadStartIndex;
uint8_t moveMode;
uint8_t rate;

if (cmd->bufLen < payloadOffset + 1)
{
return EMBER_ZCL_STATUS_MALFORMED_COMMAND;
}
moveMode = emberAfGetInt8u(cmd->buffer, payloadOffset, cmd->bufLen);
payloadOffset = static_cast<uint16_t>(payloadOffset + 1);
if (cmd->bufLen < payloadOffset + 1)
{
return EMBER_ZCL_STATUS_MALFORMED_COMMAND;
}
rate = emberAfGetInt8u(cmd->buffer, payloadOffset, cmd->bufLen);

wasHandled = emberAfLevelControlClusterMoveWithOnOffCallback(nullptr, moveMode, rate);
break;
}
case ZCL_STEP_COMMAND_ID: {
uint16_t payloadOffset = cmd->payloadStartIndex;
uint8_t stepMode;
uint8_t stepSize;
uint16_t transitionTime;
uint8_t optionMask;
uint8_t optionOverride;

if (cmd->bufLen < payloadOffset + 1)
{
return EMBER_ZCL_STATUS_MALFORMED_COMMAND;
}
stepMode = emberAfGetInt8u(cmd->buffer, payloadOffset, cmd->bufLen);
payloadOffset = static_cast<uint16_t>(payloadOffset + 1);
if (cmd->bufLen < payloadOffset + 1)
{
return EMBER_ZCL_STATUS_MALFORMED_COMMAND;
}
stepSize = emberAfGetInt8u(cmd->buffer, payloadOffset, cmd->bufLen);
payloadOffset = static_cast<uint16_t>(payloadOffset + 1);
if (cmd->bufLen < payloadOffset + 2)
{
return EMBER_ZCL_STATUS_MALFORMED_COMMAND;
}
transitionTime = emberAfGetInt16u(cmd->buffer, payloadOffset, cmd->bufLen);
payloadOffset = static_cast<uint16_t>(payloadOffset + 2);
if (cmd->bufLen < payloadOffset + 1)
{
return EMBER_ZCL_STATUS_MALFORMED_COMMAND;
}
optionMask = emberAfGetInt8u(cmd->buffer, payloadOffset, cmd->bufLen);
payloadOffset = static_cast<uint16_t>(payloadOffset + 1);
if (cmd->bufLen < payloadOffset + 1)
{
return EMBER_ZCL_STATUS_MALFORMED_COMMAND;
}
optionOverride = emberAfGetInt8u(cmd->buffer, payloadOffset, cmd->bufLen);

wasHandled =
emberAfLevelControlClusterStepCallback(nullptr, stepMode, stepSize, transitionTime, optionMask, optionOverride);
break;
}
case ZCL_STEP_WITH_ON_OFF_COMMAND_ID: {
uint16_t payloadOffset = cmd->payloadStartIndex;
uint8_t stepMode;
uint8_t stepSize;
uint16_t transitionTime;

if (cmd->bufLen < payloadOffset + 1)
{
return EMBER_ZCL_STATUS_MALFORMED_COMMAND;
}
stepMode = emberAfGetInt8u(cmd->buffer, payloadOffset, cmd->bufLen);
payloadOffset = static_cast<uint16_t>(payloadOffset + 1);
if (cmd->bufLen < payloadOffset + 1)
{
return EMBER_ZCL_STATUS_MALFORMED_COMMAND;
}
stepSize = emberAfGetInt8u(cmd->buffer, payloadOffset, cmd->bufLen);
payloadOffset = static_cast<uint16_t>(payloadOffset + 1);
if (cmd->bufLen < payloadOffset + 2)
{
return EMBER_ZCL_STATUS_MALFORMED_COMMAND;
}
transitionTime = emberAfGetInt16u(cmd->buffer, payloadOffset, cmd->bufLen);

wasHandled = emberAfLevelControlClusterStepWithOnOffCallback(nullptr, stepMode, stepSize, transitionTime);
break;
}
case ZCL_STOP_COMMAND_ID: {
uint16_t payloadOffset = cmd->payloadStartIndex;
uint8_t optionMask;
uint8_t optionOverride;

if (cmd->bufLen < payloadOffset + 1)
{
return EMBER_ZCL_STATUS_MALFORMED_COMMAND;
}
optionMask = emberAfGetInt8u(cmd->buffer, payloadOffset, cmd->bufLen);
payloadOffset = static_cast<uint16_t>(payloadOffset + 1);
if (cmd->bufLen < payloadOffset + 1)
{
return EMBER_ZCL_STATUS_MALFORMED_COMMAND;
}
optionOverride = emberAfGetInt8u(cmd->buffer, payloadOffset, cmd->bufLen);

wasHandled = emberAfLevelControlClusterStopCallback(nullptr, optionMask, optionOverride);
break;
}
case ZCL_STOP_WITH_ON_OFF_COMMAND_ID: {
wasHandled = emberAfLevelControlClusterStopWithOnOffCallback(nullptr);
break;
}
default: {
// Unrecognized command ID, error status will apply.
break;
}
}
}
return status(wasHandled, true, cmd->mfgSpecific);
}
EmberAfStatus emberAfLowPowerClusterServerCommandParse(EmberAfClusterCommand * cmd)
{
bool wasHandled = false;
Expand Down
24 changes: 0 additions & 24 deletions examples/tv-app/tv-common/gen/callback-stub.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -50,12 +50,6 @@ void emberAfClusterInitCallback(EndpointId endpoint, ClusterId clusterId)
case ZCL_GENERAL_COMMISSIONING_CLUSTER_ID:
emberAfGeneralCommissioningClusterInitCallback(endpoint);
break;
case ZCL_GROUPS_CLUSTER_ID:
emberAfGroupsClusterInitCallback(endpoint);
break;
case ZCL_IDENTIFY_CLUSTER_ID:
emberAfIdentifyClusterInitCallback(endpoint);
break;
case ZCL_KEYPAD_INPUT_CLUSTER_ID:
emberAfKeypadInputClusterInitCallback(endpoint);
break;
Expand All @@ -74,9 +68,6 @@ void emberAfClusterInitCallback(EndpointId endpoint, ClusterId clusterId)
case ZCL_ON_OFF_CLUSTER_ID:
emberAfOnOffClusterInitCallback(endpoint);
break;
case ZCL_SCENES_CLUSTER_ID:
emberAfScenesClusterInitCallback(endpoint);
break;
case ZCL_TV_CHANNEL_CLUSTER_ID:
emberAfTvChannelClusterInitCallback(endpoint);
break;
Expand Down Expand Up @@ -127,16 +118,6 @@ void __attribute__((weak)) emberAfGeneralCommissioningClusterInitCallback(Endpoi
// To prevent warning
(void) endpoint;
}
void __attribute__((weak)) emberAfGroupsClusterInitCallback(EndpointId endpoint)
{
// To prevent warning
(void) endpoint;
}
void __attribute__((weak)) emberAfIdentifyClusterInitCallback(EndpointId endpoint)
{
// To prevent warning
(void) endpoint;
}
void __attribute__((weak)) emberAfKeypadInputClusterInitCallback(EndpointId endpoint)
{
// To prevent warning
Expand Down Expand Up @@ -167,11 +148,6 @@ void __attribute__((weak)) emberAfOnOffClusterInitCallback(EndpointId endpoint)
// To prevent warning
(void) endpoint;
}
void __attribute__((weak)) emberAfScenesClusterInitCallback(EndpointId endpoint)
{
// To prevent warning
(void) endpoint;
}
void __attribute__((weak)) emberAfTvChannelClusterInitCallback(EndpointId endpoint)
{
// To prevent warning
Expand Down
Loading