diff --git a/examples/ReadLastTemperature/ReadLastTemperature.ino b/examples/ReadLastTemperature/ReadLastTemperature.ino
index e3c9fd0..8cbbe2e 100644
--- a/examples/ReadLastTemperature/ReadLastTemperature.ino
+++ b/examples/ReadLastTemperature/ReadLastTemperature.ino
@@ -8,7 +8,7 @@
ThingSpeak ( https://www.thingspeak.com ) is a free IoT service for building
systems that collect, analyze, and react to their environments.
- Copyright 2015, The MathWorks, Inc.
+ Copyright 2016, The MathWorks, Inc.
Documentation for the ThingSpeak Communication Library for Arduino is in the extras/documentation folder where the library was installed.
See the accompaning licence file for licensing information.
@@ -105,7 +105,7 @@ void loop() {
Serial.println(" degrees F");
#endif
#ifdef SPARK
- Spark.publish("thingspeak-lasttemp", "Current temp " + String(temperatureInF) + " degrees F",60,PRIVATE);
+ Particle.publish("thingspeak-lasttemp", String::format("Current temp %.1f degrees F",temperatureInF),60,PRIVATE);
#endif
delay(30000); // Note that the weather station only updates once a minute
}
diff --git a/examples/ReadPrivateChannel/ReadPrivateChannel.ino b/examples/ReadPrivateChannel/ReadPrivateChannel.ino
index ecd33ba..5c266a7 100644
--- a/examples/ReadPrivateChannel/ReadPrivateChannel.ino
+++ b/examples/ReadPrivateChannel/ReadPrivateChannel.ino
@@ -9,7 +9,7 @@
ThingSpeak ( https://www.thingspeak.com ) is a free IoT service for prototyping
systems that collect, analyze, and react to their environments.
- Copyright 2015, The MathWorks, Inc.
+ Copyright 2016, The MathWorks, Inc.
Documentation for the ThingSpeak Communication Library for Arduino is in the extras/documentation folder where the library was installed.
See the accompaning licence file for licensing information.
@@ -108,7 +108,7 @@ void loop() {
Serial.println("V");
#endif
#ifdef SPARK
- Spark.publish("thingspeak-readvoltage", "Latest voltage is: " + String(voltage) + "V",60,PRIVATE);
+ Particle.publish("thingspeak-readvoltage", "Latest voltage is: " + String(voltage) + "V",60,PRIVATE);
#endif
delay(30000);
}
diff --git a/examples/ReadWeatherStation/ReadWeatherStation.ino b/examples/ReadWeatherStation/ReadWeatherStation.ino
index 4a9a966..db6b9cd 100644
--- a/examples/ReadWeatherStation/ReadWeatherStation.ino
+++ b/examples/ReadWeatherStation/ReadWeatherStation.ino
@@ -7,7 +7,7 @@
ThingSpeak ( https://www.thingspeak.com ) is a free IoT service for prototyping
systems that collect, analyze, and react to their environments.
- Copyright 2015, The MathWorks, Inc.
+ Copyright 2016, The MathWorks, Inc.
Documentation for the ThingSpeak Communication Library for Arduino is in the extras/documentation folder where the library was installed.
See the accompaning licence file for licensing information.
@@ -126,16 +126,16 @@ void loop() {
Serial.println();
#endif
#ifdef SPARK
- Spark.publish("thingspeak-weather", "Current weather conditions in Natick: ",60,PRIVATE);
- Spark.publish("thingspeak-weather", String(temperature) + " degrees F, " + String(humidity) + "% humidity",60,PRIVATE);
- Spark.publish("thingspeak-weather", "Wind at " + String(windSpeed) + " MPH at " + String (windDirection) + " degrees",60,PRIVATE);
+ Particle.publish("thingspeak-weather", "Current weather conditions in Natick: ",60,PRIVATE);
+ Particle.publish("thingspeak-weather", String(temperature) + " degrees F, " + String(humidity) + "% humidity",60,PRIVATE);
+ Particle.publish("thingspeak-weather", "Wind at " + String(windSpeed) + " MPH at " + String (windDirection) + " degrees",60,PRIVATE);
if(rainfall > 0)
{
- Spark.publish("thingspeak-weather", "Pressure is " + String(pressure) + " inHg, and it's raining",60,PRIVATE);
+ Particle.publish("thingspeak-weather", "Pressure is " + String(pressure) + " inHg, and it's raining",60,PRIVATE);
}
else
{
- Spark.publish("thingspeak-weather", "Pressure is " + String(pressure) + " inHg",60,PRIVATE);
+ Particle.publish("thingspeak-weather", "Pressure is " + String(pressure) + " inHg",60,PRIVATE);
}
#endif
diff --git a/extras/documentation/_thing_speak_8h_source.html b/extras/documentation/_thing_speak_8h_source.html
index 559101e..f1660e1 100644
--- a/extras/documentation/_thing_speak_8h_source.html
+++ b/extras/documentation/_thing_speak_8h_source.html
@@ -1,7 +1,7 @@
@@ -57,7 +57,7 @@
-
+
@@ -234,7 +234,7 @@
378 #ifdef PRINT_DEBUG_MESSAGES
- 380 Spark.publish(SPARK_PUBLISH_TOPIC,
"writeField (" + String(channelNumber) +
", " + String(writeAPIKey) +
", " + String(field) +
", " + String(value) +
")", SPARK_PUBLISH_TTL, PRIVATE);
+ 380 Particle.publish(SPARK_PUBLISH_TOPIC,
"writeField (" + String(channelNumber) +
", " + String(writeAPIKey) +
", " + String(field) +
", " + String(value) +
")", SPARK_PUBLISH_TTL, PRIVATE);
382 Serial.print(
"ts::writeField (channelNumber: "); Serial.print(channelNumber); Serial.print(
" writeAPIKey: "); Serial.print(writeAPIKey); Serial.print(
" field: "); Serial.print(field); Serial.print(
" value: \""); Serial.print(value); Serial.println(
"\")");
@@ -283,7 +283,7 @@
582 #ifdef PRINT_DEBUG_MESSAGES
- 584 Spark.publish(SPARK_PUBLISH_TOPIC,
"setField " + String(field) +
" to " + String(value), SPARK_PUBLISH_TTL, PRIVATE);
+ 584 Particle.publish(SPARK_PUBLISH_TOPIC,
"setField " + String(field) +
" to " + String(value), SPARK_PUBLISH_TTL, PRIVATE);
586 Serial.print(
"ts::setField (field: "); Serial.print(field); Serial.print(
" value: \""); Serial.print(value); Serial.println(
"\")");
@@ -410,7 +410,7 @@
877 #ifdef PRINT_DEBUG_MESSAGES
- 879 Spark.publish(SPARK_PUBLISH_TOPIC,
"Post " + postMessage, SPARK_PUBLISH_TTL, PRIVATE);
+ 879 Particle.publish(SPARK_PUBLISH_TOPIC,
"Post " + postMessage, SPARK_PUBLISH_TTL, PRIVATE);
881 Serial.print(
" POST \"");Serial.print(postMessage);Serial.println(
"\"");
@@ -672,7 +672,7 @@
1323 #ifdef PRINT_DEBUG_MESSAGES
- 1325 Spark.publish(SPARK_PUBLISH_TOPIC,
"Attempt Connect to URL " + String(this->customHostName), SPARK_PUBLISH_TTL, PRIVATE);
+ 1325 Particle.publish(SPARK_PUBLISH_TOPIC,
"Attempt Connect to URL " + String(this->customHostName), SPARK_PUBLISH_TTL, PRIVATE);
1327 Serial.print(
" Connect to ");Serial.print(this->customHostName);Serial.print(
" ...");
@@ -685,7 +685,7 @@
- 1338 Spark.publish(SPARK_PUBLISH_TOPIC,
"Connection Success", SPARK_PUBLISH_TTL, PRIVATE);
+ 1338 Particle.publish(SPARK_PUBLISH_TOPIC,
"Connection Success", SPARK_PUBLISH_TTL, PRIVATE);
1340 Serial.println(
"Success.");
@@ -693,7 +693,7 @@
- 1346 Spark.publish(SPARK_PUBLISH_TOPIC,
"Connection Failure", SPARK_PUBLISH_TTL, PRIVATE);
+ 1346 Particle.publish(SPARK_PUBLISH_TOPIC,
"Connection Failure", SPARK_PUBLISH_TTL, PRIVATE);
1348 Serial.println(
"Failed.");
@@ -742,98 +742,121 @@
1392 if(!client->find(const_cast<char *>(
"HTTP/1.1")))
- 1395 Serial.println(
"ERROR: Didn't find HTTP/1.1");
-
- 1397 return ERR_BAD_RESPONSE;
-
- 1399 int status = client->parseInt();
-
- 1401 Serial.print(
"Got Status of ");Serial.println(status);
-
- 1403 if(status != OK_SUCCESS)
-
-
-
-
- 1408 if(!client->find(const_cast<char *>(
"\n\r\n")))
-
-
- 1411 Serial.println(
"ERROR: Didn't find end of header");
-
- 1413 return ERR_BAD_RESPONSE;
+
+ 1396 Particle.publish(SPARK_PUBLISH_TOPIC,
"ERROR: Didn't find HTTP/1.1", SPARK_PUBLISH_TTL, PRIVATE);
+
+ 1398 Serial.println(
"ERROR: Didn't find HTTP/1.1");
+
+
+ 1401 return ERR_BAD_RESPONSE;
+
+ 1403 int status = client->parseInt();
+
+
+ 1406 Particle.publish(SPARK_PUBLISH_TOPIC,
"Got Status of " + String(status), SPARK_PUBLISH_TTL, PRIVATE);
+
+ 1408 Serial.print(
"Got Status of ");Serial.println(status);
+
+
+ 1411 if(status != OK_SUCCESS)
+
+
-
- 1416 Serial.println(
"Found end of header");
-
-
-
-
- 1421 long length = client->parseInt();
- 1422 Serial.print(
"Got length of ");Serial.println(length);
-
- 1424 if(!client->find(const_cast<char *>(
"\r\n")))
-
-
- 1427 Serial.println(
"ERROR: Didn't find end of length");
-
- 1429 return ERR_BAD_RESPONSE;
-
-
- 1432 Serial.println(
"Found end of length");
+
+ 1416 if(!client->find(const_cast<char *>(
"\r\n")))
+
+
+
+ 1420 Particle.publish(SPARK_PUBLISH_TOPIC,
"ERROR: Didn't find end of status line", SPARK_PUBLISH_TTL, PRIVATE);
+
+ 1422 Serial.println(
"ERROR: Didn't find end of status line");
+
+
+ 1425 return ERR_BAD_RESPONSE;
+
+
+
+ 1429 Particle.publish(SPARK_PUBLISH_TOPIC,
"Found end of status line", SPARK_PUBLISH_TTL, PRIVATE);
+
+ 1431 Serial.println(
"Found end of status line");
+
-
- 1435 String tempString = client->readStringUntil(
'\r');
- 1436 response = tempString;
-
- 1438 Serial.print(
"Response: \"");Serial.print(response);Serial.println(
"\"");
-
-
-
-
- 1443 int convertFloatToChar(
float value,
char *valueString)
-
-
- 1446 if(0 == isinf(value) && (value > 999999000000 || value < -999999000000))
-
-
- 1449 return ERR_OUT_OF_RANGE;
-
-
- 1452 #ifdef PARTICLE_PHOTONELECTRON
-
- 1454 dtoa((
double)value,5, valueString);
-
- 1456 dtostrf(value,1,5, valueString);
-
-
-
-
- 1461 float convertStringToFloat(String value)
-
-
- 1464 float result = value.toFloat();
- 1465 if(1 == isinf(result) && *value.c_str() ==
'-')
-
- 1467 result = (float)-INFINITY;
-
-
-
-
- 1472 void resetWriteFields()
-
- 1474 for(
size_t iField = 0; iField < 8; iField++)
-
- 1476 this->nextWriteField[iField] =
"";
-
- 1478 this->nextWriteLatitude = NAN;
- 1479 this->nextWriteLongitude = NAN;
- 1480 this->nextWriteElevation = NAN;
-
-
+
+ 1435 if(!client->find(const_cast<char *>(
"\n\r\n")))
+
+
+
+ 1439 Particle.publish(SPARK_PUBLISH_TOPIC,
"ERROR: Didn't find end of header", SPARK_PUBLISH_TTL, PRIVATE);
+
+ 1441 Serial.println(
"ERROR: Didn't find end of header");
+
+
+ 1444 return ERR_BAD_RESPONSE;
+
+
+
+ 1448 Particle.publish(SPARK_PUBLISH_TOPIC,
"Found end of header", SPARK_PUBLISH_TTL, PRIVATE);
+
+ 1450 Serial.println(
"Found end of header");
+
+
+
+ 1454 String tempString = client->readStringUntil(
'\r');
+ 1455 response = tempString;
+
+
+ 1458 Particle.publish(SPARK_PUBLISH_TOPIC,
"Response: \"" + tempString +
"\"", SPARK_PUBLISH_TTL, PRIVATE);
+
+ 1460 Serial.print(
"Response: \"");Serial.print(response);Serial.println(
"\"");
+
+
+
+
+
+ 1466 int convertFloatToChar(
float value,
char *valueString)
+
+
+ 1469 if(0 == isinf(value) && (value > 999999000000 || value < -999999000000))
+
+
+ 1472 return ERR_OUT_OF_RANGE;
+
+
+ 1475 #ifdef PARTICLE_PHOTONELECTRON
+
+ 1477 dtoa((
double)value,5, valueString);
+
+ 1479 dtostrf(value,1,5, valueString);
+
+
+
-
-
- 1486 #endif //ThingSpeak_h
+ 1484 float convertStringToFloat(String value)
+
+
+ 1487 float result = value.toFloat();
+ 1488 if(1 == isinf(result) && *value.c_str() ==
'-')
+
+ 1490 result = (float)-INFINITY;
+
+
+
+
+ 1495 void resetWriteFields()
+
+ 1497 for(
size_t iField = 0; iField < 8; iField++)
+
+ 1499 this->nextWriteField[iField] =
"";
+
+ 1501 this->nextWriteLatitude = NAN;
+ 1502 this->nextWriteLongitude = NAN;
+ 1503 this->nextWriteElevation = NAN;
+
+
+
+
+
+ 1509 #endif //ThingSpeak_h
int writeRaw(unsigned long channelNumber, const char *postMessage, const char *writeAPIKey)
Write a raw POST to a ThingSpeak channel.
Definition: ThingSpeak.h:842
String readStringField(unsigned long channelNumber, unsigned int field, const char *readAPIKey)
Read the latest string from a private ThingSpeak channel.
Definition: ThingSpeak.h:937
String readStringField(unsigned long channelNumber, unsigned int field)
Read the latest string from a public ThingSpeak channel.
Definition: ThingSpeak.h:970
@@ -867,6 +890,11 @@
int writeField(unsigned long channelNumber, unsigned int field, long value, const char *writeAPIKey)
Write a long value to a single field in a ThingSpeak channel.
Definition: ThingSpeak.h:285
+
diff --git a/extras/documentation/annotated.html b/extras/documentation/annotated.html
index 708b90f..dc5784c 100644
--- a/extras/documentation/annotated.html
+++ b/extras/documentation/annotated.html
@@ -1,7 +1,7 @@
@@ -57,6 +57,11 @@
+
diff --git a/extras/documentation/class_thing_speak_class.html b/extras/documentation/class_thing_speak_class.html
index c7ba2e9..3ddf80f 100644
--- a/extras/documentation/class_thing_speak_class.html
+++ b/extras/documentation/class_thing_speak_class.html
@@ -1,7 +1,7 @@
@@ -1703,6 +1703,11 @@
+
diff --git a/extras/documentation/classes.html b/extras/documentation/classes.html
index aa46863..5802220 100644
--- a/extras/documentation/classes.html
+++ b/extras/documentation/classes.html
@@ -1,7 +1,7 @@
@@ -61,6 +61,11 @@
+
diff --git a/extras/documentation/dir_339e8c1d13ed9d171a31356d80f51341.html b/extras/documentation/dir_339e8c1d13ed9d171a31356d80f51341.html
index 30d6c39..311dace 100644
--- a/extras/documentation/dir_339e8c1d13ed9d171a31356d80f51341.html
+++ b/extras/documentation/dir_339e8c1d13ed9d171a31356d80f51341.html
@@ -1,7 +1,7 @@
@@ -56,6 +56,11 @@
+
diff --git a/extras/documentation/dir_9eb8a1162b9e86c4bf1f8e762bfe83d1.html b/extras/documentation/dir_9eb8a1162b9e86c4bf1f8e762bfe83d1.html
index 2c52975..013a2d8 100644
--- a/extras/documentation/dir_9eb8a1162b9e86c4bf1f8e762bfe83d1.html
+++ b/extras/documentation/dir_9eb8a1162b9e86c4bf1f8e762bfe83d1.html
@@ -1,7 +1,7 @@
@@ -58,6 +58,11 @@
+
diff --git a/extras/documentation/functions.html b/extras/documentation/functions.html
index ffe321f..a449aec 100644
--- a/extras/documentation/functions.html
+++ b/extras/documentation/functions.html
@@ -1,7 +1,7 @@
@@ -98,6 +98,11 @@
+
diff --git a/extras/documentation/functions_func.html b/extras/documentation/functions_func.html
index a5dc999..f8be767 100644
--- a/extras/documentation/functions_func.html
+++ b/extras/documentation/functions_func.html
@@ -1,7 +1,7 @@
@@ -98,6 +98,11 @@
+
diff --git a/extras/documentation/index.html b/extras/documentation/index.html
index 4017b85..1393bd4 100644
--- a/extras/documentation/index.html
+++ b/extras/documentation/index.html
@@ -1,7 +1,7 @@
@@ -67,6 +67,11 @@ Examples
+
diff --git a/library.json b/library.json
new file mode 100644
index 0000000..f96db87
--- /dev/null
+++ b/library.json
@@ -0,0 +1,24 @@
+{
+ "name": "ThingSpeak",
+ "keywords": "iot",
+ "description": "ThingSpeak Communication Library for Arduino & ESP8266",
+ "authors":
+ {
+ "name": "MathWorks",
+ "email": "thingspeak@mathworks.com",
+ "url": "https://www.thingspeak.com/",
+ "maintainer": true
+ },
+ "repository":
+ {
+ "type": "git",
+ "url": "https://github.com/mathworks/thingspeak-arduino.git"
+ },
+ "examples": [
+ "examples/*/*.ino"
+ ],
+ "url": "https://www.thingspeak.com/",
+ "exclude": "extras",
+ "frameworks": "arduino",
+ "platforms": "*"
+}
\ No newline at end of file
diff --git a/library.properties b/library.properties
index 574b28f..b21a29d 100644
--- a/library.properties
+++ b/library.properties
@@ -1,5 +1,5 @@
name=ThingSpeak
-version=1.1.0
+version=1.1.1
author=MathWorks
maintainer=MathWorks
sentence=ThingSpeak Communication Library for Arduino & ESP8266
diff --git a/src/ThingSpeak.h b/src/ThingSpeak.h
index 6dad1f8..9be667d 100644
--- a/src/ThingSpeak.h
+++ b/src/ThingSpeak.h
@@ -7,7 +7,7 @@
ThingSpeak ( https://www.thingspeak.com ) is a free IoT service for building
systems that collect, analyze, and react to their environments.
- Copyright 2015, The MathWorks, Inc.
+ Copyright 2016, The MathWorks, Inc.
See the accompaning licence file for licensing information.
*/
@@ -377,7 +377,7 @@ class ThingSpeakClass
#ifdef PRINT_DEBUG_MESSAGES
#ifdef SPARK
- Spark.publish(SPARK_PUBLISH_TOPIC, "writeField (" + String(channelNumber) + ", " + String(writeAPIKey) + ", " + String(field) + ", " + String(value) + ")", SPARK_PUBLISH_TTL, PRIVATE);
+ Particle.publish(SPARK_PUBLISH_TOPIC, "writeField (" + String(channelNumber) + ", " + String(writeAPIKey) + ", " + String(field) + ", " + String(value) + ")", SPARK_PUBLISH_TTL, PRIVATE);
#else
Serial.print("ts::writeField (channelNumber: "); Serial.print(channelNumber); Serial.print(" writeAPIKey: "); Serial.print(writeAPIKey); Serial.print(" field: "); Serial.print(field); Serial.print(" value: \""); Serial.print(value); Serial.println("\")");
#endif
@@ -581,7 +581,7 @@ class ThingSpeakClass
{
#ifdef PRINT_DEBUG_MESSAGES
#ifdef SPARK
- Spark.publish(SPARK_PUBLISH_TOPIC, "setField " + String(field) + " to " + String(value), SPARK_PUBLISH_TTL, PRIVATE);
+ Particle.publish(SPARK_PUBLISH_TOPIC, "setField " + String(field) + " to " + String(value), SPARK_PUBLISH_TTL, PRIVATE);
#else
Serial.print("ts::setField (field: "); Serial.print(field); Serial.print(" value: \""); Serial.print(value); Serial.println("\")");
#endif
@@ -876,7 +876,7 @@ class ThingSpeakClass
#ifdef PRINT_DEBUG_MESSAGES
#ifdef SPARK
- Spark.publish(SPARK_PUBLISH_TOPIC, "Post " + postMessage, SPARK_PUBLISH_TTL, PRIVATE);
+ Particle.publish(SPARK_PUBLISH_TOPIC, "Post " + postMessage, SPARK_PUBLISH_TTL, PRIVATE);
#else
Serial.print(" POST \"");Serial.print(postMessage);Serial.println("\"");
#endif
@@ -1322,7 +1322,7 @@ class ThingSpeakClass
// Connect to the server on port 80 (HTTP) at the URL address
#ifdef PRINT_DEBUG_MESSAGES
#ifdef SPARK
- Spark.publish(SPARK_PUBLISH_TOPIC, "Attempt Connect to URL " + String(this->customHostName), SPARK_PUBLISH_TTL, PRIVATE);
+ Particle.publish(SPARK_PUBLISH_TOPIC, "Attempt Connect to URL " + String(this->customHostName), SPARK_PUBLISH_TTL, PRIVATE);
#else
Serial.print(" Connect to ");Serial.print(this->customHostName);Serial.print(" ...");
#endif
@@ -1335,7 +1335,7 @@ class ThingSpeakClass
if (connectSuccess)
{
#ifdef SPARK
- Spark.publish(SPARK_PUBLISH_TOPIC, "Connection Success", SPARK_PUBLISH_TTL, PRIVATE);
+ Particle.publish(SPARK_PUBLISH_TOPIC, "Connection Success", SPARK_PUBLISH_TTL, PRIVATE);
#else
Serial.println("Success.");
#endif
@@ -1343,7 +1343,7 @@ class ThingSpeakClass
else
{
#ifdef SPARK
- Spark.publish(SPARK_PUBLISH_TOPIC, "Connection Failure", SPARK_PUBLISH_TTL, PRIVATE);
+ Particle.publish(SPARK_PUBLISH_TOPIC, "Connection Failure", SPARK_PUBLISH_TTL, PRIVATE);
#else
Serial.println("Failed.");
#endif
@@ -1392,50 +1392,73 @@ class ThingSpeakClass
if(!client->find(const_cast("HTTP/1.1")))
{
#ifdef PRINT_HTTP
- Serial.println("ERROR: Didn't find HTTP/1.1");
- #endif
+ #ifdef SPARK
+ Particle.publish(SPARK_PUBLISH_TOPIC, "ERROR: Didn't find HTTP/1.1", SPARK_PUBLISH_TTL, PRIVATE);
+ #else
+ Serial.println("ERROR: Didn't find HTTP/1.1");
+ #endif
+ #endif
return ERR_BAD_RESPONSE; // Couldn't parse response (didn't find HTTP/1.1)
}
int status = client->parseInt();
#ifdef PRINT_HTTP
- Serial.print("Got Status of ");Serial.println(status);
+ #ifdef SPARK
+ Particle.publish(SPARK_PUBLISH_TOPIC, "Got Status of " + String(status), SPARK_PUBLISH_TTL, PRIVATE);
+ #else
+ Serial.print("Got Status of ");Serial.println(status);
+ #endif
#endif
if(status != OK_SUCCESS)
{
return status;
}
- if(!client->find(const_cast("\n\r\n")))
+ if(!client->find(const_cast("\r\n")))
{
#ifdef PRINT_HTTP
- Serial.println("ERROR: Didn't find end of header");
+ #ifdef SPARK
+ Particle.publish(SPARK_PUBLISH_TOPIC, "ERROR: Didn't find end of status line", SPARK_PUBLISH_TTL, PRIVATE);
+ #else
+ Serial.println("ERROR: Didn't find end of status line");
+ #endif
#endif
return ERR_BAD_RESPONSE;
}
#ifdef PRINT_HTTP
- Serial.println("Found end of header");
- #endif
- #ifndef PRINT_HTTP
- client->parseInt();
- #else
- long length = client->parseInt();
- Serial.print("Got length of ");Serial.println(length);
+ #ifdef SPARK
+ Particle.publish(SPARK_PUBLISH_TOPIC, "Found end of status line", SPARK_PUBLISH_TTL, PRIVATE);
+ #else
+ Serial.println("Found end of status line");
+ #endif
#endif
- if(!client->find(const_cast("\r\n")))
+
+ if(!client->find(const_cast("\n\r\n")))
{
#ifdef PRINT_HTTP
- Serial.println("ERROR: Didn't find end of length");
+ #ifdef SPARK
+ Particle.publish(SPARK_PUBLISH_TOPIC, "ERROR: Didn't find end of header", SPARK_PUBLISH_TTL, PRIVATE);
+ #else
+ Serial.println("ERROR: Didn't find end of header");
+ #endif
#endif
return ERR_BAD_RESPONSE;
}
#ifdef PRINT_HTTP
- Serial.println("Found end of length");
+ #ifdef SPARK
+ Particle.publish(SPARK_PUBLISH_TOPIC, "Found end of header", SPARK_PUBLISH_TTL, PRIVATE);
+ #else
+ Serial.println("Found end of header");
+ #endif
#endif
// This is a workaround to a bug in the Spark implementation of String
String tempString = client->readStringUntil('\r');
response = tempString;
#ifdef PRINT_HTTP
- Serial.print("Response: \"");Serial.print(response);Serial.println("\"");
+ #ifdef SPARK
+ Particle.publish(SPARK_PUBLISH_TOPIC, "Response: \"" + tempString + "\"", SPARK_PUBLISH_TTL, PRIVATE);
+ #else
+ Serial.print("Response: \"");Serial.print(response);Serial.println("\"");
+ #endif
#endif
return status;
};