18
18
19
19
#include " netsocket/NetworkInterface.h"
20
20
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
24
23
*/
25
24
class CellularBase : public NetworkInterface {
26
25
27
26
public:
28
-
29
27
/* * Get the default Cellular interface.
30
28
*
31
29
* This is provided as a weak method so applications can override.
32
30
* Default behaviour is to get the target's default interface, if
33
31
* any.
34
32
*
35
- * @return pointer to interface, if any
33
+ * @return pointer to interface, if any.
36
34
*/
37
-
38
35
static CellularBase *get_default_instance ();
39
36
40
- /* * Set the Cellular network credentials
37
+ /* * Set the Cellular network credentials.
41
38
*
42
39
* Please check documentation of connect() for default behaviour of APN settings.
43
40
*
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).
47
44
*/
48
45
virtual void set_credentials (const char *apn, const char *uname = 0 ,
49
46
const char *pwd = 0 ) = 0;
50
47
51
- /* * Set the pin code for SIM card
48
+ /* * Set the pin code for SIM card.
52
49
*
53
- * @param sim_pin PIN for the SIM card
50
+ * @param sim_pin PIN for the SIM card.
54
51
*/
55
52
virtual void set_sim_pin (const char *sim_pin) = 0;
56
53
57
- /* * Start the interface
54
+ /* * Attempt to connect to a Cellular network with a pin and credentials.
58
55
*
59
- * Attempts to connect to a Cellular network.
60
- *
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.
66
61
*/
67
62
virtual nsapi_error_t connect (const char *sim_pin, const char *apn = 0 ,
68
63
const char *uname = 0 ,
69
64
const char *pwd = 0 ) = 0;
70
65
71
- /* * Start the interface
66
+ /* * Attempt to connect to a Cellular network.
72
67
*
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 is not set, NSAPI_ERROR_AUTH_ERROR is returned.
75
69
*
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.
77
71
*/
78
72
virtual nsapi_error_t connect () = 0;
79
73
80
- /* * Stop the interface
74
+ /* * Stop the interface.
81
75
*
82
- * @return 0 on success, or error code on failure
76
+ * @return NSAPI_ERROR_OK on success, or error code on failure.
83
77
*/
84
78
virtual nsapi_error_t disconnect () = 0;
85
79
86
- /* * Check if the connection is currently established or not
80
+ /* * Check if the connection is currently established or not.
87
81
*
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.
91
84
*/
92
85
virtual bool is_connected () = 0;
93
86
94
- /* * Get the local IP address
87
+ /* * Get the local IP address.
95
88
*
96
89
* @return Null-terminated representation of the local IP address
97
- * or null if no IP address has been received
90
+ * or null if no IP address has been received.
98
91
*/
99
92
virtual const char *get_ip_address () = 0;
100
93
101
- /* * Get the local network mask
94
+ /* * Get the local network mask.
102
95
*
103
96
* @return Null-terminated representation of the local network mask
104
- * or null if no network mask has been received
97
+ * or null if no network mask has been received.
105
98
*/
106
99
virtual const char *get_netmask () = 0;
107
100
108
- /* * Get the local gateways
101
+ /* * Get the local gateways.
109
102
*
110
103
* @return Null-terminated representation of the local gateway
111
- * or null if no network mask has been received
104
+ * or null if no network mask has been received.
112
105
*/
113
106
virtual const char *get_gateway () = 0;
114
107
108
+ /* * @copydoc NetworkInterface::cellularBase
109
+ */
115
110
virtual CellularBase *cellularBase ()
116
111
{
117
112
return this ;
118
113
}
119
114
115
+ #if !defined(DOXYGEN_ONLY)
116
+
120
117
protected:
121
118
/* * Get the target's default Cellular interface.
122
119
*
@@ -127,6 +124,8 @@ class CellularBase: public NetworkInterface {
127
124
* @return pointer to interface, if any
128
125
*/
129
126
static CellularBase *get_target_default_instance ();
127
+
128
+ #endif // !defined(DOXYGEN_ONLY)
130
129
};
131
130
132
131
#endif // CELLULAR_BASE_H
0 commit comments