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] Fix basicvideoplayer device type #32091

Merged
merged 16 commits into from
Feb 16, 2024
Merged
Changes from 1 commit
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
Prev Previous commit
Next Next commit
Use StringBuilder instead of std::stringstream
  • Loading branch information
erwinpan1 committed Feb 16, 2024
commit a2fa83e18ddf185a443ee0c3214c3b22493e58f7
7 changes: 3 additions & 4 deletions examples/chef/common/clusters/channel/ChannelManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -137,14 +137,13 @@ CHIP_ERROR ChannelManager::HandleGetCurrentChannel(AttributeValueEncoder & aEnco

bool ChannelManager::isChannelMatched(const ChannelInfoType & channel, const chip::CharSpan & match)
{
std::stringstream ss;
ss << channel.majorNumber << "." << channel.minorNumber;
std::string number = ss.str();
StringBuilder<16> channelNum;
channelNum.AddFormat("%d.%d", channel.majorNumber, channel.minorNumber);

auto isMatch = [&match](const Optional<chip::CharSpan> & a) { return a.HasValue() && a.Value().data_equal(match); };

return isMatch(channel.name) || isMatch(channel.affiliateCallSign) || isMatch(channel.callSign) ||
match.data_equal(chip::CharSpan::fromCharString(number.c_str()));
match.data_equal(chip::CharSpan::fromCharString(channelNum.c_str()));
}

void ChannelManager::HandleChangeChannel(CommandResponseHelper<ChangeChannelResponseType> & helper, const CharSpan & match)
Expand Down