Modified MQTT for Mbed OS.
Dependents: mbed-os-mqtt door_lock co657_IoT nucleo-f429zi-mbed-os-mqtt
Fork of MQTT by
MQTTEthernet.h@51:ac90fd2dd859, 2016-11-18 (annotated)
- Committer:
- azazeal88
- Date:
- Fri Nov 18 13:29:50 2016 +0000
- Revision:
- 51:ac90fd2dd859
- Parent:
- 50:2133433118ef
Buffer at 4096 was causing issues. Have reverted, but will need to look closer at allocation
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
icraggs | 29:833386b16f3e | 1 | |
icraggs | 29:833386b16f3e | 2 | #if !defined(MQTTETHERNET_H) |
icraggs | 29:833386b16f3e | 3 | #define MQTTETHERNET_H |
icraggs | 29:833386b16f3e | 4 | |
icraggs | 43:21da1f744243 | 5 | #include "MQTTmbed.h" |
icraggs | 29:833386b16f3e | 6 | #include "EthernetInterface.h" |
icraggs | 31:a51dd239b78e | 7 | #include "MQTTSocket.h" |
icraggs | 29:833386b16f3e | 8 | |
icraggs | 31:a51dd239b78e | 9 | class MQTTEthernet : public MQTTSocket |
icraggs | 29:833386b16f3e | 10 | { |
icraggs | 29:833386b16f3e | 11 | public: |
icraggs | 29:833386b16f3e | 12 | MQTTEthernet() |
icraggs | 29:833386b16f3e | 13 | { |
azazeal88 | 50:2133433118ef | 14 | connectInterface(); |
icraggs | 29:833386b16f3e | 15 | } |
icraggs | 29:833386b16f3e | 16 | |
azazeal88 | 48:83e45fa35cc8 | 17 | EthernetInterface& getInterface() |
icraggs | 41:b7e86fa6dbb8 | 18 | { |
icraggs | 41:b7e86fa6dbb8 | 19 | return eth; |
icraggs | 41:b7e86fa6dbb8 | 20 | } |
icraggs | 41:b7e86fa6dbb8 | 21 | |
azazeal88 | 50:2133433118ef | 22 | EthernetInterface& getEth() __attribute__ ((deprecated)) |
azazeal88 | 50:2133433118ef | 23 | { |
azazeal88 | 50:2133433118ef | 24 | return eth; |
azazeal88 | 50:2133433118ef | 25 | } |
azazeal88 | 50:2133433118ef | 26 | |
azazeal88 | 47:a84464ad0b6f | 27 | const char * get_ip_address() |
azazeal88 | 47:a84464ad0b6f | 28 | { |
azazeal88 | 47:a84464ad0b6f | 29 | return eth.get_ip_address(); |
azazeal88 | 47:a84464ad0b6f | 30 | } |
azazeal88 | 47:a84464ad0b6f | 31 | |
azazeal88 | 48:83e45fa35cc8 | 32 | int connectInterface(){ |
azazeal88 | 48:83e45fa35cc8 | 33 | return eth.connect(); |
azazeal88 | 48:83e45fa35cc8 | 34 | } |
azazeal88 | 48:83e45fa35cc8 | 35 | |
azazeal88 | 48:83e45fa35cc8 | 36 | int reconnectInterface() |
icraggs | 41:b7e86fa6dbb8 | 37 | { |
azazeal88 | 48:83e45fa35cc8 | 38 | disconnect(); |
azazeal88 | 48:83e45fa35cc8 | 39 | return eth.connect(); |
azazeal88 | 48:83e45fa35cc8 | 40 | } |
azazeal88 | 48:83e45fa35cc8 | 41 | |
azazeal88 | 48:83e45fa35cc8 | 42 | int disconnectInterface() |
azazeal88 | 48:83e45fa35cc8 | 43 | { |
azazeal88 | 48:83e45fa35cc8 | 44 | return eth.disconnect(); |
icraggs | 41:b7e86fa6dbb8 | 45 | } |
icraggs | 41:b7e86fa6dbb8 | 46 | |
icraggs | 29:833386b16f3e | 47 | private: |
icraggs | 29:833386b16f3e | 48 | |
icraggs | 29:833386b16f3e | 49 | EthernetInterface eth; |
icraggs | 29:833386b16f3e | 50 | |
icraggs | 29:833386b16f3e | 51 | }; |
icraggs | 29:833386b16f3e | 52 | |
icraggs | 29:833386b16f3e | 53 | |
icraggs | 29:833386b16f3e | 54 | #endif |