mirror of
https://github.com/espressif/openthread.git
synced 2026-07-11 06:40:19 +00:00
Add callback to indicate when joiner operation completes. (#1094)
This commit is contained in:
+20
-1
@@ -2438,7 +2438,7 @@ void Interpreter::ProcessJoiner(int argc, char *argv[])
|
||||
const char *provisioningUrl;
|
||||
VerifyOrExit(argc > 1, error = kThreadError_Parse);
|
||||
provisioningUrl = (argc > 2) ? argv[2] : NULL;
|
||||
otJoinerStart(mInstance, argv[1], provisioningUrl);
|
||||
otJoinerStart(mInstance, argv[1], provisioningUrl, &Interpreter::s_HandleJoinerCallback, this);
|
||||
}
|
||||
else if (strcmp(argv[0], "stop") == 0)
|
||||
{
|
||||
@@ -2451,6 +2451,25 @@ exit:
|
||||
|
||||
#endif // OPENTHREAD_ENABLE_JOINER
|
||||
|
||||
void Interpreter::s_HandleJoinerCallback(ThreadError aError, void *aContext)
|
||||
{
|
||||
static_cast<Interpreter *>(aContext)->HandleJoinerCallback(aError);
|
||||
}
|
||||
|
||||
void Interpreter::HandleJoinerCallback(ThreadError aError)
|
||||
{
|
||||
switch (aError)
|
||||
{
|
||||
case kThreadError_None:
|
||||
sServer->OutputFormat("Join success\r\n");
|
||||
break;
|
||||
|
||||
default:
|
||||
sServer->OutputFormat("Join failed [%s]\r\n", otThreadErrorToString(aError));
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void Interpreter::ProcessJoinerPort(int argc, char *argv[])
|
||||
{
|
||||
ThreadError error = kThreadError_None;
|
||||
|
||||
@@ -225,6 +225,7 @@ private:
|
||||
void *aContext);
|
||||
static void s_HandlePanIdConflict(uint16_t aPanId, uint32_t aChannelMask, void *aContext);
|
||||
static void s_HandleDiagnosticGetResponse(otMessage aMessage, const otMessageInfo *aMessageInfo, void *aContext);
|
||||
static void s_HandleJoinerCallback(ThreadError aError, void *aContext);
|
||||
|
||||
void HandleEchoResponse(Message &aMessage, const Ip6::MessageInfo &aMessageInfo);
|
||||
void HandlePingTimer();
|
||||
@@ -234,6 +235,7 @@ private:
|
||||
void HandleEnergyReport(uint32_t aChannelMask, const uint8_t *aEnergyList, uint8_t aEnergyListLength);
|
||||
void HandlePanIdConflict(uint16_t aPanId, uint32_t aChannelMask);
|
||||
void HandleDiagnosticGetResponse(Message &aMessage, const Ip6::MessageInfo &aMessageInfo);
|
||||
void HandleJoinerCallback(ThreadError aError);
|
||||
|
||||
static const struct Command sCommands[];
|
||||
|
||||
|
||||
Reference in New Issue
Block a user