MQTT client test with W5200 ethernet shield

Dependents:   IBMIoTClientEthernetExample_W5200

Fork of W5500Interface by W5500-Ethernet-Interface Makers

Revision:
5:8aefaef88f79
Parent:
0:e11e8793c3ce
Child:
9:dfffa4d6f022
--- a/WIZnet/W5500.h	Mon Sep 01 01:54:29 2014 +0000
+++ b/WIZnet/W5500.h	Fri Sep 26 08:05:41 2014 +0000
@@ -1,4 +1,3 @@
-
 #pragma once
 
 #include "mbed.h"
@@ -8,42 +7,6 @@
 
 #define DEFAULT_WAIT_RESP_TIMEOUT 500
 
-enum Protocol {
-    CLOSED = 0,
-    TCP    = 1,
-    UDP    = 2,
-};
-
-enum Command {
-    OPEN      = 0x01,
-    LISTEN    = 0x02,
-    CONNECT   = 0x04,
-    DISCON    = 0x08,
-    CLOSE     = 0x10,
-    SEND      = 0x20,
-    SEND_MAC  = 0x21, 
-    SEND_KEEP = 0x22,
-    RECV      = 0x40,
-    
-};
-
-enum Interrupt {
-    INT_CON     = 0x01,
-    INT_DISCON  = 0x02,
-    INT_RECV    = 0x04,
-    INT_TIMEOUT = 0x08,
-    INT_SEND_OK = 0x10,
-};
-
-enum Status {
-    SOCK_CLOSED      = 0x00,
-    SOCK_INIT        = 0x13,
-    SOCK_LISTEN      = 0x14,
-    SOCK_SYNSENT     = 0x15,
-    SOCK_ESTABLISHED = 0x17,
-    SOCK_CLOSE_WAIT  = 0x1c,
-    SOCK_UDP         = 0x22,
-};
 
 #define MAX_SOCK_NUM 8
 
@@ -52,7 +15,7 @@
 #define SUBR      0x0005
 #define SHAR      0x0009
 #define SIPR      0x000f
-#define PHYSTATUS 0x0035
+#define PHYCFGR   0x002e
 
 // W5500 socket register
 #define Sn_MR         0x0000
@@ -71,6 +34,15 @@
 
 class WIZnet_Chip {
 public:
+
+    enum Protocol   { CLOSED = 0, TCP = 1, UDP = 2,};
+    enum Command    { OPEN = 0x01, LISTEN = 0x02, CONNECT = 0x04, DISCON = 0x08, CLOSE = 0x10, SEND = 0x20, \
+                        SEND_MAC = 0x21, SEND_KEEP = 0x22, RECV = 0x40, };
+    enum Interrupt  { INT_CON = 0x01, INT_DISCON = 0x02, INT_RECV = 0x04, INT_TIMEOUT = 0x08, INT_SEND_OK = 0x10,};
+
+    enum Status     { SOCK_CLOSED = 0x00, SOCK_INIT = 0x13, SOCK_LISTEN = 0x14, SOCK_SYNSENT = 0x15, SOCK_ESTABLISHED = 0x17, \
+                         SOCK_CLOSE_WAIT = 0x1c, SOCK_UDP   = 0x22, };
+
     /*
     * Constructor
     *
@@ -96,6 +68,13 @@
     bool setip();
 
     /*
+    * Get Link Status
+    *
+    * @return true if Link up, false Link down
+    */
+    bool linkstatus();
+
+    /*
     * Disconnect the connection
     *
     * @ returns true