Skip to content

Commit

Permalink
Added Content launcher low power media playback and tvchannel cluster…
Browse files Browse the repository at this point in the history
… to java (#12250)

* added ContentLauncherManager cluster

* added LowPowerManager cluster

* added MediaPlaybackManager cluster

* added TvChannelManager cluster

* Restyled by whitespace

* Restyled by google-java-format

* Restyled by clang-format

* Restyled by gn

* fix content launcher response error

* Restyled by clang-format

* move most response code to content-launch-server as other clusters

* Restyled by clang-format

* fix linux build error

Co-authored-by: Restyled.io <[email protected]>
  • Loading branch information
2 people authored and pull[bot] committed Nov 6, 2023
1 parent 3f1ed91 commit 1080724
Show file tree
Hide file tree
Showing 35 changed files with 2,117 additions and 517 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,13 @@
import chip.setuppayload.DiscoveryCapability;
import chip.setuppayload.SetupPayload;
import chip.setuppayload.SetupPayloadParser;
import com.tcl.chip.tvapp.ContentLaunchManagerStub;
import com.tcl.chip.tvapp.KeypadInputManagerStub;
import com.tcl.chip.tvapp.LowPowerManagerStub;
import com.tcl.chip.tvapp.MediaInputManagerStub;
import com.tcl.chip.tvapp.MediaPlaybackManagerStub;
import com.tcl.chip.tvapp.TvApp;
import com.tcl.chip.tvapp.TvChannelManagerStub;
import com.tcl.chip.tvapp.WakeOnLanManagerStub;
import java.util.HashSet;

Expand All @@ -38,6 +42,10 @@ protected void onCreate(Bundle savedInstanceState) {
tvApp.setKeypadInputManager(new KeypadInputManagerStub());
tvApp.setWakeOnLanManager(new WakeOnLanManagerStub());
tvApp.setMediaInputManager(new MediaInputManagerStub());
tvApp.setContentLaunchManager(new ContentLaunchManagerStub());
tvApp.setLowPowerManager(new LowPowerManagerStub());
tvApp.setMediaPlaybackManager(new MediaPlaybackManagerStub());
tvApp.setTvChannelManager(new TvChannelManagerStub());

AndroidChipPlatform chipPlatform =
new AndroidChipPlatform(
Expand Down
29 changes: 21 additions & 8 deletions examples/tv-app/android/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -34,23 +34,23 @@ shared_library("jni") {
"include/audio-output/AudioOutputManager.h",
"include/cluster-change-attribute.cpp",
"include/cluster-init.cpp",
"include/content-launcher/ContentLauncherManager.cpp",
"include/content-launcher/ContentLauncherManager.h",
"include/endpoint-configuration/EndpointConfigurationStorage.cpp",
"include/endpoint-configuration/EndpointConfigurationStorage.h",
"include/low-power/LowPowerManager.cpp",
"include/low-power/LowPowerManager.h",
"include/media-playback/MediaPlaybackManager.cpp",
"include/media-playback/MediaPlaybackManager.h",
"include/target-navigator/TargetNavigatorManager.cpp",
"include/target-navigator/TargetNavigatorManager.h",
"include/tv-channel/TvChannelManager.cpp",
"include/tv-channel/TvChannelManager.h",
"java/ContentLauncherManager.cpp",
"java/ContentLauncherManager.h",
"java/KeypadInputManager.cpp",
"java/KeypadInputManager.h",
"java/LowPowerManager.cpp",
"java/LowPowerManager.h",
"java/MediaInputManager.cpp",
"java/MediaInputManager.h",
"java/MediaPlaybackManager.cpp",
"java/MediaPlaybackManager.h",
"java/TVApp-JNI.cpp",
"java/TvChannelManager.cpp",
"java/TvChannelManager.h",
"java/WakeOnLanManager.cpp",
"java/WakeOnLanManager.h",
]
Expand Down Expand Up @@ -83,12 +83,25 @@ android_library("java") {
]

sources = [
"java/src/com/tcl/chip/tvapp/ContentLaunchBrandingInformation.java",
"java/src/com/tcl/chip/tvapp/ContentLaunchManager.java",
"java/src/com/tcl/chip/tvapp/ContentLaunchManagerStub.java",
"java/src/com/tcl/chip/tvapp/ContentLaunchResponse.java",
"java/src/com/tcl/chip/tvapp/ContentLaunchSearchParameter.java",
"java/src/com/tcl/chip/tvapp/KeypadInputManager.java",
"java/src/com/tcl/chip/tvapp/KeypadInputManagerStub.java",
"java/src/com/tcl/chip/tvapp/LowPowerManager.java",
"java/src/com/tcl/chip/tvapp/LowPowerManagerStub.java",
"java/src/com/tcl/chip/tvapp/MediaInputInfo.java",
"java/src/com/tcl/chip/tvapp/MediaInputManager.java",
"java/src/com/tcl/chip/tvapp/MediaInputManagerStub.java",
"java/src/com/tcl/chip/tvapp/MediaPlaybackManager.java",
"java/src/com/tcl/chip/tvapp/MediaPlaybackManagerStub.java",
"java/src/com/tcl/chip/tvapp/TvApp.java",
"java/src/com/tcl/chip/tvapp/TvChannelInfo.java",
"java/src/com/tcl/chip/tvapp/TvChannelLineupInfo.java",
"java/src/com/tcl/chip/tvapp/TvChannelManager.java",
"java/src/com/tcl/chip/tvapp/TvChannelManagerStub.java",
"java/src/com/tcl/chip/tvapp/WakeOnLanManager.java",
"java/src/com/tcl/chip/tvapp/WakeOnLanManagerStub.java",
]
Expand Down
76 changes: 0 additions & 76 deletions examples/tv-app/android/include/cluster-init.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,7 @@
#include "application-basic/ApplicationBasicManager.h"
#include "application-launcher/ApplicationLauncherManager.h"
#include "audio-output/AudioOutputManager.h"
#include "content-launcher/ContentLauncherManager.h"
#include "target-navigator/TargetNavigatorManager.h"
#include "tv-channel/TvChannelManager.h"

#include <app-common/zap-generated/attribute-id.h>
#include <app-common/zap-generated/cluster-id.h>
Expand Down Expand Up @@ -80,33 +78,6 @@ void emberAfApplicationBasicClusterInitCallback(chip::EndpointId endpoint)

namespace {

TvAttrAccess<TvChannelManager, app::Clusters::TvChannel::Attributes::TvChannelList::TypeInfo,
&TvChannelManager::proxyGetTvChannelList>
gTvChannelAttrAccess;

} // anonymous namespace

/** @brief Tv Channel Cluster Init
*
* This function is called when a specific cluster is initialized. It gives the
* application an opportunity to take care of cluster initialization procedures.
* It is called exactly once for each endpoint where cluster is present.
*
* @param endpoint Ver.: always
*
*/
void emberAfTvChannelClusterInitCallback(EndpointId endpoint)
{
static bool attrAccessRegistered = false;
if (!attrAccessRegistered)
{
registerAttributeAccessOverride(&gTvChannelAttrAccess);
attrAccessRegistered = true;
}
}

namespace {

TvAttrAccess<ApplicationLauncherManager, app::Clusters::ApplicationLauncher::Attributes::ApplicationLauncherList::TypeInfo,
&ApplicationLauncherManager::proxyGetApplicationList>
gApplicationLauncherAttrAccess;
Expand Down Expand Up @@ -161,53 +132,6 @@ void emberAfAudioOutputClusterInitCallback(EndpointId endpoint)

namespace {

class ContentLauncherAttrAccess : public app::AttributeAccessInterface
{
public:
ContentLauncherAttrAccess() : app::AttributeAccessInterface(Optional<EndpointId>::Missing(), app::Clusters::ContentLauncher::Id)
{}

CHIP_ERROR Read(const app::ConcreteReadAttributePath & aPath, app::AttributeValueEncoder & aEncoder) override
{
if (aPath.mAttributeId == app::Clusters::ContentLauncher::Attributes::AcceptsHeaderList::Id)
{
return ContentLauncherManager().proxyGetAcceptsHeader(aEncoder);
}

if (aPath.mAttributeId == app::Clusters::ContentLauncher::Attributes::SupportedStreamingTypes::Id)
{
return ContentLauncherManager().proxyGetSupportedStreamingTypes(aEncoder);
}

return CHIP_NO_ERROR;
}
};

ContentLauncherAttrAccess gContentLauncherAttrAccess;

} // anonymous namespace

/** @brief Content Launch Cluster Init
*
* This function is called when a specific cluster is initialized. It gives the
* application an opportunity to take care of cluster initialization procedures.
* It is called exactly once for each endpoint where cluster is present.
*
* @param endpoint Ver.: always
*
*/
void emberAfContentLauncherClusterInitCallback(EndpointId endpoint)
{
static bool attrAccessRegistered = false;
if (!attrAccessRegistered)
{
registerAttributeAccessOverride(&gContentLauncherAttrAccess);
attrAccessRegistered = true;
}
}

namespace {

TvAttrAccess<TargetNavigatorManager, app::Clusters::TargetNavigator::Attributes::TargetNavigatorList::TypeInfo,
&TargetNavigatorManager::proxyGetTargetInfoList>
gTargetNavigatorAttrAccess;
Expand Down

This file was deleted.

This file was deleted.

25 changes: 0 additions & 25 deletions examples/tv-app/android/include/low-power/LowPowerManager.cpp

This file was deleted.

Loading

0 comments on commit 1080724

Please sign in to comment.