Skip to content

Commit

Permalink
TV Matter Media: Resolve cluster revisions (#31863)
Browse files Browse the repository at this point in the history
* Resolve the cluster revision issues

* Restyled by whitespace

* Restyled by clang-format

* Update per comments

* Restyled by whitespace

* Restyled by clang-format

* Update Content Launcher

* Restyled by whitespace

* Restyled by clang-format

---------

Co-authored-by: Restyled.io <[email protected]>
  • Loading branch information
2 people authored and pull[bot] committed Feb 29, 2024
1 parent 471c1de commit ee21781
Show file tree
Hide file tree
Showing 51 changed files with 401 additions and 96 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
*/

#include "AccountLoginManager.h"
#include <app-common/zap-generated/attributes/Accessors.h>
#include <app/CommandHandler.h>
#include <app/util/af.h>
#include <json/json.h>
Expand Down Expand Up @@ -102,3 +103,19 @@ void AccountLoginManager::GetSetupPin(char * setupPin, size_t setupPinSize, cons
}
ChipLogProgress(Zcl, "Returning pin for content app for endpoint %d", mEndpointId);
};

uint16_t AccountLoginManager::GetClusterRevision(chip::EndpointId endpoint)
{
if (endpoint >= MATTER_DM_CONTENT_LAUNCHER_CLUSTER_SERVER_ENDPOINT_COUNT)
{
return kClusterRevision;
}

uint16_t clusterRevision = 0;
bool success = (Attributes::ClusterRevision::Get(endpoint, &clusterRevision) == EMBER_ZCL_STATUS_SUCCESS);
if (!success)
{
ChipLogError(Zcl, "AccountLoginManager::GetClusterRevision error reading cluster revision");
}
return clusterRevision;
}
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ class AccountLoginManager : public AccountLoginDelegate
const CharSpan & tempAccountIdentifierString) override;
void GetSetupPin(char * setupPin, size_t setupPinSize, const CharSpan & tempAccountIdentifierString) override;
void SetEndpointId(EndpointId epId) { mEndpointId = epId; };
uint16_t GetClusterRevision(chip::EndpointId endpoint) override;

protected:
static const size_t kSetupPinSize = 12;
Expand All @@ -54,4 +55,6 @@ class AccountLoginManager : public AccountLoginDelegate
private:
ContentAppCommandDelegate * mCommandDelegate;
EndpointId mEndpointId;

static constexpr uint16_t kClusterRevision = 2;
};
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ uint32_t ContentController::GetFeatureMap(chip::EndpointId endpoint)
{
if (endpoint >= MATTER_DM_CONTENT_CONTROL_CLUSTER_SERVER_ENDPOINT_COUNT)
{
return mDynamicEndpointFeatureMap;
return kEndpointFeatureMap;
}

uint32_t featureMap = 0;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,6 @@ class ContentController : public ContentControlDelegate
protected:
private:
// TODO: set this based upon meta data from app
uint32_t mDynamicEndpointFeatureMap = 3;
static constexpr uint32_t kEndpointFeatureMap = 3;
chip::EndpointId mEndpointId;
};
Original file line number Diff line number Diff line change
Expand Up @@ -158,10 +158,26 @@ uint32_t AppContentLauncherManager::GetFeatureMap(chip::EndpointId endpoint)
{
if (endpoint >= MATTER_DM_CONTENT_LAUNCHER_CLUSTER_SERVER_ENDPOINT_COUNT)
{
return mDynamicEndpointFeatureMap;
return kEndpointFeatureMap;
}

uint32_t featureMap = 0;
Attributes::FeatureMap::Get(endpoint, &featureMap);
return featureMap;
}

uint16_t AppContentLauncherManager::GetClusterRevision(chip::EndpointId endpoint)
{
if (endpoint >= MATTER_DM_CONTENT_LAUNCHER_CLUSTER_SERVER_ENDPOINT_COUNT)
{
return kClusterRevision;
}

uint16_t clusterRevision = 0;
bool success = (Attributes::ClusterRevision::Get(endpoint, &clusterRevision) == EMBER_ZCL_STATUS_SUCCESS);
if (!success)
{
ChipLogError(Zcl, "AppContentLauncherManager::GetClusterRevision error reading cluster revision");
}
return clusterRevision;
}
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ class AppContentLauncherManager : public ContentLauncherDelegate
void SetEndpointId(EndpointId epId) { mEndpointId = epId; };

