arduino-emulator
Loading...
Searching...
No Matches
WiFi.h
1/*
2 WiFi.h
3 Copyright (c) 2025 Phil Schatzmann. All right reserved.
4
5 This library is free software; you can redistribute it and/or
6 modify it under the terms of the GNU Lesser General Public
7 License as published by the Free Software Foundation; either
8 version 2.1 of the License, or (at your option) any later version.
9
10 This library is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Lesser General Public License for more details.
14
15 You should have received a copy of the GNU Lesser General Public
16 License along with this library; if not, write to the Free Software
17 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
18*/
19#pragma once
20
21#include "WiFiClient.h"
22#include "WiFiClientSecure.h"
23#include "WiFiServer.h"
24
32namespace arduino {
33
34typedef enum { WIFI_OFF = 0, WIFI_STA = 1, WIFI_AP = 2, WIFI_AP_STA = 3 } WiFiMode_t; // For ESP compatibility
35
36enum wifi_ps_type_t { WIFI_PS_NONE, WIFI_PS_MIN_MODEM, WIFI_PS_MAX_MODEM };
37
38class WifiMock {
39 public:
40 virtual void begin(const char* name, const char* pwd) {
41 // nothing to be done
42 }
43
44 // we assume the network to be available on a desktop or host machine
45 wl_status_t status() { return WL_CONNECTED; }
46
47 IPAddress& localIP() {
48 SocketImpl sock;
49 adress.fromString(sock.getIPAddress());
50 return adress;
51 }
52
53 void setSleep(bool) {}
54
55 void setSleep(wifi_ps_type_t) {}
56
57 int macAddress() { return mac; }
58
59 void setClientInsecure() {}
60
61 // WIFI_STA is the best approximation to interface enabled
62 void mode(WiFiMode_t m);
63 WiFiMode_t getMode() { return WIFI_STA; };
64
65 protected:
66 IPAddress adress;
67 int mac = 0;
68};
69
70extern WifiMock WiFi;
71
72} // namespace arduino
Definition DMAPool.h:103
Definition IPAddress.h:43
Definition SocketImpl.h:26
Definition WiFi.h:38
We provide the WiFi class to simulate the Arduino WIFI. In in Linux we can expect that networking is ...
Definition CanMsg.cpp:31