mirror of
https://github.com/espressif/openthread.git
synced 2026-07-09 13:50:28 +00:00
[ncp] add radio only mode NCP app (#2085)
This commit is contained in:
@@ -36,8 +36,8 @@
|
||||
#include "openthread-core-config.h"
|
||||
|
||||
#include <openthread/instance.h>
|
||||
#include <openthread/openthread.h>
|
||||
#include <openthread/platform/misc.h>
|
||||
#include <openthread/platform/settings.h>
|
||||
|
||||
#include "common/instance.hpp"
|
||||
#include "common/logging.hpp"
|
||||
@@ -64,18 +64,34 @@ otInstance *otInstanceInitSingle(void)
|
||||
|
||||
bool otInstanceIsInitialized(otInstance *aInstance)
|
||||
{
|
||||
#if OPENTHREAD_MTD || OPENTHREAD_FTD
|
||||
Instance &instance = *static_cast<Instance *>(aInstance);
|
||||
|
||||
return instance.IsInitialized();
|
||||
#else
|
||||
OT_UNUSED_VARIABLE(aInstance);
|
||||
return true;
|
||||
#endif // OPENTHREAD_MTD || OPENTHREAD_FTD
|
||||
}
|
||||
|
||||
void otInstanceFinalize(otInstance *aInstance)
|
||||
{
|
||||
#if OPENTHREAD_MTD || OPENTHREAD_FTD
|
||||
Instance &instance = *static_cast<Instance *>(aInstance);
|
||||
|
||||
instance.Finalize();
|
||||
#else
|
||||
OT_UNUSED_VARIABLE(aInstance);
|
||||
#endif // OPENTHREAD_MTD || OPENTHREAD_FTD
|
||||
}
|
||||
|
||||
void otInstanceReset(otInstance *aInstance)
|
||||
{
|
||||
Instance &instance = *static_cast<Instance *>(aInstance);
|
||||
|
||||
instance.Reset();
|
||||
}
|
||||
|
||||
#if OPENTHREAD_MTD || OPENTHREAD_FTD
|
||||
otError otSetStateChangedCallback(otInstance *aInstance, otStateChangedCallback aCallback, void *aContext)
|
||||
{
|
||||
Instance &instance = *static_cast<Instance *>(aInstance);
|
||||
@@ -90,13 +106,6 @@ void otRemoveStateChangeCallback(otInstance *aInstance, otStateChangedCallback a
|
||||
instance.GetNotifier().RemoveCallback(aCallback, aContext);
|
||||
}
|
||||
|
||||
void otInstanceReset(otInstance *aInstance)
|
||||
{
|
||||
Instance &instance = *static_cast<Instance *>(aInstance);
|
||||
|
||||
instance.Reset();
|
||||
}
|
||||
|
||||
void otInstanceFactoryReset(otInstance *aInstance)
|
||||
{
|
||||
Instance &instance = *static_cast<Instance *>(aInstance);
|
||||
@@ -110,6 +119,7 @@ otError otInstanceErasePersistentInfo(otInstance *aInstance)
|
||||
|
||||
return instance.ErasePersistentInfo();
|
||||
}
|
||||
#endif // OPENTHREAD_MTD || OPENTHREAD_FTD
|
||||
|
||||
otLogLevel otGetDynamicLogLevel(otInstance *aInstance)
|
||||
{
|
||||
@@ -143,3 +153,38 @@ otError otSetDynamicLogLevel(otInstance *aInstance, otLogLevel aLogLevel)
|
||||
|
||||
return error;
|
||||
}
|
||||
|
||||
const char *otGetVersionString(void)
|
||||
{
|
||||
/**
|
||||
* PLATFORM_VERSION_ATTR_PREFIX and PLATFORM_VERSION_ATTR_SUFFIX are
|
||||
* intended to be used to specify compiler directives to indicate
|
||||
* what linker section the platform version string should be stored.
|
||||
*
|
||||
* This is useful for specifying an exact locaiton of where the version
|
||||
* string will be located so that it can be easily retrieved from the
|
||||
* raw firmware image.
|
||||
*
|
||||
* If PLATFORM_VERSION_ATTR_PREFIX is unspecified, the keyword `static`
|
||||
* is used instead.
|
||||
*
|
||||
* If both are unspecified, the location of the string in the firmware
|
||||
* image will be undefined and may change.
|
||||
*/
|
||||
|
||||
#ifdef PLATFORM_VERSION_ATTR_PREFIX
|
||||
PLATFORM_VERSION_ATTR_PREFIX
|
||||
#else
|
||||
static
|
||||
#endif
|
||||
const char sVersion[] = PACKAGE_NAME "/" PACKAGE_VERSION "; " OPENTHREAD_CONFIG_PLATFORM_INFO
|
||||
#if defined(__DATE__)
|
||||
"; " __DATE__ " " __TIME__
|
||||
#endif
|
||||
#ifdef PLATFORM_VERSION_ATTR_SUFFIX
|
||||
PLATFORM_VERSION_ATTR_SUFFIX
|
||||
#endif
|
||||
; // Trailing semicolon to end statement.
|
||||
|
||||
return sVersion;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user