diff options
Diffstat (limited to 'include')
| -rw-r--r-- | include/config.h | 21 | ||||
| -rw-r--r-- | include/mqtt.h | 15 | ||||
| -rw-r--r-- | include/wifi.h | 17 | ||||
| -rw-r--r-- | include/wifi_scan.h | 12 |
4 files changed, 65 insertions, 0 deletions
diff --git a/include/config.h b/include/config.h new file mode 100644 index 0000000..467e1f7 --- /dev/null +++ b/include/config.h | |||
| @@ -0,0 +1,21 @@ | |||
| 1 | #ifndef CONFIG_H | ||
| 2 | #define CONFIG_H | ||
| 3 | |||
| 4 | #define PUB_TOPIC "device/echo/in" | ||
| 5 | #define SUB_TOPIC "device/echo/out" | ||
| 6 | #define PUBLISH_INTERVAL_MS 1000 | ||
| 7 | #define BUFFER_SIZE 32 | ||
| 8 | |||
| 9 | #ifndef WIFI_SSID | ||
| 10 | #define WIFI_SSID "UNKNOWN" | ||
| 11 | #endif | ||
| 12 | |||
| 13 | #ifndef WIFI_PASS | ||
| 14 | #define WIFI_PASS "UNKNOWN" | ||
| 15 | #endif | ||
| 16 | |||
| 17 | #ifndef MQTT_URI | ||
| 18 | #define MQTT_URI "mqtt://0.0.0.0" | ||
| 19 | #endif | ||
| 20 | |||
| 21 | #endif | ||
diff --git a/include/mqtt.h b/include/mqtt.h new file mode 100644 index 0000000..4f46b5a --- /dev/null +++ b/include/mqtt.h | |||
| @@ -0,0 +1,15 @@ | |||
| 1 | #ifndef MQTT_H | ||
| 2 | #define MQTT_H | ||
| 3 | |||
| 4 | #include "mqtt_client.h" | ||
| 5 | |||
| 6 | /** | ||
| 7 | * @brief Starts the MQTT application. | ||
| 8 | * | ||
| 9 | * Initializes the MQTT client, registers event handlers, | ||
| 10 | * and starts the MQTT client. Also creates the publisher task | ||
| 11 | * that periodically sends messages. | ||
| 12 | */ | ||
| 13 | void mqtt_app_start(void); | ||
| 14 | |||
| 15 | #endif | ||
diff --git a/include/wifi.h b/include/wifi.h new file mode 100644 index 0000000..bdcbe76 --- /dev/null +++ b/include/wifi.h | |||
| @@ -0,0 +1,17 @@ | |||
| 1 | #ifndef WIFI_H | ||
| 2 | #define WIFI_H | ||
| 3 | |||
| 4 | #include "esp_wifi.h" | ||
| 5 | #include "wifi_scan.h" | ||
| 6 | |||
| 7 | /** | ||
| 8 | * @brief Initializes the WiFi interface in station mode. | ||
| 9 | * | ||
| 10 | * Sets up the default WiFi station network interface, | ||
| 11 | * initializes the WiFi driver with default configurations, | ||
| 12 | * starts WiFi, scans for available networks, and connects to | ||
| 13 | * the configured SSID and password. | ||
| 14 | */ | ||
| 15 | void wifi_init_sta(void); | ||
| 16 | |||
| 17 | #endif | ||
diff --git a/include/wifi_scan.h b/include/wifi_scan.h new file mode 100644 index 0000000..dc18e7c --- /dev/null +++ b/include/wifi_scan.h | |||
| @@ -0,0 +1,12 @@ | |||
| 1 | #ifndef WIFI_SCAN_H | ||
| 2 | #define WIFI_SCAN_H | ||
| 3 | |||
| 4 | /** | ||
| 5 | * @brief Starts scanning for available WiFi networks. | ||
| 6 | * | ||
| 7 | * This function triggers the WiFi hardware to scan | ||
| 8 | * for nearby WiFi access points asynchronously. | ||
| 9 | */ | ||
| 10 | void wifi_scan_start(void); | ||
| 11 | |||
| 12 | #endif // WIFI_SCAN_H | ||
