Socket interface for C027Interface. Implements the NetworkSocketAPI

Dependencies:   C027_Support

Dependents:   HelloC027Interface U_Blox_DeviceConnector U_Blox_DeviceConnector U-Blox_Client

Fork of LWIPInterface by NetworkSocketAPI

Files at this revision

API Documentation at this revision

Comitter:
sam_grove
Date:
Wed Mar 09 06:01:14 2016 +0000
Parent:
7:08d5a40ae448
Child:
9:0c271431385e
Commit message:
update formatting

Changed in this revision

LWIPInterface.cpp Show annotated file Show diff for this revision Revisions of this file
LWIPInterface.h Show annotated file Show diff for this revision Revisions of this file
--- a/LWIPInterface.cpp	Wed Mar 09 05:58:19 2016 +0000
+++ b/LWIPInterface.cpp	Wed Mar 09 06:01:14 2016 +0000
@@ -13,7 +13,7 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
- 
+
 #include "LWIPInterface.h"
 
 #include "mbed.h"
@@ -40,36 +40,41 @@
 static Semaphore netif_linked(0);
 static Semaphore netif_up(0);
 
-static void tcpip_init_done(void *) {
+static void tcpip_init_done(void *)
+{
     tcpip_inited.release();
 }
 
-static void netif_link_callback(struct netif *netif) {
+static void netif_link_callback(struct netif *netif)
+{
     if (netif_is_link_up(netif)) {
         netif_linked.release();
     }
 }
 
-static void netif_status_callback(struct netif *netif) {
+static void netif_status_callback(struct netif *netif)
+{
     if (netif_is_up(netif)) {
         strcpy(ip_addr, inet_ntoa(netif->ip_addr));
         netif_up.release();
     }
 }
 
-static void init_netif(ip_addr_t *ipaddr, ip_addr_t *netmask, ip_addr_t *gw) {
+static void init_netif(ip_addr_t *ipaddr, ip_addr_t *netmask, ip_addr_t *gw)
+{
     tcpip_init(tcpip_init_done, NULL);
     tcpip_inited.wait();
-    
+
     memset((void*) &netif, 0, sizeof(netif));
     netif_add(&netif, ipaddr, netmask, gw, NULL, eth_arch_enetif_init, tcpip_input);
     netif_set_default(&netif);
-    
+
     netif_set_link_callback  (&netif, netif_link_callback);
     netif_set_status_callback(&netif, netif_status_callback);
 }
 
-static void set_mac_address(void) {
+static void set_mac_address(void)
+{
 #if (MBED_MAC_ADDRESS_SUM != MBED_MAC_ADDR_INTERFACE)
     snprintf(mac_addr, 19, "%02x:%02x:%02x:%02x:%02x:%02x", MBED_MAC_ADDR_0, MBED_MAC_ADDR_1, MBED_MAC_ADDR_2,
              MBED_MAC_ADDR_3, MBED_MAC_ADDR_4, MBED_MAC_ADDR_5);
@@ -92,7 +97,7 @@
     eth_arch_enable_interrupts();
 
     dhcp_start(&netif);
-        
+
     // Wait for an IP Address
     // -1: error, 0: timeout
     if (netif_up.wait(LWIP_TIMEOUT) < 0) {
@@ -106,9 +111,9 @@
 {
     dhcp_release(&netif);
     dhcp_stop(&netif);
-    
+
     eth_arch_disable_interrupts();
-    
+
     return 0;
 }
 
@@ -117,7 +122,7 @@
     return ip_addr;
 }
 
-const char *LWIPInterface::getMACAddress() 
+const char *LWIPInterface::getMACAddress()
 {
     return mac_addr;
 }
--- a/LWIPInterface.h	Wed Mar 09 05:58:19 2016 +0000
+++ b/LWIPInterface.h	Wed Mar 09 06:01:14 2016 +0000
@@ -41,12 +41,12 @@
     virtual void destroySocket(SocketInterface *socket);
 
 private:
-    
+
     // Implementation of the TCP SocketInterface for LWIP
     class LWIPSocket : public SocketInterface
     {
-    public:    
-        
+    public:
+
         LWIPSocket(int fd) : fd(fd) {}
         int fd;