Skip to content

Commit

Permalink
Adding list attriubtes to the clusters and updating the TV example app
Browse files Browse the repository at this point in the history
Problem
We do not have list attributes enabled on app clusters.

Summary of Changes
- Updated all the app clusters where list attributes are used
- Updated the TV example app to use the new attributes

Test
- Tested locally using chip-tool client and newly created tv-server
- Used the zap_regen_all.py and gn_build.sh to verify the building is successful
  • Loading branch information
lazarkov committed May 7, 2021
1 parent b74a24b commit 5d3b94f
Show file tree
Hide file tree
Showing 51 changed files with 2,062 additions and 2,983 deletions.
14 changes: 7 additions & 7 deletions examples/all-clusters-app/all-clusters-common/gen/af-structs.h
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ typedef struct _AudioOutputInfo
{
uint8_t index;
uint8_t outputType;
uint8_t * name;
chip::ByteSpan name;
} EmberAfAudioOutputInfo;

// Struct for BasicCommissioningInfoType
Expand Down Expand Up @@ -282,8 +282,8 @@ typedef struct _MediaInputInfo
{
uint8_t index;
uint8_t inputType;
uint8_t * name;
uint8_t * description;
chip::ByteSpan name;
chip::ByteSpan description;
} EmberAfMediaInputInfo;

// Struct for MediaPlaybackPosition
Expand All @@ -297,7 +297,7 @@ typedef struct _MediaPlaybackPosition
typedef struct _NavigateTargetTargetInfo
{
uint8_t identifier;
uint8_t * name;
chip::ByteSpan name;
} EmberAfNavigateTargetTargetInfo;

// Struct for NeighborInfo
Expand Down Expand Up @@ -521,9 +521,9 @@ typedef struct _TvChannelInfo
{
uint16_t majorNumber;
uint16_t minorNumber;
uint8_t * name;
uint8_t * callSign;
uint8_t * affiliateCallSign;
chip::ByteSpan name;
chip::ByteSpan callSign;
chip::ByteSpan affiliateCallSign;
} EmberAfTvChannelInfo;

// Struct for TvChannelLineupInfo
Expand Down
14 changes: 7 additions & 7 deletions examples/bridge-app/bridge-common/gen/af-structs.h
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ typedef struct _AudioOutputInfo
{
uint8_t index;
uint8_t outputType;
uint8_t * name;
chip::ByteSpan name;
} EmberAfAudioOutputInfo;

// Struct for BasicCommissioningInfoType
Expand Down Expand Up @@ -282,8 +282,8 @@ typedef struct _MediaInputInfo
{
uint8_t index;
uint8_t inputType;
uint8_t * name;
uint8_t * description;
chip::ByteSpan name;
chip::ByteSpan description;
} EmberAfMediaInputInfo;

// Struct for MediaPlaybackPosition
Expand All @@ -297,7 +297,7 @@ typedef struct _MediaPlaybackPosition
typedef struct _NavigateTargetTargetInfo
{
uint8_t identifier;
uint8_t * name;
chip::ByteSpan name;
} EmberAfNavigateTargetTargetInfo;

// Struct for NeighborInfo
Expand Down Expand Up @@ -521,9 +521,9 @@ typedef struct _TvChannelInfo
{
uint16_t majorNumber;
uint16_t minorNumber;
uint8_t * name;
uint8_t * callSign;
uint8_t * affiliateCallSign;
chip::ByteSpan name;
chip::ByteSpan callSign;
chip::ByteSpan affiliateCallSign;
} EmberAfTvChannelInfo;

// Struct for TvChannelLineupInfo
Expand Down
141 changes: 127 additions & 14 deletions examples/chip-tool/commands/clusters/Commands.h
Original file line number Diff line number Diff line change
Expand Up @@ -660,6 +660,61 @@ static void OnTestClusterClusterTestSpecificResponse(void * context, uint8_t ret
command->SetCommandExitStatus(true);
}

