Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
59 changes: 57 additions & 2 deletions firmware/include/config.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,70 @@

#include <driver/gpio.h>

#include <array>
#include <cstdint>

namespace config {

namespace nvs {

constexpr const char *NAMESPACE = "config";

} // namespace nvs

namespace device {

constexpr const char *NVS_NAMESPACE = "config";
constexpr const char *DEVICE_ID_KEY = "device_id";
constexpr const char *PROJECT_NAME = "bugbite";
constexpr const char *ID_KEY = "device_id";

} // namespace device

namespace wifi {

constexpr const char *SSID_KEY = "wifi_ssid";
constexpr const char *PASSWORD_KEY = "wifi_password";

} // namespace wifi

namespace mqtt {

constexpr const char *HOST_KEY = "mqtt_host";
constexpr const char *PORT_KEY = "mqtt_port";
constexpr const char *USER_KEY = "mqtt_user";
constexpr const char *PASSWORD_KEY = "mqtt_password";

} // namespace mqtt

namespace ble {

// 128-bit provisioning UUIDs (little-endian for NimBLE).
constexpr std::array<std::uint8_t, 16> SERVICE_UUID = {
0x3d, 0x4e, 0x5f, 0x6a, 0x7b, 0x8c, 0xb9, 0xae,
0xbf, 0xc0, 0xd1, 0xe2, 0x00, 0x01, 0x00, 0x00};
constexpr std::array<std::uint8_t, 16> DEVICE_ID_UUID = {
0x3d, 0x4e, 0x5f, 0x6a, 0x7b, 0x8c, 0xb9, 0xae,
0xbf, 0xc0, 0xd1, 0xe2, 0x00, 0x08, 0x00, 0x00};
constexpr std::array<std::uint8_t, 16> WIFI_SSID_UUID = {
0x3d, 0x4e, 0x5f, 0x6a, 0x7b, 0x8c, 0xb9, 0xae,
0xbf, 0xc0, 0xd1, 0xe2, 0x00, 0x02, 0x00, 0x00};
constexpr std::array<std::uint8_t, 16> WIFI_PASSWORD_UUID = {
0x3d, 0x4e, 0x5f, 0x6a, 0x7b, 0x8c, 0xb9, 0xae,
0xbf, 0xc0, 0xd1, 0xe2, 0x00, 0x03, 0x00, 0x00};
constexpr std::array<std::uint8_t, 16> MQTT_HOST_UUID = {
0x3d, 0x4e, 0x5f, 0x6a, 0x7b, 0x8c, 0xb9, 0xae,
0xbf, 0xc0, 0xd1, 0xe2, 0x00, 0x04, 0x00, 0x00};
constexpr std::array<std::uint8_t, 16> MQTT_PORT_UUID = {
0x3d, 0x4e, 0x5f, 0x6a, 0x7b, 0x8c, 0xb9, 0xae,
0xbf, 0xc0, 0xd1, 0xe2, 0x00, 0x05, 0x00, 0x00};
constexpr std::array<std::uint8_t, 16> MQTT_USER_UUID = {
0x3d, 0x4e, 0x5f, 0x6a, 0x7b, 0x8c, 0xb9, 0xae,
0xbf, 0xc0, 0xd1, 0xe2, 0x00, 0x06, 0x00, 0x00};
constexpr std::array<std::uint8_t, 16> MQTT_PASSWORD_UUID = {
0x3d, 0x4e, 0x5f, 0x6a, 0x7b, 0x8c, 0xb9, 0xae,
0xbf, 0xc0, 0xd1, 0xe2, 0x00, 0x07, 0x00, 0x00};

} // namespace ble

namespace relay {

constexpr gpio_num_t GPIO = GPIO_NUM_2;
Expand Down
10 changes: 10 additions & 0 deletions firmware/sdkconfig.defaults
Original file line number Diff line number Diff line change
Expand Up @@ -16,3 +16,13 @@ CONFIG_FREERTOS_HZ=1000

# --- Logging -----------------------------------------------------------------
CONFIG_LOG_DEFAULT_LEVEL_DEBUG=y

# --- Bluetooth Low Energy (NimBLE host, peripheral only) ---------------------
# Used by the connectivity/provisioning module. ESP32-C3 is BLE-only; NimBLE is
# the lighter host. No security/bonding (plaintext link) for this MVP.
CONFIG_BT_ENABLED=y
CONFIG_BT_NIMBLE_ENABLED=y
CONFIG_BT_NIMBLE_ROLE_PERIPHERAL=y
CONFIG_BT_NIMBLE_ROLE_BROADCASTER=y
CONFIG_BT_NIMBLE_ROLE_CENTRAL=n
CONFIG_BT_NIMBLE_ROLE_OBSERVER=n
Loading
Loading