Skip to content

Commit

Permalink
[controller] Network commissioning support on Controller (#4622)
Browse files Browse the repository at this point in the history
* Add network provisioning cluster xml

* Update cluster according to spec

* Add Network Provisioning Support in Controller

* Fix type

* Restyled by prettier-json

* Fix python type

* Update generated files

* Update xml

* Fix

* run gen

* Restyled by clang-format

* Restyled by prettier-json

* Provisioning -> Commissioning

* Update zap

* Regenerate files

* Create controller-clusters.zap

* Restyled by prettier-json

* fix

Co-authored-by: Restyled.io <commits@restyled.io>
  • Loading branch information
2 people authored and pull[bot] committed Mar 1, 2021
1 parent e9c6fc3 commit a6d6607
Show file tree
Hide file tree
Showing 69 changed files with 13,614 additions and 50 deletions.
16 changes: 16 additions & 0 deletions examples/all-clusters-app/all-clusters-common/gen/af-structs.h
Original file line number Diff line number Diff line change
Expand Up @@ -364,6 +364,12 @@ typedef struct _SpecialDay
uint8_t dayIdRef;
} EmberAfSpecialDay;

// Struct for ThreadInterfaceScanResult
typedef struct _ThreadInterfaceScanResult
{
uint8_t * DiscoveryResponse;
} EmberAfThreadInterfaceScanResult;

// Struct for TierLabelsPayload
typedef struct _TierLabelsPayload
{
Expand All @@ -390,6 +396,16 @@ typedef struct _TransferredPhase
uint16_t maxActivationDelay;
} EmberAfTransferredPhase;

// Struct for WiFiInterfaceScanResult
typedef struct _WiFiInterfaceScanResult
{
uint8_t Security;
uint8_t * SSID;
uint8_t * BSSID;
uint8_t Channel;
uint32_t FrequencyBand;
} EmberAfWiFiInterfaceScanResult;

// Struct for WriteAttributeRecord
typedef struct _WriteAttributeRecord
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4058,6 +4058,12 @@

// Server attributes

// Attribute ids for cluster: Network Commissioning

// Client attributes

// Server attributes

// Attribute ids for cluster: Binding

// Client attributes
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5658,6 +5658,225 @@
ZCL_GET_ENDPOINT_LIST_REQUEST_COMMAND_ID, "uuuub", startIndex, total, startIndex, count, \
endpointInformationRecordList, endpointInformationRecordListLen);

/** @brief Command description for ScanNetworks
*
* Command: ScanNetworks
* @param ssid OCTET_STRING
* @param breadcrumb INT64U
* @param timeoutMs INT32U
*/
#define emberAfFillCommandNetwork \
CommissioningClusterScanNetworks(ssid, breadcrumb, timeoutMs) \
emberAfFillExternalBuffer(mask, \
\
ZCL_SCAN_NETWORKS_COMMAND_ID, "uuu", ssid, breadcrumb, timeoutMs);

/** @brief Command description for ScanNetworksResponse
*
* Command: ScanNetworksResponse
* @param errorCode INT8U
* @param debugText CHAR_STRING
* @param wifiScanResults WiFiInterfaceScanResult []
* @param wifiScanResultsLen int
* @param threadScanResults ThreadInterfaceScanResult []
* @param threadScanResultsLen int
*/
#define emberAfFillCommandNetwork \
CommissioningClusterScanNetworksResponse(errorCode, debugText, wifiScanResults, wifiScanResultsLen, threadScanResults, \
threadScanResultsLen) \
emberAfFillExternalBuffer(mask, \
\
ZCL_SCAN_NETWORKS_RESPONSE_COMMAND_ID, "uubb", errorCode, debugText, wifiScanResults, \
wifiScanResultsLen, threadScanResults, threadScanResultsLen);

/** @brief Command description for AddWiFiNetwork
*
* Command: AddWiFiNetwork
* @param ssid OCTET_STRING
* @param credentials OCTET_STRING
* @param breadcrumb INT64U
* @param timeoutMs INT32U
*/
#define emberAfFillCommandNetwork \
CommissioningClusterAddWiFiNetwork(ssid, credentials, breadcrumb, timeoutMs) \
emberAfFillExternalBuffer(mask, \
\
ZCL_ADD_WI_FI_NETWORK_COMMAND_ID, "uuuu", ssid, credentials, breadcrumb, timeoutMs);

/** @brief Command description for AddWiFiNetworkResponse
*
* Command: AddWiFiNetworkResponse
* @param errorCode INT8U
* @param debugText CHAR_STRING
*/
#define emberAfFillCommandNetwork \
CommissioningClusterAddWiFiNetworkResponse(errorCode, debugText) \
emberAfFillExternalBuffer(mask, \
\
ZCL_ADD_WI_FI_NETWORK_RESPONSE_COMMAND_ID, "uu", errorCode, debugText);

