Skip to content

Commit

Permalink
Update TV SDK, minor changes, mostly syncing the xml files per spec. (p…
Browse files Browse the repository at this point in the history
…roject-chip#14910)

* Update zap templates

* Run zap regen script

* Update code

* Run zap regen script, again

* Restyle fix
  • Loading branch information
lazarkov authored Feb 9, 2022
1 parent 052ce8d commit f87b32d
Show file tree
Hide file tree
Showing 58 changed files with 2,669 additions and 1,515 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -380,9 +380,9 @@ server cluster Channel = 1284 {
struct ChannelInfo {
INT16U majorNumber = 0;
INT16U minorNumber = 1;
CHAR_STRING<32> name = 2;
CHAR_STRING<32> callSign = 3;
CHAR_STRING<32> affiliateCallSign = 4;
optional CHAR_STRING<32> name = 2;
optional CHAR_STRING<32> callSign = 3;
optional CHAR_STRING<32> affiliateCallSign = 4;
}

readonly attribute ChannelInfo channelList[] = 0;
Expand Down Expand Up @@ -719,7 +719,7 @@ server cluster ContentLauncher = 1290 {
struct Parameter {
ParameterEnum type = 0;
CHAR_STRING value = 1;
AdditionalInfo externalIDList[] = 2;
optional AdditionalInfo externalIDList[] = 2;
}

struct AdditionalInfo {
Expand All @@ -729,17 +729,17 @@ server cluster ContentLauncher = 1290 {

struct BrandingInformation {
CHAR_STRING providerName = 0;
StyleInformation background = 1;
StyleInformation logo = 2;
StyleInformation progressBar = 3;
StyleInformation splash = 4;
StyleInformation waterMark = 5;
optional StyleInformation background = 1;
optional StyleInformation logo = 2;
optional StyleInformation progressBar = 3;
optional StyleInformation splash = 4;
optional StyleInformation waterMark = 5;
}

struct StyleInformation {
CHAR_STRING imageUrl = 0;
CHAR_STRING color = 1;
Dimension size = 2;
optional CHAR_STRING imageUrl = 0;
optional CHAR_STRING color = 1;
optional Dimension size = 2;
}

struct Dimension {
Expand Down Expand Up @@ -1985,11 +1985,11 @@ server cluster MediaPlayback = 1286 {
}

readonly attribute PlaybackStateEnum playbackState = 0;
readonly attribute epoch_us startTime = 1;
readonly attribute int64u duration = 2;
readonly attribute nullable epoch_us startTime = 1;
readonly attribute nullable int64u duration = 2;
readonly attribute single playbackSpeed = 4;
readonly attribute int64u seekRangeEnd = 5;
readonly attribute int64u seekRangeStart = 6;
readonly attribute nullable int64u seekRangeEnd = 5;
readonly attribute nullable int64u seekRangeStart = 6;
readonly global attribute int16u clusterRevision = 65533;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ void TargetNavigatorManager::HandleNavigateTarget(CommandResponseHelper<Navigate
{
// TODO: Insert code here
Commands::NavigateTargetResponse::Type response;
response.data = chip::CharSpan::fromCharString("data response");
response.data = chip::Optional<CharSpan>(chip::CharSpan::fromCharString("data response"));
response.status = chip::app::Clusters::TargetNavigator::StatusEnum::kSuccess;
helper.Success(response);
}
22 changes: 11 additions & 11 deletions examples/tv-app/android/java/ChannelManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -84,23 +84,23 @@ CHIP_ERROR ChannelManager::HandleGetChannelList(AttributeValueEncoder & aEncoder
if (jcallSign != NULL)
{
JniUtfString callsign(env, jcallSign);
channelInfo.callSign = callsign.charSpan();
channelInfo.callSign = Optional<CharSpan>(callsign.charSpan());
}

jfieldID getNameField = env->GetFieldID(channelClass, "name", "Ljava/lang/String;");
jstring jname = static_cast<jstring>(env->GetObjectField(channelObject, getNameField));
if (jname != NULL)
{
JniUtfString name(env, jname);
channelInfo.name = name.charSpan();
channelInfo.name = Optional<CharSpan>(name.charSpan());
}

jfieldID getJaffiliateCallSignField = env->GetFieldID(channelClass, "affiliateCallSign", "Ljava/lang/String;");
jstring jaffiliateCallSign = static_cast<jstring>(env->GetObjectField(channelObject, getJaffiliateCallSignField));
if (jaffiliateCallSign != NULL)
{
JniUtfString affiliateCallSign(env, jaffiliateCallSign);
channelInfo.affiliateCallSign = affiliateCallSign.charSpan();
channelInfo.affiliateCallSign = Optional<CharSpan>(affiliateCallSign.charSpan());
}

jfieldID majorNumField = env->GetFieldID(channelClass, "majorNumber", "I");
Expand Down Expand Up @@ -154,15 +154,15 @@ CHIP_ERROR ChannelManager::HandleGetLineup(AttributeValueEncoder & aEncoder)
if (jlineupName != NULL)
{
JniUtfString lineupName(env, jlineupName);
lineupInfo.lineupName = lineupName.charSpan();
lineupInfo.lineupName = Optional<CharSpan>(lineupName.charSpan());
}

jfieldID postalCodeFild = env->GetFieldID(channelLineupClazz, "postalCode", "Ljava/lang/String;");
jstring jpostalCode = static_cast<jstring>(env->GetObjectField(channelLineupObject, postalCodeFild));
if (jpostalCode != NULL)
{
JniUtfString postalCode(env, jpostalCode);
lineupInfo.postalCode = postalCode.charSpan();
lineupInfo.postalCode = Optional<CharSpan>(postalCode.charSpan());
}

jfieldID lineupInfoTypeFild = env->GetFieldID(channelLineupClazz, "lineupInfoTypeEnum", "I");
Expand Down Expand Up @@ -200,23 +200,23 @@ CHIP_ERROR ChannelManager::HandleGetCurrentChannel(AttributeValueEncoder & aEnco
if (jcallSign != NULL)
{
JniUtfString callsign(env, jcallSign);
channelInfo.callSign = callsign.charSpan();
channelInfo.callSign = Optional<CharSpan>(callsign.charSpan());
}

jfieldID getNameField = env->GetFieldID(channelClass, "name", "Ljava/lang/String;");
jstring jname = static_cast<jstring>(env->GetObjectField(channelInfoObject, getNameField));
if (jname != NULL)
{
JniUtfString name(env, jname);
channelInfo.name = name.charSpan();
channelInfo.name = Optional<CharSpan>(name.charSpan());
}

jfieldID getJaffiliateCallSignField = env->GetFieldID(channelClass, "affiliateCallSign", "Ljava/lang/String;");
jstring jaffiliateCallSign = static_cast<jstring>(env->GetObjectField(channelInfoObject, getJaffiliateCallSignField));
if (jaffiliateCallSign != NULL)
{
JniUtfString affiliateCallSign(env, jaffiliateCallSign);
channelInfo.affiliateCallSign = affiliateCallSign.charSpan();
channelInfo.affiliateCallSign = Optional<CharSpan>(affiliateCallSign.charSpan());
}

jfieldID majorNumField = env->GetFieldID(channelClass, "majorNumber", "I");
Expand Down Expand Up @@ -276,22 +276,22 @@ void ChannelManager::HandleChangeChannel(CommandResponseHelper<ChangeChannelResp
if (jcallSign != NULL)
{
JniUtfString callsign(env, jcallSign);
response.channelMatch.callSign = callsign.charSpan();
response.channelMatch.callSign = Optional<CharSpan>(callsign.charSpan());
}

jfieldID getNameField = env->GetFieldID(channelClass, "name", "Ljava/lang/String;");
jstring jname = static_cast<jstring>(env->GetObjectField(channelObject, getNameField));
if (jname != NULL)
{
JniUtfString junitname(env, jname);
response.channelMatch.name = junitname.charSpan();
response.channelMatch.name = Optional<CharSpan>(junitname.charSpan());
}
jfieldID getJaffiliateCallSignField = env->GetFieldID(channelClass, "affiliateCallSign", "Ljava/lang/String;");
jstring jaffiliateCallSign = static_cast<jstring>(env->GetObjectField(channelObject, getJaffiliateCallSignField));
if (jaffiliateCallSign != NULL)
{
JniUtfString affiliateCallSign(env, jaffiliateCallSign);
response.channelMatch.affiliateCallSign = affiliateCallSign.charSpan();
response.channelMatch.affiliateCallSign = Optional<CharSpan>(affiliateCallSign.charSpan());
}

jfieldID majorNumField = env->GetFieldID(channelClass, "majorNumber", "I");
Expand Down
4 changes: 2 additions & 2 deletions examples/tv-app/android/java/ContentLauncherManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ void ContentLauncherManager::HandleLaunchContent(CommandResponseHelper<LaunchRes
JniUtfString dataStr(env, jdataStr);

response.status = static_cast<chip::app::Clusters::ContentLauncher::StatusEnum>(status);
response.data = dataStr.charSpan();
response.data = chip::Optional<CharSpan>(dataStr.charSpan());

err = helper.Success(response);
}
Expand Down Expand Up @@ -140,7 +140,7 @@ void ContentLauncherManager::HandleLaunchUrl(CommandResponseHelper<LaunchRespons
JniUtfString dataStr(env, jdataStr);

response.status = static_cast<chip::app::Clusters::ContentLauncher::StatusEnum>(status);
response.data = dataStr.charSpan();
response.data = chip::Optional<CharSpan>(dataStr.charSpan());

err = helper.Success(response);
}
Expand Down
5 changes: 3 additions & 2 deletions examples/tv-app/android/java/MediaPlaybackManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@

using namespace chip;
using namespace chip::app;
using namespace chip::app::DataModel;
using namespace chip::app::Clusters::MediaPlayback;

/** @brief Media PlayBack Cluster Init
Expand Down Expand Up @@ -258,7 +259,7 @@ CHIP_ERROR MediaPlaybackManager::HandleGetSampledPosition(AttributeValueEncoder
{
Structs::PlaybackPosition::Type response;
response.updatedAt = 0;
response.position = 0;
response.position = Nullable<uint64_t>(0);

jobject positionObj;
CHIP_ERROR err = CHIP_NO_ERROR;
Expand All @@ -283,7 +284,7 @@ CHIP_ERROR MediaPlaybackManager::HandleGetSampledPosition(AttributeValueEncoder
jclass inputClass = env->GetObjectClass(positionObj);
jfieldID positionId = env->GetFieldID(inputClass, "position", "J");
jfieldID updatedAtId = env->GetFieldID(inputClass, "updatedAt", "J");
response.position = static_cast<uint64_t>(env->GetIntField(positionObj, positionId));
response.position = Nullable<uint64_t>(static_cast<uint64_t>(env->GetIntField(positionObj, positionId)));
response.updatedAt = static_cast<uint64_t>(env->GetIntField(positionObj, updatedAtId));
}

Expand Down
22 changes: 11 additions & 11 deletions examples/tv-app/linux/include/channel/ChannelManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,9 @@ CHIP_ERROR ChannelManager::HandleGetChannelList(AttributeValueEncoder & aEncoder
for (int i = 0; i < maximumVectorSize; ++i)
{
chip::app::Clusters::Channel::Structs::ChannelInfo::Type channelInfo;
channelInfo.affiliateCallSign = chip::CharSpan::fromCharString("exampleASign");
channelInfo.callSign = chip::CharSpan::fromCharString("exampleCSign");
channelInfo.name = chip::CharSpan::fromCharString("exampleName");
channelInfo.affiliateCallSign = Optional<CharSpan>(chip::CharSpan::fromCharString("exampleASign"));
channelInfo.callSign = Optional<CharSpan>(chip::CharSpan::fromCharString("exampleCSign"));
channelInfo.name = Optional<CharSpan>(chip::CharSpan::fromCharString("exampleName"));
channelInfo.majorNumber = static_cast<uint8_t>(1 + i);
channelInfo.minorNumber = static_cast<uint16_t>(2 + i);

Expand All @@ -47,8 +47,8 @@ CHIP_ERROR ChannelManager::HandleGetLineup(AttributeValueEncoder & aEncoder)
{
chip::app::Clusters::Channel::Structs::LineupInfo::Type lineup;
lineup.operatorName = chip::CharSpan::fromCharString("operatorName");
lineup.lineupName = chip::CharSpan::fromCharString("lineupName");
lineup.postalCode = chip::CharSpan::fromCharString("postalCode");
lineup.lineupName = Optional<CharSpan>(chip::CharSpan::fromCharString("lineupName"));
lineup.postalCode = Optional<CharSpan>(chip::CharSpan::fromCharString("postalCode"));
lineup.lineupInfoType = chip::app::Clusters::Channel::LineupInfoTypeEnum::kMso;

return aEncoder.Encode(lineup);
Expand All @@ -57,9 +57,9 @@ CHIP_ERROR ChannelManager::HandleGetLineup(AttributeValueEncoder & aEncoder)
CHIP_ERROR ChannelManager::HandleGetCurrentChannel(AttributeValueEncoder & aEncoder)
{
chip::app::Clusters::Channel::Structs::ChannelInfo::Type currentChannel;
currentChannel.affiliateCallSign = chip::CharSpan::fromCharString("exampleASign");
currentChannel.callSign = chip::CharSpan::fromCharString("exampleCSign");
currentChannel.name = chip::CharSpan::fromCharString("exampleName");
currentChannel.affiliateCallSign = Optional<CharSpan>(chip::CharSpan::fromCharString("exampleASign"));
currentChannel.callSign = Optional<CharSpan>(chip::CharSpan::fromCharString("exampleCSign"));
currentChannel.name = Optional<CharSpan>(chip::CharSpan::fromCharString("exampleName"));
currentChannel.majorNumber = 1;
currentChannel.minorNumber = 0;

Expand All @@ -71,9 +71,9 @@ void ChannelManager::HandleChangeChannel(CommandResponseHelper<ChangeChannelResp
ChangeChannelResponseType response;
response.channelMatch.majorNumber = 1;
response.channelMatch.minorNumber = 0;
response.channelMatch.name = chip::CharSpan::fromCharString("name");
response.channelMatch.callSign = chip::CharSpan::fromCharString("callSign");
response.channelMatch.affiliateCallSign = chip::CharSpan::fromCharString("affiliateCallSign");
response.channelMatch.name = Optional<CharSpan>(chip::CharSpan::fromCharString("name"));
response.channelMatch.callSign = Optional<CharSpan>(chip::CharSpan::fromCharString("callSign"));
response.channelMatch.affiliateCallSign = Optional<CharSpan>(chip::CharSpan::fromCharString("affiliateCallSign"));
response.errorType = chip::app::Clusters::Channel::ErrorTypeEnum::kMultipleMatches;

helper.Success(response);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ void ContentLauncherManager::HandleLaunchContent(CommandResponseHelper<LaunchRes

LaunchResponseType response;
// TODO: Insert code here
response.data = CharSpan::fromCharString("exampleData");
response.data = chip::Optional<CharSpan>(CharSpan::fromCharString("exampleData"));
response.status = ContentLauncher::StatusEnum::kSuccess;
helper.Success(response);
}
Expand All @@ -52,7 +52,7 @@ void ContentLauncherManager::HandleLaunchUrl(CommandResponseHelper<LaunchRespons

// TODO: Insert code here
LaunchResponseType response;
response.data = CharSpan::fromCharString("exampleData");
response.data = chip::Optional<CharSpan>(CharSpan::fromCharString("exampleData"));
response.status = ContentLauncher::StatusEnum::kSuccess;
helper.Success(response);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
#include "MediaPlaybackManager.h"

using namespace std;
using namespace chip::app::DataModel;
using namespace chip::app::Clusters::MediaPlayback;

PlaybackStateEnum MediaPlaybackManager::HandleGetCurrentState()
Expand All @@ -39,7 +40,7 @@ CHIP_ERROR MediaPlaybackManager::HandleGetSampledPosition(AttributeValueEncoder
{
Structs::PlaybackPosition::Type sampledPosition;
sampledPosition.updatedAt = 0;
sampledPosition.position = 0;
sampledPosition.position = Nullable<uint64_t>(0);

return aEncoder.Encode(sampledPosition);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,14 +55,14 @@ void TargetNavigatorManager::HandleNavigateTarget(CommandResponseHelper<Navigate
NavigateTargetResponseType response;
if (target == kNoCurrentTarget || target > mTargets.size())
{
response.data = CharSpan::fromCharString("error");
response.data = chip::Optional<CharSpan>(CharSpan::fromCharString("error"));
response.status = StatusEnum::kTargetNotFound;
helper.Success(response);
return;
}
mCurrentTarget = static_cast<uint8_t>(target);

response.data = CharSpan::fromCharString("data response");
response.data = chip::Optional<CharSpan>(CharSpan::fromCharString("data response"));
response.status = StatusEnum::kSuccess;
helper.Success(response);
}
Loading

0 comments on commit f87b32d

Please sign in to comment.