Skip to content

Commit e872814

Browse files
Cruz Monrreal IICruz Monrreal II
authored andcommitted
Merge branch 'docs-fix-networkiface' of ssh://github.com/paul-szczepanek-arm/mbed-os into rollup
2 parents 99e198a + 2bab24f commit e872814

File tree

12 files changed

+256
-326
lines changed

12 files changed

+256
-326
lines changed

components/wifi/esp8266-driver/ESP8266Interface.h

Lines changed: 2 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -153,36 +153,12 @@ class ESP8266Interface : public NetworkStack, public WiFiInterface
153153
*/
154154
using NetworkInterface::add_dns_server;
155155

156-
/** Set socket options
157-
*
158-
* The setsockopt allow an application to pass stack-specific hints
159-
* to the underlying stack. For unsupported options,
160-
* NSAPI_ERROR_UNSUPPORTED is returned and the socket is unmodified.
161-
*
162-
* @param handle Socket handle
163-
* @param level Stack-specific protocol level
164-
* @param optname Stack-specific option identifier
165-
* @param optval Option value
166-
* @param optlen Length of the option value
167-
* @return 0 on success, negative error code on failure
156+
/** @copydoc NetworkStack::setsockopt
168157
*/
169158
virtual nsapi_error_t setsockopt(nsapi_socket_t handle, int level,
170159
int optname, const void *optval, unsigned optlen);
171160

172-
/** Get socket options
173-
*
174-
* getsockopt allows an application to retrieve stack-specific options
175-
* from the underlying stack using stack-specific level and option names,
176-
* or to request generic options using levels from nsapi_socket_level_t.
177-
*
178-
* For unsupported options, NSAPI_ERROR_UNSUPPORTED is returned
179-
* and the socket is unmodified.
180-
*
181-
* @param level Stack-specific protocol level or nsapi_socket_level_t
182-
* @param optname Level-specific option name
183-
* @param optval Destination for option value
184-
* @param optlen Length of the option value
185-
* @return 0 on success, negative error code on failure
161+
/** @copydoc NetworkStack::getsockopt
186162
*/
187163
virtual nsapi_error_t getsockopt(nsapi_socket_t handle, int level, int optname,
188164
void *optval, unsigned *optlen);

features/netsocket/CellularBase.h

Lines changed: 42 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -18,115 +18,114 @@
1818

1919
#include "netsocket/NetworkInterface.h"
2020

