An API for using MQTT over multiple transports
Dependencies: FP MQTTPacket
Dependents: IBMIoTClientEthernetExample_W5500 IBMIoTClientEthernetExample_W5200
Fork of MQTT by
MQTTEthernet.h@44:f53a95f9c1d8, 2014-09-29 (annotated)
- Committer:
- kaizen
- Date:
- Mon Sep 29 04:56:42 2014 +0000
- Revision:
- 44:f53a95f9c1d8
- Parent:
- 43:b1ae0ac88df9
Modified for using HW_Stack
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
icraggs | 29:833386b16f3e | 1 | #if !defined(MQTTETHERNET_H) |
icraggs | 29:833386b16f3e | 2 | #define MQTTETHERNET_H |
icraggs | 29:833386b16f3e | 3 | |
icraggs | 29:833386b16f3e | 4 | #include "MQTT_mbed.h" |
kaizen | 44:f53a95f9c1d8 | 5 | #include "MQTTSocket.h" |
kaizen | 43:b1ae0ac88df9 | 6 | #include "../W5500Interface/EthernetInterface.h" |
icraggs | 29:833386b16f3e | 7 | |
icraggs | 31:a51dd239b78e | 8 | class MQTTEthernet : public MQTTSocket |
icraggs | 29:833386b16f3e | 9 | { |
icraggs | 29:833386b16f3e | 10 | public: |
kaizen | 43:b1ae0ac88df9 | 11 | MQTTEthernet(SPI* spi, PinName cs, PinName reset): eth(spi, cs, reset) |
icraggs | 29:833386b16f3e | 12 | { |
kaizen | 44:f53a95f9c1d8 | 13 | wait(1); |
kaizen | 44:f53a95f9c1d8 | 14 | this->createSocket(); |
kaizen | 43:b1ae0ac88df9 | 15 | eth.init(); |
kaizen | 44:f53a95f9c1d8 | 16 | eth.connect(); |
icraggs | 29:833386b16f3e | 17 | } |
icraggs | 29:833386b16f3e | 18 | |
icraggs | 41:b7e86fa6dbb8 | 19 | EthernetInterface& getEth() |
icraggs | 41:b7e86fa6dbb8 | 20 | { |
icraggs | 41:b7e86fa6dbb8 | 21 | return eth; |
icraggs | 41:b7e86fa6dbb8 | 22 | } |
icraggs | 41:b7e86fa6dbb8 | 23 | |
icraggs | 41:b7e86fa6dbb8 | 24 | void reconnect() |
icraggs | 41:b7e86fa6dbb8 | 25 | { |
icraggs | 41:b7e86fa6dbb8 | 26 | eth.connect(); // nothing I've tried actually works to reconnect |
icraggs | 41:b7e86fa6dbb8 | 27 | } |
icraggs | 41:b7e86fa6dbb8 | 28 | |
icraggs | 29:833386b16f3e | 29 | private: |
icraggs | 29:833386b16f3e | 30 | EthernetInterface eth; |
icraggs | 29:833386b16f3e | 31 | |
icraggs | 29:833386b16f3e | 32 | }; |
icraggs | 29:833386b16f3e | 33 | |
icraggs | 29:833386b16f3e | 34 | #endif |