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

Update Matter TV clusters & TV app per latest spec. #12757

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
103 changes: 37 additions & 66 deletions examples/all-clusters-app/all-clusters-common/all-clusters-app.zap
Original file line number Diff line number Diff line change
Expand Up @@ -13496,7 +13496,7 @@
],
"attributes": [
{
"name": "tv channel list",
"name": "channel list",
"code": 0,
"mfgCode": null,
"side": "server",
Expand All @@ -13511,12 +13511,12 @@
"reportableChange": 0
},
{
"name": "tv channel lineup",
"name": "channel lineup",
"code": 1,
"mfgCode": null,
"side": "server",
"included": 1,
"storageOption": "RAM",
"included": 0,
"storageOption": "External",
"singleton": 0,
"bounded": 0,
"defaultValue": "",
Expand All @@ -13526,12 +13526,12 @@
"reportableChange": 0
},
{
"name": "current tv channel",
"name": "current channel",
"code": 2,
"mfgCode": null,
"side": "server",
"included": 1,
"storageOption": "RAM",
"included": 0,
"storageOption": "External",
"singleton": 0,
"bounded": 0,
"defaultValue": "",
Expand Down Expand Up @@ -13625,6 +13625,21 @@
"maxInterval": 65344,
"reportableChange": 0
},
{
"name": "current navigator target",
"code": 1,
"mfgCode": null,
"side": "server",
"included": 1,
"storageOption": "RAM",
"singleton": 0,
"bounded": 0,
"defaultValue": "0x00",
"reportable": 0,
"minInterval": 1,
"maxInterval": 65534,
"reportableChange": 0
},
{
"name": "ClusterRevision",
"code": 65533,
Expand Down Expand Up @@ -13900,28 +13915,13 @@
"maxInterval": 65534,
"reportableChange": 0
},
{
"name": "position updated at",
"code": 3,
"mfgCode": null,
"side": "server",
"included": 1,
"storageOption": "RAM",
"singleton": 0,
"bounded": 0,
"defaultValue": "",
"reportable": 1,
"minInterval": 1,
"maxInterval": 65534,
"reportableChange": 0
},
{
"name": "position",
"code": 4,
"code": 3,
"mfgCode": null,
"side": "server",
"included": 1,
"storageOption": "RAM",
"included": 0,
"storageOption": "External",
"singleton": 0,
"bounded": 0,
"defaultValue": "",
Expand All @@ -13932,7 +13932,7 @@
},
{
"name": "playback speed",
"code": 5,
"code": 4,
"mfgCode": null,
"side": "server",
"included": 1,
Expand All @@ -13947,7 +13947,7 @@
},
{
"name": "seek range end",
"code": 6,
"code": 5,
"mfgCode": null,
"side": "server",
"included": 1,
Expand All @@ -13962,7 +13962,7 @@
},
{
"name": "seek range start",
"code": 7,
"code": 6,
"mfgCode": null,
"side": "server",
"included": 1,
Expand Down Expand Up @@ -14323,7 +14323,7 @@
"reportableChange": 0
},
{
"name": "supported streaming types",
"name": "supported streaming protocols",
"code": 1,
"mfgCode": null,
"side": "server",
Expand Down Expand Up @@ -14522,27 +14522,12 @@
"reportableChange": 0
},
{
"name": "catalog vendor id",
"name": "application launcher app",
"code": 1,
"mfgCode": null,
"side": "server",
"included": 1,
"storageOption": "RAM",
"singleton": 0,
"bounded": 0,
"defaultValue": "0x00",
"reportable": 1,
"minInterval": 0,
"maxInterval": 65344,
"reportableChange": 0
},
{
"name": "application id",
"code": 2,
"mfgCode": null,
"side": "server",
"included": 1,
"storageOption": "RAM",
"included": 0,
"storageOption": "External",
"singleton": 0,
"bounded": 0,
"defaultValue": "0x00",
Expand Down Expand Up @@ -14664,7 +14649,7 @@
"reportableChange": 0
},
{
"name": "application id",
"name": "application status",
"code": 5,
"mfgCode": null,
"side": "server",
Expand All @@ -14679,7 +14664,7 @@
"reportableChange": 0
},
{
"name": "catalog vendor id",
"name": "application version",
"code": 6,
"mfgCode": null,
"side": "server",
Expand All @@ -14693,21 +14678,6 @@
"maxInterval": 65344,
"reportableChange": 0
},
{
"name": "application status",
"code": 7,
"mfgCode": null,
"side": "server",
"included": 1,
"storageOption": "RAM",
"singleton": 0,
"bounded": 0,
"defaultValue": "0x01",
"reportable": 1,
"minInterval": 0,
"maxInterval": 65344,
"reportableChange": 0
},
{
"name": "ClusterRevision",
"code": 65533,
Expand Down Expand Up @@ -19458,5 +19428,6 @@
"endpointVersion": 1,
"deviceIdentifier": 22
}
]
}
],
"log": []
}
Original file line number Diff line number Diff line change
Expand Up @@ -67,11 +67,22 @@ string AccountLoginManager::proxySetupPinRequest(string requestTempAccountIdenti
return "tempPin123";
}