21-
/** CellularBase class
22-
*
23-
* Common interface that is shared between Cellular interfaces
21+
/** Common interface that is shared between cellular interfaces.
22+
* @addtogroup netsocket
2423
*/
2524
class CellularBase: public NetworkInterface {
2625

2726
public:
28-
29-
/** Get the default Cellular interface.
27+
/** Get the default cellular interface.
3028
*
3129
* This is provided as a weak method so applications can override.
3230
* Default behaviour is to get the target's default interface, if
3331
* any.
3432
*
35-
* @return pointer to interface, if any
33+
* @return pointer to interface, if any.
3634
*/
37-
3835
static CellularBase *get_default_instance();
3936

40-
/** Set the Cellular network credentials
37+
/** Set the cellular network credentials.
4138
*
4239
* Please check documentation of connect() for default behaviour of APN settings.
4340
*
44-
* @param apn Access point name
45-
* @param uname optionally, Username
46-
* @param pwd optionally, password
41+
* @param apn Access point name.
42+
* @param uname Username (optional).
43+
* @param pwd Password (optional).
4744
*/
4845
virtual void set_credentials(const char *apn, const char *uname = 0,
4946
const char *pwd = 0) = 0;
5047

51-
/** Set the pin code for SIM card
48+
/** Set the PIN code for SIM card.
5249
*
53-
* @param sim_pin PIN for the SIM card
50+
* @param sim_pin PIN for the SIM card.
5451
*/
5552
virtual void set_sim_pin(const char *sim_pin) = 0;
5653

57-
/** Start the interface
58-
*
59-
* Attempts to connect to a Cellular network.
54+
/** Attempt to connect to a cellular network with a PIN and credentials.
6055
*
61-
* @param sim_pin PIN for the SIM card
62-
* @param apn optionally, access point name
63-
* @param uname optionally, Username
64-
* @param pwd optionally, password
65-
* @return NSAPI_ERROR_OK on success, or negative error code on failure
56+
* @param sim_pin PIN for the SIM card.
57+
* @param apn Access point name (optional).
58+
* @param uname Username (optional).
59+
* @param pwd Password (optional).
60+
* @return NSAPI_ERROR_OK on success, or negative error code on failure.
6661
*/
6762
virtual nsapi_error_t connect(const char *sim_pin, const char *apn = 0,
6863
const char *uname = 0,
6964
const char *pwd = 0) = 0;
7065

71-
/** Start the interface
66+
/** Attempt to connect to a cellular network.
7267
*
73-
* Attempts to connect to a Cellular network.
74-
* If the SIM requires a PIN, and it is not set/invalid, NSAPI_ERROR_AUTH_ERROR is returned.
68+
* If the SIM requires a PIN, and it is invalid or not set, NSAPI_ERROR_AUTH_ERROR is returned.
7569
*
76-
* @return NSAPI_ERROR_OK on success, or negative error code on failure
70+
* @return NSAPI_ERROR_OK on success, or negative error code on failure.
7771
*/
7872
virtual nsapi_error_t connect() = 0;
7973

80-
/** Stop the interface
74+
/** Stop the interface.
8175
*
82-
* @return 0 on success, or error code on failure
76+
* @return NSAPI_ERROR_OK on success, or error code on failure.
8377
*/
8478
virtual nsapi_error_t disconnect() = 0;
8579

86-
/** Check if the connection is currently established or not
80+
/** Check if the connection is currently established.
8781
*
88-
* @return true/false If the cellular module have successfully acquired a carrier and is
89-
* connected to an external packet data network using PPP, isConnected()
90-
* API returns true and false otherwise.
82+
* @return `true` if the cellular module have successfully acquired a carrier and is
83+
* connected to an external packet data network using PPP, `false` otherwise.
9184
*/
9285
virtual bool is_connected() = 0;
9386

94-
/** Get the local IP address
87+
/** Get the local IP address.
9588
*
96-
* @return Null-terminated representation of the local IP address
97-
* or null if no IP address has been received
89+
* @return Null-terminated representation of the local IP address,
90+
* or null if no IP address has been received.
9891
*/
9992
virtual const char *get_ip_address() = 0;
10093

101-
/** Get the local network mask
94+
/** Get the local network mask.
10295
*
103-
* @return Null-terminated representation of the local network mask
104-
* or null if no network mask has been received
96+
* @return Null-terminated representation of the local network mask,
97+
* or null if no network mask has been received.
10598
*/
10699
virtual const char *get_netmask() = 0;
107100

108-
/** Get the local gateways
101+
/** Get the local gateways.
109102
*
110-
* @return Null-terminated representation of the local gateway
111-
* or null if no network mask has been received
103+
* @return Null-terminated representation of the local gateway,
104+
* or null if no network mask has been received.
112105
*/
113106
virtual const char *get_gateway() = 0;
114107

108+
/** @copydoc NetworkInterface::cellularBase
109+
*/
115110
virtual CellularBase *cellularBase()
116111
{
117112
return this;
118113
}
119114

115+
#if !defined(DOXYGEN_ONLY)
116+
120117
protected:
121-
/** Get the target's default Cellular interface.
118+
/** Get the target's default cellular interface.
122119
*
123120
* This is provided as a weak method so targets can override. The
124-
* default implementation configures and returns the OnBoardModemInterface
121+
* default implementation configures and returns the OnBoardModemInterface,
125122
* if available.
126123
*
127-
* @return pointer to interface, if any
124+
* @return Pointer to interface, if any.
128125
*/
129126
static CellularBase *get_target_default_instance();
127+
128+
#endif //!defined(DOXYGEN_ONLY)
130129
};
131130

132131
#endif //CELLULAR_BASE_H

features/netsocket/DNS.h

