mirror of
https://github.com/0xFEEDC0DE64/arduino-esp32.git
synced 2025-06-25 18:01:33 +02:00
Compare commits
33 Commits
Author | SHA1 | Date | |
---|---|---|---|
3236358ded | |||
82e71f9b50 | |||
2e12392721 | |||
6b0114366b | |||
18832bb418 | |||
97dcea2b99 | |||
dcff2e9774 | |||
6d256b6454 | |||
f6bf0f7aa2 | |||
a59eb5d51e | |||
adafd9d7c0 | |||
ac9fdeffe4 | |||
cee7b4237c | |||
954df2fc3e | |||
e41fb08b2a | |||
d8b1fc81c0 | |||
378b6ac032 | |||
cecef8e930 | |||
a8e99baeab | |||
b6cc108d49 | |||
8816bb5505 | |||
3274602eb0 | |||
534f0810a6 | |||
28a8073069 | |||
7494c4e76d | |||
486a4c66c4 | |||
c1951670d1 | |||
ad07d36932 | |||
c6a8da61f7 | |||
dd1a15478f | |||
bcb7012a32 | |||
3968821834 | |||
90f869e772 |
@ -72,11 +72,11 @@ set(LIBRARY_SRCS
|
||||
libraries/WiFi/src/WiFi.cpp
|
||||
libraries/WiFi/src/WiFiGeneric.cpp
|
||||
libraries/WiFi/src/WiFiMulti.cpp
|
||||
libraries/WiFi/src/WiFiProv.cpp
|
||||
libraries/WiFi/src/WiFiScan.cpp
|
||||
libraries/WiFi/src/WiFiServer.cpp
|
||||
libraries/WiFi/src/WiFiSTA.cpp
|
||||
libraries/WiFi/src/WiFiUdp.cpp
|
||||
libraries/WiFiProv/src/WiFiProv.cpp
|
||||
libraries/Wire/src/Wire.cpp
|
||||
)
|
||||
|
||||
@ -202,6 +202,7 @@ set(COMPONENT_ADD_INCLUDEDIRS
|
||||
libraries/WebServer/src
|
||||
libraries/WiFiClientSecure/src
|
||||
libraries/WiFi/src
|
||||
libraries/WiFiProv/src
|
||||
libraries/Wire/src
|
||||
)
|
||||
|
||||
|
@ -14,7 +14,7 @@
|
||||
|
||||
Latest Stable Release [](https://github.com/espressif/arduino-esp32/releases/latest/) [](https://github.com/espressif/arduino-esp32/releases/latest/) [](https://github.com/espressif/arduino-esp32/releases/latest/)
|
||||
|
||||
Latest Development Release [](https://github.com/espressif/arduino-esp32/releases/latest/) [](https://github.com/espressif/arduino-esp32/releases/latest/) [](https://github.com/espressif/arduino-esp32/releases/latest/)
|
||||
Latest Development Release [](https://github.com/espressif/arduino-esp32/releases/latest/) [](https://github.com/espressif/arduino-esp32/releases/latest/) [](https://github.com/espressif/arduino-esp32/releases/latest/)
|
||||
|
||||
|
||||
### Installation Instructions
|
||||
|
155
boards.txt
155
boards.txt
@ -2826,6 +2826,161 @@ m5stack-core2.menu.DebugLevel.verbose.build.code_debug=5
|
||||
|
||||
##############################################################
|
||||
|
||||
m5stack-timer-cam.name=M5Stack-Timer-CAM
|
||||
|
||||
m5stack-timer-cam.upload.tool=esptool_py
|
||||
m5stack-timer-cam.upload.maximum_size=1310720
|
||||
m5stack-timer-cam.upload.maximum_data_size=327680
|
||||
m5stack-timer-cam.upload.wait_for_upload_port=true
|
||||
|
||||
m5stack-timer-cam.serial.disableDTR=true
|
||||
m5stack-timer-cam.serial.disableRTS=true
|
||||
|
||||
m5stack-timer-cam.build.mcu=esp32
|
||||
m5stack-timer-cam.build.core=esp32
|
||||
m5stack-timer-cam.build.variant=m5stack_timer_cam
|
||||
m5stack-timer-cam.build.board=M5Stack-Timer-CAM
|
||||
|
||||
m5stack-timer-cam.build.f_cpu=240000000L
|
||||
m5stack-timer-cam.build.flash_size=4MB
|
||||
m5stack-timer-cam.build.flash_freq=80m
|
||||
m5stack-timer-cam.build.flash_mode=dio
|
||||
m5stack-timer-cam.build.boot=dio
|
||||
m5stack-timer-cam.build.partitions=default
|
||||
m5stack-timer-cam.build.defines=
|
||||
|
||||
m5stack-timer-cam.menu.PSRAM.enabled=Enabled
|
||||
m5stack-timer-cam.menu.PSRAM.enabled.build.defines=-DBOARD_HAS_PSRAM -mfix-esp32-psram-cache-issue
|
||||
m5stack-timer-cam.menu.PSRAM.disabled=Disabled
|
||||
m5stack-timer-cam.menu.PSRAM.disabled.build.defines=
|
||||
|
||||
m5stack-timer-cam.menu.PartitionScheme.default=Default(3MB No OTA/1MB SPIFFS)
|
||||
m5stack-timer-cam.menu.PartitionScheme.default.build.partitions=huge_app
|
||||
m5stack-timer-cam.menu.PartitionScheme.default.upload.maximum_size=3145728
|
||||
|
||||
m5stack-timer-cam.menu.PartitionScheme.no_ota=No OTA (Large APP)
|
||||
m5stack-timer-cam.menu.PartitionScheme.no_ota.build.partitions=no_ota
|
||||
m5stack-timer-cam.menu.PartitionScheme.no_ota.upload.maximum_size=2097152
|
||||
|
||||
m5stack-timer-cam.menu.PartitionScheme.min_spiffs=Minimal SPIFFS (Large APPS with OTA)
|
||||
m5stack-timer-cam.menu.PartitionScheme.min_spiffs.build.partitions=min_spiffs
|
||||
m5stack-timer-cam.menu.PartitionScheme.min_spiffs.upload.maximum_size=1966080
|
||||
|
||||
m5stack-timer-cam.menu.PartitionScheme.no_ota=No OTA (2MB APP/2MB SPIFFS)
|
||||
m5stack-timer-cam.menu.PartitionScheme.no_ota.build.partitions=no_ota
|
||||
m5stack-timer-cam.menu.PartitionScheme.no_ota.upload.maximum_size=2097152
|
||||
|
||||
m5stack-timer-cam.menu.PartitionScheme.min_spiffs=Minimal SPIFFS (1.9MB APP with OTA/190KB SPIFFS)
|
||||
m5stack-timer-cam.menu.PartitionScheme.min_spiffs.build.partitions=min_spiffs
|
||||
m5stack-timer-cam.menu.PartitionScheme.min_spiffs.upload.maximum_size=1966080
|
||||
|
||||
m5stack-timer-cam.menu.CPUFreq.240=240MHz (WiFi/BT)
|
||||
m5stack-timer-cam.menu.CPUFreq.240.build.f_cpu=240000000L
|
||||
m5stack-timer-cam.menu.CPUFreq.160=160MHz (WiFi/BT)
|
||||
m5stack-timer-cam.menu.CPUFreq.160.build.f_cpu=160000000L
|
||||
m5stack-timer-cam.menu.CPUFreq.80=80MHz (WiFi/BT)
|
||||
m5stack-timer-cam.menu.CPUFreq.80.build.f_cpu=80000000L
|
||||
m5stack-timer-cam.menu.CPUFreq.40=40MHz (40MHz XTAL)
|
||||
m5stack-timer-cam.menu.CPUFreq.40.build.f_cpu=40000000L
|
||||
m5stack-timer-cam.menu.CPUFreq.26=26MHz (26MHz XTAL)
|
||||
m5stack-timer-cam.menu.CPUFreq.26.build.f_cpu=26000000L
|
||||
m5stack-timer-cam.menu.CPUFreq.20=20MHz (40MHz XTAL)
|
||||
m5stack-timer-cam.menu.CPUFreq.20.build.f_cpu=20000000L
|
||||
m5stack-timer-cam.menu.CPUFreq.13=13MHz (26MHz XTAL)
|
||||
m5stack-timer-cam.menu.CPUFreq.13.build.f_cpu=13000000L
|
||||
m5stack-timer-cam.menu.CPUFreq.10=10MHz (40MHz XTAL)
|
||||
m5stack-timer-cam.menu.CPUFreq.10.build.f_cpu=10000000L
|
||||
|
||||
m5stack-timer-cam.menu.UploadSpeed.1500000=1500000
|
||||
m5stack-timer-cam.menu.UploadSpeed.1500000.upload.speed=1500000
|
||||
m5stack-timer-cam.menu.UploadSpeed.750000=750000
|
||||
m5stack-timer-cam.menu.UploadSpeed.750000.upload.speed=750000
|
||||
m5stack-timer-cam.menu.UploadSpeed.500000=500000
|
||||
m5stack-timer-cam.menu.UploadSpeed.500000.upload.speed=500000
|
||||
m5stack-timer-cam.menu.UploadSpeed.250000=250000
|
||||
m5stack-timer-cam.menu.UploadSpeed.250000.upload.speed=250000
|
||||
m5stack-timer-cam.menu.UploadSpeed.115200=115200
|
||||
m5stack-timer-cam.menu.UploadSpeed.115200.upload.speed=115200
|
||||
|
||||
m5stack-timer-cam.menu.DebugLevel.none=None
|
||||
m5stack-timer-cam.menu.DebugLevel.none.build.code_debug=0
|
||||
m5stack-timer-cam.menu.DebugLevel.error=Error
|
||||
m5stack-timer-cam.menu.DebugLevel.error.build.code_debug=1
|
||||
m5stack-timer-cam.menu.DebugLevel.warn=Warn
|
||||
m5stack-timer-cam.menu.DebugLevel.warn.build.code_debug=2
|
||||
m5stack-timer-cam.menu.DebugLevel.info=Info
|
||||
m5stack-timer-cam.menu.DebugLevel.info.build.code_debug=3
|
||||
m5stack-timer-cam.menu.DebugLevel.debug=Debug
|
||||
m5stack-timer-cam.menu.DebugLevel.debug.build.code_debug=4
|
||||
m5stack-timer-cam.menu.DebugLevel.verbose=Verbose
|
||||
m5stack-timer-cam.menu.DebugLevel.verbose.build.code_debug=5
|
||||
|
||||
##############################################################
|
||||
|
||||
m5stack-coreink.name=M5Stack-CoreInk
|
||||
|
||||
m5stack-coreink.upload.tool=esptool_py
|
||||
m5stack-coreink.upload.maximum_size=1310720
|
||||
m5stack-coreink.upload.maximum_data_size=327680
|
||||
m5stack-coreink.upload.wait_for_upload_port=true
|
||||
|
||||
m5stack-coreink.serial.disableDTR=true
|
||||
m5stack-coreink.serial.disableRTS=true
|
||||
|
||||
m5stack-coreink.build.mcu=esp32
|
||||
m5stack-coreink.build.core=esp32
|
||||
m5stack-coreink.build.variant=m5stack_coreink
|
||||
m5stack-coreink.build.board=M5Stack_CoreInk
|
||||
|
||||
m5stack-coreink.build.f_cpu=240000000L
|
||||
m5stack-coreink.build.flash_size=4MB
|
||||
m5stack-coreink.build.flash_freq=80m
|
||||
m5stack-coreink.build.flash_mode=dio
|
||||
m5stack-coreink.build.boot=dio
|
||||
m5stack-coreink.build.partitions=default
|
||||
m5stack-coreink.build.defines=
|
||||
|
||||
m5stack-coreink.menu.PartitionScheme.default=Default
|
||||
m5stack-coreink.menu.PartitionScheme.default.build.partitions=default
|
||||
m5stack-coreink.menu.PartitionScheme.no_ota=No OTA (Large APP)
|
||||
m5stack-coreink.menu.PartitionScheme.no_ota.build.partitions=no_ota
|
||||
m5stack-coreink.menu.PartitionScheme.no_ota.upload.maximum_size=2097152
|
||||
m5stack-coreink.menu.PartitionScheme.min_spiffs=Minimal SPIFFS (Large APPS with OTA)
|
||||
m5stack-coreink.menu.PartitionScheme.min_spiffs.build.partitions=min_spiffs
|
||||
m5stack-coreink.menu.PartitionScheme.min_spiffs.upload.maximum_size=1966080
|
||||
|
||||
m5stack-coreink.menu.UploadSpeed.921600=921600
|
||||
m5stack-coreink.menu.UploadSpeed.921600.upload.speed=921600
|
||||
m5stack-coreink.menu.UploadSpeed.115200=115200
|
||||
m5stack-coreink.menu.UploadSpeed.115200.upload.speed=115200
|
||||
m5stack-coreink.menu.UploadSpeed.256000.windows=256000
|
||||
m5stack-coreink.menu.UploadSpeed.256000.upload.speed=256000
|
||||
m5stack-coreink.menu.UploadSpeed.230400.windows.upload.speed=256000
|
||||
m5stack-coreink.menu.UploadSpeed.230400=230400
|
||||
m5stack-coreink.menu.UploadSpeed.230400.upload.speed=230400
|
||||
m5stack-coreink.menu.UploadSpeed.460800.linux=460800
|
||||
m5stack-coreink.menu.UploadSpeed.460800.macosx=460800
|
||||
m5stack-coreink.menu.UploadSpeed.460800.upload.speed=460800
|
||||
m5stack-coreink.menu.UploadSpeed.512000.windows=512000
|
||||
m5stack-coreink.menu.UploadSpeed.512000.upload.speed=512000
|
||||
m5stack-coreink.menu.UploadSpeed.1500000=1500000
|
||||
m5stack-coreink.menu.UploadSpeed.1500000.upload.speed=1500000
|
||||
|
||||
m5stack-coreink.menu.DebugLevel.none=None
|
||||
m5stack-coreink.menu.DebugLevel.none.build.code_debug=0
|
||||
m5stack-coreink.menu.DebugLevel.error=Error
|
||||
m5stack-coreink.menu.DebugLevel.error.build.code_debug=1
|
||||
m5stack-coreink.menu.DebugLevel.warn=Warn
|
||||
m5stack-coreink.menu.DebugLevel.warn.build.code_debug=2
|
||||
m5stack-coreink.menu.DebugLevel.info=Info
|
||||
m5stack-coreink.menu.DebugLevel.info.build.code_debug=3
|
||||
m5stack-coreink.menu.DebugLevel.debug=Debug
|
||||
m5stack-coreink.menu.DebugLevel.debug.build.code_debug=4
|
||||
m5stack-coreink.menu.DebugLevel.verbose=Verbose
|
||||
m5stack-coreink.menu.DebugLevel.verbose.build.code_debug=5
|
||||
|
||||
##############################################################
|
||||
|
||||
odroid_esp32.name=ODROID ESP32
|
||||
|
||||
odroid_esp32.upload.tool=esptool_py
|
||||
|
@ -88,7 +88,7 @@
|
||||
#define bitRead(value, bit) (((value) >> (bit)) & 0x01)
|
||||
#define bitSet(value, bit) ((value) |= (1UL << (bit)))
|
||||
#define bitClear(value, bit) ((value) &= ~(1UL << (bit)))
|
||||
#define bitWrite(value, bit, bitvalue) (bitvalue ? bitSet(value, bit) : bitClear(value, bit))
|
||||
#define bitWrite(value, bit, bitvalue) ((bitvalue) ? bitSet(value, bit) : bitClear(value, bit))
|
||||
|
||||
// avr-libc defines _NOP() since 1.6.2
|
||||
#ifndef _NOP
|
||||
|
@ -53,6 +53,8 @@ typedef unsigned long prog_uint32_t;
|
||||
*(void * const *)(_addr); \
|
||||
})
|
||||
|
||||
#define pgm_get_far_address(x) ((uint32_t)(&(x)))
|
||||
|
||||
#define pgm_read_byte_near(addr) pgm_read_byte(addr)
|
||||
#define pgm_read_word_near(addr) pgm_read_word(addr)
|
||||
#define pgm_read_dword_near(addr) pgm_read_dword(addr)
|
||||
|
@ -194,6 +194,7 @@ BLECharacteristic* BLEHIDDevice::protocolMode() {
|
||||
|
||||
void BLEHIDDevice::setBatteryLevel(uint8_t level) {
|
||||
m_batteryLevelCharacteristic->setValue(&level, 1);
|
||||
m_batteryLevelCharacteristic->notify();
|
||||
}
|
||||
/*
|
||||
* @brief Returns battery level characteristic
|
||||
|
@ -135,6 +135,21 @@ size_t F_Fat::totalBytes()
|
||||
return tot_sect * sect_size;
|
||||
}
|
||||
|
||||
size_t F_Fat::usedBytes()
|
||||
{
|
||||
FATFS *fs;
|
||||
DWORD free_clust, used_sect, sect_size;
|
||||
|
||||
BYTE pdrv = ff_diskio_get_pdrv_wl(_wl_handle);
|
||||
char drv[3] = {(char)(48+pdrv), ':', 0};
|
||||
if ( f_getfree(drv, &free_clust, &fs) != FR_OK){
|
||||
return 0;
|
||||
}
|
||||
used_sect = (fs->n_fatent - 2 - free_clust) * fs->csize;
|
||||
sect_size = CONFIG_WL_SECTOR_SIZE;
|
||||
return used_sect * sect_size;
|
||||
}
|
||||
|
||||
size_t F_Fat::freeBytes()
|
||||
{
|
||||
|
||||
|
@ -31,6 +31,7 @@ public:
|
||||
bool begin(bool formatOnFail=false, const char * basePath="/ffat", uint8_t maxOpenFiles=10, const char * partitionLabel = (char*)FFAT_PARTITION_LABEL);
|
||||
bool format(bool full_wipe = FFAT_WIPE_QUICK, char* partitionLabel = (char*)FFAT_PARTITION_LABEL);
|
||||
size_t totalBytes();
|
||||
size_t usedBytes();
|
||||
size_t freeBytes();
|
||||
void end();
|
||||
bool exists(const char* path);
|
||||
|
@ -583,7 +583,7 @@ int HTTPClient::sendRequest(const char * type, uint8_t * payload, size_t size)
|
||||
}
|
||||
|
||||
code = handleHeaderResponse();
|
||||
Serial.printf("sendRequest code=%d\n", code);
|
||||
log_d("sendRequest code=%d\n", code);
|
||||
|
||||
// Handle redirections as stated in RFC document:
|
||||
// https://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html
|
||||
@ -1199,6 +1199,7 @@ int HTTPClient::handleHeaderResponse()
|
||||
log_v("RX: '%s'", headerLine.c_str());
|
||||
|
||||
if(firstLine) {
|
||||
firstLine = false;
|
||||
if(_canReuse && headerLine.startsWith("HTTP/1.")) {
|
||||
_canReuse = (headerLine[sizeof "HTTP/1." - 1] != '0');
|
||||
}
|
||||
|
@ -607,8 +607,9 @@ DRESULT ff_sd_write(uint8_t pdrv, const uint8_t* buffer, DWORD sector, UINT coun
|
||||
|
||||
if (count > 1) {
|
||||
res = sdWriteSectors(pdrv, (const char*)buffer, sector, count) ? RES_OK : RES_ERROR;
|
||||
} else {
|
||||
res = sdWriteSector(pdrv, (const char*)buffer, sector) ? RES_OK : RES_ERROR;
|
||||
}
|
||||
res = sdWriteSector(pdrv, (const char*)buffer, sector) ? RES_OK : RES_ERROR;
|
||||
return res;
|
||||
}
|
||||
|
||||
|
@ -85,7 +85,7 @@ void SPIClass::setHwCs(bool use)
|
||||
if(use && !_use_hw_ss) {
|
||||
spiAttachSS(_spi, 0, _ss);
|
||||
spiSSEnable(_spi);
|
||||
} else if(_use_hw_ss) {
|
||||
} else if(!use && _use_hw_ss) {
|
||||
spiSSDisable(_spi);
|
||||
spiDetachSS(_spi, _ss);
|
||||
}
|
||||
|
@ -313,11 +313,12 @@ void WebServer::handleClient() {
|
||||
_contentLength = CONTENT_LENGTH_NOT_SET;
|
||||
_handleRequest();
|
||||
|
||||
if (_currentClient.connected()) {
|
||||
_currentStatus = HC_WAIT_CLOSE;
|
||||
_statusChange = millis();
|
||||
keepCurrentClient = true;
|
||||
}
|
||||
// Fix for issue with Chrome based browsers: https://github.com/espressif/arduino-esp32/issues/3652
|
||||
// if (_currentClient.connected()) {
|
||||
// _currentStatus = HC_WAIT_CLOSE;
|
||||
// _statusChange = millis();
|
||||
// keepCurrentClient = true;
|
||||
// }
|
||||
}
|
||||
} else { // !_currentClient.available()
|
||||
if (millis() - _statusChange <= HTTP_MAX_DATA_WAIT) {
|
||||
|
@ -88,4 +88,14 @@ void WiFiClass::printDiag(Print& p)
|
||||
p.println(conf.sta.bssid_set);
|
||||
}
|
||||
|
||||
void WiFiClass::enableProv(bool status)
|
||||
{
|
||||
prov_enable = status;
|
||||
}
|
||||
|
||||
bool WiFiClass::isProvEnabled()
|
||||
{
|
||||
return prov_enable;
|
||||
}
|
||||
|
||||
WiFiClass WiFi;
|
||||
|
@ -37,11 +37,17 @@
|
||||
#include "WiFiClient.h"
|
||||
#include "WiFiServer.h"
|
||||
#include "WiFiUdp.h"
|
||||
#include "WiFiProv.h"
|
||||
|
||||
class WiFiClass : public WiFiGenericClass, public WiFiSTAClass, public WiFiScanClass, public WiFiAPClass, public WiFiProvClass
|
||||
class WiFiClass : public WiFiGenericClass, public WiFiSTAClass, public WiFiScanClass, public WiFiAPClass
|
||||
{
|
||||
private:
|
||||
bool prov_enable;
|
||||
public:
|
||||
WiFiClass()
|
||||
{
|
||||
prov_enable = false;
|
||||
}
|
||||
|
||||
using WiFiGenericClass::channel;
|
||||
|
||||
using WiFiSTAClass::SSID;
|
||||
@ -60,6 +66,8 @@ public:
|
||||
friend class WiFiClient;
|
||||
friend class WiFiServer;
|
||||
friend class WiFiUDP;
|
||||
void enableProv(bool status);
|
||||
bool isProvEnabled();
|
||||
};
|
||||
|
||||
extern WiFiClass WiFi;
|
||||
|
@ -216,9 +216,9 @@ int WiFiClient::connect(IPAddress ip, uint16_t port, int32_t timeout)
|
||||
|
||||
uint32_t ip_addr = ip;
|
||||
struct sockaddr_in serveraddr;
|
||||
bzero((char *) &serveraddr, sizeof(serveraddr));
|
||||
memset((char *) &serveraddr, 0, sizeof(serveraddr));
|
||||
serveraddr.sin_family = AF_INET;
|
||||
bcopy((const void *)(&ip_addr), (void *)&serveraddr.sin_addr.s_addr, 4);
|
||||
memcpy((void *)&serveraddr.sin_addr.s_addr, (const void *)(&ip_addr), 4);
|
||||
serveraddr.sin_port = htons(port);
|
||||
fd_set fdset;
|
||||
struct timeval tv;
|
||||
|
@ -63,6 +63,10 @@ WiFiClient WiFiServer::available(){
|
||||
}
|
||||
|
||||
void WiFiServer::begin(uint16_t port){
|
||||
begin(port, 1);
|
||||
}
|
||||
|
||||
void WiFiServer::begin(uint16_t port, int enable){
|
||||
if(_listening)
|
||||
return;
|
||||
if(port){
|
||||
@ -72,6 +76,7 @@ void WiFiServer::begin(uint16_t port){
|
||||
sockfd = socket(AF_INET , SOCK_STREAM, 0);
|
||||
if (sockfd < 0)
|
||||
return;
|
||||
setsockopt(sockfd, SOL_SOCKET, SO_REUSEADDR, &enable, sizeof(int));
|
||||
server.sin_family = AF_INET;
|
||||
server.sin_addr.s_addr = INADDR_ANY;
|
||||
server.sin_port = htons(_port);
|
||||
|
@ -40,6 +40,7 @@ class WiFiServer : public Server {
|
||||
WiFiClient available();
|
||||
WiFiClient accept(){return available();}
|
||||
void begin(uint16_t port=0);
|
||||
void begin(uint16_t port, int reuse_enable);
|
||||
void setNoDelay(bool nodelay);
|
||||
bool getNoDelay();
|
||||
bool hasClient();
|
||||
|
@ -227,7 +227,7 @@ int start_ssl_client(sslclient_context *ssl_client, const char *host, uint32_t p
|
||||
log_v("Verifying peer X.509 certificate...");
|
||||
|
||||
if ((flags = mbedtls_ssl_get_verify_result(&ssl_client->ssl_ctx)) != 0) {
|
||||
bzero(buf, sizeof(buf));
|
||||
memset(buf, 0, sizeof(buf));
|
||||
mbedtls_x509_crt_verify_info(buf, sizeof(buf), " ! ", flags);
|
||||
log_e("Failed to verify peer certificate! verification info: %s", buf);
|
||||
stop_ssl_socket(ssl_client, rootCABuff, cli_cert, cli_key); //It's not safe continue.
|
||||
|
@ -1,4 +1,4 @@
|
||||
#include "WiFi.h"
|
||||
#include "WiFiProv.h"
|
||||
void SysProvEvent(system_event_t *sys_event,wifi_prov_event_t *prov_event)
|
||||
{
|
||||
if(sys_event) {
|
||||
@ -56,8 +56,8 @@ void setup() {
|
||||
/* uint8_t uuid[16] = {0xb4, 0xdf, 0x5a, 0x1c, 0x3f, 0x6b, 0xf4, 0xbf,
|
||||
0xea, 0x4a, 0x82, 0x03, 0x04, 0x90, 0x1a, 0x02 };*/
|
||||
WiFi.onEvent(SysProvEvent);
|
||||
//WiFi.beginProvision(provSchemeBLE, WIFI_PROV_SCHEME_BLE_EVENT_HANDLER_FREE_BTDM, WIFI_PROV_SECURITY_1, "abcd1234", "PROV_XXX", NULL, NULL);
|
||||
WiFi.beginProvision(provSchemeSoftAP, WIFI_PROV_EVENT_HANDLER_NONE, WIFI_PROV_SECURITY_1, "abcd1234", NULL, NULL, NULL);
|
||||
//WiFiProv.beginProvision(provSchemeBLE, WIFI_PROV_SCHEME_BLE_EVENT_HANDLER_FREE_BTDM, WIFI_PROV_SECURITY_1, "abcd1234", "PROV_XXX", NULL, NULL);
|
||||
WiFiProv.beginProvision(provSchemeSoftAP, WIFI_PROV_EVENT_HANDLER_NONE, WIFI_PROV_SECURITY_1, "abcd1234", NULL, NULL, NULL);
|
||||
}
|
||||
|
||||
void loop() {
|
9
libraries/WiFiProv/library.properties
Normal file
9
libraries/WiFiProv/library.properties
Normal file
@ -0,0 +1,9 @@
|
||||
name=WiFiProv
|
||||
version=1.0
|
||||
author=Switi Mhaiske <sweetymhaiske@gmail.com>
|
||||
maintainer=Hristo Gochkov <hristo@espressif.com>
|
||||
sentence=Enables provisioning.
|
||||
paragraph=With this library you can perform provisioning on esp32 via SoftAP or BLE.
|
||||
category=Communication
|
||||
url=
|
||||
architectures=esp32
|
@ -31,23 +31,18 @@
|
||||
#include <wifi_provisioning/scheme_softap.h>
|
||||
#include <wifi_provisioning/manager.h>
|
||||
#undef IPADDR_NONE
|
||||
#include "WiFi.h"
|
||||
#include "WiFiProv.h"
|
||||
#include "SimpleBLE.h"
|
||||
|
||||
wifi_prov_mgr_config_t config;
|
||||
scheme_t prov_scheme;
|
||||
extern esp_err_t postToSysQueue(system_prov_event_t *);
|
||||
|
||||
static wifi_prov_mgr_config_t config;
|
||||
static scheme_t prov_scheme;
|
||||
static const uint8_t custom_service_uuid[16] = { 0xb4, 0xdf, 0x5a, 0x1c, 0x3f, 0x6b, 0xf4, 0xbf,
|
||||
0xea, 0x4a, 0x82, 0x03, 0x04, 0x90, 0x1a, 0x02, };
|
||||
|
||||
#define SERV_NAME_PREFIX_PROV "PROV_"
|
||||
|
||||
bool WiFiProvClass::prov_enable = true;
|
||||
|
||||
bool WiFiProvClass::isProvEnabled()
|
||||
{
|
||||
return prov_enable;
|
||||
}
|
||||
|
||||
void provSchemeBLE()
|
||||
{
|
||||
prov_scheme = WIFI_PROV_SCHEME_BLE;
|
||||
@ -108,7 +103,7 @@ static void get_device_service_name(char *service_name, size_t max)
|
||||
|
||||
void WiFiProvClass :: beginProvision(void (*scheme_cb)(), wifi_prov_event_handler_t scheme_event_handler, wifi_prov_security_t security, const char * pop, const char *service_name, const char *service_key, uint8_t * uuid)
|
||||
{
|
||||
prov_enable = true;
|
||||
WiFi.enableProv(true);
|
||||
bool provisioned = false;
|
||||
scheme_cb();
|
||||
config.scheme_event_handler = scheme_event_handler;
|
||||
@ -151,7 +146,7 @@ void WiFiProvClass :: beginProvision(void (*scheme_cb)(), wifi_prov_event_handle
|
||||
} else {
|
||||
wifi_prov_mgr_deinit();
|
||||
WiFi.mode(WIFI_MODE_STA);
|
||||
log_i("Aleardy Provisioned, starting Wi-Fi STA");
|
||||
log_i("Already Provisioned, starting Wi-Fi STA");
|
||||
#if ARDUHAL_LOG_LEVEL >= ARDUHAL_LOG_LEVEL_INFO
|
||||
wifi_config_t conf;
|
||||
esp_wifi_get_config(WIFI_IF_STA,&conf);
|
||||
@ -161,4 +156,4 @@ void WiFiProvClass :: beginProvision(void (*scheme_cb)(), wifi_prov_event_handle
|
||||
WiFi.begin();
|
||||
}
|
||||
}
|
||||
|
||||
WiFiProvClass WiFiProv;
|
@ -17,10 +17,9 @@
|
||||
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
#include "WiFi.h"
|
||||
#include "wifi_provisioning/manager.h"
|
||||
#include "wifi_provisioning/scheme_ble.h"
|
||||
#include "nvs_flash.h"
|
||||
#include "SimpleBLE.h"
|
||||
//Select the scheme using which you want to provision
|
||||
typedef enum
|
||||
{
|
||||
@ -34,19 +33,11 @@ extern void provSchemeBLE();
|
||||
//Provisioning class
|
||||
class WiFiProvClass
|
||||
{
|
||||
protected:
|
||||
static bool prov_enable;
|
||||
|
||||
public:
|
||||
WiFiProvClass() {
|
||||
prov_enable = false;
|
||||
}
|
||||
|
||||
bool isProvEnabled();
|
||||
|
||||
void beginProvision(void (*scheme_cb)() = provSchemeSoftAP, wifi_prov_event_handler_t scheme_event_handler = WIFI_PROV_EVENT_HANDLER_NONE, wifi_prov_security_t security = WIFI_PROV_SECURITY_1, const char * pop = "abcd1234", const char * service_name = NULL, const char * service_key = NULL, uint8_t *uuid = NULL);
|
||||
void beginProvision(void (*scheme_cb)() = provSchemeSoftAP, wifi_prov_event_handler_t scheme_event_handler = WIFI_PROV_EVENT_HANDLER_NONE, wifi_prov_security_t security = WIFI_PROV_SECURITY_1, const char * pop = "abcd1234", const char * service_name = NULL, const char * service_key = NULL, uint8_t *uuid = NULL);
|
||||
};
|
||||
|
||||
extern WiFiProvClass WiFiProv;
|
||||
/*
|
||||
Event Handler for BLE
|
||||
- WIFI_PROV_SCHEME_BLE_EVENT_HANDLER_FREE_BTDM
|
@ -41,7 +41,7 @@
|
||||
{
|
||||
"packager": "esp32",
|
||||
"name": "esptool_py",
|
||||
"version": "2.6.1"
|
||||
"version": "3.0.0"
|
||||
},
|
||||
{
|
||||
"packager": "esp32",
|
||||
@ -102,49 +102,49 @@
|
||||
},
|
||||
{
|
||||
"name": "esptool_py",
|
||||
"version": "2.6.1",
|
||||
"version": "3.0.0",
|
||||
"systems": [
|
||||
{
|
||||
"host": "i686-mingw32",
|
||||
"url": "https://dl.espressif.com/dl/esptool-2.6.1-windows.zip",
|
||||
"archiveFileName": "esptool-2.6.1-windows.zip",
|
||||
"checksum": "SHA-256:84cf0b369a7707fe566434faba148852fc464992111d5baa95b658b374802f96",
|
||||
"size": "3422445"
|
||||
"url": "https://dl.espressif.com/dl/esptool-3.0.0.2-windows.zip",
|
||||
"archiveFileName": "esptool-3.0.0.2-windows.zip",
|
||||
"checksum": "SHA-256:b192bfc1545a3c92658ce586b4edcc2aca3f0ad4b3fa8417d658bc8a48f1387e",
|
||||
"size": "3434736"
|
||||
},
|
||||
{
|
||||
"host": "x86_64-apple-darwin",
|
||||
"url": "https://dl.espressif.com/dl/esptool-2.6.1-macos.tar.gz",
|
||||
"archiveFileName": "esptool-2.6.1-macos.tar.gz",
|
||||
"checksum": "SHA-256:f4eb758a301d6902cc9dfcd49d36345d2f075ad123da7cf8132d15cfb7533457",
|
||||
"size": "3837085"
|
||||
"url": "https://dl.espressif.com/dl/esptool-3.0.0.2-macos.tar.gz",
|
||||
"archiveFileName": "esptool-3.0.0.2-macos.tar.gz",
|
||||
"checksum": "SHA-256:9213f46d5aa865558da4a2ef4218e87eef4782779128083c15ce2b3e4d07a1ea",
|
||||
"size": "3849615"
|
||||
},
|
||||
{
|
||||
"host": "x86_64-pc-linux-gnu",
|
||||
"url": "https://dl.espressif.com/dl/esptool-2.6.1-linux.tar.gz",
|
||||
"archiveFileName": "esptool-2.6.1-linux.tar.gz",
|
||||
"checksum": "SHA-256:eaf82ff4070d9792f6a42ae1e485375de5a87bec59ef01dfb95de901519ec7fb",
|
||||
"size": "44762"
|
||||
"url": "https://dl.espressif.com/dl/esptool-3.0.0.2-linux.tar.gz",
|
||||
"archiveFileName": "esptool-3.0.0.2-linux.tar.gz",
|
||||
"checksum": "SHA-256:d5cb51da1c74ff69f81b820470d2ecccb5c7c3a2dec7776483d4c89588b00020",
|
||||
"size": "57526"
|
||||
},
|
||||
{
|
||||
"host": "i686-pc-linux-gnu",
|
||||
"url": "https://dl.espressif.com/dl/esptool-2.6.1-linux.tar.gz",
|
||||
"archiveFileName": "esptool-2.6.1-linux.tar.gz",
|
||||
"checksum": "SHA-256:eaf82ff4070d9792f6a42ae1e485375de5a87bec59ef01dfb95de901519ec7fb",
|
||||
"size": "44762"
|
||||
"url": "https://dl.espressif.com/dl/esptool-3.0.0.2-linux.tar.gz",
|
||||
"archiveFileName": "esptool-3.0.0.2-linux.tar.gz",
|
||||
"checksum": "SHA-256:d5cb51da1c74ff69f81b820470d2ecccb5c7c3a2dec7776483d4c89588b00020",
|
||||
"size": "57526"
|
||||
},
|
||||
{
|
||||
"host": "arm-linux-gnueabihf",
|
||||
"url": "https://dl.espressif.com/dl/esptool-2.6.1-linux.tar.gz",
|
||||
"archiveFileName": "esptool-2.6.1-linux.tar.gz",
|
||||
"checksum": "SHA-256:eaf82ff4070d9792f6a42ae1e485375de5a87bec59ef01dfb95de901519ec7fb",
|
||||
"size": "44762"
|
||||
"url": "https://dl.espressif.com/dl/esptool-3.0.0.2-linux.tar.gz",
|
||||
"archiveFileName": "esptool-3.0.0.2-linux.tar.gz",
|
||||
"checksum": "SHA-256:d5cb51da1c74ff69f81b820470d2ecccb5c7c3a2dec7776483d4c89588b00020",
|
||||
"size": "57526"
|
||||
},
|
||||
{
|
||||
"host": "aarch64-linux-gnu",
|
||||
"url": "https://dl.espressif.com/dl/esptool-2.6.1-linux.tar.gz",
|
||||
"archiveFileName": "esptool-2.6.1-linux.tar.gz",
|
||||
"checksum": "SHA-256:eaf82ff4070d9792f6a42ae1e485375de5a87bec59ef01dfb95de901519ec7fb",
|
||||
"size": "44762"
|
||||
"url": "https://dl.espressif.com/dl/esptool-3.0.0.2-linux.tar.gz",
|
||||
"archiveFileName": "esptool-3.0.0.2-linux.tar.gz",
|
||||
"checksum": "SHA-256:d5cb51da1c74ff69f81b820470d2ecccb5c7c3a2dec7776483d4c89588b00020",
|
||||
"size": "57526"
|
||||
}
|
||||
]
|
||||
},
|
||||
|
@ -194,16 +194,20 @@ if not env.BoardConfig().get("build.ldscript", ""):
|
||||
|
||||
libs = []
|
||||
|
||||
variants_dir = join(FRAMEWORK_DIR, "variants")
|
||||
|
||||
if "build.variants_dir" in env.BoardConfig():
|
||||
variants_dir = join("$PROJECT_DIR", env.BoardConfig().get("build.variants_dir"))
|
||||
|
||||
if "build.variant" in env.BoardConfig():
|
||||
env.Append(
|
||||
CPPPATH=[
|
||||
join(FRAMEWORK_DIR, "variants",
|
||||
env.BoardConfig().get("build.variant"))
|
||||
join(variants_dir, env.BoardConfig().get("build.variant"))
|
||||
]
|
||||
)
|
||||
libs.append(env.BuildLibrary(
|
||||
join("$BUILD_DIR", "FrameworkArduinoVariant"),
|
||||
join(FRAMEWORK_DIR, "variants", env.BoardConfig().get("build.variant"))
|
||||
join(variants_dir, env.BoardConfig().get("build.variant"))
|
||||
))
|
||||
|
||||
envsafe = env.Clone()
|
||||
|
Binary file not shown.
@ -87,6 +87,7 @@
|
||||
#define CONFIG_MFN56_1X 1
|
||||
#define CONFIG_LWIP_MAX_SOCKETS 10
|
||||
#define CONFIG_LWIP_NETIF_LOOPBACK 1
|
||||
#define CONFIG_LWIP_TCP_ISN_HOOK 1
|
||||
#define CONFIG_ESP32_PTHREAD_TASK_NAME_DEFAULT "pthread"
|
||||
#define CONFIG_EMAC_TASK_PRIORITY 20
|
||||
#define CONFIG_TIMER_TASK_STACK_DEPTH 2048
|
||||
@ -244,7 +245,6 @@
|
||||
#define CONFIG_SPIFFS_GC_MAX_RUNS 10
|
||||
#define CONFIG_ARDUINO_RUN_CORE1 1
|
||||
#define CONFIG_ESP32_APPTRACE_DEST_NONE 1
|
||||
#define CONFIG_ESP32_WIFI_RX_IRAM_OPT 1
|
||||
#define CONFIG_HP_NANO1 1
|
||||
#define CONFIG_MBEDTLS_INTERNAL_MEM_ALLOC 1
|
||||
#define CONFIG_MBEDTLS_SSL_PROTO_TLS1_2 1
|
||||
@ -392,7 +392,6 @@
|
||||
#define CONFIG_HD_NANO1 1
|
||||
#define CONFIG_BTDM_MODEM_SLEEP_MODE_ORIG 1
|
||||
#define CONFIG_ARDUHAL_LOG_DEFAULT_LEVEL_ERROR 1
|
||||
#define CONFIG_ESP32_WIFI_IRAM_OPT 1
|
||||
#define CONFIG_FATFS_API_ENCODING_ANSI_OEM 1
|
||||
#define CONFIG_ARDUINO_IDF_COMMIT "66d3783c8"
|
||||
#define CONFIG_ARDUINO_IDF_COMMIT "c33fc7821"
|
||||
#define CONFIG_ARDUINO_IDF_BRANCH "release/v3.3"
|
||||
|
@ -263,6 +263,16 @@ esp_err_t esp_mesh_set_announce_interval(int short_ms, int long_ms);
|
||||
*/
|
||||
esp_err_t esp_mesh_get_announce_interval(int *short_ms, int *long_ms);
|
||||
|
||||
/**
|
||||
* @brief Enable mesh print scan result
|
||||
*
|
||||
* @param[in] enable enable or not
|
||||
*
|
||||
* @return
|
||||
* - ESP_OK
|
||||
*/
|
||||
esp_err_t esp_mesh_print_scan_result(bool enable);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
@ -20,6 +20,7 @@ extern "C"
|
||||
#ifndef __ASSEMBLER__
|
||||
|
||||
#include "esp_err.h"
|
||||
#include "soc/soc.h"
|
||||
|
||||
|
||||
/**
|
||||
@ -61,12 +62,36 @@ esp_err_t esp_set_watchpoint(int no, void *adr, int size, int flags);
|
||||
*/
|
||||
void esp_clear_watchpoint(int no);
|
||||
|
||||
/**
|
||||
* @brief Checks stack pointer in dram
|
||||
*/
|
||||
inline static bool esp_stack_ptr_in_dram(uint32_t sp)
|
||||
{
|
||||
//Check if stack ptr is in between SOC_DRAM_LOW and SOC_DRAM_HIGH, and 16 byte aligned.
|
||||
return !(sp < SOC_DRAM_LOW + 0x10 || sp > SOC_DRAM_HIGH - 0x10 || ((sp & 0xF) != 0));
|
||||
}
|
||||
|
||||
#if CONFIG_SPIRAM_ALLOW_STACK_EXTERNAL_MEMORY
|
||||
/**
|
||||
* @brief Checks stack pointer in external ram
|
||||
*/
|
||||
inline static bool esp_stack_ptr_in_extram(uint32_t sp)
|
||||
{
|
||||
//Check if stack ptr is in between SOC_EXTRAM_DATA_LOW and SOC_EXTRAM_DATA_HIGH, and 16 byte aligned.
|
||||
return !(sp < SOC_EXTRAM_DATA_LOW + 0x10 || sp > SOC_EXTRAM_DATA_HIGH - 0x10 || ((sp & 0xF) != 0));
|
||||
}
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @brief Checks stack pointer
|
||||
*/
|
||||
static inline bool esp_stack_ptr_is_sane(uint32_t sp)
|
||||
{
|
||||
return !(sp < 0x3ffae010UL || sp > 0x3ffffff0UL || ((sp & 0xf) != 0));
|
||||
#if CONFIG_SPIRAM_ALLOW_STACK_EXTERNAL_MEMORY
|
||||
return (esp_stack_ptr_in_dram(sp) || esp_stack_ptr_in_extram(sp));
|
||||
#else
|
||||
return esp_stack_ptr_in_dram(sp);
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
|
||||
|
@ -396,6 +396,17 @@
|
||||
*/
|
||||
#define LWIP_TCP_RTO_TIME CONFIG_LWIP_TCP_RTO_TIME
|
||||
|
||||
/**
|
||||
* Set TCP hook for Initial Sequence Number (ISN)
|
||||
*/
|
||||
#ifdef CONFIG_LWIP_TCP_ISN_HOOK
|
||||
#include <lwip/arch.h>
|
||||
struct ip_addr;
|
||||
u32_t lwip_hook_tcp_isn(const struct ip_addr *local_ip, u16_t local_port,
|
||||
const struct ip_addr *remote_ip, u16_t remote_port);
|
||||
#define LWIP_HOOK_TCP_ISN lwip_hook_tcp_isn
|
||||
#endif
|
||||
|
||||
/*
|
||||
----------------------------------
|
||||
---------- Pbuf options ----------
|
||||
|
@ -32,9 +32,17 @@
|
||||
|
||||
#include "lwip/netdb.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#ifdef ESP_PLATFORM
|
||||
int getnameinfo(const struct sockaddr *addr, socklen_t addrlen,
|
||||
char *host, socklen_t hostlen,
|
||||
char *serv, socklen_t servlen, int flags);
|
||||
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
48
tools/sdk/include/lwip/tcp_isn.h
Normal file
48
tools/sdk/include/lwip/tcp_isn.h
Normal file
@ -0,0 +1,48 @@
|
||||
/*
|
||||
* Copyright (c) 2016 The MINIX 3 Project.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification,
|
||||
* are permitted provided that the following conditions are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright notice,
|
||||
* this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright notice,
|
||||
* this list of conditions and the following disclaimer in the documentation
|
||||
* and/or other materials provided with the distribution.
|
||||
* 3. The name of the author may not be used to endorse or promote products
|
||||
* derived from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
|
||||
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT
|
||||
* SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
|
||||
* OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
|
||||
* IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
|
||||
* OF SUCH DAMAGE.
|
||||
*
|
||||
* Author: David van Moolenbroek <david@minix3.org>
|
||||
*/
|
||||
|
||||
#ifndef LWIP_TCP_ISN_H
|
||||
#define LWIP_TCP_ISN_H
|
||||
|
||||
#include "lwip/opt.h"
|
||||
#include "lwip/ip_addr.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
void lwip_init_tcp_isn(u32_t boot_time, const u8_t *secret_16_bytes);
|
||||
u32_t lwip_hook_tcp_isn(const ip_addr_t *local_ip, u16_t local_port,
|
||||
const ip_addr_t *remote_ip, u16_t remote_port);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* LWIP_TCP_ISN_H */
|
@ -80,10 +80,17 @@ typedef enum {
|
||||
*/
|
||||
typedef enum {
|
||||
MQTT_ERROR_TYPE_NONE = 0,
|
||||
MQTT_ERROR_TYPE_ESP_TLS,
|
||||
MQTT_ERROR_TYPE_TCP_TRANSPORT,
|
||||
MQTT_ERROR_TYPE_CONNECTION_REFUSED,
|
||||
} esp_mqtt_error_type_t;
|
||||
|
||||
/**
|
||||
* MQTT_ERROR_TYPE_TCP_TRANSPORT error type hold all sorts of transport layer errors,
|
||||
* including ESP-TLS error, but in the past only the errors from MQTT_ERROR_TYPE_ESP_TLS layer
|
||||
* were reported, so the ESP-TLS error type is re-defined here for backward compatibility
|
||||
*/
|
||||
#define MQTT_ERROR_TYPE_ESP_TLS MQTT_ERROR_TYPE_TCP_TRANSPORT
|
||||
|
||||
typedef enum {
|
||||
MQTT_TRANSPORT_UNKNOWN = 0x0,
|
||||
MQTT_TRANSPORT_OVER_TCP, /*!< MQTT over TCP, using scheme: ``mqtt`` */
|
||||
@ -110,7 +117,7 @@ typedef enum {
|
||||
* Use this structure directly checking error_type first and then appropriate error code depending on the source of the error:
|
||||
*
|
||||
* | error_type | related member variables | note |
|
||||
* | MQTT_ERROR_TYPE_ESP_TLS | esp_tls_last_esp_err, esp_tls_stack_err, esp_tls_cert_verify_flags | Error reported from esp-tls |
|
||||
* | MQTT_ERROR_TYPE_TCP_TRANSPORT | esp_tls_last_esp_err, esp_tls_stack_err, esp_tls_cert_verify_flags, sock_errno | Error reported from tcp_transport/esp-tls |
|
||||
* | MQTT_ERROR_TYPE_CONNECTION_REFUSED | connect_return_code | Internal error reported from MQTT broker on connection |
|
||||
*/
|
||||
typedef struct esp_mqtt_error_codes {
|
||||
@ -121,6 +128,9 @@ typedef struct esp_mqtt_error_codes {
|
||||
/* esp-mqtt specific structure extension */
|
||||
esp_mqtt_error_type_t error_type; /*!< error type referring to the source of the error */
|
||||
esp_mqtt_connect_return_code_t connect_return_code; /*!< connection refused error code reported from MQTT broker on connection */
|
||||
/* tcp_transport extension */
|
||||
int esp_transport_sock_errno; /*!< errno from the underlying socket */
|
||||
|
||||
} esp_mqtt_error_codes_t;
|
||||
|
||||
/**
|
||||
@ -179,7 +189,7 @@ typedef struct {
|
||||
int refresh_connection_after_ms; /*!< Refresh connection after this value (in milliseconds) */
|
||||
const struct psk_key_hint* psk_hint_key; /*!< Pointer to PSK struct defined in esp_tls.h to enable PSK authentication (as alternative to certificate verification). If not NULL and server/client certificates are NULL, PSK is enabled */
|
||||
bool use_global_ca_store; /*!< Use a global ca_store for all the connections in which this bool is set. */
|
||||
int reconnect_timeout_ms; /*!< Reconnect to the broker after this value in miliseconds if auto reconnect is not disabled */
|
||||
int reconnect_timeout_ms; /*!< Reconnect to the broker after this value in miliseconds if auto reconnect is not disabled (defaults to 10s) */
|
||||
const char **alpn_protos; /*!< NULL-terminated list of supported application protocols to be used for ALPN */
|
||||
const char *clientkey_password; /*!< Client key decryption password string */
|
||||
int clientkey_password_len; /*!< String length of the password pointed to by clientkey_password */
|
||||
@ -188,6 +198,8 @@ typedef struct {
|
||||
bool skip_cert_common_name_check; /*!< Skip any validation of server certificate CN field, this reduces the security of TLS and makes the mqtt client susceptible to MITM attacks */
|
||||
bool use_secure_element; /*!< enable secure element for enabling SSL connection */
|
||||
void *ds_data; /*!< carrier of handle for digital signature parameters */
|
||||
int network_timeout_ms; /*!< Abort network operation if it is not completed after this value, in milliseconds (defaults to 10s) */
|
||||
bool disable_keepalive; /*!< Set disable_keepalive=true to turn off keep-alive mechanism, false by default (keepalive is active by default). Note: setting the config value `keepalive` to `0` doesn't disable keepalive feature, but uses a default keepalive period */
|
||||
} esp_mqtt_client_config_t;
|
||||
|
||||
/**
|
||||
@ -347,6 +359,14 @@ esp_err_t esp_mqtt_set_config(esp_mqtt_client_handle_t client, const esp_mqtt_cl
|
||||
*/
|
||||
esp_err_t esp_mqtt_client_register_event(esp_mqtt_client_handle_t client, esp_mqtt_event_id_t event, esp_event_handler_t event_handler, void* event_handler_arg);
|
||||
|
||||
/**
|
||||
* @brief Get outbox size
|
||||
*
|
||||
* @param client mqtt client handle
|
||||
* @return outbox size
|
||||
*/
|
||||
int esp_mqtt_client_get_outbox_size(esp_mqtt_client_handle_t client);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif //__cplusplus
|
||||
|
@ -84,8 +84,8 @@
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_OUTBOX_EXPIRED_TIMEOUT_MS
|
||||
#define OUTBOX_EXPIRED_TIMEOUT_MS CONFIG_OUTBOX_EXPIRED_TIMEOUT_MS
|
||||
#ifdef CONFIG_MQTT_OUTBOX_EXPIRED_TIMEOUT_MS
|
||||
#define OUTBOX_EXPIRED_TIMEOUT_MS CONFIG_MQTT_OUTBOX_EXPIRED_TIMEOUT_MS
|
||||
#else
|
||||
#define OUTBOX_EXPIRED_TIMEOUT_MS (30*1000)
|
||||
#endif
|
||||
|
@ -56,6 +56,7 @@
|
||||
#if ESP_IDF_VERSION >= ESP_IDF_VERSION_VAL(4, 3, 0)
|
||||
// Features supported in 4.3
|
||||
#define MQTT_SUPPORTED_FEATURE_DIGITAL_SIGNATURE
|
||||
#define MQTT_SUPPORTED_FEATURE_TRANSPORT_SOCK_ERRNO_REPORTING
|
||||
#endif
|
||||
|
||||
#endif /* ESP_IDF_VERSION */
|
||||
|
File diff suppressed because one or more lines are too long
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user