|
1 | 1 | /**************************************************************************************************************************** |
2 | | - Credentials.h for ESP32_GSM.ino |
3 | | - For ESP32 boards to run GSM/GPRS and WiFi simultaneously, using config portal feature |
4 | | -
|
5 | | - Library to enable GSM/GPRS and WiFi running simultaneously , with WiFi config portal. |
6 | | - Forked from Blynk library v0.6.1 https://github.com/blynkkk/blynk-library/releases |
7 | | - Built by Khoi Hoang https://github.com/khoih-prog/BlynkGSM_ESPManager |
8 | | - Licensed under MIT license |
9 | | - Version: 1.0.9 |
| 2 | + Credentials.h |
| 3 | + For ESP32 TTGO-TCALL boards to run GSM/GPRS and WiFi simultaneously, using config portal feature |
| 4 | + Uploading SHT3x temperature and humidity data to Blynk |
| 5 | + |
| 6 | + Library to enable GSM/GPRS and WiFi running simultaneously , with WiFi config portal. |
| 7 | + Based on and modified from Blynk library v0.6.1 https://github.com/blynkkk/blynk-library/releases |
| 8 | + Built by Khoi Hoang https://github.com/khoih-prog/BlynkGSM_Manager |
| 9 | + Licensed under MIT license |
| 10 | + Version: 1.0.10 |
10 | 11 |
|
11 | | - Version Modified By Date Comments |
12 | | - ------- ----------- ---------- ----------- |
13 | | - 1.0.0 K Hoang 17/01/2020 Initial coding. Add config portal similar to Blynk_WM library. |
14 | | - 1.0.1 K Hoang 27/01/2020 Change Synch XMLHttpRequest to Async (https://xhr.spec.whatwg.org/). Reduce code size |
15 | | - 1.0.2 K Hoang 08/02/2020 Enable GSM/GPRS and WiFi running simultaneously |
16 | | - 1.0.3 K Hoang 18/02/2020 Add checksum. Add clearConfigData() |
17 | | - 1.0.4 K Hoang 14/03/2020 Enhance Config Portal GUI. Reduce code size. |
18 | | - 1.0.5 K Hoang 20/03/2020 Add more modem supports. See the list in README.md |
19 | | - 1.0.6 K Hoang 07/04/2020 Enable adding dynamic custom parameters from sketch |
20 | | - 1.0.7 K Hoang 09/04/2020 SSID password maxlen is 63 now. Permit special chars # and % in input data. |
21 | | - 1.0.8 K Hoang 14/04/2020 Fix bug. |
22 | | - 1.0.9 K Hoang 31/05/2020 Update to use LittleFS for ESP8266 core 2.7.1+. Add Configurable Config Portal Title, |
23 | | - Default Config Data and DRD. Add MultiWiFi/Blynk features for WiFi and GPRS/GSM |
| 12 | + Version Modified By Date Comments |
| 13 | + ------- ----------- ---------- ----------- |
| 14 | + 1.0.0 K Hoang 17/01/2020 Initial coding. Add config portal similar to Blynk_WM library. |
| 15 | + 1.0.1 K Hoang 27/01/2020 Change Synch XMLHttpRequest to Async (https://xhr.spec.whatwg.org/). Reduce code size |
| 16 | + 1.0.2 K Hoang 08/02/2020 Enable GSM/GPRS and WiFi running simultaneously |
| 17 | + 1.0.3 K Hoang 18/02/2020 Add checksum. Add clearConfigData() |
| 18 | + 1.0.4 K Hoang 14/03/2020 Enhance Config Portal GUI. Reduce code size. |
| 19 | + 1.0.5 K Hoang 20/03/2020 Add more modem supports. See the list in README.md |
| 20 | + 1.0.6 K Hoang 07/04/2020 Enable adding dynamic custom parameters from sketch |
| 21 | + 1.0.7 K Hoang 09/04/2020 SSID password maxlen is 63 now. Permit special chars # and % in input data. |
| 22 | + 1.0.8 K Hoang 14/04/2020 Fix bug. |
| 23 | + 1.0.9 K Hoang 31/05/2020 Update to use LittleFS for ESP8266 core 2.7.1+. Add Configurable Config Portal Title, |
| 24 | + Default Config Data and DRD. Add MultiWiFi/Blynk features for WiFi and GPRS/GSM |
| 25 | + 1.0.10 K Hoang 26/08/2020 Use MultiWiFi. Auto format SPIFFS/LittleFS for first time usage. |
| 26 | + Fix bug and logic of USE_DEFAULT_CONFIG_DATA. |
24 | 27 | *****************************************************************************************************************************/ |
25 | 28 |
|
26 | 29 | #ifndef Credentials_h |
27 | 30 | #define Credentials_h |
28 | 31 |
|
29 | | -/// Start Default Config Data ////////////////// |
30 | | - |
31 | | -/* |
32 | | - // Defined in <BlynkSimpleESP8266_GSM_WFM.h> |
| 32 | +#if USE_BLYNK_WM |
33 | 33 |
|
34 | | - #define SSID_MAX_LEN 32 |
35 | | - //From v1.0.10, WPA2 passwords can be up to 63 characters long. |
36 | | - #define PASS_MAX_LEN 64 |
| 34 | + /// Start Default Config Data ////////////////// |
37 | 35 |
|
38 | | - typedef struct |
39 | | - { |
40 | | - char wifi_ssid[SSID_MAX_LEN]; |
41 | | - char wifi_pw [PASS_MAX_LEN]; |
42 | | - } WiFi_Credentials; |
43 | | - |
44 | | - #define BLYNK_SERVER_MAX_LEN 32 |
45 | | - #define BLYNK_TOKEN_MAX_LEN 36 |
| 36 | + /* |
| 37 | + // Defined in <BlynkSimpleESP8266_GSM_WFM.h> |
46 | 38 | |
47 | | - typedef struct |
48 | | - { |
49 | | - char blynk_server [BLYNK_SERVER_MAX_LEN]; |
50 | | - char wifi_blynk_token [BLYNK_TOKEN_MAX_LEN]; |
51 | | - char gsm_blynk_token [BLYNK_TOKEN_MAX_LEN]; |
52 | | - } Blynk_Credentials; |
| 39 | + #define SSID_MAX_LEN 32 |
| 40 | + //From v1.0.10, WPA2 passwords can be up to 63 characters long. |
| 41 | + #define PASS_MAX_LEN 64 |
| 42 | + |
| 43 | + typedef struct |
| 44 | + { |
| 45 | + char wifi_ssid[SSID_MAX_LEN]; |
| 46 | + char wifi_pw [PASS_MAX_LEN]; |
| 47 | + } WiFi_Credentials; |
| 48 | + |
| 49 | + #define BLYNK_SERVER_MAX_LEN 32 |
| 50 | + #define BLYNK_TOKEN_MAX_LEN 36 |
| 51 | + |
| 52 | + typedef struct |
| 53 | + { |
| 54 | + char blynk_server [BLYNK_SERVER_MAX_LEN]; |
| 55 | + char wifi_blynk_token [BLYNK_TOKEN_MAX_LEN]; |
| 56 | + char gsm_blynk_token [BLYNK_TOKEN_MAX_LEN]; |
| 57 | + } Blynk_Credentials; |
| 58 | + |
| 59 | + #define NUM_WIFI_CREDENTIALS 2 |
| 60 | + #define NUM_BLYNK_CREDENTIALS 2 |
| 61 | + |
| 62 | + // Configurable items besides fixed Header |
| 63 | + #define NUM_CONFIGURABLE_ITEMS ( 6 + (2 * NUM_WIFI_CREDENTIALS) + (3 * NUM_BLYNK_CREDENTIALS) ) |
| 64 | + #define DEFAULT_GPRS_PIN "1234" |
| 65 | + |
| 66 | + typedef struct Configuration |
| 67 | + { |
| 68 | + char header [16]; |
| 69 | + WiFi_Credentials WiFi_Creds [NUM_WIFI_CREDENTIALS]; |
| 70 | + Blynk_Credentials Blynk_Creds [NUM_BLYNK_CREDENTIALS]; |
| 71 | + int blynk_port; |
| 72 | + // YOUR GSM / GPRS RELATED |
| 73 | + char apn [32]; |
| 74 | + char gprsUser [32]; |
| 75 | + char gprsPass [32]; |
| 76 | + char gprsPin [12]; // A PIN (Personal Identification Number) is a 4-8 digit passcode |
| 77 | + // END OF YOUR GSM / GPRS RELATED |
| 78 | + char board_name [24]; |
| 79 | + int checkSum; |
| 80 | + } Blynk_WF_Configuration; |
53 | 81 | |
54 | | - #define NUM_WIFI_CREDENTIALS 2 |
55 | | - #define NUM_BLYNK_CREDENTIALS 2 |
| 82 | + */ |
56 | 83 |
|
57 | | - // Configurable items besides fixed Header |
58 | | - #define NUM_CONFIGURABLE_ITEMS ( 6 + (2 * NUM_WIFI_CREDENTIALS) + (3 * NUM_BLYNK_CREDENTIALS) ) |
59 | | - #define DEFAULT_GPRS_PIN "1234" |
| 84 | + //bool LOAD_DEFAULT_CONFIG_DATA = true; |
| 85 | + bool LOAD_DEFAULT_CONFIG_DATA = false; |
60 | 86 |
|
61 | | - typedef struct Configuration |
| 87 | + Blynk_WF_Configuration defaultConfig = |
62 | 88 | { |
63 | | - char header [16]; |
64 | | - WiFi_Credentials WiFi_Creds [NUM_WIFI_CREDENTIALS]; |
65 | | - Blynk_Credentials Blynk_Creds [NUM_BLYNK_CREDENTIALS]; |
66 | | - int blynk_port; |
| 89 | + //char header[16], dummy, not used |
| 90 | + "GSM", |
| 91 | + //WiFi_Credentials WiFi_Creds [NUM_WIFI_CREDENTIALS] |
| 92 | + //WiFi_Creds.wifi_ssid and WiFi_Creds.wifi_pw |
| 93 | + "SSID1", "password1", |
| 94 | + "SSID2", "password2", |
| 95 | + // Blynk_Credentials Blynk_Creds [NUM_BLYNK_CREDENTIALS]; |
| 96 | + // Blynk_Creds.blynk_server, Blynk_Creds.wifi_blynk_token and Blynk_Creds.gsm_blynk_token |
| 97 | + "account.ddns.net", "wifi_token", "gsm_token", |
| 98 | + "account.duckdns.org", "wifi_token1", "gsm_token1", |
| 99 | + //int blynk_port; |
| 100 | + 8080, |
67 | 101 | // YOUR GSM / GPRS RELATED |
68 | | - char apn [32]; |
69 | | - char gprsUser [32]; |
70 | | - char gprsPass [32]; |
71 | | - char gprsPin [12]; // A PIN (Personal Identification Number) is a 4-8 digit passcode |
72 | | - // END OF YOUR GSM / GPRS RELATED |
73 | | - char board_name [24]; |
74 | | - int checkSum; |
75 | | - } Blynk_WF_Configuration; |
76 | | -
|
77 | | -*/ |
78 | | - |
79 | | -bool LOAD_DEFAULT_CONFIG_DATA = true; |
80 | | -//bool LOAD_DEFAULT_CONFIG_DATA = false; |
81 | | - |
82 | | -Blynk_WF_Configuration defaultConfig = |
83 | | -{ |
84 | | - //char header[16], dummy, not used |
85 | | - "GSM", |
86 | | - //WiFi_Credentials WiFi_Creds [NUM_WIFI_CREDENTIALS] |
87 | | - //WiFi_Creds.wifi_ssid and WiFi_Creds.wifi_pw |
88 | | - "SSID1", "password1", |
89 | | - "SSID2", "password2", |
90 | | - // Blynk_Credentials Blynk_Creds [NUM_BLYNK_CREDENTIALS]; |
91 | | - // Blynk_Creds.blynk_server, Blynk_Creds.wifi_blynk_token and Blynk_Creds.gsm_blynk_token |
92 | | - "account.ddns.net", "wifi_token", "gsm_token", |
93 | | - "account.duckdns.org", "wifi_token1", "gsm_token1", |
94 | | - //int blynk_port; |
95 | | - 8080, |
96 | | - // YOUR GSM / GPRS RELATED |
97 | | - //char apn [32]; |
98 | | - "rogers-core-appl1.apn", |
99 | | - //char gprsUser [32]; |
100 | | - "wapuser1", |
101 | | - //char gprsPass [32]; |
102 | | - "wap", |
103 | | - //char gprsPin [12]; // A PIN (Personal Identification Number) is a 4-8 digit passcode |
104 | | - "1245678", |
105 | | - // END OF YOUR GSM / GPRS RELATED |
106 | | - //char board_name [24]; |
107 | | - "ESP32-GSM-WiFi", |
108 | | - //int checkSum, dummy, not used |
109 | | - 0 |
110 | | -}; |
111 | | - |
112 | | -/////////// End Default Config Data ///////////// |
| 102 | + //char apn [32]; |
| 103 | + "rogers-core-appl1.apn", |
| 104 | + //char gprsUser [32]; |
| 105 | + "wapuser1", |
| 106 | + //char gprsPass [32]; |
| 107 | + "wap", |
| 108 | + //char gprsPin [12]; // A PIN (Personal Identification Number) is a 4-8 digit passcode |
| 109 | + "1245678", |
| 110 | + // END OF YOUR GSM / GPRS RELATED |
| 111 | + //char board_name [24]; |
| 112 | + "ESP32-GSM-WiFi", |
| 113 | + //int checkSum, dummy, not used |
| 114 | + 0 |
| 115 | + }; |
| 116 | + |
| 117 | + /////////// End Default Config Data ///////////// |
113 | 118 |
|
| 119 | +#endif // #if USE_BLYNK_WM |
114 | 120 |
|
115 | 121 | #endif //Credentials_h |
0 commit comments