-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcore.hpp
More file actions
39 lines (30 loc) · 1.01 KB
/
core.hpp
File metadata and controls
39 lines (30 loc) · 1.01 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
#pragma once
#include <cstdint>
#include <string>
#include "error.hpp"
struct generator_conf {
int ppi = 100;
int inch_x = 827; // in 100ths
int inch_y = 1169;
int border = 10;
correction_t cor = CORRECT_RS;
checksum_t cksum = CRC_8;
uint8_t cor_strength = 50; // 0 -> 100
uint32_t cor_data = 0;
//returned values
int capacity; // in bytes
int total_bytes;
float efficiency; // useful / total bits
int img_w, img_h;
int sector_size;
generator_conf(void) = default;
};
//takes settings and returns back stats (capacity = -1 for error)
void init_generator(generator_conf& conf);
//finishes up things and calls deinits
void stop_generator(generator_conf& conf);
//dat size must be equal to capacity
void generate_barcode(const generator_conf& conf, uint8_t *dat, const std::string& filename);
//opposite of generate_barcode(), reads it from the filename given
//given image must follow the specifications for best scanning
int read_barcode(const generator_conf& conf, uint8_t *dat, const std::string& filename);