spark/core-firmware — pull request #156 by bkobkobko (2014-03-22 02:10:28+00:00)
Title: Add Support for Network.ping()

We might want to have some discussion about the while loop that polls for either a report struct or timeout. If the user asks for 5000 pings, especially for a host that is unreachable, the Spark loop could timeout but I am not sure we want to call the Spark loop here.

Here's the test program:

#include "application.h"

IPAddress google(74,125,225,52);
IPAddress yahoo(98,139,180,149);
IPAddress spark(62,116,130,8);

void setup() {
Serial.begin(9600);
delay(2000);
}

void loop() {
Serial.print("G: ");
Serial.println(Network.ping(google));
Serial.print(" Y: ");
Serial.println(Network.ping(yahoo));
Serial.print(" S: ");
Serial.println(Network.ping(spark));
Serial.print(" Fail: ");
Serial.println(Network.ping(IPAddress(10,0,0,200))); // picked to fail
delay(10000);
}