Logo Search packages:      
Sourcecode: zebra version File versions  Download package

int zebra_decoder_set_config ( zebra_decoder_t decoder,
zebra_symbol_type_t  symbology,
zebra_config_t  config,
int  value 
)

set config for indicated symbology (0 for all) to specified value.

Returns:
0 for success, non-0 for failure (config does not apply to specified symbology, or value out of range)
Since:
0.4

Definition at line 191 of file decoder.c.

References ZEBRA_CFG_ENABLE, ZEBRA_CFG_NUM, ZEBRA_CODE128, ZEBRA_CODE39, zebra_decoder_set_config(), ZEBRA_EAN13, ZEBRA_EAN8, ZEBRA_I25, ZEBRA_ISBN10, ZEBRA_ISBN13, ZEBRA_NONE, ZEBRA_UPCA, and ZEBRA_UPCE.

Referenced by zebra::Decoder::set_config(), zebra_decoder_parse_config(), zebra_decoder_set_config(), and zebra_image_scanner_set_config().

{
    unsigned *config = NULL;
    switch(sym) {
    case ZEBRA_NONE:
        zebra_decoder_set_config(dcode, ZEBRA_EAN13, cfg, val);
        zebra_decoder_set_config(dcode, ZEBRA_EAN8, cfg, val);
        zebra_decoder_set_config(dcode, ZEBRA_UPCA, cfg, val);
        zebra_decoder_set_config(dcode, ZEBRA_UPCE, cfg, val);
        zebra_decoder_set_config(dcode, ZEBRA_ISBN10, cfg, val);
        zebra_decoder_set_config(dcode, ZEBRA_ISBN13, cfg, val);
        zebra_decoder_set_config(dcode, ZEBRA_I25, cfg, val);
        zebra_decoder_set_config(dcode, ZEBRA_CODE39, cfg, val);
        zebra_decoder_set_config(dcode, ZEBRA_CODE128, cfg, val);
        return(0);

#ifdef ENABLE_EAN
    case ZEBRA_EAN13:
        config = &dcode->ean.ean13_config;
        break;

    case ZEBRA_EAN8:
        config = &dcode->ean.ean8_config;
        break;

    case ZEBRA_UPCA:
        config = &dcode->ean.upca_config;
        break;

    case ZEBRA_UPCE:
        config = &dcode->ean.upce_config;
        break;

    case ZEBRA_ISBN10:
        config = &dcode->ean.isbn10_config;
        break;

    case ZEBRA_ISBN13:
        config = &dcode->ean.isbn13_config;
        break;
#endif

#ifdef ENABLE_I25
    case ZEBRA_I25:
        config = &dcode->i25.config;
        break;
#endif

#ifdef ENABLE_CODE39
    case ZEBRA_CODE39:
        config = &dcode->code39.config;
        break;
#endif

#ifdef ENABLE_CODE128
    case ZEBRA_CODE128:
        config = &dcode->code128.config;
        break;
#endif

    /* FIXME handle addons */

    default:
        return(1);
    }
    if(!config || cfg >= ZEBRA_CFG_NUM)
        return(1);

    if(!val)
        *config &= ~(1 << cfg);
    else if(val == 1)
        *config |= (1 << cfg);
    else
        return(1);

#ifdef ENABLE_EAN
    dcode->ean.enable = TEST_CFG(dcode->ean.ean13_config |
                                 dcode->ean.ean8_config |
                                 dcode->ean.upca_config |
                                 dcode->ean.upce_config |
                                 dcode->ean.isbn10_config |
                                 dcode->ean.isbn13_config,
                                 ZEBRA_CFG_ENABLE);
#endif

    return(0);
}


Generated by  Doxygen 1.6.0   Back to index