Merge TactilityHeadless into Tactility (#263)
There currently is no practical use to have TactilityHeadless as a subproject. I'm merging it with the Tactility project.
This commit is contained in:
committed by
GitHub
parent
d0ca3b16f8
commit
d72852a6e2
@@ -0,0 +1,65 @@
|
||||
#include "Tactility/TactilityHeadless.h"
|
||||
#include "Tactility/hal/Configuration.h"
|
||||
#include "Tactility/hal/Hal_i.h"
|
||||
#include "Tactility/network/NtpPrivate.h"
|
||||
#include "Tactility/service/ServiceManifest.h"
|
||||
#include "Tactility/service/ServiceRegistry.h"
|
||||
|
||||
#include <Tactility/Dispatcher.h>
|
||||
#include <Tactility/time/TimePrivate.h>
|
||||
|
||||
#ifdef ESP_PLATFORM
|
||||
#include "Tactility/InitEsp.h"
|
||||
#endif
|
||||
|
||||
namespace tt {
|
||||
|
||||
#define TAG "tactility"
|
||||
|
||||
namespace service::gps { extern const ServiceManifest manifest; }
|
||||
namespace service::wifi { extern const ServiceManifest manifest; }
|
||||
namespace service::sdcard { extern const ServiceManifest manifest; }
|
||||
#ifdef ESP_PLATFORM
|
||||
namespace service::espnow { extern const ServiceManifest manifest; }
|
||||
#endif
|
||||
|
||||
static Dispatcher mainDispatcher;
|
||||
|
||||
static const hal::Configuration* hardwareConfig = nullptr;
|
||||
|
||||
static void registerAndStartSystemServices() {
|
||||
TT_LOG_I(TAG, "Registering and starting system services");
|
||||
addService(service::gps::manifest);
|
||||
addService(service::sdcard::manifest);
|
||||
addService(service::wifi::manifest);
|
||||
#ifdef ESP_PLATFORM
|
||||
addService(service::espnow::manifest);
|
||||
#endif
|
||||
}
|
||||
|
||||
void initHeadless(const hal::Configuration& config) {
|
||||
TT_LOG_I(TAG, "Tactility v%s on %s (%s)", TT_VERSION, CONFIG_TT_BOARD_NAME, CONFIG_TT_BOARD_ID);
|
||||
#ifdef ESP_PLATFORM
|
||||
initEsp();
|
||||
#endif
|
||||
hardwareConfig = &config;
|
||||
time::init();
|
||||
hal::init(config);
|
||||
network::ntp::init();
|
||||
registerAndStartSystemServices();
|
||||
}
|
||||
|
||||
|
||||
Dispatcher& getMainDispatcher() {
|
||||
return mainDispatcher;
|
||||
}
|
||||
|
||||
namespace hal {
|
||||
|
||||
const Configuration* getConfiguration() {
|
||||
return hardwareConfig;
|
||||
}
|
||||
|
||||
} // namespace hal
|
||||
|
||||
} // namespace tt
|
||||
Reference in New Issue
Block a user