Lines changed: 29 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -20,76 +20,76 @@
2020
class DNS {
2121
public:
2222

23-
/** Translates a hostname to an IP address with specific version
23+
/** Translate a hostname to an IP address with specific version.
2424
*
2525
* The hostname may be either a domain name or an IP address. If the
2626
* hostname is an IP address, no network transactions will be performed.
2727
*
2828
* If no stack-specific DNS resolution is provided, the hostname
2929
* will be resolve using a UDP socket on the stack.
3030
*
31-
* @param host Hostname to resolve
32-
* @param address Destination for the host SocketAddress
31+
* @param host Hostname to resolve.
32+
* @param address Pointer to a SocketAddress to store the result.
3333
* @param version IP version of address to resolve, NSAPI_UNSPEC indicates
34-
* version is chosen by the stack (defaults to NSAPI_UNSPEC)
35-
* @return 0 on success, negative error code on failure
34+
* version is chosen by the stack (defaults to NSAPI_UNSPEC).
35+
* @return NSAPI_ERROR_OK on success, negative error code on failure.
3636
*/
3737
virtual nsapi_error_t gethostbyname(const char *host,
3838
SocketAddress *address, nsapi_version_t version = NSAPI_UNSPEC) = 0;
3939

40-
/** Hostname translation callback (asynchronous)
40+
/** Hostname translation callback for gethostbyname_async.
4141
*
42-
* Callback will be called after DNS resolution completes or a failure occurs.
42+
* The callback is called after DNS resolution completes, or a failure occurs.
4343
*
4444
* Callback should not take more than 10ms to execute, otherwise it might
4545
* prevent underlying thread processing. A portable user of the callback
4646
* should not make calls to network operations due to stack size limitations.
4747
* The callback should not perform expensive operations such as socket recv/send
4848
* calls or blocking operations.
4949
*
50-
* @param status 0 on success, negative error code on failure
51-
* @param address On success, destination for the host SocketAddress
50+
* @param result NSAPI_ERROR_OK on success, negative error code on failure.
51+
* @param address On success, destination for the host SocketAddress.
5252
*/
5353
typedef mbed::Callback<void (nsapi_error_t result, SocketAddress *address)> hostbyname_cb_t;
5454

55-
/** Translates a hostname to an IP address (asynchronous)
55+
/** Translate a hostname to an IP address (asynchronous).
5656
*
5757
* The hostname may be either a domain name or an IP address. If the
5858
* hostname is an IP address, no network transactions will be performed.
5959
*
6060
* If no stack-specific DNS resolution is provided, the hostname
61-
* will be resolve using a UDP socket on the stack.
61+
* will be resolved using a UDP socket on the stack.
6262
*
63-
* Call is non-blocking. Result of the DNS operation is returned by the callback.
64-
* If this function returns failure, callback will not be called. In case result
65-
* is success (IP address was found from DNS cache), callback will be called
66-
* before function returns.
63+
* The call is non-blocking. The result of the DNS operation is returned by the callback.
64+
* If this function returns failure, the callback will not be called. If it is successful,
65+
* (the IP address was found from the DNS cache), the callback will be called
66+
* before the function returns.
6767
*
68-
* @param host Hostname to resolve
69-
* @param callback Callback that is called for result
70-
* @param version IP version of address to resolve, NSAPI_UNSPEC indicates
71-
* version is chosen by the stack (defaults to NSAPI_UNSPEC)
72-
* @return 0 on immediate success,
68+
* @param host Hostname to resolve.
69+
* @param callback Callback that is called to return the result.
70+
* @param version IP version of address to resolve. NSAPI_UNSPEC indicates that the
71+
* version is chosen by the stack (defaults to NSAPI_UNSPEC).
72+
* @return NSAPI_ERROR_OK on immediate success,
7373
* negative error code on immediate failure or
74-
* a positive unique id that represents the hostname translation operation
75-
* and can be passed to cancel
74+
* a positive unique ID that represents the hostname translation operation
75+
* and can be passed to cancel.
7676
*/
7777
virtual nsapi_value_or_error_t gethostbyname_async(const char *host, hostbyname_cb_t callback,
7878
nsapi_version_t version = NSAPI_UNSPEC) = 0;
7979

80-
/** Cancels asynchronous hostname translation
80+
/** Cancel asynchronous hostname translation.
8181
*
82-
* When translation is cancelled, callback will not be called.
82+
* When translation is canceled, callback is not called.
8383
*
84-
* @param id Unique id of the hostname translation operation
85-
* @return 0 on success, negative error code on failure
84+
* @param id Unique ID of the hostname translation operation returned by gethostbyname_async.
85+
* @return NSAPI_ERROR_OK on success, negative error code on failure.
8686
*/
8787
virtual nsapi_error_t gethostbyname_async_cancel(int id) = 0;
8888

89-
/** Add a domain name server to list of servers to query
89+
/** Add a domain name server to list of servers to query.
9090
*
91-
* @param address Destination for the host address
92-
* @return 0 on success, negative error code on failure
91+
* @param address DNS server host address.
92+
* @return NSAPI_ERROR_OK on success, negative error code on failure.
9393
*/
9494
virtual nsapi_error_t add_dns_server(const SocketAddress &address) = 0;
9595
};

