From 1cab1f5a0d3f5e46b013fa11e1d276ffd548cc8e Mon Sep 17 00:00:00 2001 From: abratchik Date: Thu, 15 Dec 2022 17:11:45 +0400 Subject: [PATCH] Webclient refactoring --- API.md | 10 +- Docs/html/annotated.html | 17 +- Docs/html/app__cam_8h_source.html | 14 +- Docs/html/app__conn_8h.html | 2 + Docs/html/app__conn_8h_source.html | 217 ++++---- Docs/html/app__httpd_8h.html | 3 + Docs/html/app__httpd_8h_source.html | 273 +++++----- Docs/html/class_c_l_app_httpd.html | 87 +++ Docs/html/classes.html | 9 +- Docs/html/functions.html | 9 + Docs/html/functions_func.html | 7 + Docs/html/functions_vars.html | 2 + Docs/html/hierarchy.html | 17 +- Docs/html/index.html | 58 +- Docs/html/md__a_p_i.html | 10 +- Docs/html/menudata.js | 2 + Docs/html/search/all_0.js | 4 +- Docs/html/search/all_11.js | 3 +- Docs/html/search/all_4.js | 2 +- Docs/html/search/all_5.js | 25 +- Docs/html/search/all_c.js | 5 +- Docs/html/search/all_e.js | 49 +- Docs/html/search/classes_0.js | 6 +- Docs/html/search/classes_1.js | 7 +- Docs/html/search/classes_2.js | 3 +- Docs/html/search/classes_3.html | 37 ++ Docs/html/search/classes_3.js | 4 + Docs/html/search/functions_0.js | 7 +- Docs/html/search/functions_1.js | 8 +- Docs/html/search/functions_2.js | 4 +- Docs/html/search/functions_3.js | 36 +- Docs/html/search/functions_4.js | 37 +- Docs/html/search/functions_5.js | 10 +- Docs/html/search/functions_6.js | 10 +- Docs/html/search/functions_7.js | 9 +- Docs/html/search/functions_8.js | 11 +- Docs/html/search/functions_9.js | 9 +- Docs/html/search/functions_a.js | 22 +- Docs/html/search/functions_b.js | 18 +- Docs/html/search/functions_c.js | 2 +- Docs/html/search/functions_d.js | 2 +- Docs/html/search/functions_e.html | 37 ++ Docs/html/search/functions_e.js | 5 + Docs/html/search/pages_2.js | 2 +- Docs/html/search/searchdata.js | 4 +- Docs/html/search/variables_5.js | 3 +- Docs/html/search/variables_6.js | 5 +- Docs/html/struct_app_servo.html | 120 ++++ Docs/html/struct_static_i_p.html | 7 +- Docs/html/struct_station.html | 7 +- README.md | 53 +- data/www/css/style.css | 6 - data/www/index.html | 367 +++++++++++++ data/www/index_ov2640.html | 617 --------------------- data/www/index_ov3660.html | 636 ---------------------- data/www/index_simple.html | 317 ----------- data/www/js/cam.js | 183 +++++++ data/www/js/utils.js | 264 +++++++++ data/www/portal.html | 27 - data/www/{streamviewer.html => view.html} | 2 +- platformio.ini | 4 +- src/app_cam.cpp | 25 +- src/app_httpd.cpp | 141 +++-- src/app_httpd.h | 17 + 64 files changed, 1777 insertions(+), 2139 deletions(-) create mode 100644 Docs/html/search/classes_3.html create mode 100644 Docs/html/search/classes_3.js create mode 100644 Docs/html/search/functions_e.html create mode 100644 Docs/html/search/functions_e.js create mode 100644 Docs/html/struct_app_servo.html create mode 100644 data/www/index.html delete mode 100644 data/www/index_ov2640.html delete mode 100644 data/www/index_ov3660.html delete mode 100644 data/www/index_simple.html create mode 100644 data/www/js/cam.js create mode 100644 data/www/js/utils.js delete mode 100644 data/www/portal.html rename data/www/{streamviewer.html => view.html} (99%) diff --git a/API.md b/API.md index 148afad..b631a87 100644 --- a/API.md +++ b/API.md @@ -4,10 +4,8 @@ this makes controlling all functions of the camera via GET requests possible. ## URI's ### Web UI pages -* `/` or `/portal` - Default index (portal) -* `/view?mode=full|simple|stream|still` - Go direct to specific page: -* - full: taking still and video with complete set of camera controls -* - simple: taking still and video with limited set of camera controls +* `/` Default index (camera view) +* `/view?mode=stream|still` - Go direct to specific page: * - stream: starting video capture with full screen mode * - still: taking a still image with full screen mode * `/dump` - Status page (automatically refreshed every 5 sec) @@ -50,8 +48,6 @@ vflip - 0 = disable, 1 = enable rotate - Rotation Angle; integer, only -90, 0, 90 values are recognised dcw - 0 = disable, 1 = enable colorbar - Overlays a color test pattern on the stream; integer, 1 = enabled -face_detect - Face Detection; 1 = enabled, Only settable if framesize <= 4 (CIF) -face_recognize - Face recognition; 1 = enabled, only settable if Face detection is already enabled ``` ##### Framesize values @@ -81,7 +77,7 @@ the `` parameter. * save_prefs - Saves preferences `val=cam` or not specified will save camera preferences `val=conn` will save network preferences -* clear_prefs - Deletes camera the preferences +* remove_prefs - Deletes camera the preferences `val=cam` or not specified will reset camera preferences `val=conn` will reset network preferences. Attention! after this the server will boot as access point after restart, and all connection settings will be lost. diff --git a/Docs/html/annotated.html b/Docs/html/annotated.html index a9e68fc..8425ee6 100644 --- a/Docs/html/annotated.html +++ b/Docs/html/annotated.html @@ -69,15 +69,16 @@
Here are the data structures with brief descriptions:
- - - - + + + + - - - - + + + +
 CCLAppCamCamera Manager Manages all interactions with camera
 CCLAppComponentAbstract root class for the appication components
 CCLAppConnConnection Manager This class manages everything related to connectivity of the application: WiFi, OTA etc
 CCLAppHttpdWebServer Manager Class for handling web server requests. The web pages are assumed to be stored in the file system (can be SD card or LittleFS).
