Skip to content

Commit 76311b8

Browse files
committed
feat: add event and arguments for port state changes in network switch management
1 parent 8817d70 commit 76311b8

1 file changed

Lines changed: 54 additions & 0 deletions

File tree

src/PepperDash.Essentials.Core/DeviceTypeInterfaces/INetworkSwitchControl.cs

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
using System;
2+
13
namespace PepperDash.Essentials.Core.DeviceTypeInterfaces
24
{
35
/// <summary>
@@ -43,6 +45,58 @@ public interface INetworkSwitchPoeManager
4345
/// </summary>
4446
public interface INetworkSwitchPoeVlanManager : INetworkSwitchVlanManager, INetworkSwitchPoeManager
4547
{
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 access VLAN on a port has changed, either through a successful call to SetPortVlan
89+
/// </summary>
90+
VlanChanged,
4691

92+
/// <summary>
93+
/// Indicates that the PoE state on a port has changed, either through a successful call to SetPortPoeState
94+
/// </summary>
95+
PoEDisabled,
96+
97+
/// <summary>
98+
/// Indicates that the PoE state on a port has changed, either through a successful call to SetPortPoeState
99+
/// </summary>
100+
PoEEnabled
47101
}
48102
}

0 commit comments

Comments
 (0)