Skip to content

Commit

Permalink
[nrf fromlist] always use the recently created device object
Browse files Browse the repository at this point in the history
This commit ensures that CHIP Tool for Android communicates with recently
commissioned device.

Signed-off-by: Lukasz Duda <[email protected]>
  • Loading branch information
LuDuda authored and Damian-Nordic committed Feb 17, 2021
1 parent 00ac05f commit c73b8e0
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,7 @@ class DeviceProvisioningFragment : Fragment() {

showMessage(R.string.rendezvous_over_ble_pairing_text)
deviceController.setCompletionListener(ConnectionCallback())
deviceController.disconnectDevice();
deviceController.beginConnectDeviceBle(gatt, deviceInfo.setupPinCode);
}
}
Expand Down
8 changes: 2 additions & 6 deletions src/controller/CHIPDeviceController_deprecated.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -176,8 +176,7 @@ bool ChipDeviceController::GetIpAddress(Inet::IPAddress & addr)
if (!IsConnected())
return false;

if (mDevice == nullptr)
InitDevice();
InitDevice();

return mDevice != nullptr && mDevice->GetIpAddress(addr);
}
Expand Down Expand Up @@ -206,10 +205,7 @@ CHIP_ERROR ChipDeviceController::SendMessage(void * appReqState, PacketBufferHan
}
VerifyOrExit(mRemoteDeviceId != kUndefinedNodeId, err = CHIP_ERROR_INCORRECT_STATE);

if (mDevice == nullptr)
{
SuccessOrExit(InitDevice());
}
SuccessOrExit(InitDevice());

VerifyOrExit(mDevice != nullptr, err = CHIP_ERROR_INVALID_ARGUMENT);
mDevice->SetDelegate(this);
Expand Down

0 comments on commit c73b8e0

Please sign in to comment.