uint32_t GetFeatureMap(chip::EndpointId endpoint) override;
uint16_t GetClusterRevision(chip::EndpointId endpoint) override;

protected:
std::list<std::string> mAcceptHeaderList;
Expand All @@ -61,7 +62,7 @@ class AppContentLauncherManager : public ContentLauncherDelegate
EndpointId mEndpointId;

// TODO: set this based upon meta data from app
uint32_t mDynamicEndpointFeatureMap = 3;

static constexpr uint32_t kEndpointFeatureMap = 3;
static constexpr uint16_t kClusterRevision = 2;
ContentAppAttributeDelegate * mAttributeDelegate;
};
Original file line number Diff line number Diff line change
Expand Up @@ -276,10 +276,26 @@ uint32_t AppMediaPlaybackManager::GetFeatureMap(chip::EndpointId endpoint)
{
if (endpoint >= MATTER_DM_CONTENT_LAUNCHER_CLUSTER_SERVER_ENDPOINT_COUNT)
{
return mDynamicEndpointFeatureMap;
return kEndpointFeatureMap;
}

uint32_t featureMap = 0;
Attributes::FeatureMap::Get(endpoint, &featureMap);
return featureMap;
}

uint16_t AppMediaPlaybackManager::GetClusterRevision(chip::EndpointId endpoint)
{
if (endpoint >= MATTER_DM_CONTENT_LAUNCHER_CLUSTER_SERVER_ENDPOINT_COUNT)
{
return kClusterRevision;
}

uint16_t clusterRevision = 0;
bool success = (Attributes::ClusterRevision::Get(endpoint, &clusterRevision) == EMBER_ZCL_STATUS_SUCCESS);
if (!success)
{
ChipLogError(Zcl, "AppMediaPlaybackManager::GetClusterRevision error reading cluster revision");
}
return clusterRevision;
}
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,7 @@ class AppMediaPlaybackManager : public MediaPlaybackDelegate
bool HandleDeactivateTextTrack() override;

uint32_t GetFeatureMap(chip::EndpointId endpoint) override;
uint16_t GetClusterRevision(chip::EndpointId endpoint) override;

void SetEndpointId(EndpointId epId) { mEndpointId = epId; };

Expand All @@ -113,7 +114,8 @@ class AppMediaPlaybackManager : public MediaPlaybackDelegate
EndpointId mEndpointId;

// TODO: set this based upon meta data from app
uint32_t mDynamicEndpointFeatureMap = 3;
static constexpr uint32_t kEndpointFeatureMap = 3;
static constexpr uint16_t kClusterRevision = 2;

ContentAppAttributeDelegate * mAttributeDelegate;
};
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
*/

#include "TargetNavigatorManager.h"
#include <app-common/zap-generated/attributes/Accessors.h>
#include <json/json.h>

using namespace std;
Expand Down Expand Up @@ -144,3 +145,19 @@ void TargetNavigatorManager::HandleNavigateTarget(CommandResponseHelper<Navigate
response.status = StatusEnum::kSuccess;
helper.Success(response);
}

uint16_t TargetNavigatorManager::GetClusterRevision(chip::EndpointId endpoint)
{
if (endpoint >= MATTER_DM_CONTENT_LAUNCHER_CLUSTER_SERVER_ENDPOINT_COUNT)
{
return kClusterRevision;
}

uint16_t clusterRevision = 0;
bool success = (Attributes::ClusterRevision::Get(endpoint, &clusterRevision) == EMBER_ZCL_STATUS_SUCCESS);
if (!success)
{
ChipLogError(Zcl, "TargetNavigatorManager::GetClusterRevision error reading cluster revision");
}
return clusterRevision;
}
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ class TargetNavigatorManager : public TargetNavigatorDelegate
uint8_t HandleGetCurrentTarget() override;
void HandleNavigateTarget(CommandResponseHelper<NavigateTargetResponseType> & responser, const uint64_t & target,
const CharSpan & data) override;
uint16_t GetClusterRevision(chip::EndpointId endpoint) override;

void SetEndpointId(EndpointId epId) { mEndpointId = epId; };

Expand All @@ -51,4 +52,8 @@ class TargetNavigatorManager : public TargetNavigatorDelegate
EndpointId mEndpointId;

