Skip to content

Commit

Permalink
Resolve the cluster revision issues
Browse files Browse the repository at this point in the history
  • Loading branch information
lazarkov committed Feb 2, 2024
1 parent 85edb01 commit 72a892f
Show file tree
Hide file tree
Showing 29 changed files with 251 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
#include "AccountLoginManager.h"
#include <app/CommandHandler.h>
#include <app/util/af.h>
#include <app-common/zap-generated/attributes/Accessors.h>
#include <json/json.h>
#include <lib/core/DataModelTypes.h>

Expand Down Expand Up @@ -102,3 +103,15 @@ 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 >= EMBER_AF_CONTENT_LAUNCHER_CLUSTER_SERVER_ENDPOINT_COUNT)
{
return mDynamicClusterRevision;
}

uint16_t clusterRevision = 0;
Attributes::ClusterRevision::Get(endpoint, &clusterRevision);
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;

uint16_t mDynamicClusterRevision = 2;
};
Original file line number Diff line number Diff line change
Expand Up @@ -283,3 +283,15 @@ uint32_t AppMediaPlaybackManager::GetFeatureMap(chip::EndpointId endpoint)
Attributes::FeatureMap::Get(endpoint, &featureMap);
return featureMap;
}

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

uint16_t clusterRevision = 0;
Attributes::ClusterRevision::Get(endpoint, &clusterRevision);
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 @@ -114,6 +115,7 @@ class AppMediaPlaybackManager : public MediaPlaybackDelegate

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

ContentAppAttributeDelegate * mAttributeDelegate;
};
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
* limitations under the License.
*/

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

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

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

uint16_t clusterRevision = 0;
Attributes::ClusterRevision::Get(endpoint, &clusterRevision);
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
uint16_t mDynamicClusterRevision = 2;
};
12 changes: 12 additions & 0 deletions examples/tv-app/android/java/ChannelManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -751,3 +751,15 @@ uint32_t ChannelManager::GetFeatureMap(chip::EndpointId endpoint)
Attributes::FeatureMap::Get(endpoint, &featureMap);
return featureMap;
}

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

uint16_t clusterRevision = 0;
Attributes::ClusterRevision::Get(endpoint, &clusterRevision);
return clusterRevision;
}
2 changes: 2 additions & 0 deletions examples/tv-app/android/java/ChannelManager.h
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,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:
jobject mChannelManagerObject = nullptr;
Expand All @@ -81,4 +82,5 @@ class ChannelManager : public ChannelDelegate

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

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

uint16_t clusterRevision = 0;
Attributes::ClusterRevision::Get(endpoint, &clusterRevision);
return clusterRevision;
}
2 changes: 2 additions & 0 deletions examples/tv-app/android/java/MediaPlaybackManager.h
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,7 @@ class MediaPlaybackManager : public MediaPlaybackDelegate
bool HandleDeactivateTextTrack() override;

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

private:
jobject mMediaPlaybackManagerObject = nullptr;
Expand All @@ -121,4 +122,5 @@ class MediaPlaybackManager : public MediaPlaybackDelegate

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

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

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

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

uint16_t clusterRevision = 0;
Attributes::ClusterRevision::Get(endpoint, &clusterRevision);
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
uint16_t mDynamicClusterRevision = 2;
};
12 changes: 12 additions & 0 deletions examples/tv-app/tv-common/clusters/channel/ChannelManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -338,3 +338,15 @@ uint32_t ChannelManager::GetFeatureMap(chip::EndpointId endpoint)
Attributes::FeatureMap::Get(endpoint, &featureMap);
return featureMap;
}

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

uint16_t clusterRevision = 0;
Attributes::ClusterRevision::Get(endpoint, &clusterRevision);
return clusterRevision;
}
2 changes: 2 additions & 0 deletions examples/tv-app/tv-common/clusters/channel/ChannelManager.h
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ class ChannelManager : public ChannelDelegate
const chip::ByteSpan & data) override;

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

