This repository has been archived by the owner on Jan 29, 2023. It is now read-only.
/
ws_common_WiFi_Portenta_H7.hpp
92 lines (68 loc) · 3.2 KB
/
ws_common_WiFi_Portenta_H7.hpp
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
87
88
89
90
91
92
/****************************************************************************************************************************
ws_common_WiFi_Portenta_H7.hpp
For WebSockets2_Generic Library
Based on and modified from Gil Maimon's ArduinoWebsockets library https://github.com/gilmaimon/ArduinoWebsockets
to support STM32F/L/H/G/WB/MP1, nRF52, SAMD21/SAMD51, SAM DUE, Teensy, RP2040 boards besides ESP8266 and ESP32
The library provides simple and easy interface for websockets (Client and Server).
Built by Khoi Hoang https://github.com/khoih-prog/Websockets2_Generic
Licensed under MIT license
Version: 1.10.2
Version Modified By Date Comments
------- ----------- ---------- -----------
1.0.0 K Hoang 14/07/2020 Initial coding/porting to support nRF52 and SAMD21/SAMD51 boards. Add SINRIC/Alexa support
...
1.9.0 K Hoang 30/11/2021 Auto detect ESP32 core version. Fix bug in examples
1.9.1 K Hoang 17/12/2021 Fix QNEthernet TCP interface
1.10.0 K Hoang 18/12/2021 Supporting case-insensitive headers, according to RFC2616
1.10.1 K Hoang 26/02/2022 Reduce QNEthernet latency
1.10.2 K Hoang 14/03/2022 Fix bug when using QNEthernet staticIP. Add staticIP option to NativeEthernet
*****************************************************************************************************************************/
#pragma once
#include <Tiny_Websockets_Generic/ws_config_defs.hpp>
#include <string>
#include <Arduino.h>
namespace websockets2_generic
{
typedef std::string WSString;
typedef String WSInterfaceString;
namespace internals2_generic
{
WSString fromInterfaceString(const WSInterfaceString& str);
WSString fromInterfaceString(const WSInterfaceString&& str);
WSInterfaceString fromInternalString(const WSString& str);
WSInterfaceString fromInternalString(const WSString&& str);
} // namespace internals2_generic
} // namespace websockets 2_generic
// From v1.7.0
#if WEBSOCKETS_USE_PORTENTA_H7_WIFI
#warning Using PORTENTA_H7 WIFI in ws_common_WiFi_Portenta_H7.hpp
#endif
#if ( ( defined(ARDUINO_PORTENTA_H7_M7) || defined(ARDUINO_PORTENTA_H7_M4) ) && defined(ARDUINO_ARCH_MBED) )
#if defined(BOARD_NAME)
#undef BOARD_NAME
#endif
#if defined(CORE_CM7)
#warning Using Portenta H7 M7 core
#define BOARD_NAME "PORTENTA_H7_M7"
#else
#warning Using Portenta H7 M4 core
#define BOARD_NAME "PORTENTA_H7_M4"
#endif
#define USE_WIFI_PORTENTA_H7 true
#define USE_WIFI_NINA false
// To use the default WiFi library here
#define USE_WIFI_CUSTOM false
#else
#error For Portenta_H7 only
#endif
// Using PORTENTA_H7 WIFI
#define PLATFORM_DOES_NOT_SUPPORT_BLOCKING_READ
// KH test for Portenta_H7 WiFi only
//#define _WS_CONFIG_NO_SSL true
#include <Tiny_Websockets_Generic/network/Portenta_H7_WiFi/Portenta_H7_WiFi_tcp.hpp>
#define WSDefaultTcpClient websockets2_generic::network2_generic::WiFiTcpClient
#define WSDefaultTcpServer websockets2_generic::network2_generic::WiFiTcpServer
#ifndef _WS_CONFIG_NO_SSL
// OpenSSL Dependent
#define WSDefaultSecuredTcpClient websockets2_generic::network2_generic::SecuredWiFiTcpClient
#endif //_WS_CONFIG_NO_SSL