Skip to content

Commit

Permalink
[python] Process responses to Network Commissioning Cluster commands (#…
Browse files Browse the repository at this point in the history
…6205)

* [python] Process responses to Network Commissioning Cluster commands

ZCL code for Python CHIP Controller doesn't process
responses to Network Commissioning Cluster commands as
the cluster is disabled in the ZAP configuration.
Enable it.

* Re-gen ZCL code
  • Loading branch information
Damian-Nordic authored Apr 22, 2021
1 parent 6a6994e commit 0719dad
Show file tree
Hide file tree
Showing 11 changed files with 2,320 additions and 531 deletions.
124 changes: 124 additions & 0 deletions src/controller/python/gen/CHIPClientCallbacks.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1333,6 +1333,130 @@ bool emberAfIdentifyClusterIdentifyQueryResponseCallback(chip::app::Command * co
return true;
}

bool emberAfNetworkCommissioningClusterAddThreadNetworkResponseCallback(chip::app::Command * commandObj, uint8_t errorCode,
uint8_t * debugText)
{
ChipLogProgress(Zcl, "AddThreadNetworkResponse:");
ChipLogProgress(Zcl, " errorCode: %" PRIu8 "", errorCode);
ChipLogProgress(Zcl, " debugText: %s", debugText);

GET_RESPONSE_CALLBACKS("NetworkCommissioningClusterAddThreadNetworkResponseCallback");

Callback::Callback<NetworkCommissioningClusterAddThreadNetworkResponseCallback> * cb =
Callback::Callback<NetworkCommissioningClusterAddThreadNetworkResponseCallback>::FromCancelable(onSuccessCallback);
cb->mCall(cb->mContext, errorCode, debugText);
return true;
}

bool emberAfNetworkCommissioningClusterAddWiFiNetworkResponseCallback(chip::app::Command * commandObj, uint8_t errorCode,
uint8_t * debugText)
{
ChipLogProgress(Zcl, "AddWiFiNetworkResponse:");
ChipLogProgress(Zcl, " errorCode: %" PRIu8 "", errorCode);
ChipLogProgress(Zcl, " debugText: %s", debugText);

GET_RESPONSE_CALLBACKS("NetworkCommissioningClusterAddWiFiNetworkResponseCallback");

Callback::Callback<NetworkCommissioningClusterAddWiFiNetworkResponseCallback> * cb =
Callback::Callback<NetworkCommissioningClusterAddWiFiNetworkResponseCallback>::FromCancelable(onSuccessCallback);
cb->mCall(cb->mContext, errorCode, debugText);
return true;
}

bool emberAfNetworkCommissioningClusterDisableNetworkResponseCallback(chip::app::Command * commandObj, uint8_t errorCode,
uint8_t * debugText)
{
ChipLogProgress(Zcl, "DisableNetworkResponse:");
ChipLogProgress(Zcl, " errorCode: %" PRIu8 "", errorCode);
ChipLogProgress(Zcl, " debugText: %s", debugText);

GET_RESPONSE_CALLBACKS("NetworkCommissioningClusterDisableNetworkResponseCallback");

Callback::Callback<NetworkCommissioningClusterDisableNetworkResponseCallback> * cb =
Callback::Callback<NetworkCommissioningClusterDisableNetworkResponseCallback>::FromCancelable(onSuccessCallback);
cb->mCall(cb->mContext, errorCode, debugText);
return true;
}

bool emberAfNetworkCommissioningClusterEnableNetworkResponseCallback(chip::app::Command * commandObj, uint8_t errorCode,
uint8_t * debugText)
{
ChipLogProgress(Zcl, "EnableNetworkResponse:");
ChipLogProgress(Zcl, " errorCode: %" PRIu8 "", errorCode);
ChipLogProgress(Zcl, " debugText: %s", debugText);

GET_RESPONSE_CALLBACKS("NetworkCommissioningClusterEnableNetworkResponseCallback");

Callback::Callback<NetworkCommissioningClusterEnableNetworkResponseCallback> * cb =
Callback::Callback<NetworkCommissioningClusterEnableNetworkResponseCallback>::FromCancelable(onSuccessCallback);
cb->mCall(cb->mContext, errorCode, debugText);
return true;
}