static void OnApplicationLauncherApplicationLauncherListListAttributeResponse(void * context, uint16_t count, uint16_t * entries)
{
ChipLogProgress(chipTool, "OnApplicationLauncherApplicationLauncherListListAttributeResponse: %lu entries", count);

for (uint16_t i = 0; i < count; i++)
{
ChipLogProgress(chipTool, "INT16U[%lu]: %" PRIu16 "", i, entries[i]);
}

ModelCommand * command = reinterpret_cast<ModelCommand *>(context);
command->SetCommandExitStatus(true);
}

static void OnAudioOutputAudioOutputListListAttributeResponse(void * context, uint16_t count, _AudioOutputInfo * entries)
{
ChipLogProgress(chipTool, "OnAudioOutputAudioOutputListListAttributeResponse: %lu entries", count);

for (uint16_t i = 0; i < count; i++)
{
ChipLogProgress(chipTool, "AudioOutputInfo[%lu]:", i);
ChipLogProgress(chipTool, " index: %" PRIu8 "", entries[i].index);
ChipLogProgress(chipTool, " outputType: %" PRIu8 "", entries[i].outputType);
ChipLogProgress(chipTool, " name: %s", entries[i].name);
}

ModelCommand * command = reinterpret_cast<ModelCommand *>(context);
command->SetCommandExitStatus(true);
}

static void OnContentLaunchAcceptsHeaderListListAttributeResponse(void * context, uint16_t count, chip::ByteSpan * entries)
{
ChipLogProgress(chipTool, "OnContentLaunchAcceptsHeaderListListAttributeResponse: %lu entries", count);

for (uint16_t i = 0; i < count; i++)
{
ChipLogProgress(chipTool, "OCTET_STRING[%lu]: %s", i, entries[i]);
}

ModelCommand * command = reinterpret_cast<ModelCommand *>(context);
command->SetCommandExitStatus(true);
}

static void OnContentLaunchSupportedStreamingTypesListAttributeResponse(void * context, uint16_t count, uint8_t * entries)
{
ChipLogProgress(chipTool, "OnContentLaunchSupportedStreamingTypesListAttributeResponse: %lu entries", count);

for (uint16_t i = 0; i < count; i++)
{
ChipLogProgress(chipTool, "ContentLaunchStreamingType[%lu]: %" PRIu8 "", i, entries[i]);
}

ModelCommand * command = reinterpret_cast<ModelCommand *>(context);
command->SetCommandExitStatus(true);
}

