Skip to content

Commit

Permalink
Refactor mqtt5 fleet provisioning sample
Browse files Browse the repository at this point in the history
  • Loading branch information
sfodagain committed Jul 11, 2024
1 parent 7504338 commit 69e7aba
Show file tree
Hide file tree
Showing 2 changed files with 238 additions and 260 deletions.
10 changes: 3 additions & 7 deletions samples/fleet_provisioning/fleet_provisioning/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ struct CreateCertificateContext
};

/**
* Keys-And-Certificate workflow.
* Keys-and-Certificate workflow.
*
* @note Subscriptions created here will be active even after the function completes. So, all variables accessed in the
* callbacks must be alive for the whole duration of the identityClient's lifetime. An instance of
Expand Down Expand Up @@ -137,7 +137,7 @@ void useKeysAndCertificate(IotIdentityClient &identityClient, CreateCertificateC
}

/**
* Certificate-From-CSR workflow.
* Certificate-from-CSR workflow.
*
* @note Subscriptions created here will be active even after the function completes. So, all variables accessed in the
* callbacks must be alive for the whole duration of the identityClient's lifetime. An instance of
Expand Down Expand Up @@ -329,10 +329,6 @@ int main(int argc, char *argv[])

IotIdentityClient identityClient(connection);

/*
* Use promises to enforce synchronous behavior, so it's easier to follow the workflow.
*/

std::promise<void> registerPublishPubAckCompletedPromise;
std::promise<void> registerAcceptedSubAckCompletedPromise;
std::promise<void> registerRejectedSubAckCompletedPromise;
Expand Down Expand Up @@ -397,8 +393,8 @@ int main(int argc, char *argv[])
registerPublishPubAckCompletedPromise.set_value();
};

// Create certificate.
CreateCertificateContext certificateContext;

if (csrFile.empty())
{
useKeysAndCertificate(identityClient, certificateContext);
Expand Down
Loading

0 comments on commit 69e7aba

Please sign in to comment.