From ce60ac38cdd629569424221a978c156c4ec5d563 Mon Sep 17 00:00:00 2001 From: Andrei Litvin Date: Thu, 4 Feb 2021 12:47:55 -0500 Subject: [PATCH 1/2] Replace nl_Chip with pychip - I believe nl stands for NestLabs however within chip that has no meaning --- .../ChipDeviceController-ScriptBinding.cpp | 80 +++++++++---------- src/controller/python/chip/ChipDeviceCtrl.py | 62 +++++++------- src/controller/python/chip/ChipStack.py | 30 +++---- 3 files changed, 86 insertions(+), 86 deletions(-) diff --git a/src/controller/python/ChipDeviceController-ScriptBinding.cpp b/src/controller/python/ChipDeviceController-ScriptBinding.cpp index eb80e829b6bee2..8219c468fd65a9 100644 --- a/src/controller/python/ChipDeviceController-ScriptBinding.cpp +++ b/src/controller/python/ChipDeviceController-ScriptBinding.cpp @@ -77,44 +77,44 @@ chip::NodeId kRemoteDeviceId = chip::kTestDeviceNodeId; extern "C" { // Trampolined callback types -CHIP_ERROR nl_Chip_DeviceController_DriveIO(uint32_t sleepTimeMS); +CHIP_ERROR pychip_DeviceController_DriveIO(uint32_t sleepTimeMS); -CHIP_ERROR nl_Chip_DeviceController_NewDeviceController(chip::DeviceController::ChipDeviceController ** outDevCtrl); -CHIP_ERROR nl_Chip_DeviceController_DeleteDeviceController(chip::DeviceController::ChipDeviceController * devCtrl); +CHIP_ERROR pychip_DeviceController_NewDeviceController(chip::DeviceController::ChipDeviceController ** outDevCtrl); +CHIP_ERROR pychip_DeviceController_DeleteDeviceController(chip::DeviceController::ChipDeviceController * devCtrl); // Rendezvous -CHIP_ERROR nl_Chip_DeviceController_ConnectBLE(chip::DeviceController::ChipDeviceController * devCtrl, uint16_t discriminator, +CHIP_ERROR pychip_DeviceController_ConnectBLE(chip::DeviceController::ChipDeviceController * devCtrl, uint16_t discriminator, uint32_t setupPINCode, OnConnectFunct onConnect, OnMessageFunct onMessage, OnErrorFunct onError); -CHIP_ERROR nl_Chip_DeviceController_ConnectIP(chip::DeviceController::ChipDeviceController * devCtrl, const char * peerAddrStr, +CHIP_ERROR pychip_DeviceController_ConnectIP(chip::DeviceController::ChipDeviceController * devCtrl, const char * peerAddrStr, uint32_t setupPINCode, OnConnectFunct onConnect, OnMessageFunct onMessage, OnErrorFunct onError); // Network Provisioning CHIP_ERROR -nl_Chip_ScriptDevicePairingDelegate_NewPairingDelegate(chip::DeviceController::ScriptDevicePairingDelegate ** pairingDelegate); +pychip_ScriptDevicePairingDelegate_NewPairingDelegate(chip::DeviceController::ScriptDevicePairingDelegate ** pairingDelegate); CHIP_ERROR -nl_Chip_ScriptDevicePairingDelegate_SetWifiCredential(chip::DeviceController::ScriptDevicePairingDelegate * pairingDelegate, +pychip_ScriptDevicePairingDelegate_SetWifiCredential(chip::DeviceController::ScriptDevicePairingDelegate * pairingDelegate, const char * ssid, const char * password); -CHIP_ERROR nl_Chip_DeviceController_SetDevicePairingDelegate(chip::DeviceController::ChipDeviceController * devCtrl, +CHIP_ERROR pychip_DeviceController_SetDevicePairingDelegate(chip::DeviceController::ChipDeviceController * devCtrl, chip::Controller::DevicePairingDelegate * pairingDelegate); -bool nl_Chip_DeviceController_IsConnected(chip::DeviceController::ChipDeviceController * devCtrl); -void nl_Chip_DeviceController_Close(chip::DeviceController::ChipDeviceController * devCtrl); -uint8_t nl_Chip_DeviceController_GetLogFilter(); -void nl_Chip_DeviceController_SetLogFilter(uint8_t category); +bool pychip_DeviceController_IsConnected(chip::DeviceController::ChipDeviceController * devCtrl); +void pychip_DeviceController_Close(chip::DeviceController::ChipDeviceController * devCtrl); +uint8_t pychip_DeviceController_GetLogFilter(); +void pychip_DeviceController_SetLogFilter(uint8_t category); -CHIP_ERROR nl_Chip_Stack_Init(); -CHIP_ERROR nl_Chip_Stack_Shutdown(); -const char * nl_Chip_Stack_ErrorToString(CHIP_ERROR err); -const char * nl_Chip_Stack_StatusReportToString(uint32_t profileId, uint16_t statusCode); -void nl_Chip_Stack_SetLogFunct(LogMessageFunct logFunct); +CHIP_ERROR pychip_Stack_Init(); +CHIP_ERROR pychip_Stack_Shutdown(); +const char * pychip_Stack_ErrorToString(CHIP_ERROR err); +const char * pychip_Stack_StatusReportToString(uint32_t profileId, uint16_t statusCode); +void pychip_Stack_SetLogFunct(LogMessageFunct logFunct); -CHIP_ERROR nl_Chip_GetDeviceByNodeId(chip::DeviceController::ChipDeviceController * devCtrl, chip::NodeId nodeId, +CHIP_ERROR pychip_GetDeviceByNodeId(chip::DeviceController::ChipDeviceController * devCtrl, chip::NodeId nodeId, chip::Controller::Device ** device); } -CHIP_ERROR nl_Chip_DeviceController_NewDeviceController(chip::DeviceController::ChipDeviceController ** outDevCtrl) +CHIP_ERROR pychip_DeviceController_NewDeviceController(chip::DeviceController::ChipDeviceController ** outDevCtrl) { CHIP_ERROR err = CHIP_NO_ERROR; @@ -133,7 +133,7 @@ CHIP_ERROR nl_Chip_DeviceController_NewDeviceController(chip::DeviceController:: return err; } -CHIP_ERROR nl_Chip_DeviceController_DeleteDeviceController(chip::DeviceController::ChipDeviceController * devCtrl) +CHIP_ERROR pychip_DeviceController_DeleteDeviceController(chip::DeviceController::ChipDeviceController * devCtrl) { if (devCtrl != NULL) { @@ -143,25 +143,25 @@ CHIP_ERROR nl_Chip_DeviceController_DeleteDeviceController(chip::DeviceControlle return CHIP_NO_ERROR; } -void nl_Chip_DeviceController_Close(chip::DeviceController::ChipDeviceController * devCtrl) {} +void pychip_DeviceController_Close(chip::DeviceController::ChipDeviceController * devCtrl) {} -bool nl_Chip_DeviceController_IsConnected(chip::DeviceController::ChipDeviceController * devCtrl) +bool pychip_DeviceController_IsConnected(chip::DeviceController::ChipDeviceController * devCtrl) { return devCtrl->IsConnected(); } -const char * nl_Chip_DeviceController_ErrorToString(CHIP_ERROR err) +const char * pychip_DeviceController_ErrorToString(CHIP_ERROR err) { return chip::ErrorStr(err); } -const char * nl_Chip_DeviceController_StatusReportToString(uint32_t profileId, uint16_t statusCode) +const char * pychip_DeviceController_StatusReportToString(uint32_t profileId, uint16_t statusCode) { // return chip::StatusReportStr(profileId, statusCode); return NULL; } -uint8_t nl_Chip_DeviceController_GetLogFilter() +uint8_t pychip_DeviceController_GetLogFilter() { #if _CHIP_USE_LOGGING return chip::Logging::GetLogFilter(); @@ -170,21 +170,21 @@ uint8_t nl_Chip_DeviceController_GetLogFilter() #endif } -void nl_Chip_DeviceController_SetLogFilter(uint8_t category) +void pychip_DeviceController_SetLogFilter(uint8_t category) { #if _CHIP_USE_LOGGING chip::Logging::SetLogFilter(category); #endif } -CHIP_ERROR nl_Chip_DeviceController_Connect(chip::DeviceController::ChipDeviceController * devCtrl, BLE_CONNECTION_OBJECT connObj, +CHIP_ERROR pychip_DeviceController_Connect(chip::DeviceController::ChipDeviceController * devCtrl, BLE_CONNECTION_OBJECT connObj, uint32_t setupPINCode, OnConnectFunct onConnect, OnMessageFunct onMessage, OnErrorFunct onError) { return CHIP_ERROR_NOT_IMPLEMENTED; } -CHIP_ERROR nl_Chip_DeviceController_ConnectBLE(chip::DeviceController::ChipDeviceController * devCtrl, uint16_t discriminator, +CHIP_ERROR pychip_DeviceController_ConnectBLE(chip::DeviceController::ChipDeviceController * devCtrl, uint16_t discriminator, uint32_t setupPINCode, OnConnectFunct onConnect, OnMessageFunct onMessage, OnErrorFunct onError) { @@ -196,7 +196,7 @@ CHIP_ERROR nl_Chip_DeviceController_ConnectBLE(chip::DeviceController::ChipDevic (void *) devCtrl, onConnect, onMessage, onError); } -CHIP_ERROR nl_Chip_DeviceController_ConnectIP(chip::DeviceController::ChipDeviceController * devCtrl, const char * peerAddrStr, +CHIP_ERROR pychip_DeviceController_ConnectIP(chip::DeviceController::ChipDeviceController * devCtrl, const char * peerAddrStr, uint32_t setupPINCode, OnConnectFunct onConnect, OnMessageFunct onMessage, OnErrorFunct onError) { @@ -213,7 +213,7 @@ CHIP_ERROR nl_Chip_DeviceController_ConnectIP(chip::DeviceController::ChipDevice } CHIP_ERROR -nl_Chip_ScriptDevicePairingDelegate_NewPairingDelegate(chip::DeviceController::ScriptDevicePairingDelegate ** pairingDelegate) +pychip_ScriptDevicePairingDelegate_NewPairingDelegate(chip::DeviceController::ScriptDevicePairingDelegate ** pairingDelegate) { CHIP_ERROR err = CHIP_NO_ERROR; @@ -231,7 +231,7 @@ nl_Chip_ScriptDevicePairingDelegate_NewPairingDelegate(chip::DeviceController::S } CHIP_ERROR -nl_Chip_ScriptDevicePairingDelegate_SetWifiCredential(chip::DeviceController::ScriptDevicePairingDelegate * pairingDelegate, +pychip_ScriptDevicePairingDelegate_SetWifiCredential(chip::DeviceController::ScriptDevicePairingDelegate * pairingDelegate, const char * ssid, const char * password) { CHIP_ERROR err = CHIP_NO_ERROR; @@ -245,7 +245,7 @@ nl_Chip_ScriptDevicePairingDelegate_SetWifiCredential(chip::DeviceController::Sc exit: return err; } -CHIP_ERROR nl_Chip_DeviceController_SetDevicePairingDelegate(chip::DeviceController::ChipDeviceController * devCtrl, +CHIP_ERROR pychip_DeviceController_SetDevicePairingDelegate(chip::DeviceController::ChipDeviceController * devCtrl, chip::Controller::DevicePairingDelegate * pairingDelegate) { CHIP_ERROR err = CHIP_NO_ERROR; @@ -259,7 +259,7 @@ CHIP_ERROR nl_Chip_DeviceController_SetDevicePairingDelegate(chip::DeviceControl return err; } -CHIP_ERROR nl_Chip_Stack_Init() +CHIP_ERROR pychip_Stack_Init() { CHIP_ERROR err = CHIP_NO_ERROR; @@ -276,28 +276,28 @@ CHIP_ERROR nl_Chip_Stack_Init() exit: if (err != CHIP_NO_ERROR) - nl_Chip_Stack_Shutdown(); + pychip_Stack_Shutdown(); return err; } -CHIP_ERROR nl_Chip_Stack_Shutdown() +CHIP_ERROR pychip_Stack_Shutdown() { return CHIP_NO_ERROR; } -const char * nl_Chip_Stack_ErrorToString(CHIP_ERROR err) +const char * pychip_Stack_ErrorToString(CHIP_ERROR err) { return chip::ErrorStr(err); } -const char * nl_Chip_Stack_StatusReportToString(uint32_t profileId, uint16_t statusCode) +const char * pychip_Stack_StatusReportToString(uint32_t profileId, uint16_t statusCode) { // return chip::StatusReportStr(profileId, statusCode); return NULL; } -CHIP_ERROR nl_Chip_GetDeviceByNodeId(chip::DeviceController::ChipDeviceController * devCtrl, chip::NodeId nodeId, +CHIP_ERROR pychip_GetDeviceByNodeId(chip::DeviceController::ChipDeviceController * devCtrl, chip::NodeId nodeId, chip::Controller::Device ** device) { return devCtrl->GetDeviceController()->GetDevice(nodeId, device); @@ -360,7 +360,7 @@ static void LogMessageToPython(uint8_t module, uint8_t category, const char * ms } } -void nl_Chip_Stack_SetLogFunct(LogMessageFunct logFunct) +void pychip_Stack_SetLogFunct(LogMessageFunct logFunct) { if (logFunct != NULL) { @@ -376,6 +376,6 @@ void nl_Chip_Stack_SetLogFunct(LogMessageFunct logFunct) #else // CHIP_LOG_ENABLE_DYNAMIC_LOGING_FUNCTION -void nl_Chip_Stack_SetLogFunct(LogMessageFunct logFunct) {} +void pychip_Stack_SetLogFunct(LogMessageFunct logFunct) {} #endif // CHIP_LOG_ENABLE_DYNAMIC_LOGING_FUNCTION diff --git a/src/controller/python/chip/ChipDeviceCtrl.py b/src/controller/python/chip/ChipDeviceCtrl.py index 7b3f90c45eb144..b133d2e7ce7d29 100644 --- a/src/controller/python/chip/ChipDeviceCtrl.py +++ b/src/controller/python/chip/ChipDeviceCtrl.py @@ -78,16 +78,16 @@ def __init__(self, startNetworkThread=True): self._InitLib() devCtrl = c_void_p(None) - res = self._dmLib.nl_Chip_DeviceController_NewDeviceController(pointer(devCtrl)) + res = self._dmLib.pychip_DeviceController_NewDeviceController(pointer(devCtrl)) if res != 0: raise self._ChipStack.ErrorToException(res) pairingDelegate = c_void_p(None) - res = self._dmLib.nl_Chip_ScriptDevicePairingDelegate_NewPairingDelegate(pointer(pairingDelegate)) + res = self._dmLib.pychip_ScriptDevicePairingDelegate_NewPairingDelegate(pointer(pairingDelegate)) if res != 0: raise self._ChipStack.ErrorToException(res) - res = self._dmLib.nl_Chip_DeviceController_SetDevicePairingDelegate(devCtrl, pairingDelegate) + res = self._dmLib.pychip_DeviceController_SetDevicePairingDelegate(devCtrl, pairingDelegate) if res != 0: raise self._ChipStack.ErrorToException(res) @@ -117,17 +117,17 @@ def HandleRendezvousError(appState, reqState, err, devStatusPtr): def __del__(self): if self.devCtrl != None: - self._dmLib.nl_Chip_DeviceController_DeleteDeviceController(self.devCtrl) + self._dmLib.pychip_DeviceController_DeleteDeviceController(self.devCtrl) self.devCtrl = None def IsConnected(self): return self._ChipStack.Call( - lambda: self._dmLib.nl_Chip_DeviceController_IsConnected(self.devCtrl) + lambda: self._dmLib.pychip_DeviceController_IsConnected(self.devCtrl) ) def ConnectBle(self, bleConnection): self._ChipStack.CallAsync( - lambda: self._dmLib.nl_Chip_DeviceController_ValidateBTP( + lambda: self._dmLib.pychip_DeviceController_ValidateBTP( self.devCtrl, bleConnection, self._ChipStack.cbHandleComplete, @@ -145,7 +145,7 @@ def HandleComplete(dc, connState, appState): self.state = DCState.RENDEZVOUS_ONGOING return self._ChipStack.CallAsync( - lambda: self._dmLib.nl_Chip_DeviceController_ConnectBLE( + lambda: self._dmLib.pychip_DeviceController_ConnectBLE( self.devCtrl, discriminator, setupPinCode, onConnectFunct, self.cbHandleMessage, self.cbHandleRendezvousError) ) @@ -159,14 +159,14 @@ def HandleComplete(dc, connState, appState): self.state = DCState.RENDEZVOUS_ONGOING return self._ChipStack.CallAsync( - lambda: self._dmLib.nl_Chip_DeviceController_ConnectIP( + lambda: self._dmLib.pychip_DeviceController_ConnectIP( self.devCtrl, ipaddr, setupPinCode, onConnectFunct, self.cbHandleMessage, self.cbHandleRendezvousError) ) def ZCLSend(self, cluster, command, nodeid, endpoint, groupid, args): device = c_void_p(None) self._ChipStack.Call( - lambda: self._dmLib.nl_Chip_GetDeviceByNodeId(self.devCtrl, nodeid, pointer(device)) + lambda: self._dmLib.pychip_GetDeviceByNodeId(self.devCtrl, nodeid, pointer(device)) ) self._Cluster.SendCommand(device, cluster, command, endpoint, groupid, args) @@ -175,7 +175,7 @@ def ZCLList(self): def Close(self): self._ChipStack.Call( - lambda: self._dmLib.nl_Chip_DeviceController_Close(self.devCtrl) + lambda: self._dmLib.pychip_DeviceController_Close(self.devCtrl) ) def SetLogFilter(self, category): @@ -183,19 +183,19 @@ def SetLogFilter(self, category): raise ValueError("category must be an unsigned 8-bit integer") self._ChipStack.Call( - lambda: self._dmLib.nl_Chip_DeviceController_SetLogFilter(category) + lambda: self._dmLib.pychip_DeviceController_SetLogFilter(category) ) def GetLogFilter(self): self._ChipStack.Call( - lambda: self._dmLib.nl_Chip_DeviceController_GetLogFilter() + lambda: self._dmLib.pychip_DeviceController_GetLogFilter() ) def SetBlockingCB(self, blockingCB): self._ChipStack.blockingCB = blockingCB def SetWifiCredential(self, ssid, password): - ret = self._dmLib.nl_Chip_ScriptDevicePairingDelegate_SetWifiCredential(self.pairingDelegate, ssid.encode("utf-8"), password.encode("utf-8")) + ret = self._dmLib.pychip_ScriptDevicePairingDelegate_SetWifiCredential(self.pairingDelegate, ssid.encode("utf-8"), password.encode("utf-8")) if ret != 0: raise self._ChipStack.ErrorToException(res) @@ -204,37 +204,37 @@ def _InitLib(self): if self._dmLib is None: self._dmLib = CDLL(self._ChipStack.LocateChipDLL()) - self._dmLib.nl_Chip_DeviceController_NewDeviceController.argtypes = [ + self._dmLib.pychip_DeviceController_NewDeviceController.argtypes = [ POINTER(c_void_p) ] - self._dmLib.nl_Chip_DeviceController_NewDeviceController.restype = c_uint32 + self._dmLib.pychip_DeviceController_NewDeviceController.restype = c_uint32 - self._dmLib.nl_Chip_DeviceController_DeleteDeviceController.argtypes = [ + self._dmLib.pychip_DeviceController_DeleteDeviceController.argtypes = [ c_void_p ] - self._dmLib.nl_Chip_DeviceController_DeleteDeviceController.restype = ( + self._dmLib.pychip_DeviceController_DeleteDeviceController.restype = ( c_uint32 ) - self._dmLib.nl_Chip_DeviceController_Close.argtypes = [c_void_p] - self._dmLib.nl_Chip_DeviceController_Close.restype = None + self._dmLib.pychip_DeviceController_Close.argtypes = [c_void_p] + self._dmLib.pychip_DeviceController_Close.restype = None - self._dmLib.nl_Chip_DeviceController_ConnectBLE.argtypes = [ + self._dmLib.pychip_DeviceController_ConnectBLE.argtypes = [ c_void_p, c_uint16, c_uint32, _OnConnectFunct, _OnMessageFunct, _OnRendezvousErrorFunct] - self._dmLib.nl_Chip_DeviceController_ConnectBLE.restype = c_uint32 + self._dmLib.pychip_DeviceController_ConnectBLE.restype = c_uint32 - self._dmLib.nl_Chip_DeviceController_ConnectIP.argtypes = [ + self._dmLib.pychip_DeviceController_ConnectIP.argtypes = [ c_void_p, c_char_p, c_uint32, _OnConnectFunct, _OnMessageFunct, _OnRendezvousErrorFunct] - self._dmLib.nl_Chip_DeviceController_ConnectIP.restype = c_uint32 + self._dmLib.pychip_DeviceController_ConnectIP.restype = c_uint32 - self._dmLib.nl_Chip_ScriptDevicePairingDelegate_NewPairingDelegate.argtypes = [POINTER(c_void_p)] - self._dmLib.nl_Chip_ScriptDevicePairingDelegate_NewPairingDelegate.restype = c_uint32 + self._dmLib.pychip_ScriptDevicePairingDelegate_NewPairingDelegate.argtypes = [POINTER(c_void_p)] + self._dmLib.pychip_ScriptDevicePairingDelegate_NewPairingDelegate.restype = c_uint32 - self._dmLib.nl_Chip_ScriptDevicePairingDelegate_SetWifiCredential.argtypes = [c_void_p, c_char_p, c_char_p] - self._dmLib.nl_Chip_ScriptDevicePairingDelegate_SetWifiCredential.restype = c_uint32 + self._dmLib.pychip_ScriptDevicePairingDelegate_SetWifiCredential.argtypes = [c_void_p, c_char_p, c_char_p] + self._dmLib.pychip_ScriptDevicePairingDelegate_SetWifiCredential.restype = c_uint32 - self._dmLib.nl_Chip_DeviceController_SetDevicePairingDelegate.argtypes = [c_void_p, c_void_p] - self._dmLib.nl_Chip_DeviceController_SetDevicePairingDelegate.restype = c_uint32 + self._dmLib.pychip_DeviceController_SetDevicePairingDelegate.argtypes = [c_void_p, c_void_p] + self._dmLib.pychip_DeviceController_SetDevicePairingDelegate.restype = c_uint32 - self._dmLib.nl_Chip_GetDeviceByNodeId.argtypes = [c_void_p, c_uint64, POINTER(c_void_p)] - self._dmLib.nl_Chip_GetDeviceByNodeId.restype = c_uint32 + self._dmLib.pychip_GetDeviceByNodeId.argtypes = [c_void_p, c_uint64, POINTER(c_void_p)] + self._dmLib.pychip_GetDeviceByNodeId.restype = c_uint32 diff --git a/src/controller/python/chip/ChipStack.py b/src/controller/python/chip/ChipStack.py index 9e5635dfa0e8e9..a8e383a06ef309 100644 --- a/src/controller/python/chip/ChipStack.py +++ b/src/controller/python/chip/ChipStack.py @@ -198,7 +198,7 @@ def HandleError(appState, reqState, err, devStatusPtr): self.blockingCB = None # set by other modules(BLE) that require service by thread while thread blocks. # Initialize the chip library - res = self._ChipStackLib.nl_Chip_Stack_Init() + res = self._ChipStackLib.pychip_Stack_Init() if res != 0: raise self._ChipStack.ErrorToException(res) @@ -242,10 +242,10 @@ def setLogFunct(self, logFunct): # set. Otherwise it may get garbage collected, and logging calls from the # chip library will fail. self._activeLogFunct = logFunct - self._ChipStackLib.nl_Chip_Stack_SetLogFunct(logFunct) + self._ChipStackLib.pychip_Stack_SetLogFunct(logFunct) def Shutdown(self): - self._ChipStack.Call(lambda: self._dmLib.nl_Chip_Stack_Shutdown()) + self._ChipStack.Call(lambda: self._dmLib.pychip_Stack_Shutdown()) self.networkLock = None self.completeEvent = None self._ChipStackLib = None @@ -288,7 +288,7 @@ def ErrorToException(self, err, devStatusPtr=None): devStatus = devStatusPtr.contents msg = ChipUtility.CStringToString( ( - self._ChipStackLib.nl_Chip_Stack_StatusReportToString( + self._ChipStackLib.pychip_Stack_StatusReportToString( devStatus.ProfileId, devStatus.StatusCode ) ) @@ -305,7 +305,7 @@ def ErrorToException(self, err, devStatusPtr=None): return ChipStackError( err, ChipUtility.CStringToString( - (self._ChipStackLib.nl_Chip_Stack_ErrorToString(err)) + (self._ChipStackLib.pychip_Stack_ErrorToString(err)) ), ) @@ -359,16 +359,16 @@ def _AllDirsToRoot(self, dir): def _loadLib(self): if self._ChipStackLib is None: self._ChipStackLib = CDLL(self.LocateChipDLL()) - self._ChipStackLib.nl_Chip_Stack_Init.argtypes = [] - self._ChipStackLib.nl_Chip_Stack_Init.restype = c_uint32 - self._ChipStackLib.nl_Chip_Stack_Shutdown.argtypes = [] - self._ChipStackLib.nl_Chip_Stack_Shutdown.restype = c_uint32 - self._ChipStackLib.nl_Chip_Stack_StatusReportToString.argtypes = [ + self._ChipStackLib.pychip_Stack_Init.argtypes = [] + self._ChipStackLib.pychip_Stack_Init.restype = c_uint32 + self._ChipStackLib.pychip_Stack_Shutdown.argtypes = [] + self._ChipStackLib.pychip_Stack_Shutdown.restype = c_uint32 + self._ChipStackLib.pychip_Stack_StatusReportToString.argtypes = [ c_uint32, c_uint16, ] - self._ChipStackLib.nl_Chip_Stack_StatusReportToString.restype = c_char_p - self._ChipStackLib.nl_Chip_Stack_ErrorToString.argtypes = [c_uint32] - self._ChipStackLib.nl_Chip_Stack_ErrorToString.restype = c_char_p - self._ChipStackLib.nl_Chip_Stack_SetLogFunct.argtypes = [_LogMessageFunct] - self._ChipStackLib.nl_Chip_Stack_SetLogFunct.restype = c_uint32 + self._ChipStackLib.pychip_Stack_StatusReportToString.restype = c_char_p + self._ChipStackLib.pychip_Stack_ErrorToString.argtypes = [c_uint32] + self._ChipStackLib.pychip_Stack_ErrorToString.restype = c_char_p + self._ChipStackLib.pychip_Stack_SetLogFunct.argtypes = [_LogMessageFunct] + self._ChipStackLib.pychip_Stack_SetLogFunct.restype = c_uint32 From 723e2564d2a122957ca97ac0dd06193c27d30bd4 Mon Sep 17 00:00:00 2001 From: "Restyled.io" Date: Thu, 4 Feb 2021 17:49:56 +0000 Subject: [PATCH 2/2] Restyled by clang-format --- .../ChipDeviceController-ScriptBinding.cpp | 30 +++++++++---------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/src/controller/python/ChipDeviceController-ScriptBinding.cpp b/src/controller/python/ChipDeviceController-ScriptBinding.cpp index 8219c468fd65a9..57a581f27cc537 100644 --- a/src/controller/python/ChipDeviceController-ScriptBinding.cpp +++ b/src/controller/python/ChipDeviceController-ScriptBinding.cpp @@ -84,20 +84,20 @@ CHIP_ERROR pychip_DeviceController_DeleteDeviceController(chip::DeviceController // Rendezvous CHIP_ERROR pychip_DeviceController_ConnectBLE(chip::DeviceController::ChipDeviceController * devCtrl, uint16_t discriminator, - uint32_t setupPINCode, OnConnectFunct onConnect, OnMessageFunct onMessage, - OnErrorFunct onError); -CHIP_ERROR pychip_DeviceController_ConnectIP(chip::DeviceController::ChipDeviceController * devCtrl, const char * peerAddrStr, uint32_t setupPINCode, OnConnectFunct onConnect, OnMessageFunct onMessage, OnErrorFunct onError); +CHIP_ERROR pychip_DeviceController_ConnectIP(chip::DeviceController::ChipDeviceController * devCtrl, const char * peerAddrStr, + uint32_t setupPINCode, OnConnectFunct onConnect, OnMessageFunct onMessage, + OnErrorFunct onError); // Network Provisioning CHIP_ERROR pychip_ScriptDevicePairingDelegate_NewPairingDelegate(chip::DeviceController::ScriptDevicePairingDelegate ** pairingDelegate); CHIP_ERROR pychip_ScriptDevicePairingDelegate_SetWifiCredential(chip::DeviceController::ScriptDevicePairingDelegate * pairingDelegate, - const char * ssid, const char * password); + const char * ssid, const char * password); CHIP_ERROR pychip_DeviceController_SetDevicePairingDelegate(chip::DeviceController::ChipDeviceController * devCtrl, - chip::Controller::DevicePairingDelegate * pairingDelegate); + chip::Controller::DevicePairingDelegate * pairingDelegate); bool pychip_DeviceController_IsConnected(chip::DeviceController::ChipDeviceController * devCtrl); void pychip_DeviceController_Close(chip::DeviceController::ChipDeviceController * devCtrl); @@ -111,7 +111,7 @@ const char * pychip_Stack_StatusReportToString(uint32_t profileId, uint16_t stat void pychip_Stack_SetLogFunct(LogMessageFunct logFunct); CHIP_ERROR pychip_GetDeviceByNodeId(chip::DeviceController::ChipDeviceController * devCtrl, chip::NodeId nodeId, - chip::Controller::Device ** device); + chip::Controller::Device ** device); } CHIP_ERROR pychip_DeviceController_NewDeviceController(chip::DeviceController::ChipDeviceController ** outDevCtrl) @@ -178,15 +178,15 @@ void pychip_DeviceController_SetLogFilter(uint8_t category) } CHIP_ERROR pychip_DeviceController_Connect(chip::DeviceController::ChipDeviceController * devCtrl, BLE_CONNECTION_OBJECT connObj, - uint32_t setupPINCode, OnConnectFunct onConnect, OnMessageFunct onMessage, - OnErrorFunct onError) + uint32_t setupPINCode, OnConnectFunct onConnect, OnMessageFunct onMessage, + OnErrorFunct onError) { return CHIP_ERROR_NOT_IMPLEMENTED; } CHIP_ERROR pychip_DeviceController_ConnectBLE(chip::DeviceController::ChipDeviceController * devCtrl, uint16_t discriminator, - uint32_t setupPINCode, OnConnectFunct onConnect, OnMessageFunct onMessage, - OnErrorFunct onError) + uint32_t setupPINCode, OnConnectFunct onConnect, OnMessageFunct onMessage, + OnErrorFunct onError) { return devCtrl->ConnectDevice(kRemoteDeviceId, chip::RendezvousParameters() @@ -197,8 +197,8 @@ CHIP_ERROR pychip_DeviceController_ConnectBLE(chip::DeviceController::ChipDevice } CHIP_ERROR pychip_DeviceController_ConnectIP(chip::DeviceController::ChipDeviceController * devCtrl, const char * peerAddrStr, - uint32_t setupPINCode, OnConnectFunct onConnect, OnMessageFunct onMessage, - OnErrorFunct onError) + uint32_t setupPINCode, OnConnectFunct onConnect, OnMessageFunct onMessage, + OnErrorFunct onError) { CHIP_ERROR err = CHIP_NO_ERROR; chip::Inet::IPAddress peerAddr; @@ -232,7 +232,7 @@ pychip_ScriptDevicePairingDelegate_NewPairingDelegate(chip::DeviceController::Sc CHIP_ERROR pychip_ScriptDevicePairingDelegate_SetWifiCredential(chip::DeviceController::ScriptDevicePairingDelegate * pairingDelegate, - const char * ssid, const char * password) + const char * ssid, const char * password) { CHIP_ERROR err = CHIP_NO_ERROR; @@ -246,7 +246,7 @@ pychip_ScriptDevicePairingDelegate_SetWifiCredential(chip::DeviceController::Scr return err; } CHIP_ERROR pychip_DeviceController_SetDevicePairingDelegate(chip::DeviceController::ChipDeviceController * devCtrl, - chip::Controller::DevicePairingDelegate * pairingDelegate) + chip::Controller::DevicePairingDelegate * pairingDelegate) { CHIP_ERROR err = CHIP_NO_ERROR; @@ -298,7 +298,7 @@ const char * pychip_Stack_StatusReportToString(uint32_t profileId, uint16_t stat } CHIP_ERROR pychip_GetDeviceByNodeId(chip::DeviceController::ChipDeviceController * devCtrl, chip::NodeId nodeId, - chip::Controller::Device ** device) + chip::Controller::Device ** device) { return devCtrl->GetDeviceController()->GetDevice(nodeId, device); }