Include platform details in version information (#347)

- add --with-platform-info configuration option to specify platform information
- add otGetVersionString() interface to get OpenThread version
This commit is contained in:
Shu Chen
2016-08-10 20:02:29 -07:00
committed by Jonathan Hui
parent cfdc53088e
commit cefea1a3c6
7 changed files with 50 additions and 3 deletions
+20
View File
@@ -475,6 +475,25 @@ AC_SUBST(OPENTHREAD_EXAMPLES_CC2538)
AM_CONDITIONAL([OPENTHREAD_EXAMPLES_CC2538], [test "${OPENTHREAD_EXAMPLES}" = "cc2538"])
AC_DEFINE_UNQUOTED([OPENTHREAD_EXAMPLES_CC2538],[${OPENTHREAD_EXAMPLES_CC2538}],[Define to 1 if you want to use cc2538 examples])
#
# Platform Information
#
AC_ARG_WITH(platform-info,
[AS_HELP_STRING([--with-platform-info=PLATFORM],
[Specify the platform information @<:@default=none@:>@.])],
[],
[with_platform_info=none])
PLATFORM_INFO=${with_platform_info}
AC_MSG_RESULT(${PLATFORM_INFO})
if test "$PLATFORM_INFO" != "none"; then
AC_SUBST(PLATFORM_INFO)
AC_DEFINE_UNQUOTED([PLATFORM_INFO],["${PLATFORM_INFO}"],[OpenThread platform information])
fi
#
# Tools
#
@@ -652,5 +671,6 @@ AC_MSG_NOTICE([
OpenThread CLI support : ${enable_cli}
OpenThread NCP support : ${enable_ncp}
OpenThread examples : ${OPENTHREAD_EXAMPLES}
OpenThread platform information : ${PLATFORM_INFO}
])
+1
View File
@@ -45,6 +45,7 @@ configure_OPTIONS = \
--enable-cli \
--enable-ncp \
--with-examples=cc2538 \
--with-platform-info=CC2538 \
$(NULL)
COMMONCFLAGS := \
+6 -1
View File
@@ -86,7 +86,12 @@ TargetTuple = $(shell ${AbsTopSourceDir}/third_party/nlbuild
# If the user has asserted COVERAGE, alter the configuration options
# accordingly.
configure_OPTIONS = --with-examples=posix --enable-cli --enable-ncp
configure_OPTIONS = \
--enable-cli \
--enable-ncp \
--with-examples=posix \
--with-platform-info=POSIX \
$(NULL)
ifeq ($(COVERAGE),1)
configure_OPTIONS += --enable-coverage
+8
View File
@@ -145,6 +145,14 @@ extern void otSignalTaskletPending(void);
*
*/
/**
* Get the OpenThread version string.
*
* @returns A pointer to the OpenThread version.
*
*/
const char *otGetVersionString(void);
/**
* This function initializes the OpenThread library.
*
+1 -1
View File
@@ -1391,7 +1391,7 @@ exit:
void Interpreter::ProcessVersion(int argc, char *argv[])
{
sServer->OutputFormat("%s\r\n", PACKAGE_NAME "/" PACKAGE_VERSION "; " __DATE__ " " __TIME__);
sServer->OutputFormat("%s\r\n", otGetVersionString());
AppendResult(kThreadError_None);
(void)argc;
(void)argv;
+13
View File
@@ -32,6 +32,7 @@
*/
#include <openthread.h>
#include <openthread-config.h>
#include <common/code_utils.hpp>
#include <common/debug.hpp>
#include <common/logging.hpp>
@@ -679,6 +680,18 @@ void otSetStateChangedCallback(otStateChangedCallback aCallback, void *aContext)
sThreadNetif->RegisterCallback(sNetifCallback);
}
const char *otGetVersionString(void)
{
static const char sVersion[] =
PACKAGE_NAME "/" PACKAGE_VERSION "; "
#ifdef PLATFORM_INFO
PLATFORM_INFO "; "
#endif
__DATE__ " " __TIME__;
return sVersion;
}
ThreadError otEnable(void)
{
ThreadError error = kThreadError_None;
+1 -1
View File
@@ -1133,7 +1133,7 @@ ThreadError NcpBase::GetPropertyHandler_NCP_VERSION(uint8_t header, spinel_prop_
SPINEL_CMD_PROP_VALUE_IS,
key,
SPINEL_DATATYPE_UTF8_S,
PACKAGE_NAME "/" PACKAGE_VERSION "; " __DATE__ " " __TIME__
otGetVersionString()
);
}