Skip to content

Commit 34ebd2b

Browse files
robertfalkenbergcodebot
authored andcommitted
cu: add initial version of console helper
1 parent e8ca1a3 commit 34ebd2b

File tree

1 file changed

+11
-3
lines changed

1 file changed

+11
-3
lines changed

apps/cu/cu.cpp

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@
3232

3333
#include "apps/cu/cu_appconfig_cli11_schema.h"
3434
#include "apps/cu/cu_worker_manager.h"
35+
#include "apps/services/console_helper.h"
3536
#include "apps/services/metrics_log_helper.h"
3637
#include "apps/units/cu_cp/cu_cp_builder.h"
3738
#include "apps/units/cu_cp/cu_cp_logger_registrator.h"
@@ -327,8 +328,15 @@ int main(int argc, char** argv)
327328
// create CU-CP.
328329
std::unique_ptr<srsran::srs_cu_cp::cu_cp> cu_cp_obj = build_cu_cp(cu_cp_config, cu_cp_dependencies);
329330

331+
// TODO: Remove JSON sink and refactor console_helper to not require it upon construction
332+
// Set up the JSON log channel used by metrics.
333+
srslog::sink& json_sink = srslog::fetch_udp_sink("127.0.9.9", 61234, srslog::create_json_formatter());
334+
srslog::log_channel& json_channel = srslog::fetch_log_channel("JSON_channel", json_sink, {});
335+
json_channel.set_enabled(false);
336+
330337
// Create console helper object for commands and metrics printing.
331-
// TODO console helper
338+
console_helper console(*epoll_broker, json_channel, cu_cp_obj->get_command_handler());
339+
console.on_app_starting();
332340

333341
// Create metrics log helper.
334342
metrics_log_helper metrics_logger(srslog::fetch_basic_logger("METRICS"));
@@ -374,14 +382,14 @@ int main(int argc, char** argv)
374382
dlt_pcaps.push_back(std::move(e2ap_p));
375383

376384
// Start processing.
377-
// TODO console.on_app_running()
385+
console.on_app_running();
378386

379387
while (is_running) {
380388
std::this_thread::sleep_for(std::chrono::milliseconds(100));
381389
}
382390

383391
// Console helper print stop
384-
// TODO
392+
console.on_app_stopping();
385393

386394
// Stop CU-UP activity.
387395
cu_up_obj->stop();

0 commit comments

Comments
 (0)