Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Controller] Update CHIPController to use the Invoke API instead of r… #13371

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 6 additions & 12 deletions examples/platform/linux/AppMain.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -323,7 +323,7 @@ CHIP_ERROR ShutdownCommissioner()
class PairingCommand : public Controller::DevicePairingDelegate, public Controller::DeviceAddressUpdateDelegate
{
public:
PairingCommand() : mSuccessCallback(OnSuccessResponse, this), mFailureCallback(OnFailureResponse, this){};
PairingCommand(){};

/////////// DevicePairingDelegate Interface /////////
void OnStatusUpdate(Controller::DevicePairingDelegate::Status status) override;
Expand All @@ -337,12 +337,9 @@ class PairingCommand : public Controller::DevicePairingDelegate, public Controll
CHIP_ERROR UpdateNetworkAddress();

/* Callback when command results in success */
static void OnSuccessResponse(void * context);
static void OnSuccessResponse(void * context, const chip::app::DataModel::NullObjectType &);
/* Callback when command results in failure */
static void OnFailureResponse(void * context, uint8_t status);

Callback::Callback<DefaultSuccessCallback> mSuccessCallback;
Callback::Callback<DefaultFailureCallback> mFailureCallback;
static void OnFailureResponse(void * context, CHIP_ERROR error);
};

PairingCommand gPairingCommand;
Expand Down Expand Up @@ -401,12 +398,12 @@ void PairingCommand::OnPairingDeleted(CHIP_ERROR err)
}
}

void PairingCommand::OnSuccessResponse(void * context)
void PairingCommand::OnSuccessResponse(void * context, const chip::app::DataModel::NullObjectType &)
{
ChipLogProgress(Controller, "OnSuccessResponse");
}

void PairingCommand::OnFailureResponse(void * context, uint8_t status)
void PairingCommand::OnFailureResponse(void * context, CHIP_ERROR error)
{
ChipLogProgress(Controller, "OnFailureResponse");
}
Expand All @@ -423,15 +420,12 @@ void PairingCommand::OnCommissioningComplete(NodeId nodeId, CHIP_ERROR err)
// - the cluster(s) chosen should come from the App Platform
constexpr EndpointId kBindingClusterEndpoint = 0;

Callback::Cancelable * successCallback = mSuccessCallback.Cancel();
Callback::Cancelable * failureCallback = mFailureCallback.Cancel();

GroupId groupId = kUndefinedGroupId;
EndpointId endpointId = 1;
ClusterId clusterId = kInvalidClusterId;

gCommissioner.CreateBindingWithCallback(nodeId, kBindingClusterEndpoint, gLocalId, groupId, endpointId, clusterId,
successCallback, failureCallback);
OnSuccessResponse, OnFailureResponse);
}
else
{
Expand Down
Loading