protected:
uint16_t mCurrentChannelIndex;
Expand All @@ -73,4 +74,5 @@ class ChannelManager : public ChannelDelegate
private:
// TODO: set this based upon meta data from app
uint32_t mDynamicEndpointFeatureMap = 3;
uint16_t mDynamicClusterRevision = 2;
};
Original file line number Diff line number Diff line change
Expand Up @@ -326,3 +326,15 @@ uint32_t MediaPlaybackManager::GetFeatureMap(chip::EndpointId endpoint)
Attributes::FeatureMap::Get(endpoint, &featureMap);
return featureMap;
}

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

uint16_t clusterRevision = 0;
Attributes::ClusterRevision::Get(endpoint, &clusterRevision);
return clusterRevision;
}
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ class MediaPlaybackManager : public MediaPlaybackDelegate
bool HandleDeactivateTextTrack() override;

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

protected:
// NOTE: it does not make sense to have default state of playing with a speed of 0, but
Expand Down Expand Up @@ -113,4 +114,5 @@ class MediaPlaybackManager : public MediaPlaybackDelegate
private:
// TODO: set this based upon meta data from app
uint32_t mDynamicEndpointFeatureMap = 3;
uint16_t mDynamicClusterRevision = 2;
};
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>

using namespace std;
using namespace chip::app;
Expand Down Expand Up @@ -66,3 +67,16 @@ void TargetNavigatorManager::HandleNavigateTarget(CommandResponseHelper<Navigate
response.status = StatusEnum::kSuccess;
helper.Success(response);
}


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

uint16_t clusterRevision = 0;
Attributes::ClusterRevision::Get(endpoint, &clusterRevision);
return clusterRevision;
}
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,14 @@ 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;

protected:
// NOTE: the ids for each target start at 1 so that we can reserve 0 as "no current target"
static const uint8_t kNoCurrentTarget = 0;
std::list<std::string> mTargets;
uint8_t mCurrentTarget;
private:
// TODO: set this based upon meta data from app
uint16_t mDynamicClusterRevision = 2;
};
4 changes: 2 additions & 2 deletions examples/tv-app/tv-common/tv-app.matter
Original file line number Diff line number Diff line change
Expand Up @@ -3444,7 +3444,7 @@ endpoint 1 {
callback attribute lineup;
callback attribute currentChannel;
ram attribute featureMap default = 0x0003;
ram attribute clusterRevision default = 1;
ram attribute clusterRevision default = 2;

handle command ChangeChannel;
handle command ChangeChannelResponse;
Expand All @@ -3461,7 +3461,7 @@ endpoint 1 {
callback attribute targetList;
ram attribute currentTarget default = 0;
ram attribute featureMap default = 0;
ram attribute clusterRevision default = 1;
ram attribute clusterRevision default = 2;

handle command NavigateTarget;
handle command NavigateTargetResponse;
Expand Down
4 changes: 2 additions & 2 deletions examples/tv-app/tv-common/tv-app.zap
Original file line number Diff line number Diff line change
Expand Up @@ -4897,7 +4897,7 @@
"storageOption": "RAM",
"singleton": 0,
"bounded": 0,
"defaultValue": "1",
"defaultValue": "2",
"reportable": 1,
"minInterval": 0,
"maxInterval": 65344,
Expand Down Expand Up @@ -4989,7 +4989,7 @@
"storageOption": "RAM",
"singleton": 0,
"bounded": 0,
"defaultValue": "1",
"defaultValue": "2",
"reportable": 1,
"minInterval": 0,
"maxInterval": 65344,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,8 @@ class Delegate
const chip::CharSpan & tempAccountIdentifierString) = 0;
virtual void GetSetupPin(char * setupPin, size_t setupPinSize, const chip::CharSpan & tempAccountIdentifierString) = 0;

virtual uint16_t GetClusterRevision(chip::EndpointId endpoint) = 0;

virtual ~Delegate() = default;
};

Expand Down
Loading

0 comments on commit 72a892f

Please sign in to comment.