Gleb Klochkov / Mbed OS Climatcontroll_Main

Dependencies:   esp8266-driver

Embed: (wiki syntax)

« Back to documentation index

LoWPANNDInterface Class Reference

LoWPANNDInterface Class Reference

6LoWPAN-ND mesh network interface class More...

#include <LoWPANNDInterface.h>

Inherits MeshInterfaceNanostack.

Public Member Functions

 LoWPANNDInterface ()
 Create an uninitialized LoWPANNDInterface.
 LoWPANNDInterface (NanostackRfPhy *phy)
 Create an initialized MeshInterface.
virtual int connect ()
 Start the interface.
virtual int disconnect ()
 Stop the interface.
virtual bool getOwnIpAddress (char *address, int8_t len)
 Read own global IP address.
nsapi_error_t initialize (NanostackPhy *phy)
 Attach phy and initialize the mesh.
virtual const char * get_ip_address ()
 Get the internally stored IP address /return IP address of the interface or null if not yet connected.
virtual const char * get_mac_address ()
 Get the internally stored MAC address /return MAC address of the interface.
int8_t get_interface_id () const
 Get the interface ID /return Interface identifier.
void mesh_network_handler (mesh_connection_status_t status)
 Callback from C-layer.
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.
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 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.

Protected Attributes

int8_t _network_interface_id
 Network interface ID.
int8_t _device_id
 Registered device ID.

Friends

class Socket
class UDPSocket
class TCPSocket

Detailed Description

6LoWPAN-ND mesh network interface class

Configure Nanostack to use 6LoWPAN-ND protocol.

Definition at line 26 of file LoWPANNDInterface.h.


Constructor & Destructor Documentation

Create an uninitialized LoWPANNDInterface.

Must initialize to initialize the mesh on a phy.

Definition at line 33 of file LoWPANNDInterface.h.

Create an initialized MeshInterface.

Definition at line 38 of file LoWPANNDInterface.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.

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

Register callback for status reporting.

Parameters:
status_cbThe callback for status changes
int connect (  ) [virtual]

Start the interface.

Returns:
0 on success, negative on failure

Implements MeshInterfaceNanostack.

Definition at line 15 of file LoWPANNDInterface.cpp.

int disconnect (  ) [virtual]

Stop the interface.

Returns:
0 on success, negative on failure

Implements MeshInterfaceNanostack.

Definition at line 52 of file LoWPANNDInterface.cpp.

nsapi_connection_status_t get_connection_status (  ) const [virtual, inherited]

Get the connection status.

Returns:
The connection status according to ConnectionStatusType

Definition at line 133 of file MeshInterfaceNanostack.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.

int8_t get_interface_id (  ) const [inherited]

Get the interface ID /return Interface identifier.

Definition at line 66 of file MeshInterfaceNanostack.h.

const char * get_ip_address (  ) [virtual, inherited]

Get the internally stored IP address /return IP address of the interface or null if not yet connected.

Definition at line 114 of file MeshInterfaceNanostack.cpp.

const char * get_mac_address (  ) [virtual, inherited]

Get the internally stored MAC address /return MAC address of the interface.

Definition at line 128 of file MeshInterfaceNanostack.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.

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.

bool getOwnIpAddress ( char *  address,
int8_t  len 
) [virtual]

Read own global IP address.

Parameters:
addressis where the IP address will be copied
lenis the length of the address buffer, must be at least 40 bytes
Returns:
true if address is read successfully, false otherwise

Implements MeshInterfaceNanostack.

Definition at line 112 of file LoWPANNDInterface.cpp.

nsapi_error_t initialize ( NanostackPhy phy ) [inherited]

Attach phy and initialize the mesh.

Initializes a mesh interface on the given phy. Not needed if the phy is passed to the mesh's constructor.

Returns:
0 on success, negative on failure

Definition at line 39 of file MeshInterfaceNanostack.cpp.

void mesh_network_handler ( mesh_connection_status_t  status ) [inherited]

Callback from C-layer.

Parameters:
statusstate of the network

Definition at line 49 of file MeshInterfaceNanostack.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 144 of file MeshInterfaceNanostack.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.


Field Documentation

int8_t _device_id [protected, inherited]

Registered device ID.

Definition at line 112 of file MeshInterfaceNanostack.h.

int8_t _network_interface_id [protected, inherited]

Network interface ID.

Definition at line 110 of file MeshInterfaceNanostack.h.