+
 CAppServo
 CCLAppCamCamera Manager Manages all interactions with camera
 CCLAppComponentAbstract root class for the appication components
 CCLAppConnConnection Manager This class manages everything related to connectivity of the application: WiFi, OTA etc
 CCLAppHttpdWebServer Manager Class for handling web server requests. The web pages are assumed to be stored in the file system (can be SD card or LittleFS).
 CCLStorageStorage Manager Encapsulates access to the file system, which can be either external (SD card) or internal (LittleFS)
 CStaticIP
 CStation
 CUriMappingStatic URI to path mapping
 CCLStorageStorage Manager Encapsulates access to the file system, which can be either external (SD card) or internal (LittleFS)
 CStaticIPStatic IP strcuture for configuring AP and WiFi parameters
 CStationWiFi connectivity details (SSID/password)
 CUriMappingStatic URI to path mapping
diff --git a/Docs/html/app__cam_8h_source.html b/Docs/html/app__cam_8h_source.html index 63be855..e06ec0f 100644 --- a/Docs/html/app__cam_8h_source.html +++ b/Docs/html/app__cam_8h_source.html @@ -174,31 +174,31 @@
105extern CLAppCam AppCam;
106
107#endif
-
CLAppCam AppCam
Definition: app_cam.cpp:233
+
CLAppCam AppCam
Definition: app_cam.cpp:248
#define LAMP_DEFAULT
Definition: app_cam.h:11
Camera Manager Manages all interactions with camera.
Definition: app_cam.h:22
-
int savePrefs()
Definition: app_cam.cpp:157
+
int savePrefs()
Definition: app_cam.cpp:170
bool isJPEGinBuffer()
Definition: app_cam.h:54
-
int loadPrefs()
Definition: app_cam.cpp:98
+
int loadPrefs()
Definition: app_cam.cpp:109
void setRotation(int val)
Definition: app_cam.h:48
CLAppCam()
Definition: app_cam.cpp:3
void setFrameRate(int newFrameRate)
Definition: app_cam.h:43
int getRotation()
Definition: app_cam.h:49
int getFrameRate()
Definition: app_cam.h:42
int getLamp()
Definition: app_cam.h:33
-
int snapToBufer()
Definition: app_cam.cpp:218
-
void setLamp(int newVal=LAMP_DEFAULT)
Definition: app_cam.cpp:85
+
int snapToBufer()
Definition: app_cam.cpp:233
+
void setLamp(int newVal=LAMP_DEFAULT)
Definition: app_cam.cpp:96
int getXclk()
Definition: app_cam.h:46
-
int stop()
Definition: app_cam.cpp:78
+
int stop()
Definition: app_cam.cpp:89
String getErr()
Definition: app_cam.h:40
void setXclk(int val)
Definition: app_cam.h:45
size_t getBufferSize()
Definition: app_cam.h:53
void setAutoLamp(bool val)
Definition: app_cam.h:35
bool isAutoLamp()
Definition: app_cam.h:36
uint8_t * getBuffer()
Definition: app_cam.h:52
-
void releaseBuffer()
Definition: app_cam.cpp:224
+
void releaseBuffer()
Definition: app_cam.cpp:239
int getSensorPID()
Definition: app_cam.h:38
int start()
Definition: app_cam.cpp:8
sensor_t * getSensor()
Definition: app_cam.h:39
diff --git a/Docs/html/app__conn_8h.html b/Docs/html/app__conn_8h.html index 842324d..43c19ef 100644 --- a/Docs/html/app__conn_8h.html +++ b/Docs/html/app__conn_8h.html @@ -90,8 +90,10 @@

