mirror of
https://github.com/espressif/openthread.git
synced 2026-07-10 14:20:29 +00:00
[mle] add discovery request callback (#5131)
This commit allows notifying the application a discovery request is received, which is useful if the application wants to be more active when a joiner comes.
This commit is contained in:
@@ -287,6 +287,9 @@ Interpreter::Interpreter(Instance *aInstance)
|
||||
#if OPENTHREAD_FTD || OPENTHREAD_CONFIG_TMF_NETWORK_DIAG_MTD_ENABLE
|
||||
otThreadSetReceiveDiagnosticGetCallback(mInstance, &Interpreter::HandleDiagnosticGetResponse, this);
|
||||
#endif
|
||||
#if OPENTHREAD_FTD
|
||||
otThreadSetDiscoveryRequestCallback(mInstance, &Interpreter::HandleDiscoveryRequest, this);
|
||||
#endif
|
||||
|
||||
mIcmpHandler.mReceiveCallback = Interpreter::HandleIcmpReceive;
|
||||
mIcmpHandler.mContext = this;
|
||||
@@ -4590,6 +4593,13 @@ void Interpreter::SignalPingReply(const Ip6::Address &aPeerAddress,
|
||||
#endif
|
||||
}
|
||||
|
||||
void Interpreter::HandleDiscoveryRequest(const otThreadDiscoveryRequestInfo &aInfo)
|
||||
{
|
||||
mServer->OutputFormat("~ Discovery Request from ");
|
||||
OutputBytes(aInfo.mExtAddress.m8, sizeof(aInfo.mExtAddress.m8));
|
||||
mServer->OutputFormat(": version=%u,joiner=%d\r\n", aInfo.mVersion, aInfo.mIsJoiner);
|
||||
}
|
||||
|
||||
extern "C" void otCliSetUserCommands(const otCliCommand *aUserCommands, uint8_t aLength)
|
||||
{
|
||||
Server::sServer->GetInterpreter().SetUserCommands(aUserCommands, aLength);
|
||||
|
||||
Reference in New Issue
Block a user