Initial commit - Pingerino network monitoring application
هذا الالتزام موجود في:
67
Services/Interfaces/IPingService.cs
Normal file
67
Services/Interfaces/IPingService.cs
Normal file
@@ -0,0 +1,67 @@
|
||||
using System;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Pingerino.Services.Interfaces
|
||||
{
|
||||
public interface IPingService : IDisposable
|
||||
{
|
||||
event EventHandler<PingResultEventArgs> PingCompleted;
|
||||
event EventHandler<NetworkStatisticsEventArgs> StatisticsUpdated;
|
||||
|
||||
System.Threading.Tasks.Task StartPingingAsync(string ipAddress, int intervalMs, CancellationToken cancellationToken = default);
|
||||
System.Threading.Tasks.Task StopPingingAsync();
|
||||
System.Threading.Tasks.Task<PingResult> PingOnceAsync(string ipAddress, CancellationToken cancellationToken = default);
|
||||
void ClearStatistics();
|
||||
NetworkStatistics GetCurrentStatistics();
|
||||
bool IsRunning { get; }
|
||||
}
|
||||
|
||||
public class PingResultEventArgs : EventArgs
|
||||
{
|
||||
public PingResult Result { get; }
|
||||
public DateTime Timestamp { get; }
|
||||
|
||||
public PingResultEventArgs(PingResult result, DateTime timestamp)
|
||||
{
|
||||
Result = result;
|
||||
Timestamp = timestamp;
|
||||
}
|
||||
}
|
||||
|
||||
public class NetworkStatisticsEventArgs : EventArgs
|
||||
{
|
||||
public NetworkStatistics Statistics { get; }
|
||||
|
||||
public NetworkStatisticsEventArgs(NetworkStatistics statistics)
|
||||
{
|
||||
Statistics = statistics;
|
||||
}
|
||||
}
|
||||
|
||||
public class PingResult
|
||||
{
|
||||
public string IpAddress { get; set; }
|
||||
public bool IsSuccess { get; set; }
|
||||
public long RoundTripTime { get; set; }
|
||||
public string Status { get; set; }
|
||||
public string ErrorMessage { get; set; }
|
||||
}
|
||||
|
||||
public class NetworkStatistics
|
||||
{
|
||||
public double Jitter { get; set; }
|
||||
public double PacketLoss { get; set; }
|
||||
public long MaxPing { get; set; }
|
||||
public long MinPing { get; set; }
|
||||
public double AveragePing { get; set; }
|
||||
public double MaxJitter { get; set; }
|
||||
public double MinJitter { get; set; }
|
||||
public double AverageJitter { get; set; }
|
||||
public double MaxPacketLoss { get; set; }
|
||||
public double MinPacketLoss { get; set; }
|
||||
public double AveragePacketLoss { get; set; }
|
||||
public int TotalPings { get; set; }
|
||||
public int SuccessfulPings { get; set; }
|
||||
}
|
||||
}
|
المرجع في مشكلة جديدة
حظر مستخدم