Added support to NetworkSocket API with Wifi.
Dependencies: FP MQTTPacket
Dependents: IDW01M1_Cloud_IBM IDW01M1-MQTT IDW01M1-MQTT-1 IDW01M1-MQTT3 ... more
Fork of MQTT by
Revision 49:c66fdbb9eb83, committed 2017-10-30
- Comitter:
- mapellil
- Date:
- Mon Oct 30 13:50:53 2017 +0100
- Parent:
- 48:66826ea709ea
- Commit message:
- Fixed NonCopyable for Mbed-os 5
Changed in this revision
MQTTClient.h | Show annotated file Show diff for this revision Revisions of this file |
MQTTmbed.h | Show annotated file Show diff for this revision Revisions of this file |
diff -r 66826ea709ea -r c66fdbb9eb83 MQTTClient.h --- a/MQTTClient.h Wed Sep 28 15:34:12 2016 +0000 +++ b/MQTTClient.h Mon Oct 30 13:50:53 2017 +0100 @@ -276,8 +276,6 @@ template<class Network, class Timer, int a, int MAX_MESSAGE_HANDLERS> MQTT::Client<Network, Timer, a, MAX_MESSAGE_HANDLERS>::Client(Network& network, unsigned int command_timeout_ms) : ipstack(network), packetid() { - last_sent = Timer(); - last_received = Timer(); this->command_timeout_ms = command_timeout_ms; cleanSession(); }
diff -r 66826ea709ea -r c66fdbb9eb83 MQTTmbed.h --- a/MQTTmbed.h Wed Sep 28 15:34:12 2016 +0000 +++ b/MQTTmbed.h Mon Oct 30 13:50:53 2017 +0100 @@ -6,43 +6,42 @@ class Countdown { public: - Countdown() - { - t = Timer(); + Countdown() { + t = new Timer(); + if (t == NULL) printf ("Countdown newfail\n\r"); } - Countdown(int ms) - { - t = Timer(); + Countdown(int ms) { + t = new Timer(); + if (t == NULL) printf ("Countdown newfail\n\r"); countdown_ms(ms); } + ~Countdown() { + delete t; + } - bool expired() - { - return t.read_ms() >= interval_end_ms; + bool expired() { + return t->read_ms() >= interval_end_ms; } - void countdown_ms(unsigned long ms) - { - t.stop(); + void countdown_ms(unsigned long ms) { + t->stop(); interval_end_ms = ms; - t.reset(); - t.start(); + t->reset(); + t->start(); } - void countdown(int seconds) - { + void countdown(int seconds) { countdown_ms((unsigned long)seconds * 1000L); } - int left_ms() - { - return interval_end_ms - t.read_ms(); + int left_ms() { + return interval_end_ms - t->read_ms(); } private: - Timer t; + Timer *t; unsigned long interval_end_ms; };