rewrite MccGenericMount and MccGenericFsmMount class creation
Asibfm700MountNetServer is now started
This commit is contained in:
@@ -15,20 +15,43 @@ Asibfm700Mount::Asibfm700Mount(Asibfm700MountConfig const& config, std::shared_p
|
||||
.lon = config.siteLongitude(),
|
||||
.elev = config.siteElevation()}),
|
||||
Asibfm700PCM(config.pcmData()),
|
||||
base_gm_class_t(
|
||||
gm_class_t{AsibFM700ServoController{config.servoControllerConfig()}, mcc::MccTelemetry{this},
|
||||
Asibfm700PZoneContainer{}, mcc::MccSimpleSlewingModel{this}, mcc::MccSimpleTrackingModel{this},
|
||||
Asibfm700Logger{std::move(logger), Asibfm700Logger::LOGGER_DEFAULT_FORMAT}},
|
||||
Asibfm700StartState{}),
|
||||
base_gm_class_t(Asibfm700StartState{},
|
||||
std::make_tuple(config.servoControllerConfig()),
|
||||
std::make_tuple(this),
|
||||
std::make_tuple(),
|
||||
std::make_tuple(this),
|
||||
std::make_tuple(this),
|
||||
std::make_tuple(logger, Asibfm700Logger::LOGGER_DEFAULT_FORMAT)),
|
||||
_mountConfig(config),
|
||||
_mountConfigMutex(new std::mutex)
|
||||
{
|
||||
addMarkToPatternIdx("ASIB-MOUNT");
|
||||
addMarkToPatternIdx("[ASIB-MOUNT]");
|
||||
|
||||
logDebug("Create Asibfm700Mount class instance ({})", this->getThreadId());
|
||||
|
||||
initMount();
|
||||
}
|
||||
// Asibfm700Mount::Asibfm700Mount(Asibfm700MountConfig const& config, std::shared_ptr<spdlog::logger> logger)
|
||||
// : mcc::ccte::erfa::MccCCTE_ERFA({.meteo{.temperature = 10.0, .humidity = 0.5, .pressure = 1010.0},
|
||||
// .wavelength = config.refractWavelength(),
|
||||
// .lat = config.siteLatitude(),
|
||||
// .lon = config.siteLongitude(),
|
||||
// .elev = config.siteElevation()}),
|
||||
// Asibfm700PCM(config.pcmData()),
|
||||
// base_gm_class_t(
|
||||
// gm_class_t{AsibFM700ServoController{config.servoControllerConfig()}, mcc::MccTelemetry{this},
|
||||
// Asibfm700PZoneContainer{}, mcc::MccSimpleSlewingModel{this}, mcc::MccSimpleTrackingModel{this},
|
||||
// Asibfm700Logger{std::move(logger), Asibfm700Logger::LOGGER_DEFAULT_FORMAT}},
|
||||
// Asibfm700StartState{}),
|
||||
// _mountConfig(config),
|
||||
// _mountConfigMutex(new std::mutex)
|
||||
// {
|
||||
// addMarkToPatternIdx("ASIB-MOUNT");
|
||||
|
||||
// logDebug("Create Asibfm700Mount class instance ({})", this->getThreadId());
|
||||
|
||||
// initMount();
|
||||
// }
|
||||
|
||||
|
||||
Asibfm700Mount::~Asibfm700Mount()
|
||||
@@ -140,7 +163,7 @@ Asibfm700Mount::error_t Asibfm700Mount::initMount()
|
||||
ccte_state._leapSeconds.expireDate());
|
||||
}
|
||||
} else {
|
||||
logError("Using hardcoded leap seconds defauls (expire date: {})", ccte_state._leapSeconds.expireDate());
|
||||
logInfo("Using hardcoded leap seconds defauls (expire date: {})", ccte_state._leapSeconds.expireDate());
|
||||
}
|
||||
|
||||
if (!_mountConfig.bulletinAFilename().empty()) { // load IERS Bulletin A file
|
||||
@@ -154,8 +177,8 @@ Asibfm700Mount::error_t Asibfm700Mount::initMount()
|
||||
ccte_state._bulletinA.dateRange().begin, ccte_state._bulletinA.dateRange().end);
|
||||
}
|
||||
} else {
|
||||
logError("Using hardcoded IERS Bulletin A defauls (date range: {} - {})",
|
||||
ccte_state._bulletinA.dateRange().begin, ccte_state._bulletinA.dateRange().end);
|
||||
logInfo("Using hardcoded IERS Bulletin A defauls (date range: {} - {})",
|
||||
ccte_state._bulletinA.dateRange().begin, ccte_state._bulletinA.dateRange().end);
|
||||
}
|
||||
|
||||
setStateERFA(std::move(ccte_state));
|
||||
|
||||
@@ -9,7 +9,7 @@ Asibfm700MountNetServer::Asibfm700MountNetServer(asio::io_context& ctx,
|
||||
std::shared_ptr<spdlog::logger> logger)
|
||||
: base_t(ctx, mount, std::move(logger), Asibfm700Logger::LOGGER_DEFAULT_FORMAT)
|
||||
{
|
||||
addMarkToPatternIdx("ASIB-NETSERVER");
|
||||
addMarkToPatternIdx("[ASIB-NETSERVER]");
|
||||
|
||||
// to avoid possible compiler optimization (one needs to catch 'mount' strictly by reference)
|
||||
auto* mount_ptr = &mount;
|
||||
|
||||
@@ -27,6 +27,12 @@ int main(int argc, char* argv[])
|
||||
options.add_options()("level", "Log level (see SPDLOG package description for valid values)",
|
||||
cxxopts::value<std::string>()->default_value("info"));
|
||||
|
||||
options.add_options()("c,config", "Mount configuration filename (by default use of hardcoded one)",
|
||||
cxxopts::value<std::string>()->default_value(""));
|
||||
|
||||
options.add_options()("dump", "Dump mount default configuration to file and exit",
|
||||
cxxopts::value<std::string>()->default_value(""));
|
||||
|
||||
options.add_options()(
|
||||
"endpoints",
|
||||
"endpoints server will be listening for. For 'local' endpoint the '@' symbol at the beginning of the path "
|
||||
@@ -54,6 +60,19 @@ int main(int argc, char* argv[])
|
||||
return 0;
|
||||
}
|
||||
|
||||
asibfm700::Asibfm700MountConfig mount_cfg;
|
||||
|
||||
std::string fname = opt_result["dump"].as<std::string>();
|
||||
if (fname.size()) {
|
||||
bool ok = mount_cfg.dumpDefaultsToFile(fname);
|
||||
if (!ok) {
|
||||
return 255;
|
||||
}
|
||||
|
||||
return 0;
|
||||
} else {
|
||||
return 255;
|
||||
}
|
||||
|
||||
auto logname = opt_result["log"].as<std::string>();
|
||||
|
||||
@@ -91,7 +110,18 @@ int main(int argc, char* argv[])
|
||||
logger->info("\n");
|
||||
|
||||
|
||||
asibfm700::Asibfm700MountConfig mount_cfg;
|
||||
|
||||
std::string mount_cfg_fname = opt_result["config"].as<std::string>();
|
||||
if (mount_cfg_fname.size()) {
|
||||
logger->info("Try to load mount configuration from file: {}", mount_cfg_fname);
|
||||
auto err = mount_cfg.load(mount_cfg_fname);
|
||||
if (err) {
|
||||
logger->error("Cannot load mount configuration (err = {})! Use defaults!", err.message());
|
||||
} else {
|
||||
logger->info("Mount configuration was loaded successfully!");
|
||||
}
|
||||
}
|
||||
|
||||
asibfm700::Asibfm700Mount mount(mount_cfg, logger);
|
||||
asibfm700::Asibfm700MountNetServer server(ctx, mount, logger);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user