bool AccountLoginManager::proxyLogout()
{
// TODO: Insert your code here to send logout request
return true;
}

bool accountLoginClusterIsUserLoggedIn(std::string requestTempAccountIdentifier, std::string requestSetupPin)
{
return AccountLoginManager().GetInstance().isUserLoggedIn(requestTempAccountIdentifier, requestSetupPin);
}

bool accountLoginClusterLogout()
{
return AccountLoginManager().GetInstance().proxyLogout();
}

std::string accountLoginClusterGetSetupPin(std::string requestTempAccountIdentifier, chip::EndpointId endpoint)
{
string responseSetupPin = AccountLoginManager().proxySetupPinRequest(requestTempAccountIdentifier, endpoint);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ class AccountLoginManager
{
public:
bool isUserLoggedIn(std::string requestTempAccountIdentifier, std::string requestSetupPin);
bool proxyLogout();
std::string proxySetupPinRequest(std::string requestTempAccountIdentifier, chip::EndpointId endpoint);
void setTempAccountIdentifierForPin(std::string requestTempAccountIdentifier, std::string requestSetupPin);

Expand Down
18 changes: 10 additions & 8 deletions examples/tv-app/android/include/application-basic/Application.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,14 @@

struct Application
{
using ApplicationBasicStatus = chip::app::Clusters::ApplicationBasic::ApplicationBasicStatus;
char vendorName[32] = "";
char name[32] = "";
char id[32] = "";
uint16_t vendorId = 0;
uint16_t productId = 0;
uint16_t catalogVendorId = 0;
ApplicationBasicStatus status = ApplicationBasicStatus::kStopped;
using ApplicationBasicStatus = chip::app::Clusters::ApplicationBasic::ApplicationBasicStatus;
char vendorName[32] = "";
char name[32] = "";
char id[32] = "";
char version[32] = "";
uint16_t vendorId = 0;
uint16_t productId = 0;
uint16_t catalogVendorId = 0;
uint16_t allowedVendorList[32] = { 123, 456 };
ApplicationBasicStatus status = ApplicationBasicStatus::kStopped;
};
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,15 @@ void ApplicationBasicManager::store(chip::EndpointId endpoint, Application * app
ChipLogError(Zcl, "Failed to store name attribute.");
}

MakeZclCharString(zclString, application->version);
EmberAfStatus versionStatus =
emberAfWriteServerAttribute(endpoint, ZCL_APPLICATION_BASIC_CLUSTER_ID, ZCL_APPLICATION_VERSION_ATTRIBUTE_ID,
lazarkov marked this conversation as resolved.
Show resolved Hide resolved
zclString.data(), ZCL_CHAR_STRING_ATTRIBUTE_TYPE);
if (versionStatus != EMBER_ZCL_STATUS_SUCCESS)
{
ChipLogError(Zcl, "Failed to store version attribute.");
}

EmberAfStatus productIdStatus =
emberAfWriteServerAttribute(endpoint, ZCL_APPLICATION_BASIC_CLUSTER_ID, ZCL_APPLICATION_PRODUCT_ID_ATTRIBUTE_ID,
(uint8_t *) &application->productId, ZCL_INT16U_ATTRIBUTE_TYPE);
Expand All @@ -82,23 +91,6 @@ void ApplicationBasicManager::store(chip::EndpointId endpoint, Application * app
ChipLogError(Zcl, "Failed to store product id attribute.");
}

MakeZclCharString(zclString, application->id);
EmberAfStatus idStatus =
emberAfWriteServerAttribute(endpoint, ZCL_APPLICATION_BASIC_CLUSTER_ID, ZCL_APPLICATION_ID_ATTRIBUTE_ID, zclString.data(),
ZCL_CHAR_STRING_ATTRIBUTE_TYPE);
if (idStatus != EMBER_ZCL_STATUS_SUCCESS)
{
ChipLogError(Zcl, "Failed to store id attribute.");
}

EmberAfStatus catalogVendorIdStatus =
emberAfWriteServerAttribute(endpoint, ZCL_APPLICATION_BASIC_CLUSTER_ID, ZCL_CATALOG_VENDOR_ID_ATTRIBUTE_ID,
(uint8_t *) &application->catalogVendorId, ZCL_INT16U_ATTRIBUTE_TYPE);
if (catalogVendorIdStatus != EMBER_ZCL_STATUS_SUCCESS)
{
ChipLogError(Zcl, "Failed to store catalog vendor id attribute.");
}

EmberAfStatus applicationStatus =
emberAfWriteServerAttribute(endpoint, ZCL_APPLICATION_BASIC_CLUSTER_ID, ZCL_APPLICATION_STATUS_ATTRIBUTE_ID,
(uint8_t *) &application->status, ZCL_ENUM8_ATTRIBUTE_TYPE);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ name=exampleName1
productId=1
id=1
catalogVendorId=1
version=exampleVersion

[endpoint4]
type=app
Expand All @@ -22,6 +23,7 @@ name=exampleName2
productId=2
id=2
catalogVendorId=2
version=exampleVersion

[endpoint5]
type=app
Expand All @@ -31,6 +33,7 @@ name=exampleName3
productId=3
id= 3
catalogVendorId=3
version=exampleVersion

[endpoint6]
type=app
Expand All @@ -39,4 +42,5 @@ vendorId=4
name=exampleName4
productId=4
id=4
catalogVendorId=4
catalogVendorId=4
version=exampleVersion
2 changes: 1 addition & 1 deletion examples/tv-app/android/java/ContentLauncherManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ class ContentLauncherAttrAccess : public app::AttributeAccessInterface
{
return ContentLauncherMgr().GetAcceptsHeader(aEncoder);
}
else if (aPath.mAttributeId == app::Clusters::ContentLauncher::Attributes::SupportedStreamingTypes::Id)
else if (aPath.mAttributeId == app::Clusters::ContentLauncher::Attributes::SupportedStreamingProtocols::Id)
{
return ContentLauncherMgr().GetSupportedStreamingTypes(aEncoder);
}
Expand Down
4 changes: 0 additions & 4 deletions examples/tv-app/android/java/MediaPlaybackManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -50,10 +50,6 @@ class MediaPlayBackAttrAccess : public app::AttributeAccessInterface
attrId = ZCL_MEDIA_PLAYBACK_DURATION_ATTRIBUTE_ID;
break;
}
case app::Clusters::MediaPlayback::Attributes::PositionUpdatedAt::Id: {
attrId = ZCL_MEDIA_PLAYBACK_PLAYBACK_POSITION_UPDATED_AT_ATTRIBUTE_ID;
break;
}
case app::Clusters::MediaPlayback::Attributes::Position::Id: {
attrId = ZCL_MEDIA_PLAYBACK_PLAYBACK_POSITION_ATTRIBUTE_ID;
break;
Expand Down
6 changes: 3 additions & 3 deletions examples/tv-app/android/java/TvChannelManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -42,15 +42,15 @@ class ChannelInfoAttrAccess : public app::AttributeAccessInterface
ChannelInfoAttrAccess() : app::AttributeAccessInterface(Optional<EndpointId>::Missing(), app::Clusters::TvChannel::Id) {}
CHIP_ERROR Read(const app::ConcreteReadAttributePath & aPath, app::AttributeValueEncoder & aEncoder) override
{
if (aPath.mAttributeId == app::Clusters::TvChannel::Attributes::TvChannelList::Id)
if (aPath.mAttributeId == app::Clusters::TvChannel::Attributes::ChannelList::Id)
{
return TvChannelMgr().getTvChannelList(aEncoder);
}
else if (aPath.mAttributeId == app::Clusters::TvChannel::Attributes::TvChannelLineup::Id)
else if (aPath.mAttributeId == app::Clusters::TvChannel::Attributes::ChannelLineup::Id)
{
return TvChannelMgr().getTvChannelLineup(aEncoder);
}
else if (aPath.mAttributeId == app::Clusters::TvChannel::Attributes::CurrentTvChannel::Id)
else if (aPath.mAttributeId == app::Clusters::TvChannel::Attributes::CurrentChannel::Id)
{
return TvChannelMgr().getCurrentTvChannel(aEncoder);
}
Expand Down
2 changes: 1 addition & 1 deletion examples/tv-app/linux/AppImpl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ DECLARE_DYNAMIC_ATTRIBUTE_LIST_END();
DECLARE_DYNAMIC_ATTRIBUTE_LIST_BEGIN(contentLauncherAttrs)
DECLARE_DYNAMIC_ATTRIBUTE(ZCL_CONTENT_LAUNCHER_ACCEPTS_HEADER_ATTRIBUTE_ID, ARRAY, kDescriptorAttributeArraySize,
0), /* accept header list */
DECLARE_DYNAMIC_ATTRIBUTE(ZCL_CONTENT_LAUNCHER_SUPPORTED_STREAMING_TYPES_ATTRIBUTE_ID, BITMAP32, 1,
DECLARE_DYNAMIC_ATTRIBUTE(ZCL_CONTENT_LAUNCHER_SUPPORTED_STREAMING_PROTOCOLS_ATTRIBUTE_ID, BITMAP32, 1,
lazarkov marked this conversation as resolved.
Show resolved Hide resolved
0), /* streaming protocols */
DECLARE_DYNAMIC_ATTRIBUTE_LIST_END();

Expand Down
Loading