static void OnDescriptorDeviceListListAttributeResponse(void * context, uint16_t count, _DeviceType * entries)
{
ChipLogProgress(chipTool, "OnDescriptorDeviceListListAttributeResponse: %lu entries", count);
Expand Down Expand Up @@ -748,6 +803,23 @@ static void OnGroupKeyManagementGroupKeysListAttributeResponse(void * context, u
command->SetCommandExitStatus(true);
}

static void OnMediaInputMediaInputListListAttributeResponse(void * context, uint16_t count, _MediaInputInfo * entries)
{
ChipLogProgress(chipTool, "OnMediaInputMediaInputListListAttributeResponse: %lu entries", count);

for (uint16_t i = 0; i < count; i++)
{
ChipLogProgress(chipTool, "MediaInputInfo[%lu]:", i);
ChipLogProgress(chipTool, " index: %" PRIu8 "", entries[i].index);
ChipLogProgress(chipTool, " inputType: %" PRIu8 "", entries[i].inputType);
ChipLogProgress(chipTool, " name: %s", entries[i].name);
ChipLogProgress(chipTool, " description: %s", entries[i].description);
}

ModelCommand * command = reinterpret_cast<ModelCommand *>(context);
command->SetCommandExitStatus(true);
}

static void OnOperationalCredentialsFabricsListListAttributeResponse(void * context, uint16_t count, _FabricDescriptor * entries)
{
ChipLogProgress(chipTool, "OnOperationalCredentialsFabricsListListAttributeResponse: %lu entries", count);
Expand All @@ -764,6 +836,40 @@ static void OnOperationalCredentialsFabricsListListAttributeResponse(void * cont
command->SetCommandExitStatus(true);
}

static void OnTvChannelTvChannelListListAttributeResponse(void * context, uint16_t count, _TvChannelInfo * entries)
{
ChipLogProgress(chipTool, "OnTvChannelTvChannelListListAttributeResponse: %lu entries", count);

for (uint16_t i = 0; i < count; i++)
{
ChipLogProgress(chipTool, "TvChannelInfo[%lu]:", i);
ChipLogProgress(chipTool, " majorNumber: %" PRIu16 "", entries[i].majorNumber);
ChipLogProgress(chipTool, " minorNumber: %" PRIu16 "", entries[i].minorNumber);
ChipLogProgress(chipTool, " name: %s", entries[i].name);
ChipLogProgress(chipTool, " callSign: %s", entries[i].callSign);
ChipLogProgress(chipTool, " affiliateCallSign: %s", entries[i].affiliateCallSign);
}

ModelCommand * command = reinterpret_cast<ModelCommand *>(context);
command->SetCommandExitStatus(true);
}

static void OnTargetNavigatorTargetNavigatorListListAttributeResponse(void * context, uint16_t count,
_NavigateTargetTargetInfo * entries)
{
ChipLogProgress(chipTool, "OnTargetNavigatorTargetNavigatorListListAttributeResponse: %lu entries", count);

for (uint16_t i = 0; i < count; i++)
{
ChipLogProgress(chipTool, "NavigateTargetTargetInfo[%lu]:", i);
ChipLogProgress(chipTool, " identifier: %" PRIu8 "", entries[i].identifier);
ChipLogProgress(chipTool, " name: %s", entries[i].name);
}

ModelCommand * command = reinterpret_cast<ModelCommand *>(context);
command->SetCommandExitStatus(true);
}

static void OnTestClusterListInt8uListAttributeResponse(void * context, uint16_t count, uint8_t * entries)
{
ChipLogProgress(chipTool, "OnTestClusterListInt8uListAttributeResponse: %lu entries", count);
Expand Down Expand Up @@ -1424,8 +1530,9 @@ class ReadApplicationLauncherApplicationLauncherList : public ModelCommand
}

private:
chip::Callback::Callback<StringAttributeCallback> * onSuccessCallback =
new chip::Callback::Callback<StringAttributeCallback>(OnStringAttributeResponse, this);
chip::Callback::Callback<ApplicationLauncherApplicationLauncherListListAttributeCallback> * onSuccessCallback =
new chip::Callback::Callback<ApplicationLauncherApplicationLauncherListListAttributeCallback>(
OnApplicationLauncherApplicationLauncherListListAttributeResponse, this);
chip::Callback::Callback<DefaultFailureCallback> * onFailureCallback =
new chip::Callback::Callback<DefaultFailureCallback>(OnDefaultFailureResponse, this);
};
Expand Down Expand Up @@ -1605,8 +1712,9 @@ class ReadAudioOutputAudioOutputList : public ModelCommand
}

private:
chip::Callback::Callback<StringAttributeCallback> * onSuccessCallback =
new chip::Callback::Callback<StringAttributeCallback>(OnStringAttributeResponse, this);
chip::Callback::Callback<AudioOutputAudioOutputListListAttributeCallback> * onSuccessCallback =
new chip::Callback::Callback<AudioOutputAudioOutputListListAttributeCallback>(
OnAudioOutputAudioOutputListListAttributeResponse, this);
chip::Callback::Callback<DefaultFailureCallback> * onFailureCallback =
new chip::Callback::Callback<DefaultFailureCallback>(OnDefaultFailureResponse, this);
};
Expand Down Expand Up @@ -6123,8 +6231,9 @@ class ReadContentLaunchAcceptsHeaderList : public ModelCommand
}

