24
24
#include " netif.h"
25
25
#include " rtw_emac.h"
26
26
#include " OnboardNetworkStack.h"
27
+ #include " EMACInterface.h"
27
28
#include " LWIPStack.h"
28
29
29
30
// Forward declaration
@@ -32,7 +33,7 @@ class NetworkStack;
32
33
/* * Realtek Wlan (RTW) interface class
33
34
* Implementation of the NetworkStack for Ameba
34
35
*/
35
- class RTWInterface : public WiFiInterface
36
+ class RTWInterface : public WiFiInterface , public EMACInterface
36
37
{
37
38
public:
38
39
/* * RTWWlanInterface lifetime
@@ -43,28 +44,6 @@ class RTWInterface: public WiFiInterface
43
44
44
45
~RTWInterface ();
45
46
46
- /* * Set a static IP address
47
- *
48
- * Configures this network interface to use a static IP address.
49
- * Implicitly disables DHCP, which can be enabled in set_dhcp.
50
- * Requires that the network is disconnected.
51
- *
52
- * @param address Null-terminated representation of the local IP address
53
- * @param netmask Null-terminated representation of the local network mask
54
- * @param gateway Null-terminated representation of the local gateway
55
- * @return 0 on success, negative error code on failure
56
- */
57
- virtual nsapi_error_t set_network (const char *ip_address, const char *netmask, const char *gateway);
58
-
59
- /* * Enable or disable DHCP on the network
60
- *
61
- * Requires that the network is disconnected
62
- *
63
- * @param dhcp False to disable dhcp (defaults to enabled)
64
- * @return 0 on success, negative error code on failure
65
- */
66
- virtual nsapi_error_t set_dhcp (bool dhcp);
67
-
68
47
/* * Set the WiFi network credentials
69
48
*
70
49
* @param ssid Name of the network to connect to
@@ -112,42 +91,10 @@ class RTWInterface: public WiFiInterface
112
91
* @return Number of entries in @a, or if @a count was 0 number of available networks, negative on error
113
92
* see @a nsapi_error
114
93
*/
115
- virtual nsapi_size_or_error_t scan (WiFiAccessPoint *res, unsigned count);
116
-
117
- virtual nsapi_error_t set_channel (uint8_t channel);
118
- virtual int8_t get_rssi ();
119
-
120
- /* * Get the local MAC address
121
- *
122
- * Provided MAC address is intended for info or debug purposes and
123
- * may not be provided if the underlying network interface does not
124
- * provide a MAC address
125
- *
126
- * @return Null-terminated representation of the local MAC address
127
- * or null if no MAC address is available
128
- */
129
- virtual const char *get_mac_address ();
130
-
131
- /* * Get the local IP address
132
- *
133
- * @return Null-terminated representation of the local IP address
134
- * or null if no IP address has been recieved
135
- */
136
- virtual const char *get_ip_address ();
94
+ virtual nsapi_size_or_error_t scan (WiFiAccessPoint *res, unsigned count);
137
95
138
- /* * Get the local network mask
139
- *
140
- * @return Null-terminated representation of the local network mask
141
- * or null if no network mask has been recieved
142
- */
143
- virtual const char *get_netmask ();
144
-
145
- /* * Get the local gateways
146
- *
147
- * @return Null-terminated representation of the local gateway
148
- * or null if no network mask has been recieved
149
- */
150
- virtual const char *get_gateway ();
96
+ virtual nsapi_error_t set_channel (uint8_t channel);
97
+ virtual int8_t get_rssi ();
151
98
152
99
RTW_EMAC &get_emac () const { return rtw_emac; }
153
100
@@ -161,15 +108,9 @@ class RTWInterface: public WiFiInterface
161
108
virtual NetworkStack *get_stack ();
162
109
RTW_EMAC &rtw_emac;
163
110
OnboardNetworkStack &rtw_obn_stack;
164
- OnboardNetworkStack::Interface *rtw_interface;
165
- bool _dhcp;
166
111
char _ssid[256 ];
167
112
char _pass[256 ];
168
113
nsapi_security_t _security;
169
114
uint8_t _channel;
170
- char _ip_address[IPADDR_STRLEN_MAX];
171
- char _netmask[NSAPI_IPv4_SIZE];
172
- char _gateway[NSAPI_IPv4_SIZE];
173
- char _mac_address[NSAPI_MAC_SIZE];
174
115
};
175
116
#endif
0 commit comments