From aa0acd62c7939d05ea26aa10c2545b0d9af5378f Mon Sep 17 00:00:00 2001 From: Alexandre Abadie <alexandre.abadie@inria.fr> Date: Sat, 24 Feb 2018 15:16:33 +0100 Subject: [PATCH] tests/pkg_semtech-loramac: add new link_check command --- tests/pkg_semtech-loramac/main.c | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/tests/pkg_semtech-loramac/main.c b/tests/pkg_semtech-loramac/main.c index 1a8b98fa4a..0d19cf4e5f 100644 --- a/tests/pkg_semtech-loramac/main.c +++ b/tests/pkg_semtech-loramac/main.c @@ -34,7 +34,7 @@ static char print_buf[LORAMAC_APPKEY_LEN * 2 + 1]; static void _loramac_usage(void) { - puts("Usage: loramac <get|set|join|tx>"); + puts("Usage: loramac <get|set|join|tx|link_check>"); } static void _loramac_join_usage(void) @@ -416,8 +416,25 @@ static int _cmd_loramac(int argc, char **argv) break; } + if (loramac.link_chk.available) { + printf("Link check information:\n" + " - Demodulation margin: %d\n" + " - Number of gateways: %d\n", + loramac.link_chk.demod_margin, + loramac.link_chk.nb_gateways); + } + return 0; } + else if (strcmp(argv[1], "link_check") == 0) { + if (argc > 2) { + _loramac_usage(); + return 1; + } + + semtech_loramac_request_link_check(&loramac); + puts("Link check request scheduled"); + } else { _loramac_usage(); return 1; -- GitLab