@@ -213,7 +213,8 @@ PyChipError pychip_DeviceCommissioner_CloseBleConnection(chip::Controller::Devic
213
213
const char * pychip_Stack_StatusReportToString (uint32_t profileId, uint16_t statusCode);
214
214
215
215
PyChipError pychip_GetConnectedDeviceByNodeId (chip::Controller::DeviceCommissioner * devCtrl, chip::NodeId nodeId,
216
- chip::Controller::Python::PyObject * context, DeviceAvailableFunc callback);
216
+ chip::Controller::Python::PyObject * context, DeviceAvailableFunc callback,
217
+ int transportPayloadCapability);
217
218
PyChipError pychip_FreeOperationalDeviceProxy (chip::OperationalDeviceProxy * deviceProxy);
218
219
PyChipError pychip_GetLocalSessionId (chip::OperationalDeviceProxy * deviceProxy, uint16_t * localSessionId);
219
220
PyChipError pychip_GetNumSessionsToPeer (chip::OperationalDeviceProxy * deviceProxy, uint32_t * numSessions);
@@ -239,6 +240,13 @@ void pychip_Storage_ShutdownAdapter(chip::Controller::Python::StorageAdapter * s
239
240
// ICD
240
241
//
241
242
void pychip_CheckInDelegate_SetOnCheckInCompleteCallback (PyChipCheckInDelegate::OnCheckInCompleteCallback * callback);
243
+
244
+ //
245
+ // LargePayload and TCP
246
+ PyChipError pychip_SessionAllowsLargePayload (chip::OperationalDeviceProxy * deviceProxy, bool * allowsLargePayload);
247
+ PyChipError pychip_IsSessionOverTCPConnection (chip::OperationalDeviceProxy * deviceProxy, bool * isSessionOverTCP);
248
+ PyChipError pychip_IsActiveSession (chip::OperationalDeviceProxy * deviceProxy, bool * isActiveSession);
249
+ PyChipError pychip_CloseTCPConnectionWithPeer (chip::OperationalDeviceProxy * deviceProxy);
242
250
}
243
251
244
252
void * pychip_Storage_InitializeStorageAdapter (chip::Controller::Python::PyObject * context,
@@ -807,11 +815,58 @@ struct GetDeviceCallbacks
807
815
} // anonymous namespace
808
816
809
817
PyChipError pychip_GetConnectedDeviceByNodeId (chip::Controller::DeviceCommissioner * devCtrl, chip::NodeId nodeId,
810
- chip::Controller::Python::PyObject * context, DeviceAvailableFunc callback)
818
+ chip::Controller::Python::PyObject * context, DeviceAvailableFunc callback,
819
+ int transportPayloadCapability)
811
820
{
812
821
VerifyOrReturnError (devCtrl != nullptr , ToPyChipError (CHIP_ERROR_INVALID_ARGUMENT));
813
822
auto * callbacks = new GetDeviceCallbacks (context, callback);
814
- return ToPyChipError (devCtrl->GetConnectedDevice (nodeId, &callbacks->mOnSuccess , &callbacks->mOnFailure ));
823
+ return ToPyChipError (devCtrl->GetConnectedDevice (nodeId, &callbacks->mOnSuccess , &callbacks->mOnFailure ,
824
+ static_cast <chip::TransportPayloadCapability>(transportPayloadCapability)));
825
+ }
826
+
827
+ PyChipError pychip_SessionAllowsLargePayload (chip::OperationalDeviceProxy * deviceProxy, bool * allowsLargePayload)
828
+ {
829
+ VerifyOrReturnError (deviceProxy->GetSecureSession ().HasValue (), ToPyChipError (CHIP_ERROR_MISSING_SECURE_SESSION));
830
+ VerifyOrReturnError (allowsLargePayload != nullptr , ToPyChipError (CHIP_ERROR_INVALID_ARGUMENT));
831
+
832
+ *allowsLargePayload = deviceProxy->GetSecureSession ().Value ()->AsSecureSession ()->AllowsLargePayload ();
833
+
834
+ return ToPyChipError (CHIP_NO_ERROR);
835
+ }
836
+
837
+ PyChipError pychip_IsSessionOverTCPConnection (chip::OperationalDeviceProxy * deviceProxy, bool * isSessionOverTCP)
838
+ {
839
+ VerifyOrReturnError (deviceProxy->GetSecureSession ().HasValue (), ToPyChipError (CHIP_ERROR_MISSING_SECURE_SESSION));
840
+ VerifyOrReturnError (isSessionOverTCP != nullptr , ToPyChipError (CHIP_ERROR_INVALID_ARGUMENT));
841
+
842
+ *isSessionOverTCP = deviceProxy->GetSecureSession ().Value ()->AsSecureSession ()->GetTCPConnection () != nullptr ;
843
+
844
+ return ToPyChipError (CHIP_NO_ERROR);
845
+ }
846
+
847
+ PyChipError pychip_IsActiveSession (chip::OperationalDeviceProxy * deviceProxy, bool * isActiveSession)
848
+ {
849
+ VerifyOrReturnError (isActiveSession != nullptr , ToPyChipError (CHIP_ERROR_INVALID_ARGUMENT));
850
+
851
+ *isActiveSession = false ;
852
+ if (deviceProxy->GetSecureSession ().HasValue ())
853
+ {
854
+ *isActiveSession = deviceProxy->GetSecureSession ().Value ()->AsSecureSession ()->IsActiveSession ();
855
+ }
856
+
857
+ return ToPyChipError (CHIP_NO_ERROR);
858
+ }
859
+
860
+ PyChipError pychip_CloseTCPConnectionWithPeer (chip::OperationalDeviceProxy * deviceProxy)
861
+ {
862
+ VerifyOrReturnError (deviceProxy->GetSecureSession ().HasValue (), ToPyChipError (CHIP_ERROR_MISSING_SECURE_SESSION));
863
+ VerifyOrReturnError (deviceProxy->GetSecureSession ().Value ()->AsSecureSession ()->AllowsLargePayload (),
864
+ ToPyChipError (CHIP_ERROR_INVALID_ARGUMENT));
865
+
866
+ deviceProxy->GetExchangeManager ()->GetSessionManager ()->TCPDisconnect (
867
+ deviceProxy->GetSecureSession ().Value ()->AsSecureSession ()->GetTCPConnection (), /* shouldAbort = */ false );
868
+
869
+ return ToPyChipError (CHIP_NO_ERROR);
815
870
}
816
871
817
872
PyChipError pychip_FreeOperationalDeviceProxy (chip::OperationalDeviceProxy * deviceProxy)
0 commit comments