Skip to content

Commit ddada8a

Browse files
committed
Wifi.h
1 parent 9cf7e64 commit ddada8a

File tree

1 file changed

+37
-34
lines changed
  • ArduinoCore-Linux/cores/arduino

1 file changed

+37
-34
lines changed

ArduinoCore-Linux/cores/arduino/WiFi.h

Lines changed: 37 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -5,48 +5,51 @@
55

66
/**
77
* @brief We provide the WiFi class to simulate the Arduino WIFI. In in Linux
8-
* we can expect that networking is already active. So we dont need to do anything
9-
*
8+
* we can expect that networking is already active. So we dont need to do
9+
* anything
10+
*
1011
*/
1112

1213
namespace arduino {
1314

1415
typedef enum {
15-
WL_NO_SHIELD = 255,
16-
WL_IDLE_STATUS = 0,
17-
WL_NO_SSID_AVAIL,
18-
WL_SCAN_COMPLETED,
19-
WL_CONNECTED,
20-
WL_CONNECT_FAILED,
21-
WL_CONNECTION_LOST,
22-
WL_DISCONNECTED
16+
WL_NO_SHIELD = 255,
17+
WL_IDLE_STATUS = 0,
18+
WL_NO_SSID_AVAIL,
19+
WL_SCAN_COMPLETED,
20+
WL_CONNECTED,
21+
WL_CONNECT_FAILED,
22+
WL_CONNECTION_LOST,
23+
WL_DISCONNECTED
2324
} wl_status_t;
24-
25-
25+
2626
class WifiMock {
27-
public:
28-
virtual void begin(const char*name, const char* pwd){
29-
// nothing to be done
30-
}
31-
32-
// we assume the network to be available on a desktop or host machine
33-
wl_status_t status() {
34-
return WL_CONNECTED;
35-
}
36-
37-
IPAddress &localIP(){
38-
SocketImpl sock;
39-
adress.fromString(sock.getIPAddress());
40-
return adress;
41-
}
42-
43-
protected:
44-
IPAddress adress;
45-
27+
public:
28+
virtual void begin(const char *name, const char *pwd) {
29+
// nothing to be done
30+
}
31+
32+
// we assume the network to be available on a desktop or host machine
33+
wl_status_t status() { return WL_CONNECTED; }
34+
35+
IPAddress &localIP() {
36+
SocketImpl sock;
37+
adress.fromString(sock.getIPAddress());
38+
return adress;
39+
}
40+
41+
void setSleep(bool){
42+
}
4643

44+
int macAddress() {
45+
return mac;
46+
}
47+
48+
protected:
49+
IPAddress adress;
50+
int mac = 0;
4751
};
48-
49-
extern WifiMock WiFi;
5052

51-
}
53+
extern WifiMock WiFi;
5254

55+
} // namespace arduino

0 commit comments

Comments
 (0)