Skip to content

Commit

Permalink
Align naming in Channel cluster XML with the spec. (#24508)
Browse files Browse the repository at this point in the history
* Align naming in Channel cluster XML with the spec.

* Auto-update ZAP files.

* Regenerate generated code.

* Address review comment.
  • Loading branch information
bzbarsky-apple authored Jan 21, 2023
1 parent 14b538c commit 7b99e63
Show file tree
Hide file tree
Showing 42 changed files with 448 additions and 389 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3198,15 +3198,15 @@ server cluster Channel = 1284 {
kLineupInfo = 0x2;
}

struct ChannelInfo {
struct ChannelInfoStruct {
int16u majorNumber = 0;
int16u minorNumber = 1;
optional char_string<32> name = 2;
optional char_string<32> callSign = 3;
optional char_string<32> affiliateCallSign = 4;
optional char_string name = 2;
optional char_string callSign = 3;
optional char_string affiliateCallSign = 4;
}

readonly attribute ChannelInfo channelList[] = 0;
readonly attribute ChannelInfoStruct channelList[] = 0;
readonly attribute bitmap32 featureMap = 65532;
readonly attribute int16u clusterRevision = 65533;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17717,7 +17717,7 @@
"code": 1,
"mfgCode": null,
"side": "server",
"type": "LineupInfo",
"type": "LineupInfoStruct",
"included": 0,
"storageOption": "External",
"singleton": 0,
Expand All @@ -17733,7 +17733,7 @@
"code": 2,
"mfgCode": null,
"side": "server",
"type": "ChannelInfo",
"type": "ChannelInfoStruct",
"included": 0,
"storageOption": "External",
"singleton": 0,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17217,7 +17217,7 @@
"code": 1,
"mfgCode": null,
"side": "server",
"type": "LineupInfo",
"type": "LineupInfoStruct",
"included": 0,
"storageOption": "External",
"singleton": 0,
Expand All @@ -17233,7 +17233,7 @@
"code": 2,
"mfgCode": null,
"side": "server",
"type": "ChannelInfo",
"type": "ChannelInfoStruct",
"included": 0,
"storageOption": "External",
"singleton": 0,
Expand Down
4 changes: 2 additions & 2 deletions examples/thermostat/thermostat-common/thermostat.zap
Original file line number Diff line number Diff line change
Expand Up @@ -13253,7 +13253,7 @@
"code": 1,
"mfgCode": null,
"side": "server",
"type": "LineupInfo",
"type": "LineupInfoStruct",
"included": 1,
"storageOption": "RAM",
"singleton": 0,
Expand All @@ -13269,7 +13269,7 @@
"code": 2,
"mfgCode": null,
"side": "server",
"type": "ChannelInfo",
"type": "ChannelInfoStruct",
"included": 1,
"storageOption": "RAM",
"singleton": 0,
Expand Down
6 changes: 3 additions & 3 deletions examples/tv-app/android/java/ChannelManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ CHIP_ERROR ChannelManager::HandleGetChannelList(AttributeValueEncoder & aEncoder

for (jint i = 0; i < length; i++)
{
chip::app::Clusters::Channel::Structs::ChannelInfo::Type channelInfo;
chip::app::Clusters::Channel::Structs::ChannelInfoStruct::Type channelInfo;
jobject channelObject = env->GetObjectArrayElement(channelInfoList, i);
jclass channelClass = env->GetObjectClass(channelObject);

Expand Down Expand Up @@ -131,7 +131,7 @@ CHIP_ERROR ChannelManager::HandleGetChannelList(AttributeValueEncoder & aEncoder

CHIP_ERROR ChannelManager::HandleGetLineup(AttributeValueEncoder & aEncoder)
{
chip::app::Clusters::Channel::Structs::LineupInfo::Type lineupInfo;
chip::app::Clusters::Channel::Structs::LineupInfoStruct::Type lineupInfo;
CHIP_ERROR err = CHIP_NO_ERROR;
JNIEnv * env = JniReferences::GetInstance().GetEnvForCurrentThread();

Expand Down Expand Up @@ -193,7 +193,7 @@ CHIP_ERROR ChannelManager::HandleGetLineup(AttributeValueEncoder & aEncoder)

CHIP_ERROR ChannelManager::HandleGetCurrentChannel(AttributeValueEncoder & aEncoder)
{
chip::app::Clusters::Channel::Structs::ChannelInfo::Type channelInfo;
chip::app::Clusters::Channel::Structs::ChannelInfoStruct::Type channelInfo;
CHIP_ERROR err = CHIP_NO_ERROR;
JNIEnv * env = JniReferences::GetInstance().GetEnvForCurrentThread();
ChipLogProgress(Zcl, "Received ChannelManager::HandleGetCurrentChannel");
Expand Down
4 changes: 2 additions & 2 deletions examples/tv-app/linux/include/channel/ChannelManager.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@ using chip::app::AttributeValueEncoder;
using chip::app::CommandResponseHelper;
using ChannelDelegate = chip::app::Clusters::Channel::Delegate;
using ChangeChannelResponseType = chip::app::Clusters::Channel::Commands::ChangeChannelResponse::Type;
using ChannelInfoType = chip::app::Clusters::Channel::Structs::ChannelInfo::Type;
using LineupInfoType = chip::app::Clusters::Channel::Structs::LineupInfo::Type;
using ChannelInfoType = chip::app::Clusters::Channel::Structs::ChannelInfoStruct::Type;
using LineupInfoType = chip::app::Clusters::Channel::Structs::LineupInfoStruct::Type;

class ChannelManager : public ChannelDelegate
{
Expand Down
16 changes: 8 additions & 8 deletions examples/tv-app/tv-common/tv-app.matter
Original file line number Diff line number Diff line change
Expand Up @@ -1574,24 +1574,24 @@ server cluster Channel = 1284 {
kLineupInfo = 0x2;
}

struct ChannelInfo {
struct ChannelInfoStruct {
int16u majorNumber = 0;
int16u minorNumber = 1;
optional char_string<32> name = 2;
optional char_string<32> callSign = 3;
optional char_string<32> affiliateCallSign = 4;
optional char_string name = 2;
optional char_string callSign = 3;
optional char_string affiliateCallSign = 4;
}

struct LineupInfo {
struct LineupInfoStruct {
char_string operatorName = 0;
optional char_string lineupName = 1;
optional char_string postalCode = 2;
LineupInfoTypeEnum lineupInfoType = 3;
}

readonly attribute ChannelInfo channelList[] = 0;
readonly attribute nullable LineupInfo lineup = 1;
readonly attribute nullable ChannelInfo currentChannel = 2;
readonly attribute ChannelInfoStruct channelList[] = 0;
readonly attribute nullable LineupInfoStruct lineup = 1;
readonly attribute nullable ChannelInfoStruct currentChannel = 2;
readonly attribute command_id generatedCommandList[] = 65528;
readonly attribute command_id acceptedCommandList[] = 65529;
readonly attribute attrib_id attributeList[] = 65531;
Expand Down
8 changes: 4 additions & 4 deletions examples/tv-app/tv-common/tv-app.zap
Original file line number Diff line number Diff line change
Expand Up @@ -7737,7 +7737,7 @@
"code": 1,
"mfgCode": null,
"side": "server",
"type": "LineupInfo",
"type": "LineupInfoStruct",
"included": 1,
"storageOption": "External",
"singleton": 0,
Expand All @@ -7753,7 +7753,7 @@
"code": 2,
"mfgCode": null,
"side": "server",
"type": "ChannelInfo",
"type": "ChannelInfoStruct",
"included": 1,
"storageOption": "External",
"singleton": 0,
Expand Down Expand Up @@ -10811,7 +10811,7 @@
"code": 1,
"mfgCode": null,
"side": "server",
"type": "LineupInfo",
"type": "LineupInfoStruct",
"included": 0,
"storageOption": "RAM",
"singleton": 0,
Expand All @@ -10827,7 +10827,7 @@
"code": 2,
"mfgCode": null,
"side": "server",
"type": "ChannelInfo",
"type": "ChannelInfoStruct",
"included": 0,
"storageOption": "RAM",
"singleton": 0,
Expand Down
16 changes: 8 additions & 8 deletions examples/tv-casting-app/tv-casting-common/tv-casting-app.matter
Original file line number Diff line number Diff line change
Expand Up @@ -1686,24 +1686,24 @@ client cluster Channel = 1284 {
kLineupInfo = 0x2;
}

struct ChannelInfo {
struct ChannelInfoStruct {
int16u majorNumber = 0;
int16u minorNumber = 1;
optional char_string<32> name = 2;
optional char_string<32> callSign = 3;
optional char_string<32> affiliateCallSign = 4;
optional char_string name = 2;
optional char_string callSign = 3;
optional char_string affiliateCallSign = 4;
}

struct LineupInfo {
struct LineupInfoStruct {
char_string operatorName = 0;
optional char_string lineupName = 1;
optional char_string postalCode = 2;
LineupInfoTypeEnum lineupInfoType = 3;
}

readonly attribute ChannelInfo channelList[] = 0;
readonly attribute nullable LineupInfo lineup = 1;
readonly attribute nullable ChannelInfo currentChannel = 2;
readonly attribute ChannelInfoStruct channelList[] = 0;
readonly attribute nullable LineupInfoStruct lineup = 1;
readonly attribute nullable ChannelInfoStruct currentChannel = 2;
readonly attribute int16u clusterRevision = 65533;

request struct ChangeChannelRequest {
Expand Down
4 changes: 2 additions & 2 deletions examples/tv-casting-app/tv-casting-common/tv-casting-app.zap
Original file line number Diff line number Diff line change
Expand Up @@ -12409,7 +12409,7 @@
"code": 1,
"mfgCode": null,
"side": "server",
"type": "LineupInfo",
"type": "LineupInfoStruct",
"included": 1,
"storageOption": "External",
"singleton": 0,
Expand All @@ -12425,7 +12425,7 @@
"code": 2,
"mfgCode": null,
"side": "server",
"type": "ChannelInfo",
"type": "ChannelInfoStruct",
"included": 1,
"storageOption": "External",
"singleton": 0,
Expand Down
58 changes: 29 additions & 29 deletions src/app/tests/suites/TV_ChannelCluster.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -35,32 +35,32 @@ tests:
value:
[
{
majorNumber: 6,
minorNumber: 0,
name: "ABC",
callSign: "KAAL-TV",
affiliateCallSign: "KAAL",
MajorNumber: 6,
MinorNumber: 0,
Name: "ABC",
CallSign: "KAAL-TV",
AffiliateCallSign: "KAAL",
},
{
majorNumber: 9,
minorNumber: 1,
name: "PBS",
callSign: "KCTS-TV",
affiliateCallSign: "KCTS",
MajorNumber: 9,
MinorNumber: 1,
Name: "PBS",
CallSign: "KCTS-TV",
AffiliateCallSign: "KCTS",
},
{
majorNumber: 9,
minorNumber: 2,
name: "PBS Kids",
callSign: "KCTS-TV",
affiliateCallSign: "KCTS",
MajorNumber: 9,
MinorNumber: 2,
Name: "PBS Kids",
CallSign: "KCTS-TV",
AffiliateCallSign: "KCTS",
},
{
majorNumber: 9,
minorNumber: 3,
name: "World Channel",
callSign: "KCTS-TV",
affiliateCallSign: "KCTS",
MajorNumber: 9,
MinorNumber: 3,
Name: "World Channel",
CallSign: "KCTS-TV",
AffiliateCallSign: "KCTS",
},
]

Expand All @@ -70,10 +70,10 @@ tests:
response:
value:
{
operatorName: "Comcast",
lineupName: "Comcast King County",
postalCode: "98052",
lineupInfoType: 0,
OperatorName: "Comcast",
LineupName: "Comcast King County",
PostalCode: "98052",
LineupInfoType: 0,
}

- label: "Read attribute current channel"
Expand All @@ -82,11 +82,11 @@ tests:
response:
value:
{
majorNumber: 6,
minorNumber: 0,
name: "ABC",
callSign: "KAAL-TV",
affiliateCallSign: "KAAL",
MajorNumber: 6,
MinorNumber: 0,
Name: "ABC",
CallSign: "KAAL-TV",
AffiliateCallSign: "KAAL",
}

- label: "Change Channel Command"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,4 +87,4 @@ tests:
response:
value: [majorNumber: majornumber, minorNumber: minornumber + 1]
constraints:
type: ChannelInfo
type: ChannelInfoStruct
42 changes: 21 additions & 21 deletions src/app/zap-templates/zcl/data-model/chip/channel-cluster.xml
Original file line number Diff line number Diff line change
Expand Up @@ -24,54 +24,54 @@ limitations under the License.
<client init="false" tick="false">true</client>
<server init="false" tick="false">true</server>
<description>This cluster provides an interface for controlling the current Channel on a device.</description>
<attribute side="server" code="0x0000" define="CHANNEL_LIST" type="ARRAY" entryType="ChannelInfo" length="254" writable="false" optional="true">ChannelList</attribute>
<attribute side="server" code="0x0001" define="CHANNEL_LINEUP" type="LineupInfo" default="0x0" isNullable="true" writable="false" optional="true">Lineup</attribute>
<attribute side="server" code="0x0002" define="CHANNEL_CURRENT_CHANNEL" type="ChannelInfo" default="0x0" isNullable="true" writable="false" optional="true">CurrentChannel</attribute>
<attribute side="server" code="0x0000" define="CHANNEL_LIST" type="ARRAY" entryType="ChannelInfoStruct" length="254" writable="false" optional="true">ChannelList</attribute>
<attribute side="server" code="0x0001" define="CHANNEL_LINEUP" type="LineupInfoStruct" default="0x0" isNullable="true" writable="false" optional="true">Lineup</attribute>
<attribute side="server" code="0x0002" define="CHANNEL_CURRENT_CHANNEL" type="ChannelInfoStruct" default="0x0" isNullable="true" writable="false" optional="true">CurrentChannel</attribute>

<command source="client" code="0x00" name="ChangeChannel" response="ChangeChannelResponse" optional="true">
<description>Change the channel on the media player to the channel case-insensitive exact matching the value passed as an argument. </description>
<arg name="match" type="CHAR_STRING"/>
<arg name="Match" type="CHAR_STRING"/>
</command>

<command source="client" code="0x02" name="ChangeChannelByNumber" optional="false">
<description>Change the channel on the media plaeyer to the channel with the given Number in the ChannelList attribute.</description>
<arg name="majorNumber" type="INT16U"/>
<arg name="minorNumber" type="INT16U"/>
<arg name="MajorNumber" type="INT16U"/>
<arg name="MinorNumber" type="INT16U"/>
</command>

<command source="client" code="0x03" name="SkipChannel" optional="false">
<description>This command provides channel up and channel down functionality, but allows channel index jumps of size Count. When the value of the increase or decrease is larger than the number of channels remaining in the given direction, then the behavior SHALL be to return to the beginning (or end) of the channel list and continue. For example, if the current channel is at index 0 and count value of -1 is given, then the current channel should change to the last channel.</description>
<arg name="count" type="INT16U"/>
<arg name="Count" type="INT16U"/>
</command>

<command source="server" code="0x01" name="ChangeChannelResponse" optional="true">
<description>Upon receipt, this SHALL display the active status of the input list on screen.</description>
<arg name="status" type="ChannelStatusEnum"/>
<arg name="data" type="CHAR_STRING" optional="true"/>
<arg name="Status" type="ChannelStatusEnum"/>
<arg name="Data" type="CHAR_STRING" optional="true"/>
</command>

</cluster>

<struct name="ChannelInfo">
<struct name="ChannelInfoStruct">
<cluster code="0x0504"/>
<item name="majorNumber" type="INT16U"/>
<item name="minorNumber" type="INT16U"/>
<item name="name" type="CHAR_STRING" optional="true" length="32"/>
<item name="callSign" type="CHAR_STRING" optional="true" length="32"/>
<item name="affiliateCallSign" type="CHAR_STRING" optional="true" length="32"/>
<item name="MajorNumber" type="INT16U"/>
<item name="MinorNumber" type="INT16U"/>
<item name="Name" type="CHAR_STRING" optional="true"/>
<item name="CallSign" type="CHAR_STRING" optional="true"/>
<item name="AffiliateCallSign" type="CHAR_STRING" optional="true"/>
</struct>

<struct name="LineupInfo">
<struct name="LineupInfoStruct">
<cluster code="0x0504"/>
<item name="operatorName" type="CHAR_STRING"/>
<item name="lineupName" type="CHAR_STRING" default="" optional="true"/>
<item name="postalCode" type="CHAR_STRING" default="" optional="true"/>
<item name="lineupInfoType" type="LineupInfoTypeEnum"/>
<item name="OperatorName" type="CHAR_STRING"/>
<item name="LineupName" type="CHAR_STRING" default="" optional="true"/>
<item name="PostalCode" type="CHAR_STRING" default="" optional="true"/>
<item name="LineupInfoType" type="LineupInfoTypeEnum"/>
</struct>

<enum name="LineupInfoTypeEnum" type="ENUM8">
<cluster code="0x0504"/>
<item name="Mso" value="0x00"/>
<item name="MSO" value="0x00"/>
</enum>

<enum name="ChannelStatusEnum" type="ENUM8">
Expand Down
Loading

0 comments on commit 7b99e63

Please sign in to comment.