mirror of
https://github.com/espressif/openthread.git
synced 2026-08-21 09:59:52 +00:00
Update otThreadDiscover() to include input argument for setting Joiner flag. (#1658)
This commit is contained in:
committed by
Jonathan Hui
parent
c73ba27878
commit
f392421d2c
@@ -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<GUID,uint32_t,uint16_t> Buffer(aInstance->InterfaceGuid, aScanChannels, aPanid);
|
||||
PackedBuffer4<GUID,uint32_t,uint16_t, bool> Buffer(aInstance->InterfaceGuid, aScanChannels, aPanid, aJoiner);
|
||||
return DwordToThreadError(SendIOCTL(aInstance->ApiHandle, IOCTL_OTLWF_OT_DISCOVER, &Buffer, sizeof(Buffer), nullptr, 0));
|
||||
}
|
||||
|
||||
|
||||
@@ -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)
|
||||
);
|
||||
|
||||
@@ -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);
|
||||
|
||||
/**
|
||||
|
||||
+1
-1
@@ -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");
|
||||
|
||||
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user