Merge pull request #11 from kAworu/display-human-readable-data-type
dump_data: display a human readable Data type.
This commit is contained in:
commit
d968f0ae33
1 changed files with 11 additions and 1 deletions
|
@ -21,14 +21,24 @@
|
||||||
#include <jpeglib.h>
|
#include <jpeglib.h>
|
||||||
#include <png.h>
|
#include <png.h>
|
||||||
|
|
||||||
|
#include <quirc.h>
|
||||||
|
|
||||||
#include "dbgutil.h"
|
#include "dbgutil.h"
|
||||||
|
|
||||||
void dump_data(const struct quirc_data *data)
|
void dump_data(const struct quirc_data *data)
|
||||||
{
|
{
|
||||||
|
static const char *data_type_str[] = {
|
||||||
|
[QUIRC_DATA_TYPE_NUMERIC] = "NUMERIC",
|
||||||
|
[QUIRC_DATA_TYPE_ALPHA] = "ALPHANUMERIC",
|
||||||
|
[QUIRC_DATA_TYPE_BYTE] = "BINARY",
|
||||||
|
[QUIRC_DATA_TYPE_KANJI] = "KANJI",
|
||||||
|
};
|
||||||
|
|
||||||
printf(" Version: %d\n", data->version);
|
printf(" Version: %d\n", data->version);
|
||||||
printf(" ECC level: %c\n", "MLHQ"[data->ecc_level]);
|
printf(" ECC level: %c\n", "MLHQ"[data->ecc_level]);
|
||||||
printf(" Mask: %d\n", data->mask);
|
printf(" Mask: %d\n", data->mask);
|
||||||
printf(" Data type: %d\n", data->data_type);
|
printf(" Data type: %d (%s)\n",
|
||||||
|
data->data_type, data_type_str[data->data_type]);
|
||||||
printf(" Length: %d\n", data->payload_len);
|
printf(" Length: %d\n", data->payload_len);
|
||||||
printf(" Payload: %s\n", data->payload);
|
printf(" Payload: %s\n", data->payload);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue