Zoltan Hudak / zbar

Dependents:   BarcodeReader_F103

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers code39.h Source File

code39.h

00001 /*------------------------------------------------------------------------
00002  *  Copyright 2008-2009 (c) Jeff Brown <spadix@users.sourceforge.net>
00003  *
00004  *  This file is part of the ZBar Bar Code Reader.
00005  *
00006  *  The ZBar Bar Code Reader is free software; you can redistribute it
00007  *  and/or modify it under the terms of the GNU Lesser Public License as
00008  *  published by the Free Software Foundation; either version 2.1 of
00009  *  the License, or (at your option) any later version.
00010  *
00011  *  The ZBar Bar Code Reader is distributed in the hope that it will be
00012  *  useful, but WITHOUT ANY WARRANTY; without even the implied warranty
00013  *  of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00014  *  GNU Lesser Public License for more details.
00015  *
00016  *  You should have received a copy of the GNU Lesser Public License
00017  *  along with the ZBar Bar Code Reader; if not, write to the Free
00018  *  Software Foundation, Inc., 51 Franklin St, Fifth Floor,
00019  *  Boston, MA  02110-1301  USA
00020  *
00021  *  http://sourceforge.net/projects/zbar
00022  *------------------------------------------------------------------------*/
00023 #ifndef _CODE39_H_
00024 #define _CODE39_H_
00025 
00026 #include <stdint.h>
00027 
00028 /* Code 39 specific decode state */
00029 /* Code 39 specific decode state */
00030 //typedef struct code39_decoder_s {
00031 //    unsigned direction : 1;     /* scan direction: 0=fwd, 1=rev */
00032 //    unsigned element : 4;       /* element offset 0-8 */
00033 //    int character : 12;         /* character position in symbol */
00034 //    unsigned s9;                /* current character width */
00035 //    unsigned width;             /* last character width */
00036 
00037 //    unsigned config;
00038 //    int configs[NUM_CFGS];      /* int valued configurations */
00039 //} code39_decoder_t;
00040 
00041 typedef struct code39_decoder_s {
00042     uint8_t direction;     /* scan direction: 0=fwd, 1=rev */
00043     uint8_t element;       /* element offset 0-8 */
00044     int16_t character;         /* character position in symbol */
00045     uint16_t s9;                /* current character width */
00046     uint16_t width;             /* last character width */
00047 
00048     unsigned config;
00049     int configs[NUM_CFGS];      /* int valued configurations */
00050 } code39_decoder_t;
00051 
00052 /* reset Code 39 specific state */
00053 static inline void code39_reset (code39_decoder_t *dcode39)
00054 {
00055     dcode39->direction = 0;
00056     dcode39->element = 0;
00057     dcode39->character = -1;
00058     dcode39->s9 = 0;
00059 }
00060 
00061 /* decode Code 39 symbols */
00062 zbar_symbol_type_t _zbar_decode_code39(zbar_decoder_t *dcode);
00063 
00064 #endif