#include <stdio.h>
#define DEBUG_LOG_MODULE_NAME "CBOR APP"
#define DEBUG_LOG_MAX_LEVEL LVL_INFO
static uint8_t m_cbor_buffer[] = {0xA5,
0x00,
0x50,
0x00,
0x01,
0x02,
0x03,
0x04,
0x05,
0x06,
0x07,
0x08,
0x09,
0x0A,
0x0B,
0x0C,
0x0D,
0x0E,
0x0F,
0x01,
0x6B,
'T',
'e',
's',
't',
' ',
'S',
't',
'r',
'i',
'n',
'g',
0x02,
0x18,
0x1F,
0x03,
0x20,
0x04,
0x1A,
0x07,
0x5B,
0xCD,
0x15};
static bool dumprecursive(
CborValue *it,
int nestingLevel)
{
char indent[32];
int idx = 0, lvl = nestingLevel;
while (lvl--)
{
indent[idx++] = ' ';
indent[idx++] = ' ';
}
indent[idx] = '\0';
{
switch (type)
{
{
{
return err;
}
err = dumprecursive(&recursed, nestingLevel + 1);
{
return err;
}
{
return err;
}
continue;
}
{
int val;
{
return err;
}
break;
}
{
uint8_t data[64];
size_t n = 64;
{
return err;
}
continue;
}
{
char data[64];
size_t n = 64;
{
return err;
}
continue;
}
{
break;
}
{
uint8_t type;
break;
}
{
break;
}
{
break;
}
{
bool val;
LOG(
LVL_INFO,
"%sBoolean: %s", indent, val ?
"true" :
"false");
break;
}
{
break;
}
break;
}
{
return err;
}
}
}
{
(void) functions;
int len = sizeof(m_cbor_buffer);
{
}
{
err = dumprecursive(&value, 0);
}
{
value.
ptr - m_cbor_buffer,
}
}
static CborType cbor_value_get_type(const CborValue *value)
static CborError cbor_value_get_simple_type(const CborValue *value, uint8_t *result)
CBOR_API CborError cbor_value_enter_container(const CborValue *it, CborValue *recursed)
CBOR_API const char * cbor_error_string(CborError error)
static CborError cbor_value_get_boolean(const CborValue *value, bool *result)
CBOR_API CborError cbor_value_leave_container(CborValue *it, const CborValue *recursed)
CBOR_API CborError cbor_value_validate(const CborValue *it, uint32_t flags)
static CborError cbor_value_get_tag(const CborValue *value, CborTag *result)
static CborError cbor_value_copy_text_string(const CborValue *value, char *buffer, size_t *buflen, CborValue *next)
CBOR_API CborError cbor_parser_init(const uint8_t *buffer, size_t size, uint32_t flags, CborParser *parser, CborValue *it)
CBOR_API CborError cbor_value_get_int_checked(const CborValue *value, int *result)
static CborError cbor_value_copy_byte_string(const CborValue *value, uint8_t *buffer, size_t *buflen, CborValue *next)
static bool cbor_value_at_end(const CborValue *it)
CBOR_API CborError cbor_value_advance_fixed(CborValue *it)
#define LOG_BUFFER(level, buffer, size)
Print a buffer if its severity is lower or equal to DEBUG_LOG_MAX_LEVEL.
#define LOG_FLUSH(level)
Actively wait that Uart buffer as been sent.
#define LOG(level, fmt,...)
Print a log message if its severity is lower or equal to DEBUG_LOG_MAX_LEVEL.
List of global functions, passed to App_entrypoint()