Skip to content

Commit b664d4d

Browse files
trantanenrlubos
authored andcommitted
samples: cellular: modem_shell: sock: Warn about many RAI options
You can set several RAI socket options to lower layers but practically just one should be used at a time. Added a warning about this but still allowing several RAI options to be able to test something that lower layers allow. Jira: MOSH-527 Signed-off-by: Tommi Rantanen <tommi.rantanen@nordicsemi.no>
1 parent e0ebb3c commit b664d4d

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

samples/cellular/modem_shell/src/sock/sock_shell.c

+12
Original file line numberDiff line numberDiff line change
@@ -638,6 +638,7 @@ static int cmd_sock_rai(const struct shell *shell, size_t argc, char **argv)
638638
bool arg_rai_one_resp = false;
639639
bool arg_rai_ongoing = false;
640640
bool arg_rai_wait_more = false;
641+
int rai_option_count = 0;
641642

642643
optreset = 1;
643644
optind = 1;
@@ -652,18 +653,23 @@ static int cmd_sock_rai(const struct shell *shell, size_t argc, char **argv)
652653

653654
case SOCK_SHELL_OPT_RAI_LAST:
654655
arg_rai_last = true;
656+
rai_option_count++;
655657
break;
656658
case SOCK_SHELL_OPT_RAI_NO_DATA:
657659
arg_rai_no_data = true;
660+
rai_option_count++;
658661
break;
659662
case SOCK_SHELL_OPT_RAI_ONE_RESP:
660663
arg_rai_one_resp = true;
664+
rai_option_count++;
661665
break;
662666
case SOCK_SHELL_OPT_RAI_ONGOING:
663667
arg_rai_ongoing = true;
668+
rai_option_count++;
664669
break;
665670
case SOCK_SHELL_OPT_RAI_WAIT_MORE:
666671
arg_rai_wait_more = true;
672+
rai_option_count++;
667673
break;
668674

669675
case 'h':
@@ -693,6 +699,12 @@ static int cmd_sock_rai(const struct shell *shell, size_t argc, char **argv)
693699
"Use 'link rai' command to enable it for socket usage.");
694700
}
695701

702+
if (rai_option_count > 1) {
703+
mosh_warn(
704+
"%d RAI options set while normally just one should be used at a time. "
705+
"Hope you know what you are doing.", rai_option_count);
706+
}
707+
696708
err = sock_rai(
697709
arg_socket_id,
698710
arg_rai_last,

0 commit comments

Comments
 (0)