Skip to content

Commit 6126c74

Browse files
committed
Refer examples/tv-app/ to build chef BasicVideoPlayer
1 parent 99d9d32 commit 6126c74

20 files changed

+1713
-287
lines changed

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,92 @@
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 EMBER_AF_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+
27+
AudioOutputManager::AudioOutputManager()
28+
{
29+
mCurrentOutput = 1;
30+
31+
for (int i = 1; i < 4; ++i)
32+
{
33+
OutputInfoType outputInfo;
34+
outputInfo.outputType = chip::app::Clusters::AudioOutput::OutputTypeEnum::kHdmi;
35+
// note: safe only because of use of string literal
36+
outputInfo.name = chip::CharSpan::fromCharString("HDMI");
37+
outputInfo.index = static_cast<uint8_t>(i);
38+
mOutputs.push_back(outputInfo);
39+
}
40+
}
41+
42+
uint8_t AudioOutputManager::HandleGetCurrentOutput()
43+
{
44+
return mCurrentOutput;
45+
}
46+
47+
CHIP_ERROR AudioOutputManager::HandleGetOutputList(AttributeValueEncoder & aEncoder)
48+
{
49+
// TODO: Insert code here
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+
// TODO: Insert code here
62+
bool audioOutputRenamed = false;
63+
64+
for (OutputInfoType & output : mOutputs)
65+
{
66+
if (output.index == index)
67+
{
68+
audioOutputRenamed = true;
69+
memcpy(this->Data(index), name.data(), name.size());
70+
output.name = chip::CharSpan(this->Data(index), name.size());
71+
}
72+
}
73+
74+
return audioOutputRenamed;
75+
}
76+
77+
bool AudioOutputManager::HandleSelectOutput(const uint8_t & index)
78+
{
79+
// TODO: Insert code here
80+
bool audioOutputSelected = false;
81+
for (OutputInfoType & output : mOutputs)
82+
{
83+
if (output.index == index)
84+
{
85+
audioOutputSelected = true;
86+
mCurrentOutput = index;
87+
}
88+
}
89+
90+
return audioOutputSelected;
91+
}
92+
#endif // EMBER_AF_PLUGIN_AUDIO_OUTPUT_SERVER

0 commit comments

Comments
 (0)