Skip to content

Commit

Permalink
Resolve comments
Browse files Browse the repository at this point in the history
  • Loading branch information
kghost committed Jun 4, 2021
1 parent 2a03c8d commit f586231
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 20 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -169,21 +169,21 @@ bool emberAfMediaPlaybackClusterMediaRewindCallback(chip::app::Command *)
return true;
}

bool emberAfMediaPlaybackClusterMediaSkipBackwardCallback(chip::app::Command *, unsigned long long deltaPositionMilliseconds)
bool emberAfMediaPlaybackClusterMediaSkipBackwardCallback(chip::app::Command *, uint64_t deltaPositionMilliseconds)
{
EmberAfMediaPlaybackStatus status = MediaPlaybackManager().proxyMediaPlaybackRequest(MediaPlaybackRequest::SkipBackward);
sendResponse("MediaSkipBackward", ZCL_MEDIA_SKIP_BACKWARD_RESPONSE_COMMAND_ID, status);
return true;
}

bool emberAfMediaPlaybackClusterMediaSkipForwardCallback(chip::app::Command *, unsigned long long deltaPositionMilliseconds)
bool emberAfMediaPlaybackClusterMediaSkipForwardCallback(chip::app::Command *, uint64_t deltaPositionMilliseconds)
{
EmberAfMediaPlaybackStatus status = MediaPlaybackManager().proxyMediaPlaybackRequest(MediaPlaybackRequest::SkipForward);
sendResponse("MediaSkipForward", ZCL_MEDIA_SKIP_FORWARD_RESPONSE_COMMAND_ID, status);
return true;
}

bool emberAfMediaPlaybackClusterMediaSkipSeekCallback(chip::app::Command *, unsigned long long positionMilliseconds)
bool emberAfMediaPlaybackClusterMediaSkipSeekCallback(chip::app::Command *, uint64_t positionMilliseconds)
{
EmberAfMediaPlaybackStatus status = MediaPlaybackManager().proxyMediaPlaybackRequest(MediaPlaybackRequest::Seek);
sendResponse("MediaSeek", ZCL_MEDIA_SKIP_FORWARD_RESPONSE_COMMAND_ID, status);
Expand Down
8 changes: 4 additions & 4 deletions src/app/util/af-main-common.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -330,8 +330,8 @@ EmberStatus emberAfSendMulticastWithAliasWithCallback(GroupId multicastId, Ember
uint8_t * message, EmberNodeId alias, uint8_t sequence,
EmberAfMessageSentFunction callback)
{
apsFrame->groupId = multicastId;
const MessageSendDestination destination = MessageSendDestination::MulticastWithAlias(multicastId);
apsFrame->groupId = multicastId;
const auto destination = MessageSendDestination::MulticastWithAlias(multicastId);
return send(destination, apsFrame, messageLength, message,
true, // broadcast
alias, sequence, callback);
Expand All @@ -340,8 +340,8 @@ EmberStatus emberAfSendMulticastWithAliasWithCallback(GroupId multicastId, Ember
EmberStatus emberAfSendMulticastWithCallback(GroupId multicastId, EmberApsFrame * apsFrame, uint16_t messageLength,
uint8_t * message, EmberAfMessageSentFunction callback)
{
apsFrame->groupId = multicastId;
const MessageSendDestination destination = MessageSendDestination::Multicast(multicastId);
apsFrame->groupId = multicastId;
const auto destination = MessageSendDestination::Multicast(multicastId);
return send(destination, apsFrame, messageLength, message,
true, // broadcast?
0, // alias
Expand Down
2 changes: 0 additions & 2 deletions src/app/util/af-types.h
Original file line number Diff line number Diff line change
Expand Up @@ -1282,8 +1282,6 @@ class MessageSendDestination
return MessageSendDestination(VariantViaExchange(exchangeContext));
}

std::size_t GetType() const { return mDestination.GetType(); }

bool IsViaBinding() const { return mDestination.Is<VariantViaBinding>(); }
bool IsDirect() const { return mDestination.Is<VariantDirect>(); }
bool IsViaExchange() const { return mDestination.Is<VariantViaExchange>(); }
Expand Down
13 changes: 2 additions & 11 deletions src/lib/support/Variant.h
Original file line number Diff line number Diff line change
Expand Up @@ -70,15 +70,6 @@ struct VariantCurry<>
inline static void Copy(std::size_t that_t, const void * that_v, void * this_v) {}
};

// Using assert inside template will encoded template name into the assert
// error message, which cost lots of flash space, this function can strip the
// type name, and the function name should be as short as possible to save
// space.
inline void AssertStrip(bool exp)
{
assert(exp);
}

} // namespace Internal

/**
Expand Down Expand Up @@ -166,14 +157,14 @@ struct Variant
template <typename T>
T & Get()
{
Internal::AssertStrip(mTypeId == T::VariantId);
VerifyOrDie(mTypeId == T::VariantId);
return *reinterpret_cast<T *>(&mData);
}

template <typename T>
const T & Get() const
{
Internal::AssertStrip(mTypeId == T::VariantId);
VerifyOrDie(mTypeId == T::VariantId);
return *reinterpret_cast<const T *>(&mData);
}

Expand Down

0 comments on commit f586231

Please sign in to comment.