This repository was archived by the owner on Feb 4, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathAsyncWebSynchronization_RP2040W.h
86 lines (64 loc) · 2.28 KB
/
AsyncWebSynchronization_RP2040W.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
/****************************************************************************************************************************
AsyncWebSynchronization_RP2040W.h
For RP2040W with CYW43439 WiFi
AsyncWebServer_RP2040W is a library for the RP2040W with CYW43439 WiFi
Based on and modified from ESPAsyncWebServer (https://github.com/me-no-dev/ESPAsyncWebServer)
Built by Khoi Hoang https://github.com/khoih-prog/AsyncWebServer_RP2040W
Licensed under GPLv3 license
Version: 1.5.0
Version Modified By Date Comments
------- ----------- ---------- -----------
1.0.0 K Hoang 13/08/2022 Initial coding for RP2040W with CYW43439 WiFi
...
1.3.0 K Hoang 10/10/2022 Fix crash when using AsyncWebSockets server
1.3.1 K Hoang 10/10/2022 Improve robustness of AsyncWebSockets server
1.4.0 K Hoang 20/10/2022 Add LittleFS functions such as AsyncFSWebServer
1.4.1 K Hoang 10/11/2022 Add examples to demo how to use beginChunkedResponse() to send in chunks
1.4.2 K Hoang 28/01/2023 Add Async_AdvancedWebServer_SendChunked_MQTT and AsyncWebServer_MQTT_RP2040W examples
1.5.0 K Hoang 30/01/2023 Fix _catchAllHandler not working bug
*****************************************************************************************************************************/
#pragma once
#ifndef RP2040W_ASYNCWEBSYNCHRONIZATION_H_
#define RP2040W_ASYNCWEBSYNCHRONIZATION_H_
#include <AsyncWebServer_RP2040W.h>
// This is the RP2040W version of the Sync Lock which is currently unimplemented
class AsyncWebLock
{
public:
AsyncWebLock() {}
~AsyncWebLock() {}
/////////////////////////////////////////////////
inline bool lock() const
{
return false;
}
/////////////////////////////////////////////////
inline void unlock() const {}
};
class AsyncWebLockGuard
{
private:
const AsyncWebLock *_lock;
public:
/////////////////////////////////////////////////
AsyncWebLockGuard(const AsyncWebLock &l)
{
if (l.lock())
{
_lock = &l;
}
else
{
_lock = NULL;
}
}
/////////////////////////////////////////////////
~AsyncWebLockGuard()
{
if (_lock)
{
_lock->unlock();
}
}
};
#endif // RP2040W_ASYNCWEBSYNCHRONIZATION_H_