/** @brief Command description for UpdateWiFiNetwork
*
* Command: UpdateWiFiNetwork
* @param ssid OCTET_STRING
* @param credentials OCTET_STRING
* @param breadcrumb INT64U
* @param timeoutMs INT32U
*/
#define emberAfFillCommandNetwork \
CommissioningClusterUpdateWiFiNetwork(ssid, credentials, breadcrumb, timeoutMs) \
emberAfFillExternalBuffer(mask, \
\
ZCL_UPDATE_WI_FI_NETWORK_COMMAND_ID, "uuuu", ssid, credentials, breadcrumb, timeoutMs);

/** @brief Command description for UpdateWiFiNetworkResponse
*
* Command: UpdateWiFiNetworkResponse
* @param errorCode INT8U
* @param debugText CHAR_STRING
*/
#define emberAfFillCommandNetwork \
CommissioningClusterUpdateWiFiNetworkResponse(errorCode, debugText) \
emberAfFillExternalBuffer(mask, \
\
ZCL_UPDATE_WI_FI_NETWORK_RESPONSE_COMMAND_ID, "uu", errorCode, debugText);

/** @brief Command description for AddThreadNetwork
*
* Command: AddThreadNetwork
* @param operationalDataset OCTET_STRING
* @param breadcrumb INT64U
* @param timeoutMs INT32U
*/
#define emberAfFillCommandNetwork \
CommissioningClusterAddThreadNetwork(operationalDataset, breadcrumb, timeoutMs) \
emberAfFillExternalBuffer(mask, \
\
ZCL_ADD_THREAD_NETWORK_COMMAND_ID, "uuu", operationalDataset, breadcrumb, timeoutMs);

/** @brief Command description for AddThreadNetworkResponse
*
* Command: AddThreadNetworkResponse
* @param errorCode INT8U
* @param debugText CHAR_STRING
*/
#define emberAfFillCommandNetwork \
CommissioningClusterAddThreadNetworkResponse(errorCode, debugText) \
emberAfFillExternalBuffer(mask, \
\
ZCL_ADD_THREAD_NETWORK_RESPONSE_COMMAND_ID, "uu", errorCode, debugText);

/** @brief Command description for UpdateThreadNetwork
*
* Command: UpdateThreadNetwork
* @param operationalDataset OCTET_STRING
* @param breadcrumb INT64U
* @param timeoutMs INT32U
*/
#define emberAfFillCommandNetwork \
CommissioningClusterUpdateThreadNetwork(operationalDataset, breadcrumb, timeoutMs) \
emberAfFillExternalBuffer(mask, \
\
ZCL_UPDATE_THREAD_NETWORK_COMMAND_ID, "uuu", operationalDataset, breadcrumb, timeoutMs);

/** @brief Command description for UpdateThreadNetworkResponse
*
* Command: UpdateThreadNetworkResponse
* @param errorCode INT8U
* @param debugText CHAR_STRING
*/
#define emberAfFillCommandNetwork \
CommissioningClusterUpdateThreadNetworkResponse(errorCode, debugText) \
emberAfFillExternalBuffer(mask, \
\
ZCL_UPDATE_THREAD_NETWORK_RESPONSE_COMMAND_ID, "uu", errorCode, debugText);

/** @brief Command description for RemoveNetwork
*
* Command: RemoveNetwork
* @param NetworkID OCTET_STRING
* @param Breadcrumb INT64U
* @param TimeoutMs INT32U
*/
#define emberAfFillCommandNetwork \
CommissioningClusterRemoveNetwork(NetworkID, Breadcrumb, TimeoutMs) \
emberAfFillExternalBuffer(mask, \
\
ZCL_REMOVE_NETWORK_COMMAND_ID, "uuu", NetworkID, Breadcrumb, TimeoutMs);

/** @brief Command description for RemoveNetworkResponse
*
* Command: RemoveNetworkResponse
* @param errorCode INT8U
* @param debugText CHAR_STRING
*/
#define emberAfFillCommandNetwork \
CommissioningClusterRemoveNetworkResponse(errorCode, debugText) \
emberAfFillExternalBuffer(mask, \
\
ZCL_REMOVE_NETWORK_RESPONSE_COMMAND_ID, "uu", errorCode, debugText);

/** @brief Command description for EnableNetwork
*
* Command: EnableNetwork
* @param networkID OCTET_STRING
* @param breadcrumb INT64U
* @param timeoutMs INT32U
*/
#define emberAfFillCommandNetwork \
CommissioningClusterEnableNetwork(networkID, breadcrumb, timeoutMs) \
emberAfFillExternalBuffer(mask, \
\
ZCL_ENABLE_NETWORK_COMMAND_ID, "uuu", networkID, breadcrumb, timeoutMs);

