Code39_Decode


Files

file  decode-39.c
 Code 39 Decode.

Enumerations

enum  { STANDARD, SPECIAL }

Functions

unsigned short Decode39 (struct BC_STRUCT *p)
 Code 39 decode routine.

Enumeration Type Documentation

anonymous enum

Enumerator:
STANDARD 
SPECIAL 

Definition at line 90 of file decode-39.c.

00090 {STANDARD, SPECIAL};


Function Documentation

unsigned short Decode39 ( struct BC_STRUCT p  ) 

Code 39 decode routine.

Parameters:
p points to channel context
Returns:
0 if unable to decode, else decoded character count

Definition at line 107 of file decode-39.c.

References BC_STRUCT::decode_count, BC_STRUCT::sample_buffer, BC_STRUCT::sample_ctr, BC_STRUCT::sample_ptr, SPECIAL, and STANDARD.

00108 {
00109     // Minimum sample count
00110     if(p->sample_ctr < 27){
00111         return  0;      
00112         }
00113 
00114     // Standard reference
00115     p->sample_ptr = &p->sample_buffer[0];
00116     if(FindStart(p, STANDARD) != NO_CODE){
00117         if(Decode(p, STANDARD) != NO_DECODE){
00118             return p->decode_count;
00119         }
00120     }
00121 
00122     // Special reference
00123     p->sample_ptr = &p->sample_buffer[0];
00124     if(FindStart(p, SPECIAL) != NO_CODE){
00125         if(Decode(p, SPECIAL) != NO_DECODE){
00126             return p->decode_count;
00127         }
00128     }
00129 
00130     // Unable to decode
00131     return 0;
00132 }

Download Source Code