The MQTTEthernet.h and MQTTSocket.h file is changed for W7500.
Dependents: w7500-paho-mqtt w7500-RFID-mqtt w7500-mqtt-wizfi310 w7500-mqtt-wizfi310_tested
Fork of MQTT by
MQTTEthernet.h
00001 00002 #if !defined(MQTTETHERNET_H) 00003 #define MQTTETHERNET_H 00004 00005 #include "MQTTmbed.h" 00006 #include "EthernetInterface.h" 00007 #include "MQTTSocket.h" 00008 00009 00010 uint8_t mac_addr[6] = {0x00, 0x08, 0xDC, 0x1E, 0x72, 0x1B}; // your mac address 00011 const char * ip_addr = "222.98.173.249"; // your ip 00012 const char * gw_addr = "222.98.173.254"; // your gateway 00013 const char * snmask = "255.255.255.192"; // your subnetmask 00014 00015 class MQTTEthernet : public MQTTSocket 00016 { 00017 public: 00018 MQTTEthernet() 00019 { 00020 wait(1); 00021 this->createSocket(); 00022 //eth.init(mac_addr,ip_addr,snmask,gw_addr); // Do not use DHCP! If you use DHCP use "eth.init(mac_addr);". 00023 eth.init(mac_addr); 00024 eth.connect(); 00025 } 00026 00027 EthernetInterface& getEth() 00028 { 00029 return eth; 00030 } 00031 00032 void reconnect() 00033 { 00034 eth.connect(); // nothing I've tried actually works to reconnect 00035 } 00036 00037 private: 00038 00039 EthernetInterface eth; 00040 00041 }; 00042 00043 00044 #endif
Generated on Tue Jul 12 2022 22:23:55 by 1.7.2