ContentAppAttributeDelegate * mAttributeDelegate;

private:
// TODO: set this based upon meta data from app
static constexpr uint16_t kClusterRevision = 2;
};
18 changes: 17 additions & 1 deletion examples/tv-app/android/java/ChannelManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -745,10 +745,26 @@ uint32_t ChannelManager::GetFeatureMap(chip::EndpointId endpoint)
{
if (endpoint >= MATTER_DM_CONTENT_LAUNCHER_CLUSTER_SERVER_ENDPOINT_COUNT)
{
return mDynamicEndpointFeatureMap;
return kEndpointFeatureMap;
}

uint32_t featureMap = 0;
Attributes::FeatureMap::Get(endpoint, &featureMap);
return featureMap;
}

uint16_t ChannelManager::GetClusterRevision(chip::EndpointId endpoint)
{
if (endpoint >= MATTER_DM_CONTENT_LAUNCHER_CLUSTER_SERVER_ENDPOINT_COUNT)
{
return kClusterRevision;
}

uint16_t clusterRevision = 0;
bool success = (Attributes::ClusterRevision::Get(endpoint, &clusterRevision) == EMBER_ZCL_STATUS_SUCCESS);
if (!success)
{
ChipLogError(Zcl, "ChannelManager::GetClusterRevision error reading cluster revision");
}
return clusterRevision;
}
4 changes: 3 additions & 1 deletion examples/tv-app/android/java/ChannelManager.h
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ class ChannelManager : public ChannelDelegate
const chip::ByteSpan & data) override;

uint32_t GetFeatureMap(chip::EndpointId endpoint) override;
uint16_t GetClusterRevision(chip::EndpointId endpoint) override;

private:
chip::JniGlobalReference mChannelManagerObject;
Expand All @@ -81,5 +82,6 @@ class ChannelManager : public ChannelDelegate
jmethodID mCancelRecordProgramMethod = nullptr;

// TODO: set this based upon meta data from app
uint32_t mDynamicEndpointFeatureMap = 3;
static constexpr uint32_t kEndpointFeatureMap = 3;
static constexpr uint16_t kClusterRevision = 2;
};
16 changes: 16 additions & 0 deletions examples/tv-app/android/java/ContentLauncherManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -286,3 +286,19 @@ uint32_t ContentLauncherManager::GetFeatureMap(chip::EndpointId endpoint)
Attributes::FeatureMap::Get(endpoint, &featureMap);
return featureMap;
}

uint16_t ContentLauncherManager::GetClusterRevision(chip::EndpointId endpoint)
{
if (endpoint >= MATTER_DM_CONTENT_LAUNCHER_CLUSTER_SERVER_ENDPOINT_COUNT)
{
return kClusterRevision;
}

uint16_t clusterRevision = 0;
bool success = (Attributes::ClusterRevision::Get(endpoint, &clusterRevision) == EMBER_ZCL_STATUS_SUCCESS);
if (!success)
{
ChipLogError(Zcl, "ContentLauncherManager::GetClusterRevision error reading cluster revision");
}
return clusterRevision;
}
4 changes: 4 additions & 0 deletions examples/tv-app/android/java/ContentLauncherManager.h
Original file line number Diff line number Diff line change
Expand Up @@ -49,11 +49,15 @@ class ContentLauncherManager : public ContentLauncherDelegate
uint32_t HandleGetSupportedStreamingProtocols() override;

uint32_t GetFeatureMap(chip::EndpointId endpoint) override;
uint16_t GetClusterRevision(chip::EndpointId endpoint) override;

private:
chip::JniGlobalReference mContentLauncherManagerObject;
jmethodID mGetAcceptHeaderMethod = nullptr;
jmethodID mGetSupportedStreamingProtocolsMethod = nullptr;
jmethodID mLaunchContentMethod = nullptr;
jmethodID mLaunchUrlMethod = nullptr;

