From 7d72993494b5192ea6d5f140c87da1a1e0441e2f Mon Sep 17 00:00:00 2001 From: Jun Jie Yong Date: Wed, 5 Sep 2018 13:15:48 +0800 Subject: [PATCH 1/4] Update Print.h Allow multiple argument --- cores/arduino/Print.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/cores/arduino/Print.h b/cores/arduino/Print.h index 058a2abbd..14117a25f 100644 --- a/cores/arduino/Print.h +++ b/cores/arduino/Print.h @@ -73,6 +73,7 @@ class Print size_t print(unsigned long, int = DEC); size_t print(double, int = 2); size_t print(const Printable&); + template size_t print(Arg arg, Args... args){ return print(arg) + print(args...); } size_t println(const __FlashStringHelper *); size_t println(const String &s); @@ -86,6 +87,7 @@ class Print size_t println(double, int = 2); size_t println(const Printable&); size_t println(void); + template size_t println(Args... args) { return print(args...) + println(); } virtual void flush() { /* Empty implementation for backward compatibility */ } }; From 71cb54d48959cb8f4b2493fab0fd47d8a426e6fa Mon Sep 17 00:00:00 2001 From: Jun Jie Yong Date: Wed, 5 Sep 2018 13:51:46 +0800 Subject: [PATCH 2/4] Update Print.h --- cores/arduino/Print.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cores/arduino/Print.h b/cores/arduino/Print.h index 14117a25f..9b0c7247f 100644 --- a/cores/arduino/Print.h +++ b/cores/arduino/Print.h @@ -73,7 +73,7 @@ class Print size_t print(unsigned long, int = DEC); size_t print(double, int = 2); size_t print(const Printable&); - template size_t print(Arg arg, Args... args){ return print(arg) + print(args...); } + template size_t print(Arg arg0, Arg arg1, Args... args){ return print(arg0) + print(arg1) + print(args...); } size_t println(const __FlashStringHelper *); size_t println(const String &s); From 3defea75a913a1ecfb990f326037ccd47e047312 Mon Sep 17 00:00:00 2001 From: Jun Jie Yong Date: Wed, 5 Sep 2018 14:00:24 +0800 Subject: [PATCH 3/4] Update IPAddress.h --- cores/arduino/IPAddress.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/cores/arduino/IPAddress.h b/cores/arduino/IPAddress.h index d762f2c02..0631739d6 100644 --- a/cores/arduino/IPAddress.h +++ b/cores/arduino/IPAddress.h @@ -58,6 +58,8 @@ class IPAddress : public Printable { // Overloaded index operator to allow getting and setting individual octets of the address uint8_t operator[](int index) const { return _address.bytes[index]; }; uint8_t& operator[](int index) { return _address.bytes[index]; }; + + String toString(); // Overloaded copy operators to allow initialisation of IPAddress objects from other types IPAddress& operator=(const uint8_t *address); From e8dff678b21ce7d7fa06753ca3a65435e045d6e3 Mon Sep 17 00:00:00 2001 From: Jun Jie Yong Date: Wed, 5 Sep 2018 14:01:15 +0800 Subject: [PATCH 4/4] Update IPAddress.cpp --- cores/arduino/IPAddress.cpp | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/cores/arduino/IPAddress.cpp b/cores/arduino/IPAddress.cpp index d9fe5be1d..6b676b999 100644 --- a/cores/arduino/IPAddress.cpp +++ b/cores/arduino/IPAddress.cpp @@ -83,6 +83,19 @@ bool IPAddress::fromString(const char *address) return true; } +String IPAddress::toString() +{ + String addressString = ""; + for (int i =0; i < 3; i++) + { + addressString += String(_address.bytes[i], DEC); + addressString += String('.'); + } + addressString += String(_address.bytes[3], DEC); + return addressString; +} + + IPAddress& IPAddress::operator=(const uint8_t *address) { memcpy(_address.bytes, address, sizeof(_address.bytes));