Skip to content

Commit 6fda537

Browse files
committed
[Chef] Fix basicvideoplayer device type
This was actually a squashed and rebased commit for PR project-chip#31987 since it mixed with unwanted commit from other people due to conflicts during rebasing
1 parent f216481 commit 6fda537

25 files changed

+3090
-498
lines changed

examples/chef/chef.py

+1
Original file line numberDiff line numberDiff line change
@@ -801,6 +801,7 @@ def main() -> int:
801801
'import("${chip_root}/config/standalone/args.gni")',
802802
'chip_shell_cmd_server = false',
803803
'chip_build_libshell = true',
804+
'chip_enable_openthread = false',
804805
'chip_config_network_layer_ble = false',
805806
'chip_device_project_config_include = "<CHIPProjectAppConfig.h>"',
806807
'chip_project_config_include = "<CHIPProjectAppConfig.h>"',

examples/chef/common/chef-channel-manager.cpp

-226
This file was deleted.

examples/chef/common/chef-channel-manager.h

-55
This file was deleted.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,93 @@
1+
/*
2+
*
3+
* Copyright (c) 2021 Project CHIP Authors
4+
* All rights reserved.
5+
*
6+
* Licensed under the Apache License, Version 2.0 (the "License");
7+
* you may not use this file except in compliance with the License.
8+
* You may obtain a copy of the License at
9+
*
10+
* http://www.apache.org/licenses/LICENSE-2.0
11+
*
12+
* Unless required by applicable law or agreed to in writing, software
13+
* distributed under the License is distributed on an "AS IS" BASIS,
14+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15+
* See the License for the specific language governing permissions and
16+
* limitations under the License.
17+
*/
18+
19+
#include <app/util/config.h>
20+
#ifdef MATTER_DM_PLUGIN_AUDIO_OUTPUT_SERVER
21+
#include "AudioOutputManager.h"
22+
23+
using namespace std;
24+
using namespace chip::app;
25+
using namespace chip::app::Clusters::AudioOutput;
26+
using chip::app::AttributeValueEncoder;
27+
28+
AudioOutputManager::AudioOutputManager()
29+
{
30+
const int totalOutput = 4;
31+
32+
for (uint8_t i = 1; i < totalOutput; ++i)
33+
{
34+
OutputInfoType outputInfo;
35+
outputInfo.outputType = chip::app::Clusters::AudioOutput::OutputTypeEnum::kHdmi;
36+
// note: safe only because of use of string literal
37+
outputInfo.name = chip::CharSpan::fromCharString("HDMI");
38+
outputInfo.index = static_cast<uint8_t>(i);
39+
mOutputs.push_back(outputInfo);
40+
}
41+
}
42+
43+
uint8_t AudioOutputManager::HandleGetCurrentOutput()
44+
{
45+
return mCurrentOutput;
46+
}
47+
48+
CHIP_ERROR AudioOutputManager::HandleGetOutputList(AttributeValueEncoder & aEncoder)
49+
{
50+
return aEncoder.EncodeList([this](const auto & encoder) -> CHIP_ERROR {
51+
for (auto const & outputInfo : this->mOutputs)
52+
{
53+
ReturnErrorOnFailure(encoder.Encode(outputInfo));
54+
}
55+
return CHIP_NO_ERROR;
56+
});
57+
}
58+
59+
bool AudioOutputManager::HandleRenameOutput(const uint8_t & index, const chip::CharSpan & name)
60+
{
61+
bool audioOutputRenamed = false;
62+
63+
for (OutputInfoType & output : mOutputs)
64+
{
65+
if (output.index == index)
66+
{
67+
audioOutputRenamed = true;
68+
const size_t len = std::min(mBufMax, name.size());
69+
memcpy(this->Data(index), name.data(), len);
70+
output.name = chip::CharSpan(this->Data(index), len);
71+
return audioOutputRenamed;
72+
}
73+
}
74+
75+
return audioOutputRenamed;
76+
}
77+
78+
bool AudioOutputManager::HandleSelectOutput(const uint8_t & index)
79+
{
80+
bool audioOutputSelected = false;
81+
for (OutputInfoType & output : mOutputs)
82+
{
83+
if (output.index == index)
84+
{
85+
audioOutputSelected = true;
86+
mCurrentOutput = index;
87+
return audioOutputSelected;
88+
}
89+
}
90+
91+
return audioOutputSelected;
92+
}
93+
#endif // MATTER_DM_PLUGIN_AUDIO_OUTPUT_SERVER

0 commit comments

Comments
 (0)