Skip to content

Commit

Permalink
fix build & review comments
Browse files Browse the repository at this point in the history
  • Loading branch information
gjc13 committed Dec 16, 2021
1 parent 61d62f4 commit 7db565c
Show file tree
Hide file tree
Showing 7 changed files with 8 additions and 11 deletions.
2 changes: 0 additions & 2 deletions src/app/CASESessionManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,6 @@ CHIP_ERROR CASESessionManager::FindOrEstablishSession(PeerId peerId, Callback::C
{
Dnssd::ResolvedNodeData resolutionData;

// PeerId peerId = fabric->GetPeerIdForNode(nodeId);

bool nodeIDWasResolved = (mConfig.dnsCache != nullptr && mConfig.dnsCache->Lookup(peerId, resolutionData) == CHIP_NO_ERROR);

OperationalDeviceProxy * session = FindExistingSession(peerId);
Expand Down
5 changes: 2 additions & 3 deletions src/controller/CHIPDeviceController.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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->GetPeerIdForNode(peerId.GetNodeId()), peerAddr));
ReturnErrorOnFailure(mCASESessionManager->GetPeerAddress(peerId, peerAddr));
addr = peerAddr.GetIPAddress();
port = peerAddr.GetPort();
return CHIP_NO_ERROR;
Expand Down Expand Up @@ -1645,8 +1645,7 @@ void DeviceCommissioner::OnNodeIdResolved(const chip::Dnssd::ResolvedNodeData &

mDNSCache.Insert(nodeData);

mCASESessionManager->FindOrEstablishSession(mFabricInfo->GetPeerIdForNode(nodeData.mPeerId.GetNodeId()),
&mOnDeviceConnectedCallback, &mOnDeviceConnectionFailureCallback);
mCASESessionManager->FindOrEstablishSession(nodeData.mPeerId, &mOnDeviceConnectedCallback, &mOnDeviceConnectionFailureCallback);
DeviceController::OnNodeIdResolved(nodeData);
}

Expand Down
4 changes: 2 additions & 2 deletions src/controller/java/AndroidCallbacks.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ void GetConnectedDeviceCallback::OnDeviceConnectedFn(void * context, Operational
env->CallVoidMethod(javaCallback, successMethod, reinterpret_cast<jlong>(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<GetConnectedDeviceCallback *>(context);
Expand All @@ -92,5 +92,5 @@ void GetConnectedDeviceCallback::OnDeviceConnectionFailureFn(void * context, Nod
jmethodID exceptionConstructor = env->GetMethodID(controllerExceptionCls, "<init>", "(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);
}
2 changes: 1 addition & 1 deletion src/controller/java/AndroidCallbacks.h
Original file line number Diff line number Diff line change
Expand Up @@ -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<OnDeviceConnected> mOnSuccess;
Callback::Callback<OnDeviceConnectionFailure> mOnFailure;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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<GetDeviceCallbacks *>(context);
self->mCallback(nullptr, error.AsInteger());
Expand Down
2 changes: 1 addition & 1 deletion src/darwin/Framework/CHIP/CHIPDeviceConnectionBridge.h
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ class CHIPDeviceConnectionBridge : public chip::ReferenceCounted<CHIPDeviceConne
chip::Callback::Callback<chip::OnDeviceConnectionFailure> 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
2 changes: 1 addition & 1 deletion src/darwin/Framework/CHIP/CHIPDeviceConnectionBridge.mm
Original file line number Diff line number Diff line change
Expand Up @@ -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<CHIPDeviceConnectionBridge *>(context);
dispatch_async(object->mQueue, ^{
Expand Down

0 comments on commit 7db565c

Please sign in to comment.