mirror of
https://github.com/aaronleetw/savage-tracking.git
synced 2024-11-14 19:11:39 -08:00
updated arduino case and code
This commit is contained in:
parent
6d5b60e3b5
commit
e02db95f55
10 changed files with 744099 additions and 774131 deletions
|
@ -3,10 +3,13 @@
|
||||||
#include <LiquidCrystal_I2C.h>
|
#include <LiquidCrystal_I2C.h>
|
||||||
#include <Arduino.h>
|
#include <Arduino.h>
|
||||||
#include <ESP8266WiFi.h>
|
#include <ESP8266WiFi.h>
|
||||||
#include <WiFiClient.h>
|
#include <ESP8266WiFiMulti.h>
|
||||||
|
#include <WiFiClientSecureBearSSL.h>
|
||||||
#include <ESP8266HTTPClient.h>
|
#include <ESP8266HTTPClient.h>
|
||||||
#include <ArduinoJson.h>
|
#include <ArduinoJson.h>
|
||||||
|
|
||||||
|
#include "cert.h"
|
||||||
|
|
||||||
LiquidCrystal_I2C lcd(0x27, 16, 2); // set the LCD address to 0x27 for a 16 chars and 2 line display
|
LiquidCrystal_I2C lcd(0x27, 16, 2); // set the LCD address to 0x27 for a 16 chars and 2 line display
|
||||||
|
|
||||||
#define SS_PIN D8
|
#define SS_PIN D8
|
||||||
|
@ -15,13 +18,15 @@ LiquidCrystal_I2C lcd(0x27, 16, 2); // set the LCD address to 0x27 for a 16 cha
|
||||||
|
|
||||||
#define WIFI_SSID "SEA"
|
#define WIFI_SSID "SEA"
|
||||||
#define WIFI_PASS "sara9914"
|
#define WIFI_PASS "sara9914"
|
||||||
#define RECURL "http://192.168.0.11:5000/api/rfid"
|
#define RECURL "tracking.aarontech.xyz/api/rfid"
|
||||||
#define KEY "secret"
|
#define KEY "5fbda4564acb0d49f260707a"
|
||||||
|
|
||||||
MFRC522 rfid(SS_PIN, RST_PIN); // Instance of the class
|
MFRC522 rfid(SS_PIN, RST_PIN); // Instance of the class
|
||||||
|
|
||||||
bool processingReq = false;
|
bool processingReq = false;
|
||||||
WiFiClient wifiClient;
|
ESP8266WiFiMulti wifi;
|
||||||
|
|
||||||
|
X509List cert (cert_ISRG_Root_X1);
|
||||||
|
|
||||||
int cursorPos = 0;
|
int cursorPos = 0;
|
||||||
|
|
||||||
|
@ -76,9 +81,12 @@ void loop() {
|
||||||
serializeJson(body, bodych);
|
serializeJson(body, bodych);
|
||||||
Serial.println(bodych);
|
Serial.println(bodych);
|
||||||
|
|
||||||
|
WiFiClientSecure wifiClient;
|
||||||
|
wifiClient.setTrustAnchors(&cert);
|
||||||
|
|
||||||
HTTPClient httpClient;
|
HTTPClient httpClient;
|
||||||
httpClient.useHTTP10(true);
|
httpClient.useHTTP10(true);
|
||||||
httpClient.begin(wifiClient, RECURL);
|
httpClient.begin(wifiClient, RECURL, 443);
|
||||||
httpClient.addHeader("Content-Type", "application/json");
|
httpClient.addHeader("Content-Type", "application/json");
|
||||||
Serial.print("RECURL: ");
|
Serial.print("RECURL: ");
|
||||||
Serial.println(RECURL);
|
Serial.println(RECURL);
|
||||||
|
@ -168,5 +176,21 @@ void connectWifi() {
|
||||||
lcd.print(".");
|
lcd.print(".");
|
||||||
delay(500);
|
delay(500);
|
||||||
}
|
}
|
||||||
|
configTime(8 * 3600, 0, "pool.ntp.org", "time.nist.gov");
|
||||||
|
|
||||||
|
Serial.print("Waiting for NTP time sync: ");
|
||||||
|
time_t now = time(nullptr);
|
||||||
|
while (now < 8 * 3600 * 2) {
|
||||||
|
delay(500);
|
||||||
|
Serial.print(".");
|
||||||
|
now = time(nullptr);
|
||||||
|
}
|
||||||
|
|
||||||
|
Serial.println("");
|
||||||
|
struct tm timeinfo;
|
||||||
|
gmtime_r(&now, &timeinfo);
|
||||||
|
Serial.print("Current time: ");
|
||||||
|
Serial.print(asctime(&timeinfo));
|
||||||
|
|
||||||
lcdOut("WiFi OK!");
|
lcdOut("WiFi OK!");
|
||||||
}
|
}
|
99
arduino/SavageTracker/cert.h
Normal file
99
arduino/SavageTracker/cert.h
Normal file
|
@ -0,0 +1,99 @@
|
||||||
|
// this file is autogenerated - any modification will be overwritten
|
||||||
|
// unused symbols will not be linked in the final binary
|
||||||
|
// generated on 2024-01-06 15:37:58
|
||||||
|
// by ['cert.py', '-s', 'tracking.aarontech.xyz', '-p', '443']
|
||||||
|
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////
|
||||||
|
// certificate chain for tracking.aarontech.xyz:443
|
||||||
|
|
||||||
|
// CN: tracking.aarontech.xyz => name: tracking_aarontech_xyz
|
||||||
|
// not valid before: 2024-01-01 08:41:48
|
||||||
|
// not valid after: 2024-03-31 08:41:47
|
||||||
|
const char fingerprint_tracking_aarontech_xyz [] PROGMEM = "4c:1c:44:5d:4d:98:82:0f:ad:a4:66:84:af:a7:ee:7e:a5:e4:f9:b0";
|
||||||
|
const char pubkey_tracking_aarontech_xyz [] PROGMEM = R"PUBKEY(
|
||||||
|
-----BEGIN PUBLIC KEY-----
|
||||||
|
MFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAEsWEKsBIJFjOM9UQJlogEnrcSMESk
|
||||||
|
YEFvGJAcDcIiyvLoEwPgq8OvMS8BnR77RdlF4xI2w3srIXkc6u9lgv1kHg==
|
||||||
|
-----END PUBLIC KEY-----
|
||||||
|
)PUBKEY";
|
||||||
|
|
||||||
|
// http://r3.i.lencr.org/
|
||||||
|
// CN: R3 => name: R3
|
||||||
|
// not valid before: 2020-09-04 00:00:00
|
||||||
|
// not valid after: 2025-09-15 16:00:00
|
||||||
|
const char cert_R3 [] PROGMEM = R"CERT(
|
||||||
|
-----BEGIN CERTIFICATE-----
|
||||||
|
MIIFFjCCAv6gAwIBAgIRAJErCErPDBinU/bWLiWnX1owDQYJKoZIhvcNAQELBQAw
|
||||||
|
TzELMAkGA1UEBhMCVVMxKTAnBgNVBAoTIEludGVybmV0IFNlY3VyaXR5IFJlc2Vh
|
||||||
|
cmNoIEdyb3VwMRUwEwYDVQQDEwxJU1JHIFJvb3QgWDEwHhcNMjAwOTA0MDAwMDAw
|
||||||
|
WhcNMjUwOTE1MTYwMDAwWjAyMQswCQYDVQQGEwJVU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ikfmZW4/RvTZ8M6UK+5UzhK8jCdLuMGYL6KvzXGRSgi3yLgjewQtCPkIVz6D2QQz
|
||||||
|
CkcheAmCJ8MqyJu5zlzyZMjAvnnAT45tRAxekrsu94sQ4egdRCnbWSDtY7kh+BIm
|
||||||
|
lJNXoB1lBMEKIq4QDUOXoRgffuDghje1WrG9ML+Hbisq/yFOGwXD9RiX8F6sw6W4
|
||||||
|
avAuvDszue5L3sz85K+EC4Y/wFVDNvZo4TYXao6Z0f+lQKc0t8DQYzk1OXVu8rp2
|
||||||
|
yJMC6alLbBfODALZvYH7n7do1AZls4I9d1P4jnkDrQoxB3UqQ9hVl3LEKQ73xF1O
|
||||||
|
yK5GhDDX8oVfGKF5u+decIsH4YaTw7mP3GFxJSqv3+0lUFJoi5Lc5da149p90Ids
|
||||||
|
hCExroL1+7mryIkXPeFM5TgO9r0rvZaBFOvV2z0gp35Z0+L4WPlbuEjN/lxPFin+
|
||||||
|
HlUjr8gRsI3qfJOQFy/9rKIJR0Y/8Omwt/8oTWgy1mdeHmmjk7j1nYsvC9JSQ6Zv
|
||||||
|
MldlTTKB3zhThV1+XWYp6rjd5JW1zbVWEkLNxE7GJThEUG3szgBVGP7pSWTUTsqX
|
||||||
|
nLRbwHOoq7hHwg==
|
||||||
|
-----END CERTIFICATE-----
|
||||||
|
)CERT";
|
||||||
|
|
||||||
|
// http://x1.i.lencr.org/
|
||||||
|
// CN: ISRG Root X1 => name: ISRG_Root_X1
|
||||||
|
// not valid before: 2015-06-04 11:04:38
|
||||||
|
// not valid after: 2035-06-04 11:04:38
|
||||||
|
const char cert_ISRG_Root_X1 [] PROGMEM = R"CERT(
|
||||||
|
-----BEGIN CERTIFICATE-----
|
||||||
|
MIIFazCCA1OgAwIBAgIRAIIQz7DSQONZRGPgu2OCiwAwDQYJKoZIhvcNAQELBQAw
|
||||||
|
TzELMAkGA1UEBhMCVVMxKTAnBgNVBAoTIEludGVybmV0IFNlY3VyaXR5IFJlc2Vh
|
||||||
|
cm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GA1UdDwEB/wQEAwIBBjAPBgNV
|
||||||
|
HRMBAf8EBTADAQH/MB0GA1UdDgQWBBR5tFnme7bl5AFzgAiIyBpY9umbbjANBgkq
|
||||||
|
hkiG9w0BAQsFAAOCAgEAVR9YqbyyqFDQDLHYGmkgJykIrGF1XIpu+ILlaS/V9lZL
|
||||||
|
ubhzEFnTIZd+50xx+7LSYK05qAvqFyFWhfFQDlnrzuBZ6brJFe+GnY+EgPbk6ZGQ
|
||||||
|
3BebYhtF8GaV0nxvwuo77x/Py9auJ/GpsMiu/X1+mvoiBOv/2X/qkSsisRcOj/KK
|
||||||
|
NFtY2PwByVS5uCbMiogziUwthDyC3+6WVwW6LLv3xLfHTjuCvjHIInNzktHCgKQ5
|
||||||
|
ORAzI4JMPJ+GslWYHb4phowim57iaztXOoJwTdwJx4nLCgdNbOhdjsnvzqvHu7Ur
|
||||||
|
TkXWStAmzOVyyghqpZXjFaH3pO3JLF+l+/+sKAIuvtd7u+Nxe5AW0wdeRlN8NwdC
|
||||||
|
jNPElpzVmbUq4JUagEiuTDkHzsxHpFKVK7q4+63SM1N95R1NbdWhscdCb+ZAJzVc
|
||||||
|
oyi3B43njTOQ5yOf+1CceWxG1bQVs5ZufpsMljq4Ui0/1lvh+wjChP4kqKOJ2qxq
|
||||||
|
4RgqsahDYVvTH9w7jXbyLeiNdd8XM2w9U/t7y0Ff/9yi0GE44Za4rF2LN9d11TPA
|
||||||
|
mRGunUHBcnWEvgJBQl9nJEiU0Zsnvgc/ubhPgXRR4Xq37Z0j4r7g1SgEEzwxA57d
|
||||||
|
emyPxgcYxn/eR44/KJ4EBs+lVDR3veyJm+kXQ99b21/+jh5Xos1AnX5iItreGCc=
|
||||||
|
-----END CERTIFICATE-----
|
||||||
|
)CERT";
|
||||||
|
|
||||||
|
|
||||||
|
// end of certificate chain for tracking.aarontech.xyz:443
|
||||||
|
////////////////////////////////////////////////////////////
|
File diff suppressed because it is too large
Load diff
Binary file not shown.
Binary file not shown.
Binary file not shown.
File diff suppressed because it is too large
Load diff
Binary file not shown.
Binary file not shown.
Binary file not shown.
Loading…
Reference in a new issue