Skip to content

Commit

Permalink
Align naming in Media Input cluster XML with the spec.
Browse files Browse the repository at this point in the history
  • Loading branch information
bzbarsky-apple committed Jan 19, 2023
1 parent ab00c53 commit 3291217
Show file tree
Hide file tree
Showing 6 changed files with 60 additions and 33 deletions.
2 changes: 1 addition & 1 deletion examples/tv-app/android/java/MediaInputManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ CHIP_ERROR MediaInputManager::HandleGetInputList(chip::app::AttributeValueEncode
jint size = env->GetArrayLength(inputArray);
for (int i = 0; i < size; i++)
{
app::Clusters::MediaInput::Structs::InputInfo::Type mediaInput;
app::Clusters::MediaInput::Structs::InputInfoStruct::Type mediaInput;

jobject inputObj = env->GetObjectArrayElement(inputArray, i);
jclass inputClass = env->GetObjectClass(inputObj);
Expand Down
4 changes: 2 additions & 2 deletions examples/tv-app/linux/include/media-input/MediaInputManager.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
#include <app/clusters/media-input-server/media-input-server.h>
#include <vector>

using InputInfoType = chip::app::Clusters::MediaInput::Structs::InputInfo::Type;
using InputInfoType = chip::app::Clusters::MediaInput::Structs::InputInfoStruct::Type;

class MediaInputManager : public chip::app::Clusters::MediaInput::Delegate
{
Expand All @@ -39,7 +39,7 @@ class MediaInputManager : public chip::app::Clusters::MediaInput::Delegate

protected:
uint8_t mCurrentInput;
std::vector<chip::app::Clusters::MediaInput::Structs::InputInfo::Type> mInputs;
std::vector<chip::app::Clusters::MediaInput::Structs::InputInfoStruct::Type> mInputs;
// Magic numbers are here on purpose, please allocate memory
char mCharDataBuffer[10][32];
};
2 changes: 1 addition & 1 deletion src/app/clusters/media-input-server/media-input-delegate.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ namespace MediaInput {
class Delegate
{
public:
// no easy way to handle the return memory of app::Clusters::MediaInput::Structs::InputInfo::Type list, so encoder is used
// no easy way to handle the return memory of app::Clusters::MediaInput::Structs::InputInfoStruct::Type list, so encoder is used
virtual CHIP_ERROR HandleGetInputList(app::AttributeValueEncoder & aEncoder) = 0;
virtual uint8_t HandleGetCurrentInput() = 0;
virtual bool HandleSelectInput(const uint8_t index) = 0;
Expand Down
32 changes: 16 additions & 16 deletions src/app/tests/suites/TV_MediaInputCluster.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -35,16 +35,16 @@ tests:
value:
[
{
index: 1,
inputType: 4,
name: "HDMI",
description: "High-Definition Multimedia Interface",
Index: 1,
InputType: 4,
Name: "HDMI",
Description: "High-Definition Multimedia Interface",
},
{
index: 2,
inputType: 4,
name: "HDMI",
description: "High-Definition Multimedia Interface",
Index: 2,
InputType: 4,
Name: "HDMI",
Description: "High-Definition Multimedia Interface",
},
]

Expand Down Expand Up @@ -83,15 +83,15 @@ tests:
value:
[
{
index: 1,
inputType: 4,
name: "HDMI Test",
description: "High-Definition Multimedia Interface",
Index: 1,
InputType: 4,
Name: "HDMI Test",
Description: "High-Definition Multimedia Interface",
},
{
index: 2,
inputType: 4,
name: "HDMI",
description: "High-Definition Multimedia Interface",
Index: 2,
InputType: 4,
Name: "HDMI",
Description: "High-Definition Multimedia Interface",
},
]
26 changes: 13 additions & 13 deletions src/app/zap-templates/zcl/data-model/chip/media-input-cluster.xml
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,12 @@ limitations under the License.
<server init="false" tick="false">true</server>
<!-- TODO: Add feature map once it is supported -->
<description>This cluster provides an interface for controlling the Input Selector on a media device such as a TV.</description>
<attribute side="server" code="0x0000" define="MEDIA_INPUT_LIST" type="ARRAY" entryType="InputInfo" length="254" writable="false" optional="false">InputList</attribute>
<attribute side="server" code="0x0001" define="MEDIA_INPUT_CURRENT_INPUT" type="INT8U" default="0x00" min="0x00" max="0xFF" writable="false" optional="true">CurrentInput</attribute>
<attribute side="server" code="0x0000" define="MEDIA_INPUT_LIST" type="ARRAY" entryType="InputInfoStruct" length="254" writable="false" optional="false">InputList</attribute>
<attribute side="server" code="0x0001" define="MEDIA_INPUT_CURRENT_INPUT" type="INT8U" default="0x00" min="0x00" max="0xFF" writable="false" optional="false">CurrentInput</attribute>

<command source="client" code="0x00" name="SelectInput" optional="false">
<description>Upon receipt, this SHALL change the input on the media device to the input at a specific index in the Input List.</description>
<arg name="index" type="INT8U"/>
<arg name="Index" type="INT8U"/>
</command>

<command source="client" code="0x01" name="ShowInputStatus" optional="false">
Expand All @@ -43,18 +43,18 @@ limitations under the License.

<command source="client" code="0x03" name="RenameInput" optional="true">
<description>Upon receipt, this SHALL rename the input at a specific index in the Input List. Updates to the input name SHALL appear in the TV settings menus. </description>
<arg name="index" type="INT8U"/>
<arg name="name" type="CHAR_STRING"/>
<arg name="Index" type="INT8U"/>
<arg name="Name" type="CHAR_STRING"/>
</command>

</cluster>

<struct name="InputInfo">
<struct name="InputInfoStruct">
<cluster code="0x0507"/>
<item name="index" type="INT8U"/>
<item name="inputType" type="InputTypeEnum"/>
<item name="name" type="CHAR_STRING" length="32"/>
<item name="description" type="CHAR_STRING" length="32"/>
<item name="Index" type="INT8U"/>
<item name="InputType" type="InputTypeEnum"/>
<item name="Name" type="CHAR_STRING" length="32"/>
<item name="Description" type="CHAR_STRING" length="32"/>
</struct>

<enum name="InputTypeEnum" type="ENUM8">
Expand All @@ -63,13 +63,13 @@ limitations under the License.
<item name="Aux" value="0x01"/>
<item name="Coax" value="0x02"/>
<item name="Composite" value="0x03"/>
<item name="Hdmi" value="0x04"/>
<item name="HDMI" value="0x04"/>
<item name="Input" value="0x05"/>
<item name="Line" value="0x06"/>
<item name="Optical" value="0x07"/>
<item name="Video" value="0x08"/>
<item name="Scart" value="0x09"/>
<item name="Usb" value="0x0A"/>
<item name="SCART" value="0x09"/>
<item name="USB" value="0x0A"/>
<item name="Other" value="0x0B"/>
</enum>

Expand Down
27 changes: 27 additions & 0 deletions src/darwin/Framework/CHIP/templates/availability.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5037,6 +5037,8 @@
- FabricDescriptorStruct
DoorLock:
- CredentialStruct
MediaInput:
- InputInfoStruct
struct fields:
UnitTesting:
SimpleStruct:
Expand Down Expand Up @@ -5152,6 +5154,12 @@
CredentialStruct:
- credentialType
- credentialIndex
MediaInput:
InputInfoStruct:
- index
- inputType
- name
- descriptionString
events:
OTASoftwareUpdateRequestor:
- StateTransition
Expand Down Expand Up @@ -5466,6 +5474,11 @@
- ExpiringUser
- ScheduleRestrictedUser
- RemoteOnlyUser
MediaInput:
InputTypeEnum:
- HDMI
- SCART
- USB
bitmaps:
UnitTesting:
- Bitmap8MaskMap
Expand Down Expand Up @@ -5613,6 +5626,8 @@
- FabricDescriptor
DoorLock:
- DlCredential
MediaInput:
- InputInfo
struct fields:
Descriptor:
DeviceTypeStruct:
Expand Down Expand Up @@ -5689,6 +5704,11 @@
- NotSupported
- Unrestricted
- MasterUser
MediaInput:
InputTypeEnum:
- Hdmi
- Scart
- Usb
bitmaps:
DoorLock:
- DlDaysMaskMap
Expand Down Expand Up @@ -5859,6 +5879,8 @@
FabricDescriptorStruct: FabricDescriptor
DoorLock:
CredentialStruct: DlCredential
MediaInput:
InputInfoStruct: InputInfo
struct fields:
Descriptor:
DeviceTypeStruct:
Expand Down Expand Up @@ -5948,6 +5970,11 @@
UserTypeEnum:
UnrestrictedUser: Unrestricted
ProgrammingUser: MasterUser
MediaInput:
InputTypeEnum:
HDMI: Hdmi
SCART: Scart
USB: Usb
bitmaps:
DoorLock:
DaysMaskMap: DlDaysMaskMap
Expand Down

0 comments on commit 3291217

Please sign in to comment.