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.
Dependencies: C12832 EthernetInterface LM75B MMA7660 MQTT mbed-rtos mbed
Fork of IBMIoTClientEthernetExample by
MQTT/MQTTEthernet.h@6:37b6d0d56190, 2014-08-20 (annotated)
- Committer:
- samdanbury
- Date:
- Wed Aug 20 12:45:14 2014 +0000
- Revision:
- 6:37b6d0d56190
- Child:
- 8:80d49dd91542
Code completely changed to improve the structure, flow and memory usage of the application
Who changed what in which revision?
| User | Revision | Line number | New contents of line |
|---|---|---|---|
| samdanbury | 6:37b6d0d56190 | 1 | |
| samdanbury | 6:37b6d0d56190 | 2 | #if !defined(MQTTETHERNET_H) |
| samdanbury | 6:37b6d0d56190 | 3 | #define MQTTETHERNET_H |
| samdanbury | 6:37b6d0d56190 | 4 | |
| samdanbury | 6:37b6d0d56190 | 5 | #include "MQTT_mbed.h" |
| samdanbury | 6:37b6d0d56190 | 6 | #include "EthernetInterface.h" |
| samdanbury | 6:37b6d0d56190 | 7 | #include "MQTTSocket.h" |
| samdanbury | 6:37b6d0d56190 | 8 | |
| samdanbury | 6:37b6d0d56190 | 9 | class MQTTEthernet : public MQTTSocket |
| samdanbury | 6:37b6d0d56190 | 10 | { |
| samdanbury | 6:37b6d0d56190 | 11 | public: |
| samdanbury | 6:37b6d0d56190 | 12 | MQTTEthernet() |
| samdanbury | 6:37b6d0d56190 | 13 | { |
| samdanbury | 6:37b6d0d56190 | 14 | eth.init(); // Use DHCP |
| samdanbury | 6:37b6d0d56190 | 15 | eth.connect(); |
| samdanbury | 6:37b6d0d56190 | 16 | } |
| samdanbury | 6:37b6d0d56190 | 17 | |
| samdanbury | 6:37b6d0d56190 | 18 | EthernetInterface& getEth() |
| samdanbury | 6:37b6d0d56190 | 19 | { |
| samdanbury | 6:37b6d0d56190 | 20 | return eth; |
| samdanbury | 6:37b6d0d56190 | 21 | } |
| samdanbury | 6:37b6d0d56190 | 22 | |
| samdanbury | 6:37b6d0d56190 | 23 | void reconnect() |
| samdanbury | 6:37b6d0d56190 | 24 | { |
| samdanbury | 6:37b6d0d56190 | 25 | eth.connect(); // nothing I've tried actually works to reconnect |
| samdanbury | 6:37b6d0d56190 | 26 | } |
| samdanbury | 6:37b6d0d56190 | 27 | |
| samdanbury | 6:37b6d0d56190 | 28 | private: |
| samdanbury | 6:37b6d0d56190 | 29 | |
| samdanbury | 6:37b6d0d56190 | 30 | EthernetInterface eth; |
| samdanbury | 6:37b6d0d56190 | 31 | |
| samdanbury | 6:37b6d0d56190 | 32 | }; |
| samdanbury | 6:37b6d0d56190 | 33 | |
| samdanbury | 6:37b6d0d56190 | 34 | |
| samdanbury | 6:37b6d0d56190 | 35 | #endif |
