Skip to content

Commit 17fd793

Browse files
authored
Enable building python controller with no TCP (project-chip#34888)
Test: built with chip_inet_config_enable_tcp_endpoint set to false
1 parent 16e23d3 commit 17fd793

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

src/controller/python/ChipDeviceController-ScriptBinding.cpp

+8
Original file line numberDiff line numberDiff line change
@@ -839,7 +839,11 @@ PyChipError pychip_IsSessionOverTCPConnection(chip::OperationalDeviceProxy * dev
839839
VerifyOrReturnError(deviceProxy->GetSecureSession().HasValue(), ToPyChipError(CHIP_ERROR_MISSING_SECURE_SESSION));
840840
VerifyOrReturnError(isSessionOverTCP != nullptr, ToPyChipError(CHIP_ERROR_INVALID_ARGUMENT));
841841

842+
#if INET_CONFIG_ENABLE_TCP_ENDPOINT
842843
*isSessionOverTCP = deviceProxy->GetSecureSession().Value()->AsSecureSession()->GetTCPConnection() != nullptr;
844+
#else
845+
*isSessionOverTCP = false;
846+
#endif
843847

844848
return ToPyChipError(CHIP_NO_ERROR);
845849
}
@@ -859,6 +863,7 @@ PyChipError pychip_IsActiveSession(chip::OperationalDeviceProxy * deviceProxy, b
859863

860864
PyChipError pychip_CloseTCPConnectionWithPeer(chip::OperationalDeviceProxy * deviceProxy)
861865
{
866+
#if INET_CONFIG_ENABLE_TCP_ENDPOINT
862867
VerifyOrReturnError(deviceProxy->GetSecureSession().HasValue(), ToPyChipError(CHIP_ERROR_MISSING_SECURE_SESSION));
863868
VerifyOrReturnError(deviceProxy->GetSecureSession().Value()->AsSecureSession()->AllowsLargePayload(),
864869
ToPyChipError(CHIP_ERROR_INVALID_ARGUMENT));
@@ -867,6 +872,9 @@ PyChipError pychip_CloseTCPConnectionWithPeer(chip::OperationalDeviceProxy * dev
867872
deviceProxy->GetSecureSession().Value()->AsSecureSession()->GetTCPConnection(), /* shouldAbort = */ false);
868873

869874
return ToPyChipError(CHIP_NO_ERROR);
875+
#else
876+
return ToPyChipError(CHIP_ERROR_NOT_IMPLEMENTED);
877+
#endif
870878
}
871879

872880
PyChipError pychip_FreeOperationalDeviceProxy(chip::OperationalDeviceProxy * deviceProxy)

0 commit comments

Comments
 (0)