app.h
1 // clang-format off 2 #pragma once 3 4 #include "features.h" 5 6 #include <cstddef> 7 #include <cstdint> 8 9 namespace config { 10 11 inline constexpr const char* HOSTNAME = "ceratina"; 12 13 namespace led { 14 inline constexpr uint8_t BRIGHTNESS = 255; 15 inline constexpr uint8_t FRAME_MS = 20; 16 } 17 18 namespace system { 19 inline constexpr uint32_t TASK_STACK = 8192; 20 inline constexpr uint16_t SHELL_SERVICE_MS = 10; 21 } 22 23 namespace ssh { 24 inline constexpr uint16_t PORT = 22; 25 inline constexpr uint16_t RING_SIZE = 512; 26 inline constexpr uint16_t WRITE_BUF_SIZE = 1024; 27 inline constexpr uint32_t TASK_STACK = 32768; 28 inline constexpr const char* HOSTKEY_PATH = "/.ssh/id_ed25519"; 29 } 30 31 namespace wifi { 32 inline constexpr uint16_t CONNECT_TIMEOUT_MS = 15000; 33 inline constexpr uint16_t POLL_MS = 100; 34 inline constexpr uint16_t STA_RETRY_MS = 10000; 35 inline constexpr const char* NVS_NAMESPACE = "wifi"; 36 inline constexpr uint8_t SSID_MAX_LEN = 32; 37 inline constexpr uint8_t PASS_MAX_LEN = 64; 38 namespace ap { 39 inline constexpr const char* SSID = "ceratina-access-point"; 40 inline constexpr const char* PASSWORD = "apidaesystems"; 41 inline constexpr uint8_t CHANNEL = 1; 42 } 43 } 44 45 namespace telnet { 46 inline constexpr uint16_t PORT = 23; 47 inline constexpr uint16_t RING_SIZE = 512; 48 inline constexpr uint16_t WRITE_BUF = 1024; 49 inline constexpr uint16_t KEEPALIVE_MS = 3000; 50 } 51 52 namespace ota { 53 inline constexpr uint16_t PORT = 3232; 54 inline constexpr const char* PASSWORD = ""; 55 inline constexpr const char* SD_PATH = "/update.bin"; 56 } 57 58 namespace sntp { 59 inline constexpr const char* SERVER_1 = "pool.ntp.org"; 60 inline constexpr const char* SERVER_2 = "time.nist.gov"; 61 inline constexpr const char* TIME_ZONE = "EST5EDT,M3.2.0/2,M11.1.0/2"; 62 inline constexpr uint16_t SYNC_TIMEOUT_MS = 10000; 63 } 64 65 namespace http { 66 inline constexpr uint16_t PORT = 80; 67 inline constexpr bool AUTH_ENABLED = false; 68 inline constexpr const char* AUTH_USER = CONFIG_SSH_USER; 69 inline constexpr const char* AUTH_PASSWORD = CONFIG_SSH_USER; 70 inline constexpr const char* AUTH_REALM = "ceratina"; 71 } 72 73 namespace shell { 74 inline constexpr uint16_t BUF_IN = 256; 75 inline constexpr uint16_t BUF_OUT = 256; 76 inline constexpr uint16_t MAX_PATH_LEN = 128; 77 inline constexpr uint16_t HOSTNAME_SIZE = 32; 78 } 79 80 namespace i2c { 81 inline constexpr uint16_t POWER_SETTLE_MS = 100; 82 inline constexpr uint16_t DISCOVERY_SETTLE_MS = 500; 83 } 84 85 namespace temperature_humidity { 86 inline constexpr uint8_t MAX_SENSORS = 8; 87 inline constexpr uint16_t READ_DELAY_MS = 100; 88 } 89 90 namespace voltage { 91 inline constexpr uint8_t CHANNEL_COUNT = 4; 92 } 93 94 namespace wind { 95 inline constexpr uint16_t SENSOR_DELAY_MS = 100; 96 } 97 98 namespace data_logger { 99 inline constexpr const char *CSV_PATH = "/data.csv"; 100 inline constexpr uint32_t LOG_INTERVAL_MS = 5000; 101 inline constexpr uint8_t TEMP_HUMIDITY_SENSOR_COUNT = 3; 102 } 103 104 namespace sleep { 105 inline constexpr bool DEFAULT_ENABLED = false; 106 inline constexpr uint32_t DEFAULT_DURATION_SECONDS = 300; 107 inline constexpr const char* NVS_NAMESPACE = "sleep"; 108 inline constexpr const char* ENABLED_KEY = "enabled"; 109 inline constexpr const char* DURATION_KEY = "duration_s"; 110 } 111 112 namespace provisioning { 113 inline constexpr const char* POP = "ceratina"; 114 inline constexpr const char* SERVICE_UUID = "ceaa0001-b5a3-f393-e0a9-e50e24dcca9e"; 115 inline constexpr const char* CONFIG_UUID = "ceaa0002-b5a3-f393-e0a9-e50e24dcca9e"; 116 inline constexpr const char* NVS_NAMESPACE = "prov"; 117 } 118 119 namespace buttons { 120 inline constexpr uint16_t DEBOUNCE_MS = 50; 121 inline constexpr uint16_t LONG_PRESS_MS = 1000; 122 } 123 124 namespace ble { 125 inline constexpr uint32_t PASSKEY = 123456; 126 inline constexpr uint8_t MAX_CLIENTS = 2; 127 inline constexpr uint16_t RING_SIZE = 512; 128 inline constexpr uint16_t WRITE_BUF = 512; 129 } 130 131 namespace smtp { 132 inline constexpr uint16_t PORT = 587; 133 inline constexpr const char* HOST = ""; 134 inline constexpr const char* DOMAIN = ""; 135 inline constexpr const char* FROM_EMAIL = ""; 136 inline constexpr const char* FROM_NAME = ""; 137 inline constexpr const char* TO_EMAIL = ""; 138 inline constexpr const char* LOGIN_EMAIL = ""; 139 inline constexpr bool AUTH_ENABLED = false; 140 inline constexpr bool SSL_ENABLED = false; 141 inline constexpr bool STARTTLS_ENABLED = false; 142 inline constexpr bool TEST_ENABLED = false; 143 inline constexpr const char* SUBJECT_PREFIX = "[ceratina]"; 144 inline constexpr const char* NVS_KEY = "SMTP_PASSWORD"; 145 } 146 147 namespace cloudevents { 148 inline constexpr const char* TENANT = "default-tenant"; 149 inline constexpr const char* SITE = "default-site"; 150 } 151 152 namespace scp { 153 inline constexpr uint16_t BUF_SIZE = 4096; 154 } 155 156 namespace ws_shell { 157 inline constexpr uint16_t RING_SIZE = 512; 158 inline constexpr uint16_t WRITE_BUF = 1024; 159 } 160 161 } // namespace config