Skip to content

Commit

Permalink
Merge pull request #4 from openthread/master
Browse files Browse the repository at this point in the history
Update fork
  • Loading branch information
Tonghui Tang committed Jul 28, 2020
2 parents 79c820f + a69a9d5 commit 78abefe
Show file tree
Hide file tree
Showing 5 changed files with 33 additions and 6 deletions.
1 change: 1 addition & 0 deletions Android.mk
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@ LOCAL_C_INCLUDES := \
external/openthread/include \
external/openthread/src \
external/openthread/src/posix/platform/include \
$(OTBR_PROJECT_INCLUDES)

LOCAL_CFLAGS += -Wall -Wextra -Wno-unused-parameter
LOCAL_CFLAGS += \
Expand Down
10 changes: 5 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
[![Build Status][otbr-travis-svg]][otbr-travis] [![Coverage Status][otbr-codecov-svg]][otbr-codecov] [![Docker Status][otbr-docker-amd64-linux-svg]][otbr-docker-amd64-linux] [![Docker Status][otbr-docker-arm32v7l-raspbian-svg]][otbr-docker-arm32v7l-raspbian]
[![Build Status][ot-gh-action-build-svg]][ot-gh-action-build] [![Docker Status][ot-gh-action-docker-svg]][ot-gh-action-docker] [![Build Status][otbr-travis-svg]][otbr-travis] [![Coverage Status][otbr-codecov-svg]][otbr-codecov]

---

Expand Down Expand Up @@ -28,14 +28,14 @@ OTBR includes a number of features, including:

More information about Thread can be found at [threadgroup.org](http://threadgroup.org/). Thread is a registered trademark of the Thread Group, Inc.

[ot-gh-action-build]: https://github.com/openthread/ot-br-posix/actions?query=workflow%3ABuild+branch%3Amaster+event%3Apush
[ot-gh-action-build-svg]: https://github.com/openthread/ot-br-posix/workflows/Build/badge.svg?branch=master&event=push
[ot-gh-action-docker]: https://github.com/openthread/ot-br-posix/actions?query=workflow%3ADocker+branch%3Amaster+event%3Apush
[ot-gh-action-docker-svg]: https://github.com/openthread/ot-br-posix/workflows/Docker/badge.svg?branch=master&event=push
[otbr-travis]: https://travis-ci.org/openthread/ot-br-posix
[otbr-travis-svg]: https://travis-ci.org/openthread/ot-br-posix.svg?branch=master
[otbr-codecov]: https://codecov.io/gh/openthread/ot-br-posix
[otbr-codecov-svg]: https://codecov.io/gh/openthread/ot-br-posix/branch/master/graph/badge.svg
[otbr-docker-amd64-linux]: https://hub.docker.com/r/openthread/otbr_amd64_linux
[otbr-docker-amd64-linux-svg]: https://img.shields.io/docker/cloud/build/openthread/otbr_amd64_linux.svg?label=docker%20%7C%20amd64_linux
[otbr-docker-arm32v7l-raspbian]: https://hub.docker.com/r/openthread/arm32v7l-raspbian
[otbr-docker-arm32v7l-raspbian-svg]: https://img.shields.io/docker/cloud/build/openthread/otbr_arm32v7l_raspbian.svg?label=docker%20%7C%20arm32v7l_raspbian

## Getting started

Expand Down
15 changes: 15 additions & 0 deletions src/agent/ncp_openthread.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,10 @@
#include "common/logging.hpp"
#include "common/types.hpp"

#if OTBR_ENABLE_LEGACY
#include <ot-legacy-pairing-ext.h>
#endif

static bool sReset;
using std::chrono::duration_cast;
using std::chrono::microseconds;
Expand Down Expand Up @@ -104,6 +108,9 @@ otbrError ControllerOpenThread::Init(void)

mInstance = otSysInit(&mConfig);
otCliUartInit(mInstance);
#if OTBR_ENABLE_LEGACY
otLegacyInit();
#endif

{
otError result = otSetStateChangedCallback(mInstance, &ControllerOpenThread::HandleStateChanged, this);
Expand Down Expand Up @@ -136,9 +143,17 @@ void ControllerOpenThread::HandleStateChanged(otChangedFlags aFlags)

switch (otThreadGetDeviceRole(mInstance))
{
case OT_DEVICE_ROLE_DISABLED:
#if OTBR_ENABLE_LEGACY
otLegacyStop();
#endif
break;
case OT_DEVICE_ROLE_CHILD:
case OT_DEVICE_ROLE_ROUTER:
case OT_DEVICE_ROLE_LEADER:
#if OTBR_ENABLE_LEGACY
otLegacyStart();
#endif
attached = true;
break;
default:
Expand Down
12 changes: 11 additions & 1 deletion src/dbus/server/dbus_thread_object.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,10 @@
#include "dbus/server/dbus_agent.hpp"
#include "dbus/server/dbus_thread_object.hpp"

#if OTBR_ENABLE_LEGACY
#include <ot-legacy-pairing-ext.h>
#endif

using std::placeholders::_1;
using std::placeholders::_2;

Expand Down Expand Up @@ -452,14 +456,20 @@ otError DBusThreadObject::SetMeshLocalPrefixHandler(DBusMessageIter &aIter)

otError DBusThreadObject::SetLegacyUlaPrefixHandler(DBusMessageIter &aIter)
{
#if OTBR_ENABLE_LEGACY
std::array<uint8_t, OTBR_IP6_PREFIX_SIZE> data;
otError error = OT_ERROR_NONE;

VerifyOrExit(DBusMessageExtractFromVariant(&aIter, data) == OTBR_ERROR_NONE, error = OT_ERROR_INVALID_ARGS);
otNcpHandleDidReceiveNewLegacyUlaPrefix(&data[0]);
otSetLegacyUlaPrefix(&data[0]);

exit:
return error;
#else
(void)aIter;

return OT_ERROR_NOT_IMPLEMENTED;
#endif // OTBR_ENABLE_LEGACY
}

otError DBusThreadObject::SetLinkModeHandler(DBusMessageIter &aIter)
Expand Down
1 change: 1 addition & 0 deletions src/mdns/mdns_avahi.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -511,6 +511,7 @@ otbrError PublisherAvahi::PublishService(uint16_t aPort, const char *aName, cons
va_start(args, aType);

VerifyOrExit(mState == kStateReady, errno = EAGAIN);
VerifyOrExit(mGroup != nullptr, ret = OTBR_ERROR_MDNS);

for (const char *name = va_arg(args, const char *); name; name = va_arg(args, const char *))
{
Expand Down

0 comments on commit 78abefe

Please sign in to comment.