gftgtgtf
Fork of MQTT by
Revision 47:d3feba7f242a, committed 2015-10-03
- Comitter:
- jamesabruce
- Date:
- Sat Oct 03 10:53:36 2015 +0000
- Parent:
- 46:88f62eb29442
- Child:
- 48:205fe4c5a6d6
- Commit message:
Changed in this revision
| MQTTEthernet.h | Show annotated file Show diff for this revision Revisions of this file |
| MQTTPacket.lib | Show annotated file Show diff for this revision Revisions of this file |
--- a/MQTTEthernet.h Mon Jun 29 02:07:13 2015 +0000
+++ b/MQTTEthernet.h Sat Oct 03 10:53:36 2015 +0000
@@ -7,10 +7,6 @@
#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
{
@@ -19,8 +15,27 @@
{
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();
+ //eth.init(mac_addr,ip_addr,snmask,gw_addr); // Do not use DHCP! If you use DHCP use "eth.init(mac_addr);".
+ uint8_t mac_addr[6] = {0x00, 0x08, 0xDC, 0x32, 0x23, 0x42};
+
+ eth.init(mac_addr);
+
+ printf("Check Ethernet Link\r\n");
+ while(1) { //Wait link up
+ if(eth.link() == true)
+ break;
+ }
+ printf("Link up\r\n");
+
+ int ethErr = eth.connect();
+
+
+ if(ethErr < 0)
+ {
+ printf("Error %d in setup.\n", ethErr);
+ }
+ printf("Server IP Address is %s\r\n", eth.getIPAddress());
+
}
EthernetInterface& getEth()
--- a/MQTTPacket.lib Mon Jun 29 02:07:13 2015 +0000 +++ b/MQTTPacket.lib Sat Oct 03 10:53:36 2015 +0000 @@ -1,1 +1,1 @@ -http://mbed.org/teams/mqtt/code/MQTTPacket/#bf36e077e7b8 +http://mbed.org/teams/mqtt/code/MQTTPacket/#62396c1620b6
