compile with esp mqtt lib

This commit is contained in:
technyon
2023-01-27 19:29:13 +01:00
parent 10650c1132
commit c9dbbb5dc1
113 changed files with 9740 additions and 2997 deletions

View File

@@ -0,0 +1,50 @@
#!/bin/bash
# already done by workflow
#pip install -U platformio
#platformio update
#pio pkg install --global --library me-no-dev/AsyncTCP
#pio pkg install --global --library EspAsyncTCP
RED='\033[0;31m'
GREEN='\033[0;32m'
YELLOW='\033[0;33m'
NC='\033[0m'
lines=$(find ./examples/ -maxdepth 1 -mindepth 1 -type d)
retval=0
retvalpart=0
while read line; do
if [[ "$line" != *esp8266 && "$line" != *esp32 && "$line" != *linux ]]; then
echo -e "========================== BUILDING $line =========================="
echo -e "${YELLOW}SKIPPING${NC}"
continue
fi
echo -e "========================== BUILDING $line =========================="
if [[ -e "$line/platformio.ini" ]]; then
output=$(platformio ci --lib="." --project-conf="$line/platformio.ini" $line 2>&1)
retvalpart=$?
else
if [[ "$line" == *esp8266 ]]; then
output=$(platformio ci --lib="." --project-conf="scripts/CI/platformio_esp8266.ini" $line 2>&1)
retvalpart=$?
else
output=$(platformio ci --lib="." --project-conf="scripts/CI/platformio_esp32.ini" $line 2>&1)
retvalpart=$?
fi
:
fi
if [ $retvalpart -ne 0 ]; then
echo "$output"
echo -e "Building $line ${RED}FAILED${NC}"
retval=1
else
echo -e "${GREEN}SUCCESS${NC}"
fi
done <<< "$lines"
# will be deleted together with container
#pio pkg uninstall --global --library me-no-dev/AsyncTCP
#pio pkg uninstall --global --library EspAsyncTCP
exit "$retval"

View File

@@ -0,0 +1,18 @@
; PlatformIO Project Configuration File
;
; Build options: build flags, source filter
; Upload options: custom upload port, speed and extra flags
; Library options: dependencies, extra library storages
; Advanced options: extra scripting
;
; Please visit documentation for the other options and examples
; https://docs.platformio.org/page/projectconf.html
[env:esp32]
platform = espressif32
board = lolin32
framework = arduino
build_flags =
;-Werror
-Wall
-Wextra

View File

@@ -0,0 +1,18 @@
; PlatformIO Project Configuration File
;
; Build options: build flags, source filter
; Upload options: custom upload port, speed and extra flags
; Library options: dependencies, extra library storages
; Advanced options: extra scripting
;
; Please visit documentation for the other options and examples
; https://docs.platformio.org/page/projectconf.html
[env:esp8266]
platform = espressif8266
board = d1_mini
framework = arduino
build_flags =
;-Werror
-Wall
-Wextra

View File

@@ -0,0 +1,30 @@
#!/usr/bin/env python
# https://github.com/marvinroger/async-mqtt-client/blob/develop/scripts/get-fingerprint/get-fingerprint.py
import argparse
import ssl
import hashlib
parser = argparse.ArgumentParser(description='Compute SSL/TLS fingerprints.')
parser.add_argument('--host', required=True)
parser.add_argument('--port', default=8883)
args = parser.parse_args()
print(args.host)
cert_pem = ssl.get_server_certificate((args.host, args.port))
cert_der = ssl.PEM_cert_to_DER_cert(cert_pem)
md5 = hashlib.md5(cert_der).hexdigest()
sha1 = hashlib.sha1(cert_der).hexdigest()
sha256 = hashlib.sha256(cert_der).hexdigest()
print("MD5: " + md5)
print("SHA1: " + sha1)
print("SHA256: " + sha256)
print("\nSHA1 as array initializer:")
print("const uint8_t fingerprint[] = {0x" + ", 0x".join([sha1[i:i+2] for i in range(0, len(sha1), 2)]) + "};")
print("\nSHA1 as function call:")
print("mqttClient.addServerFingerprint((const uint8_t[]){0x" + ", 0x".join([sha1[i:i+2] for i in range(0, len(sha1), 2)]) + "});")