Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Fork of OmniWheels by
ThreadInterface Class Reference
Thread mesh network interface class. More...
#include <ThreadInterface.h>
Inherits MeshInterfaceNanostack.
Public Member Functions | |
ThreadInterface () | |
Create an uninitialized LoWPANNDInterface. | |
ThreadInterface (NanostackRfPhy *phy) | |
Create an initialized MeshInterface. | |
void | device_eui64_set (const uint8_t *eui64) |
Sets the eui64 for the device configuration. | |
mesh_error_t | device_pskd_set (const char *pskd) |
sets the PSKd for the device configuration. | |
virtual int | connect () |
Start the interface. | |
virtual int | disconnect () |
Stop the interface. | |
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
Thread mesh network interface class.
Configure Nanostack to use Thread protocol.
Definition at line 26 of file ThreadInterface.h.
Constructor & Destructor Documentation
ThreadInterface | ( | ) |
Create an uninitialized LoWPANNDInterface.
Must initialize to initialize the mesh on a phy.
Definition at line 33 of file ThreadInterface.h.
ThreadInterface | ( | NanostackRfPhy * | phy ) |
Create an initialized MeshInterface.
Definition at line 38 of file ThreadInterface.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 15 of file ThreadInterface.cpp.
void device_eui64_set | ( | const uint8_t * | eui64 ) |
Sets the eui64 for the device configuration.
By default this value is read from the radio driver. The value must be set before calling the connect function.
Definition at line 122 of file ThreadInterface.cpp.
mesh_error_t device_pskd_set | ( | const char * | pskd ) |
sets the PSKd for the device configuration.
The default value is overwritten, which is defined in the mbed_lib.json file in the mesh-api The value must be set before calling the connect function.
- Returns:
- MESH_ERROR_NONE on success.
- MESH_ERROR_PARAM in case of illegal parameters.
- MESH_ERROR_MEMORY in case of memory error.
Definition at line 127 of file ThreadInterface.cpp.
int disconnect | ( | ) | [virtual] |
Stop the interface.
- Returns:
- 0 on success, negative on failure
Implements MeshInterfaceNanostack.
Definition at line 65 of file ThreadInterface.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.
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 Fri Jul 22 2022 04:54:15 by
