Files
tactility/Tactility/Source/service/espnow/EspNowHostedTransport.cpp
T
Ken Van Hoeylandt ab75d2022d Refactored events (#621)
Event handling:

- Added unified event handling for application, system, and Wi‑Fi events.
- Updated all apps to reflect event handling changes

Wi-Fi:

- Refactored event handling from listener interface to task & event group.
- Added direct Wi‑Fi radio controls and improved event subscriptions.
- Wi‑Fi screens now refresh asynchronously and handle unavailable devices more gracefully.
- Enabled Wi‑Fi by default on in dts files, but radio on/off is still done by code. The main reason was reliable event subscription and consistent devicetree states.
- Improved Wi‑Fi shutdown cleanup and radio-state handling.

Other:
- Renamed the Kernel Display app to Display.
2026-08-25 17:44:20 +02:00

38 lines
1.1 KiB
C++

#ifdef ESP_PLATFORM
#include <sdkconfig.h>
#endif
#if defined(CONFIG_SLAVE_SOC_WIFI_SUPPORTED)
#include <Tactility/service/espnow/EspNowHostedTransport.h>
#include <tactility/device.h>
#include <tactility/drivers/wifi.h>
namespace tt::service::espnow::backend {
// Thin wrapper: the actual CP_INIT wait/generation-tracking logic lives in the kernel driver
// (Platforms/platform-esp32/source/drivers/esp32_esp_hosted_ota.cpp, reached via the generic
// FirmwareOps::wait_ready() interface in tactility/drivers/wifi.h) so it's a single source of
// truth shared with any other caller (e.g. an external OTA app), instead of being duplicated
// here.
bool waitForHostedTransport(uint32_t timeoutMs) {
Device* device = nullptr;
if (device_get_first_by_type(&WIFI_TYPE, &device) != ERROR_NONE) {
return false;
}
const FirmwareOps* ops = nullptr;
void* ctx = nullptr;
if (wifi_get_firmware_ops(device, &ops, &ctx) != ERROR_NONE) {
device_put(device);
return false;
}
bool ready = ops->wait_ready(ctx, timeoutMs);
device_put(device);
return ready;
}
}
#endif // CONFIG_SLAVE_SOC_WIFI_SUPPORTED