The MQTTEthernet.h and MQTTSocket.h file is changed for W7500.

Dependencies:   FP MQTTPacket

Dependents:   w7500-paho-mqtt w7500-RFID-mqtt w7500-mqtt-wizfi310 w7500-mqtt-wizfi310_tested

Fork of MQTT by Bohyun Bang

MQTTEthernet.h

Committer:
bangbh
Date:
2015-09-21
Revision:
48:4d790a810311
Parent:
47:85fefcf0b231

File content as of revision 48:4d790a810311:


#if !defined(MQTTETHERNET_H)
#define MQTTETHERNET_H

#include "MQTTmbed.h"
#include "EthernetInterface.h"
#include "MQTTSocket.h"


uint8_t mac_addr[6] = {0x00, 0x08, 0xDC, 0x1E, 0x72, 0x1B}; // your mac address
const char * ip_addr = "222.98.173.249"; // your ip
const char * gw_addr = "222.98.173.254"; // your gateway
const char * snmask = "255.255.255.192"; // your subnetmask

class MQTTEthernet : public MQTTSocket
{
public:    
    MQTTEthernet()
    {
        wait(1);
        this->createSocket();
        //eth.init(mac_addr,ip_addr,snmask,gw_addr);                          // Do not use DHCP! If you use DHCP use "eth.init(mac_addr);".
        eth.init(mac_addr);
        eth.connect();
    }
    
    EthernetInterface& getEth()
    {
        return eth;
    }
    
    void reconnect()
    {
        eth.connect();  // nothing I've tried actually works to reconnect 
    }
    
private:

    EthernetInterface eth;
    
};


#endif