34 #ifndef OTBR_AGENT_NCP_OPENTHREAD_HPP_
35 #define OTBR_AGENT_NCP_OPENTHREAD_HPP_
42 #include <openthread/backbone_router_ftd.h>
43 #include <openthread/cli.h>
44 #include <openthread/instance.h>
45 #include <openthread/openthread-system.h>
49 #include "common/types.hpp"
53 #if OTBR_ENABLE_FEATURE_FLAGS
55 class FeatureFlagList;
67 using ThreadStateChangedCallback = std::function<void(otChangedFlags aFlags)>;
80 const std::vector<const char *> &aRadioUrls,
81 const char * aBackboneInterfaceName,
83 bool aEnableAutoAttach);
105 assert(mInstance !=
nullptr);
117 assert(mThreadHelper !=
nullptr);
118 return mThreadHelper.get();
171 static otbrLogLevel ConvertToOtbrLogLevel(otLogLevel aLogLevel);
173 #if OTBR_ENABLE_FEATURE_FLAGS
182 otError ApplyFeatureFlagList(
const FeatureFlagList &aFeatureFlagList);
190 const std::string &GetAppliedFeatureFlagListBytes(
void) {
return mAppliedFeatureFlagListBytes; }
196 static void HandleStateChanged(otChangedFlags aFlags,
void *aContext)
200 void HandleStateChanged(otChangedFlags aFlags);
202 static void HandleBackboneRouterDomainPrefixEvent(
void * aContext,
203 otBackboneRouterDomainPrefixEvent aEvent,
204 const otIp6Prefix * aDomainPrefix);
205 void HandleBackboneRouterDomainPrefixEvent(otBackboneRouterDomainPrefixEvent aEvent,
206 const otIp6Prefix * aDomainPrefix);
208 #if OTBR_ENABLE_DUA_ROUTING
209 static void HandleBackboneRouterNdProxyEvent(
void * aContext,
210 otBackboneRouterNdProxyEvent aEvent,
211 const otIp6Address * aAddress);
212 void HandleBackboneRouterNdProxyEvent(otBackboneRouterNdProxyEvent aEvent,
const otIp6Address *aAddress);
215 bool IsAutoAttachEnabled(
void);
216 void DisableAutoAttach(
void);
218 static otLogLevel ConvertToOtLogLevel(
otbrLogLevel aLevel);
220 otInstance *mInstance;
222 otPlatformConfig mConfig;
223 std::unique_ptr<otbr::agent::ThreadHelper> mThreadHelper;
224 std::vector<std::function<void(
void)>> mResetHandlers;
225 TaskRunner mTaskRunner;
226 std::vector<ThreadStateChangedCallback> mThreadStateChangedCallbacks;
227 bool mEnableAutoAttach =
false;
228 #if OTBR_ENABLE_FEATURE_FLAGS
230 std::string mAppliedFeatureFlagListBytes;
237 #endif // OTBR_AGENT_NCP_OPENTHREAD_HPP_