Knight KE / Mbed OS Game_Master
Embed: (wiki syntax)

« Back to documentation index

OnboardNetworkStack::Interface Class Reference

OnboardNetworkStack::Interface Class Reference

Representation of a stack's view of an interface. More...

#include <OnboardNetworkStack.h>

Inherited by EmacTestNetworkStack::Interface, LWIP::Interface, and Nanostack::Interface.

Public Member Functions

virtual nsapi_error_t bringup (bool dhcp, const char *ip, const char *netmask, const char *gw, nsapi_ip_stack_t stack=DEFAULT_STACK, bool blocking=true)=0
 Connect the interface to the network.
virtual nsapi_error_t bringdown ()=0
 Disconnect interface from the network.
virtual void attach (mbed::Callback< void(nsapi_event_t, intptr_t)> status_cb)=0
 Register callback for status reporting.
virtual nsapi_connection_status_t get_connection_status () const =0
 Get the connection status.
virtual char * get_mac_address (char *buf, nsapi_size_t buflen)=0
 Return MAC address of the network interface.
virtual char * get_ip_address (char *buf, nsapi_size_t buflen)=0
 Copies IP address of the network interface to user supplied buffer.
virtual char * get_netmask (char *buf, nsapi_size_t buflen)=0
 Copies netmask of the network interface to user supplied buffer.
virtual char * get_gateway (char *buf, nsapi_size_t buflen)=0
 Copies gateway address of the network interface to user supplied buffer.

Detailed Description

Representation of a stack's view of an interface.

Provides facilities required by a driver to implement the application NetworkInterface API.

Definition at line 47 of file OnboardNetworkStack.h.


Member Function Documentation

virtual void attach ( mbed::Callback< void(nsapi_event_t, intptr_t)>  status_cb ) [pure virtual]

Register callback for status reporting.

The specified status callback function will be called on status changes on the network. The parameters on the callback are the event type and event-type dependent reason parameter.

Parameters:
status_cbThe callback for status changes
virtual nsapi_error_t bringdown (  ) [pure virtual]

Disconnect interface from the network.

After this call the network interface is inactive, to use it again user needs to call
bringup again.

Returns:
NSAPI_ERROR_OK on success, or error code
virtual nsapi_error_t bringup ( bool  dhcp,
const char *  ip,
const char *  netmask,
const char *  gw,
nsapi_ip_stack_t  stack = DEFAULT_STACK,
bool  blocking = true 
) [pure virtual]

Connect the interface to the network.

Sets up a connection on specified network interface, using DHCP or provided network details. If the dhcp is set to true all the remaining parameters are ignored.

Parameters:
dhcptrue if the network details should be acquired using DHCP
ipIP address to be used for the interface as "W:X:Y:Z" or NULL
netmaskNet mask to be used for the interface as "W:X:Y:Z" or NULL
gwGateway address to be used for the interface as "W:X:Y:Z" or NULL
stackAllow manual selection of IPv4 and/or IPv6.
blockingSpecify whether bringup blocks for connection completion.
Returns:
NSAPI_ERROR_OK on success, or error code
virtual nsapi_connection_status_t get_connection_status (  ) const [pure virtual]

Get the connection status.

Returns:
The connection status according to ConnectionStatusType
virtual char* get_gateway ( char *  buf,
nsapi_size_t  buflen 
) [pure virtual]

Copies gateway address of the network interface to user supplied buffer.

Parameters:
bufbuffer to which gateway address will be copied as "W:X:Y:Z"
buflensize of supplied buffer
Returns:
Pointer to a buffer, or NULL if the buffer is too small
virtual char* get_ip_address ( char *  buf,
nsapi_size_t  buflen 
) [pure virtual]

Copies IP address of the network interface to user supplied buffer.

Parameters:
bufbuffer to which IP address will be copied as "W:X:Y:Z"
buflensize of supplied buffer
Returns:
Pointer to a buffer, or NULL if the buffer is too small
virtual char* get_mac_address ( char *  buf,
nsapi_size_t  buflen 
) [pure virtual]

Return MAC address of the network interface.

Returns:
MAC address as "V:W:X:Y:Z"
virtual char* get_netmask ( char *  buf,
nsapi_size_t  buflen 
) [pure virtual]

Copies netmask of the network interface to user supplied buffer.

Parameters:
bufbuffer to which netmask will be copied as "W:X:Y:Z"
buflensize of supplied buffer
Returns:
Pointer to a buffer, or NULL if the buffer is too small