[otns] add default implementation for otPlatOtnsStatus (#5155)

This commit adds a default implementation for otPlatOtnsStatus, which
emits OTNS status messages to log, so that OTNS=1 could be used with
real devices. This is required for the Silk-OTNS integration work, as
Silk will pick up these messages and reroute them to OTNS for
visualization purposes.
This commit is contained in:
Colin Tan
2020-06-30 13:02:50 -07:00
committed by GitHub
parent b0bff4f8c3
commit 5ce4046751
2 changed files with 19 additions and 0 deletions
+13
View File
@@ -1158,6 +1158,19 @@ extern "C" {
#define otLogDebgPlat(...)
#endif
/**
* @def otLogOtns
*
* This method generates a log with level none for the Core region,
* and is specifically for OTNS visualization use.
*
* @param[in] ... Arguments for the format specification.
*
*/
#if (OPENTHREAD_MTD || OPENTHREAD_FTD) && OPENTHREAD_CONFIG_OTNS_ENABLE
#define otLogOtns(...) _otLogFormatter(OT_LOG_LEVEL_NONE, OT_LOG_REGION_CORE, _OT_LEVEL_NONE_PREFIX __VA_ARGS__, NULL)
#endif
/**
* @def otDumpCrit
*
+6
View File
@@ -38,6 +38,7 @@
#include "common/debug.hpp"
#include "common/locator-getters.hpp"
#include "common/logging.hpp"
namespace ot {
namespace Utils {
@@ -133,4 +134,9 @@ void Otns::EmitNeighborChange(otNeighborTableEvent aEvent, Neighbor &aNeighbor)
} // namespace Utils
} // namespace ot
OT_TOOL_WEAK void otPlatOtnsStatus(const char *aStatus)
{
otLogOtns("[OTNS] %s", aStatus);
}
#endif // (OPENTHREAD_MTD || OPENTHREAD_FTD) && OPENTHREAD_CONFIG_OTNS_ENABLE