-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdecoder_api_lib.cpp
More file actions
152 lines (122 loc) · 3.71 KB
/
Copy pathdecoder_api_lib.cpp
File metadata and controls
152 lines (122 loc) · 3.71 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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
#include "qr_frame_decoder.h"
#include "string.h"
#include <stdio.h>
#include <stdint.h>
#include <stdlib.h>
#include <math.h>
#ifdef ANDROID
#include <android/log.h>
#endif
QR_frame_decoder* framedecoder = NULL;
FILE *f = NULL;
char namebuf[200];
immediate_status last_status;
bool mydecoder_initialized = false;
int initialize_decoder(){
if (mydecoder_initialized){
if (framedecoder != NULL){
immediate_status stat = framedecoder->destroy_and_get_filetransfer_status();
delete framedecoder;
}
}
framedecoder = new QR_frame_decoder;
mydecoder_initialized = true;
return 0;
};
int set_decoded_file_path(const char* path){
if (!mydecoder_initialized)
return (int)API_NOT_INITIALIZED;
if(framedecoder != NULL)
framedecoder->tell_file_generation_path(path);
else
return (int)API_NOT_INITIALIZED;
};
immediate_status send_next_grayscale_buffer_to_decoder(
const char* grayscale_qr_data,
int image_width,
int image_height){
if (!mydecoder_initialized)
return API_NOT_INITIALIZED;
if(framedecoder != NULL)
return framedecoder->send_next_grayscale_qr_frame(grayscale_qr_data, image_width, image_height);
else
return API_NOT_INITIALIZED;
};
immediate_status tell_decoder_no_more_qr(){
if (!mydecoder_initialized)
return API_NOT_INITIALIZED;
if(framedecoder != NULL)
return framedecoder->tell_no_more_qr();
else
return API_NOT_INITIALIZED;
};
int get_total_frames_of_data_that_will_be_produced(){
if (!mydecoder_initialized)
return (int)API_NOT_INITIALIZED;
if(framedecoder != NULL)
return framedecoder->get_total_frames_of_data_that_will_be_produced();
else
return (int)API_NOT_INITIALIZED;
};
int get_last_number_of_frame_detected(){
if (!mydecoder_initialized)
return (int)API_NOT_INITIALIZED;
if(framedecoder != NULL)
return framedecoder->get_last_number_of_frame_detected();
else
return (int)API_NOT_INITIALIZED;
};
int get_last_number_of_header_frame_detected(){
if (!mydecoder_initialized)
return (int)API_NOT_INITIALIZED;
if(framedecoder != NULL)
return framedecoder->get_last_number_of_header_frame_detected();
else
return (int)API_NOT_INITIALIZED;
};
char filename_array[4096];
const char* get_last_recognized_file_name_str(){
if (!mydecoder_initialized)
return NULL;
if (framedecoder != NULL)
framedecoder->copy_recognized_filename_to_provided_memory(filename_array, sizeof(filename_array));
return (const char*)filename_array;
};
int get_last_recognized_file_size(){
int size = -1;
if (!mydecoder_initialized)
return -1;
if (framedecoder != NULL)
size = framedecoder->get_last_recognized_file_size();
return size;
};
int get_main_RSN(){
if (!mydecoder_initialized)
return (int)API_NOT_INITIALIZED;
return framedecoder->get_main_RSN();
};
int get_main_RSK(){
if (!mydecoder_initialized)
return (int)API_NOT_INITIALIZED;
return framedecoder->get_main_RSK();
};
int get_residual_RSN(){
if (!mydecoder_initialized)
return (int)API_NOT_INITIALIZED;
return framedecoder->get_residual_RSN();
};
int get_residual_RSK(){
if (!mydecoder_initialized)
return (int)API_NOT_INITIALIZED;
return framedecoder->get_residual_RSK();
};
immediate_status deinitialize_decoder(){
if (!mydecoder_initialized)
return API_NOT_INITIALIZED;
immediate_status stat = framedecoder->destroy_and_get_filetransfer_status();
if (framedecoder != NULL)
delete framedecoder;
framedecoder = NULL;
mydecoder_initialized = false;
return stat;
};