Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Fork of M2XStreamClient by
Diff: M2XStreamClient_template.h
- Revision:
- 10:4ce9eba38dbe
- Parent:
- 0:f479e4f4db0e
- Child:
- 13:0d574742208f
diff -r ba0d02be2835 -r 4ce9eba38dbe M2XStreamClient_template.h
--- a/M2XStreamClient_template.h Sun Sep 07 17:56:18 2014 +0000
+++ b/M2XStreamClient_template.h Wed Sep 10 13:07:34 2014 +0000
@@ -6,12 +6,12 @@
int print_encoded_string(Print* print, const char* str);
template <class T>
-int M2XStreamClient::post(const char* feedId, const char* streamName, T value) {
+int M2XStreamClient::put(const char* feedId, const char* streamName, T value) {
if (_client->connect(_host, _port)) {
DBGLN("%s", "Connected to M2X server!");
- writePostHeader(feedId, streamName,
- // for {"value": and }
- _null_print.print(value) + 10);
+ writePutHeader(feedId, streamName,
+ // for {"value": and }
+ _null_print.print(value) + 10);
_client->print("{\"value\":");
_client->print(value);
_client->print("}");
@@ -34,13 +34,9 @@
bytes += print->print(names[i]);
bytes += print->print("\":[");
for (int j = 0; j < counts[i]; j++) {
- bytes += print->print("{");
- if (ats && ats[value_index]) {
- bytes += print->print("\"at\": \"");
- bytes += print->print(ats[value_index]);
- bytes += print->print("\",");
- }
- bytes += print->print("\"value\": \"");
+ bytes += print->print("{\"at\": \"");
+ bytes += print->print(ats[value_index]);
+ bytes += print->print("\", \"value\": \"");
bytes += print->print(values[value_index]);
bytes += print->print("\"}");
if (j < counts[i] - 1) { bytes += print->print(","); }
