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

[Chef] BasicVideoPlayer: Fix MediaInput and MediaPlayback not reporting attribute changes due to using AttributeAccessInterface #35122

Merged
merged 20 commits into from
Aug 27, 2024
Merged
Changes from 1 commit
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
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
Prev Previous commit
Next Next commit
Fix type in error messages
  • Loading branch information
erwinpan1 committed Aug 27, 2024
commit a29413f250dff39ecb7aa72dd965037ff5816fa1
12 changes: 6 additions & 6 deletions examples/chef/common/clusters/media-input/MediaInputManager.cpp
Original file line number Diff line number Diff line change
@@ -29,13 +29,13 @@ using Protocols::InteractionModel::Status;

MediaInputManager::MediaInputManager(chip::EndpointId endpoint) : mEndpoint(endpoint)
{
struct InputData inputData1(1, chip::app::Clusters::MediaInput::InputTypeEnum::kHdmi, "HDMI 1",
struct InputData inputData1(1, InputTypeEnum::kHdmi, "HDMI 1",
"High-Definition Multimedia Interface");
mInputs.push_back(inputData1);
struct InputData inputData2(2, chip::app::Clusters::MediaInput::InputTypeEnum::kHdmi, "HDMI 2",
struct InputData inputData2(2, InputTypeEnum::kHdmi, "HDMI 2",
"High-Definition Multimedia Interface");
mInputs.push_back(inputData2);
struct InputData inputData3(3, chip::app::Clusters::MediaInput::InputTypeEnum::kHdmi, "HDMI 3",
struct InputData inputData3(3, InputTypeEnum::kHdmi, "HDMI 3",
"High-Definition Multimedia Interface");
mInputs.push_back(inputData3);
}
@@ -57,7 +57,7 @@ uint8_t MediaInputManager::HandleGetCurrentInput()
Status status = Attributes::CurrentInput::Get(mEndpoint, &currentInput);
if (Status::Success != status)
{
ChipLogError(Zcl, "Unable to save CurrentInput attribute, err:0x%x", to_underlying(status));
ChipLogError(Zcl, "Unable to get CurrentInput attribute, err:0x%x", to_underlying(status));
}
return currentInput;
}
@@ -74,7 +74,7 @@ bool MediaInputManager::HandleSelectInput(const uint8_t index)
if (inputData.index == index)
{
// Sync the CurrentInput to attribute storage while reporting changes
erwinpan1 marked this conversation as resolved.
Show resolved Hide resolved
Status status = chip::app::Clusters::MediaInput::Attributes::CurrentInput::Set(mEndpoint, index);
Status status = Attributes::CurrentInput::Set(mEndpoint, index);
if (Status::Success != status)
{
ChipLogError(Zcl, "CurrentInput is not stored successfully, err:0x%x", to_underlying(status));
@@ -127,6 +127,6 @@ void emberAfMediaInputClusterInitCallback(EndpointId endpoint)

gMediaInputManagerInstance[endpoint] = std::make_unique<MediaInputManager>(endpoint);

chip::app::Clusters::MediaInput::SetDefaultDelegate(endpoint, gMediaInputManagerInstance[endpoint].get());
SetDefaultDelegate(endpoint, gMediaInputManagerInstance[endpoint].get());
}
#endif // MATTER_DM_PLUGIN_MEDIA_INPUT_SERVER
Original file line number Diff line number Diff line change
@@ -40,7 +40,7 @@ PlaybackStateEnum MediaPlaybackManager::HandleGetCurrentState()
Status status = Attributes::CurrentState::Get(mEndpoint, &currentState);
if (Status::Success != status)
{
ChipLogError(Zcl, "Unable to save CurrentStage attribute, err:0x%x", to_underlying(status));
ChipLogError(Zcl, "Unable to get CurrentStage attribute, err:0x%x", to_underlying(status));
}
return currentState;
}
@@ -67,7 +67,7 @@ float MediaPlaybackManager::HandleGetPlaybackSpeed()
Status status = Attributes::PlaybackSpeed::Get(mEndpoint, &playbackSpeed);
if (Status::Success != status)
{
ChipLogError(Zcl, "Unable to save PlaybackSpeed attribute, err:0x%x", to_underlying(status));
ChipLogError(Zcl, "Unable to get PlaybackSpeed attribute, err:0x%x", to_underlying(status));
}
return playbackSpeed;
}
@@ -114,16 +114,16 @@ CHIP_ERROR MediaPlaybackManager::HandleGetAvailableTextTracks(AttributeValueEnco
});
}

CHIP_ERROR MediaPlaybackManager::HandleSetCurrentState(chip::app::Clusters::MediaPlayback::PlaybackStateEnum currentState)
CHIP_ERROR MediaPlaybackManager::HandleSetCurrentState(PlaybackStateEnum currentState)
{
Status status = Attributes::CurrentState::Set(mEndpoint, currentState);

if (Status::Success != status)
{
ChipLogError(Zcl, "Unable to save CurrentState attribute, 0x%x", to_underlying(status));
ChipLogError(Zcl, "Unable to set CurrentState attribute, 0x%x", to_underlying(status));
}

return CHIP_NO_ERROR;
return CHIP_ERROR_IM_GLOBAL_STATUS_VALUE(status);
}

CHIP_ERROR MediaPlaybackManager::HandleSetPlaybackSpeed(float playbackSpeed)
@@ -135,7 +135,7 @@ CHIP_ERROR MediaPlaybackManager::HandleSetPlaybackSpeed(float playbackSpeed)
ChipLogError(Zcl, "Unable to set PlaybackSpeed attribute, 0x%x", to_underlying(status));
}

return CHIP_NO_ERROR;
return CHIP_ERROR_IM_GLOBAL_STATUS_VALUE(status);
}

void MediaPlaybackManager::HandlePlay(CommandResponseHelper<Commands::PlaybackResponse::Type> & helper)
@@ -391,7 +391,7 @@ void emberAfMediaPlaybackClusterInitCallback(EndpointId endpoint)

gMediaPlaybackManagerInstance[endpoint] = std::make_unique<MediaPlaybackManager>(endpoint);

chip::app::Clusters::MediaPlayback::SetDefaultDelegate(endpoint, gMediaPlaybackManagerInstance[endpoint].get());
SetDefaultDelegate(endpoint, gMediaPlaybackManagerInstance[endpoint].get());
}

#endif /// MATTER_DM_PLUGIN_MEDIA_PLAYBACK_SERVER
Loading