/** @brief Command description for EnableNetworkResponse
*
* Command: EnableNetworkResponse
* @param errorCode INT8U
* @param debugText CHAR_STRING
*/
#define emberAfFillCommandNetwork \
CommissioningClusterEnableNetworkResponse(errorCode, debugText) \
emberAfFillExternalBuffer(mask, \
\
ZCL_ENABLE_NETWORK_RESPONSE_COMMAND_ID, "uu", errorCode, debugText);

/** @brief Command description for DisableNetwork
*
* Command: DisableNetwork
* @param networkID OCTET_STRING
* @param breadcrumb INT64U
* @param timeoutMs INT32U
*/
#define emberAfFillCommandNetwork \
CommissioningClusterDisableNetwork(networkID, breadcrumb, timeoutMs) \
emberAfFillExternalBuffer(mask, \
\
ZCL_DISABLE_NETWORK_COMMAND_ID, "uuu", networkID, breadcrumb, timeoutMs);

/** @brief Command description for DisableNetworkResponse
*
* Command: DisableNetworkResponse
* @param errorCode INT8U
* @param debugText CHAR_STRING
*/
#define emberAfFillCommandNetwork \
CommissioningClusterDisableNetworkResponse(errorCode, debugText) \
emberAfFillExternalBuffer(mask, \
\
ZCL_DISABLE_NETWORK_RESPONSE_COMMAND_ID, "uu", errorCode, debugText);

/** @brief Command description for GetLastNetworkCommissioningResult
*
* Command: GetLastNetworkCommissioningResult
* @param timeoutMs INT32U
*/
#define emberAfFillCommandNetwork \
CommissioningClusterGetLastNetworkCommissioningResult(timeoutMs) \
emberAfFillExternalBuffer(mask, \
\
ZCL_GET_LAST_NETWORK_COMMISSIONING_RESULT_COMMAND_ID, "u", timeoutMs);

