diff --git a/examples/chip-tool/commands/clusters/ModelCommand.cpp b/examples/chip-tool/commands/clusters/ModelCommand.cpp index 01406250d7a360..a8e5ddd0071086 100644 --- a/examples/chip-tool/commands/clusters/ModelCommand.cpp +++ b/examples/chip-tool/commands/clusters/ModelCommand.cpp @@ -36,7 +36,7 @@ void ModelCommand::OnDeviceConnectedFn(void * context, ChipDevice * device) command->SendCommand(device, command->mEndPointId); } -void ModelCommand::OnDeviceConnectionFailureFn(void * context, NodeId deviceId, CHIP_ERROR err) +void ModelCommand::OnDeviceConnectionFailureFn(void * context, PeerId peerId, CHIP_ERROR err) { LogErrorOnFailure(err); diff --git a/examples/chip-tool/commands/clusters/ModelCommand.h b/examples/chip-tool/commands/clusters/ModelCommand.h index b03361433e0996..e769ad3f9ffad3 100644 --- a/examples/chip-tool/commands/clusters/ModelCommand.h +++ b/examples/chip-tool/commands/clusters/ModelCommand.h @@ -54,7 +54,7 @@ class ModelCommand : public CHIPCommand uint8_t mEndPointId; static void OnDeviceConnectedFn(void * context, ChipDevice * device); - static void OnDeviceConnectionFailureFn(void * context, NodeId deviceId, CHIP_ERROR error); + static void OnDeviceConnectionFailureFn(void * context, PeerId peerId, CHIP_ERROR error); chip::Callback::Callback mOnDeviceConnectedCallback; chip::Callback::Callback mOnDeviceConnectionFailureCallback; diff --git a/examples/chip-tool/commands/common/CHIPCommand.h b/examples/chip-tool/commands/common/CHIPCommand.h index efc6396311e41e..54ef0452c1cfd9 100644 --- a/examples/chip-tool/commands/common/CHIPCommand.h +++ b/examples/chip-tool/commands/common/CHIPCommand.h @@ -39,6 +39,7 @@ class CHIPCommand : public Command using ChipDeviceController = ::chip::Controller::DeviceController; using IPAddress = ::chip::Inet::IPAddress; using NodeId = ::chip::NodeId; + using PeerId = ::chip::PeerId; using PeerAddress = ::chip::Transport::PeerAddress; CHIPCommand(const char * commandName) : Command(commandName) diff --git a/examples/chip-tool/commands/pairing/OpenCommissioningWindowCommand.cpp b/examples/chip-tool/commands/pairing/OpenCommissioningWindowCommand.cpp index 030a5858067bd9..abc94a593e3948 100644 --- a/examples/chip-tool/commands/pairing/OpenCommissioningWindowCommand.cpp +++ b/examples/chip-tool/commands/pairing/OpenCommissioningWindowCommand.cpp @@ -31,7 +31,7 @@ void OpenCommissioningWindowCommand::OnDeviceConnectedFn(void * context, chip::O VerifyOrReturn(command != nullptr, ChipLogError(chipTool, "OnDeviceConnectedFn: context is null")); command->OpenCommissioningWindow(); } -void OpenCommissioningWindowCommand::OnDeviceConnectionFailureFn(void * context, NodeId remoteId, CHIP_ERROR err) +void OpenCommissioningWindowCommand::OnDeviceConnectionFailureFn(void * context, PeerId peerId, CHIP_ERROR err) { LogErrorOnFailure(err); diff --git a/examples/chip-tool/commands/pairing/OpenCommissioningWindowCommand.h b/examples/chip-tool/commands/pairing/OpenCommissioningWindowCommand.h index 92130cdb02ceca..14014dc5e99597 100644 --- a/examples/chip-tool/commands/pairing/OpenCommissioningWindowCommand.h +++ b/examples/chip-tool/commands/pairing/OpenCommissioningWindowCommand.h @@ -48,7 +48,7 @@ class OpenCommissioningWindowCommand : public CHIPCommand CHIP_ERROR OpenCommissioningWindow(); static void OnDeviceConnectedFn(void * context, chip::OperationalDeviceProxy * device); - static void OnDeviceConnectionFailureFn(void * context, NodeId deviceId, CHIP_ERROR error); + static void OnDeviceConnectionFailureFn(void * context, PeerId peerId, CHIP_ERROR error); static void OnOpenCommissioningWindowResponse(void * context, NodeId deviceId, CHIP_ERROR status, chip::SetupPayload payload); chip::Callback::Callback mOnDeviceConnectedCallback; diff --git a/examples/chip-tool/commands/tests/TestCommand.cpp b/examples/chip-tool/commands/tests/TestCommand.cpp index 4e9f01af3cdf5c..70af22f64663cb 100644 --- a/examples/chip-tool/commands/tests/TestCommand.cpp +++ b/examples/chip-tool/commands/tests/TestCommand.cpp @@ -45,10 +45,10 @@ void TestCommand::OnDeviceConnectedFn(void * context, chip::OperationalDevicePro command->NextTest(); } -void TestCommand::OnDeviceConnectionFailureFn(void * context, NodeId deviceId, CHIP_ERROR error) +void TestCommand::OnDeviceConnectionFailureFn(void * context, PeerId peerId, CHIP_ERROR error) { ChipLogProgress(chipTool, " **** Test Setup: Device Connection Failure [deviceId=%" PRIu64 ". Error %" CHIP_ERROR_FORMAT "\n]", - deviceId, error.Format()); + peerId.GetNodeId(), error.Format()); auto * command = static_cast(context); VerifyOrReturn(command != nullptr, ChipLogError(chipTool, "Test command context is null")); command->SetCommandExitStatus(error); diff --git a/examples/chip-tool/commands/tests/TestCommand.h b/examples/chip-tool/commands/tests/TestCommand.h index 81fbe3a0159d4a..9fe32c392aa54d 100644 --- a/examples/chip-tool/commands/tests/TestCommand.h +++ b/examples/chip-tool/commands/tests/TestCommand.h @@ -66,7 +66,7 @@ class TestCommand : public CHIPCommand chip::NodeId mNodeId; static void OnDeviceConnectedFn(void * context, chip::OperationalDeviceProxy * device); - static void OnDeviceConnectionFailureFn(void * context, NodeId deviceId, CHIP_ERROR error); + static void OnDeviceConnectionFailureFn(void * context, PeerId peerId, CHIP_ERROR error); static void OnWaitForMsFn(chip::System::Layer * systemLayer, void * context); CHIP_ERROR ContinueOnChipMainThread() { return WaitForMs(0); }; diff --git a/src/app/CASESessionManager.cpp b/src/app/CASESessionManager.cpp index 841e510ed66b26..5d3ed0e5e3f07e 100644 --- a/src/app/CASESessionManager.cpp +++ b/src/app/CASESessionManager.cpp @@ -21,17 +21,14 @@ namespace chip { -CHIP_ERROR CASESessionManager::FindOrEstablishSession(FabricInfo * fabric, NodeId nodeId, - Callback::Callback * onConnection, +CHIP_ERROR CASESessionManager::FindOrEstablishSession(PeerId peerId, Callback::Callback * onConnection, Callback::Callback * onFailure) { Dnssd::ResolvedNodeData resolutionData; - PeerId peerId = fabric->GetPeerIdForNode(nodeId); - bool nodeIDWasResolved = (mConfig.dnsCache != nullptr && mConfig.dnsCache->Lookup(peerId, resolutionData) == CHIP_NO_ERROR); - OperationalDeviceProxy * session = FindExistingSession(nodeId); + OperationalDeviceProxy * session = FindExistingSession(peerId); if (session == nullptr) { // TODO - Implement LRU to evict least recently used session to handle mActiveSessions pool exhaustion @@ -46,7 +43,7 @@ CHIP_ERROR CASESessionManager::FindOrEstablishSession(FabricInfo * fabric, NodeI if (session == nullptr) { - onFailure->mCall(onFailure->mContext, nodeId, CHIP_ERROR_NO_MEMORY); + onFailure->mCall(onFailure->mContext, peerId, CHIP_ERROR_NO_MEMORY); return CHIP_ERROR_NO_MEMORY; } } @@ -64,9 +61,9 @@ CHIP_ERROR CASESessionManager::FindOrEstablishSession(FabricInfo * fabric, NodeI return err; } -void CASESessionManager::ReleaseSession(NodeId nodeId) +void CASESessionManager::ReleaseSession(PeerId peerId) { - ReleaseSession(FindExistingSession(nodeId)); + ReleaseSession(FindExistingSession(peerId)); } CHIP_ERROR CASESessionManager::ResolveDeviceAddress(FabricInfo * fabric, NodeId nodeId) @@ -84,7 +81,7 @@ void CASESessionManager::OnNodeIdResolved(const Dnssd::ResolvedNodeData & nodeDa LogErrorOnFailure(mConfig.dnsCache->Insert(nodeData)); } - OperationalDeviceProxy * session = FindExistingSession(nodeData.mPeerId.GetNodeId()); + OperationalDeviceProxy * session = FindExistingSession(nodeData.mPeerId); VerifyOrReturn(session != nullptr, ChipLogDetail(Controller, "OnNodeIdResolved was called for a device with no active sessions, ignoring it.")); @@ -96,17 +93,17 @@ void CASESessionManager::OnNodeIdResolutionFailed(const PeerId & peer, CHIP_ERRO ChipLogError(Controller, "Error resolving node id: %s", ErrorStr(error)); } -CHIP_ERROR CASESessionManager::GetPeerAddress(FabricInfo * fabric, NodeId nodeId, Transport::PeerAddress & addr) +CHIP_ERROR CASESessionManager::GetPeerAddress(PeerId peerId, Transport::PeerAddress & addr) { if (mConfig.dnsCache != nullptr) { Dnssd::ResolvedNodeData resolutionData; - ReturnErrorOnFailure(mConfig.dnsCache->Lookup(fabric->GetPeerIdForNode(nodeId), resolutionData)); + ReturnErrorOnFailure(mConfig.dnsCache->Lookup(peerId, resolutionData)); addr = OperationalDeviceProxy::ToPeerAddress(resolutionData); return CHIP_NO_ERROR; } - OperationalDeviceProxy * session = FindExistingSession(nodeId); + OperationalDeviceProxy * session = FindExistingSession(peerId); VerifyOrReturnError(session != nullptr, CHIP_ERROR_NOT_CONNECTED); addr = session->GetPeerAddress(); return CHIP_NO_ERROR; @@ -125,9 +122,9 @@ OperationalDeviceProxy * CASESessionManager::FindSession(const SessionHandle & s return mConfig.devicePool->FindDevice(session); } -OperationalDeviceProxy * CASESessionManager::FindExistingSession(NodeId id) +OperationalDeviceProxy * CASESessionManager::FindExistingSession(PeerId peerId) { - return mConfig.devicePool->FindDevice(id); + return mConfig.devicePool->FindDevice(peerId); } void CASESessionManager::ReleaseSession(OperationalDeviceProxy * session) diff --git a/src/app/CASESessionManager.h b/src/app/CASESessionManager.h index 221010fd591d8f..382fcd493784e8 100644 --- a/src/app/CASESessionManager.h +++ b/src/app/CASESessionManager.h @@ -79,12 +79,12 @@ class CASESessionManager : public SessionReleaseDelegate, public Dnssd::Resolver * these will be used to inform the caller about successful or failed connection establishment. * If the connection is already established, the `onConnection` callback will be immediately called. */ - CHIP_ERROR FindOrEstablishSession(FabricInfo * fabric, NodeId nodeId, Callback::Callback * onConnection, + CHIP_ERROR FindOrEstablishSession(PeerId peerId, Callback::Callback * onConnection, Callback::Callback * onFailure); - OperationalDeviceProxy * FindExistingSession(NodeId nodeId); + OperationalDeviceProxy * FindExistingSession(PeerId peerId); - void ReleaseSession(NodeId nodeId); + void ReleaseSession(PeerId peerId); /** * This API triggers the DNS-SD resolution for the given node ID. The node ID will be looked up @@ -103,7 +103,7 @@ class CASESessionManager : public SessionReleaseDelegate, public Dnssd::Resolver * an ongoing session with the peer node. If the session doesn't exist, the API will return * `CHIP_ERROR_NOT_CONNECTED` error. */ - CHIP_ERROR GetPeerAddress(FabricInfo * fabric, NodeId nodeId, Transport::PeerAddress & addr); + CHIP_ERROR GetPeerAddress(PeerId peerId, Transport::PeerAddress & addr); //////////// SessionReleaseDelegate Implementation /////////////// void OnSessionReleased(const SessionHandle & session) override; diff --git a/src/app/OperationalDeviceProxy.cpp b/src/app/OperationalDeviceProxy.cpp index 1e4d04d3690e58..076385821eaaae 100644 --- a/src/app/OperationalDeviceProxy.cpp +++ b/src/app/OperationalDeviceProxy.cpp @@ -84,7 +84,7 @@ CHIP_ERROR OperationalDeviceProxy::Connect(Callback::Callback if (err != CHIP_NO_ERROR && onFailure != nullptr) { - onFailure->mCall(onFailure->mContext, mPeerId.GetNodeId(), err); + onFailure->mCall(onFailure->mContext, mPeerId, err); } return err; @@ -205,7 +205,7 @@ void OperationalDeviceProxy::DequeueConnectionFailureCallbacks(CHIP_ERROR error, cb->Cancel(); if (executeCallback) { - cb->mCall(cb->mContext, mPeerId.GetNodeId(), error); + cb->mCall(cb->mContext, mPeerId, error); } } } diff --git a/src/app/OperationalDeviceProxy.h b/src/app/OperationalDeviceProxy.h index 62f7dfbf2eb2c8..3a8aa365da0514 100644 --- a/src/app/OperationalDeviceProxy.h +++ b/src/app/OperationalDeviceProxy.h @@ -74,7 +74,7 @@ struct DeviceProxyInitParams class OperationalDeviceProxy; typedef void (*OnDeviceConnected)(void * context, OperationalDeviceProxy * device); -typedef void (*OnDeviceConnectionFailure)(void * context, NodeId deviceId, CHIP_ERROR error); +typedef void (*OnDeviceConnectionFailure)(void * context, PeerId peerId, CHIP_ERROR error); class DLL_EXPORT OperationalDeviceProxy : public DeviceProxy, SessionReleaseDelegate, public SessionEstablishmentDelegate { diff --git a/src/app/OperationalDeviceProxyPool.h b/src/app/OperationalDeviceProxyPool.h index 403b27f099a2b0..8fed456db7998d 100644 --- a/src/app/OperationalDeviceProxyPool.h +++ b/src/app/OperationalDeviceProxyPool.h @@ -35,7 +35,7 @@ class OperationalDeviceProxyPoolDelegate virtual OperationalDeviceProxy * FindDevice(const SessionHandle & session) = 0; - virtual OperationalDeviceProxy * FindDevice(NodeId id) = 0; + virtual OperationalDeviceProxy * FindDevice(PeerId peerId) = 0; virtual ~OperationalDeviceProxyPoolDelegate() {} }; @@ -74,11 +74,11 @@ class OperationalDeviceProxyPool : public OperationalDeviceProxyPoolDelegate return foundDevice; } - OperationalDeviceProxy * FindDevice(NodeId id) override + OperationalDeviceProxy * FindDevice(PeerId peerId) override { OperationalDeviceProxy * foundDevice = nullptr; mDevicePool.ForEachActiveObject([&](auto * activeDevice) { - if (activeDevice->GetDeviceId() == id) + if (activeDevice->GetPeerId() == peerId) { foundDevice = activeDevice; return Loop::Break; diff --git a/src/app/clusters/ota-requestor/OTARequestor.cpp b/src/app/clusters/ota-requestor/OTARequestor.cpp index 7e4806a0a3f384..8772bd6229e9cb 100644 --- a/src/app/clusters/ota-requestor/OTARequestor.cpp +++ b/src/app/clusters/ota-requestor/OTARequestor.cpp @@ -237,8 +237,8 @@ void OTARequestor::ConnectToProvider(OnConnectedAction onConnectedAction) ChipLogDetail(SoftwareUpdate, "Establishing session to provider node ID 0x" ChipLogFormatX64 " on fabric index %d", ChipLogValueX64(mProviderNodeId), mProviderFabricIndex); - CHIP_ERROR err = mCASESessionManager->FindOrEstablishSession(fabricInfo, mProviderNodeId, &mOnConnectedCallback, - &mOnConnectionFailureCallback); + CHIP_ERROR err = mCASESessionManager->FindOrEstablishSession(fabricInfo->GetPeerIdForNode(mProviderNodeId), + &mOnConnectedCallback, &mOnConnectionFailureCallback); VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(SoftwareUpdate, "Cannot establish connection to provider: %" CHIP_ERROR_FORMAT, err.Format())); } @@ -350,9 +350,10 @@ OTARequestorInterface::OTATriggerResult OTARequestor::TriggerImmediateQuery() } // Called whenever FindOrEstablishSession fails -void OTARequestor::OnConnectionFailure(void * context, NodeId deviceId, CHIP_ERROR error) +void OTARequestor::OnConnectionFailure(void * context, PeerId peerId, CHIP_ERROR error) { - ChipLogError(SoftwareUpdate, "Failed to connect to node 0x%" PRIX64 ": %" CHIP_ERROR_FORMAT, deviceId, error.Format()); + ChipLogError(SoftwareUpdate, "Failed to connect to node 0x%" PRIX64 ": %" CHIP_ERROR_FORMAT, peerId.GetNodeId(), + error.Format()); } void OTARequestor::ApplyUpdate() diff --git a/src/app/clusters/ota-requestor/OTARequestor.h b/src/app/clusters/ota-requestor/OTARequestor.h index 1a300dca43d4a7..1d494005aba284 100644 --- a/src/app/clusters/ota-requestor/OTARequestor.h +++ b/src/app/clusters/ota-requestor/OTARequestor.h @@ -213,7 +213,7 @@ class OTARequestor : public OTARequestorInterface * Session connection callbacks */ static void OnConnected(void * context, OperationalDeviceProxy * deviceProxy); - static void OnConnectionFailure(void * context, NodeId deviceId, CHIP_ERROR error); + static void OnConnectionFailure(void * context, PeerId peerId, CHIP_ERROR error); Callback::Callback mOnConnectedCallback; Callback::Callback mOnConnectionFailureCallback; diff --git a/src/controller/CHIPDeviceController.cpp b/src/controller/CHIPDeviceController.cpp index a79452253c03bd..d69df2cd5d0fd2 100644 --- a/src/controller/CHIPDeviceController.cpp +++ b/src/controller/CHIPDeviceController.cpp @@ -265,7 +265,7 @@ void DeviceController::ReleaseOperationalDevice(NodeId remoteDeviceId) { VerifyOrReturn(mState == State::Initialized, ChipLogError(Controller, "ReleaseOperationalDevice was called in incorrect state")); - mCASESessionManager->ReleaseSession(remoteDeviceId); + mCASESessionManager->ReleaseSession(mFabricInfo->GetPeerIdForNode(remoteDeviceId)); } void DeviceController::OnSessionReleased(const SessionHandle & session) @@ -352,7 +352,7 @@ CHIP_ERROR DeviceController::GetPeerAddressAndPort(PeerId peerId, Inet::IPAddres { VerifyOrReturnError(mState == State::Initialized, CHIP_ERROR_INCORRECT_STATE); Transport::PeerAddress peerAddr; - ReturnErrorOnFailure(mCASESessionManager->GetPeerAddress(mFabricInfo, peerId.GetNodeId(), peerAddr)); + ReturnErrorOnFailure(mCASESessionManager->GetPeerAddress(peerId, peerAddr)); addr = peerAddr.GetIPAddress(); port = peerAddr.GetPort(); return CHIP_NO_ERROR; @@ -379,7 +379,7 @@ void DeviceController::OnVIDReadResponse(void * context, uint16_t value) controller->mSetupPayload.vendorID = value; OperationalDeviceProxy * device = - controller->mCASESessionManager->FindExistingSession(controller->mDeviceWithCommissioningWindowOpen); + controller->mCASESessionManager->FindExistingSession(controller->GetPeerIdWithCommissioningWindowOpen()); if (device == nullptr) { ChipLogError(Controller, "Could not find device for opening commissioning window"); @@ -476,7 +476,7 @@ CHIP_ERROR DeviceController::OpenCommissioningWindowWithCallback(NodeId deviceId if (callback != nullptr && mCommissioningWindowOption != CommissioningWindowOption::kOriginalSetupCode && readVIDPIDAttributes) { - OperationalDeviceProxy * device = mCASESessionManager->FindExistingSession(mDeviceWithCommissioningWindowOpen); + OperationalDeviceProxy * device = mCASESessionManager->FindExistingSession(GetPeerIdWithCommissioningWindowOpen()); VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT); constexpr EndpointId kBasicClusterEndpoint = 0; @@ -495,7 +495,7 @@ CHIP_ERROR DeviceController::OpenCommissioningWindowInternal() ChipLogProgress(Controller, "OpenCommissioningWindow for device ID %" PRIu64, mDeviceWithCommissioningWindowOpen); VerifyOrReturnError(mState == State::Initialized, CHIP_ERROR_INCORRECT_STATE); - OperationalDeviceProxy * device = mCASESessionManager->FindExistingSession(mDeviceWithCommissioningWindowOpen); + OperationalDeviceProxy * device = mCASESessionManager->FindExistingSession(GetPeerIdWithCommissioningWindowOpen()); VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT); constexpr EndpointId kAdministratorCommissioningClusterEndpoint = 0; @@ -1645,8 +1645,7 @@ void DeviceCommissioner::OnNodeIdResolved(const chip::Dnssd::ResolvedNodeData & mDNSCache.Insert(nodeData); - mCASESessionManager->FindOrEstablishSession(mFabricInfo, nodeData.mPeerId.GetNodeId(), &mOnDeviceConnectedCallback, - &mOnDeviceConnectionFailureCallback); + mCASESessionManager->FindOrEstablishSession(nodeData.mPeerId, &mOnDeviceConnectedCallback, &mOnDeviceConnectionFailureCallback); DeviceController::OnNodeIdResolved(nodeData); } @@ -1688,7 +1687,7 @@ void DeviceCommissioner::OnDeviceConnectedFn(void * context, OperationalDevicePr } } -void DeviceCommissioner::OnDeviceConnectionFailureFn(void * context, NodeId deviceId, CHIP_ERROR error) +void DeviceCommissioner::OnDeviceConnectionFailureFn(void * context, PeerId peerId, CHIP_ERROR error) { DeviceCommissioner * commissioner = static_cast(context); ChipLogProgress(Controller, "Device connection failed. Error %s", ErrorStr(error)); @@ -1696,7 +1695,7 @@ void DeviceCommissioner::OnDeviceConnectionFailureFn(void * context, NodeId devi ChipLogProgress(Controller, "Device connection failure callback with null context. Ignoring")); VerifyOrReturn(commissioner->mPairingDelegate != nullptr, ChipLogProgress(Controller, "Device connection failure callback with null pairing delegate. Ignoring")); - commissioner->mPairingDelegate->OnCommissioningComplete(deviceId, error); + commissioner->mPairingDelegate->OnCommissioningComplete(peerId.GetNodeId(), error); } void DeviceCommissioner::PerformCommissioningStep(DeviceProxy * proxy, CommissioningStage step, CommissioningParameters & params, diff --git a/src/controller/CHIPDeviceController.h b/src/controller/CHIPDeviceController.h index 7bebe240507bd5..eddef1f8802bcd 100644 --- a/src/controller/CHIPDeviceController.h +++ b/src/controller/CHIPDeviceController.h @@ -221,7 +221,7 @@ class DLL_EXPORT DeviceController : public SessionReleaseDelegate, Callback::Callback * onFailure) { VerifyOrReturnError(mState == State::Initialized, CHIP_ERROR_INCORRECT_STATE); - return mCASESessionManager->FindOrEstablishSession(mFabricInfo, deviceId, onConnection, onFailure); + return mCASESessionManager->FindOrEstablishSession(mFabricInfo->GetPeerIdForNode(deviceId), onConnection, onFailure); } /** @@ -399,6 +399,8 @@ class DLL_EXPORT DeviceController : public SessionReleaseDelegate, CHIP_ERROR OpenCommissioningWindowInternal(); + PeerId GetPeerIdWithCommissioningWindowOpen() { return mFabricInfo->GetPeerIdForNode(mDeviceWithCommissioningWindowOpen); } + // TODO - Support opening commissioning window simultaneously on multiple devices Callback::Callback * mCommissioningWindowCallback = nullptr; SetupPayload mSetupPayload; @@ -745,7 +747,7 @@ class DLL_EXPORT DeviceCommissioner : public DeviceController, static void OnRootCertFailureResponse(void * context, uint8_t status); static void OnDeviceConnectedFn(void * context, OperationalDeviceProxy * device); - static void OnDeviceConnectionFailureFn(void * context, NodeId deviceId, CHIP_ERROR error); + static void OnDeviceConnectionFailureFn(void * context, PeerId peerId, CHIP_ERROR error); static void OnDeviceNOCChainGeneration(void * context, CHIP_ERROR status, const ByteSpan & noc, const ByteSpan & icac, const ByteSpan & rcac); diff --git a/src/controller/java/AndroidCallbacks.cpp b/src/controller/java/AndroidCallbacks.cpp index d4b844a6b04a22..33a5b9578dc044 100644 --- a/src/controller/java/AndroidCallbacks.cpp +++ b/src/controller/java/AndroidCallbacks.cpp @@ -65,7 +65,7 @@ void GetConnectedDeviceCallback::OnDeviceConnectedFn(void * context, Operational env->CallVoidMethod(javaCallback, successMethod, reinterpret_cast(device)); } -void GetConnectedDeviceCallback::OnDeviceConnectionFailureFn(void * context, NodeId nodeId, CHIP_ERROR error) +void GetConnectedDeviceCallback::OnDeviceConnectionFailureFn(void * context, PeerId peerId, CHIP_ERROR error) { JNIEnv * env = JniReferences::GetInstance().GetEnvForCurrentThread(); auto * self = static_cast(context); @@ -92,5 +92,5 @@ void GetConnectedDeviceCallback::OnDeviceConnectionFailureFn(void * context, Nod jmethodID exceptionConstructor = env->GetMethodID(controllerExceptionCls, "", "(ILjava/lang/String;)V"); jobject exception = env->NewObject(controllerExceptionCls, exceptionConstructor, error, env->NewStringUTF(ErrorStr(error))); - env->CallVoidMethod(javaCallback, failureMethod, nodeId, exception); + env->CallVoidMethod(javaCallback, failureMethod, peerId.GetNodeId(), exception); } diff --git a/src/controller/java/AndroidCallbacks.h b/src/controller/java/AndroidCallbacks.h index 9691e77f5fd770..3ccdacc198eb39 100644 --- a/src/controller/java/AndroidCallbacks.h +++ b/src/controller/java/AndroidCallbacks.h @@ -29,7 +29,7 @@ struct GetConnectedDeviceCallback ~GetConnectedDeviceCallback(); static void OnDeviceConnectedFn(void * context, OperationalDeviceProxy * device); - static void OnDeviceConnectionFailureFn(void * context, NodeId nodeId, CHIP_ERROR error); + static void OnDeviceConnectionFailureFn(void * context, PeerId peerId, CHIP_ERROR error); Callback::Callback mOnSuccess; Callback::Callback mOnFailure; diff --git a/src/controller/python/ChipDeviceController-ScriptBinding.cpp b/src/controller/python/ChipDeviceController-ScriptBinding.cpp index 7eed756a37a845..4f812e6d86669c 100644 --- a/src/controller/python/ChipDeviceController-ScriptBinding.cpp +++ b/src/controller/python/ChipDeviceController-ScriptBinding.cpp @@ -596,7 +596,7 @@ struct GetDeviceCallbacks delete self; } - static void OnConnectionFailureFn(void * context, NodeId deviceId, CHIP_ERROR error) + static void OnConnectionFailureFn(void * context, PeerId peerId, CHIP_ERROR error) { auto * self = static_cast(context); self->mCallback(nullptr, error.AsInteger()); diff --git a/src/darwin/Framework/CHIP/CHIPDeviceConnectionBridge.h b/src/darwin/Framework/CHIP/CHIPDeviceConnectionBridge.h index a83cc533ded234..354bfa73453b8f 100644 --- a/src/darwin/Framework/CHIP/CHIPDeviceConnectionBridge.h +++ b/src/darwin/Framework/CHIP/CHIPDeviceConnectionBridge.h @@ -49,7 +49,7 @@ class CHIPDeviceConnectionBridge : public chip::ReferenceCounted mOnConnectFailed; static void OnConnected(void * context, chip::OperationalDeviceProxy * device); - static void OnConnectionFailure(void * context, chip::NodeId deviceId, CHIP_ERROR error); + static void OnConnectionFailure(void * context, chip::PeerId peerId, CHIP_ERROR error); }; NS_ASSUME_NONNULL_END diff --git a/src/darwin/Framework/CHIP/CHIPDeviceConnectionBridge.mm b/src/darwin/Framework/CHIP/CHIPDeviceConnectionBridge.mm index ac0241a7c614f7..acad191da1969a 100644 --- a/src/darwin/Framework/CHIP/CHIPDeviceConnectionBridge.mm +++ b/src/darwin/Framework/CHIP/CHIPDeviceConnectionBridge.mm @@ -29,7 +29,7 @@ }); } -void CHIPDeviceConnectionBridge::OnConnectionFailure(void * context, chip::NodeId deviceId, CHIP_ERROR error) +void CHIPDeviceConnectionBridge::OnConnectionFailure(void * context, chip::PeerId peerId, CHIP_ERROR error) { auto * object = static_cast(context); dispatch_async(object->mQueue, ^{