My climat station
NanostackEthernetInterface Class Reference
Ethernet interface for Nanostack. More...
#include <NanostackEthernetInterface.h>
Inherits MeshInterfaceNanostack.
Public Member Functions | |
| 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
Ethernet interface for Nanostack.
Configure Nanostack to use Ethernet connectivity.
Definition at line 27 of file NanostackEthernetInterface.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:
-
address Destination 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_cb The callback for status changes
| int connect | ( | ) | [virtual] |
Start the interface.
- Returns:
- 0 on success, negative on failure
Implements MeshInterfaceNanostack.
Definition at line 46 of file NanostackEthernetInterface.cpp.
| int disconnect | ( | ) | [virtual] |
Stop the interface.
- Returns:
- 0 on success, negative on failure
Implements MeshInterfaceNanostack.
Definition at line 70 of file NanostackEthernetInterface.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:
-
address Destination for the host SocketAddress host Hostname to resolve version IP 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:
-
address is where the IP address will be copied len is 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 76 of file NanostackEthernetInterface.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:
-
status state 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:
-
blocking true 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:
-
dhcp True 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_address Null-terminated representation of the local IP address netmask Null-terminated representation of the local network mask gateway Null-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.
Generated on Tue Jul 12 2022 14:26:50 by
1.7.2
Gleb Klochkov