BA / Mbed OS BaBoRo1
Embed: (wiki syntax)

« Back to documentation index

MeshInterface Class Reference

MeshInterface class. More...

#include <MeshInterface.h>

Inherits NetworkInterface.

Inherited by MeshInterfaceNanostack.

Public Member Functions

virtual const char * get_mac_address ()
 Get the local MAC address.
virtual const char * get_ip_address ()
 Get the local IP address.
virtual const char * get_netmask ()
 Get the local network mask.
virtual const char * get_gateway ()
 Get the local gateway.
virtual nsapi_error_t set_network (const char *ip_address, const char *netmask, const char *gateway)
 Set a static IP address.
virtual nsapi_error_t set_dhcp (bool dhcp)
 Enable or disable DHCP on the network.
virtual nsapi_error_t connect ()=0
 Start the interface.
virtual nsapi_error_t disconnect ()=0
 Stop the interface.
virtual nsapi_error_t gethostbyname (const char *host, SocketAddress *address, nsapi_version_t version=NSAPI_UNSPEC)
 Translates a hostname to an IP address with specific version.
virtual nsapi_error_t add_dns_server (const SocketAddress &address)
 Add a domain name server to list of servers to query.
virtual void attach (mbed::Callback< void(nsapi_event_t, intptr_t)> status_cb)
 Register callback for status reporting.
virtual nsapi_connection_status_t get_connection_status () const
 Get the connection status.
virtual nsapi_error_t set_blocking (bool blocking)
 Set blocking status of connect() which by default should be blocking.

Protected Member Functions

virtual NetworkStack * get_stack ()=0
 Provide access to the NetworkStack object.

Friends

class Socket
class UDPSocket
class TCPSocket

Detailed Description

MeshInterface class.

Common interface that is shared between mesh hardware

Definition at line 30 of file MeshInterface.h.


Member Function Documentation

nsapi_error_t add_dns_server ( const SocketAddress &  address ) [virtual, inherited]

Add a domain name server to list of servers to query.

Parameters:
addressDestination for the host address
Returns:
0 on success, negative error code on failure

Definition at line 60 of file NetworkInterface_stub.cpp.

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

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

Definition at line 65 of file NetworkInterface_stub.cpp.

virtual nsapi_error_t connect (  ) [pure virtual, inherited]

Start the interface.

Returns:
0 on success, negative error code on failure
virtual nsapi_error_t disconnect (  ) [pure virtual, inherited]

Stop the interface.

Returns:
0 on success, negative error code on failure
nsapi_connection_status_t get_connection_status (  ) const [virtual, inherited]

Get the connection status.

Returns:
The connection status according to ConnectionStatusType

Definition at line 70 of file NetworkInterface_stub.cpp.

const char * get_gateway (  ) [virtual, inherited]

Get the local gateway.

Returns:
Null-terminated representation of the local gateway or null if no network mask has been received

Definition at line 39 of file NetworkInterface_stub.cpp.

const char * get_ip_address (  ) [virtual, inherited]

Get the local IP address.

Returns:
Null-terminated representation of the local IP address or null if no IP address has been received

Definition at line 29 of file NetworkInterface_stub.cpp.

const char * get_mac_address (  ) [virtual, inherited]

Get the local MAC address.

Provided MAC address is intended for info or debug purposes and may not be provided if the underlying network interface does not provide a MAC address

Returns:
Null-terminated representation of the local MAC address or null if no MAC address is available

Definition at line 24 of file NetworkInterface_stub.cpp.

const char * get_netmask (  ) [virtual, inherited]

Get the local network mask.

Returns:
Null-terminated representation of the local network mask or null if no network mask has been received

Definition at line 34 of file NetworkInterface_stub.cpp.

virtual NetworkStack* get_stack (  ) [protected, pure virtual, inherited]

Provide access to the NetworkStack object.

Returns:
The underlying NetworkStack object
nsapi_error_t gethostbyname ( const char *  host,
SocketAddress *  address,
nsapi_version_t  version = NSAPI_UNSPEC 
) [virtual, inherited]

Translates a hostname to an IP address with specific version.

The hostname may be either a domain name or an IP address. If the hostname is an IP address, no network transactions will be performed.

If no stack-specific DNS resolution is provided, the hostname will be resolve using a UDP socket on the stack.

Parameters:
addressDestination for the host SocketAddress
hostHostname to resolve
versionIP version of address to resolve, NSAPI_UNSPEC indicates version is chosen by the stack (defaults to NSAPI_UNSPEC)
Returns:
0 on success, negative error code on failure

Definition at line 55 of file NetworkInterface_stub.cpp.

nsapi_error_t set_blocking ( bool  blocking ) [virtual, inherited]

Set blocking status of connect() which by default should be blocking.

Parameters:
blockingtrue if connect is blocking
Returns:
0 on success, negative error code on failure

Definition at line 75 of file NetworkInterface_stub.cpp.

nsapi_error_t set_dhcp ( bool  dhcp ) [virtual, inherited]

Enable or disable DHCP on the network.

Enables DHCP on connecting the network. Defaults to enabled unless a static IP address has been assigned. Requires that the network is disconnected.

Parameters:
dhcpTrue to enable DHCP
Returns:
0 on success, negative error code on failure

Definition at line 49 of file NetworkInterface_stub.cpp.

nsapi_error_t set_network ( const char *  ip_address,
const char *  netmask,
const char *  gateway 
) [virtual, inherited]

Set a static IP address.

Configures this network interface to use a static IP address. Implicitly disables DHCP, which can be enabled in set_dhcp. Requires that the network is disconnected.

Parameters:
ip_addressNull-terminated representation of the local IP address
netmaskNull-terminated representation of the local network mask
gatewayNull-terminated representation of the local gateway
Returns:
0 on success, negative error code on failure

Definition at line 44 of file NetworkInterface_stub.cpp.