|
| 1 | +using System; |
| 2 | + |
| 3 | +namespace PepperDash.Essentials.Core.DeviceTypeInterfaces |
| 4 | +{ |
| 5 | + /// <summary> |
| 6 | + /// Interface for network switches that support VLAN assignment on individual ports. |
| 7 | + /// </summary> |
| 8 | + public interface INetworkSwitchVlanManager |
| 9 | + { |
| 10 | + /// <summary> |
| 11 | + /// Returns the current access VLAN ID configured on the port. |
| 12 | + /// Return -1 when the value is unavailable (e.g. the switch has not been polled yet |
| 13 | + /// or the implementation does not support VLAN queries). |
| 14 | + /// </summary> |
| 15 | + /// <param name="port">Switch port identifier</param> |
| 16 | + /// <returns>VLAN ID or -1 when unavailable</returns> |
| 17 | + int GetPortCurrentVlan(string port); |
| 18 | + |
| 19 | + /// <summary> |
| 20 | + /// Changes the access VLAN of a single switch port. |
| 21 | + /// The implementation is responsible for entering/exiting privileged/config mode. |
| 22 | + /// </summary> |
| 23 | + /// <param name="port">Switch port identifier (e.g. "1/0/3" for Netgear, "gi1/0/3" for Cisco)</param> |
| 24 | + /// <param name="vlanId">Target VLAN ID (1-4093)</param> |
| 25 | + void SetPortVlan(string port, uint vlanId); |
| 26 | + } |
| 27 | + |
| 28 | + /// <summary> |
| 29 | + /// Interface for network switches that support Power over Ethernet (PoE) control on individual ports. |
| 30 | + /// </summary> |
| 31 | + public interface INetworkSwitchPoeManager |
| 32 | + { |
| 33 | + /// <summary> |
| 34 | + /// Enables or disables PoE power delivery on a single switch port. |
| 35 | + /// The implementation is responsible for entering/exiting privileged/config mode. |
| 36 | + /// </summary> |
| 37 | + /// <param name="port">Switch port identifier</param> |
| 38 | + /// <param name="enabled">True to enable PoE; false to disable PoE</param> |
| 39 | + void SetPortPoeState(string port, bool enabled); |
| 40 | + } |
| 41 | + |
| 42 | + /// <summary> |
| 43 | + /// Standardized interface for network switch devices that support per-port PoE control |
| 44 | + /// and VLAN assignment. |
| 45 | + /// </summary> |
| 46 | + public interface INetworkSwitchPoeVlanManager : INetworkSwitchVlanManager, INetworkSwitchPoeManager |
| 47 | + { |
| 48 | + /// <summary> |
| 49 | + /// Event that is raised when the state of a switch port changes, such as a VLAN change or PoE state change. |
| 50 | + /// </summary> |
| 51 | + event EventHandler<NetworkSwitchPortEventArgs> PortStateChanged; |
| 52 | + |
| 53 | + } |
| 54 | + |
| 55 | + /// <summary> |
| 56 | + /// Event arguments for port state changes on a network switch, such as VLAN changes or PoE state changes. |
| 57 | + /// </summary> |
| 58 | + public class NetworkSwitchPortEventArgs : EventArgs |
| 59 | + { |
| 60 | + /// <summary> |
| 61 | + /// The identifier of the port that changed state (e.g. "1/0/3" for Netgear, "gi1/0/3" for Cisco). |
| 62 | + /// </summary> |
| 63 | + public string Port { get; private set; } |
| 64 | + |
| 65 | + /// <summary> |
| 66 | + /// The type of event that occurred on the port (e.g. VLAN change, PoE enabled/disabled). |
| 67 | + /// </summary> |
| 68 | + public NetworkSwitchPortEventType EventType { get; private set; } |
| 69 | + |
| 70 | + /// <summary> |
| 71 | + /// Constructor for NetworkSwitchPortEventArgs |
| 72 | + /// </summary> |
| 73 | + /// <param name="port">The identifier of the port that changed state</param> |
| 74 | + /// <param name="eventType">The type of event that occurred on the port</param> |
| 75 | + public NetworkSwitchPortEventArgs(string port, NetworkSwitchPortEventType eventType) |
| 76 | + { |
| 77 | + Port = port; |
| 78 | + EventType = eventType; |
| 79 | + } |
| 80 | + } |
| 81 | + |
| 82 | + /// <summary> |
| 83 | + /// Event arguments for port state changes on a network switch, such as VLAN changes or PoE state changes. |
| 84 | + /// </summary> |
| 85 | + public enum NetworkSwitchPortEventType |
| 86 | + { |
| 87 | + /// <summary> |
| 88 | + /// Indicates that the type of event is unknown or cannot be determined. |
| 89 | + /// </summary> |
| 90 | + Unknown, |
| 91 | + |
| 92 | + /// <summary> |
| 93 | + /// Indicates that a VLAN change is in progress on the port, either through a call to SetPortVlan or an external change detected by polling. |
| 94 | + /// </summary> |
| 95 | + VlanChangeInProgress, |
| 96 | + |
| 97 | + /// <summary> |
| 98 | + /// Indicates that the access VLAN on a port has changed, either through a successful call to SetPortVlan |
| 99 | + /// </summary> |
| 100 | + VlanChanged, |
| 101 | + |
| 102 | + /// <summary> |
| 103 | + /// Indicates that PoE is being disabled on the port, either through a call to SetPortPoeState or an external change detected by polling. |
| 104 | + /// </summary> |
| 105 | + PoeDisableInProgress, |
| 106 | + |
| 107 | + /// <summary> |
| 108 | + /// Indicates that the PoE state on a port has changed, either through a successful call to SetPortPoeState |
| 109 | + /// </summary> |
| 110 | + PoEDisabled, |
| 111 | + |
| 112 | + /// <summary> |
| 113 | + /// Indicates that PoE is being enabled on the port, either through a call to SetPortPoeState or an external change detected by polling. |
| 114 | + /// </summary> |
| 115 | + PoeEnableInProgress, |
| 116 | + |
| 117 | + /// <summary> |
| 118 | + /// Indicates that the PoE state on a port has changed, either through a successful call to SetPortPoeState |
| 119 | + /// </summary> |
| 120 | + PoEEnabled |
| 121 | + } |
| 122 | +} |
0 commit comments