/*------------------------------------------------------------------------
* Copyright 2007-2010 (c) Jeff Brown <spadix@users.sourceforge.net>
*
* This file is part of the ZBar Bar Code Reader.
*
* The ZBar Bar Code Reader is free software; you can redistribute it
* and/or modify it under the terms of the GNU Lesser Public License as
* published by the Free Software Foundation; either version 2.1 of
* the License, or (at your option) any later version.
*
* The ZBar Bar Code Reader is distributed in the hope that it will be
* useful, but WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser Public License for more details.
*
* You should have received a copy of the GNU Lesser Public License
* along with the ZBar Bar Code Reader; if not, write to the Free
* Software Foundation, Inc., 51 Franklin St, Fifth Floor,
* Boston, MA 02110-1301 USA
*
* http://sourceforge.net/projects/zbar
*------------------------------------------------------------------------*/
#ifndef _ZBAR_H_
#define _ZBAR_H_
/** @file
* ZBar Barcode Reader C API definition
*/
/** @mainpage
*
* interface to the barcode reader is available at several levels.
* most applications will want to use the high-level interfaces:
*
* @section high-level High-Level Interfaces
*
* these interfaces wrap all library functionality into an easy-to-use
* package for a specific toolkit:
* - the "GTK+ 2.x widget" may be used with GTK GUI applications. a
* Python wrapper is included for PyGtk
* - the @ref zbar::QZBar "Qt4 widget" may be used with Qt GUI
* applications
* - the Processor interface (in @ref c-processor "C" or @ref
* zbar::Processor "C++") adds a scanning window to an application
* with no GUI.
*
* @section mid-level Intermediate Interfaces
*
* building blocks used to construct high-level interfaces:
* - the ImageScanner (in @ref c-imagescanner "C" or @ref
* zbar::ImageScanner "C++") looks for barcodes in a library defined
* image object
* - the Window abstraction (in @ref c-window "C" or @ref
* zbar::Window "C++") sinks library images, displaying them on the
* platform display
* - the Video abstraction (in @ref c-video "C" or @ref zbar::Video
* "C++") sources library images from a video device
*
* @section low-level Low-Level Interfaces
*
* direct interaction with barcode scanning and decoding:
* - the Scanner (in @ref c-scanner "C" or @ref zbar::Scanner "C++")
* looks for barcodes in a linear intensity sample stream
* - the Decoder (in @ref c-decoder "C" or @ref zbar::Decoder "C++")
* extracts barcodes from a stream of bar and space widths
*/
#ifdef __cplusplus
/** C++ namespace for library interfaces */
namespace zbar {
extern "C" {
#endif
/** @name Global library interfaces */
/*@{*/
/** "color" of element: bar or space. */
typedef enum zbar_color_e {
ZBAR_SPACE = 0, /**< light area or space between bars */
ZBAR_BAR = 1, /**< dark area or colored bar segment */
} zbar_color_t;
/** decoded symbol type. */
typedef enum zbar_symbol_type_e {
ZBAR_NONE = 0, /**< no symbol decoded */
ZBAR_PARTIAL = 1, /**< intermediate status */
ZBAR_EAN2 = 2, /**< GS1 2-digit add-on */
ZBAR_EAN5 = 5, /**< GS1 5-digit add-on */
ZBAR_EAN8 = 8, /**< EAN-8 */
ZBAR_UPCE = 9, /**< UPC-E */
ZBAR_ISBN10 = 10, /**< ISBN-10 (from EAN-13). @since 0.4 */
ZBAR_UPCA = 12, /**< UPC-A */
ZBAR_EAN13 = 13, /**< EAN-13 */
ZBAR_ISBN13 = 14, /**< ISBN-13 (from EAN-13). @since 0.4 */
ZBAR_COMPOSITE = 15, /**< EAN/UPC composite */
ZBAR_I25 = 25, /**< Interleaved 2 of 5. @since 0.4 */
ZBAR_DATABAR = 34, /**< GS1 DataBar (RSS). @since 0.11 */
ZBAR_DATABAR_EXP = 35, /**< GS1 DataBar Expanded. @since 0.11 */
ZBAR_CODABAR = 38, /**< Codabar. @since 0.11 */
ZBAR_CODE39 = 39, /**< Code 39. @since 0.4 */
ZBAR_PDF417 = 57, /**< PDF417. @since 0.6 */
ZBAR_QRCODE = 64, /**< QR Code. @since 0.10 */
ZBAR_CODE93 = 93, /**< Code 93. @since 0.11 */
ZBAR_CODE128 = 128, /**< Code 128 */
/** mask for base symbol type.
* @deprecated in 0.11, remove this from existing code
*/
ZBAR_SYMBOL = 0x00ff,
/** 2-digit add-on flag.
* @deprecated in 0.11, a ::ZBAR_EAN2 component is used for
* 2-digit GS1 add-ons
*/
ZBAR_ADDON2 = 0x0200,
/** 5-digit add-on flag.
* @deprecated in 0.11, a ::ZBAR_EAN5 component is used for
* 5-digit GS1 add-ons
*/
ZBAR_ADDON5 = 0x0500,
/** add-on flag mask.
* @deprecated in 0.11, GS1 add-ons are represented using composite
* symbols of type ::ZBAR_COMPOSITE; add-on components use ::ZBAR_EAN2
* or ::ZBAR_EAN5
*/
ZBAR_ADDON = 0x0700,
} zbar_symbol_type_t;
/** decoded symbol coarse orientation.
* @since 0.11
*/
typedef enum zbar_orientation_e {
ZBAR_ORIENT_UNKNOWN = -1, /**< unable to determine orientation */
ZBAR_ORIENT_UP, /**< upright, read left to right */
ZBAR_ORIENT_RIGHT, /**< sideways, read top to bottom */
ZBAR_ORIENT_DOWN, /**< upside-down, read right to left */
ZBAR_ORIENT_LEFT, /**< sideways, read bottom to top */
} zbar_orientation_t;
/** error codes. */
typedef enum zbar_error_e {
ZBAR_OK = 0, /**< no error */
ZBAR_ERR_NOMEM, /**< out of memory */
ZBAR_ERR_INTERNAL, /**< internal library error */
ZBAR_ERR_UNSUPPORTED, /**< unsupported request */
ZBAR_ERR_INVALID, /**< invalid request */
ZBAR_ERR_SYSTEM, /**< system error */
ZBAR_ERR_LOCKING, /**< locking error */
ZBAR_ERR_BUSY, /**< all resources busy */
ZBAR_ERR_XDISPLAY, /**< X11 display error */
ZBAR_ERR_XPROTO, /**< X11 protocol error */
ZBAR_ERR_CLOSED, /**< output window is closed */
ZBAR_ERR_WINAPI, /**< windows system error */
ZBAR_ERR_NUM /**< number of error codes */
} zbar_error_t;
/** decoder configuration options.
* @since 0.4
*/
typedef enum zbar_config_e {
ZBAR_CFG_ENABLE = 0, /**< enable symbology/feature */
ZBAR_CFG_ADD_CHECK, /**< enable check digit when optional */
ZBAR_CFG_EMIT_CHECK, /**< return check digit when present */
ZBAR_CFG_ASCII, /**< enable full ASCII character set */
ZBAR_CFG_NUM, /**< number of boolean decoder configs */
ZBAR_CFG_MIN_LEN = 0x20, /**< minimum data length for valid decode */
ZBAR_CFG_MAX_LEN, /**< maximum data length for valid decode */
ZBAR_CFG_UNCERTAINTY = 0x40,/**< required video consistency frames */
ZBAR_CFG_POSITION = 0x80, /**< enable scanner to collect position data */
ZBAR_CFG_X_DENSITY = 0x100, /**< image scanner vertical scan density */
ZBAR_CFG_Y_DENSITY, /**< image scanner horizontal scan density */
} zbar_config_t;
/** decoder symbology modifier flags.
* @since 0.11
*/
typedef enum zbar_modifier_e {
/** barcode tagged as GS1 (EAN.UCC) reserved
* (eg, FNC1 before first data character).
* data may be parsed as a sequence of GS1 AIs
*/
ZBAR_MOD_GS1 = 0,
/** barcode tagged as AIM reserved
* (eg, FNC1 after first character or digit pair)
*/
ZBAR_MOD_AIM,
/** number of modifiers */
ZBAR_MOD_NUM,
} zbar_modifier_t;
/** retrieve runtime library version information.
* @param major set to the running major version (unless NULL)
* @param minor set to the running minor version (unless NULL)
* @returns 0
*/
extern int zbar_version(unsigned *major,
unsigned *minor);
/**