CodeI25_Decode


Files

file  decode-I25.c
 Code I2/5 Decode.

Enumerations

enum  { STANDARD, SPECIAL }

Functions

unsigned short DecodeI25 (struct BC_STRUCT *p, unsigned char length)
 Code 39 decode routine.

Enumeration Type Documentation

anonymous enum

Enumerator:
STANDARD 
SPECIAL 

Definition at line 86 of file decode-I25.c.

00086 {STANDARD, SPECIAL};


Function Documentation

unsigned short DecodeI25 ( struct BC_STRUCT p,
unsigned char  length 
)

Code 39 decode routine.

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

Definition at line 105 of file decode-I25.c.

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

00106 {
00107     // Check the input length
00108     if(length == 0 || length > MAX_DECODE){
00109         return 0;
00110     }
00111 
00112     // Leave if insufficent number of samples
00113     if(p->sample_ctr < ((length * 5) + 7)){
00114         return 0;
00115     }
00116 
00117     // Sstandard reference
00118     p->sample_ptr = &p->sample_buffer[0];
00119     if(FindStart(p, length) != NO_CODE){
00120         if(Decode(p, length, STANDARD) != NO_DECODE){
00121             return p->decode_count;
00122         }
00123     }
00124 
00125     // Special reference
00126     p->sample_ptr = &p->sample_buffer[0];
00127     if(FindStart(p, length) != NO_CODE){
00128         if(Decode(p, length, SPECIAL) != NO_DECODE){
00129             return p->decode_count;
00130         }
00131     }
00132 
00133     // Unable to decode
00134     return NO_DECODE;
00135 }

Download Source Code