mirror of https://github.com/ARMmbed/mbed-os.git
				
				
				
			WiFi: Decuple IP stack bringup and IP address provisioning
							parent
							
								
									c80641fe11
								
							
						
					
					
						commit
						f122695fd3
					
				| 
						 | 
				
			
			@ -34,6 +34,16 @@ void IPStackInterface::bringdown()
 | 
			
		|||
    lwip_bringdown();
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
int IPStackInterface::start_dhcp(uint timeout)
 | 
			
		||||
{
 | 
			
		||||
    return lwip_start_dhcp(timeout);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
int IPStackINterface::start_static_ip(const char *ip, const char *netmask, const char *gw)
 | 
			
		||||
{
 | 
			
		||||
    return lwip_start_static_ip();
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
const char * IPStackInterface::get_mac_address()
 | 
			
		||||
{
 | 
			
		||||
    return lwip_get_mac_address();
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -403,7 +403,7 @@ int lwip_bringup(emac_interface_t *emac, bool dhcp, const char *ip, const char *
 | 
			
		|||
    }
 | 
			
		||||
 | 
			
		||||
    // Zero out socket set
 | 
			
		||||
    lwip_arena_init();
 | 
			
		||||
    lwip_arena_init(15000);
 | 
			
		||||
 | 
			
		||||
#if LWIP_IPV6
 | 
			
		||||
    netif_create_ip6_linklocal_address(&lwip_netif, 1/*from MAC*/);
 | 
			
		||||
| 
						 | 
				
			
			@ -510,10 +510,6 @@ int lwip_bringdown(void)
 | 
			
		|||
    }
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
    lwip_connected = false;
 | 
			
		||||
    // TO DO - actually remove addresses from stack, and shut down properly
 | 
			
		||||
    return 0;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/* LWIP error remapping */
 | 
			
		||||
static int lwip_err_remap(err_t err) {
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -43,6 +43,24 @@ public:
 | 
			
		|||
     */
 | 
			
		||||
    virtual void bringdown();
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * Sends the dhcp request
 | 
			
		||||
     *
 | 
			
		||||
     * @param timeout Request timeout in ms
 | 
			
		||||
     * @return NSAPI_ERROR_OK in case of success, error code otherwise
 | 
			
		||||
     */
 | 
			
		||||
    virtual int start_dhcp(uint timeout = 15000);
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * Starts the interface with static IP
 | 
			
		||||
     *
 | 
			
		||||
     * @param  ip      Static IP to use (in XYZ.XYZ.XYZ.XYZ format)
 | 
			
		||||
     * @param  netmask Network mask to use (in XYZ.XYZ.XYZ.XYZ format)
 | 
			
		||||
     * @param  gw      Gateway IP address (in XYZ.XYZ.XYZ.XYZ format)
 | 
			
		||||
     * @return         NSAPI_ERROR_OK in case of success, error code otherwise
 | 
			
		||||
     */
 | 
			
		||||
    virtual int start_static_ip(const char *ip, const char *netmask, const char *gw);
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * Returns  MAC address
 | 
			
		||||
     *
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in New Issue