mirror of
https://github.com/PepperDash/PepperDashCore.git
synced 2026-04-13 20:46:34 +00:00
Added event for connected to drive connected fb on module. Status change is there but it uses socket status which is not available in UDP.
This commit is contained in:
parent
a9dbaf21c2
commit
f0ad3b3706
2 changed files with 28 additions and 0 deletions
|
|
@ -93,6 +93,24 @@ namespace PepperDash.Core
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public class GenericUdpConnectedEventArgs : EventArgs
|
||||||
|
{
|
||||||
|
public ushort UConnected;
|
||||||
|
public bool Connected;
|
||||||
|
|
||||||
|
public GenericUdpConnectedEventArgs() { }
|
||||||
|
|
||||||
|
public GenericUdpConnectedEventArgs(ushort uconnected)
|
||||||
|
{
|
||||||
|
UConnected = uconnected;
|
||||||
|
}
|
||||||
|
|
||||||
|
public GenericUdpConnectedEventArgs(bool connected)
|
||||||
|
{
|
||||||
|
Connected = connected;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
@ -43,6 +43,8 @@ namespace PepperDash.Core
|
||||||
//public event GenericSocketStatusChangeEventDelegate SocketStatusChange;
|
//public event GenericSocketStatusChangeEventDelegate SocketStatusChange;
|
||||||
public event EventHandler<GenericSocketStatusChageEventArgs> ConnectionChange;
|
public event EventHandler<GenericSocketStatusChageEventArgs> ConnectionChange;
|
||||||
|
|
||||||
|
public event EventHandler<GenericUdpConnectedEventArgs> UpdateConnectionStatus;
|
||||||
|
|
||||||
public SocketStatus ClientStatus
|
public SocketStatus ClientStatus
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
|
|
@ -187,6 +189,10 @@ namespace PepperDash.Core
|
||||||
if (status == SocketErrorCodes.SOCKET_OK)
|
if (status == SocketErrorCodes.SOCKET_OK)
|
||||||
IsConnected = true;
|
IsConnected = true;
|
||||||
|
|
||||||
|
var handler = UpdateConnectionStatus;
|
||||||
|
if (handler != null)
|
||||||
|
handler(this, new GenericUdpConnectedEventArgs(UIsConnected));
|
||||||
|
|
||||||
// Start receiving data
|
// Start receiving data
|
||||||
Server.ReceiveDataAsync(Receive);
|
Server.ReceiveDataAsync(Receive);
|
||||||
}
|
}
|
||||||
|
|
@ -200,6 +206,10 @@ namespace PepperDash.Core
|
||||||
Server.DisableUDPServer();
|
Server.DisableUDPServer();
|
||||||
|
|
||||||
IsConnected = false;
|
IsConnected = false;
|
||||||
|
|
||||||
|
var handler = UpdateConnectionStatus;
|
||||||
|
if (handler != null)
|
||||||
|
handler(this, new GenericUdpConnectedEventArgs(UIsConnected));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue