1
0
mirror of https://github.com/RIOT-OS/RIOT.git synced 2025-12-17 02:23:49 +01:00

sys/sc_suit: add seq_no command

This commit is contained in:
Francisco Molina 2022-04-14 08:39:28 +02:00
parent e3f9252947
commit 180be1d6ee

View File

@ -23,15 +23,33 @@
#include <inttypes.h>
#include "suit/transport/coap.h"
#include "suit/storage.h"
static void _print_usage(char **argv)
{
printf("Usage: %s fetch <manifest url>\n", argv[0]);
printf(" %s seq_no\n", argv[0]);
}
int _suit_handler(int argc, char **argv)
{
if (argc != 2) {
printf("Usage: %s <manifest url>\n", argv[0]);
if (argc < 2) {
_print_usage(argv);
return 1;
}
suit_coap_trigger((uint8_t *)argv[1], strlen(argv[1]));
if (strcmp(argv[1], "fetch") == 0) {
suit_coap_trigger((uint8_t *)argv[2], strlen(argv[2]));
}
else if (strcmp(argv[1], "seq_no") == 0) {
uint32_t seq_no = 0;
suit_storage_get_highest_seq_no(&seq_no);
printf("seq_no: %" PRIu32 "\n", seq_no);
}
else {
_print_usage(argv);
return -1;
}
return 0;
}