Cognex Mobile Barcode SDK SDK for supporting communication with Cognex Barcode Reader devices

MWParser.h
Go to the documentation of this file.
1
14#ifndef MWParser_h
15#define MWParser_h
16
17#ifdef __cplusplus
18 extern "C" {
19#endif
20
31#define MWP_RT_OK 0
32#define MWP_RT_FAIL -1
33#define MWP_RT_NOT_SUPPORTED -2
34#define MWP_RT_BAD_PARAM -3
35#define MWP_RT_BAD_INPUT -4
41#define MWP_PARSER_MASK_NONE 0x00000000u
42#define MWP_PARSER_MASK_GS1 0x00000001u
43#define MWP_PARSER_MASK_IUID 0x00000002u
44#define MWP_PARSER_MASK_ISBT 0x00000004u
45#define MWP_PARSER_MASK_AAMVA 0x00000008u
46#define MWP_PARSER_MASK_HIBC 0x00000010u
47#define MWP_PARSER_MASK_SCM 0x00000020u
51//UID PARSER ERROR CODES
52#define UID_ERROR_INVALID_HEADER -1
53#define UID_ERROR_INVALID_FORMAT -2
54#define UID_ERROR_INVALID_EI -3.0
55#define UID_ERROR_INVALID_CAGE -3.1
56#define UID_ERROR_INVALID_DUNS -3.2
57#define UID_ERROR_INVALID_DODAAC -3.3
58#define UID_ERROR_INVALID_GS1COMP -3.4
59#define UID_ERROR_INVALID_PN -4
60#define UID_ERROR_INVALID_SN -5
61#define UID_ERROR_INVALID_UII -6
62#define UID_ERROR_INVALID_LOT -7
63#define UID_ERROR_GS_MISSING -8 //GS Missing after Header
64#define UID_ERROR_RS_MISSING -9
65#define UID_ERROR_EOT_MISSING -10
66#define UID_ERROR_NO_SN -11
67#define UID_ERROR_NO_EI -12
68#define UID_ERROR_NO_PN -13
69#define UID_ERROR_NO_LOT -14
70#define UID_ERROR_DUPLICATE_DQ -15
71#define UID_ERROR_DUPLICATE_UII -16
72#define UID_ERROR_DUPLICATE_LOT -17
73#define UID_ERROR_DUPLICATE_SN -18
74#define UID_ERROR_DUPLICATE_EI -19
75#define UID_ERROR_LOT_PN_CONFLICT -20
76#define UID_ERROR_MISSING_REQ -21
77#define UID_ERROR_INVALID_IAC -22
78#define UID_ERROR_INVALID_TEI -23
79#define UID_ERROR_NOT_ENOUGHT_MEMORY -24
80
81
82//UID PARSER WARNING CODES
83#define UID_WARN_EXTRA_CHARS 91 //characters after EOT
84#define UID_WARN_UNNEEDED_DATA 92 //unneeded additional data
85#define UID_WARN_SPACE_AROUND 93 //space at the beginning or end of the uid
86#define UID_WARN_UNKNOWN_DQ 94
87#define UID_WARN_OBSOLETE_FORMAT 95 //warning for DD
88
89
90//AAMVA PARSER ERROR CODES
91#define AAMVA_ERROR_INVALID_FORMAT -1
92#define AAMVA_ERROR_INVALID_HEADER -2
93#define AAMVA_ERROR_INVALID_IIN -3
94#define NOT_ENOUGHT_MEMORY -4
95#define AAMVA_ERROR_INVALID_JN -5
96#define AAMVA_ERROR_INVALID_NENTIRES -6
97
98
99//AAMVA PARSER WARNING CODES
100#define AAMVA_WARNING_MISSING_MANDATORY_FIELDS 1
101
102
103//UPS/SCM PARSER ERROR CODES
104#define SCM_ERROR_INVALID_FORMAT -1
105#define SCM_ERROR_INVALID_CODE -2
106#define SCM_ERROR_ELEMENT_NOT_FOUND -3
107#define SCM_ERROR_CANT_ALLOCATE_MEMORY -4
108
109//UPS/SCM PARSER WARNING CODES
110#define SCM_WARNING_LENGTH_OUT_OF_BOUNDS 1 //possible compression used by UPS
111#define SCM_WARNING_FIELD_EXCEEDS_MAX_LENGTH 2 //possible compression used by UPS
112#define SCM_WARNING_INVALID_TERMINATOR 3 //possible compression used by UPS
113
123 extern unsigned int MWP_getSupportedParsers(void);
124
125
126/*
127 * Registers licensing information with selected single parser type.
128 * If registering information is correct, enables full support for selected
129 * parser type.
130 * Should be called once per decoder type.
131 *
132 * @param[in] parserMask Single parser type selector (MWP_PARSER_MASK_...)
133 * @param[in] userName User name string
134 * @param[in] key License key string
135 *
136 * @retval MWP_RT_OK Registration successful
137 * MWP_RT_FAIL Registration failed
138 * MWP_RT_BAD_PARAM More than one parser flag selected
139 * MWP_RT_NOT_SUPPORTED Selected parser type or its registration
140 * is not supported
141 */
142 extern int
143 MWP_registerParser(const uint32_t parserMask, const char * userName, const char * key);
144
145
146/*
147 * Get parsed result in form of 'formatted text', mainly suited for demonstration purpose.
148 * It would return text with rows consisted of key/values pairs, like: (ABC) 123456, where
149 * ABC is a key, and 123456 is a value.
150 *
151 * @param[in] parser_type Single parser type selector (MWP_PARSER_MASK_...)
152 * @param[in] p_input Input byte array from decoder
153 * @param[in] inputLength Length of input byte array
154 * @param[in] pp_output Output formatted result
155 *
156 * @retval MWP_RT_OK Parsing successful
157 * MWP_RT_FAIL Parsing failed
158 */
159 extern double
160 MWP_getFormattedText(const int parser_type, const unsigned char * p_input, const int inputLength, unsigned char **pp_output);
161
162/*
163 * Get parsed result as JSON string, caontaining general info about parsed data, and fields array.
164 *
165 * @param[in] parser_type Single parser type selector (MWP_PARSER_MASK_...)
166 * @param[in] p_input Input byte array from decoder
167 * @param[in] inputLength Length of input byte array
168 * @param[in] pp_output Output JSON string
169 *
170 * @retval MWP_RT_OK Parsing successful
171 * MWP_RT_FAIL Parsing failed
172 */
173 double
174 MWP_getJSON(const int parser_type, const unsigned char* p_input, const int inputLength, unsigned char **pp_output);
175
176
177
178#ifdef __cplusplus
179}
180#endif
181
182#endif
uint32_t
unsigned int uint32_t
Definition: BarcodeScanner.h:22
MWP_getJSON
double MWP_getJSON(const int parser_type, const unsigned char *p_input, const int inputLength, unsigned char **pp_output)
MWP_getFormattedText
double MWP_getFormattedText(const int parser_type, const unsigned char *p_input, const int inputLength, unsigned char **pp_output)
MWP_registerParser
int MWP_registerParser(const uint32_t parserMask, const char *userName, const char *key)
MWP_getSupportedParsers
unsigned int MWP_getSupportedParsers(void)
Returns supported parsers in this library release.