Skip to content

Commit

Permalink
Add initial version of the WiFi Network Diagnostics Cluster (#6563)
Browse files Browse the repository at this point in the history
* Add initial Wi-Fi Network Diagnostics cluster

* Add auto-generated files
  • Loading branch information
yufengwangca authored and pull[bot] committed Jul 26, 2021
1 parent b8e9846 commit 1441218
Show file tree
Hide file tree
Showing 99 changed files with 2,524 additions and 327 deletions.
127 changes: 127 additions & 0 deletions examples/all-clusters-app/all-clusters-common/all-clusters-app.zap
Original file line number Diff line number Diff line change
Expand Up @@ -1510,6 +1510,133 @@
}
]
},
{
"name": "WiFi Network Diagnostics",
"code": 54,
"mfgCode": null,
"define": "WIFI_NETWORK_DIAGNOSTICS_CLUSTER",
"side": "client",
"enabled": 0,
"commands": [],
"attributes": [
{
"name": "cluster revision",
"code": 65533,
"mfgCode": null,
"side": "client",
"included": 1,
"storageOption": "RAM",
"singleton": 0,
"bounded": 0,
"defaultValue": "0x0001",
"reportable": 0,
"minInterval": 0,
"maxInterval": 65344,
"reportableChange": 0
}
]
},
{
"name": "WiFi Network Diagnostics",
"code": 54,
"mfgCode": null,
"define": "WIFI_NETWORK_DIAGNOSTICS_CLUSTER",
"side": "server",
"enabled": 1,
"commands": [],
"attributes": [
{
"name": "bssid",
"code": 0,
"mfgCode": null,
"side": "server",
"included": 1,
"storageOption": "RAM",
"singleton": 0,
"bounded": 0,
"defaultValue": "",
"reportable": 0,
"minInterval": 0,
"maxInterval": 65344,
"reportableChange": 0
},
{
"name": "SecurityType",
"code": 1,
"mfgCode": null,
"side": "server",
"included": 1,
"storageOption": "RAM",
"singleton": 0,
"bounded": 0,
"defaultValue": "",
"reportable": 0,
"minInterval": 0,
"maxInterval": 65344,
"reportableChange": 0
},
{
"name": "WiFiVersion",
"code": 2,
"mfgCode": null,
"side": "server",
"included": 1,
"storageOption": "RAM",
"singleton": 0,
"bounded": 0,
"defaultValue": "",
"reportable": 0,
"minInterval": 0,
"maxInterval": 65344,
"reportableChange": 0
},
{
"name": "ChannelNumber",
"code": 3,
"mfgCode": null,
"side": "server",
"included": 1,
"storageOption": "RAM",
"singleton": 0,
"bounded": 0,
"defaultValue": "0x0000",
"reportable": 0,
"minInterval": 0,
"maxInterval": 65344,
"reportableChange": 0
},
{
"name": "Rssi",
"code": 4,
"mfgCode": null,
"side": "server",
"included": 1,
"storageOption": "RAM",
"singleton": 0,
"bounded": 0,
"defaultValue": "0x00",
"reportable": 0,
"minInterval": 0,
"maxInterval": 65344,
"reportableChange": 0
},
{
"name": "cluster revision",
"code": 65533,
"mfgCode": null,
"side": "server",
"included": 1,
"storageOption": "RAM",
"singleton": 0,
"bounded": 0,
"defaultValue": "0x0001",
"reportable": 0,
"minInterval": 0,
"maxInterval": 65344,
"reportableChange": 0
}
]
},
{
"name": "Switch",
"code": 59,
Expand Down
19 changes: 19 additions & 0 deletions examples/all-clusters-app/all-clusters-common/gen/attribute-id.h
Original file line number Diff line number Diff line change
Expand Up @@ -421,6 +421,25 @@

// Server attributes

// Attribute ids for cluster: WiFi Network Diagnostics

// Client attributes

// Server attributes
#define ZCL_BSSID_ATTRIBUTE_ID (0x0000)
#define ZCL_SECURITY_TYPE_ATTRIBUTE_ID (0x0001)
#define ZCL_WIFI_VERSION_ATTRIBUTE_ID (0x0002)
#define ZCL_CHANNEL_NUMBER_ATTRIBUTE_ID (0x0003)
#define ZCL_RSSI_ATTRIBUTE_ID (0x0004)
#define ZCL_BEACON_LOST_COUNT_ATTRIBUTE_ID (0x0005)
#define ZCL_BEACON_RX_COUNT_ATTRIBUTE_ID (0x0006)
#define ZCL_PACKET_MULTICAST_RX_COUNT_ATTRIBUTE_ID (0x0007)
#define ZCL_PACKET_MULTICAST_TX_COUNT_ATTRIBUTE_ID (0x0008)
#define ZCL_PACKET_UNICAST_RX_COUNT_ATTRIBUTE_ID (0x0009)
#define ZCL_PACKET_UNICAST_TX_COUNT_ATTRIBUTE_ID (0x000A)
#define ZCL_CURRENT_MAX_RATE_ATTRIBUTE_ID (0x000B)
#define ZCL_OVERRUN_COUNT_ATTRIBUTE_ID (0x000C)

// Attribute ids for cluster: Switch

// Client attributes
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ EmberAfStatus emberAfSwitchClusterServerCommandParse(EmberAfClusterCommand * cmd
EmberAfStatus emberAfTemperatureMeasurementClusterServerCommandParse(EmberAfClusterCommand * cmd);
EmberAfStatus emberAfTestClusterClusterServerCommandParse(EmberAfClusterCommand * cmd);
EmberAfStatus emberAfThermostatClusterServerCommandParse(EmberAfClusterCommand * cmd);
EmberAfStatus emberAfWiFiNetworkDiagnosticsClusterServerCommandParse(EmberAfClusterCommand * cmd);

static EmberAfStatus status(bool wasHandled, bool clusterExists, bool mfgSpecific)
{
Expand Down Expand Up @@ -176,6 +177,10 @@ EmberAfStatus emberAfClusterSpecificCommandParse(EmberAfClusterCommand * cmd)
// No commands are enabled for cluster Thermostat
result = status(false, true, cmd->mfgSpecific);
break;
case ZCL_WIFI_NETWORK_DIAGNOSTICS_CLUSTER_ID:
// No commands are enabled for cluster WiFi Network Diagnostics
result = status(false, true, cmd->mfgSpecific);
break;
default:
// Unrecognized cluster ID, error status will apply.
break;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,9 @@ void emberAfClusterInitCallback(EndpointId endpoint, ClusterId clusterId)
case ZCL_THERMOSTAT_CLUSTER_ID:
emberAfThermostatClusterInitCallback(endpoint);
break;
case ZCL_WIFI_NETWORK_DIAGNOSTICS_CLUSTER_ID:
emberAfWiFiNetworkDiagnosticsClusterInitCallback(endpoint);
break;
default:
// Unrecognized cluster ID
break;
Expand Down Expand Up @@ -235,6 +238,11 @@ void __attribute__((weak)) emberAfThermostatClusterInitCallback(EndpointId endpo
// To prevent warning
(void) endpoint;
}
void __attribute__((weak)) emberAfWiFiNetworkDiagnosticsClusterInitCallback(EndpointId endpoint)
{
// To prevent warning
(void) endpoint;
}

//
// Non-Cluster Related Callbacks
Expand Down
80 changes: 80 additions & 0 deletions examples/all-clusters-app/all-clusters-common/gen/callback.h
Original file line number Diff line number Diff line change
Expand Up @@ -240,6 +240,14 @@ void emberAfTestClusterClusterInitCallback(chip::EndpointId endpoint);
*/
void emberAfThermostatClusterInitCallback(chip::EndpointId endpoint);

/** @brief WiFi Network Diagnostics Cluster Init
*
* Cluster Init
*
* @param endpoint Endpoint that is being initialized
*/
void emberAfWiFiNetworkDiagnosticsClusterInitCallback(chip::EndpointId endpoint);

// Cluster Server/Client Init Functions

//
Expand Down Expand Up @@ -2004,6 +2012,78 @@ EmberAfStatus emberAfThermostatClusterServerPreAttributeChangedCallback(chip::En
*/
void emberAfThermostatClusterServerTickCallback(chip::EndpointId endpoint);

//
// WiFi Network Diagnostics Cluster server
//

/** @brief WiFi Network Diagnostics Cluster Server Init
*
* Server Init
*
* @param endpoint Endpoint that is being initialized
*/
void emberAfWiFiNetworkDiagnosticsClusterServerInitCallback(chip::EndpointId endpoint);

/** @brief WiFi Network Diagnostics Cluster Server Attribute Changed
*
* Server Attribute Changed
*
* @param endpoint Endpoint that is being initialized
* @param attributeId Attribute that changed
*/
void emberAfWiFiNetworkDiagnosticsClusterServerAttributeChangedCallback(chip::EndpointId endpoint, chip::AttributeId attributeId);

/** @brief WiFi Network Diagnostics Cluster Server Manufacturer Specific Attribute Changed
*
* Server Manufacturer Specific Attribute Changed
*
* @param endpoint Endpoint that is being initialized
* @param attributeId Attribute that changed
* @param manufacturerCode Manufacturer Code of the attribute that changed
*/
void emberAfWiFiNetworkDiagnosticsClusterServerManufacturerSpecificAttributeChangedCallback(chip::EndpointId endpoint,
chip::AttributeId attributeId,
uint16_t manufacturerCode);

/** @brief WiFi Network Diagnostics Cluster Server Message Sent
*
* Server Message Sent
*
* @param type The type of message sent
* @param destination The destination to which the message was sent
* @param apsFrame The APS frame for the message
* @param msgLen The length of the message
* @param message The message that was sent
* @param status The status of the sent message
*/
void emberAfWiFiNetworkDiagnosticsClusterServerMessageSentCallback(EmberOutgoingMessageType type,
chip::MessageSendDestination destination,
EmberApsFrame * apsFrame, uint16_t msgLen, uint8_t * message,
EmberStatus status);

/** @brief WiFi Network Diagnostics Cluster Server Pre Attribute Changed
*
* server Pre Attribute Changed
*
* @param endpoint Endpoint that is being initialized
* @param attributeId Attribute to be changed
* @param attributeType Attribute type
* @param size Attribute size
* @param value Attribute value
*/
EmberAfStatus emberAfWiFiNetworkDiagnosticsClusterServerPreAttributeChangedCallback(chip::EndpointId endpoint,
chip::AttributeId attributeId,
EmberAfAttributeType attributeType,
uint16_t size, uint8_t * value);

/** @brief WiFi Network Diagnostics Cluster Server Tick
*
* server Tick
*
* @param endpoint Endpoint that is being served
*/
void emberAfWiFiNetworkDiagnosticsClusterServerTickCallback(chip::EndpointId endpoint);

// Cluster Commands Callback

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2197,6 +2197,15 @@
\
ZCL_GET_LAST_NETWORK_COMMISSIONING_RESULT_COMMAND_ID, "u", timeoutMs);

/** @brief Command description for ResetCounts
*
* Command: ResetCounts
*/
#define emberAfFillCommandWiFi \
Network DiagnosticsClusterResetCounts() emberAfFillExternalBuffer(mask, \
\
ZCL_RESET_COUNTS_COMMAND_ID, "", );

/** @brief Command description for SetFabric
*
* Command: SetFabric
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,9 @@
// Definitions for cluster: Network Commissioning
#define ZCL_NETWORK_COMMISSIONING_CLUSTER_ID (0x0031)

// Definitions for cluster: WiFi Network Diagnostics
#define ZCL_WIFI_NETWORK_DIAGNOSTICS_CLUSTER_ID (0x0036)

// Definitions for cluster: Switch
#define ZCL_SWITCH_CLUSTER_ID (0x003B)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -265,6 +265,9 @@
#define ZCL_DISABLE_NETWORK_RESPONSE_COMMAND_ID (0x0F)
#define ZCL_GET_LAST_NETWORK_COMMISSIONING_RESULT_COMMAND_ID (0x10)

// Commands for cluster: WiFi Network Diagnostics
#define ZCL_RESET_COUNTS_COMMAND_ID (0x00)

// Commands for cluster: Operational Credentials
#define ZCL_SET_FABRIC_COMMAND_ID (0x00)
#define ZCL_SET_FABRIC_RESPONSE_COMMAND_ID (0x01)
Expand Down
Loading

0 comments on commit 1441218

Please sign in to comment.