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.
Fork of MQTT by
MQTTEthernet.h
- Committer:
- bangbh
- Date:
- 2015-06-29
- Revision:
- 46:88f62eb29442
- Parent:
- 45:b7cebc104c6c
- Child:
- 47:d3feba7f242a
File content as of revision 46:88f62eb29442:
#if !defined(MQTTETHERNET_H)
#define MQTTETHERNET_H
#include "MQTTmbed.h"
#include "EthernetInterface.h"
#include "MQTTSocket.h"
uint8_t mac_addr[6] = {0x00, 0x08, 0xDC, 0x00, 0x00, 0x00}; // your mac address
const char * ip_addr = "???.???.???.???"; // your ip
const char * gw_addr = "???.???.???.???"; // your gateway
const char * snmask = "???.???.???.???"; // 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.connect();
}
EthernetInterface& getEth()
{
return eth;
}
void reconnect()
{
eth.connect(); // nothing I've tried actually works to reconnect
}
private:
EthernetInterface eth;
};
#endif