private:
chip::Callback::Callback<StringAttributeCallback> * onSuccessCallback =
new chip::Callback::Callback<StringAttributeCallback>(OnStringAttributeResponse, this);
chip::Callback::Callback<ContentLaunchAcceptsHeaderListListAttributeCallback> * onSuccessCallback =
new chip::Callback::Callback<ContentLaunchAcceptsHeaderListListAttributeCallback>(
OnContentLaunchAcceptsHeaderListListAttributeResponse, this);
chip::Callback::Callback<DefaultFailureCallback> * onFailureCallback =
new chip::Callback::Callback<DefaultFailureCallback>(OnDefaultFailureResponse, this);
};
Expand Down Expand Up @@ -6157,8 +6266,9 @@ class ReadContentLaunchSupportedStreamingTypes : public ModelCommand
}

private:
chip::Callback::Callback<StringAttributeCallback> * onSuccessCallback =
new chip::Callback::Callback<StringAttributeCallback>(OnStringAttributeResponse, this);
chip::Callback::Callback<ContentLaunchSupportedStreamingTypesListAttributeCallback> * onSuccessCallback =
new chip::Callback::Callback<ContentLaunchSupportedStreamingTypesListAttributeCallback>(
OnContentLaunchSupportedStreamingTypesListAttributeResponse, this);
chip::Callback::Callback<DefaultFailureCallback> * onFailureCallback =
new chip::Callback::Callback<DefaultFailureCallback>(OnDefaultFailureResponse, this);
};
Expand Down Expand Up @@ -9337,8 +9447,9 @@ class ReadMediaInputMediaInputList : public ModelCommand
}

private:
chip::Callback::Callback<StringAttributeCallback> * onSuccessCallback =
new chip::Callback::Callback<StringAttributeCallback>(OnStringAttributeResponse, this);
chip::Callback::Callback<MediaInputMediaInputListListAttributeCallback> * onSuccessCallback =
new chip::Callback::Callback<MediaInputMediaInputListListAttributeCallback>(OnMediaInputMediaInputListListAttributeResponse,
this);
chip::Callback::Callback<DefaultFailureCallback> * onFailureCallback =
new chip::Callback::Callback<DefaultFailureCallback>(OnDefaultFailureResponse, this);
};
Expand Down Expand Up @@ -12030,8 +12141,9 @@ class ReadTvChannelTvChannelList : public ModelCommand
}

private:
chip::Callback::Callback<StringAttributeCallback> * onSuccessCallback =
new chip::Callback::Callback<StringAttributeCallback>(OnStringAttributeResponse, this);
chip::Callback::Callback<TvChannelTvChannelListListAttributeCallback> * onSuccessCallback =
new chip::Callback::Callback<TvChannelTvChannelListListAttributeCallback>(OnTvChannelTvChannelListListAttributeResponse,
this);
chip::Callback::Callback<DefaultFailureCallback> * onFailureCallback =
new chip::Callback::Callback<DefaultFailureCallback>(OnDefaultFailureResponse, this);
};
Expand Down Expand Up @@ -12245,8 +12357,9 @@ class ReadTargetNavigatorTargetNavigatorList : public ModelCommand
}

private:
chip::Callback::Callback<StringAttributeCallback> * onSuccessCallback =
new chip::Callback::Callback<StringAttributeCallback>(OnStringAttributeResponse, this);
chip::Callback::Callback<TargetNavigatorTargetNavigatorListListAttributeCallback> * onSuccessCallback =
new chip::Callback::Callback<TargetNavigatorTargetNavigatorListListAttributeCallback>(
OnTargetNavigatorTargetNavigatorListListAttributeResponse, this);
chip::Callback::Callback<DefaultFailureCallback> * onFailureCallback =
new chip::Callback::Callback<DefaultFailureCallback>(OnDefaultFailureResponse, this);
};
Expand Down
Loading

0 comments on commit 5d3b94f

Please sign in to comment.