features/netsocket/EthInterface.h

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -23,13 +23,13 @@
2323
#include "netsocket/NetworkInterface.h"
2424

2525

26-
/** EthInterface class
27-
*
28-
* Common interface that is shared between ethernet hardware.
26+
/** Common interface that is shared between Ethernet hardware.
2927
*/
3028
class EthInterface : public virtual NetworkInterface {
3129
public:
3230

31+
/** @copydoc NetworkInterface::ethInterface
32+
*/
3333
virtual EthInterface *ethInterface()
3434
{
3535
return this;
@@ -41,10 +41,11 @@ class EthInterface : public virtual NetworkInterface {
4141
* Default behaviour is to get the target's default interface, if
4242
* any.
4343
*
44-
* @return pointer to interface, if any
44+
* @return Pointer to interface, if one exists.
4545
*/
4646
static EthInterface *get_default_instance();
4747

48+
#if !defined(DOXYGEN_ONLY)
4849
protected:
4950

5051
/** Get the target's default Ethernet interface.
@@ -53,9 +54,10 @@ class EthInterface : public virtual NetworkInterface {
5354
* default implementation will invoke EthernetInterface with the
5455
* default EMAC and default network stack, if DEVICE_EMAC is set.
5556
*
56-
* @return pointer to interface, if any
57+
* @return Pointer to interface, if one exists.
5758
*/
5859
static EthInterface *get_target_default_instance();
60+
#endif //!defined(DOXYGEN_ONLY)
5961
};
6062

6163

features/netsocket/EthernetInterface.h

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -21,12 +21,11 @@
2121
#include "EMACInterface.h"
2222

2323

24-
/** EthernetInterface class
25-
* Implementation of the NetworkStack for an EMAC-based Ethernet driver
24+
/** Implementation of the NetworkStack for an EMAC-based Ethernet driver.
2625
*/
2726
class EthernetInterface : public EMACInterface, public EthInterface {
2827
public:
29-
/** Create an EMAC-based ethernet interface.
28+
/** Create an EMAC-based Ethernet interface.
3029
*
3130
* The default arguments obtain the default EMAC, which will be target-
3231
* dependent (and the target may have some JSON option to choose which
@@ -36,8 +35,8 @@ class EthernetInterface : public EMACInterface, public EthInterface {
3635
* Due to inability to return errors from the constructor, no real
3736
* work is done until the first call to connect().
3837
*
39-
* @param emac Reference to EMAC to use
40-
* @param stack Reference to onboard-network stack to use
38+
* @param emac Reference to EMAC to use.
39+
* @param stack Reference to onboard-network stack to use.
4140
*/
4241
EthernetInterface(EMAC &emac = EMAC::get_default_instance(),
4342
OnboardNetworkStack &stack = OnboardNetworkStack::get_default_instance()) : EMACInterface(emac, stack) { }

0 commit comments

Comments
 (0)