// TODO: set this based upon meta data from app
static constexpr uint16_t kClusterRevision = 2;
};
2 changes: 1 addition & 1 deletion examples/tv-app/android/java/KeypadInputManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ uint32_t KeypadInputManager::GetFeatureMap(chip::EndpointId endpoint)
{
if (endpoint >= MATTER_DM_CONTENT_LAUNCHER_CLUSTER_SERVER_ENDPOINT_COUNT)
{
return mDynamicEndpointFeatureMap;
return kEndpointFeatureMap;
}

uint32_t featureMap = 0;
Expand Down
2 changes: 1 addition & 1 deletion examples/tv-app/android/java/KeypadInputManager.h
Original file line number Diff line number Diff line change
Expand Up @@ -42,5 +42,5 @@ class KeypadInputManager : public KeypadInputDelegate
jmethodID mSendKeyMethod = nullptr;

// TODO: set this based upon meta data from app
uint32_t mDynamicEndpointFeatureMap = 7;
static constexpr uint32_t kEndpointFeatureMap = 7;
};
18 changes: 17 additions & 1 deletion examples/tv-app/android/java/MediaPlaybackManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -598,10 +598,26 @@ uint32_t MediaPlaybackManager::GetFeatureMap(chip::EndpointId endpoint)
{
if (endpoint >= MATTER_DM_CONTENT_LAUNCHER_CLUSTER_SERVER_ENDPOINT_COUNT)
{
return mDynamicEndpointFeatureMap;
return kEndpointFeatureMap;
}

uint32_t featureMap = 0;
Attributes::FeatureMap::Get(endpoint, &featureMap);
return featureMap;
}

uint16_t MediaPlaybackManager::GetClusterRevision(chip::EndpointId endpoint)
{
if (endpoint >= MATTER_DM_CONTENT_LAUNCHER_CLUSTER_SERVER_ENDPOINT_COUNT)
{
return kClusterRevision;
}

uint16_t clusterRevision = 0;
bool success = (Attributes::ClusterRevision::Get(endpoint, &clusterRevision) == EMBER_ZCL_STATUS_SUCCESS);
if (!success)
{
ChipLogError(Zcl, "MediaPlaybackManager::GetClusterRevision error reading cluster revision");
}
return clusterRevision;
}
4 changes: 3 additions & 1 deletion examples/tv-app/android/java/MediaPlaybackManager.h
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,7 @@ class MediaPlaybackManager : public MediaPlaybackDelegate
bool HandleDeactivateTextTrack() override;

uint32_t GetFeatureMap(chip::EndpointId endpoint) override;
uint16_t GetClusterRevision(chip::EndpointId endpoint) override;

private:
chip::JniGlobalReference mMediaPlaybackManagerObject;
Expand All @@ -121,5 +122,6 @@ class MediaPlaybackManager : public MediaPlaybackDelegate
HandleMediaRequest(MediaPlaybackRequest mediaPlaybackRequest, uint64_t deltaPositionMilliseconds);

// TODO: set this based upon meta data from app
uint32_t mDynamicEndpointFeatureMap = 3;
static constexpr uint32_t kEndpointFeatureMap = 3;
static constexpr uint16_t kClusterRevision = 2;
};
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
*/

#include "AccountLoginManager.h"
#include <app-common/zap-generated/attributes/Accessors.h>
#include <app/CommandHandler.h>
#include <app/util/af.h>

Expand Down Expand Up @@ -64,3 +65,19 @@ void AccountLoginManager::HandleGetSetupPin(CommandResponseHelper<GetSetupPINRes
response.setupPIN = CharSpan::fromCharString(mSetupPin);
helper.Success(response);
}

uint16_t AccountLoginManager::GetClusterRevision(chip::EndpointId endpoint)
{
if (endpoint >= MATTER_DM_CONTENT_LAUNCHER_CLUSTER_SERVER_ENDPOINT_COUNT)
{
return kClusterRevision;
}

uint16_t clusterRevision = 0;
bool success = (Attributes::ClusterRevision::Get(endpoint, &clusterRevision) == EMBER_ZCL_STATUS_SUCCESS);
if (!success)
{
ChipLogError(Zcl, "AccountLoginManager::GetClusterRevision error reading cluster revision");
}
return clusterRevision;
}
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,13 @@ class AccountLoginManager : public AccountLoginDelegate
CopyString(setupPin, setupPinSize, mSetupPin);
};

uint16_t GetClusterRevision(chip::EndpointId endpoint) override;

protected:
static const size_t kSetupPinSize = 12;
char mSetupPin[kSetupPinSize];

private:
// TODO: set this based upon meta data from app
static constexpr uint16_t kClusterRevision = 2;
};
Loading

0 comments on commit ee21781

Please sign in to comment.