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

TV Matter Media: Resolve cluster revisions #31863

Merged
merged 27 commits into from
Feb 8, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
845252f
Resolve the cluster revision issues
lazarkov Feb 2, 2024
cbc3337
Restyled by whitespace
restyled-commits Feb 2, 2024
35a9212
Restyled by clang-format
restyled-commits Feb 2, 2024
06b6a3b
Update per comments
lazarkov Feb 2, 2024
b688287
Restyled by whitespace
restyled-commits Feb 2, 2024
dbf2b19
Restyled by clang-format
restyled-commits Feb 2, 2024
58a84b1
Update Content Launcher
lazarkov Feb 3, 2024
3e91897
Restyled by whitespace
restyled-commits Feb 3, 2024
18865de
Restyled by clang-format
restyled-commits Feb 3, 2024
5136269
Update Tests
lazarkov Feb 3, 2024
18744ec
Update channel tests
lazarkov Feb 5, 2024
7db1a25
Fix Content Launcher Tests
lazarkov Feb 5, 2024
ee41237
Fix endpoint 1 clusters
lazarkov Feb 5, 2024
da72496
Update per comments
lazarkov Feb 5, 2024
3e6a311
Restyled by clang-format
restyled-commits Feb 5, 2024
fc37cf2
Update per comments
lazarkov Feb 5, 2024
aaeec9a
Restyled by whitespace
restyled-commits Feb 5, 2024
fa9f83e
Remove unecessary file
lazarkov Feb 6, 2024
637bf41
Update cluster revision variable
lazarkov Feb 6, 2024
c53875d
Update example apps
lazarkov Feb 6, 2024
ff46ae8
Restyled by clang-format
restyled-commits Feb 6, 2024
34245fb
Update static variables naming and scope for consistency
lazarkov Feb 7, 2024
535bab1
Restyled by clang-format
restyled-commits Feb 7, 2024
4d66196
Update name
lazarkov Feb 7, 2024
c277cd6
Update endpoint reference count name
lazarkov Feb 7, 2024
1d58e29
Merge branch 'master' into feature/fix-cluster-revisions
lazarkov Feb 7, 2024
fd85c6b
Merge branch 'master' into feature/fix-cluster-revisions
lazarkov Feb 8, 2024
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
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
Loading