/** @brief Command description for Bind
*
* Command: Bind
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -332,6 +332,9 @@
// Definitions for cluster: ZLL Commissioning
#define ZCL_ZLL_COMMISSIONING_CLUSTER_ID (0x1000)

// Definitions for cluster: Network Commissioning
#define ZCL_NETWORK_COMMISSIONING_CLUSTER_ID (0xAAAA)

// Definitions for cluster: Binding
#define ZCL_BINDING_CLUSTER_ID (0xF000)

Expand Down
19 changes: 19 additions & 0 deletions examples/all-clusters-app/all-clusters-common/gen/command-id.h
Original file line number Diff line number Diff line change
Expand Up @@ -685,6 +685,25 @@
#define ZCL_GET_ENDPOINT_LIST_REQUEST_COMMAND_ID (0x42)
#define ZCL_GET_ENDPOINT_LIST_RESPONSE_COMMAND_ID (0x42)

// Commands for cluster: Network Commissioning
#define ZCL_SCAN_NETWORKS_COMMAND_ID (0x00)
#define ZCL_SCAN_NETWORKS_RESPONSE_COMMAND_ID (0x01)
#define ZCL_ADD_WI_FI_NETWORK_COMMAND_ID (0x02)
#define ZCL_ADD_WI_FI_NETWORK_RESPONSE_COMMAND_ID (0x03)
#define ZCL_UPDATE_WI_FI_NETWORK_COMMAND_ID (0x04)
#define ZCL_UPDATE_WI_FI_NETWORK_RESPONSE_COMMAND_ID (0x05)
#define ZCL_ADD_THREAD_NETWORK_COMMAND_ID (0x06)
#define ZCL_ADD_THREAD_NETWORK_RESPONSE_COMMAND_ID (0x07)
#define ZCL_UPDATE_THREAD_NETWORK_COMMAND_ID (0x08)
#define ZCL_UPDATE_THREAD_NETWORK_RESPONSE_COMMAND_ID (0x09)
#define ZCL_REMOVE_NETWORK_COMMAND_ID (0x0A)
#define ZCL_REMOVE_NETWORK_RESPONSE_COMMAND_ID (0x0B)
#define ZCL_ENABLE_NETWORK_COMMAND_ID (0x0C)
#define ZCL_ENABLE_NETWORK_RESPONSE_COMMAND_ID (0x0D)
#define ZCL_DISABLE_NETWORK_COMMAND_ID (0x0E)
#define ZCL_DISABLE_NETWORK_RESPONSE_COMMAND_ID (0x0F)
#define ZCL_GET_LAST_NETWORK_COMMISSIONING_RESULT_COMMAND_ID (0x10)

// Commands for cluster: Binding
#define ZCL_BIND_COMMAND_ID (0x00)
#define ZCL_UNBIND_COMMAND_ID (0x01)
Expand Down
35 changes: 35 additions & 0 deletions examples/all-clusters-app/all-clusters-common/gen/enums.h
Original file line number Diff line number Diff line change
Expand Up @@ -1873,6 +1873,31 @@ typedef enum
EMBER_ZCL_MOVE_MODE_DOWN = 1,
} EmberAfMoveMode;

// Enum for NetworkCommissioningError
typedef enum
{
EMBER_ZCL_NETWORK_COMMISSIONING_ERROR_SUCCESS = 0,
EMBER_ZCL_NETWORK_COMMISSIONING_ERROR_OUT_OF_RANGE = 1,
EMBER_ZCL_NETWORK_COMMISSIONING_ERROR_BOUNDS_EXCEEDED = 2,
EMBER_ZCL_NETWORK_COMMISSIONING_ERROR_NETWORK_ID_NOT_FOUND = 3,
EMBER_ZCL_NETWORK_COMMISSIONING_ERROR_DUPLICATE_NETWORK_ID = 4,
EMBER_ZCL_NETWORK_COMMISSIONING_ERROR_NETWORK_NOT_FOUND = 5,
EMBER_ZCL_NETWORK_COMMISSIONING_ERROR_REGULATORY_ERROR = 6,
EMBER_ZCL_NETWORK_COMMISSIONING_ERROR_AUTH_FAILURE = 7,
EMBER_ZCL_NETWORK_COMMISSIONING_ERROR_UNSUPPORTED_SECURITY = 8,
EMBER_ZCL_NETWORK_COMMISSIONING_ERROR_OTHER_CONNECTION_FAILURE = 9,
EMBER_ZCL_NETWORK_COMMISSIONING_ERROR_IPV6_FAILED = 10,
EMBER_ZCL_NETWORK_COMMISSIONING_ERROR_IP_BIND_FAILED = 11,
EMBER_ZCL_NETWORK_COMMISSIONING_ERROR_LABEL9 = 12,
EMBER_ZCL_NETWORK_COMMISSIONING_ERROR_LABEL10 = 13,
EMBER_ZCL_NETWORK_COMMISSIONING_ERROR_LABEL11 = 14,
EMBER_ZCL_NETWORK_COMMISSIONING_ERROR_LABEL12 = 15,
EMBER_ZCL_NETWORK_COMMISSIONING_ERROR_LABEL13 = 16,
EMBER_ZCL_NETWORK_COMMISSIONING_ERROR_LABEL14 = 17,
EMBER_ZCL_NETWORK_COMMISSIONING_ERROR_LABEL15 = 18,
EMBER_ZCL_NETWORK_COMMISSIONING_ERROR_UNKNOWN_ERROR = 19,
} EmberAfNetworkCommissioningError;

// Enum for NotificationScheme
typedef enum
{
Expand Down Expand Up @@ -3887,6 +3912,16 @@ typedef enum
#define EMBER_AF_RESTART_OPTIONS_IMMEDIATE_OFFSET (3)
#define EMBER_AF_SCENES_COPY_MODE_COPY_ALL_SCENES (1)
#define EMBER_AF_SCENES_COPY_MODE_COPY_ALL_SCENES_OFFSET (0)
#define EMBER_AF_SECURITY_TYPE_UNENCRYPTED (1)
#define EMBER_AF_SECURITY_TYPE_UNENCRYPTED_OFFSET (0)
#define EMBER_AF_SECURITY_TYPE_WEP_PERSONAL (2)
#define EMBER_AF_SECURITY_TYPE_WEP_PERSONAL_OFFSET (1)
#define EMBER_AF_SECURITY_TYPE_WPA_PERSONAL (4)
#define EMBER_AF_SECURITY_TYPE_WPA_PERSONAL_OFFSET (2)
#define EMBER_AF_SECURITY_TYPE_WPA2_PERSONAL (8)
#define EMBER_AF_SECURITY_TYPE_WPA2_PERSONAL_OFFSET (3)
#define EMBER_AF_SECURITY_TYPE_WPA3_PERSONAL (16)
#define EMBER_AF_SECURITY_TYPE_WPA3_PERSONAL_OFFSET (4)
#define EMBER_AF_SHADE_CLOSURE_STATUS_OPERATIONAL (1)
#define EMBER_AF_SHADE_CLOSURE_STATUS_OPERATIONAL_OFFSET (0)
#define EMBER_AF_SHADE_CLOSURE_STATUS_ADJUSTING (2)
Expand Down
Loading

0 comments on commit a6d6607

Please sign in to comment.