"use strict";
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __export = (target, all) => {
  for (var name in all)
    __defProp(target, name, { get: all[name], enumerable: true });
};
var __copyProps = (to, from, except, desc) => {
  if (from && typeof from === "object" || typeof from === "function") {
    for (let key of __getOwnPropNames(from))
      if (!__hasOwnProp.call(to, key) && key !== except)
        __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
  }
  return to;
};
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
var WiFiNetworkDiagnostics_exports = {};
__export(WiFiNetworkDiagnostics_exports, {
  WiFiNetworkDiagnostics: () => WiFiNetworkDiagnostics
});
module.exports = __toCommonJS(WiFiNetworkDiagnostics_exports);
var import_MatterDefinition = require("../MatterDefinition.js");
var import_elements = require("../../elements/index.js");
/**
 * @license
 * Copyright 2022-2024 Matter.js Authors
 * SPDX-License-Identifier: Apache-2.0
 */
const WiFiNetworkDiagnostics = (0, import_elements.ClusterElement)({
  name: "WiFiNetworkDiagnostics",
  id: 54,
  classification: "node",
  pics: "DGWIFI",
  quality: "K",
  details: "The Wi-Fi Network Diagnostics Cluster provides a means to acquire standardized diagnostics metrics that may be used by a Node to assist a user or Administrator in diagnosing potential problems. The Wi-Fi Network Diagnostics Cluster attempts to centralize all metrics that are relevant to a potential Wi-Fi radio running on a Node.",
  xref: { document: "core", section: "11.15" },
  children: [
    (0, import_elements.AttributeElement)({ name: "ClusterRevision", id: 65533, type: "ClusterRevision", default: 1 }),
    (0, import_elements.AttributeElement)({
      name: "FeatureMap",
      id: 65532,
      type: "FeatureMap",
      xref: { document: "core", section: "11.15.4" },
      children: [
        (0, import_elements.FieldElement)({
          name: "PKTCNT",
          constraint: "0",
          description: "PacketCounts",
          details: "Node makes available the counts for the number of received and transmitted packets on the Wi-Fi interface."
        }),
        (0, import_elements.FieldElement)({
          name: "ERRCNT",
          constraint: "1",
          description: "ErrorCounts",
          details: "Node makes available the counts for the number of errors that have occurred during the reception and transmission of packets on the Wi-Fi interface."
        })
      ]
    }),
    (0, import_elements.AttributeElement)({
      name: "Bssid",
      id: 0,
      type: "octstr",
      access: "R V",
      conformance: "M",
      constraint: "6",
      default: null,
      quality: "X",
      details: "The BSSID attribute shall indicate the BSSID for which the Wi-Fi network the Node is currently connected.",
      xref: { document: "core", section: "11.15.6.1" }
    }),
    (0, import_elements.AttributeElement)({
      name: "SecurityType",
      id: 1,
      type: "SecurityTypeEnum",
      access: "R V",
      conformance: "M",
      default: null,
      quality: "X",
      details: "The SecurityType attribute shall indicate the current type of Wi-Fi security used.",
      xref: { document: "core", section: "11.15.6.2" }
    }),
    (0, import_elements.AttributeElement)({
      name: "WiFiVersion",
      id: 2,
      type: "WiFiVersionEnum",
      access: "R V",
      conformance: "M",
      default: null,
      quality: "X",
      details: "The WiFiVersion attribute shall indicate the current 802.11 standard version in use by the Node, per the table below.",
      xref: { document: "core", section: "11.15.6.3" }
    }),
    (0, import_elements.AttributeElement)({
      name: "ChannelNumber",
      id: 3,
      type: "uint16",
      access: "R V",
      conformance: "M",
      default: null,
      quality: "X",
      details: "The ChannelNumber attribute shall indicate the channel that Wi-Fi communication is currently operating on.",
      xref: { document: "core", section: "11.15.6.4" }
    }),
    (0, import_elements.AttributeElement)({
      name: "Rssi",
      id: 4,
      type: "int8",
      access: "R V",
      conformance: "M",
      constraint: "-120 to 0",
      default: null,
      quality: "X C",
      details: "The RSSI attribute shall indicate the current RSSI of the Node\u2019s Wi-Fi radio in dBm.",
      xref: { document: "core", section: "11.15.6.5" }
    }),
    (0, import_elements.AttributeElement)({
      name: "BeaconLostCount",
      id: 5,
      type: "uint32",
      access: "R V",
      conformance: "ERRCNT",
      default: 0,
      quality: "X C",
      details: "The BeaconLostCount attribute shall indicate the count of the number of missed beacons the Node has detected. If the Node does not have an ability to count beacons expected and not received, this value may remain set to zero.",
      xref: { document: "core", section: "11.15.6.6" }
    }),
    (0, import_elements.AttributeElement)({
      name: "BeaconRxCount",
      id: 6,
      type: "uint32",
      access: "R V",
      conformance: "PKTCNT",
      default: 0,
      quality: "X C",
      details: "The BeaconRxCount attribute shall indicate the count of the number of received beacons. The\ntotal number of expected beacons that could have been received during the interval since association SHOULD match the sum of BeaconRxCount and BeaconLostCount. If the Node does not have an ability to report count of beacons received, this value may remain set to zero.",
      xref: { document: "core", section: "11.15.6.7" }
    }),
    (0, import_elements.AttributeElement)({
      name: "PacketMulticastRxCount",
      id: 7,
      type: "uint32",
      access: "R V",
      conformance: "PKTCNT",
      default: 0,
      quality: "X C",
      details: "The PacketMulticastRxCount attribute shall indicate the number of multicast packets received by the Node.",
      xref: { document: "core", section: "11.15.6.8" }
    }),
    (0, import_elements.AttributeElement)({
      name: "PacketMulticastTxCount",
      id: 8,
      type: "uint32",
      access: "R V",
      conformance: "PKTCNT",
      default: 0,
      quality: "X C",
      details: "The PacketMulticastTxCount attribute shall indicate the number of multicast packets transmitted by the Node.",
      xref: { document: "core", section: "11.15.6.9" }
    }),
    (0, import_elements.AttributeElement)({
      name: "PacketUnicastRxCount",
      id: 9,
      type: "uint32",
      access: "R V",
      conformance: "PKTCNT",
      default: 0,
      quality: "X C",
      details: "The PacketUnicastRxCount attribute shall indicate the number of unicast packets received by the Node.",
      xref: { document: "core", section: "11.15.6.10" }
    }),
    (0, import_elements.AttributeElement)({
      name: "PacketUnicastTxCount",
      id: 10,
      type: "uint32",
      access: "R V",
      conformance: "PKTCNT",
      default: 0,
      quality: "X C",
      details: "The PacketUnicastTxCount attribute shall indicate the number of unicast packets transmitted by the Node.",
      xref: { document: "core", section: "11.15.6.11" }
    }),
    (0, import_elements.AttributeElement)({
      name: "CurrentMaxRate",
      id: 11,
      type: "uint64",
      access: "R V",
      conformance: "O",
      default: 0,
      quality: "X C",
      details: "The CurrentMaxRate attribute shall indicate the current maximum PHY rate of transfer of data in bits-per-second.",
      xref: { document: "core", section: "11.15.6.12" }
    }),
    (0, import_elements.AttributeElement)({
      name: "OverrunCount",
      id: 12,
      type: "uint64",
      access: "R V",
      conformance: "ERRCNT",
      default: 0,
      quality: "X C",
      details: "The OverrunCount attribute shall indicate the number of packets dropped either at ingress or egress, due to lack of buffer memory to retain all packets on the network interface. The OverrunCount attribute shall be reset to 0 upon a reboot of the Node.",
      xref: { document: "core", section: "11.15.6.13" }
    }),
    (0, import_elements.EventElement)({
      name: "Disconnection",
      id: 0,
      access: "V",
      conformance: "O",
      priority: "info",
      details: "The Disconnection Event shall indicate that a Node\u2019s Wi-Fi connection has been disconnected as a result of de-authenticated or dis-association and indicates the reason.",
      xref: { document: "core", section: "11.15.8.1" },
      children: [(0, import_elements.FieldElement)({
        name: "ReasonCode",
        id: 0,
        type: "uint16",
        conformance: "M",
        details: 'This field shall contain the Reason Code field value for the Disassociation or Deauthentication event that caused the disconnection and the value shall align with Table 9-49 "Reason codes" of IEEE 802.11-2020.',
        xref: { document: "core", section: "11.15.8.1.1" }
      })]
    }),
    (0, import_elements.EventElement)({
      name: "AssociationFailure",
      id: 1,
      access: "V",
      conformance: "O",
      priority: "info",
      details: "The AssociationFailure event shall indicate that a Node has attempted to connect, or reconnect, to a Wi-Fi access point, but is unable to successfully associate or authenticate, after exhausting all internal retries of its supplicant.",
      xref: { document: "core", section: "11.15.8.2" },
      children: [
        (0, import_elements.FieldElement)({
          name: "AssociationFailureCause",
          id: 0,
          type: "AssociationFailureCauseEnum",
          conformance: "M",
          details: "The Status field shall be set to a value from the AssociationFailureCauseEnum.",
          xref: { document: "core", section: "11.15.8.2.1" }
        }),
        (0, import_elements.FieldElement)({
          name: "Status",
          id: 1,
          type: "uint16",
          conformance: "M",
          details: 'The Status field shall be set to the Status Code value that was present in the last frame related to association where Status Code was not equal to zero and which caused the failure of a last trial\nattempt, if this last failure was due to one of the following Management frames:\n  \u2022 Association Response (Type 0, Subtype 1)\n  \u2022 Reassociation Response (Type 0, Subtype 3)\n  \u2022 Authentication (Type 0, Subtype 11)\nTable 9-50 "Status codes" of IEEE 802.11-2020 contains a description of all values possible.',
          xref: { document: "core", section: "11.15.8.2.2" }
        })
      ]
    }),
    (0, import_elements.EventElement)({
      name: "ConnectionStatus",
      id: 2,
      access: "V",
      conformance: "O",
      priority: "info",
      details: "The ConnectionStatus Event shall indicate that a Node\u2019s connection status to a Wi-Fi network has changed. Connected, in this context, shall mean that a Node acting as a Wi-Fi station is successfully associated to a Wi-Fi Access Point.",
      xref: { document: "core", section: "11.15.8.3" },
      children: [(0, import_elements.FieldElement)({ name: "ConnectionStatus", id: 0, type: "ConnectionStatusEnum", conformance: "M" })]
    }),
    (0, import_elements.CommandElement)({
      name: "ResetCounts",
      id: 0,
      access: "O",
      conformance: "ERRCNT",
      direction: "request",
      response: "status",
      details: "Reception of this command shall reset the following attributes to 0:\n  \u2022 BeaconLostCount\n  \u2022 BeaconRxCount\n  \u2022 PacketMulticastRxCount\n  \u2022 PacketMulticastTxCount\n  \u2022 PacketUnicastRxCount\n  \u2022 PacketUnicastTxCount\nThis command has no associated data.",
      xref: { document: "core", section: "11.15.7.1" }
    }),
    (0, import_elements.DatatypeElement)({
      name: "SecurityTypeEnum",
      type: "enum8",
      xref: { document: "core", section: "11.15.5.1" },
      children: [
        (0, import_elements.FieldElement)({
          name: "Unspecified",
          id: 0,
          conformance: "M",
          description: "Indicate the usage of an unspecified Wi-Fi security type"
        }),
        (0, import_elements.FieldElement)({ name: "None", id: 1, conformance: "M", description: "Indicate the usage of no Wi-Fi security" }),
        (0, import_elements.FieldElement)({ name: "Wep", id: 2, conformance: "M", description: "Indicate the usage of WEP Wi-Fi security" }),
        (0, import_elements.FieldElement)({ name: "Wpa", id: 3, conformance: "M", description: "Indicate the usage of WPA Wi-Fi security" }),
        (0, import_elements.FieldElement)({
          name: "Wpa2",
          id: 4,
          conformance: "M",
          description: "Indicate the usage of WPA2 Wi-Fi security"
        }),
        (0, import_elements.FieldElement)({
          name: "Wpa3",
          id: 5,
          conformance: "M",
          description: "Indicate the usage of WPA3 Wi-Fi security"
        })
      ]
    }),
    (0, import_elements.DatatypeElement)({
      name: "WiFiVersionEnum",
      type: "enum8",
      xref: { document: "core", section: "11.15.5.2" },
      children: [
        (0, import_elements.FieldElement)({
          name: "A",
          id: 0,
          conformance: "M",
          description: "Indicate the network interface is currently using 802.11a against the wireless access point."
        }),
        (0, import_elements.FieldElement)({
          name: "B",
          id: 1,
          conformance: "M",
          description: "Indicate the network interface is currently using 802.11b against the wireless access point."
        }),
        (0, import_elements.FieldElement)({
          name: "G",
          id: 2,
          conformance: "M",
          description: "Indicate the network interface is currently using 802.11g against the wireless access point."
        }),
        (0, import_elements.FieldElement)({
          name: "N",
          id: 3,
          conformance: "M",
          description: "Indicate the network interface is currently using 802.11n against the wireless access point."
        }),
        (0, import_elements.FieldElement)({
          name: "Ac",
          id: 4,
          conformance: "M",
          description: "Indicate the network interface is currently using 802.11ac against the wireless access point."
        }),
        (0, import_elements.FieldElement)({
          name: "Ax",
          id: 5,
          conformance: "M",
          description: "Indicate the network interface is currently using 802.11ax against the wireless access point."
        }),
        (0, import_elements.FieldElement)({
          name: "Ah",
          id: 6,
          conformance: "M",
          description: "Indicate the network interface is currently using 802.11ah against the wireless access point."
        })
      ]
    }),
    (0, import_elements.DatatypeElement)({
      name: "AssociationFailureCauseEnum",
      type: "enum8",
      xref: { document: "core", section: "11.15.5.3" },
      children: [
        (0, import_elements.FieldElement)({
          name: "Unknown",
          id: 0,
          conformance: "M",
          description: "The reason for the failure is unknown."
        }),
        (0, import_elements.FieldElement)({
          name: "AssociationFailed",
          id: 1,
          conformance: "M",
          description: "An error occurred during association."
        }),
        (0, import_elements.FieldElement)({
          name: "AuthenticationFailed",
          id: 2,
          conformance: "M",
          description: "An error occurred during authentication."
        }),
        (0, import_elements.FieldElement)({
          name: "SsidNotFound",
          id: 3,
          conformance: "M",
          description: "The specified SSID could not be found."
        })
      ]
    }),
    (0, import_elements.DatatypeElement)({
      name: "ConnectionStatusEnum",
      type: "enum8",
      xref: { document: "core", section: "11.15.5.4" },
      children: [
        (0, import_elements.FieldElement)({ name: "Connected", id: 0, conformance: "M", description: "Indicate the node is connected" }),
        (0, import_elements.FieldElement)({
          name: "NotConnected",
          id: 1,
          conformance: "M",
          description: "Indicate the node is not connected"
        })
      ]
    })
  ]
});
import_MatterDefinition.MatterDefinition.children.push(WiFiNetworkDiagnostics);
//# sourceMappingURL=WiFiNetworkDiagnostics.js.map
