From 0f0f39062300d69b47428bedd6578b55634ae58b Mon Sep 17 00:00:00 2001 From: Damian Krolik Date: Fri, 27 Nov 2020 17:00:37 +0100 Subject: [PATCH] Fix Rendezvous over BLE after recent changes PR #3704 introduced a change that the BLE transport in RendezvousSession is only initialized when PeerAddress in RendezvousParams is of type BLE. However, PeerAddress isn't initialized anywhere. As a result Rendezvous over BLE stopped working between Android CHIPTool and accessories. Btw, remove an assert related to the storage delegate as it seems an optional member of the device controller. --- examples/common/chip-app-server/Server.cpp | 3 ++- src/controller/CHIPDeviceController.cpp | 1 - src/controller/java/CHIPDeviceController-JNI.cpp | 3 ++- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/examples/common/chip-app-server/Server.cpp b/examples/common/chip-app-server/Server.cpp index ac0f879475512a..67ddad791e7f41 100644 --- a/examples/common/chip-app-server/Server.cpp +++ b/examples/common/chip-app-server/Server.cpp @@ -112,7 +112,8 @@ void InitServer() SuccessOrExit(err = DeviceLayer::ConfigurationMgr().GetSetupPinCode(pinCode)); params.SetSetupPINCode(pinCode) .SetLocalNodeId(chip::kTestDeviceNodeId) - .SetBleLayer(DeviceLayer::ConnectivityMgr().GetBleLayer()); + .SetBleLayer(DeviceLayer::ConnectivityMgr().GetBleLayer()) + .SetPeerAddress(Transport::PeerAddress::BLE()); SuccessOrExit(err = gRendezvousServer.Init(params, &gTransports)); } #endif diff --git a/src/controller/CHIPDeviceController.cpp b/src/controller/CHIPDeviceController.cpp index 5b31b2c2bb62a1..008ac0fb4cdefb 100644 --- a/src/controller/CHIPDeviceController.cpp +++ b/src/controller/CHIPDeviceController.cpp @@ -467,7 +467,6 @@ CHIP_ERROR DeviceCommissioner::PairDevice(NodeId remoteDeviceId, RendezvousParam VerifyOrExit(mState == State::Initialized, err = CHIP_ERROR_INCORRECT_STATE); VerifyOrExit(mDeviceBeingPaired == kNumMaxActiveDevices, err = CHIP_ERROR_INCORRECT_STATE); - VerifyOrExit(mStorageDelegate != nullptr, err = CHIP_ERROR_INCORRECT_STATE); #if CONFIG_DEVICE_LAYER && CONFIG_NETWORK_LAYER_BLE if (!params.HasBleLayer()) diff --git a/src/controller/java/CHIPDeviceController-JNI.cpp b/src/controller/java/CHIPDeviceController-JNI.cpp index e74a82302020c4..cbb9457bbd66d0 100644 --- a/src/controller/java/CHIPDeviceController-JNI.cpp +++ b/src/controller/java/CHIPDeviceController-JNI.cpp @@ -288,7 +288,8 @@ JNI_METHOD(void, beginConnectDevice)(JNIEnv * env, jobject self, jlong handle, j RendezvousParameters params = RendezvousParameters() .SetSetupPINCode(pinCode) .SetConnectionObject(reinterpret_cast(connObj)) - .SetBleLayer(&sBleLayer); + .SetBleLayer(&sBleLayer) + .SetPeerAddress(Transport::PeerAddress::BLE()); err = wrapper->Controller()->ConnectDevice(kRemoteDeviceId, params, (void *) "ConnectDevice", HandleKeyExchange, HandleEchoResponse, HandleError); }