Skip to content

Commit

Permalink
Fixing style issues
Browse files Browse the repository at this point in the history
  • Loading branch information
pgregorr-amazon committed Mar 1, 2024
1 parent f126532 commit 4c382d1
Show file tree
Hide file tree
Showing 7 changed files with 18 additions and 23 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@
* limitations under the License.
*/

#import "zap-generated/MCClusterObjects.h"
#import "MCCluster_Internal.h"
#import "zap-generated/MCClusterObjects.h"

#import "MCEndpoint_Internal.h"

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,10 @@ FOUNDATION_EXPORT const unsigned char MatterTvCastingBridgeVersionString[];

// Add simplified casting API headers here
#import "MCAttribute.h"
#import "zap-generated/MCAttributeObjects.h"
#import "MCCastingApp.h"
#import "MCCastingPlayer.h"
#import "MCCastingPlayerDiscovery.h"
#import "MCCluster.h"
#import "zap-generated/MCClusterObjects.h"
#import "MCCommand.h"
#import "MCCommandObjects.h"
#import "MCCommissionableData.h"
Expand All @@ -42,3 +40,5 @@ FOUNDATION_EXPORT const unsigned char MatterTvCastingBridgeVersionString[];
#import "MCEndpointClusterType.h"
#import "MCEndpointFilter.h"
#import "MCObserver.h"
#import "zap-generated/MCAttributeObjects.h"
#import "zap-generated/MCClusterObjects.h"
Original file line number Diff line number Diff line change
Expand Up @@ -33,4 +33,4 @@ MatterCastingClusters:

# The commands currently implemented for Matter Casting in MCCommandObjects.h/mm. We will ZAP generate this file in the next PR.
MatterCastingImplementedCommands:
- LaunchURL
- LaunchURL
Original file line number Diff line number Diff line change
Expand Up @@ -47,4 +47,4 @@
"output": "examples/tv-casting-app/darwin/MatterTvCastingBridge/MatterTvCastingBridge/zap-generated/MCClusterObjects.mm"
}
]
}
}

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

27 changes: 11 additions & 16 deletions examples/tv-casting-app/tv-casting-common/core/Attribute.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@ namespace casting {
namespace core {

template <typename TypeInfo>
using ReadResponseSuccessCallbackFn =
std::function<void(void * context, chip::Optional<typename TypeInfo::DecodableType> before, typename TypeInfo::DecodableArgType after)>;
using ReadResponseSuccessCallbackFn = std::function<void(void * context, chip::Optional<typename TypeInfo::DecodableType> before,
typename TypeInfo::DecodableArgType after)>;
using ReadResponseFailureCallbackFn = std::function<void(void * context, CHIP_ERROR err)>;
using WriteResponseSuccessCallbackFn = std::function<void(void * context)>;
using WriteResponseFailureCallbackFn = std::function<void(void * context, CHIP_ERROR err)>;
Expand Down Expand Up @@ -72,8 +72,7 @@ class Attribute
* before (if the Attribute had been previously read)
* @param failureCb Called when there is a failure in reading the Attribute
*/
void Read(void * context, ReadResponseSuccessCallbackFn<TypeInfo> successCb,
ReadResponseFailureCallbackFn failureCb)
void Read(void * context, ReadResponseSuccessCallbackFn<TypeInfo> successCb, ReadResponseFailureCallbackFn failureCb)
{
memory::Strong<core::Endpoint> endpoint = this->GetEndpoint().lock();
if (endpoint)
Expand All @@ -85,8 +84,7 @@ class Attribute
attributeContext,
// FindOrEstablishSession success handler
[](void * _context, chip::Messaging::ExchangeManager & exchangeMgr, const chip::SessionHandle & sessionHandle) {
ReadAttributeContext<TypeInfo> * _attributeContext =
static_cast<ReadAttributeContext<TypeInfo> *>(_context);
ReadAttributeContext<TypeInfo> * _attributeContext = static_cast<ReadAttributeContext<TypeInfo> *>(_context);
ChipLogProgress(AppServer, "<Attribute>::Read() Found or established session");

// Read attribute
Expand Down Expand Up @@ -137,8 +135,7 @@ class Attribute
},
// FindOrEstablishSession failure handler
[](void * _context, const chip::ScopedNodeId & peerId, CHIP_ERROR error) {
ReadAttributeContext<TypeInfo> * _attributeContext =
static_cast<ReadAttributeContext<TypeInfo> *>(_context);
ReadAttributeContext<TypeInfo> * _attributeContext = static_cast<ReadAttributeContext<TypeInfo> *>(_context);
ChipLogError(AppServer,
"<Attribute>::Read() failure in retrieving session info for peerId.nodeId: "
"0x" ChipLogFormatX64 ", peer.fabricIndex: %d with error: %" CHIP_ERROR_FORMAT,
Expand Down Expand Up @@ -245,15 +242,14 @@ class Attribute
* @param minIntervalFloorSeconds the requested minimum interval boundary floor in seconds for attribute udpates
* @param maxIntervalCeilingSeconds the requested maximum interval boundary ceiling in seconds for attribute udpates
*/
void Subscribe(void * context, ReadResponseSuccessCallbackFn<TypeInfo> successCb,
ReadResponseFailureCallbackFn failureCb, uint16_t minIntervalFloorSeconds, uint16_t maxIntervalCeilingSeconds)
void Subscribe(void * context, ReadResponseSuccessCallbackFn<TypeInfo> successCb, ReadResponseFailureCallbackFn failureCb,
uint16_t minIntervalFloorSeconds, uint16_t maxIntervalCeilingSeconds)
{
memory::Strong<core::Endpoint> endpoint = this->GetEndpoint().lock();
if (endpoint)
{
SubscribeAttributeContext<TypeInfo> * attributeContext =
new SubscribeAttributeContext<TypeInfo>(this, endpoint, context, successCb, failureCb,
minIntervalFloorSeconds, maxIntervalCeilingSeconds);
SubscribeAttributeContext<TypeInfo> * attributeContext = new SubscribeAttributeContext<TypeInfo>(
this, endpoint, context, successCb, failureCb, minIntervalFloorSeconds, maxIntervalCeilingSeconds);

endpoint->GetCastingPlayer()->FindOrEstablishSession(
attributeContext,
Expand Down Expand Up @@ -385,9 +381,8 @@ template <typename TypeInfo>
struct SubscribeAttributeContext
{
SubscribeAttributeContext(void * attribute, memory::Strong<core::Endpoint> endpoint, void * clientContext,
ReadResponseSuccessCallbackFn<TypeInfo> successCb,
ReadResponseFailureCallbackFn failureCb, uint16_t minIntervalFloorSeconds,
uint16_t maxIntervalCeilingSeconds) :
ReadResponseSuccessCallbackFn<TypeInfo> successCb, ReadResponseFailureCallbackFn failureCb,
uint16_t minIntervalFloorSeconds, uint16_t maxIntervalCeilingSeconds) :
mEndpoint(endpoint),
mClientContext(clientContext), mSuccessCb(successCb), mFailureCb(failureCb)
{
Expand Down

0 comments on commit 4c382d1

Please sign in to comment.