Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Restyle Replace nl_Chip with pychip #4669

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
114 changes: 57 additions & 57 deletions src/controller/python/ChipDeviceController-ScriptBinding.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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,
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_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);

// 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,
const char * ssid, const char * password);
CHIP_ERROR nl_Chip_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);

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 nl_Chip_GetDeviceByNodeId(chip::DeviceController::ChipDeviceController * devCtrl, chip::NodeId nodeId,
chip::Controller::Device ** device);
pychip_ScriptDevicePairingDelegate_SetWifiCredential(chip::DeviceController::ScriptDevicePairingDelegate * pairingDelegate,
const char * ssid, const char * password);
CHIP_ERROR pychip_DeviceController_SetDevicePairingDelegate(chip::DeviceController::ChipDeviceController * devCtrl,
chip::Controller::DevicePairingDelegate * pairingDelegate);

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 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 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;

Expand All @@ -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)
{
Expand All @@ -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();
Expand All @@ -170,23 +170,23 @@ 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,
uint32_t setupPINCode, OnConnectFunct onConnect, OnMessageFunct onMessage,
OnErrorFunct onError)
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,
uint32_t setupPINCode, OnConnectFunct onConnect, OnMessageFunct onMessage,
OnErrorFunct onError)
CHIP_ERROR pychip_DeviceController_ConnectBLE(chip::DeviceController::ChipDeviceController * devCtrl, uint16_t discriminator,
uint32_t setupPINCode, OnConnectFunct onConnect, OnMessageFunct onMessage,
OnErrorFunct onError)
{
return devCtrl->ConnectDevice(kRemoteDeviceId,
chip::RendezvousParameters()
Expand All @@ -196,9 +196,9 @@ 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,
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 err = CHIP_NO_ERROR;
chip::Inet::IPAddress peerAddr;
Expand All @@ -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;

Expand All @@ -231,8 +231,8 @@ nl_Chip_ScriptDevicePairingDelegate_NewPairingDelegate(chip::DeviceController::S
}

CHIP_ERROR
nl_Chip_ScriptDevicePairingDelegate_SetWifiCredential(chip::DeviceController::ScriptDevicePairingDelegate * pairingDelegate,
const char * ssid, const char * password)
pychip_ScriptDevicePairingDelegate_SetWifiCredential(chip::DeviceController::ScriptDevicePairingDelegate * pairingDelegate,
const char * ssid, const char * password)
{
CHIP_ERROR err = CHIP_NO_ERROR;

Expand All @@ -245,8 +245,8 @@ nl_Chip_ScriptDevicePairingDelegate_SetWifiCredential(chip::DeviceController::Sc
exit:
return err;
}
CHIP_ERROR nl_Chip_DeviceController_SetDevicePairingDelegate(chip::DeviceController::ChipDeviceController * devCtrl,
chip::Controller::DevicePairingDelegate * pairingDelegate)
CHIP_ERROR pychip_DeviceController_SetDevicePairingDelegate(chip::DeviceController::ChipDeviceController * devCtrl,
chip::Controller::DevicePairingDelegate * pairingDelegate)
{
CHIP_ERROR err = CHIP_NO_ERROR;

Expand All @@ -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;

Expand All @@ -276,29 +276,29 @@ 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::Controller::Device ** device)
CHIP_ERROR pychip_GetDeviceByNodeId(chip::DeviceController::ChipDeviceController * devCtrl, chip::NodeId nodeId,
chip::Controller::Device ** device)
{
return devCtrl->GetDeviceController()->GetDevice(nodeId, device);
}
Expand Down Expand Up @@ -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)
{
Expand All @@ -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
Loading