bool emberAfNetworkCommissioningClusterRemoveNetworkResponseCallback(chip::app::Command * commandObj, uint8_t errorCode,
uint8_t * debugText)
{
ChipLogProgress(Zcl, "RemoveNetworkResponse:");
ChipLogProgress(Zcl, " errorCode: %" PRIu8 "", errorCode);
ChipLogProgress(Zcl, " debugText: %s", debugText);

GET_RESPONSE_CALLBACKS("NetworkCommissioningClusterRemoveNetworkResponseCallback");

Callback::Callback<NetworkCommissioningClusterRemoveNetworkResponseCallback> * cb =
Callback::Callback<NetworkCommissioningClusterRemoveNetworkResponseCallback>::FromCancelable(onSuccessCallback);
cb->mCall(cb->mContext, errorCode, debugText);
return true;
}

bool emberAfNetworkCommissioningClusterScanNetworksResponseCallback(
chip::app::Command * commandObj, uint8_t errorCode, uint8_t * debugText,
/* TYPE WARNING: array array defaults to */ uint8_t * wifiScanResults,
/* TYPE WARNING: array array defaults to */ uint8_t * threadScanResults)
{
ChipLogProgress(Zcl, "ScanNetworksResponse:");
ChipLogProgress(Zcl, " errorCode: %" PRIu8 "", errorCode);
ChipLogProgress(Zcl, " debugText: %s", debugText);
ChipLogProgress(Zcl, " wifiScanResults: %p", wifiScanResults);
ChipLogProgress(Zcl, " threadScanResults: %p", threadScanResults);

GET_RESPONSE_CALLBACKS("NetworkCommissioningClusterScanNetworksResponseCallback");

Callback::Callback<NetworkCommissioningClusterScanNetworksResponseCallback> * cb =
Callback::Callback<NetworkCommissioningClusterScanNetworksResponseCallback>::FromCancelable(onSuccessCallback);
cb->mCall(cb->mContext, errorCode, debugText, wifiScanResults, threadScanResults);
return true;
}

bool emberAfNetworkCommissioningClusterUpdateThreadNetworkResponseCallback(chip::app::Command * commandObj, uint8_t errorCode,
uint8_t * debugText)
{
ChipLogProgress(Zcl, "UpdateThreadNetworkResponse:");
ChipLogProgress(Zcl, " errorCode: %" PRIu8 "", errorCode);
ChipLogProgress(Zcl, " debugText: %s", debugText);

GET_RESPONSE_CALLBACKS("NetworkCommissioningClusterUpdateThreadNetworkResponseCallback");

Callback::Callback<NetworkCommissioningClusterUpdateThreadNetworkResponseCallback> * cb =
Callback::Callback<NetworkCommissioningClusterUpdateThreadNetworkResponseCallback>::FromCancelable(onSuccessCallback);
cb->mCall(cb->mContext, errorCode, debugText);
return true;
}

bool emberAfNetworkCommissioningClusterUpdateWiFiNetworkResponseCallback(chip::app::Command * commandObj, uint8_t errorCode,
uint8_t * debugText)
{
ChipLogProgress(Zcl, "UpdateWiFiNetworkResponse:");
ChipLogProgress(Zcl, " errorCode: %" PRIu8 "", errorCode);
ChipLogProgress(Zcl, " debugText: %s", debugText);

GET_RESPONSE_CALLBACKS("NetworkCommissioningClusterUpdateWiFiNetworkResponseCallback");

Callback::Callback<NetworkCommissioningClusterUpdateWiFiNetworkResponseCallback> * cb =
Callback::Callback<NetworkCommissioningClusterUpdateWiFiNetworkResponseCallback>::FromCancelable(onSuccessCallback);
cb->mCall(cb->mContext, errorCode, debugText);
return true;
}

