@@ -420,16 +420,19 @@ static void configure_cli11_tdd_ul_dl_args(CLI::App& app, du_high_unit_tdd_ul_dl
420420{
421421 configure_cli11_tdd_ul_dl_pattern_args (app, tdd_ul_dl_params.pattern1 );
422422 // TDD pattern 2.
423- // NOTE: CLI11 needs that the life of the variable last longer than the call of callback function. Therefore, the
424- // pattern2_cfg variable needs to be static.
425- tdd_ul_dl_params.pattern2 .emplace ();
426- CLI::App* pattern2_sub_cmd =
423+ // NOTE: As the pattern2 can be configured in the common cell and not in the cell, use a different variable to parse
424+ // the cell pattern 2 property. If the pattern 2 is present for the cell, update the cell pattern 2 value, otherwise
425+ // do nothing (this will cause that the cell pattern 2 value equals than the common cell TDD pattern 2). CLI11 needs
426+ // that the life of the variable last longer than the call of callback function. Therefore, the pattern2_cfg variable
427+ // needs to be static.
428+ tdd_ul_dl_pattern_unit_config pattern2_cfg;
429+ CLI::App* pattern2_sub_cmd =
427430 add_subcommand (app, " pattern2" , " TDD UL DL pattern2 configuration parameters" )->configurable ();
428- configure_cli11_tdd_ul_dl_pattern_args (*pattern2_sub_cmd, *tdd_ul_dl_params. pattern2 );
431+ configure_cli11_tdd_ul_dl_pattern_args (*pattern2_sub_cmd, pattern2_cfg );
429432 auto tdd_pattern2_verify_callback = [&]() {
430433 CLI::App* sub_cmd = app.get_subcommand (" pattern2" );
431- if (sub_cmd->count () = = 0 ) {
432- tdd_ul_dl_params.pattern2 .reset ( );
434+ if (sub_cmd->count () ! = 0 ) {
435+ tdd_ul_dl_params.pattern2 .emplace (pattern2_cfg );
433436 }
434437 };
435438 pattern2_sub_cmd->parse_complete_callback (tdd_pattern2_verify_callback);
@@ -1060,14 +1063,19 @@ static void configure_cli11_common_cell_args(CLI::App& app, du_high_unit_base_ce
10601063 configure_cli11_prach_args (*prach_subcmd, cell_params.prach_cfg );
10611064
10621065 // TDD UL DL configuration.
1063- cell_params.tdd_ul_dl_cfg .emplace ();
1064- CLI::App* tdd_ul_dl_subcmd =
1066+ // NOTE: As the cell TDD pattern can be configured in the common cell and not in the cell, use a different variable to
1067+ // parse the cell TDD property. If the TDD pattern is present for the cell, update the cell TDD pattern value,
1068+ // otherwise do nothing (this will cause that the cell TDD pattern value equals than the common cell TDD pattern).
1069+ // CLI11 needs that the life of the variable last longer than the call of callback function. Therefore, the
1070+ // cell_tdd_pattern variable needs to be static.
1071+ static du_high_unit_tdd_ul_dl_config cell_tdd_pattern;
1072+ CLI::App* tdd_ul_dl_subcmd =
10651073 add_subcommand (app, " tdd_ul_dl_cfg" , " TDD UL DL configuration parameters" )->configurable ();
1066- configure_cli11_tdd_ul_dl_args (*tdd_ul_dl_subcmd, *cell_params. tdd_ul_dl_cfg );
1074+ configure_cli11_tdd_ul_dl_args (*tdd_ul_dl_subcmd, cell_tdd_pattern );
10671075 auto tdd_ul_dl_verify_callback = [&]() {
10681076 CLI::App* tdd_sub_cmd = app.get_subcommand (" tdd_ul_dl_cfg" );
1069- if (tdd_sub_cmd->count () = = 0 ) {
1070- cell_params.tdd_ul_dl_cfg .reset ( );
1077+ if (tdd_sub_cmd->count () ! = 0 ) {
1078+ cell_params.tdd_ul_dl_cfg .emplace (cell_tdd_pattern );
10711079 }
10721080 };
10731081 tdd_ul_dl_subcmd->parse_complete_callback (tdd_ul_dl_verify_callback);
0 commit comments