getSuccessRate method
Calculates the percentage of successfully received pings. Returns success rate as a percentage (0-100), or 100 if no pings expected yet
Implementation
double getSuccessRate() {
final expectedPings = totalPings + missedPings;
return expectedPings > 0 ? (totalPings / expectedPings) * 100.0 : 100.0;
}