Skip to content
This repository has been archived by the owner on Oct 27, 2022. It is now read-only.

Commit

Permalink
[toble] Enable ToBLE feature when third_party/openthread supports it.
Browse files Browse the repository at this point in the history
- Add logic to disable WoBLE when ToBLE is provisioned.
- Extend default logging to include OpenThread platform and debug.
  • Loading branch information
turon committed Oct 21, 2019
1 parent c2e12ab commit 7bf7051
Show file tree
Hide file tree
Showing 5 changed files with 65 additions and 3 deletions.
28 changes: 27 additions & 1 deletion main/include/OpenThreadConfig.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,10 @@
#define OPENTHREAD_CONFIG_LOG_OUTPUT OPENTHREAD_CONFIG_LOG_OUTPUT_APP

// Turn on a moderate level of logging in OpenThread
#define OPENTHREAD_CONFIG_LOG_LEVEL OT_LOG_LEVEL_NOTE
#define OPENTHREAD_CONFIG_LOG_LEVEL OT_LOG_LEVEL_DEBG

// Turn on Nordic platform logs
#define OPENTHREAD_CONFIG_LOG_PLATFORM 1

// Use the Nordic-supplied default platform configuration for remainder
// of OpenThread config options.
Expand All @@ -41,6 +44,29 @@
//
#include "openthread-core-nrf52840-config.h"

// ==============================================================
// CONFIG TOBLE
// ==============================================================
#define OPENTHREAD_CONFIG_ENABLE_TOBLE 1

#define OPENTHREAD_CONFIG_ENABLE_BLE 1
#define OPENTHREAD_CONFIG_ENABLE_TOBLE_TO_BLE 1
#define OPENTHREAD_CONFIG_TOBLE_CENTRAL_ENABLE 0
#define OPENTHREAD_CONFIG_TOBLE_PERIPHERAL_ENABLE 1
#define OPENTHREAD_CONFIG_TOBLE_MULTI_RADIO_ENABLE 1
#define OPENTHREAD_CONFIG_TOBLE_154_ATTACH_ATTEMPT_RATIO 2

#define OPENTHREAD_DISABLE_TOBLE_GATT_ACKNOWLEDGEMENTS 0

#define OPENTHREAD_CONFIG_MAC_DATA_POLL_RESPONSE_TIMEOUT 500
#define OPENTHREAD_CONFIG_6LOWPAN_REASSEMBLY_TIMEOUT 60

#define OPENTHREAD_CONFIG_MLE_PARENT_REQUEST_ROUTER_TIMEOUT 1500
#define OPENTHREAD_CONFIG_MLE_PARENT_REQUEST_REED_TIMEOUT 3000
#define OPENTHREAD_CONFIG_MLE_UNICAST_RETRANSMISSION_DELAY 1500
#define OPENTHREAD_CONFIG_MLE_CHILD_ID_REQUEST_TIMEOUT 10000


#endif // OPENTHREAD_PLATFORM_CONFIG_H


2 changes: 2 additions & 0 deletions main/include/WeaveProjectConfig.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@
#ifndef WEAVE_PROJECT_CONFIG_H
#define WEAVE_PROJECT_CONFIG_H

#define WEAVE_PROGRESS_LOGGING 1