bool emberAfScenesClusterAddSceneResponseCallback(chip::app::Command * commandObj, uint8_t status, uint16_t groupId,
uint8_t sceneId)
{
Expand Down
12 changes: 12 additions & 0 deletions src/controller/python/gen/CHIPClientCallbacks.h
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,18 @@ typedef void (*GroupsClusterGetGroupMembershipResponseCallback)(void * context,
typedef void (*GroupsClusterRemoveGroupResponseCallback)(void * context, uint16_t groupId);
typedef void (*GroupsClusterViewGroupResponseCallback)(void * context, uint16_t groupId, uint8_t * groupName);
typedef void (*IdentifyClusterIdentifyQueryResponseCallback)(void * context, uint16_t timeout);
typedef void (*NetworkCommissioningClusterAddThreadNetworkResponseCallback)(void * context, uint8_t errorCode, uint8_t * debugText);
typedef void (*NetworkCommissioningClusterAddWiFiNetworkResponseCallback)(void * context, uint8_t errorCode, uint8_t * debugText);
typedef void (*NetworkCommissioningClusterDisableNetworkResponseCallback)(void * context, uint8_t errorCode, uint8_t * debugText);
typedef void (*NetworkCommissioningClusterEnableNetworkResponseCallback)(void * context, uint8_t errorCode, uint8_t * debugText);
typedef void (*NetworkCommissioningClusterRemoveNetworkResponseCallback)(void * context, uint8_t errorCode, uint8_t * debugText);
typedef void (*NetworkCommissioningClusterScanNetworksResponseCallback)(
void * context, uint8_t errorCode, uint8_t * debugText, /* TYPE WARNING: array array defaults to */ uint8_t * wifiScanResults,
/* TYPE WARNING: array array defaults to */ uint8_t * threadScanResults);
typedef void (*NetworkCommissioningClusterUpdateThreadNetworkResponseCallback)(void * context, uint8_t errorCode,
uint8_t * debugText);
typedef void (*NetworkCommissioningClusterUpdateWiFiNetworkResponseCallback)(void * context, uint8_t errorCode,
uint8_t * debugText);
typedef void (*ScenesClusterAddSceneResponseCallback)(void * context, uint16_t groupId, uint8_t sceneId);
typedef void (*ScenesClusterGetSceneMembershipResponseCallback)(void * context, uint8_t capacity, uint16_t groupId,
uint8_t sceneCount,
Expand Down
46 changes: 46 additions & 0 deletions src/controller/python/gen/CHIPClustersObjc.h
Original file line number Diff line number Diff line change
Expand Up @@ -484,6 +484,52 @@ NS_ASSUME_NONNULL_BEGIN

@end

/**
* Cluster Network Commissioning
*
*/
@interface CHIPNetworkCommissioning : CHIPCluster

- (void)addThreadNetwork:(NSData *)operationalDataset
breadcrumb:(uint64_t)breadcrumb
timeoutMs:(uint32_t)timeoutMs
completionHandler:(ResponseHandler)completionHandler;
- (void)addWiFiNetwork:(NSData *)ssid
credentials:(NSData *)credentials
breadcrumb:(uint64_t)breadcrumb
timeoutMs:(uint32_t)timeoutMs
completionHandler:(ResponseHandler)completionHandler;
- (void)disableNetwork:(NSData *)networkID
breadcrumb:(uint64_t)breadcrumb
timeoutMs:(uint32_t)timeoutMs
completionHandler:(ResponseHandler)completionHandler;
- (void)enableNetwork:(NSData *)networkID
breadcrumb:(uint64_t)breadcrumb
timeoutMs:(uint32_t)timeoutMs
completionHandler:(ResponseHandler)completionHandler;
- (void)getLastNetworkCommissioningResult:(uint32_t)timeoutMs completionHandler:(ResponseHandler)completionHandler;
- (void)removeNetwork:(NSData *)networkID
breadcrumb:(uint64_t)breadcrumb
timeoutMs:(uint32_t)timeoutMs
completionHandler:(ResponseHandler)completionHandler;
- (void)scanNetworks:(NSData *)ssid
breadcrumb:(uint64_t)breadcrumb
timeoutMs:(uint32_t)timeoutMs
completionHandler:(ResponseHandler)completionHandler;
- (void)updateThreadNetwork:(NSData *)operationalDataset
breadcrumb:(uint64_t)breadcrumb
timeoutMs:(uint32_t)timeoutMs
completionHandler:(ResponseHandler)completionHandler;
- (void)updateWiFiNetwork:(NSData *)ssid
credentials:(NSData *)credentials
breadcrumb:(uint64_t)breadcrumb
timeoutMs:(uint32_t)timeoutMs
completionHandler:(ResponseHandler)completionHandler;

- (void)readAttributeClusterRevision:(ResponseHandler)completionHandler;

@end

/**
* Cluster On/off
*
Expand Down
Loading

0 comments on commit 0719dad

Please sign in to comment.