Data Structures

struct  Station + WiFi connectivity details (SSID/password). More...
  struct  StaticIP + Static IP strcuture for configuring AP and WiFi parameters. More...
  class  CLAppConn  Connection Manager This class manages everything related to connectivity of the application: WiFi, OTA etc. More...
diff --git a/Docs/html/app__conn_8h_source.html b/Docs/html/app__conn_8h_source.html index fc7d394..b4edd93 100644 --- a/Docs/html/app__conn_8h_source.html +++ b/Docs/html/app__conn_8h_source.html @@ -100,98 +100,97 @@
27#define NTP_GMT_OFFSET 14400
28#define NTP_DST_OFFSET 0
29
-
30
-
31struct Station { char ssid[64]; char password[64]; bool dhcp;};
-
32
-
33struct StaticIP { IPAddress *ip; IPAddress *netmask; IPAddress *gateway; IPAddress *dns1; IPAddress *dns2; };
-
34
-
40class CLAppConn : public CLAppComponent {
-
41 public:
-
42 CLAppConn();
-
43
-
44 int loadPrefs();
-
45 int savePrefs();
-
46 int start();
-
47 bool stop() {return WiFi.disconnect();};
-
48
-
49 void enableOTA(bool enable = true);
-
50 void handleOTA() {if(otaEnabled) ArduinoOTA.handle();};
-
51
-
52 void configMDNS();
-
53 void handleDNSRequest(){if (captivePortal) dnsServer.processNextRequest();};
-
54
-
55 void configNTP();
-
56
-
57 char * getNTPServer() { return ntpServer;};
-
58 long getGmtOffset_sec() {return gmtOffset_sec;};
-
59 int getDaylightOffset_sec() {return daylightOffset_sec;};
-
60
-
61 bool isOTAEnabled() {return otaEnabled;};
-
62
-
63 wl_status_t wifiStatus() {return (accesspoint?ap_status:WiFi.status());};
-
64
-
65 char * getHTTPUrl(){ return httpURL;};
-
66 char * getStreamUrl(){ return streamURL;};
-
67 int getPort() {return httpPort;};
-
68
-
69 char * getApName() {return apName;};
-
70
-
71 bool isAccessPoint() {return accesspoint;};
-
72 bool isCaptivePortal() {return captivePortal;};
-
73
-
74 char * getLocalTimeStr();
-
75 char * getUpTimeStr();
-
76 void printLocalTime(bool extraData=false);
+
34struct Station { char ssid[64]; char password[64]; bool dhcp;};
+
35
+
40struct StaticIP { IPAddress *ip; IPAddress *netmask; IPAddress *gateway; IPAddress *dns1; IPAddress *dns2; };
+
41
+
47class CLAppConn : public CLAppComponent {
+
48 public:
+
49 CLAppConn();
+
50
+
51 int loadPrefs();
+
52 int savePrefs();
+
53 int start();
+
54 bool stop() {return WiFi.disconnect();};
+
55
+
56 void enableOTA(bool enable = true);
+
57 void handleOTA() {if(otaEnabled) ArduinoOTA.handle();};
+
58
+
59 void configMDNS();
+
60 void handleDNSRequest(){if (captivePortal) dnsServer.processNextRequest();};
+
61
+
62 void configNTP();
+
63
+
64 char * getNTPServer() { return ntpServer;};
+
65 long getGmtOffset_sec() {return gmtOffset_sec;};
+
66 int getDaylightOffset_sec() {return daylightOffset_sec;};
+
67
+
68 bool isOTAEnabled() {return otaEnabled;};
+
69
+
70 wl_status_t wifiStatus() {return (accesspoint?ap_status:WiFi.status());};
+
71
+
72 char * getHTTPUrl(){ return httpURL;};
+
73 char * getStreamUrl(){ return streamURL;};
+
74 int getPort() {return httpPort;};
+
75
+
76 char * getApName() {return apName;};
77
-
78 private:
-
79 void calcURLs();
+
78 bool isAccessPoint() {return accesspoint;};
+
79 bool isCaptivePortal() {return captivePortal;};
80
-
81 // Known networks structure. Max number of known stations limited for memory considerations
-
82 Station *stationList[MAX_KNOWN_STATIONS];
-
83 int stationCount = 0;
+
81 char * getLocalTimeStr();
+
82 char * getUpTimeStr();
+
83 void printLocalTime(bool extraData=false);
84
-
85 // Static IP structure
-
86 StaticIP staticIP;
+
85 private:
+
86 void calcURLs();
87
-
88 char mdnsName[20];
-
89
-
90 bool accesspoint = false;
-
91 char apName[20];
-
92 char apPass[20];
-
93 int ap_channel=1;
-
94 StaticIP apIP;
-
95 bool ap_dhcp=true;
-
96 wl_status_t ap_status = WL_DISCONNECTED;
-
97
-
98 // DNS server
-
99 const byte DNS_PORT = 53;
-
100 DNSServer dnsServer;
-
101 bool captivePortal = false;
-
102
-
103 // HOST_NAME
-
104 char hostName[64]="";
-
105
-
106 // The app and stream URLs (initialized during WiFi setup)
-
107 char httpURL[64];
-
108 char streamURL[64];
+
88 // Known networks structure. Max number of known stations limited for memory considerations
+
89 Station *stationList[MAX_KNOWN_STATIONS];
+
90 int stationCount = 0;
+
91
+
92 // Static IP structure
+
93 StaticIP staticIP;
+
94
+
95 char mdnsName[20];
+
96
+
97 bool accesspoint = false;
+
98 char apName[20];
+
99 char apPass[20];
+
100 int ap_channel=1;
+
101 StaticIP apIP;
+
102 bool ap_dhcp=true;
+
103 wl_status_t ap_status = WL_DISCONNECTED;
+
104
+
105 // DNS server
+
106 const byte DNS_PORT = 53;
+
107 DNSServer dnsServer;
+
108 bool captivePortal = false;
109
-
110 // HTTP Port. Can be overriden during IP setup
-
111 int httpPort = 80;
+
110 // HOST_NAME
+
111 char hostName[64]="";
112
-
113 // OTA parameters
-
114 bool otaEnabled = false;
-
115 char otaPassword[20] = "";
+
113 // The app and stream URLs (initialized during WiFi setup)
+
114 char httpURL[64];
+
115 char streamURL[64];
116
-
117 // NTP parameters
-
118 char ntpServer[20] = NTPSERVER;
-
119 long gmtOffset_sec = NTP_GMT_OFFSET;
-
120 int daylightOffset_sec = NTP_DST_OFFSET;
-
121
-
122};
+
117 // HTTP Port. Can be overriden during IP setup
+
118 int httpPort = 80;
+
119
+
120 // OTA parameters
+
121 bool otaEnabled = false;
+
122 char otaPassword[20] = "";
123
-
124extern CLAppConn AppConn;
-
125
-
126#endif
+
124 // NTP parameters
+
125 char ntpServer[20] = NTPSERVER;
+
126 long gmtOffset_sec = NTP_GMT_OFFSET;
+
127 int daylightOffset_sec = NTP_DST_OFFSET;
+
128
+
129};
+
130
+
131extern CLAppConn AppConn;
+
132
+
133#endif
#define NTP_GMT_OFFSET
Definition: app_conn.h:27
@@ -200,42 +199,42 @@
#define NTPSERVER
Definition: app_conn.h:26
#define MAX_KNOWN_STATIONS
Definition: app_conn.h:15
Abstract root class for the appication components.
Definition: app_component.h:14
-
Connection Manager This class manages everything related to connectivity of the application: WiFi,...
Definition: app_conn.h:40
+
Connection Manager This class manages everything related to connectivity of the application: WiFi,...
Definition: app_conn.h:47
char * getUpTimeStr()
Definition: app_conn.cpp:374
-
char * getNTPServer()
Definition: app_conn.h:57
+
char * getNTPServer()
Definition: app_conn.h:64
void configNTP()
Definition: app_conn.cpp:352
-
void handleOTA()
Definition: app_conn.h:50
-
char * getApName()
Definition: app_conn.h:69
-
char * getStreamUrl()
Definition: app_conn.h:66
+
void handleOTA()
Definition: app_conn.h:57
+
char * getApName()
Definition: app_conn.h:76
+
char * getStreamUrl()
Definition: app_conn.h:73
CLAppConn()
Definition: app_conn.cpp:3
void enableOTA(bool enable=true)
Definition: app_conn.cpp:276
-
int getPort()
Definition: app_conn.h:67
+
int getPort()
Definition: app_conn.h:74
int start()
Definition: app_conn.cpp:7
-
wl_status_t wifiStatus()
Definition: app_conn.h:63
-
bool isAccessPoint()
Definition: app_conn.h:71
-
void handleDNSRequest()
Definition: app_conn.h:53
+
wl_status_t wifiStatus()
Definition: app_conn.h:70
+
bool isAccessPoint()
Definition: app_conn.h:78
+
void handleDNSRequest()
Definition: app_conn.h:60
void printLocalTime(bool extraData=false)
Definition: app_conn.cpp:356
-
long getGmtOffset_sec()
Definition: app_conn.h:58
-
bool stop()
Definition: app_conn.h:47
+
long getGmtOffset_sec()
Definition: app_conn.h:65
+
bool stop()
Definition: app_conn.h:54
void configMDNS()
Definition: app_conn.cpp:338
-
bool isCaptivePortal()
Definition: app_conn.h:72
+
bool isCaptivePortal()
Definition: app_conn.h:79
int savePrefs()
Definition: app_conn.cpp:271
char * getLocalTimeStr()
Definition: app_conn.cpp:364
-
char * getHTTPUrl()
Definition: app_conn.h:65
+
char * getHTTPUrl()
Definition: app_conn.h:72
int loadPrefs()
Definition: app_conn.cpp:179
-
int getDaylightOffset_sec()
Definition: app_conn.h:59
-
bool isOTAEnabled()
Definition: app_conn.h:61
+
int getDaylightOffset_sec()
Definition: app_conn.h:66
+
bool isOTAEnabled()
Definition: app_conn.h:68
-
Definition: app_conn.h:33
-
IPAddress * ip
Definition: app_conn.h:33
-
IPAddress * dns2
Definition: app_conn.h:33
-
IPAddress * dns1
Definition: app_conn.h:33
-
IPAddress * gateway
Definition: app_conn.h:33
-
IPAddress * netmask
Definition: app_conn.h:33
-
Definition: app_conn.h:31
-
bool dhcp
Definition: app_conn.h:31
-
char ssid[64]
Definition: app_conn.h:31
-
char password[64]
Definition: app_conn.h:31
+
Static IP strcuture for configuring AP and WiFi parameters.
Definition: app_conn.h:40
+
IPAddress * ip
Definition: app_conn.h:40
+
IPAddress * dns2
Definition: app_conn.h:40
+
IPAddress * dns1
Definition: app_conn.h:40
+
IPAddress * gateway
Definition: app_conn.h:40
+
IPAddress * netmask
Definition: app_conn.h:40
+
WiFi connectivity details (SSID/password).
Definition: app_conn.h:34
+
bool dhcp
Definition: app_conn.h:34
+
char ssid[64]
Definition: app_conn.h:34
+
char password[64]
Definition: app_conn.h:34