/**
* WEAVE_DEVICE_CONFIG_ENABLE_TEST_DEVICE_IDENTITY
*
Expand Down
34 changes: 34 additions & 0 deletions main/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,8 @@ using namespace ::nl::Weave::DeviceLayer;

extern "C" size_t GetHeapTotalSize(void);

static void DeviceEventHandler(const WeaveDeviceEvent * event, intptr_t arg);

// ================================================================================
// Logging Support
// ================================================================================
Expand Down Expand Up @@ -239,6 +241,10 @@ int main(void)
APP_ERROR_HANDLER(ret);
}

// Register a function to receive events from the Weave device layer. Note that calls to
// this function will happen on the Weave event loop thread, not the app_main thread.
PlatformMgr().AddEventHandler(DeviceEventHandler, 0);

NRF_LOG_INFO("Initializing OpenThread stack");

otSysInit(0, NULL);
Expand Down Expand Up @@ -285,6 +291,19 @@ int main(void)
}
}

// Disable Weave Pairing if Thread network has already been provisioned.
// TODO: Change this to only disable WoBLE when *full provisioning* has completed,
// i.e. ConfigurationManager.IsPairedToAccount()
if (ConnectivityMgr().IsThreadProvisioned())
{
ConnectivityMgr().SetBLEAdvertisingEnabled(false);
NRF_LOG_INFO("WoBLE pairing is disabled, as Thread is provisioned");
}
else
{
NRF_LOG_INFO("WoBLE pairing is enabled");
}

NRF_LOG_INFO("Starting Weave task");

ret = PlatformMgr().StartEventLoopTask();
Expand Down Expand Up @@ -329,3 +348,18 @@ int main(void)
NRF_LOG_INFO("vTaskStartScheduler() failed");
APP_ERROR_HANDLER(0);
}

/* Handle events from the Weave Device layer.
*
* NOTE: This function runs on the Weave event loop task.
*/
void DeviceEventHandler(const WeaveDeviceEvent * event, intptr_t arg)
{
if (event->Type == DeviceEventType::kSessionEstablished &&
event->SessionEstablished.IsCommissioner)
{
// Disable advertising when Commissioner connected over WoBLE
// so ToBLE connectivity checks can occur.
ConnectivityMgr().SetBLEAdvertisingEnabled(false);
}
}
2 changes: 1 addition & 1 deletion third_party/openthread
2 changes: 1 addition & 1 deletion third_party/openweave-core
Submodule openweave-core updated 54 files
+21 −1 build/esp32/components/openweave/Kconfig
+2 −1 build/nrf5/nrf5-app.mk
+2 −0 build/nrf5/nrf5-openthread.mk
+12 −107 configure
+2 −11 configure.ac
+39 −0 src/adaptations/device-layer/LwIP/WarmSupport.cpp
+7 −0 src/adaptations/device-layer/include/Weave/DeviceLayer/ConfigurationManager.h
+1 −0 src/adaptations/device-layer/include/Weave/DeviceLayer/ESP32/WeaveDevicePlatformConfig.h
+1 −0 src/adaptations/device-layer/include/Weave/DeviceLayer/ESP32/WeavePlatformConfig.h
+1 −0 src/adaptations/device-layer/include/Weave/DeviceLayer/LwIP/WarmSupport.h
+12 −0 src/adaptations/device-layer/include/Weave/DeviceLayer/WeaveDeviceConfig.h
+3 −0 src/adaptations/device-layer/include/Weave/DeviceLayer/internal/GenericConfigurationManagerImpl.h
+166 −2 src/adaptations/device-layer/include/Weave/DeviceLayer/internal/GenericConfigurationManagerImpl.ipp
+4 −2 src/adaptations/device-layer/nRF5/BLEManagerImpl.cpp
+16 −1 src/device-manager/WeaveDeviceManager.cpp
+2 −0 src/device-manager/WeaveDeviceManager.h
+16 −3 src/device-manager/python/WeaveDeviceManager-ScriptBinding.cpp
+4 −3 src/device-manager/python/openweave/WeaveDeviceMgr.py
+11 −3 src/device-manager/python/weave-device-mgr.py
+131 −47 src/inet/IPEndPointBasis.cpp
+25 −91 src/inet/IPEndPointBasis.h
+223 −4 src/inet/RawEndPoint.cpp
+3 −184 src/inet/RawEndPoint.h
+292 −81 src/inet/UDPEndPoint.cpp
+3 −143 src/inet/UDPEndPoint.h
+59 −2 src/lib/core/WeaveConfig.h
+31 −0 src/lib/core/WeaveMessageLayer.cpp
+3 −0 src/lib/core/WeaveMessageLayer.h
+10 −3 src/lib/profiles/data-management/Current/UpdateClient.h
+325 −9 src/lib/profiles/security/WeaveCert.cpp
+20 −1 src/lib/profiles/security/WeaveCert.h
+5 −3 src/lib/profiles/weave-tunneling/WeaveTunnelConnectionMgr.cpp
+4 −2 src/lib/support/Base64.h
+13 −0 src/lib/support/MathUtils.h
+13 −1 src/lib/support/crypto/EllipticCurve.h
+1 −1 src/test-apps/Makefile.am
+2 −1 src/test-apps/Makefile.in
+180 −0 src/test-apps/TestWeaveCert.cpp
+4 −3 src/test-apps/TestWeaveCertData.cpp
+2 −2 src/test-apps/TestWeaveCertData.h
+1 −1 src/test-apps/TestWeaveTunnelBR.cpp
+25 −0 src/test-apps/TestWeaveTunnelServer.cpp
+9 −1 src/test-apps/ToolCommon.cpp
+17 −1 src/test-apps/ToolCommonOptions.cpp
+2 −0 src/test-apps/ToolCommonOptions.h
+11 −3 src/test-apps/happy/lib/WeaveNodeConfigure.py
+32 −6 src/test-apps/happy/lib/WeaveState.py
+19 −6 src/test-apps/happy/test-templates/WeavePairing.py
+66 −39 src/test-apps/happy/test-templates/WeaveTunnelStart.py
+17 −33 src/test-apps/happy/tests/standalone/tunnel/test_weave_tunnel_01.py
+7 −1 src/test-apps/happy/topologies/standalone/thread_wifi_on_tap_ap_service.sh
+4 −8 src/tools/simnet/lib/simnet/layouts/two-devices.py
+132 −50 src/tools/simnet/simnet.py
+7 −0 src/tools/weave/Cmd_ConvertProvisioningData.cpp

0 comments on commit 7bf7051

Please sign in to comment.