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
MQTTEthernetIoT.h@0:cae064bcbe5e, 2014-07-16 (annotated)
- Committer:
- samdanbury
- Date:
- Wed Jul 16 12:03:54 2014 +0000
- Revision:
- 0:cae064bcbe5e
Initial commit
Who changed what in which revision?
| User | Revision | Line number | New contents of line |
|---|---|---|---|
| samdanbury | 0:cae064bcbe5e | 1 | |
| samdanbury | 0:cae064bcbe5e | 2 | #if !defined(MQTTETHERNET_H) |
| samdanbury | 0:cae064bcbe5e | 3 | #define MQTTETHERNET_H |
| samdanbury | 0:cae064bcbe5e | 4 | |
| samdanbury | 0:cae064bcbe5e | 5 | #include "MQTT_mbed.h" |
| samdanbury | 0:cae064bcbe5e | 6 | #include "EthernetInterface.h" |
| samdanbury | 0:cae064bcbe5e | 7 | #include "MQTTSocket.h" |
| samdanbury | 0:cae064bcbe5e | 8 | #include <string> |
| samdanbury | 0:cae064bcbe5e | 9 | |
| samdanbury | 0:cae064bcbe5e | 10 | class MQTTEthernetIoT : public MQTTSocket |
| samdanbury | 0:cae064bcbe5e | 11 | { |
| samdanbury | 0:cae064bcbe5e | 12 | public: |
| samdanbury | 0:cae064bcbe5e | 13 | MQTTEthernetIoT() |
| samdanbury | 0:cae064bcbe5e | 14 | { |
| samdanbury | 0:cae064bcbe5e | 15 | eth.init(); // Use DHCP |
| samdanbury | 0:cae064bcbe5e | 16 | eth.connect(); |
| samdanbury | 0:cae064bcbe5e | 17 | mac = eth.getMACAddress(); |
| samdanbury | 0:cae064bcbe5e | 18 | } |
| samdanbury | 0:cae064bcbe5e | 19 | |
| samdanbury | 0:cae064bcbe5e | 20 | string getMACAddress() { |
| samdanbury | 0:cae064bcbe5e | 21 | return mac; |
| samdanbury | 0:cae064bcbe5e | 22 | } |
| samdanbury | 0:cae064bcbe5e | 23 | |
| samdanbury | 0:cae064bcbe5e | 24 | private: |
| samdanbury | 0:cae064bcbe5e | 25 | |
| samdanbury | 0:cae064bcbe5e | 26 | EthernetInterface eth; |
| samdanbury | 0:cae064bcbe5e | 27 | string mac; |
| samdanbury | 0:cae064bcbe5e | 28 | |
| samdanbury | 0:cae064bcbe5e | 29 | }; |
| samdanbury | 0:cae064bcbe5e | 30 | |
| samdanbury | 0:cae064bcbe5e | 31 | |
| samdanbury | 0:cae064bcbe5e | 32 | #endif |
