diff --git a/examples/drivers/windows/otApi/otApi.cpp b/examples/drivers/windows/otApi/otApi.cpp index 978ecd671..fa176116a 100644 --- a/examples/drivers/windows/otApi/otApi.cpp +++ b/examples/drivers/windows/otApi/otApi.cpp @@ -1335,6 +1335,7 @@ otThreadDiscover( _In_ otInstance *aInstance, uint32_t aScanChannels, uint16_t aPanid, + bool aJoiner, otHandleActiveScanResult aCallback, void *aCallbackContext ) @@ -1346,7 +1347,7 @@ otThreadDiscover( aInstance->InterfaceGuid, aCallback, aCallbackContext ); - PackedBuffer3 Buffer(aInstance->InterfaceGuid, aScanChannels, aPanid); + PackedBuffer4 Buffer(aInstance->InterfaceGuid, aScanChannels, aPanid, aJoiner); return DwordToThreadError(SendIOCTL(aInstance->ApiHandle, IOCTL_OTLWF_OT_DISCOVER, &Buffer, sizeof(Buffer), nullptr, 0)); } diff --git a/examples/drivers/windows/otLwf/iocontrol.c b/examples/drivers/windows/otLwf/iocontrol.c index 82725c68c..9b7c9c6fa 100644 --- a/examples/drivers/windows/otLwf/iocontrol.c +++ b/examples/drivers/windows/otLwf/iocontrol.c @@ -904,15 +904,17 @@ otLwfIoCtl_otDiscover( { NTSTATUS status = STATUS_INVALID_PARAMETER; - if (InBufferLength >= sizeof(uint32_t) + sizeof(uint16_t)) + if (InBufferLength >= sizeof(uint32_t) + sizeof(uint16_t) + sizeof(bool)) { uint32_t aScanChannels = *(uint32_t*)InBuffer; uint16_t aPanid = *(uint16_t*)(InBuffer + sizeof(uint32_t)); + bool aJoiner = *(bool*)(InBuffer + sizeof(uint32_t) + sizeof(uint16_t)); status = ThreadErrorToNtstatus( otThreadDiscover( pFilter->otCtx, aScanChannels, aPanid, + aJoiner, otLwfDiscoverCallback, pFilter) ); diff --git a/include/openthread/thread.h b/include/openthread/thread.h index ba58d1979..cb94a1a91 100644 --- a/include/openthread/thread.h +++ b/include/openthread/thread.h @@ -115,6 +115,7 @@ OTAPI bool OTCALL otThreadIsSingleton(otInstance *aInstance); * @param[in] aInstance A pointer to an OpenThread instance. * @param[in] aScanChannels A bit vector indicating which channels to scan (e.g. OT_CHANNEL_11_MASK). * @param[in] aPanId The PAN ID filter (set to Broadcast PAN to disable filter). + * @param[in] aJoiner Value of the Joiner Flag in the Discovery Request TLV. * @param[in] aCallback A pointer to a function called on receiving an MLE Discovery Response or scan completes. * @param[in] aCallbackContext A pointer to application-specific context. * @@ -122,7 +123,7 @@ OTAPI bool OTCALL otThreadIsSingleton(otInstance *aInstance); * @retval kThreadError_Busy Already performing an Thread Discovery. * */ -OTAPI ThreadError OTCALL otThreadDiscover(otInstance *aInstance, uint32_t aScanChannels, uint16_t aPanid, +OTAPI ThreadError OTCALL otThreadDiscover(otInstance *aInstance, uint32_t aScanChannels, uint16_t aPanid, bool aJoiner, otHandleActiveScanResult aCallback, void *aCallbackContext); /** diff --git a/src/cli/cli.cpp b/src/cli/cli.cpp index b14fd90f1..aa4c863fe 100644 --- a/src/cli/cli.cpp +++ b/src/cli/cli.cpp @@ -747,7 +747,7 @@ void Interpreter::ProcessDiscover(int argc, char *argv[]) scanChannels = 1 << value; } - SuccessOrExit(error = otThreadDiscover(mInstance, scanChannels, OT_PANID_BROADCAST, + SuccessOrExit(error = otThreadDiscover(mInstance, scanChannels, OT_PANID_BROADCAST, false, &Interpreter::s_HandleActiveScanResult, this)); sServer->OutputFormat("| J | Network Name | Extended PAN | PAN | MAC Address | Ch | dBm | LQI |\r\n"); sServer->OutputFormat("+---+------------------+------------------+------+------------------+----+-----+-----+\r\n"); diff --git a/src/core/api/thread_api.cpp b/src/core/api/thread_api.cpp index 3b403fd36..931051186 100644 --- a/src/core/api/thread_api.cpp +++ b/src/core/api/thread_api.cpp @@ -678,10 +678,10 @@ bool otThreadIsSingleton(otInstance *aInstance) return aInstance->mThreadNetif.GetMle().IsSingleton(); } -ThreadError otThreadDiscover(otInstance *aInstance, uint32_t aScanChannels, uint16_t aPanId, +ThreadError otThreadDiscover(otInstance *aInstance, uint32_t aScanChannels, uint16_t aPanId, bool aJoiner, otHandleActiveScanResult aCallback, void *aCallbackContext) { - return aInstance->mThreadNetif.GetMle().Discover(aScanChannels, aPanId, false, aCallback, aCallbackContext); + return aInstance->mThreadNetif.GetMle().Discover(aScanChannels, aPanId, aJoiner, aCallback, aCallbackContext); } bool otThreadIsDiscoverInProgress(otInstance *aInstance)