Projects >> edsdk4j >>9d516f2714a531e30d2f82350e85311e6cd654f6

Chunk
Conflicting content
package edsdk.utils;

/**
<<<<<<< HEAD
 * A Lot of constants.
 * 
 * Copyright © 2014 Hansi Raber , Ananta Palani
 * 
 * This work is free. You can redistribute it and/or modify it under the
 * terms of the Do What The Fuck You Want To Public License, Version 2,
 * as published by Sam Hocevar. See the COPYING file for more details.
 * 
 * @author hansi
 * @author Ananta Palani
 * 
 */
import java.lang.reflect.Field;
import java.util.Arrays;
import java.util.HashMap;
import java.util.HashSet;
import java.util.LinkedHashMap;

import edsdk.bindings.EdSdkLibrary;

public class CanonConstants {

        @Override



        }
    private static final HashMap> nameLUT = new HashMap>();
    private static final HashMap> descriptionLUT = new HashMap>();
    private static final HashMap>> duplicateNameLUT = new HashMap>>();
    private static final HashMap>> duplicateDescriptionLUT = new HashMap>>();
    private static final HashMap>> tieredNameLUT = new HashMap>>();
    private static final HashMap>> tieredValueLUT = new HashMap>>();
    private static final HashMap>> tieredDescriptionLUT = new HashMap>>();
    private static final HashMap>>> tieredDuplicateValueLUT = new HashMap>>>();
    private static final HashMap>>> tieredDuplicateDescriptionLUT = new HashMap>>>();

    private static final HashSet constantIgnoreList = new HashSet( Arrays.asList( new String[] {
                                                                                                                "INSTANCE",
                                                                                                                "JNA_LIBRARY_NAME",
                                                                                                                "JNA_NATIVE_LIB",
                                                                                                                "NULL",
                                                                                                                "FALSE",
                                                                                                                "TRUE",
                                                                                                                "oldif" } ) );

    static {
        // The following pre-caches all enums to ensure that they will successfully load values from EdSdkLibrary generated by JNAerator
        //System.out.println("Pre-caching enums");
        final Class[] classes = CanonConstants.class.getClasses();

        for ( final Class klass : classes ) {
            if ( Enum.class.isAssignableFrom( klass ) &&
                 DescriptiveEnum.class.isAssignableFrom( klass ) ) {

                final DescriptiveEnum[] enums = (DescriptiveEnum[]) klass.getEnumConstants();

                if ( enums == null ) {
                    throw new IllegalStateException( "Class " +
                                                     klass.getCanonicalName() +
                                                     " was not initialized properly before before static initializer accessed, probably due to a dependency from a constructor accessing a static member or method of the outer class therefore requiring the static class to fully initialize first." );
                }

                for ( final DescriptiveEnum e : enums ) {
                    if ( e == null ) {
                        throw new IllegalStateException( "Class " +
                                                         klass.getCanonicalName() +
                                                         " was not initialized properly before before static initializer accessed, probably due to a dependency from a constructor accessing a static member or method of the outer class therefore requiring the static class to fully initialize first." );
                    }

                    if ( !CanonConstants.nameLUT.containsKey( e.name() ) ) {
                        //System.out.println( e.name() );
                        CanonConstants.nameLUT.put( e.name(), e );
                    } else {
                        if ( !CanonConstants.duplicateNameLUT.containsKey( e.name() ) ) {
                            CanonConstants.duplicateNameLUT.put( e.name(), new HashSet>() );
                        }
                        CanonConstants.duplicateNameLUT.get( e.name() ).add( e );
                        //System.out.println( "Warning: there are multiple enums named "+e.name()+". Looking up this enum by name may not work as expected." );
                    }

                    if ( !CanonConstants.descriptionLUT.containsKey( e.description() ) ) {
                        CanonConstants.descriptionLUT.put( e.description(), e );
                    } else {
                        if ( !CanonConstants.duplicateDescriptionLUT.containsKey( e.description() ) ) {
                            CanonConstants.duplicateDescriptionLUT.put( e.description(), new HashSet>() );
                        }
                        CanonConstants.duplicateDescriptionLUT.get( e.description() ).add( e );
                        //System.out.println( "Warning: there are multiple enums with description "+e.description()+". Looking up this enum by description may not work as expected." );
                    }


                    if ( !CanonConstants.tieredNameLUT.containsKey( klass.getSimpleName() ) ) {
                        CanonConstants.tieredNameLUT.put( klass.getSimpleName(), new LinkedHashMap>() );
                        CanonConstants.tieredValueLUT.put( klass.getSimpleName(), new LinkedHashMap>() );
                        CanonConstants.tieredDescriptionLUT.put( klass.getSimpleName(), new LinkedHashMap>() );
                    }

                    CanonConstants.tieredNameLUT.get( klass.getSimpleName() ).put( e.name(), e );

                    if ( !CanonConstants.tieredValueLUT.get( klass.getSimpleName() ).containsKey( e.value() ) ) {
                        CanonConstants.tieredValueLUT.get( klass.getSimpleName() ).put( e.value(), e );
                    } else {
                        if ( !CanonConstants.tieredDuplicateValueLUT.containsKey( klass.getSimpleName() ) ) {
                            CanonConstants.tieredDuplicateValueLUT.put( klass.getSimpleName(), new HashMap>>() );
                        }
                        if ( !CanonConstants.tieredDuplicateValueLUT.get( klass.getSimpleName() ).containsKey( e.value() ) ) {
                            CanonConstants.tieredDuplicateValueLUT.get( klass.getSimpleName() ).put( e.value(), new HashSet>() );
                        }
                        CanonConstants.tieredDuplicateValueLUT.get( klass.getSimpleName() ).get( e.value() ).add( e );
                        //System.out.println( "Warning: there are multiple enums in "+klass.getCanonicalName()+" with value "+e.value()+". Looking up this enum by value may not work as expected." );
                    }

                    if ( !CanonConstants.tieredDescriptionLUT.get( klass.getSimpleName() ).containsKey( e.description() ) ) {
                        CanonConstants.tieredDescriptionLUT.get( klass.getSimpleName() ).put( e.description(), e );
                    } else {
                        if ( !CanonConstants.tieredDuplicateDescriptionLUT.containsKey( klass.getSimpleName() ) ) {
                            CanonConstants.tieredDuplicateDescriptionLUT.put( klass.getSimpleName(), new HashMap>>() );
                        }
                        if ( !CanonConstants.tieredDuplicateDescriptionLUT.get( klass.getSimpleName() ).containsKey( e.description() ) ) {
                            CanonConstants.tieredDuplicateDescriptionLUT.get( klass.getSimpleName() ).put( e.description(), new HashSet>() );
                        }
                        CanonConstants.tieredDuplicateDescriptionLUT.get( klass.getSimpleName() ).get( e.description() ).add( e );
                        //System.out.println( "Warning: there are multiple enums in "+klass.getCanonicalName()+" with description "+e.description()+". Looking up this enum by description may not work as expected." );
                    }
                }
            }
        }
    }

    /**
     * Ensure that {@link edsdk.utils.CanonConstants CanonConstants} contains
     * all
     * constant values from {@link edsdk.bindings.EdSdkLibrary}
     * 
     * @return true if {@link edsdk.utils.CanonConstants CanonConstants}
     *         contains
     *         all values, bar those in
     *         {@link edsdk.utils.CanonConstants#constantIgnoreList
     *         constantIgnoreList}
     */
    public static final boolean verifyAllConstants() {
        boolean nothingMissing = true;

        System.out.println( "Begin checking whether " +
                            CanonConstants.class.getSimpleName() +
                            " has all constants from EdSdkLibrary" );

        Field[] fields = EdSdkLibrary.class.getDeclaredFields();
        for ( final Field f : fields ) {
            if ( !CanonConstants.nameLUT.containsKey( f.getName() ) &&
                 !CanonConstants.constantIgnoreList.contains( f.getName() ) ) {
                System.err.println( CanonConstants.class.getSimpleName() +
                                    " is Missing: " + f.getName() + " in " +
                                    EdSdkLibrary.class.getCanonicalName() );
                nothingMissing = false;
            }
        }


        final Class[] edsdkClasses = EdSdkLibrary.class.getClasses();
        for ( final Class klass : edsdkClasses ) {
            fields = klass.getDeclaredFields();
            for ( final Field f : fields ) {
                if ( !CanonConstants.nameLUT.containsKey( f.getName() ) &&
                     !CanonConstants.constantIgnoreList.contains( f.getName() ) ) {
                    System.err.println( CanonConstants.class.getSimpleName() +
                                        " is Missing: " + f.getName() + " in " +
                                        klass.getCanonicalName() );
                    nothingMissing = false;
                }
            }
        }

        System.out.println( "Completed checking" );

        return nothingMissing;
    }

    public static final DescriptiveEnum enumOfName( final String name ) {
        return CanonConstants.nameLUT.get( name );
    }

    public static final DescriptiveEnum enumOfName( final Class> klass,
                                                       final String name ) {
        return CanonConstants.tieredNameLUT.get( klass.getSimpleName() ).get( name );
    }

    public static final DescriptiveEnum enumOfDescription( final Class> klass,
                                                              final String description ) {
        return CanonConstants.tieredDescriptionLUT.get( klass.getSimpleName() ).get( description );
    }

    public static final DescriptiveEnum enumOfValue( final Class> klass,
                                                        final int value ) {
        return CanonConstants.tieredValueLUT.get( klass.getSimpleName() ).get( value );
    }

    public interface DescriptiveEnum {

        public abstract String name();

        public abstract V value();

        public abstract String description();

    }

    /**
     * The following enum values are not defined by the EDSDK header
     * files, so values are taken from the EDSDK API documentation PDF and
     * compiled here for convenience. Interestingly, most of these are the
     * values (with
     * the exception of {@link edsdk.EdSdkLibrary#kEdsPropID_AEMode
     * kEdsPropID_AEMode} whose values are provided by the EDSDK) that can be
     * queried by {@link edsdk.EdSdkLibrary#EdsGetPropertyDesc
     * EdsGetPropertyDesc}
     */

    /**
     * Battery Quality
     * See: API Reference - 5.2.11 kEdsPropID_BatteryQuality
     */
    public enum EdsBatteryQuality implements DescriptiveEnum {
        kEdsBatteryQuality_Low( 0, "Very degraded" ),
        kEdsBatteryQuality_Half( 1, "Degraded" ),
        kEdsBatteryQuality_HI( 2, "Slight degradation" ),
        kEdsBatteryQuality_Full( 3, "No degradation" );

        private final int value;
        private final String description;

        EdsBatteryQuality( final int value, final String description ) {
            this.value = value;
            this.description = description;
        }

        @Override
        public final Integer value() {
            return value;
        }

        @Override
        public final String description() {
            return description;
        }

        public static final EdsBatteryQuality enumOfName( final String name ) {
            return (EdsBatteryQuality) CanonConstants.enumOfName( EdsBatteryQuality.class, name );
        }

        public static final EdsBatteryQuality enumOfValue( final int value ) {
            return (EdsBatteryQuality) CanonConstants.enumOfValue( EdsBatteryQuality.class, value );
        }
        public static final EdsBatteryQuality enumOfDescription( final String description ) {
            return (EdsBatteryQuality) CanonConstants.enumOfDescription( EdsBatteryQuality.class, description );
        }
    }

    /**
     * Drive Mode Values
     * See: API Reference - 5.2.18 kEdsPropID_DriveMode
     */
    public enum EdsDriveMode implements DescriptiveEnum {
        kEdsDriveMode_SingleFrame( 0x00000000, "Single-Frame Shooting" ),
        kEdsDriveMode_Continuous( 0x00000001, "Continuous Shooting" ),
        kEdsDriveMode_Video( 0x00000002, "Video" ),
        kEdsDriveMode_NotUsed( 0x00000003, "Not used" ),
        kEdsDriveMode_HighSpeedContinuous( 0x00000004, "High-Speed Continuous Shooting" ),
        kEdsDriveMode_LowSpeedContinuous( 0x00000005, "Low-Speed Continuous Shooting" ),
        kEdsDriveMode_SilentSingleFrame( 0x00000006, "Silent single shooting" ),
        kEdsDriveMode_10SecSelfTimerWithContinuous( 0x00000007, "10-Sec Self-Timer + Continuous Shooting" ),
        kEdsDriveMode_10SecSelfTimer( 0x00000010, "10-Sec Self-Timer" ),
        kEdsDriveMode_2SecSelfTimer( 0x00000011, "2-Sec Self-Timer" );

        private final int value;
        private final String description;

        EdsDriveMode( final int value, final String description ) {
            this.value = value;
            this.description = description;
        }

        @Override
        public final Integer value() {
            return value;
        }

        @Override
        public final String description() {
            return description;
        }

        public static final EdsDriveMode enumOfName( final String name ) {
            return (EdsDriveMode) CanonConstants.enumOfName( EdsDriveMode.class, name );
        }

        public static final EdsDriveMode enumOfValue( final int value ) {
            return (EdsDriveMode) CanonConstants.enumOfValue( EdsDriveMode.class, value );
        }

        public static final EdsDriveMode enumOfDescription( final String description ) {
            return (EdsDriveMode) CanonConstants.enumOfDescription( EdsDriveMode.class, description );
        }
    }

    /**
     * ISO Values
     * See: API Reference - 5.2.19 kEdsPropID_ISOSpeed
     * These values are taken from multiple EDSDK API Docs. Some values are
     * added are removed as support for cameras are added or removed
     */
    public enum EdsISOSpeed implements DescriptiveEnum {
        kEdsISOSpeed_Auto( 0x0, "Auto" ),
        kEdsISOSpeed_6( 0x28, "6" ),
        kEdsISOSpeed_12( 0x30, "12" ),
        kEdsISOSpeed_25( 0x38, "25" ),
        kEdsISOSpeed_50( 0x40, "50" ),
        kEdsISOSpeed_100( 0x48, "100" ),
        kEdsISOSpeed_125( 0x4B, "125" ),
        kEdsISOSpeed_160( 0x4D, "160" ),
        kEdsISOSpeed_200( 0x50, "200" ),
        kEdsISOSpeed_250( 0x53, "250" ),
        kEdsISOSpeed_320( 0x55, "320" ),
        kEdsISOSpeed_400( 0x58, "400" ),
        kEdsISOSpeed_500( 0x5B, "500" ),
        kEdsISOSpeed_640( 0x5D, "640" ),
        kEdsISOSpeed_800( 0x60, "800" ),
        kEdsISOSpeed_1000( 0x63, "1000" ),
        kEdsISOSpeed_1250( 0x65, "1250" ),
        kEdsISOSpeed_1600( 0x68, "1600" ),
        kEdsISOSpeed_2000( 0x6b, "2000" ),
        kEdsISOSpeed_2500( 0x6d, "2500" ),
        kEdsISOSpeed_3200( 0x70, "3200" ),
        kEdsISOSpeed_4000( 0x73, "4000" ),
        kEdsISOSpeed_5000( 0x75, "5000" ),
        kEdsISOSpeed_6400( 0x78, "6400" ),
        kEdsISOSpeed_8000( 0x7b, "8000" ),
        kEdsISOSpeed_10000( 0x7d, "10000" ),
        kEdsISOSpeed_12800( 0x80, "12800" ),
        kEdsISOSpeed_25600( 0x88, "25600" ),
        kEdsISOSpeed_51200( 0x90, "51200" ),
        kEdsISOSpeed_102400( 0x98, "102400" ),
        kEdsISOSpeed_Unknown( 0xFFFFFFFF, "Not valid/no settings changes" );
        private final int value;
        private final String description;

        EdsISOSpeed( final int value, final String description ) {
            this.value = value;
            this.description = description;
        public final Integer value() {
            return value;
        }

        @Override
        public final String description() {
            return description;
        }

        public static final EdsISOSpeed enumOfName( final String name ) {
            return (EdsISOSpeed) CanonConstants.enumOfName( EdsISOSpeed.class, name );
        }

        public static final EdsISOSpeed enumOfValue( final int value ) {
            return (EdsISOSpeed) CanonConstants.enumOfValue( EdsISOSpeed.class, value );
        }

        public static final EdsISOSpeed enumOfDescription( final String description ) {
            return (EdsISOSpeed) CanonConstants.enumOfDescription( EdsISOSpeed.class, description );
        }
    }

    /**
     * Metering Mode Values
     * See: API Reference - 5.2.20 kEdsPropID_MeteringMode
     */
    public enum EdsMeteringMode implements DescriptiveEnum {
        kEdsMeteringMode_Spot( 1, "Spot metering" ),
        kEdsMeteringMode_Evaluative( 3, "Evaluative metering" ),
        kEdsMeteringMode_Partial( 4, "Partial metering" ),
        kEdsMeteringMode_CenterWeightedAvg( 5, "Center-weighted averaging metering" ),
        kEdsMeteringMode_Unknown( 0xFFFFFFFF, "Not valid/no settings changes" );

        private final int value;
        private final String description;

        EdsMeteringMode( final int value, final String description ) {
            this.value = value;
            this.description = description;
        }

        @Override
        public final Integer value() {
            return value;
        }

        @Override
        public final String description() {
            return description;
        }

        public static final EdsMeteringMode enumOfName( final String name ) {
            return (EdsMeteringMode) CanonConstants.enumOfName( EdsMeteringMode.class, name );
        }

        public static final EdsMeteringMode enumOfValue( final int value ) {
            return (EdsMeteringMode) CanonConstants.enumOfValue( EdsMeteringMode.class, value );
        }

        public static final EdsMeteringMode enumOfDescription( final String description ) {
            return (EdsMeteringMode) CanonConstants.enumOfDescription( EdsMeteringMode.class, description );
        }
    }

    /**
     * Auto-Focus Mode Values
     * See: API Reference - 5.2.21 kEdsPropID_AFMode
     * Note: Read-only
     */
    public enum EdsAFMode implements DescriptiveEnum {
        kEdsAFMode_OneShot( 0, "One-Shot AF" ),
        kEdsAFMode_AIServo( 1, "AI Servo AF" ),
        kEdsAFMode_AIFocus( 2, "AI Focus AF" ),
        kEdsAFMode_Manual( 3, "Manual Focus" ),
        kEdsAFMode_Unknown( 0xFFFFFFFF, "Not valid/no settings changes" );

        private final int value;
        private final String description;

        EdsAFMode( final int value, final String description ) {
            this.value = value;
            this.description = description;
        }

        @Override
        public final Integer value() {
            return value;
        }

        @Override
        public final String description() {
            return description;
        }

        public static final EdsAFMode enumOfName( final String name ) {
            return (EdsAFMode) CanonConstants.enumOfName( EdsAFMode.class, name );
        }

        @Override
        public static final EdsAFMode enumOfValue( final int value ) {
            return (EdsAFMode) CanonConstants.enumOfValue( EdsAFMode.class, value );
        }

        public static final EdsAFMode enumOfDescription( final String description ) {
            return (EdsAFMode) CanonConstants.enumOfDescription( EdsAFMode.class, description );
        }
    }

    /**
     * Aperture Values
     * See: API Reference - 5.2.22 kEdsPropID_Av
     * Note: EdsAv names ending with 'b' represent aperture values when the
     * exposure step set in the Custom Function is 1/3 instead of 1/2.
     */
    public enum EdsAv implements DescriptiveEnum {
        kEdsAv_1( 0x08, "1" ),
        kEdsAv_1_1( 0x0B, "1.1" ),
        kEdsAv_1_2( 0x0C, "1.2" ),
        kEdsAv_1_2b( 0x0D, "1.2 (1/3)" ),
        kEdsAv_1_4( 0x10, "1.4" ),
        kEdsAv_1_6( 0x13, "1.6" ),
        kEdsAv_1_8( 0x14, "1.8" ),
        kEdsAv_1_8b( 0x15, "1.8 (1/3)" ),
        kEdsAv_2( 0x18, "2" ),
        kEdsAv_2_2( 0x1B, "2.2" ),
        kEdsAv_2_5( 0x1C, "2.5" ),
        kEdsAv_2_5b( 0x1D, "2.5 (1/3)" ),
        kEdsAv_2_8( 0x20, "2.8" ),
        kEdsAv_3_2( 0x23, "3.2" ),
        kEdsAv_3_5( 0x24, "3.5" ),
        kEdsAv_3_5b( 0x25, "3.5 (1/3)" ),
        kEdsAv_4( 0x28, "4" ),
        // both 0x2B and 0x2C labeled '4.5' in EDSDK API docs, 1/3 value determined by camera reading
        kEdsAv_4_5b( 0x2B, "4.5 (1/3)" ),
        kEdsAv_4_5( 0x2C, "4.5" ),
        kEdsAv_5_0( 0x2D, "5.0" ),
        kEdsAv_5_6( 0x30, "5.6" ),
        kEdsAv_6_3( 0x33, "6.3" ),
        kEdsAv_6_7( 0x34, "6.7" ),
        kEdsAv_7_1( 0x35, "7.1" ),
        kEdsAv_8( 0x38, "8" ),
        kEdsAv_9( 0x3B, "9" ),
        kEdsAv_9_5( 0x3C, "9.5" ),
        kEdsAv_10( 0x3D, "10" ),
        kEdsAv_11( 0x40, "11" ),
        kEdsAv_13b( 0x43, "13 (1/3)" ),
        kEdsAv_13( 0x44, "13" ),
        kEdsAv_14( 0x45, "14" ),
        kEdsAv_16( 0x48, "16" ),
        kEdsAv_18( 0x4B, "18" ),
        kEdsAv_19( 0x4C, "19" ),
        kEdsAv_20( 0x4D, "20" ),
        kEdsAv_22( 0x50, "22" ),
        kEdsAv_25( 0x53, "25" ),
        kEdsAv_27( 0x54, "27" ),
        kEdsAv_29( 0x55, "29" ),
        kEdsAv_32( 0x58, "32" ),
        kEdsAv_36( 0x5B, "36" ),
        kEdsAv_38( 0x5C, "38" ),
        kEdsAv_40( 0x5D, "40" ),
        kEdsAv_45( 0x60, "45" ),
        kEdsAv_51( 0x63, "51" ),
        kEdsAv_54( 0x64, "54" ),
        kEdsAv_57( 0x65, "57" ),
        kEdsAv_64( 0x68, "64" ),
        kEdsAv_72( 0x6B, "72" ),
        kEdsAv_76( 0x6C, "76" ),
        kEdsAv_80( 0x6D, "80" ),
        kEdsAv_91( 0x70, "91" ),
        kEdsAv_Unknown( 0xFFFFFFFF, "Not valid/no settings changes" );

        private final int value;
        private final String description;

        EdsAv( final int value, final String description ) {
            this.value = value;
            this.description = description;
        }

        @Override
        public final Integer value() {
            return value;
        }

        @Override
        public final String description() {
            return description;
        }

        public static final EdsAv enumOfName( final String name ) {
            return (EdsAv) CanonConstants.enumOfName( EdsAv.class, name );
        }

        public static final EdsAv enumOfValue( final int value ) {
            return (EdsAv) CanonConstants.enumOfValue( EdsAv.class, value );
        }
        public static final EdsAv enumOfDescription( final String description ) {
            return (EdsAv) CanonConstants.enumOfDescription( EdsAv.class, description );
        }
    }

    /**
     * Shutter Speed Values
     * See: API Reference - 5.2.23 kEdsPropID_Tv
     * Note: EdsTv names ending with 'b' represent shutter speeds when the
     * exposure step set in the Custom Function is 1/3 instead of 1/2.
     */
    public enum EdsTv implements DescriptiveEnum {
        kEdsTv_BULB( 0x0C, "BULB" ),
        kEdsTv_30( 0x10, "30\"" ),
        kEdsTv_25( 0x13, "25\"" ),
        kEdsTv_20( 0x14, "20\"" ),
        kEdsTv_20b( 0x15, "20\" (1/3)" ),
        kEdsTv_15( 0x18, "15\"" ),
        kEdsTv_13( 0x1B, "13\"" ),
        kEdsTv_10( 0x1C, "10\"" ),
        kEdsTv_10b( 0x1D, "10\" (1/3)" ),
        kEdsTv_8( 0x20, "8\"" ),
        kEdsTv_6b( 0x23, "6\" (1/3)" ),
        kEdsTv_6( 0x24, "6\"" ),
        kEdsTv_5( 0x25, "5\"" ),
        kEdsTv_4( 0x28, "4\"" ),
        kEdsTv_3_2( 0x2B, "3\"2" ),
        kEdsTv_3( 0x2C, "3\"" ),
        kEdsTv_2_5( 0x2D, "2\"5" ),
        kEdsTv_2( 0x30, "2\"" ),
        kEdsTv_1_6( 0x33, "1\"6" ),
        kEdsTv_1_5( 0x34, "1\"5" ),
        kEdsTv_1_3( 0x35, "1\"3" ),
        kEdsTv_1( 0x38, "1\"" ),
        kEdsTv_0_8( 0x3B, "0\"8" ),
        kEdsTv_0_7( 0x3C, "0\"7" ),
        kEdsTv_0_6( 0x3D, "0\"6" ),
        kEdsTv_0_5( 0x40, "0\"5" ),
        kEdsTv_0_4( 0x43, "0\"4" ),
        kEdsTv_0_3( 0x44, "0\"3" ),
        kEdsTv_0_3b( 0x45, "0\"3 (1/3)" ),
        kEdsTv_1by4( 0x48, "1/4" ),
        kEdsTv_1by5( 0x4B, "1/5" ),
        kEdsTv_1by6( 0x4C, "1/6" ),
        kEdsTv_1by6b( 0x4D, "1/6 (1/3)" ),
        kEdsTv_1by8( 0x50, "1/8" ),
        kEdsTv_1by10b( 0x53, "1/10 (1/3)" ),
        kEdsTv_1by10( 0x54, "1/10" ),
        kEdsTv_1by13( 0x55, "1/13" ),
        kEdsTv_1by15( 0x58, "1/15" ),
        kEdsTv_1by20b( 0x5B, "1/20 (1/3)" ),
        kEdsTv_1by20( 0x5C, "1/20" ),
        kEdsTv_1by25( 0x5D, "1/25" ),
        kEdsTv_1by30( 0x60, "1/30" ),
        kEdsTv_1by40( 0x63, "1/40" ),
        kEdsTv_1by45( 0x64, "1/45" ),
        kEdsTv_1by50( 0x65, "1/50" ),
        kEdsTv_1by60( 0x68, "1/60" ),
        kEdsTv_1by80( 0x6B, "1/80" ),
        kEdsTv_1by90( 0x6C, "1/90" ),
        kEdsTv_1by100( 0x6D, "1/100" ),
        kEdsTv_1by125( 0x70, "1/125" ),
        kEdsTv_1by160( 0x73, "1/160" ),
        kEdsTv_1by180( 0x74, "1/180" ),
        kEdsTv_1by200( 0x75, "1/200" ),
        kEdsTv_1by250( 0x78, "1/250" ),
        kEdsTv_1by320( 0x7B, "1/320" ),
        kEdsTv_1by350( 0x7C, "1/350" ),
        kEdsTv_1by400( 0x7D, "1/400" ),
        kEdsTv_1by500( 0x80, "1/500" ),
        kEdsTv_1by640( 0x83, "1/640" ),
        kEdsTv_1by750( 0x84, "1/750" ),
        kEdsTv_1by800( 0x85, "1/800" ),
        kEdsTv_1by1000( 0x88, "1/1000" ),
        kEdsTv_1by1250( 0x8B, "1/1250" ),
        kEdsTv_1by1500( 0x8C, "1/1500" ),
        kEdsTv_1by1600( 0x8D, "1/1600" ),
        kEdsTv_1by2000( 0x90, "1/2000" ),
        kEdsTv_1by2500( 0x93, "1/2500" ),
        kEdsTv_1by3000( 0x94, "1/3000" ),
        kEdsTv_1by3200( 0x95, "1/3200" ),
        kEdsTv_1by4000( 0x98, "1/4000" ),
        kEdsTv_1by5000( 0x9B, "1/5000" ),
        kEdsTv_1by6000( 0x9C, "1/6000" ),
        kEdsTv_1by6400( 0x9D, "1/6400" ),
        kEdsTv_1by8000( 0xA0, "1/8000" ),
        kEdsTv_Unknown( 0xFFFFFFFF, "Not valid/no settings changes" );

        private final int value;
        private final String description;

        EdsTv( final int value, final String description ) {
            this.value = value;
            this.description = description;
        }
        public final Integer value() {
            return value;
        }

        @Override
        public final String description() {
            return description;
        }

        public static final EdsTv enumOfName( final String name ) {
            return (EdsTv) CanonConstants.enumOfName( EdsTv.class, name );
        }

        public static final EdsTv enumOfValue( final int value ) {
            return (EdsTv) CanonConstants.enumOfValue( EdsTv.class, value );
        }

        public static final EdsTv enumOfDescription( final String description ) {
            return (EdsTv) CanonConstants.enumOfDescription( EdsTv.class, description );
        }
    }

    /**
     * Exposure Compensation Values (Same as Flash Compensation Values)
     * See: API Reference - 5.2.24 kEdsPropID_ExposureCompensation
     * 5.2.26 kEdsPropID_FlashCompensation
     */
    public enum EdsExposureCompensation implements DescriptiveEnum {
        /*
         * These extra values were available on a 550D camera and for some
         * reason are not described in the EDSDK documentation
         */
        kEdsExposureCompensation_5( 0x28, "+5" ),
        kEdsExposureCompensation_4_2by3( 0x25, "+4 2/3" ),
        kEdsExposureCompensation_4_1by2( 0x24, "+4 1/2" ),
        kEdsExposureCompensation_4_1by3( 0x23, "+4 1/3" ),
        kEdsExposureCompensation_4( 0x20, "+4" ),
        kEdsExposureCompensation_3_2by3( 0x1D, "+3 2/3" ),
        kEdsExposureCompensation_3_1by2( 0x1C, "+3 1/2" ),
        kEdsExposureCompensation_3_1by3( 0x1B, "+3 1/3" ),

        /* This group was defined in the EDSDK documentation */
        kEdsExposureCompensation_3( 0x18, "+3" ),
        kEdsExposureCompensation_2_2by3( 0x15, "+2 2/3" ),
        kEdsExposureCompensation_2_1by2( 0x14, "+2 1/2" ),
        kEdsExposureCompensation_2_1by3( 0x13, "+2 1/3" ),
        kEdsExposureCompensation_2( 0x10, "+2" ),
        kEdsExposureCompensation_1_2by3( 0x0D, "+1 2/3" ),
        kEdsExposureCompensation_1_1by2( 0x0C, "+1 1/2" ),
        kEdsExposureCompensation_1_1by3( 0x0B, "+1 1/3" ),
        kEdsExposureCompensation_1( 0x08, "+1" ),
        kEdsExposureCompensation_2by3( 0x05, "+2/3" ),
        kEdsExposureCompensation_1by2( 0x04, "+1/2" ),
        kEdsExposureCompensation_1by3( 0x03, "+1/3" ),
        kEdsExposureCompensation_0( 0x00, "0" ),
        kEdsExposureCompensation_n1by3( 0xFD, "-1/3" ),
        kEdsExposureCompensation_n1by2( 0xFC, "-1/2" ),
        kEdsExposureCompensation_n2by3( 0xFB, "-2/3" ),
        kEdsExposureCompensation_n1( 0xF8, "-1" ),
        kEdsExposureCompensation_n1_1by3( 0xF5, "-1 1/3" ),
        kEdsExposureCompensation_n1_1by2( 0xF4, "-1 1/2" ),
        kEdsExposureCompensation_n1_2by3( 0xF3, "-1 2/3" ),
        kEdsExposureCompensation_n2( 0xF0, "-2" ),
        kEdsExposureCompensation_n2_1by3( 0xED, "-2 1/3" ),
        kEdsExposureCompensation_n2_1by2( 0xEC, "-2 1/2" ),
        kEdsExposureCompensation_n2_2by3( 0xEB, "-2 2/3" ),
        kEdsExposureCompensation_n3( 0xE8, "-3" ),

        /*
         * These extra values were available on a 550D camera and for some
         * reason are not described in the EDSDK documentation
         */
        kEdsExposureCompensation_n3_1by3( 0xE5, "-3 1/3" ),
        kEdsExposureCompensation_n3_1by2( 0xE4, "-3 1/2" ),
        kEdsExposureCompensation_n3_2by3( 0xE3, "-3 2/3" ),
        kEdsExposureCompensation_n4( 0xE0, "-4" ),
        kEdsExposureCompensation_n4_1by3( 0xDD, "-4 1/3" ),
        kEdsExposureCompensation_n4_1by2( 0xDC, "-4 1/2" ),
        kEdsExposureCompensation_n4_2by3( 0xDB, "-4 2/3" ),
        kEdsExposureCompensation_n5( 0xD8, "-5" ),

        /* This was defined in the EDSDK documentation */
        kEdsExposureCompensation_Unknown( 0xFFFFFFFF, "Not valid/no settings changes" );

        private final int value;
        private final String description;


        EdsExposureCompensation( final int value, final String description ) {
            this.value = value;
            this.description = description;
        }

        @Override
        public final Integer value() {
            return value;
        }

        @Override
        public final String description() {
            return description;
        }

        public static final EdsExposureCompensation enumOfName( final String name ) {
            return (EdsExposureCompensation) CanonConstants.enumOfName( EdsExposureCompensation.class, name );
        }

        public static final EdsExposureCompensation enumOfValue( final int value ) {
            return (EdsExposureCompensation) CanonConstants.enumOfValue( EdsExposureCompensation.class, value );
        }

        public static final EdsExposureCompensation enumOfDescription( final String description ) {
            return (EdsExposureCompensation) CanonConstants.enumOfDescription( EdsExposureCompensation.class, description );
        }
    }

    /**
     * Live View Histogram Status
     * See: API Reference - 5.2.77 kEdsPropID_Evf_HistogramStatus
     */
    public enum EdsEvfHistogramStatus implements DescriptiveEnum {
        kEdsEvfHistogramStatus_Hide( 0, "Hide" ),
        kEdsEvfHistogramStatus_Normal( 0, "Display" ),
        kEdsEvfHistogramStatus_Grayout( 0, "Gray Out" );

        private final int value;
        private final String description;

        EdsEvfHistogramStatus( final int value, final String description ) {
            this.value = value;
            this.description = description;
        }

        @Override
        public final Integer value() {
            return value;
        }

        @Override
        public final String description() {
            return description;
        }

        public static final EdsEvfHistogramStatus enumOfName( final String name ) {
            return (EdsEvfHistogramStatus) CanonConstants.enumOfName( EdsEvfHistogramStatus.class, name );
        }

        public static final EdsEvfHistogramStatus enumOfValue( final int value ) {
            return (EdsEvfHistogramStatus) CanonConstants.enumOfValue( EdsEvfHistogramStatus.class, value );
        }

        public static final EdsEvfHistogramStatus enumOfDescription( final String description ) {
            return (EdsEvfHistogramStatus) CanonConstants.enumOfDescription( EdsEvfHistogramStatus.class, description );
        }
    }

    /**
     * Custom Function Values
     * Value passed as a 'param' to getPropertyData or setPropertyData
     * 
     * Data values given in comments are for Canon EOS 550D
     * 
     * 0x1xx = C.Fn I :Exposure
     * 0x2xx = C.Fn II :Image
     * 0x5xx = C.Fn III :Autofocus/Drive
     * 0x6xx = C.Fn III :Autofocus/Drive
     * 0x7xx = C.Fn IV :Operation/Others
     * 0x8xx = C.Fn IV :Operation/Others
     * 
     */
    public enum EdsCustomFunction implements DescriptiveEnum {
        kEdsCustomFunction_ExposureIncrements( 0x101, "Exposure level increments" ), // 0:1/3-stop, 1:1/2-stop
        kEdsCustomFunction_ISOExpansion( 0x103, "ISO Expansion" ), // 0:Off, 1:On
        kEdsCustomFunction_FlashSyncSpeed( 0x10F, "Flash sync. speed in Av mode" ), // 0:Auto, 1:1/200-1/60sec. auto, 2:1/200sec. (fixed)
        kEdsCustomFunction_LongExpNoiseReduction( 0x201, "Long exp. noise reduction" ), // 0:Off, 1:Auto, 2:On
        kEdsCustomFunction_HighISONoiseReduction( 0x202, "High ISO speed noise reduct'n" ), // 0:Standard, 1:Low, 2:Strong, 3:Disable
        kEdsCustomFunction_HighlighTonePriority( 0x203, "Highlight tone priority" ), // 0:Disable, 1:Enable
        kEdsCustomFunction_AFAssistBeam( 0x50E, "AF-assist beam firing" ), // 0:Enable, 1:Disable, 2:Enable external flash only, 3:IR AF assist beam only
        kEdsCustomFunction_MirrorLockup( 0x60F, "Mirror lockup" ), // 0:Disable, 1:Enable
        kEdsCustomFunction_ShutterAELockButton( 0x701, "Shutter/AE lock button" ), // 0:AF/AE lock, 1:AE lock/AF, 2:AF/AF lock, no AE lock, 3:AE/AF, no AE lock
        kEdsCustomFunction_AssignSETButton( 0x704, "Assign SET button" ), // 0:Normal (disabled), 1:Image quality, 2:Flash exposure comp., 3:LCD monitor On/Off, 4:Menu display, 5:ISO speed
        kEdsCustomFunction_LCDDisplayWhenOn( 0x80F, "LCD display when power ON" ), // 0:Display on, 1:Previous display status
        kEdsCustomFunction_AddVerificationData( 0x811, "Add image verification data" ); // 0:Disable, 1:Enable

        private final int value;
        private final String description;

        EdsCustomFunction( final int value, final String description ) {
            this.value = value;
            this.description = description;
        }

        @Override
        public final Integer value() {
            return value;
        }

        @Override
        public final String description() {
            return description;
        }

        public static final EdsCustomFunction enumOfName( final String name ) {
            return (EdsCustomFunction) CanonConstants.enumOfName( EdsCustomFunction.class, name );
        }

        public static final EdsCustomFunction enumOfValue( final int value ) {
            return (EdsCustomFunction) CanonConstants.enumOfValue( EdsCustomFunction.class, value );
        }

        public static final EdsCustomFunction enumOfDescription( final String description ) {
            return (EdsCustomFunction) CanonConstants.enumOfDescription( EdsCustomFunction.class, description );
        }
    }

    /******************************************************************************
     * Definition of Constants
     ******************************************************************************/

    public enum EdsConstant implements DescriptiveEnum {
        EDS_MAX_NAME( "Maximum File Name Length" ),
        EDS_TRANSFER_BLOCK_SIZE( "Transfer Block Size" );

        private final int value;
        private final String description;

        EdsConstant( final String description ) {
            value = CanonUtils.classIntField( EdSdkLibrary.class, name() );
            this.description = description;
        }

        @Override
        public final Integer value() {
            return value;
        }

        @Override
        public final String description() {
            return description;
        }

        public static final EdsConstant enumOfName( final String name ) {
            return (EdsConstant) CanonConstants.enumOfName( EdsConstant.class, name );
        }

        public static final EdsConstant enumOfValue( final int value ) {
            return (EdsConstant) CanonConstants.enumOfValue( EdsConstant.class, value );
        }

        public static final EdsConstant enumOfDescription( final String description ) {
            return (EdsConstant) CanonConstants.enumOfDescription( EdsConstant.class, description );
        }

    }

    /******************************************************************************
     * Definition of Error Codes
     ******************************************************************************/

        }
    public enum EdsError implements DescriptiveEnum {
        /*-----------------------------------------------------------------------
        ED-SDK Error Code Masks
         ------------------------------------------------------------------------*/
        EDS_ISSPECIFIC_MASK( "IS Specific Mask" ),
        EDS_COMPONENTID_MASK( "Component ID Mask" ),

        EDS_RESERVED_MASK( "Reserved Mask" ),
        EDS_ERRORID_MASK( "Error ID Mask" ),

        /*-----------------------------------------------------------------------
           ED-SDK Base Component IDs
        ------------------------------------------------------------------------*/
        EDS_CMP_ID_CLIENT_COMPONENTID( "Component ID Client" ),
        EDS_CMP_ID_LLSDK_COMPONENTID( "Component ID LLSDK" ),
        EDS_CMP_ID_HLSDK_COMPONENTID( "Component ID HLSDK" ),

        /*-----------------------------------------------------------------------
           ED-SDK Function Success Code
        ------------------------------------------------------------------------*/
        EDS_ERR_OK( "Success, No Errors" ),

        /*-----------------------------------------------------------------------
           ED-SDK Generic Error IDs
        ------------------------------------------------------------------------*/
        /* Miscellaneous errors */
        EDS_ERR_UNIMPLEMENTED( "Unimplemented" ),
        EDS_ERR_INTERNAL_ERROR( "Internal Error" ),
        EDS_ERR_MEM_ALLOC_FAILED( "Memory Allocation Failed" ),
        EDS_ERR_MEM_FREE_FAILED( "Memory Release Failed" ),
        EDS_ERR_OPERATION_CANCELLED( "Operation Cancelled" ),
        EDS_ERR_INCOMPATIBLE_VERSION( "Incompatible Version" ),
        EDS_ERR_NOT_SUPPORTED( "Not Supported" ),
        EDS_ERR_UNEXPECTED_EXCEPTION( "Unexpected Exception" ),
        EDS_ERR_PROTECTION_VIOLATION( "Protection Violation" ),
        EDS_ERR_MISSING_SUBCOMPONENT( "Missing Subcomponent" ),
        EDS_ERR_SELECTION_UNAVAILABLE( "Selection Unavailable" ),

        /* File errors */
        EDS_ERR_FILE_IO_ERROR( "File I/O Error" ),
        EDS_ERR_FILE_TOO_MANY_OPEN( "Too Many Files Open" ),
        EDS_ERR_FILE_NOT_FOUND( "File Not Found" ),
        EDS_ERR_FILE_OPEN_ERROR( "File Open Error" ),
        EDS_ERR_FILE_CLOSE_ERROR( "File Close Error" ),
        EDS_ERR_FILE_SEEK_ERROR( "File Seek Error" ),
        EDS_ERR_FILE_TELL_ERROR( "File Tell Error" ),
        EDS_ERR_FILE_READ_ERROR( "File Read Error" ),
        EDS_ERR_FILE_WRITE_ERROR( "File Write Error" ),
        EDS_ERR_FILE_PERMISSION_ERROR( "File Permission Error" ),
        EDS_ERR_FILE_DISK_FULL_ERROR( "Disk Full Error" ),
        EDS_ERR_FILE_ALREADY_EXISTS( "File Already Exists" ),
        EDS_ERR_FILE_FORMAT_UNRECOGNIZED( "File Format Not Recognized" ),
        EDS_ERR_FILE_DATA_CORRUPT( "File Data Corrupt" ),
        EDS_ERR_FILE_NAMING_NA( "File Naming Error" ),

        /* Directory errors */
        EDS_ERR_DIR_NOT_FOUND( "Directory Does Not Exist" ),
        EDS_ERR_DIR_IO_ERROR( "Directory I/O Error" ),
        EDS_ERR_DIR_ENTRY_NOT_FOUND( "No Files In Directory" ),
        EDS_ERR_DIR_ENTRY_EXISTS( "Directory Contains Files" ),
        EDS_ERR_DIR_NOT_EMPTY( "Directory Full" ),

        /* Property errors */
        EDS_ERR_PROPERTIES_UNAVAILABLE( "Property Unavailable" ),
        EDS_ERR_PROPERTIES_MISMATCH( "Property Mismatch" ),
        EDS_ERR_PROPERTIES_NOT_LOADED( "Property Not Loaded" ),

        /* Function Parameter errors */
        EDS_ERR_INVALID_PARAMETER( "Invalid Function Parameter" ),
        EDS_ERR_INVALID_HANDLE( "Function Handle Error" ),
        EDS_ERR_INVALID_POINTER( "Function Pointer Error" ),
        EDS_ERR_INVALID_INDEX( "Function Index Error" ),
        EDS_ERR_INVALID_LENGTH( "Function Length Error" ),
        EDS_ERR_INVALID_FN_POINTER( "Function FN Pointer Error" ),
        EDS_ERR_INVALID_SORT_FN( "Function Sort FN Error" ),

        /* Device errors */
        EDS_ERR_DEVICE_NOT_FOUND( "Device Not Found" ),
        EDS_ERR_DEVICE_BUSY( "Device Busy" ),
        EDS_ERR_DEVICE_INVALID( "Device Error" ),
        EDS_ERR_DEVICE_EMERGENCY( "Device Emergency" ),
        EDS_ERR_DEVICE_MEMORY_FULL( "Device Memory Full" ),
        EDS_ERR_DEVICE_INTERNAL_ERROR( "Internal Device Error" ),
        EDS_ERR_DEVICE_INVALID_PARAMETER( "Invalid Device Parameter" ),
        EDS_ERR_DEVICE_NO_DISK( "No Device Disk" ),
        EDS_ERR_DEVICE_DISK_ERROR( "Device Disk Error" ),
        EDS_ERR_DEVICE_CF_GATE_CHANGED( "Device CF Gate Changed" ),
        EDS_ERR_DEVICE_DIAL_CHANGED( "Device Dial Changed" ),
            return description;
        EDS_ERR_DEVICE_NOT_INSTALLED( "Device Not Installed" ),
        EDS_ERR_DEVICE_STAY_AWAKE( "Device Connect In Awake Mode" ),
        EDS_ERR_DEVICE_NOT_RELEASED( "Device Not Released" ),

        /* Stream errors */
        EDS_ERR_STREAM_IO_ERROR( "Stream I/O Error" ),
        EDS_ERR_STREAM_NOT_OPEN( "Stream Not Open" ),
        EDS_ERR_STREAM_ALREADY_OPEN( "Stream Already Open" ),
        EDS_ERR_STREAM_OPEN_ERROR( "Stream Open Error" ),
        EDS_ERR_STREAM_CLOSE_ERROR( "Stream Close Error" ),
        EDS_ERR_STREAM_SEEK_ERROR( "Stream Seek Error" ),
        EDS_ERR_STREAM_TELL_ERROR( "Stream Tell Error" ),
        EDS_ERR_STREAM_READ_ERROR( "Stream Read Error" ),
        EDS_ERR_STREAM_WRITE_ERROR( "Stream Write Error" ),
        EDS_ERR_STREAM_PERMISSION_ERROR( "Stream Permission Error" ),
        EDS_ERR_STREAM_COULDNT_BEGIN_THREAD( "Stream Could Not Start Reading Thumbnail" ),
        EDS_ERR_STREAM_BAD_OPTIONS( "Invalid Stream Options" ),
        EDS_ERR_STREAM_END_OF_STREAM( "Invalid Stream Termination" ),

        /* Communications errors */
        EDS_ERR_COMM_PORT_IS_IN_USE( "Communication Port In Use" ),
        EDS_ERR_COMM_DISCONNECTED( "Communication Port Disconnected" ),
        EDS_ERR_COMM_DEVICE_INCOMPATIBLE( "Communication Device Incompatible" ),
        EDS_ERR_COMM_BUFFER_FULL( "Communication Buffer Full" ),
        EDS_ERR_COMM_USB_BUS_ERR( "USB Bus Error" ),

        /* Lock/Unlock */
        EDS_ERR_USB_DEVICE_LOCK_ERROR( "Failed To Lock The UI" ),
        EDS_ERR_USB_DEVICE_UNLOCK_ERROR( "Failed To Unlock The UI" ),

        /* STI/WIA */
        EDS_ERR_STI_UNKNOWN_ERROR( "Unknown STI" ),
        EDS_ERR_STI_INTERNAL_ERROR( "Internal STI Error" ),
        EDS_ERR_STI_DEVICE_CREATE_ERROR( "STI Device Creation Error" ),
        EDS_ERR_STI_DEVICE_RELEASE_ERROR( "STI Device Release Error" ),
        EDS_ERR_DEVICE_NOT_LAUNCHED( "Device Start-up Failed" ),

        EDS_ERR_ENUM_NA( "Enumeration Terminated" ),
        EDS_ERR_INVALID_FN_CALL( "Function Call Made In Incompatible Mode" ),
        EDS_ERR_HANDLE_NOT_FOUND( "Handle Not Found" ),
        EDS_ERR_INVALID_ID( "Invalid ID" ),
        EDS_ERR_WAIT_TIMEOUT_ERROR( "Timeout" ),

        /* PTP */
        EDS_ERR_SESSION_NOT_OPEN( "Session Open Error" ),
        EDS_ERR_INVALID_TRANSACTIONID( "Invalid Transaction ID" ),
        EDS_ERR_INCOMPLETE_TRANSFER( "Transfer Incomplete" ),
        EDS_ERR_INVALID_STRAGEID( "Invalid Storage ID" ),
        EDS_ERR_DEVICEPROP_NOT_SUPPORTED( "Unsupported Device Property" ),
        EDS_ERR_INVALID_OBJECTFORMATCODE( "Invalid Object Format Code" ),
        EDS_ERR_SELF_TEST_FAILED( "Failed Self-Diagnosis" ),
        EDS_ERR_PARTIAL_DELETION( "Partial Deletion Failed" ),
        EDS_ERR_SPECIFICATION_BY_FORMAT_UNSUPPORTED( "Unsupported Format Specification" ),
        EDS_ERR_NO_VALID_OBJECTINFO( "Invalid Object Information" ),
        EDS_ERR_INVALID_CODE_FORMAT( "Invalid Code Format" ),
        EDS_ERR_UNKNOWN_VENDOR_CODE( "Unknown Vendor Code" ),
        EDS_ERR_CAPTURE_ALREADY_TERMINATED( "Capture Already Terminated" ),
        EDS_ERR_INVALID_PARENTOBJECT( "Invalid Parent Object" ),
        EDS_ERR_INVALID_DEVICEPROP_FORMAT( "Invalid Device Property Format" ),
        EDS_ERR_INVALID_DEVICEPROP_VALUE( "Invalid Device Property Value" ),
        EDS_ERR_SESSION_ALREADY_OPEN( "Session Already Open" ),
        EDS_ERR_TRANSACTION_CANCELLED( "Transaction Cancelled" ),
        EDS_ERR_SPECIFICATION_OF_DESTINATION_UNSUPPORTED( "Unsupported Destination Specification" ),

        /* PTP Vendor */
        EDS_ERR_UNKNOWN_COMMAND( "Unknown Command" ),
        EDS_ERR_OPERATION_REFUSED( "Operation Refused" ),
        EDS_ERR_LENS_COVER_CLOSE( "Lens Cover Closed" ),
        EDS_ERR_LOW_BATTERY( "Low Battery" ),
        EDS_ERR_OBJECT_NOTREADY( "Live View Image Data Set Not Ready" ),
        EDS_ERR_CANNOT_MAKE_OBJECT( "Cannot Make Object" ),

        /* Take Picture errors */
        EDS_ERR_TAKE_PICTURE_AF_NG( "Focus Failed" ),
        EDS_ERR_TAKE_PICTURE_RESERVED( "Reserved" ),
        EDS_ERR_TAKE_PICTURE_MIRROR_UP_NG( "Currently Configuring Mirror Up" ),
        EDS_ERR_TAKE_PICTURE_SENSOR_CLEANING_NG( "Currently Cleaning Sensor" ),
        EDS_ERR_TAKE_PICTURE_SILENCE_NG( "Currently Performing Silent Operations" ),
        }

        EDS_ERR_TAKE_PICTURE_NO_CARD_NG( "Card Not Installed" ),
        EDS_ERR_TAKE_PICTURE_CARD_NG( "Error Writing To Card" ),
        EDS_ERR_TAKE_PICTURE_CARD_PROTECT_NG( "Card Write Protected" ),
        EDS_ERR_TAKE_PICTURE_MOVIE_CROP_NG( "Cropping Movie" ),
        EDS_ERR_TAKE_PICTURE_STROBO_CHARGE_NG( "Strobe Charging" ),

        EDS_ERR_LAST_GENERIC_ERROR_PLUS_ONE( "Not Used" );

        private final int value;
        private final String description;

        EdsError( final String description ) {
            value = CanonUtils.classIntField( EdSdkLibrary.class, name() );
            this.description = description;
        }

        @Override
        public final Integer value() {
            return value;
        }

        @Override
        public final String description() {
            return description;
        }

        public static final EdsError enumOfName( final String name ) {
            return (EdsError) CanonConstants.enumOfName( EdsError.class, name );
        }

        public static final EdsError enumOfValue( final int value ) {
            return (EdsError) CanonConstants.enumOfValue( EdsError.class, value );
        }

        public static final EdsError enumOfDescription( final String description ) {
            return (EdsError) CanonConstants.enumOfDescription( EdsError.class, description );
        }

    }

    /******************************************************************************
     * Definition of Data Types
     ******************************************************************************/
/*-----------------------------------------------------------------------------
 Data Types
 -----------------------------------------------------------------------------*/
    public enum EdsDataType implements DescriptiveEnum {
        kEdsDataType_Unknown( "Unknown" ),
        kEdsDataType_Bool( "EdsBool" ),
        kEdsDataType_String( "EdsChar[]" ),
        kEdsDataType_Int8( "EdsInt8" ),
        kEdsDataType_UInt8( "EdsUInt8" ),
        kEdsDataType_Int16( "EdsInt16" ),
        kEdsDataType_UInt16( "EdsUInt16" ),
        kEdsDataType_Int32( "EdsInt32" ),
        kEdsDataType_UInt32( "EdsUInt32" ),
        kEdsDataType_Int64( "EdsInt64" ),
        kEdsDataType_UInt64( "EdsUInt64" ),
        kEdsDataType_Float( "EdsFloat" ),
        kEdsDataType_Double( "EdsDouble" ),
        kEdsDataType_ByteBlock( "Byte Block" ), // According to API, is either EdsInt8[] or EdsUInt32[], but perhaps former is a typo or an old value
        kEdsDataType_Rational( "EdsRational" ),
        kEdsDataType_Point( "EdsPoint" ),
        kEdsDataType_Rect( "EdsRect" ),
        kEdsDataType_Time( "EdsTime" ),

        kEdsDataType_Bool_Array( "EdsBool[]" ),
        kEdsDataType_Int8_Array( "EdsInt8[]" ),
        kEdsDataType_Int16_Array( "EdsInt16[]" ),
        kEdsDataType_Int32_Array( "EdsInt32[]" ),
        kEdsDataType_UInt8_Array( "EdsUInt8[]" ),
        kEdsDataType_UInt16_Array( "EdsUInt16[]" ),
        kEdsDataType_UInt32_Array( "EdsUInt32[]" ),
        kEdsDataType_Rational_Array( "EdsRational[]" ),

        kEdsDataType_FocusInfo( "EdsFocusInfo" ),
        kEdsDataType_PictureStyleDesc( "EdsPictureStyleDesc" );

        private final int value;
        private final String description;

        EdsDataType( final String description ) {
            value = CanonUtils.classIntField( EdSdkLibrary.EdsDataType.class, name() );
            this.description = description;
        }

        @Override
        public final Integer value() {
            return value;
        }

        @Override
        public final String description() {
        public static final EdsDataType enumOfName( final String name ) {
            return (EdsDataType) CanonConstants.enumOfName( EdsDataType.class, name );
        }

        public static final EdsDataType enumOfValue( final int value ) {
            return (EdsDataType) CanonConstants.enumOfValue( EdsDataType.class, value );
        }

        public static final EdsDataType enumOfDescription( final String description ) {
            return (EdsDataType) CanonConstants.enumOfDescription( EdsDataType.class, description );
        }

    }

/*-----------------------------------------------------------------------------
 Property IDs
 -----------------------------------------------------------------------------*/
    public enum EdsPropertyID implements DescriptiveEnum {
        /*----------------------------------
        Camera Setting Properties
        ----------------------------------*/
        kEdsPropID_Unknown( "Unknown", EdsDataType.kEdsDataType_Unknown ),

        kEdsPropID_ProductName( "Product Name", EdsDataType.kEdsDataType_String ),
        kEdsPropID_OwnerName( "Owner Name", EdsDataType.kEdsDataType_String ),
        kEdsPropID_MakerName( "Maker Name", EdsDataType.kEdsDataType_String ),
        kEdsPropID_DateTime( "Date/Time", EdsDataType.kEdsDataType_Time ),
        kEdsPropID_FirmwareVersion( "Firmware Version", EdsDataType.kEdsDataType_String ),
        kEdsPropID_BatteryLevel( "Battery Level", EdsDataType.kEdsDataType_UInt32 ),
        kEdsPropID_CFn( "Custom Function #", EdsDataType.kEdsDataType_UInt32 ), // Not stated in the API, but all values seen on various cameras seem to be EdsUInt32
        kEdsPropID_SaveTo( "Save To", EdsDataType.kEdsDataType_UInt32 ),
        kEdsPropID_CurrentStorage( "Current Storage", EdsDataType.kEdsDataType_String ),
        kEdsPropID_CurrentFolder( "Current Folder", EdsDataType.kEdsDataType_String ),
        kEdsPropID_MyMenu( "My Menu", EdsDataType.kEdsDataType_UInt32_Array ),

        kEdsPropID_BatteryQuality( "Battery Quality", EdsDataType.kEdsDataType_UInt32 ),

        kEdsPropID_BodyIDEx( "Body ID Ex", EdsDataType.kEdsDataType_String ),
        kEdsPropID_HDDirectoryStructure( "Hard Drive Directory Structure", EdsDataType.kEdsDataType_String ),

        /*----------------------------------
        Image Properties
        ----------------------------------*/
        kEdsPropID_ImageQuality( "Image Quality", EdsDataType.kEdsDataType_UInt32 ),
        kEdsPropID_JpegQuality( "JPEG Quality", EdsDataType.kEdsDataType_UInt32 ),
        kEdsPropID_Orientation( "Orientation", EdsDataType.kEdsDataType_UInt32 ),
        kEdsPropID_ICCProfile( "ICC Profile", EdsDataType.kEdsDataType_ByteBlock ), // API lists EdsInt8[]
        kEdsPropID_FocusInfo( "Focus Info", EdsDataType.kEdsDataType_FocusInfo ),
        kEdsPropID_DigitalExposure( "Digital Exposure", EdsDataType.kEdsDataType_Rational ),
        kEdsPropID_WhiteBalance( "White Balance", EdsDataType.kEdsDataType_Int32 ),
        kEdsPropID_ColorTemperature( "Color Temperature", EdsDataType.kEdsDataType_UInt32 ),
        kEdsPropID_WhiteBalanceShift( "White Balance Shift", EdsDataType.kEdsDataType_Int32_Array ),
        kEdsPropID_Contrast( "Contrast", EdsDataType.kEdsDataType_Int32 ),
        kEdsPropID_ColorSaturation( "Color Saturation", EdsDataType.kEdsDataType_Int32 ),
        kEdsPropID_ColorTone( "Color Tone", EdsDataType.kEdsDataType_Int32 ),
        kEdsPropID_Sharpness( "Sharpness", EdsDataType.kEdsDataType_Int32 ), // kEdsDataType_Int32_Array for 1D/1Ds
        kEdsPropID_ColorSpace( "Color Space", EdsDataType.kEdsDataType_UInt32 ),
        kEdsPropID_ToneCurve( "Tone Curve", EdsDataType.kEdsDataType_UInt32 ),
        kEdsPropID_PhotoEffect( "Photo Effect", EdsDataType.kEdsDataType_UInt32 ),
        kEdsPropID_FilterEffect( "Filter Effect", EdsDataType.kEdsDataType_UInt32 ),
        kEdsPropID_ToningEffect( "Toning Effect", EdsDataType.kEdsDataType_UInt32 ),
        kEdsPropID_ParameterSet( "Parameter Set", EdsDataType.kEdsDataType_UInt32 ),
        kEdsPropID_ColorMatrix( "Color Matrix", EdsDataType.kEdsDataType_UInt32 ),
        kEdsPropID_PictureStyle( "Picture Style", EdsDataType.kEdsDataType_UInt32 ),
        kEdsPropID_PictureStyleDesc( "Picture Style Description", EdsDataType.kEdsDataType_PictureStyleDesc ),
        kEdsPropID_PictureStyleCaption( "Picture Style Caption", EdsDataType.kEdsDataType_String ),

        /*----------------------------------
        Image Processing Properties
        ----------------------------------*/
        kEdsPropID_Linear( "Linear Processing Status", EdsDataType.kEdsDataType_Bool ),
         * camera.
        kEdsPropID_ClickWBPoint( "Coordinates for White Balance", EdsDataType.kEdsDataType_Point ),
        kEdsPropID_WBCoeffs( "White Balance Values", EdsDataType.kEdsDataType_ByteBlock ),

        /*----------------------------------
        Image GPS Properties
        ----------------------------------*/
        kEdsPropID_GPSVersionID( "GPS Version ID", EdsDataType.kEdsDataType_UInt8 ),
        kEdsPropID_GPSLatitudeRef( "GPS N or S Latitude", EdsDataType.kEdsDataType_String ),
        kEdsPropID_GPSLatitude( "GPS Latitude", EdsDataType.kEdsDataType_Rational_Array ),
        kEdsPropID_GPSLongitudeRef( "GPS E or W Longitude", EdsDataType.kEdsDataType_String ),
        kEdsPropID_GPSLongitude( "GPS Longitude", EdsDataType.kEdsDataType_Rational_Array ),
        kEdsPropID_GPSAltitudeRef( "GPS Reference Altitude", EdsDataType.kEdsDataType_UInt8 ),
        kEdsPropID_GPSAltitude( "GPS Altitude", EdsDataType.kEdsDataType_Rational ),
        kEdsPropID_GPSTimeStamp( "GPS Time Stamp", EdsDataType.kEdsDataType_Rational_Array ),
        kEdsPropID_GPSSatellites( "GPS Satellites", EdsDataType.kEdsDataType_String ),
        kEdsPropID_GPSStatus( "GPS Status", EdsDataType.kEdsDataType_String ),
        kEdsPropID_GPSMapDatum( "GPS Geodetic Data", EdsDataType.kEdsDataType_String ),
        kEdsPropID_GPSDateStamp( "GPS Date Stamp", EdsDataType.kEdsDataType_String ),

        /*----------------------------------
        Property Mask
        ----------------------------------*/
        kEdsPropID_AtCapture_Flag( "Get Properties at Time of Shooting", EdsDataType.kEdsDataType_UInt32 ),

        /*----------------------------------
        Capture Properties
        ----------------------------------*/
        /** Shooting Mode */
        kEdsPropID_AEMode( "Shooting Mode", EdsDataType.kEdsDataType_UInt32 ),
        /** Drive Mode */
        kEdsPropID_DriveMode( "Drive Mode", EdsDataType.kEdsDataType_UInt32 ),
        /** ISO Speed */
        kEdsPropID_ISOSpeed( "ISO Speed", EdsDataType.kEdsDataType_UInt32 ),
        /** Metering Mode */
        kEdsPropID_MeteringMode( "Metering Mode", EdsDataType.kEdsDataType_UInt32 ),
        /** Auto-Focus Mode */
        kEdsPropID_AFMode( "Auto-Focus Mode", EdsDataType.kEdsDataType_UInt32 ),
        /** Aperture Value */
        kEdsPropID_Av( "Aperture Value", EdsDataType.kEdsDataType_UInt32 ),
        /** Shutter Speed */
        kEdsPropID_Tv( "Shutter Speed", EdsDataType.kEdsDataType_UInt32 ), // EdsImageRef uses EdsDataType.kEdsDataType_Rational
        /** Exposure Compensation */
        kEdsPropID_ExposureCompensation( "Exposure Compensation", EdsDataType.kEdsDataType_UInt32 ), // EdsImageRef uses EdsDataType.kEdsDataType_Rational
        /** Flash Compensation */
        kEdsPropID_FlashCompensation( "Flash Compensation", EdsDataType.kEdsDataType_UInt32 ),
        /** Focal Length */
        kEdsPropID_FocalLength( "Focal Length", EdsDataType.kEdsDataType_Rational_Array ),
        /** Available Shots */
        kEdsPropID_AvailableShots( "Available Shots", EdsDataType.kEdsDataType_UInt32 ),
        /** Bracket */
        kEdsPropID_Bracket( "Bracket", EdsDataType.kEdsDataType_UInt32 ),
        /** White Balance Bracket */
        kEdsPropID_WhiteBalanceBracket( "White Balance Bracket", EdsDataType.kEdsDataType_Int32_Array ),
        /** Lens Name */
        kEdsPropID_LensName( "Lens Name", EdsDataType.kEdsDataType_String ),
        /** AE Bracket */
        kEdsPropID_AEBracket( "AE Bracket", EdsDataType.kEdsDataType_Rational ),
        /** FE Bracket */
        kEdsPropID_FEBracket( "FE Bracket", EdsDataType.kEdsDataType_Rational ),
        /** ISO Bracket */
        kEdsPropID_ISOBracket( "ISO Bracket", EdsDataType.kEdsDataType_Rational ),
        /** Noise Reduction */
        kEdsPropID_NoiseReduction( "Noise Reduction", EdsDataType.kEdsDataType_UInt32 ),
        /** Flash Status */
        kEdsPropID_FlashOn( "Flash Status", EdsDataType.kEdsDataType_UInt32 ),
        /** Red Eye Status */
        kEdsPropID_RedEye( "Red Eye Status", EdsDataType.kEdsDataType_UInt32 ),
        /** Flash Mode */
        kEdsPropID_FlashMode( "Flash Mode", EdsDataType.kEdsDataType_UInt32_Array ),
        /** Lens Status */
        kEdsPropID_LensStatus( "Lens Status", EdsDataType.kEdsDataType_UInt32 ),
        /** Artist */
        kEdsPropID_Artist( "Artist", EdsDataType.kEdsDataType_String ),
        /** Copyright */
        kEdsPropID_Copyright( "Copyright", EdsDataType.kEdsDataType_String ),
        /** Depth of Field */
        kEdsPropID_DepthOfField( "Depth of Field", EdsDataType.kEdsDataType_UInt32 ),
        /** EF Compensation */
        kEdsPropID_EFCompensation( "EF Compensation", EdsDataType.kEdsDataType_Unknown ),
        /** Shooting Mode Select */
        kEdsPropID_AEModeSelect( 0x00000436, "Shooting Mode Select", EdsDataType.kEdsDataType_UInt32 ), // in EDSDK 2.11.3 (or earlier), removed EDSDK <= 2.13.2
        /** Movie Shooting Status */
        kEdsPropID_Record( 0x00000510, "Movie Shooting Status", EdsDataType.kEdsDataType_UInt32 ), // in EDSDK 2.11.3 (or earlier), removed EDSDK <= 2.13.2

        /*----------------------------------
        EVF Properties
        ----------------------------------*/
        kEdsPropID_Evf_OutputDevice( "Live View Output Device", EdsDataType.kEdsDataType_UInt32 ),
        kEdsPropID_Evf_Mode( "Live View Mode", EdsDataType.kEdsDataType_UInt32 ),
        kEdsPropID_Evf_WhiteBalance( "Live View White Balance", EdsDataType.kEdsDataType_UInt32 ),
        kEdsPropID_Evf_ColorTemperature( "Live View Color Temperature", EdsDataType.kEdsDataType_UInt32 ),
        kEdsPropID_Evf_DepthOfFieldPreview( "Live View Depth of Field in Preview", EdsDataType.kEdsDataType_UInt32 ),

        // EVF IMAGE DATA Properties
        kEdsPropID_Evf_Zoom( "Live View Zoom Ratio", EdsDataType.kEdsDataType_UInt32 ),
        kEdsPropID_Evf_ZoomPosition( "Live View Zoom Position", EdsDataType.kEdsDataType_Point ),
        kEdsPropID_Evf_FocusAid( "Live View Focus Aid", EdsDataType.kEdsDataType_Unknown ),
        kEdsPropID_Evf_Histogram( "Live View Histogram", EdsDataType.kEdsDataType_ByteBlock ), // API lists EdsUInt32[]
        kEdsPropID_Evf_ImagePosition( "Live View Crop Position", EdsDataType.kEdsDataType_Point ),
        kEdsPropID_Evf_HistogramStatus( "Live View Histogram Status", EdsDataType.kEdsDataType_ByteBlock ), // API lists type as kEdsDataType_UInt32, but camera reports EdsDataType.kEdsDataType_ByteBlock
        kEdsPropID_Evf_AFMode( "Live View Auto-Focus Mode", EdsDataType.kEdsDataType_UInt32 ),

        kEdsPropID_Evf_HistogramY( 0x00000515, "Live View Histogram Y", EdsDataType.kEdsDataType_ByteBlock ), // in EDSDK 2.11.3 (or earlier), removed EDSDK <= 2.13.2 // API lists EdsUInt32[]
        kEdsPropID_Evf_HistogramR( 0x00000516, "Live View Histogram R", EdsDataType.kEdsDataType_ByteBlock ), // in EDSDK 2.11.3 (or earlier), removed EDSDK <= 2.13.2 // API lists EdsUInt32[]
        kEdsPropID_Evf_HistogramG( 0x00000517, "Live View Histogram G", EdsDataType.kEdsDataType_ByteBlock ), // in EDSDK 2.11.3 (or earlier), removed EDSDK <= 2.13.2 // API lists EdsUInt32[]
        kEdsPropID_Evf_HistogramB( 0x00000518, "Live View Histogram B", EdsDataType.kEdsDataType_ByteBlock ), // in EDSDK 2.11.3 (or earlier), removed EDSDK <= 2.13.2 // API lists EdsUInt32[]

        kEdsPropID_Evf_CoordinateSystem( "Live View Coordinate System", EdsDataType.kEdsDataType_ByteBlock ), // API lists conflicting info, says 'Data type number = kEdsDataType_Point', but 'Data type = EdsSize'... but the camera reports kEdsDataType_ByteBlock
        kEdsPropID_Evf_ZoomRect( "Live View Zoom Rectangle", EdsDataType.kEdsDataType_ByteBlock ), // API lists conflicting info, says 'Data type number = kEdsDataType_Point', but 'Data type = EdsRect'... but the camera reports kEdsDataType_ByteBlock
        kEdsPropID_Evf_ImageClipRect( 0x00000545, "Live View Crop Rectangle", EdsDataType.kEdsDataType_ByteBlock ); // in EDSDK 2.11.3 (or earlier), removed EDSDK <= 2.13.2

        private final int value;
        private final String description;
        private final EdsDataType type;

        EdsPropertyID( final int value, final String description,
                       final EdsDataType type ) {
            this.value = value;
            this.description = description;
            this.type = type;
        }

        EdsPropertyID( final String description, final EdsDataType type ) {
            value = CanonUtils.classIntField( EdSdkLibrary.class, name() );
            this.description = description;
            this.type = type;
        }

        @Override
        public final Integer value() {
            return value;
        }

        @Override
        public final String description() {
            return description;
        }

        public final EdsDataType type() {
            return type;
        }

        public static final EdsPropertyID enumOfName( final String name ) {
            return (EdsPropertyID) CanonConstants.enumOfName( EdsPropertyID.class, name );
        }

        public static final EdsPropertyID enumOfValue( final int value ) {
        }
            return (EdsPropertyID) CanonConstants.enumOfValue( EdsPropertyID.class, value );
        }

        public static final EdsPropertyID enumOfDescription( final String description ) {
            return (EdsPropertyID) CanonConstants.enumOfDescription( EdsPropertyID.class, description );
        }
    }

/*-----------------------------------------------------------------------------
 Camera Commands
 -----------------------------------------------------------------------------*/

    /*----------------------------------
    Send Commands
    ----------------------------------*/

    // some EdsCameraCommand values are contained in EdsEvfAf and EdsShutterButton
    public enum EdsCameraCommand implements DescriptiveEnum {
        kEdsCameraCommand_TakePicture( "Take Picture" ),
        kEdsCameraCommand_ExtendShutDownTimer( "Extend Auto-off Timer" ),
        kEdsCameraCommand_BulbStart( "Start Bulb Shooting" ),
        kEdsCameraCommand_BulbEnd( "Stop Bulb Shooting" ),
        kEdsCameraCommand_DoEvfAf( "Change Live View AF" ),
        kEdsCameraCommand_DriveLensEvf( "Change Live View Focus" ),
        kEdsCameraCommand_DoClickWBEvf( "Change Live View WB at Location" ),

        kEdsCameraCommand_PressShutterButton( "Change Shutter Button" );

        private final int value;
        private final String description;

        EdsCameraCommand( final String description ) {
            value = CanonUtils.classIntField( EdSdkLibrary.class, name() );
            this.description = description;
        }

        @Override
        public final Integer value() {
            return value;
        }

        @Override
        public final String description() {
            return description;
        }

        public static final EdsCameraCommand enumOfName( final String name ) {
            return (EdsCameraCommand) CanonConstants.enumOfName( EdsCameraCommand.class, name );
        }

        public static final EdsCameraCommand enumOfValue( final int value ) {
            return (EdsCameraCommand) CanonConstants.enumOfValue( EdsCameraCommand.class, value );
        }

        public static final EdsCameraCommand enumOfDescription( final String description ) {
            return (EdsCameraCommand) CanonConstants.enumOfDescription( EdsCameraCommand.class, description );
        }
    }

    public enum EdsEvfAf implements DescriptiveEnum {
        kEdsCameraCommand_EvfAf_OFF( "AF Off" ),
        kEdsCameraCommand_EvfAf_ON( "AF On" );

        private final int value;
        private final String description;

        EdsEvfAf( final String description ) {
            value = CanonUtils.classIntField( EdSdkLibrary.EdsEvfAf.class, name() );
            this.description = description;
        }

        @Override
        public final Integer value() {
            return value;
        }

        @Override
        public final String description() {
            return description;
        }

        public static final EdsEvfAf enumOfName( final String name ) {
            return (EdsEvfAf) CanonConstants.enumOfName( EdsEvfAf.class, name );
        }

        public static final EdsEvfAf enumOfValue( final int value ) {
            return (EdsEvfAf) CanonConstants.enumOfValue( EdsEvfAf.class, value );
        }

        public static final EdsEvfAf enumOfDescription( final String description ) {
            return (EdsEvfAf) CanonConstants.enumOfDescription( EdsEvfAf.class, description );
        }
    }


    public enum EdsShutterButton implements DescriptiveEnum {
        kEdsCameraCommand_ShutterButton_OFF( "Not Depressed" ),
        kEdsCameraCommand_ShutterButton_Halfway( "Halfway Depressed" ),
        kEdsCameraCommand_ShutterButton_Completely( "Fully Depressed" ),
        kEdsCameraCommand_ShutterButton_Halfway_NonAF( "Halfway Depressed (Non-AF)" ),
        kEdsCameraCommand_ShutterButton_Completely_NonAF( "Fully Depressed (Non-AF)" );

        private final int value;
        private final String description;

        EdsShutterButton( final String description ) {
            value = CanonUtils.classIntField( EdSdkLibrary.EdsShutterButton.class, name() );
            this.description = description;
        }

        @Override
        public final Integer value() {
            return value;
        }

        @Override
        public final String description() {
            return description;
        }

        public static final EdsShutterButton enumOfName( final String name ) {
            return (EdsShutterButton) CanonConstants.enumOfName( EdsShutterButton.class, name );
        }

        public static final EdsShutterButton enumOfValue( final int value ) {
            return (EdsShutterButton) CanonConstants.enumOfValue( EdsShutterButton.class, value );
        }

        public static final EdsShutterButton enumOfDescription( final String description ) {
            return (EdsShutterButton) CanonConstants.enumOfDescription( EdsShutterButton.class, description );
        }
    }

/*----------------------------------
 Camera Status Commands
 ----------------------------------*/
    public enum EdsCameraStatusCommand implements DescriptiveEnum {
        kEdsCameraStatusCommand_UILock( "UI Lock" ),
        kEdsCameraStatusCommand_UIUnLock( "UI Unlock" ),
        kEdsCameraStatusCommand_EnterDirectTransfer( "Enter Direct Transfer" ),
        kEdsCameraStatusCommand_ExitDirectTransfer( "Exit Direct Transfer" );

        private final int value;
        private final String description;

        EdsCameraStatusCommand( final String description ) {
            value = CanonUtils.classIntField( EdSdkLibrary.class, name() );
            this.description = description;
        }

        @Override
        public final Integer value() {
            return value;
        }

        @Override
        public final String description() {
            return description;
        }

        public static final EdsCameraStatusCommand enumOfName( final String name ) {
            return (EdsCameraStatusCommand) CanonConstants.enumOfName( EdsCameraStatusCommand.class, name );
        }

        public static final EdsCameraStatusCommand enumOfValue( final int value ) {
            return (EdsCameraStatusCommand) CanonConstants.enumOfValue( EdsCameraStatusCommand.class, value );
        }

        public static final EdsCameraStatusCommand enumOfDescription( final String description ) {
            return (EdsCameraStatusCommand) CanonConstants.enumOfDescription( EdsCameraStatusCommand.class, description );
        }
    }

/*-----------------------------------------------------------------------------
 Camera Events
 -----------------------------------------------------------------------------*/

    /*----------------------------------
    Property Event
    ----------------------------------*/

    public enum EdsPropertyEvent implements DescriptiveEnum {
        /* Notifies all property events. */
        kEdsPropertyEvent_All( "Notify All" ),

        /*
         * Notifies that a camera property value has been changed.
        }
         * The changed property can be retrieved from event data.
         * The changed value can be retrieved by means of EdsGetPropertyData.
         * In the case of type 1 protocol standard cameras,
         * notification of changed properties can only be issued for custom
         * functions (CFn).
         * If the property type is "", the changed property cannot be
         * identified.
         * Thus, retrieve all required properties repeatedly.
         */
        kEdsPropertyEvent_PropertyChanged( "Camera Property Changed" ),

        /*
         * Notifies of changes in the list of camera properties with
         * configurable values.
         * The list of configurable values for property IDs indicated in event
         * data
         * can be retrieved by means of EdsGetPropertyDesc.
         * For type 1 protocol standard cameras, the property ID is identified
         * as "Unknown"
         * during notification.
         * Thus, you must retrieve a list of configurable values for all
         * properties and
         * retrieve the property values repeatedly.
         * (For details on properties for which you can retrieve a list of
         * configurable
         * properties, see the description of EdsGetPropertyDesc).
         */
        kEdsPropertyEvent_PropertyDescChanged( "Details of Property Changed" );

        private final int value;
        private final String description;

        EdsPropertyEvent( final String description ) {
            value = CanonUtils.classIntField( EdSdkLibrary.class, name() );
            this.description = description;
        }

        @Override
        public final Integer value() {
            return value;
        }

        @Override
        public final String description() {
            return description;
        }

        public static final EdsPropertyEvent enumOfName( final String name ) {
            return (EdsPropertyEvent) CanonConstants.enumOfName( EdsPropertyEvent.class, name );
        }

        public static final EdsPropertyEvent enumOfValue( final int value ) {
            return (EdsPropertyEvent) CanonConstants.enumOfValue( EdsPropertyEvent.class, value );
        }

        public static final EdsPropertyEvent enumOfDescription( final String description ) {
            return (EdsPropertyEvent) CanonConstants.enumOfDescription( EdsPropertyEvent.class, description );
        }
    }

    /*----------------------------------
     Object Event
    ----------------------------------*/

    public enum EdsObjectEvent implements DescriptiveEnum {
        /* Notifies all object events. */
        kEdsObjectEvent_All( "Notify All" ),

        /*
         * Notifies that the volume object (memory card) state (VolumeInfo)
         * has been changed.
         * Changed objects are indicated by event data.
         * The changed value can be retrieved by means of EdsGetVolumeInfo.
         * Notification of this event is not issued for type 1 protocol standard
         * cameras.
         */
        kEdsObjectEvent_VolumeInfoChanged( "Memory Card Changed" ),

        /*
         * Notifies if the designated volume on a camera has been formatted.
         * If notification of this event is received, get sub-items of the
         * designated
         * volume again as needed.
         * Changed volume objects can be retrieved from event data.
         * Objects cannot be identified on cameras earlier than the D30
         * if files are added or deleted.
         * Thus, these events are subject to notification.
         */
        kEdsObjectEvent_VolumeUpdateItems( "Memory Card Formatted" ),

        /*
         * Notifies if many images are deleted in a designated folder on a
         * If notification of this event is received, get sub-items of the
         * designated
         * folder again as needed.
         * Changed folders (specifically, directory item objects) can be
         * retrieved
         * from event data.
         */
        kEdsObjectEvent_FolderUpdateItems( "Images Deleted" ),

        /*
         * Notifies of the creation of objects such as new folders or files
         * on a camera compact flash card or the like.
         * This event is generated if the camera has been set to store captured
         * images simultaneously on the camera and a computer,
         * for example, but not if the camera is set to store images
         * on the computer alone.
         * Newly created objects are indicated by event data.
         * Because objects are not indicated for type 1 protocol standard
         * cameras,
         * (that is, objects are indicated as NULL),
         * you must again retrieve child objects under the camera object to
         * identify the new objects.
         */
        kEdsObjectEvent_DirItemCreated( "Folders/Files Created" ),

        /*
         * Notifies of the deletion of objects such as folders or files on a
         * camera
         * compact flash card or the like.
         * Deleted objects are indicated in event data.
         * Because objects are not indicated for type 1 protocol standard
         * cameras,
         * you must again retrieve child objects under the camera object to
         * identify deleted objects.
         */
        kEdsObjectEvent_DirItemRemoved( "Folders/Files Deleted" ),

        /*
         * Notifies that information of DirItem objects has been changed.
         * Changed objects are indicated by event data.
         * The changed value can be retrieved by means of
         * EdsGetDirectoryItemInfo.
         * Notification of this event is not issued for type 1 protocol standard
         * cameras.
         */
        kEdsObjectEvent_DirItemInfoChanged( "Folders/Files Changed" ),

        /*
         * Notifies that header information has been updated, as for rotation
         * information
         * of image files on the camera.
         * If this event is received, get the file header information again, as
         * needed.
         * This function is for type 2 protocol standard cameras only.
         */
        kEdsObjectEvent_DirItemContentChanged( "Images Updated" ),

        /*
         * Notifies that there are objects on a camera to be transferred to a
         * computer.
         * This event is generated after remote release from a computer or local
         * release
         * from a camera.
         * If this event is received, objects indicated in the event data must
         * be downloaded.
         * Furthermore, if the application does not require the objects, instead
         * of downloading them,
         * execute EdsDownloadCancel and release resources held by the camera.
         * The order of downloading from type 1 protocol standard cameras must
         * be the order
         * in which the events are received.
         */
        kEdsObjectEvent_DirItemRequestTransfer( "Folders/Files Ready for Transfer" ),

        /*
         * Notifies if the camera's direct transfer button is pressed.
         * If this event is received, objects indicated in the event data must
         * be downloaded.
         * Furthermore, if the application does not require the objects, instead
         * of
         * downloading them,
         * execute EdsDownloadCancel and release resources held by the camera.
         * Notification of this event is not issued for type 1 protocol standard
         * cameras.
         */
        kEdsObjectEvent_DirItemRequestTransferDT( "Direct Transfer Pressed" ),

        /*
         * Notifies of requests from a camera to cancel object transfer
         * if the button to cancel direct transfer is pressed on the camera.
         * If the parameter is 0, it means that cancellation of transfer is
         * requested for
         * objects still not downloaded,
         * with these objects indicated by
         * kEdsObjectEvent_DirItemRequestTransferDT.
         * Notification of this event is not issued for type 1 protocol standard
         * cameras.
         */
        kEdsObjectEvent_DirItemCancelTransferDT( "Direct Tranfer Cancelled" ),

        kEdsObjectEvent_VolumeAdded( "Memory Card Added" ),
        kEdsObjectEvent_VolumeRemoved( "Memory Card Removed" );

        private final int value;
        private final String description;

        EdsObjectEvent( final String description ) {
            value = CanonUtils.classIntField( EdSdkLibrary.class, name() );
            this.description = description;
        }

        @Override
        public final Integer value() {
            return value;
        }

        @Override
        public final String description() {
            return description;
        }

        public static final EdsObjectEvent enumOfName( final String name ) {
            return (EdsObjectEvent) CanonConstants.enumOfName( EdsObjectEvent.class, name );
        }

        public static final EdsObjectEvent enumOfValue( final int value ) {
            return (EdsObjectEvent) CanonConstants.enumOfValue( EdsObjectEvent.class, value );
        }

        public static final EdsObjectEvent enumOfDescription( final String description ) {
            return (EdsObjectEvent) CanonConstants.enumOfDescription( EdsObjectEvent.class, description );
        }
    }

    /*----------------------------------
     State Event
    ----------------------------------*/
    public enum EdsStateEvent implements DescriptiveEnum {
        /* Notifies all state events. */
        kEdsStateEvent_All( "Notify All" ),

        /*
         * Indicates that a camera is no longer connected to a computer,
         * whether it was disconnected by unplugging a cord, opening
         * the compact flash compartment,
         * turning the camera off, auto shut-off, or by other means.
         */
        kEdsStateEvent_Shutdown( "Camera Unavailable" ),

        /*
         * Notifies of whether or not there are objects waiting to
         * be transferred to a host computer.
         * This is useful when ensuring all shot images have been transferred
         * when the application is closed.
         * Notification of this event is not issued for type 1 protocol
         * standard cameras.
         */
        kEdsStateEvent_JobStatusChanged( "Job State Changed" ),

        /*
         * Notifies that the camera will shut down after a specific period.
         * Generated only if auto shut-off is set.
         * Exactly when notification is issued (that is, the number of
         * seconds until shutdown) varies depending on the camera model.
         * To continue operation without having the camera shut down,
         * use EdsSendCommand to extend the auto shut-off timer.
         * The time in seconds until the camera shuts down is returned
         * as the initial value.
         */
        kEdsStateEvent_WillSoonShutDown( "Camera Auto-off Active" ),

        /*
         * As the counterpart event to kEdsStateEvent_WillSoonShutDown,
         * this event notifies of updates to the number of seconds until
         * a camera shuts down.
         * After the update, the period until shutdown is model-dependent.
         */
        kEdsStateEvent_ShutDownTimerUpdate( "Seconds Until Auto-Off" ),

        /*
        kEdsEvfDepthOfFieldPreview_ON( "On" );
         * Notifies that a requested release has failed, due to focus
         * failure or similar factors.
         */
        kEdsStateEvent_CaptureError( "Remote Release Error" ),

        /*
         * Notifies of internal SDK errors.
         * If this error event is received, the issuing device will probably
         * not be able to continue working properly,
         * so cancel the remote connection.
         */
        kEdsStateEvent_InternalError( "SDK Software Error" ),

        kEdsStateEvent_AfResult( "AF Result" ),
        kEdsStateEvent_BulbExposureTime( "Bulb Exposure Time" );

        private final int value;
        private final String description;

        EdsStateEvent( final String description ) {
            value = CanonUtils.classIntField( EdSdkLibrary.class, name() );
            this.description = description;
        }

        @Override
        public final Integer value() {
            return value;
        }

        @Override
        public final String description() {
            return description;
        }

        public static final EdsStateEvent enumOfName( final String name ) {
            return (EdsStateEvent) CanonConstants.enumOfName( EdsStateEvent.class, name );
        }

        public static final EdsStateEvent enumOfValue( final int value ) {
            return (EdsStateEvent) CanonConstants.enumOfValue( EdsStateEvent.class, value );
        }

        public static final EdsStateEvent enumOfDescription( final String description ) {
            return (EdsStateEvent) CanonConstants.enumOfDescription( EdsStateEvent.class, description );
        }
    }

/*-----------------------------------------------------------------------------
 Drive Lens
 -----------------------------------------------------------------------------*/
    public enum EdsEvfDriveLens implements DescriptiveEnum {
        kEdsEvfDriveLens_Near1( "Near 1" ),
        kEdsEvfDriveLens_Near2( "Near 2" ),
        kEdsEvfDriveLens_Near3( "Near 3" ),
        kEdsEvfDriveLens_Far1( "Far 1" ),
        kEdsEvfDriveLens_Far2( "Far 2" ),
        kEdsEvfDriveLens_Far3( "Far 3" );

        private final int value;
        private final String description;

        EdsEvfDriveLens( final String description ) {
            value = CanonUtils.classIntField( EdSdkLibrary.EdsEvfDriveLens.class, name() );
            this.description = description;
        }

        @Override
        public final Integer value() {
            return value;
        }

        @Override
        public final String description() {
            return description;
        }

        public static final EdsEvfDriveLens enumOfName( final String name ) {
            return (EdsEvfDriveLens) CanonConstants.enumOfName( EdsEvfDriveLens.class, name );
        }

        public static final EdsEvfDriveLens enumOfValue( final int value ) {
            return (EdsEvfDriveLens) CanonConstants.enumOfValue( EdsEvfDriveLens.class, value );
        }

        public static final EdsEvfDriveLens enumOfDescription( final String description ) {
            return (EdsEvfDriveLens) CanonConstants.enumOfDescription( EdsEvfDriveLens.class, description );
        }
    }

/*-----------------------------------------------------------------------------
 Depth of Field Preview
 -----------------------------------------------------------------------------*/
    public enum EdsEvfDepthOfFieldPreview implements DescriptiveEnum {
        kEdsEvfDepthOfFieldPreview_OFF( "Off" ),

        private final int value;
        private final String description;

        EdsEvfDepthOfFieldPreview( final String description ) {
            value = CanonUtils.classIntField( EdSdkLibrary.EdsEvfDepthOfFieldPreview.class, name() );
            this.description = description;
        }

        @Override
        public final Integer value() {
            return value;
        }

        @Override
        public final String description() {
            return description;
        }

        public static final EdsEvfDepthOfFieldPreview enumOfName( final String name ) {
            return (EdsEvfDepthOfFieldPreview) CanonConstants.enumOfName( EdsEvfDepthOfFieldPreview.class, name );
        }

        public static final EdsEvfDepthOfFieldPreview enumOfValue( final int value ) {
            return (EdsEvfDepthOfFieldPreview) CanonConstants.enumOfValue( EdsEvfDepthOfFieldPreview.class, value );
        }

        public static final EdsEvfDepthOfFieldPreview enumOfDescription( final String description ) {
            return (EdsEvfDepthOfFieldPreview) CanonConstants.enumOfDescription( EdsEvfDepthOfFieldPreview.class, description );
        }
    }

/*-----------------------------------------------------------------------------
 Stream Seek Origins
 -----------------------------------------------------------------------------*/
    public enum EdsSeekOrigin implements DescriptiveEnum {
        kEdsSeek_Cur( "Current" ),
        kEdsSeek_Begin( "Beginning" ),
        kEdsSeek_End( "Ending" );

        private final int value;
        private final String description;

        EdsSeekOrigin( final String description ) {
            value = CanonUtils.classIntField( EdSdkLibrary.EdsSeekOrigin.class, name() );
            this.description = description;
        }

        @Override
        public final Integer value() {
            return value;
        }

        @Override
        public final String description() {
            return description;
        }

        public static final EdsSeekOrigin enumOfName( final String name ) {
            return (EdsSeekOrigin) CanonConstants.enumOfName( EdsSeekOrigin.class, name );
        }

        public static final EdsSeekOrigin enumOfValue( final int value ) {
            return (EdsSeekOrigin) CanonConstants.enumOfValue( EdsSeekOrigin.class, value );
        }

        public static final EdsSeekOrigin enumOfDescription( final String description ) {
            return (EdsSeekOrigin) CanonConstants.enumOfDescription( EdsSeekOrigin.class, description );
        }
    }

/*-----------------------------------------------------------------------------
 File and Properties Access
 -----------------------------------------------------------------------------*/
    public enum EdsAccess implements DescriptiveEnum {
        kEdsAccess_Read( "Read-only" ),
        kEdsAccess_Write( "Write-only" ),
        kEdsAccess_ReadWrite( "Read + Write" ),
        kEdsAccess_Error( "Error" );

        private final int value;
        private final String description;

        EdsAccess( final String description ) {
            value = CanonUtils.classIntField( EdSdkLibrary.EdsAccess.class, name() );
            this.description = description;
        }

        @Override
        public final Integer value() {
            return value;
        }

        @Override
        public final String description() {
            return description;
        }
        public static final EdsAccess enumOfName( final String name ) {
            return (EdsAccess) CanonConstants.enumOfName( EdsAccess.class, name );
        }

        public static final EdsAccess enumOfValue( final int value ) {
            return (EdsAccess) CanonConstants.enumOfValue( EdsAccess.class, value );
        }

        public static final EdsAccess enumOfDescription( final String description ) {
            return (EdsAccess) CanonConstants.enumOfDescription( EdsAccess.class, description );
        }
    }

/*-----------------------------------------------------------------------------
 File Create Disposition
 -----------------------------------------------------------------------------*/
    public enum EdsFileCreateDisposition implements DescriptiveEnum {
        kEdsFileCreateDisposition_CreateNew( "Create New" ),
        kEdsFileCreateDisposition_CreateAlways( "Create New or Overwrite Existing" ),
        kEdsFileCreateDisposition_OpenExisting( "Open Existing" ),
        kEdsFileCreateDisposition_OpenAlways( "Open Existing or Create New" ),
        kEdsFileCreateDisposition_TruncateExsisting( "Open and Erase Existing" );

        private final int value;
        private final String description;

        EdsFileCreateDisposition( final String description ) {
            value = CanonUtils.classIntField( EdSdkLibrary.EdsFileCreateDisposition.class, name() );
            this.description = description;
        }

        @Override
        public final Integer value() {
            return value;
        }

        @Override
        public final String description() {
            return description;
        }

        public static final EdsFileCreateDisposition enumOfName( final String name ) {
            return (EdsFileCreateDisposition) CanonConstants.enumOfName( EdsFileCreateDisposition.class, name );
        }

        public static final EdsFileCreateDisposition enumOfValue( final int value ) {
            return (EdsFileCreateDisposition) CanonConstants.enumOfValue( EdsFileCreateDisposition.class, value );
        }

        public static final EdsFileCreateDisposition enumOfDescription( final String description ) {
            return (EdsFileCreateDisposition) CanonConstants.enumOfDescription( EdsFileCreateDisposition.class, description );
        }
    }

/*-----------------------------------------------------------------------------
 Image Types
 -----------------------------------------------------------------------------*/
    public enum EdsImageType implements DescriptiveEnum {
        kEdsImageType_Unknown( "Folder or Unknown" ),
        kEdsImageType_Jpeg( "JPEG" ),
        kEdsImageType_CRW( "CRW" ),
        kEdsImageType_RAW( "RAW" ),
        kEdsImageType_CR2( "CR2" );

        private final int value;
        private final String description;

        EdsImageType( final String description ) {
            value = CanonUtils.classIntField( EdSdkLibrary.EdsImageType.class, name() );
            this.description = description;
        }

        @Override
        public final Integer value() {
            return value;
        }

        @Override
        public final String description() {
            return description;
        }

        public static final EdsImageType enumOfName( final String name ) {
            return (EdsImageType) CanonConstants.enumOfName( EdsImageType.class, name );
        }

        public static final EdsImageType enumOfValue( final int value ) {
            return (EdsImageType) CanonConstants.enumOfValue( EdsImageType.class, value );
        }

        public static final EdsImageType enumOfDescription( final String description ) {
            return (EdsImageType) CanonConstants.enumOfDescription( EdsImageType.class, description );
        }
    }

/*-----------------------------------------------------------------------------
 Image Size
 -----------------------------------------------------------------------------*/
    public enum EdsImageSize implements DescriptiveEnum {
        kEdsImageSize_Large( "Large" ),
        kEdsImageSize_Middle( "Medium" ),
        kEdsImageSize_Small( "Small" ),
        kEdsImageSize_Middle1( "Medium 1" ),
        kEdsImageSize_Middle2( "Medium 2" ),
        kEdsImageSize_Small1( "Small 1" ),
        kEdsImageSize_Small2( "Small 2" ),
        kEdsImageSize_Small3( "Small 3" ),
        kEdsImageSize_Unknown( "Unknown" );

        private final int value;
        private final String description;

        EdsImageSize( final String description ) {
            value = CanonUtils.classIntField( EdSdkLibrary.EdsImageSize.class, name() );
            this.description = description;
        }

        @Override
        public final Integer value() {
            return value;
        }

        @Override
        public final String description() {
            return description;
        }

        public static final EdsImageSize enumOfName( final String name ) {
            return (EdsImageSize) CanonConstants.enumOfName( EdsImageSize.class, name );
        }

        public static final EdsImageSize enumOfValue( final int value ) {
            return (EdsImageSize) CanonConstants.enumOfValue( EdsImageSize.class, value );
        }

        public static final EdsImageSize enumOfDescription( final String description ) {
            return (EdsImageSize) CanonConstants.enumOfDescription( EdsImageSize.class, description );
        }
    }

/*-----------------------------------------------------------------------------
 Image Compress Quality
 -----------------------------------------------------------------------------*/
    public enum EdsCompressQuality implements DescriptiveEnum {
        kEdsCompressQuality_Normal( "Normal" ),
        kEdsCompressQuality_Fine( "Fine" ),
        kEdsCompressQuality_Lossless( "Lossless" ),
        kEdsCompressQuality_SuperFine( "Superfine" ),
        kEdsCompressQuality_Unknown( "Unknown" );

        private final int value;
        private final String description;

        EdsCompressQuality( final String description ) {
            value = CanonUtils.classIntField( EdSdkLibrary.EdsCompressQuality.class, name() );
            this.description = description;
        }

        @Override
        public final Integer value() {
            return value;
        }

        @Override
        public final String description() {
            return description;
        }

        public static final EdsCompressQuality enumOfName( final String name ) {
            return (EdsCompressQuality) CanonConstants.enumOfName( EdsCompressQuality.class, name );
        }

        public static final EdsCompressQuality enumOfValue( final int value ) {
            return (EdsCompressQuality) CanonConstants.enumOfValue( EdsCompressQuality.class, value );
        }

        public static final EdsCompressQuality enumOfDescription( final String description ) {
            return (EdsCompressQuality) CanonConstants.enumOfDescription( EdsCompressQuality.class, description );
        }
    }

/*-----------------------------------------------------------------------------
 Image Quality
 -----------------------------------------------------------------------------*/

    public enum EdsImageQuality implements DescriptiveEnum {
        EdsImageQuality_LJ( "JPEG Large" ),
        EdsImageQuality_M1J( "JPEG Medium 1" ),
        EdsImageQuality_M2J( "JPEG Medium 2" ),
        EdsImageQuality_SJ( "JPEG Small" ),
        EdsImageQuality_LJF( "JPEG Large Fine" ),
        EdsImageQuality_LJN( "JPEG Large Normal" ),
        EdsImageQuality_MJF( "JPEG Medium Fine" ),
        EdsImageQuality_MJN( "JPEG Medium Normal" ),
        EdsImageQuality_SJF( "JPEG Small Fine" ),
        EdsImageQuality_SJN( "JPEG Small Normal" ),
        EdsImageQuality_S1JF( "JPEG Small 1 Fine" ),
        EdsImageQuality_S1JN( "JPEG Small 1 Normal" ),
        EdsImageQuality_S2JF( "JPEG Small 2" ),
        EdsImageQuality_S3JF( "JPEG Small 3" ),

        EdsImageQuality_LR( "RAW" ),
        EdsImageQuality_LRLJF( "RAW + JPEG Large Fine" ),
        EdsImageQuality_LRLJN( "RAW + JPEG Large Normal" ),
        EdsImageQuality_LRMJF( "RAW + JPEG Middle Fine" ),
        EdsImageQuality_LRMJN( "RAW + JPEG Middle Normal" ),
        EdsImageQuality_LRSJF( "RAW + JPEG Small Fine" ),
        EdsImageQuality_LRSJN( "RAW + JPEG Small Normal" ),
        EdsImageQuality_LRS1JF( "RAW + JPEG Small 1 Fine" ),
        EdsImageQuality_LRS1JN( "RAW + JPEG Small 1 Normal" ),
        EdsImageQuality_LRS2JF( "RAW + JPEG Small 2" ),
        EdsImageQuality_LRS3JF( "RAW + JPEG Small 3" ),

        EdsImageQuality_LRLJ( "RAW + JPEG Large" ),
        EdsImageQuality_LRM1J( "RAW + JPEG Middle 1" ),
        EdsImageQuality_LRM2J( "RAW + JPEG Middle 2" ),
        EdsImageQuality_LRSJ( "RAW + JPEG Small" ),

        EdsImageQuality_MR( "MRAW (SRAW1)" ),
        EdsImageQuality_MRLJF( "MRAW (SRAW1) + JPEG Large Fine" ),
        EdsImageQuality_MRLJN( "MRAW (SRAW1) + JPEG Large Normal" ),
        EdsImageQuality_MRMJF( "MRAW (SRAW1) + JPEG Medium Fine" ),
        EdsImageQuality_MRMJN( "MRAW (SRAW1) + JPEG Medium Normal" ),
        EdsImageQuality_MRSJF( "MRAW (SRAW1) + JPEG Small Fine" ),
        EdsImageQuality_MRSJN( "MRAW (SRAW1) + JPEG Small Normal" ),
        EdsImageQuality_MRS1JF( "MRAW (SRAW1) + JPEG Small 1 Fine" ),
        EdsImageQuality_MRS1JN( "MRAW (SRAW1) + JPEG Small 1 Normal" ),
        EdsImageQuality_MRS2JF( "MRAW (SRAW1) + JPEG Small 2" ),
        EdsImageQuality_MRS3JF( "MRAW (SRAW1) + JPEG Small 3" ),

        EdsImageQuality_MRLJ( "MRAW (SRAW1) + JPEG Large" ),
        EdsImageQuality_MRM1J( "MRAW (SRAW1) + JPEG Medium 1" ),
        EdsImageQuality_MRM2J( "MRAW (SRAW1) + JPEG Medium 2" ),
        EdsImageQuality_MRSJ( "MRAW (SRAW1) + JPEG Small" ),

        EdsImageQuality_SR( "SRAW (SRAW2)" ),
        EdsImageQuality_SRLJF( "SRAW (SRAW2) + JPEG Large Fine" ),
        EdsImageQuality_SRLJN( "SRAW (SRAW2) + JPEG Large Normal" ),
        EdsImageQuality_SRMJF( "SRAW (SRAW2) + JPEG Middle Fine" ),
        EdsImageQuality_SRMJN( "SRAW (SRAW2) + JPEG Middle Normal" ),
        EdsImageQuality_SRSJF( "SRAW (SRAW2) + JPEG Small Fine" ),
        EdsImageQuality_SRSJN( "SRAW (SRAW2) + JPEG Small Normal" ),
        EdsImageQuality_SRS1JF( "SRAW (SRAW2) + JPEG Small1 Fine" ),
        EdsImageQuality_SRS1JN( "SRAW (SRAW2) + JPEG Small1 Normal" ),
        EdsImageQuality_SRS2JF( "SRAW (SRAW2) + JPEG Small2" ),
        EdsImageQuality_SRS3JF( "SRAW (SRAW2) + JPEG Small3" ),

        EdsImageQuality_SRLJ( "SRAW (SRAW2) + JPEG Large" ),
        EdsImageQuality_SRM1J( "SRAW (SRAW2) + JPEG Medium 1" ),
        EdsImageQuality_SRM2J( "SRAW (SRAW2) + JPEG Medium 2" ),
        EdsImageQuality_SRSJ( "SRAW (SRAW2) + JPEG Small" ),

        EdsImageQuality_Unknown( "Unknown" );

        private final int value;
        private final String description;

        EdsImageQuality( final String description ) {
            value = CanonUtils.classIntField( EdSdkLibrary.EdsImageQuality.class, name() );
            this.description = description;
        }

        @Override
        public final Integer value() {
            return value;
        }

        @Override
        public final String description() {
            return description;
        public static final EdsImageQuality enumOfName( final String name ) {
            return (EdsImageQuality) CanonConstants.enumOfName( EdsImageQuality.class, name );
        }

        public static final EdsImageQuality enumOfValue( final int value ) {
            return (EdsImageQuality) CanonConstants.enumOfValue( EdsImageQuality.class, value );
        }

        public static final EdsImageQuality enumOfDescription( final String description ) {
            return (EdsImageQuality) CanonConstants.enumOfDescription( EdsImageQuality.class, description );
        }
    }

    public enum EdsImageQualityForLegacy implements DescriptiveEnum {
        kEdsImageQualityForLegacy_LJ( "JPEG large" ),
        kEdsImageQualityForLegacy_M1J( "JPEG medium 1" ),
        kEdsImageQualityForLegacy_M2J( "JPEG medium 2" ),
        kEdsImageQualityForLegacy_SJ( "JPEG small" ),

        kEdsImageQualityForLegacy_LJF( "JPEG large fine" ),
        kEdsImageQualityForLegacy_LJN( "JPEG large normal" ),
        kEdsImageQualityForLegacy_MJF( "JPEG medium fine" ),
        kEdsImageQualityForLegacy_MJN( "JPEG medium normal" ),
        kEdsImageQualityForLegacy_SJF( "JPEG small fine" ),
        kEdsImageQualityForLegacy_SJN( "JPEG small normal" ),

        kEdsImageQualityForLegacy_LR( "RAW" ),
        kEdsImageQualityForLegacy_LRLJF( "RAW + JPEG large fine" ),
        kEdsImageQualityForLegacy_LRLJN( "RAW + JPEG large normal" ),
        kEdsImageQualityForLegacy_LRMJF( "RAW + JPEG medium fine" ),
        kEdsImageQualityForLegacy_LRMJN( "RAW + JPEG medium normal" ),
        kEdsImageQualityForLegacy_LRSJF( "RAW + JPEG small fine" ),
        kEdsImageQualityForLegacy_LRSJN( "RAW + JPEG small normal" ),

        kEdsImageQualityForLegacy_LR2( "RAW " ),
        kEdsImageQualityForLegacy_LR2LJ( "RAW + JPEG large" ),
        kEdsImageQualityForLegacy_LR2M1J( "RAW + JPEG medium 1" ),
        kEdsImageQualityForLegacy_LR2M2J( "RAW + JPEG medium 2" ),
        kEdsImageQualityForLegacy_LR2SJ( "RAW + JPEG small" ),

        kEdsImageQualityForLegacy_Unknown( "Unknown" );

        private final int value;
        private final String description;

        EdsImageQualityForLegacy( final String description ) {
            value = CanonUtils.classIntField( EdSdkLibrary.EdsImageQualityForLegacy.class, name() );
            this.description = description;
        }

        @Override
        public final Integer value() {
            return value;
        }

        @Override
        public final String description() {
            return description;
        }

        public static final EdsImageQualityForLegacy enumOfName( final String name ) {
            return (EdsImageQualityForLegacy) CanonConstants.enumOfName( EdsImageQualityForLegacy.class, name );
        }

        public static final EdsImageQualityForLegacy enumOfValue( final int value ) {
            return (EdsImageQualityForLegacy) CanonConstants.enumOfValue( EdsImageQualityForLegacy.class, value );
        }

        public static final EdsImageQualityForLegacy enumOfDescription( final String description ) {
            return (EdsImageQualityForLegacy) CanonConstants.enumOfDescription( EdsImageQualityForLegacy.class, description );
        }
    }

/*-----------------------------------------------------------------------------
 Image Source
 -----------------------------------------------------------------------------*/
    public enum EdsImageSource implements DescriptiveEnum {
        kEdsImageSrc_FullView( "Full-size" ),
        kEdsImageSrc_Thumbnail( "Thumbnail" ),
        kEdsImageSrc_Preview( "Preview" ),
        kEdsImageSrc_RAWThumbnail( "RAW thumbnail" ),
        kEdsImageSrc_RAWFullView( "RAW full-size" );

        private final int value;
        private final String description;

        EdsImageSource( final String description ) {
        kEdsWhiteBalance_Tangsten( "Tungsten" ),
            value = CanonUtils.classIntField( EdSdkLibrary.EdsImageSource.class, name() );
            this.description = description;
        }

        @Override
        public final Integer value() {
            return value;
        }

        @Override
        public final String description() {
            return description;
        }

        public static final EdsImageSource enumOfName( final String name ) {
            return (EdsImageSource) CanonConstants.enumOfName( EdsImageSource.class, name );
        }

        public static final EdsImageSource enumOfValue( final int value ) {
            return (EdsImageSource) CanonConstants.enumOfValue( EdsImageSource.class, value );
        }

        public static final EdsImageSource enumOfDescription( final String description ) {
            return (EdsImageSource) CanonConstants.enumOfDescription( EdsImageSource.class, description );
        }
    }

/*-----------------------------------------------------------------------------
 Target Image Types
 -----------------------------------------------------------------------------*/
    public enum EdsTargetImageType implements DescriptiveEnum {
        kEdsTargetImageType_Unknown( "Folder or unknown" ),
        kEdsTargetImageType_Jpeg( "JPEG" ),
        kEdsTargetImageType_TIFF( "8-bit TIFF" ),
        kEdsTargetImageType_TIFF16( "16-bit TIFF" ),
        kEdsTargetImageType_RGB( "8-bit RGB" ),
        kEdsTargetImageType_RGB16( "16-bit RGB" ),
        kEdsTargetImageType_DIB( "DIB (BMP)" );

        private final int value;
        private final String description;

        EdsTargetImageType( final String description ) {
            value = CanonUtils.classIntField( EdSdkLibrary.EdsTargetImageType.class, name() );
            this.description = description;
        }

        @Override
        public final Integer value() {
            return value;
        }

        @Override
        public final String description() {
            return description;
        }

        public static final EdsTargetImageType enumOfName( final String name ) {
            return (EdsTargetImageType) CanonConstants.enumOfName( EdsTargetImageType.class, name );
        }

        public static final EdsTargetImageType enumOfValue( final int value ) {
            return (EdsTargetImageType) CanonConstants.enumOfValue( EdsTargetImageType.class, value );
        }

        public static final EdsTargetImageType enumOfDescription( final String description ) {
            return (EdsTargetImageType) CanonConstants.enumOfDescription( EdsTargetImageType.class, description );
        }
    }

/*-----------------------------------------------------------------------------
 Progress Option
 -----------------------------------------------------------------------------*/
    public enum EdsProgressOption implements DescriptiveEnum {
        kEdsProgressOption_NoReport( "No callback" ),
        kEdsProgressOption_Done( "Callback when done" ),
        kEdsProgressOption_Periodically( "Periodic Callback" );

        private final int value;
        private final String description;

        EdsProgressOption( final String description ) {
            value = CanonUtils.classIntField( EdSdkLibrary.EdsProgressOption.class, name() );
            this.description = description;
        }

        @Override
        public final Integer value() {
            return value;
        }

        @Override
        public final String description() {
            return description;
        public static final EdsProgressOption enumOfName( final String name ) {
            return (EdsProgressOption) CanonConstants.enumOfName( EdsProgressOption.class, name );
        }

        public static final EdsProgressOption enumOfValue( final int value ) {
            return (EdsProgressOption) CanonConstants.enumOfValue( EdsProgressOption.class, value );
        }

        public static final EdsProgressOption enumOfDescription( final String description ) {
            return (EdsProgressOption) CanonConstants.enumOfDescription( EdsProgressOption.class, description );
        }
    }

/*-----------------------------------------------------------------------------
 File attribute
 -----------------------------------------------------------------------------*/
    public enum EdsFileAttributes implements DescriptiveEnum {
        kEdsFileAttribute_Normal( "Normal" ),
        kEdsFileAttribute_ReadOnly( "Read-Only" ),
        kEdsFileAttribute_Hidden( "Hidden" ),
        kEdsFileAttribute_System( "System" ),
        kEdsFileAttribute_Archive( "Archive" );

        private final int value;
        private final String description;

        EdsFileAttributes( final String description ) {
            value = CanonUtils.classIntField( EdSdkLibrary.EdsFileAttributes.class, name() );
            this.description = description;
        }

        @Override
        public final Integer value() {
            return value;
        }

        @Override
        public final String description() {
            return description;
        }

        public static final EdsFileAttributes enumOfName( final String name ) {
            return (EdsFileAttributes) CanonConstants.enumOfName( EdsFileAttributes.class, name );
        }

        public static final EdsFileAttributes enumOfValue( final int value ) {
            return (EdsFileAttributes) CanonConstants.enumOfValue( EdsFileAttributes.class, value );
        }

        public static final EdsFileAttributes enumOfDescription( final String description ) {
            return (EdsFileAttributes) CanonConstants.enumOfDescription( EdsFileAttributes.class, description );
        }
    }

/*-----------------------------------------------------------------------------
 Battery level
 -----------------------------------------------------------------------------*/
    // TODO: C++ enum values can have the same value, as in EdSdkLibrary.EdsBatteryLevel2... how to handle reverse lookup in JAVA? Have moved kEdsBatteryLevel2_Error as last identical value so that at least the user doesn't think something is OK when it might not be
    public enum EdsBatteryLevel2 implements DescriptiveEnum {
        kEdsBatteryLevel2_Empty( "Empty" ),
        kEdsBatteryLevel2_Low( "Low" ),
        kEdsBatteryLevel2_Half( "Half" ),
        kEdsBatteryLevel2_Normal( "Normal" ),
        kEdsBatteryLevel2_Hi( "Hi" ),
        kEdsBatteryLevel2_Quarter( "Quarter" ),
        kEdsBatteryLevel2_BCLevel( "BC Level" ),
        kEdsBatteryLevel2_Error( "Error" ),
        kEdsBatteryLevel2_AC( "AC power" );

        private final int value;
        private final String description;

        EdsBatteryLevel2( final String description ) {
            value = CanonUtils.classIntField( EdSdkLibrary.EdsBatteryLevel2.class, name() );
            this.description = description;
        }

        @Override
        public final Integer value() {
            return value;
        }

        @Override
        public static final EdsBatteryLevel2 enumOfValue( final int value ) {
        public final String description() {
            return description;
        }

        public static final EdsBatteryLevel2 enumOfName( final String name ) {
            return (EdsBatteryLevel2) CanonConstants.enumOfName( EdsBatteryLevel2.class, name );
            return (EdsBatteryLevel2) CanonConstants.enumOfValue( EdsBatteryLevel2.class, value );
        }

        public static final EdsBatteryLevel2 enumOfDescription( final String description ) {
            return (EdsBatteryLevel2) CanonConstants.enumOfDescription( EdsBatteryLevel2.class, description );
        }
    }

/*-----------------------------------------------------------------------------
 Save To
 -----------------------------------------------------------------------------*/
    public enum EdsSaveTo implements DescriptiveEnum {
        kEdsSaveTo_Camera( "Camera" ),
        kEdsSaveTo_Host( "Host Computer" ),
        kEdsSaveTo_Both( "Both" );

        private final int value;
        private final String description;

        EdsSaveTo( final String description ) {
            value = CanonUtils.classIntField( EdSdkLibrary.EdsSaveTo.class, name() );
            this.description = description;
        }

        @Override
        public final Integer value() {
            return value;
        }

        @Override
        public final String description() {
            return description;
        }

        public static final EdsSaveTo enumOfName( final String name ) {
            return (EdsSaveTo) CanonConstants.enumOfName( EdsSaveTo.class, name );
        }

        public static final EdsSaveTo enumOfValue( final int value ) {
            return (EdsSaveTo) CanonConstants.enumOfValue( EdsSaveTo.class, value );
        }

        public static final EdsSaveTo enumOfDescription( final String description ) {
            return (EdsSaveTo) CanonConstants.enumOfDescription( EdsSaveTo.class, description );
        }
    }

/*-----------------------------------------------------------------------------
 StorageType
 -----------------------------------------------------------------------------*/
    public enum EdsStorageType implements DescriptiveEnum {
        kEdsStorageType_Non( "No memory card" ),
        kEdsStorageType_CF( "Compact Flash" ),
        kEdsStorageType_SD( "SD Flash" ),
        kEdsStorageType_HD( "Hard Drive" );

        private final int value;
        private final String description;

        EdsStorageType( final String description ) {
            value = CanonUtils.classIntField( EdSdkLibrary.EdsStorageType.class, name() );
            this.description = description;
        }

        @Override
        public final Integer value() {
            return value;
        }

        @Override
        public final String description() {
            return description;
        }

        public static final EdsStorageType enumOfName( final String name ) {
            return (EdsStorageType) CanonConstants.enumOfName( EdsStorageType.class, name );
        }

        public static final EdsStorageType enumOfValue( final int value ) {
            return (EdsStorageType) CanonConstants.enumOfValue( EdsStorageType.class, value );
        }

        public static final EdsStorageType enumOfDescription( final String description ) {
            return (EdsStorageType) CanonConstants.enumOfDescription( EdsStorageType.class, description );
        }
    }
        kEdsWhiteBalance_Cloudy( "Cloudy" ),
        }

/*-----------------------------------------------------------------------------
 White Balance
 -----------------------------------------------------------------------------*/
    public enum EdsWhiteBalance implements DescriptiveEnum {
        kEdsWhiteBalance_Auto( "Auto" ),
        kEdsWhiteBalance_Daylight( "Daylight" ),
        kEdsWhiteBalance_Fluorescent( "Fluorescent" ),
        kEdsWhiteBalance_Strobe( "Flash" ),
        kEdsWhiteBalance_WhitePaper( "Manual" ),
        kEdsWhiteBalance_Shade( "Shade" ),
        kEdsWhiteBalance_ColorTemp( "Color temperature" ),
        kEdsWhiteBalance_PCSet1( "Custom: PC-1" ),
        kEdsWhiteBalance_PCSet2( "Custom: PC-2" ),
        kEdsWhiteBalance_PCSet3( "Custom: PC-3" ),
        kEdsWhiteBalance_WhitePaper2( "Manual 2" ),
        kEdsWhiteBalance_WhitePaper3( "Manual 3" ),
        kEdsWhiteBalance_WhitePaper4( "Manual 4" ),
        kEdsWhiteBalance_WhitePaper5( "Manual 5" ),
        kEdsWhiteBalance_PCSet4( "Custom: PC-4" ),
        kEdsWhiteBalance_PCSet5( "Custom: PC-5" ),
        kEdsWhiteBalance_Click( "Click to set" ),
        kEdsWhiteBalance_Pasted( "Copied from image" );

        private final int value;
        private final String description;

        EdsWhiteBalance( final String description ) {
            value = CanonUtils.classIntField( EdSdkLibrary.EdsWhiteBalance.class, name() );
            this.description = description;
        }

        @Override
        public final Integer value() {
            return value;
        }

        @Override
        public final String description() {
            return description;
        }

        public static final EdsWhiteBalance enumOfName( final String name ) {
            return (EdsWhiteBalance) CanonConstants.enumOfName( EdsWhiteBalance.class, name );
        }

        public static final EdsWhiteBalance enumOfValue( final int value ) {
            return (EdsWhiteBalance) CanonConstants.enumOfValue( EdsWhiteBalance.class, value );
        }

        public static final EdsWhiteBalance enumOfDescription( final String description ) {
            return (EdsWhiteBalance) CanonConstants.enumOfDescription( EdsWhiteBalance.class, description );
        }
    }

/*-----------------------------------------------------------------------------
 Photo Effects
 -----------------------------------------------------------------------------*/
    public enum EdsPhotoEffect implements DescriptiveEnum {
        kEdsPhotoEffect_Off( "Off" ),
        kEdsPhotoEffect_Monochrome( "Monochrome" );

        private final int value;
        private final String description;

        EdsPhotoEffect( final String description ) {
            value = CanonUtils.classIntField( EdSdkLibrary.EdsPhotoEffect.class, name() );
            this.description = description;
        }

        @Override
        public final Integer value() {
            return value;
        }

        @Override
        public final String description() {
            return description;
        }

        public static final EdsPhotoEffect enumOfName( final String name ) {
            return (EdsPhotoEffect) CanonConstants.enumOfName( EdsPhotoEffect.class, name );
        }

        public static final EdsPhotoEffect enumOfValue( final int value ) {
            return (EdsPhotoEffect) CanonConstants.enumOfValue( EdsPhotoEffect.class, value );
        }

        public static final EdsPhotoEffect enumOfDescription( final String description ) {
            return (EdsPhotoEffect) CanonConstants.enumOfDescription( EdsPhotoEffect.class, description );
        kEdsColorMatrix_2( "ColorMatrix2" ),
    }

/*-----------------------------------------------------------------------------
 Color Matrix
 -----------------------------------------------------------------------------*/
    public enum EdsColorMatrix implements DescriptiveEnum {
        kEdsColorMatrix_Custom( "Custom" ),
        kEdsColorMatrix_1( "ColorMatrix1" ),
        kEdsColorMatrix_3( "ColorMatrix3" ),
        kEdsColorMatrix_4( "ColorMatrix4" ),
        kEdsColorMatrix_5( "ColorMatrix5" ),
        kEdsColorMatrix_6( "ColorMatrix6" ),
        kEdsColorMatrix_7( "ColorMatrix7" );

        private final int value;
        private final String description;

        EdsColorMatrix( final String description ) {
            value = CanonUtils.classIntField( EdSdkLibrary.EdsColorMatrix.class, name() );
            this.description = description;
        }

        @Override
        public final Integer value() {
            return value;
        }

        @Override
        public final String description() {
            return description;
        }

        public static final EdsColorMatrix enumOfName( final String name ) {
            return (EdsColorMatrix) CanonConstants.enumOfName( EdsColorMatrix.class, name );
        }

        public static final EdsColorMatrix enumOfValue( final int value ) {
            return (EdsColorMatrix) CanonConstants.enumOfValue( EdsColorMatrix.class, value );
        }

        public static final EdsColorMatrix enumOfDescription( final String description ) {
            return (EdsColorMatrix) CanonConstants.enumOfDescription( EdsColorMatrix.class, description );
        }
    }

/*-----------------------------------------------------------------------------
 Filter Effects
 -----------------------------------------------------------------------------*/
    public enum EdsFilterEffect implements DescriptiveEnum {
        kEdsFilterEffect_None( "None" ),
        kEdsFilterEffect_Yellow( "Yellow" ),
        kEdsFilterEffect_Orange( "Orange" ),
        kEdsFilterEffect_Red( "Red" ),
        kEdsFilterEffect_Green( "Green" );

        private final int value;
        private final String description;

        EdsFilterEffect( final String description ) {
            value = CanonUtils.classIntField( EdSdkLibrary.EdsFilterEffect.class, name() );
            this.description = description;
        }

        @Override
        public final Integer value() {
            return value;
        }

        @Override
        public final String description() {
            return description;
        }

        public static final EdsFilterEffect enumOfName( final String name ) {
            return (EdsFilterEffect) CanonConstants.enumOfName( EdsFilterEffect.class, name );
        }

        public static final EdsFilterEffect enumOfValue( final int value ) {
            return (EdsFilterEffect) CanonConstants.enumOfValue( EdsFilterEffect.class, value );
        }

        public static final EdsFilterEffect enumOfDescription( final String description ) {
            return (EdsFilterEffect) CanonConstants.enumOfDescription( EdsFilterEffect.class, description );
        }
    }

/*-----------------------------------------------------------------------------
 Toning Effects
 -----------------------------------------------------------------------------*/
    public enum EdsTonigEffect implements DescriptiveEnum {
        kEdsTonigEffect_None( "None" ),
        kEdsTonigEffect_Sepia( "Sepia" ),
        kEdsTonigEffect_Blue( "Blue" ),
        kEdsTonigEffect_Purple( "Purple" ),
        kEdsTonigEffect_Green( "Green" );

        private final int value;
        private final String description;

        EdsTonigEffect( final String description ) {
            value = CanonUtils.classIntField( EdSdkLibrary.EdsTonigEffect.class, name() );
            this.description = description;
        }

        @Override
        public final Integer value() {
            return value;
        }

        @Override
        public final String description() {
            return description;
        }

        public static final EdsTonigEffect enumOfName( final String name ) {
            return (EdsTonigEffect) CanonConstants.enumOfName( EdsTonigEffect.class, name );
        }

        public static final EdsTonigEffect enumOfValue( final int value ) {
            return (EdsTonigEffect) CanonConstants.enumOfValue( EdsTonigEffect.class, value );
        }

        public static final EdsTonigEffect enumOfDescription( final String description ) {
            return (EdsTonigEffect) CanonConstants.enumOfDescription( EdsTonigEffect.class, description );
        }
    }

/*-----------------------------------------------------------------------------
 Color Space
 -----------------------------------------------------------------------------*/
    public enum EdsColorSpace implements DescriptiveEnum {
        kEdsColorSpace_sRGB( "sRGB" ),
        kEdsColorSpace_AdobeRGB( "AdobeRGB" ),
        kEdsColorSpace_Unknown( "Unknown" );

        private final int value;
        private final String description;

        EdsColorSpace( final String description ) {
            value = CanonUtils.classIntField( EdSdkLibrary.EdsColorSpace.class, name() );
            this.description = description;
        }

        @Override
        public final Integer value() {
            return value;
        }

        @Override
        public final String description() {
            return description;
        }

        public static final EdsColorSpace enumOfName( final String name ) {
            return (EdsColorSpace) CanonConstants.enumOfName( EdsColorSpace.class, name );
        }

        public static final EdsColorSpace enumOfValue( final int value ) {
            return (EdsColorSpace) CanonConstants.enumOfValue( EdsColorSpace.class, value );
        }

        public static final EdsColorSpace enumOfDescription( final String description ) {
            return (EdsColorSpace) CanonConstants.enumOfDescription( EdsColorSpace.class, description );
        }
    }

/*-----------------------------------------------------------------------------
 PictureStyle
 -----------------------------------------------------------------------------*/
    public enum EdsPictureStyle implements DescriptiveEnum {
        kEdsPictureStyle_Standard( "Standard" ),
        kEdsPictureStyle_Portrait( "Portrait" ),
        kEdsPictureStyle_Landscape( "Landscape" ),
        kEdsPictureStyle_Neutral( "Neutral" ),
        kEdsPictureStyle_Faithful( "Faithful" ),
        kEdsPictureStyle_Monochrome( "Monochrome" ),
        kEdsPictureStyle_Auto( "Auto" ),
        kEdsPictureStyle_User1( "User 1" ),
        kEdsPictureStyle_User2( "User 2" ),
        kEdsPictureStyle_User3( "User 3" ),
        kEdsPictureStyle_PC1( "Computer 1" ),
        kEdsPictureStyle_PC2( "Computer 2" ),
        kEdsPictureStyle_PC3( "Computer 3" );

        private final int value;
        private final String description;

        EdsPictureStyle( final String description ) {
            value = CanonUtils.classIntField( EdSdkLibrary.EdsPictureStyle.class, name() );
            this.description = description;
        }

        @Override
        public final Integer value() {
            return value;
        }

        @Override
        public final String description() {
            return description;
        }

        public static final EdsPictureStyle enumOfName( final String name ) {
            return (EdsPictureStyle) CanonConstants.enumOfName( EdsPictureStyle.class, name );
        }

        public static final EdsPictureStyle enumOfValue( final int value ) {
            return (EdsPictureStyle) CanonConstants.enumOfValue( EdsPictureStyle.class, value );
        }

        public static final EdsPictureStyle enumOfDescription( final String description ) {
            return (EdsPictureStyle) CanonConstants.enumOfDescription( EdsPictureStyle.class, description );
        }
    }

/*-----------------------------------------------------------------------------
 Transfer Option
 -----------------------------------------------------------------------------*/
    public enum EdsTransferOption implements DescriptiveEnum {
        kEdsTransferOption_ByDirectTransfer( "By Direct Transfer" ),
        kEdsTransferOption_ByRelease( "By Release" ),
        kEdsTransferOption_ToDesktop( "To Desktop" );

        private final int value;
        private final String description;

        EdsTransferOption( final String description ) {
            value = CanonUtils.classIntField( EdSdkLibrary.EdsTransferOption.class, name() );
            this.description = description;
        }

        @Override
        public final Integer value() {
            return value;
        }

        @Override
        public final String description() {
            return description;
        }

        public static final EdsTransferOption enumOfName( final String name ) {
            return (EdsTransferOption) CanonConstants.enumOfName( EdsTransferOption.class, name );
        }

        public static final EdsTransferOption enumOfValue( final int value ) {
            return (EdsTransferOption) CanonConstants.enumOfValue( EdsTransferOption.class, value );
        }

        public static final EdsTransferOption enumOfDescription( final String description ) {
            return (EdsTransferOption) CanonConstants.enumOfDescription( EdsTransferOption.class, description );
        }
    }

/*-----------------------------------------------------------------------------
 Shooting Mode
 -----------------------------------------------------------------------------*/
    public enum EdsAEMode implements DescriptiveEnum {
        kEdsAEMode_Program( "Program AE" ),
        kEdsAEMode_Tv( "Shutter-Speed Priority AE" ),
        kEdsAEMode_Av( "Aperture Priority AE" ),
        kEdsAEMode_Manual( "Manual Exposure" ),
        kEdsAEMode_Bulb( "Bulb" ),
        kEdsAEMode_A_DEP( "Auto Depth-of-Field AE" ),
        kEdsAEMode_DEP( "Depth-of-Field AE" ),
        kEdsAEMode_Custom( "Camera settings registered" ),
        kEdsAEMode_Lock( "Lock" ),
        kEdsAEMode_Green( "Auto" ),
        kEdsAEMode_NightPortrait( "Night Scene Portrait" ),
        kEdsAEMode_Sports( "Sports" ),
        kEdsAEMode_Portrait( "Portrait" ),
        kEdsAEMode_Landscape( "Landscape" ),
        kEdsAEMode_Closeup( "Close-Up" ),
        kEdsAEMode_FlashOff( "Flash Off" ),
        kEdsAEMode_CreativeAuto( "Creative Auto" ),
        kEdsAEMode_Movie( "Movie" ),
        kEdsAEMode_PhotoInMovie( "Photo In Movie" ),
        //kEdsAEMode_SceneIntelligentAuto( "Scene Intelligent Auto" ), // in EDSDK 2.11.3 (or earlier), removed EDSDK <= 2.13.2
        kEdsAEMode_Unknown( "Unknown" );

        private final int value;
        private final String description;

        EdsAEMode( final String description ) {
            value = CanonUtils.classIntField( EdSdkLibrary.EdsAEMode.class, name() );
            this.description = description;
        }

        @Override
        public final Integer value() {
            return value;
        }

        @Override
        public final String description() {
            return description;
        }

        public static final EdsAEMode enumOfName( final String name ) {
            return (EdsAEMode) CanonConstants.enumOfName( EdsAEMode.class, name );
        }

        public static final EdsAEMode enumOfValue( final int value ) {
            return (EdsAEMode) CanonConstants.enumOfValue( EdsAEMode.class, value );
        }

        public static final EdsAEMode enumOfDescription( final String description ) {
            return (EdsAEMode) CanonConstants.enumOfDescription( EdsAEMode.class, description );
        }
    }

/*-----------------------------------------------------------------------------
 Bracket
 -----------------------------------------------------------------------------*/
    public enum EdsBracket implements DescriptiveEnum {
        kEdsBracket_AEB( "AE" ),
        kEdsBracket_ISOB( "ISO" ),
        kEdsBracket_WBB( "WB" ),
        kEdsBracket_FEB( "FE" ),
        kEdsBracket_Unknown( "Off" );

        private final int value;
        private final String description;

        EdsBracket( final String description ) {
            value = CanonUtils.classIntField( EdSdkLibrary.EdsBracket.class, name() );
            this.description = description;
        }

        @Override
        public final Integer value() {
            return value;
        }

        @Override
        public final String description() {
            return description;
        }

        public static final EdsBracket enumOfName( final String name ) {
            return (EdsBracket) CanonConstants.enumOfName( EdsBracket.class, name );
        }

        public static final EdsBracket enumOfValue( final int value ) {
            return (EdsBracket) CanonConstants.enumOfValue( EdsBracket.class, value );
        }

        public static final EdsBracket enumOfDescription( final String description ) {
            return (EdsBracket) CanonConstants.enumOfDescription( EdsBracket.class, description );
        }
    }

/*-----------------------------------------------------------------------------
 EVF Output Device [Flag]
 -----------------------------------------------------------------------------*/
    public enum EdsEvfOutputDevice implements DescriptiveEnum {
        kEdsEvfOutputDevice_TFT( "Camera" ),
        kEdsEvfOutputDevice_PC( "Host Computer" );

        private final int value;
        private final String description;

        EdsEvfOutputDevice( final String description ) {
            value = CanonUtils.classIntField( EdSdkLibrary.EdsEvfOutputDevice.class, name() );
            this.description = description;
        }

        @Override
        public final Integer value() {
            return value;
        }

        @Override
        public final String description() {
            return description;
        }

        public static final EdsEvfOutputDevice enumOfName( final String name ) {
            return (EdsEvfOutputDevice) CanonConstants.enumOfName( EdsEvfOutputDevice.class, name );
        }

        public static final EdsEvfOutputDevice enumOfValue( final int value ) {
            return (EdsEvfOutputDevice) CanonConstants.enumOfValue( EdsEvfOutputDevice.class, value );
        }

        kEdsStroboModeManual( "Manual" );
        public static final EdsEvfOutputDevice enumOfDescription( final String description ) {
            return (EdsEvfOutputDevice) CanonConstants.enumOfDescription( EdsEvfOutputDevice.class, description );
        }
    }

/*-----------------------------------------------------------------------------
 EVF Zoom
 -----------------------------------------------------------------------------*/
    public enum EdsEvfZoom implements DescriptiveEnum {
        kEdsEvfZoom_Fit( "Fit Screen" ),
        kEdsEvfZoom_x5( "5 times" ),
        kEdsEvfZoom_x10( "10 times" );

        private final int value;
        private final String description;

        EdsEvfZoom( final String description ) {
            value = CanonUtils.classIntField( EdSdkLibrary.EdsEvfZoom.class, name() );
            this.description = description;
        }

        @Override
        public final Integer value() {
            return value;
        }

        @Override
        public final String description() {
            return description;
        }

        public static final EdsEvfZoom enumOfName( final String name ) {
            return (EdsEvfZoom) CanonConstants.enumOfName( EdsEvfZoom.class, name );
        }

        public static final EdsEvfZoom enumOfValue( final int value ) {
            return (EdsEvfZoom) CanonConstants.enumOfValue( EdsEvfZoom.class, value );
        }

        public static final EdsEvfZoom enumOfDescription( final String description ) {
            return (EdsEvfZoom) CanonConstants.enumOfDescription( EdsEvfZoom.class, description );
        }
    }

/*-----------------------------------------------------------------------------
 EVF AF Mode
 -----------------------------------------------------------------------------*/
    public enum EdsEvfAFMode implements DescriptiveEnum {
        Evf_AFMode_Quick( "Quick" ),
        Evf_AFMode_Live( "Live" ),
        Evf_AFMode_LiveFace( "Live Face" );

        private final int value;
        private final String description;

        EdsEvfAFMode( final String description ) {
            value = CanonUtils.classIntField( EdSdkLibrary.EdsEvfAFMode.class, name() );
            this.description = description;
        }

        @Override
        public final Integer value() {
            return value;
        }

        @Override
        public final String description() {
            return description;
        }

        public static final EdsEvfAFMode enumOfName( final String name ) {
            return (EdsEvfAFMode) CanonConstants.enumOfName( EdsEvfAFMode.class, name );
        }

        public static final EdsEvfAFMode enumOfValue( final int value ) {
            return (EdsEvfAFMode) CanonConstants.enumOfValue( EdsEvfAFMode.class, value );
        }

        public static final EdsEvfAFMode enumOfDescription( final String description ) {
            return (EdsEvfAFMode) CanonConstants.enumOfDescription( EdsEvfAFMode.class, description );
        }
    }

/*-----------------------------------------------------------------------------
 Strobo Mode
 -----------------------------------------------------------------------------*/

    public enum EdsStroboMode implements DescriptiveEnum {
        kEdsStroboModeInternal( "Internal" ),
        kEdsStroboModeExternalETTL( "External ETTL" ),
        kEdsStroboModeExternalATTL( "External ATTL" ),
        kEdsStroboModeExternalTTL( "External TTL" ),
        kEdsStroboModeExternalAuto( "External Auto" ),
        kEdsStroboModeExternalManual( "External Manual" ),
        private final int value;
        private final String description;

        EdsStroboMode( final String description ) {
            value = CanonUtils.classIntField( EdSdkLibrary.EdsStroboMode.class, name() );
            this.description = description;
        }

        @Override
        public final Integer value() {
            return value;
        }

        @Override
        public final String description() {
            return description;
        }

        public static final EdsStroboMode enumOfName( final String name ) {
            return (EdsStroboMode) CanonConstants.enumOfName( EdsStroboMode.class, name );
        }

        public static final EdsStroboMode enumOfValue( final int value ) {
            return (EdsStroboMode) CanonConstants.enumOfValue( EdsStroboMode.class, value );
        }

        public static final EdsStroboMode enumOfDescription( final String description ) {
            return (EdsStroboMode) CanonConstants.enumOfDescription( EdsStroboMode.class, description );
        }
    }

/*-----------------------------------------------------------------------------
 ETTL-II Mode
 -----------------------------------------------------------------------------*/
    public enum EdsETTL2Mode implements DescriptiveEnum {
        kEdsETTL2ModeEvaluative( "Evaluative" ),
        kEdsETTL2ModeAverage( "Average" );

        private final int value;
        private final String description;

        EdsETTL2Mode( final String description ) {
            value = CanonUtils.classIntField( EdSdkLibrary.EdsETTL2Mode.class, name() );
            this.description = description;
        }

        @Override
        public final Integer value() {
            return value;
        }

        @Override
        public final String description() {
            return description;
        }

        public static final EdsETTL2Mode enumOfName( final String name ) {
            return (EdsETTL2Mode) CanonConstants.enumOfName( EdsETTL2Mode.class, name );
        }

        public static final EdsETTL2Mode enumOfValue( final int value ) {
            return (EdsETTL2Mode) CanonConstants.enumOfValue( EdsETTL2Mode.class, value );
        }

        public static final EdsETTL2Mode enumOfDescription( final String description ) {
            return (EdsETTL2Mode) CanonConstants.enumOfDescription( EdsETTL2Mode.class, description );
        }
    }

=======
 * A Lot of constants. 
 * @author hansi
 *
 * Copyright © 2014 Hansi Raber 
 * This work is free. You can redistribute it and/or modify it under the
 * terms of the Do What The Fuck You Want To Public License, Version 2,
 * as published by Sam Hocevar. See the COPYING file for more details.
 */
public interface CanonConstants {
	public final static int Av_1 = 0x08;
	public final static int Av_1_1 = 0x0B;
	public final static int Av_1_2 = 0x0C;
	public final static int Av_1_2b = 0x0D;
	public final static int Av_1_4 = 0x10;
	public final static int Av_1_6 = 0x13;
	public final static int Av_1_8 = 0x14;
	public final static int Av_1_8b = 0x15;
	public final static int Av_2 = 0x18;
	public final static int Av_2_2 = 0x1B;
	public final static int Av_2_5 = 0x1C;
	public final static int Av_2_5b = 0x1D;
	public final static int Av_2_8 = 0x20;
	public final static int Av_3_2 = 0x23;
	public final static int Av_3_5 = 0x24;
	public final static int Av_3_5b = 0x25;
	public final static int Av_4 = 0x28;
	public final static int Av_4_5 = 0x2B;
	public final static int Av_4_5b = 0x2C;
	public final static int Av_5_0 = 0x2D;
	public final static int Av_5_6 = 0x30;
	public final static int Av_6_3 = 0x33;
	public final static int Av_6_7 = 0x34;
	public final static int Av_7_1 = 0x35;
	public final static int Av_8 = 0x38;
	public final static int Av_9 = 0x3B;
	public final static int Av_9_5 = 0x3C;
	public final static int Av_10 = 0x3D;
	public final static int Av_11 = 0x40;
	public final static int Av_13 = 0x43;
	public final static int Av_13_b = 0x44;
	public final static int Av_14 = 0x45;
	public final static int Av_16 = 0x48;
	public final static int Av_18 = 0x4B;
	public final static int Av_19 = 0x4C;
	public final static int Av_20 = 0x4D;
	public final static int Av_22 = 0x50;
	public final static int Av_25 = 0x53;
	public final static int Av_27 = 0x54;
	public final static int Av_29 = 0x55;
	public final static int Av_32 = 0x58;
	public final static int Av_36 = 0x5B;
	public final static int Av_38 = 0x5C;
	public final static int Av_40 = 0x5D;
	public final static int Av_45 = 0x60;
	public final static int Av_51 = 0x63;
	public final static int Av_54 = 0x64;
	public final static int Av_57 = 0x65;
	public final static int Av_64 = 0x68;
	public final static int Av_72 = 0x6B;
	public final static int Av_76 = 0x6C;
	public final static int Av_80 = 0x6D;
	public final static int Av_91 = 0x70;
	public final static int Av_invalid = 0xFFFFFFFF;
	
	public final static int Tv_BULB = 0x0C;
	public final static int Tv_30 = 0x10;
	public final static int Tv_25 = 0x13;
	public final static int Tv_20 = 0x14;
	public final static int Tv_20b = 0x15;
	public final static int Tv_15 = 0x18;
	public final static int Tv_13 = 0x1B;
	public final static int Tv_10 = 0x1C;
	public final static int Tv_10b = 0x1D;
	public final static int Tv_8 = 0x20;
	public final static int Tv_6 = 0x23;
	public final static int Tv_6b = 0x24;
	public final static int Tv_5 = 0x25;
	public final static int Tv_4 = 0x28;
	public final static int Tv_3_2 = 0x2B;
	public final static int Tv_3 = 0x2C;
	public final static int Tv_2_5 = 0x2D;
	public final static int Tv_2 = 0x30;
	public final static int Tv_1_6 = 0x33;
	public final static int Tv_1_5 = 0x34;
	public final static int Tv_1_3 = 0x35;
	public final static int Tv_1 = 0x38;
	public final static int Tv_0_8 = 0x3B;
	public final static int Tv_0_7 = 0x3C;
	public final static int Tv_0_6 = 0x3D;
	public final static int Tv_0_5 = 0x40;
	public final static int Tv_0_4 = 0x43;
	public final static int Tv_0_3 = 0x44;
	public final static int Tv_0_3b = 0x45;
	public final static int Tv_1by4 = 0x48;
	public final static int Tv_1by5 = 0x4B;
	public final static int Tv_1by6 = 0x4C;
	public final static int Tv_1by6b = 0x4D;
	public final static int Tv_1by8 = 0x50;
	public final static int Tv_1by10 = 0x53;
	public final static int Tv_1by10b = 0x54;
	public final static int Tv_1by25 = 0x5D;
	public final static int Tv_1by30 = 0x60;
	public final static int Tv_1by40 = 0x63;
	public final static int Tv_1by45 = 0x64;
	public final static int Tv_1by50 = 0x65;
	public final static int Tv_1by60 = 0x68;
	public final static int Tv_1by80 = 0x6B;
	public final static int Tv_1by90 = 0x6C;
	public final static int Tv_1by100 = 0x6D;
	public final static int Tv_1by125 = 0x70;
	public final static int Tv_1by160 = 0x73;
	public final static int Tv_1by180 = 0x74;
	public final static int Tv_1by200 = 0x75;
	public final static int Tv_1by250 = 0x78;
	public final static int Tv_1by320 = 0x7B;
	public final static int Tv_1by350 = 0x7C;
	public final static int Tv_1by400 = 0x7D;
	public final static int Tv_1by500 = 0x80;
	public final static int Tv_1by640 = 0x83;
	public final static int Tv_1by750 = 0x84;
	public final static int Tv_1by800 = 0x85;
	public final static int Tv_1by1000 = 0x88;
	public final static int Tv_1by1250 = 0x8B;
	public final static int Tv_1by1500 = 0x8C;
	public final static int Tv_1by1600 = 0x8D;
	public final static int Tv_1by2000 = 0x90;
	public final static int Tv_1by2500 = 0x93;
	public final static int Tv_1by3000 = 0x94;
	public final static int Tv_1by3200 = 0x95;
	public final static int Tv_1by4000 = 0x98;
	public final static int Tv_1by5000 = 0x9B;
	public final static int Tv_1by6000 = 0x9C;
	public final static int Tv_1by6400 = 0x9D;
	public final static int Tv_1by8000 = 0xA0;
	public final static int Tv_invalid = 0xFFFFFFFF;
	
	public final static int ISO_6 = 0x28;
	public final static int ISO_12 = 0x30;
	public final static int ISO_25 = 0x38;
	public final static int ISO_50 = 0x40;
	public final static int ISO_100 = 0x48;
	public final static int ISO_125 = 0x4B;
	public final static int ISO_160 = 0x4D;
	public final static int ISO_200 = 0x50;
	public final static int ISO_250 = 0x53;
	public final static int ISO_320 = 0x55;
	public final static int ISO_400 = 0x58;
	public final static int ISO_500 = 0x5B;
	public final static int ISO_640 = 0x5D;
	public final static int ISO_800 = 0x60;
	public final static int ISO_1000 = 0x63;
	public final static int ISO_1250 = 0x65;
	public final static int ISO_1600 = 0x68;
	public final static int ISO_3200 = 0x70;
	public final static int ISO_6400 = 0x78;
	public final static int ISO_12800 = 0x80;
	public final static int ISO_25600 = 0x88;
	public final static int ISO_51200 = 0x90;
	public final static int ISO_102400 = 0x98;
	public final static int ISO_invalid = 0xFFFFFFFF;
	
	
	public final static int kEdsSaveTo_Camera = 1; 
	public final static int kEdsSaveTo_Host = 2; 
	public final static int kEdsSaveTo_Both = 3; 
	
	
	public final static int AFMode_OneShot = 0; 
	public final static int AFMode_AIServo = 1; 
	public final static int AFMode_AIFocus = 2; 
	public final static int AFMode_Manual = 3; 
>>>>>>> a0560a3efd37b3c0f25a1a05cff3f3a3c019985b
}
Solution content
        }

        @Override
     Object Event
         * computer.
        }

        @Override
        }
    }


        @Override
package edsdk.utils;

/**
 * A Lot of constants.
 * 
 * Copyright © 2014 Hansi Raber , Ananta Palani
 * 
 * This work is free. You can redistribute it and/or modify it under the
 * terms of the Do What The Fuck You Want To Public License, Version 2,
 * as published by Sam Hocevar. See the COPYING file for more details.
 * 
 * @author hansi
 * @author Ananta Palani
 * 
 */
import java.lang.reflect.Field;
import java.util.Arrays;
import java.util.HashMap;
import java.util.HashSet;
import java.util.LinkedHashMap;

import edsdk.bindings.EdSdkLibrary;

public class CanonConstants {

    private static final HashMap> nameLUT = new HashMap>();
    private static final HashMap> descriptionLUT = new HashMap>();
    private static final HashMap>> duplicateNameLUT = new HashMap>>();
    private static final HashMap>> duplicateDescriptionLUT = new HashMap>>();
    private static final HashMap>> tieredNameLUT = new HashMap>>();
    private static final HashMap>> tieredValueLUT = new HashMap>>();
    private static final HashMap>> tieredDescriptionLUT = new HashMap>>();
    private static final HashMap>>> tieredDuplicateValueLUT = new HashMap>>>();
    private static final HashMap>>> tieredDuplicateDescriptionLUT = new HashMap>>>();

    private static final HashSet constantIgnoreList = new HashSet( Arrays.asList( new String[] {
                                                                                                                "INSTANCE",
                                                                                                                "JNA_LIBRARY_NAME",
                                                                                                                "JNA_NATIVE_LIB",
                                                                                                                "NULL",
                                                                                                                "FALSE",
                                                                                                                "TRUE",
                                                                                                                "oldif" } ) );

    static {
        // The following pre-caches all enums to ensure that they will successfully load values from EdSdkLibrary generated by JNAerator
        //System.out.println("Pre-caching enums");
        final Class[] classes = CanonConstants.class.getClasses();

        for ( final Class klass : classes ) {
            if ( Enum.class.isAssignableFrom( klass ) &&
                 DescriptiveEnum.class.isAssignableFrom( klass ) ) {

                final DescriptiveEnum[] enums = (DescriptiveEnum[]) klass.getEnumConstants();

                if ( enums == null ) {
                    throw new IllegalStateException( "Class " +
                                                     klass.getCanonicalName() +
                                                     " was not initialized properly before before static initializer accessed, probably due to a dependency from a constructor accessing a static member or method of the outer class therefore requiring the static class to fully initialize first." );
                }

                for ( final DescriptiveEnum e : enums ) {
                    if ( e == null ) {
                        throw new IllegalStateException( "Class " +
        kEdsISOSpeed_12( 0x30, "12" ),
        }



        @Override
                                                         klass.getCanonicalName() +
                                                         " was not initialized properly before before static initializer accessed, probably due to a dependency from a constructor accessing a static member or method of the outer class therefore requiring the static class to fully initialize first." );
                    }

                    if ( !CanonConstants.nameLUT.containsKey( e.name() ) ) {
                        //System.out.println( e.name() );
                        CanonConstants.nameLUT.put( e.name(), e );
                    } else {
                        if ( !CanonConstants.duplicateNameLUT.containsKey( e.name() ) ) {
                            CanonConstants.duplicateNameLUT.put( e.name(), new HashSet>() );
                        }
                        CanonConstants.duplicateNameLUT.get( e.name() ).add( e );
                        //System.out.println( "Warning: there are multiple enums named "+e.name()+". Looking up this enum by name may not work as expected." );
                    }

                    if ( !CanonConstants.descriptionLUT.containsKey( e.description() ) ) {
                        CanonConstants.descriptionLUT.put( e.description(), e );
                    } else {
                        if ( !CanonConstants.duplicateDescriptionLUT.containsKey( e.description() ) ) {
                            CanonConstants.duplicateDescriptionLUT.put( e.description(), new HashSet>() );
                        }
                        CanonConstants.duplicateDescriptionLUT.get( e.description() ).add( e );
                        //System.out.println( "Warning: there are multiple enums with description "+e.description()+". Looking up this enum by description may not work as expected." );
                    }

                    if ( !CanonConstants.tieredNameLUT.containsKey( klass.getSimpleName() ) ) {
                        CanonConstants.tieredNameLUT.put( klass.getSimpleName(), new LinkedHashMap>() );
                        CanonConstants.tieredValueLUT.put( klass.getSimpleName(), new LinkedHashMap>() );
                        CanonConstants.tieredDescriptionLUT.put( klass.getSimpleName(), new LinkedHashMap>() );
                    }

                    CanonConstants.tieredNameLUT.get( klass.getSimpleName() ).put( e.name(), e );

                    if ( !CanonConstants.tieredValueLUT.get( klass.getSimpleName() ).containsKey( e.value() ) ) {
                        CanonConstants.tieredValueLUT.get( klass.getSimpleName() ).put( e.value(), e );
                    } else {
                        if ( !CanonConstants.tieredDuplicateValueLUT.containsKey( klass.getSimpleName() ) ) {
                            CanonConstants.tieredDuplicateValueLUT.put( klass.getSimpleName(), new HashMap>>() );
                        }
                        if ( !CanonConstants.tieredDuplicateValueLUT.get( klass.getSimpleName() ).containsKey( e.value() ) ) {
                            CanonConstants.tieredDuplicateValueLUT.get( klass.getSimpleName() ).put( e.value(), new HashSet>() );
                        }
                        CanonConstants.tieredDuplicateValueLUT.get( klass.getSimpleName() ).get( e.value() ).add( e );
                        //System.out.println( "Warning: there are multiple enums in "+klass.getCanonicalName()+" with value "+e.value()+". Looking up this enum by value may not work as expected." );
                    }

                    if ( !CanonConstants.tieredDescriptionLUT.get( klass.getSimpleName() ).containsKey( e.description() ) ) {
                        CanonConstants.tieredDescriptionLUT.get( klass.getSimpleName() ).put( e.description(), e );
                    } else {
                        if ( !CanonConstants.tieredDuplicateDescriptionLUT.containsKey( klass.getSimpleName() ) ) {
                            CanonConstants.tieredDuplicateDescriptionLUT.put( klass.getSimpleName(), new HashMap>>() );
                        }
                        if ( !CanonConstants.tieredDuplicateDescriptionLUT.get( klass.getSimpleName() ).containsKey( e.description() ) ) {
                            CanonConstants.tieredDuplicateDescriptionLUT.get( klass.getSimpleName() ).put( e.description(), new HashSet>() );
                        }
                        CanonConstants.tieredDuplicateDescriptionLUT.get( klass.getSimpleName() ).get( e.description() ).add( e );
                        //System.out.println( "Warning: there are multiple enums in "+klass.getCanonicalName()+" with description "+e.description()+". Looking up this enum by description may not work as expected." );
                    }
                }
            }
        }
    }

    /**
     * Ensure that {@link edsdk.utils.CanonConstants CanonConstants} contains
     * all
     * constant values from {@link edsdk.bindings.EdSdkLibrary}
     * 
     * @return true if {@link edsdk.utils.CanonConstants CanonConstants}
     *         contains
     *         all values, bar those in
     *         {@link edsdk.utils.CanonConstants#constantIgnoreList
     *         constantIgnoreList}
     */
    public static final boolean verifyAllConstants() {
        boolean nothingMissing = true;

        System.out.println( "Begin checking whether " +
                            CanonConstants.class.getSimpleName() +
                            " has all constants from EdSdkLibrary" );

        Field[] fields = EdSdkLibrary.class.getDeclaredFields();
        for ( final Field f : fields ) {
            if ( !CanonConstants.nameLUT.containsKey( f.getName() ) &&
                 !CanonConstants.constantIgnoreList.contains( f.getName() ) ) {
                System.err.println( CanonConstants.class.getSimpleName() +
                                    " is Missing: " + f.getName() + " in " +
                                    EdSdkLibrary.class.getCanonicalName() );
                nothingMissing = false;
            }
        }

        final Class[] edsdkClasses = EdSdkLibrary.class.getClasses();
        for ( final Class klass : edsdkClasses ) {
            fields = klass.getDeclaredFields();
            for ( final Field f : fields ) {
                if ( !CanonConstants.nameLUT.containsKey( f.getName() ) &&
                     !CanonConstants.constantIgnoreList.contains( f.getName() ) ) {
                    System.err.println( CanonConstants.class.getSimpleName() +
                                        " is Missing: " + f.getName() + " in " +
                                        klass.getCanonicalName() );
                    nothingMissing = false;
                }
            }
        }

        System.out.println( "Completed checking" );

        return nothingMissing;
    }

    public static final DescriptiveEnum enumOfName( final String name ) {
        return CanonConstants.nameLUT.get( name );
    }

    public static final DescriptiveEnum enumOfName( final Class> klass,
                                                       final String name ) {
        return CanonConstants.tieredNameLUT.get( klass.getSimpleName() ).get( name );
    }

    public static final DescriptiveEnum enumOfDescription( final Class> klass,
                                                              final String description ) {
        return CanonConstants.tieredDescriptionLUT.get( klass.getSimpleName() ).get( description );
    }

    public static final DescriptiveEnum enumOfValue( final Class> klass,
                                                        final int value ) {
        return CanonConstants.tieredValueLUT.get( klass.getSimpleName() ).get( value );
    }

    public interface DescriptiveEnum {

        public abstract String name();

        public abstract V value();

        public abstract String description();

    }

    /**
     * The following enum values are not defined by the EDSDK header
     * files, so values are taken from the EDSDK API documentation PDF and
     * compiled here for convenience. Interestingly, most of these are the
     * values (with
     * the exception of {@link edsdk.EdSdkLibrary#kEdsPropID_AEMode
     * kEdsPropID_AEMode} whose values are provided by the EDSDK) that can be
     * queried by {@link edsdk.EdSdkLibrary#EdsGetPropertyDesc
     * EdsGetPropertyDesc}
     */

    /**
     * Battery Quality
     * See: API Reference - 5.2.11 kEdsPropID_BatteryQuality
     */
    public enum EdsBatteryQuality implements DescriptiveEnum {
        kEdsBatteryQuality_Low( 0, "Very degraded" ),
        kEdsBatteryQuality_Half( 1, "Degraded" ),
        kEdsBatteryQuality_HI( 2, "Slight degradation" ),
        kEdsBatteryQuality_Full( 3, "No degradation" );

        private final int value;
        private final String description;

        EdsBatteryQuality( final int value, final String description ) {
            this.value = value;
            this.description = description;
        }

        @Override
        public final Integer value() {
            return value;
        }

        @Override
        public final String description() {
            return description;
        }

        public static final EdsBatteryQuality enumOfName( final String name ) {
            return (EdsBatteryQuality) CanonConstants.enumOfName( EdsBatteryQuality.class, name );
        }

        public static final EdsBatteryQuality enumOfValue( final int value ) {
            return (EdsBatteryQuality) CanonConstants.enumOfValue( EdsBatteryQuality.class, value );
        }

        public static final EdsBatteryQuality enumOfDescription( final String description ) {
            return (EdsBatteryQuality) CanonConstants.enumOfDescription( EdsBatteryQuality.class, description );
        }
    }

    /**
     * Drive Mode Values
     * See: API Reference - 5.2.18 kEdsPropID_DriveMode
     */
    public enum EdsDriveMode implements DescriptiveEnum {
        kEdsDriveMode_SingleFrame( 0x00000000, "Single-Frame Shooting" ),
        kEdsDriveMode_Continuous( 0x00000001, "Continuous Shooting" ),
        kEdsDriveMode_Video( 0x00000002, "Video" ),
        kEdsDriveMode_NotUsed( 0x00000003, "Not used" ),
        kEdsDriveMode_HighSpeedContinuous( 0x00000004, "High-Speed Continuous Shooting" ),
        kEdsDriveMode_LowSpeedContinuous( 0x00000005, "Low-Speed Continuous Shooting" ),
        kEdsDriveMode_SilentSingleFrame( 0x00000006, "Silent single shooting" ),
        kEdsDriveMode_10SecSelfTimerWithContinuous( 0x00000007, "10-Sec Self-Timer + Continuous Shooting" ),
        kEdsDriveMode_10SecSelfTimer( 0x00000010, "10-Sec Self-Timer" ),
        kEdsDriveMode_2SecSelfTimer( 0x00000011, "2-Sec Self-Timer" );

        private final int value;
        private final String description;

        EdsDriveMode( final int value, final String description ) {
            this.value = value;
            this.description = description;
        }

        @Override
        public final Integer value() {
            return value;
        }

        @Override
        public final String description() {
            return description;
        }

        public static final EdsDriveMode enumOfName( final String name ) {
            return (EdsDriveMode) CanonConstants.enumOfName( EdsDriveMode.class, name );
        }

        public static final EdsDriveMode enumOfValue( final int value ) {
            return (EdsDriveMode) CanonConstants.enumOfValue( EdsDriveMode.class, value );
        }

        public static final EdsDriveMode enumOfDescription( final String description ) {
            return (EdsDriveMode) CanonConstants.enumOfDescription( EdsDriveMode.class, description );
        }
    }

    /**
     * ISO Values
     * See: API Reference - 5.2.19 kEdsPropID_ISOSpeed
     * These values are taken from multiple EDSDK API Docs. Some values are
     * added are removed as support for cameras are added or removed
     */
    public enum EdsISOSpeed implements DescriptiveEnum {
        kEdsISOSpeed_Auto( 0x0, "Auto" ),
        kEdsISOSpeed_6( 0x28, "6" ),
        kEdsISOSpeed_25( 0x38, "25" ),
        kEdsISOSpeed_50( 0x40, "50" ),
        kEdsISOSpeed_100( 0x48, "100" ),
        kEdsISOSpeed_125( 0x4B, "125" ),
        kEdsISOSpeed_160( 0x4D, "160" ),
        kEdsISOSpeed_200( 0x50, "200" ),
        kEdsISOSpeed_250( 0x53, "250" ),
        kEdsISOSpeed_320( 0x55, "320" ),
        kEdsISOSpeed_400( 0x58, "400" ),
        kEdsISOSpeed_500( 0x5B, "500" ),
        kEdsISOSpeed_640( 0x5D, "640" ),
        kEdsISOSpeed_800( 0x60, "800" ),
        kEdsISOSpeed_1000( 0x63, "1000" ),
        kEdsISOSpeed_1250( 0x65, "1250" ),
        kEdsISOSpeed_1600( 0x68, "1600" ),
        kEdsISOSpeed_2000( 0x6b, "2000" ),
        kEdsISOSpeed_2500( 0x6d, "2500" ),
        kEdsISOSpeed_3200( 0x70, "3200" ),
        kEdsISOSpeed_4000( 0x73, "4000" ),
        kEdsISOSpeed_5000( 0x75, "5000" ),
        kEdsISOSpeed_6400( 0x78, "6400" ),
        kEdsISOSpeed_8000( 0x7b, "8000" ),
        kEdsISOSpeed_10000( 0x7d, "10000" ),
        kEdsISOSpeed_12800( 0x80, "12800" ),
        kEdsISOSpeed_25600( 0x88, "25600" ),
        kEdsISOSpeed_51200( 0x90, "51200" ),
        kEdsISOSpeed_102400( 0x98, "102400" ),
        kEdsISOSpeed_Unknown( 0xFFFFFFFF, "Not valid/no settings changes" );

        private final int value;
        private final String description;

        EdsISOSpeed( final int value, final String description ) {
            this.value = value;
            this.description = description;
        }

        @Override
        public final Integer value() {
            return value;
        }

        @Override
        public final String description() {
            return description;
        }

        public static final EdsISOSpeed enumOfName( final String name ) {
            return (EdsISOSpeed) CanonConstants.enumOfName( EdsISOSpeed.class, name );
        }

        public static final EdsISOSpeed enumOfValue( final int value ) {
            return (EdsISOSpeed) CanonConstants.enumOfValue( EdsISOSpeed.class, value );
        }

        public static final EdsISOSpeed enumOfDescription( final String description ) {
            return (EdsISOSpeed) CanonConstants.enumOfDescription( EdsISOSpeed.class, description );
        }
    }

    /**
     * Metering Mode Values
     * See: API Reference - 5.2.20 kEdsPropID_MeteringMode
     */
    public enum EdsMeteringMode implements DescriptiveEnum {
        kEdsMeteringMode_Spot( 1, "Spot metering" ),
        kEdsMeteringMode_Evaluative( 3, "Evaluative metering" ),
        kEdsMeteringMode_Partial( 4, "Partial metering" ),
        kEdsMeteringMode_CenterWeightedAvg( 5, "Center-weighted averaging metering" ),
        kEdsMeteringMode_Unknown( 0xFFFFFFFF, "Not valid/no settings changes" );

        private final int value;
        private final String description;

        EdsMeteringMode( final int value, final String description ) {
            this.value = value;
            this.description = description;
        }

        @Override
        public final Integer value() {
            return value;
        }

        @Override
        public final String description() {
            return description;
        }

        public static final EdsMeteringMode enumOfName( final String name ) {
            return (EdsMeteringMode) CanonConstants.enumOfName( EdsMeteringMode.class, name );
        }

        public static final EdsMeteringMode enumOfValue( final int value ) {
            return (EdsMeteringMode) CanonConstants.enumOfValue( EdsMeteringMode.class, value );
        public static final EdsMeteringMode enumOfDescription( final String description ) {
            return (EdsMeteringMode) CanonConstants.enumOfDescription( EdsMeteringMode.class, description );
        }
    }

    /**
     * Auto-Focus Mode Values
     * See: API Reference - 5.2.21 kEdsPropID_AFMode
     * Note: Read-only
     */
    public enum EdsAFMode implements DescriptiveEnum {
        kEdsAFMode_OneShot( 0, "One-Shot AF" ),
        kEdsAFMode_AIServo( 1, "AI Servo AF" ),
        kEdsAFMode_AIFocus( 2, "AI Focus AF" ),
        kEdsAFMode_Manual( 3, "Manual Focus" ),
        kEdsAFMode_Unknown( 0xFFFFFFFF, "Not valid/no settings changes" );

        private final int value;
        private final String description;

        EdsAFMode( final int value, final String description ) {
            this.value = value;
            this.description = description;
        }

        @Override
        public final Integer value() {
            return value;
        }

        @Override
        public final String description() {
            return description;
        }

        public static final EdsAFMode enumOfName( final String name ) {
            return (EdsAFMode) CanonConstants.enumOfName( EdsAFMode.class, name );
        }

        public static final EdsAFMode enumOfValue( final int value ) {
            return (EdsAFMode) CanonConstants.enumOfValue( EdsAFMode.class, value );
        }

        public static final EdsAFMode enumOfDescription( final String description ) {
            return (EdsAFMode) CanonConstants.enumOfDescription( EdsAFMode.class, description );
        }
    }

    /**
     * Aperture Values
     * See: API Reference - 5.2.22 kEdsPropID_Av
     * Note: EdsAv names ending with 'b' represent aperture values when the
     * exposure step set in the Custom Function is 1/3 instead of 1/2.
     */
    public enum EdsAv implements DescriptiveEnum {
        kEdsAv_1( 0x08, "1" ),
        kEdsAv_1_1( 0x0B, "1.1" ),
        kEdsAv_1_2( 0x0C, "1.2" ),
        kEdsAv_1_2b( 0x0D, "1.2 (1/3)" ),
        kEdsAv_1_4( 0x10, "1.4" ),
        kEdsAv_1_6( 0x13, "1.6" ),
        kEdsAv_1_8( 0x14, "1.8" ),
        kEdsAv_1_8b( 0x15, "1.8 (1/3)" ),
        kEdsAv_2( 0x18, "2" ),
        kEdsAv_2_2( 0x1B, "2.2" ),
        kEdsAv_2_5( 0x1C, "2.5" ),
        kEdsAv_2_5b( 0x1D, "2.5 (1/3)" ),
        kEdsAv_2_8( 0x20, "2.8" ),
        kEdsAv_3_2( 0x23, "3.2" ),
        kEdsAv_3_5( 0x24, "3.5" ),
        kEdsAv_3_5b( 0x25, "3.5 (1/3)" ),
        kEdsAv_4( 0x28, "4" ),
        // both 0x2B and 0x2C labeled '4.5' in EDSDK API docs, 1/3 value determined by camera reading
        kEdsAv_4_5b( 0x2B, "4.5 (1/3)" ),
        kEdsAv_4_5( 0x2C, "4.5" ),
        kEdsAv_5_0( 0x2D, "5.0" ),
        kEdsAv_5_6( 0x30, "5.6" ),
        kEdsAv_6_3( 0x33, "6.3" ),
        kEdsAv_6_7( 0x34, "6.7" ),
        kEdsAv_7_1( 0x35, "7.1" ),
        kEdsAv_8( 0x38, "8" ),
        kEdsAv_9( 0x3B, "9" ),
        kEdsAv_9_5( 0x3C, "9.5" ),
        kEdsAv_10( 0x3D, "10" ),
        kEdsAv_11( 0x40, "11" ),
        kEdsAv_13b( 0x43, "13 (1/3)" ),
        kEdsAv_13( 0x44, "13" ),
        kEdsAv_14( 0x45, "14" ),
        kEdsAv_16( 0x48, "16" ),
        kEdsAv_18( 0x4B, "18" ),
        kEdsAv_19( 0x4C, "19" ),
        kEdsAv_20( 0x4D, "20" ),
        kEdsAv_22( 0x50, "22" ),
        kEdsAv_25( 0x53, "25" ),
        kEdsAv_27( 0x54, "27" ),
        kEdsAv_29( 0x55, "29" ),
        kEdsAv_32( 0x58, "32" ),
        kEdsAv_36( 0x5B, "36" ),
        kEdsAv_38( 0x5C, "38" ),
        kEdsAv_40( 0x5D, "40" ),
        kEdsAv_45( 0x60, "45" ),
        kEdsAv_51( 0x63, "51" ),
        kEdsAv_54( 0x64, "54" ),
        kEdsAv_57( 0x65, "57" ),
        kEdsAv_64( 0x68, "64" ),
        kEdsAv_72( 0x6B, "72" ),
        kEdsAv_76( 0x6C, "76" ),
        kEdsAv_80( 0x6D, "80" ),
        kEdsAv_91( 0x70, "91" ),
        kEdsAv_Unknown( 0xFFFFFFFF, "Not valid/no settings changes" );

        private final int value;
        private final String description;

        EdsAv( final int value, final String description ) {
            this.value = value;
            this.description = description;
        }

        @Override
        public final Integer value() {
            return value;
        }

        @Override
        public final String description() {
            return description;
        }

        public static final EdsAv enumOfName( final String name ) {
            return (EdsAv) CanonConstants.enumOfName( EdsAv.class, name );
        }

        public static final EdsAv enumOfValue( final int value ) {
            return (EdsAv) CanonConstants.enumOfValue( EdsAv.class, value );
        }

        public static final EdsAv enumOfDescription( final String description ) {
            return (EdsAv) CanonConstants.enumOfDescription( EdsAv.class, description );
        }
    }

    /**
     * Shutter Speed Values
     * See: API Reference - 5.2.23 kEdsPropID_Tv
     * Note: EdsTv names ending with 'b' represent shutter speeds when the
     * exposure step set in the Custom Function is 1/3 instead of 1/2.
     */
    public enum EdsTv implements DescriptiveEnum {
        kEdsTv_BULB( 0x0C, "BULB" ),
        kEdsTv_30( 0x10, "30\"" ),
        kEdsTv_25( 0x13, "25\"" ),
        kEdsTv_20( 0x14, "20\"" ),
        kEdsTv_20b( 0x15, "20\" (1/3)" ),
        kEdsTv_15( 0x18, "15\"" ),
        kEdsTv_13( 0x1B, "13\"" ),
        kEdsTv_10( 0x1C, "10\"" ),
        kEdsTv_10b( 0x1D, "10\" (1/3)" ),
        kEdsTv_8( 0x20, "8\"" ),
        kEdsTv_6b( 0x23, "6\" (1/3)" ),
        kEdsTv_6( 0x24, "6\"" ),
        kEdsTv_5( 0x25, "5\"" ),
        kEdsTv_4( 0x28, "4\"" ),
        kEdsTv_3_2( 0x2B, "3\"2" ),
        kEdsTv_3( 0x2C, "3\"" ),
        kEdsTv_2_5( 0x2D, "2\"5" ),
        kEdsTv_2( 0x30, "2\"" ),
        kEdsTv_1_6( 0x33, "1\"6" ),
        kEdsTv_1_5( 0x34, "1\"5" ),
        kEdsTv_1_3( 0x35, "1\"3" ),
        kEdsTv_1( 0x38, "1\"" ),
        kEdsTv_0_8( 0x3B, "0\"8" ),
        kEdsTv_0_7( 0x3C, "0\"7" ),
        kEdsTv_0_6( 0x3D, "0\"6" ),
        kEdsTv_0_5( 0x40, "0\"5" ),
        kEdsTv_0_4( 0x43, "0\"4" ),
        kEdsTv_0_3( 0x44, "0\"3" ),
        kEdsTv_0_3b( 0x45, "0\"3 (1/3)" ),
        kEdsTv_1by4( 0x48, "1/4" ),
        kEdsTv_1by5( 0x4B, "1/5" ),
        kEdsTv_1by6( 0x4C, "1/6" ),
        kEdsTv_1by6b( 0x4D, "1/6 (1/3)" ),
        kEdsTv_1by8( 0x50, "1/8" ),
        kEdsTv_1by10b( 0x53, "1/10 (1/3)" ),
        kEdsTv_1by10( 0x54, "1/10" ),
        kEdsTv_1by13( 0x55, "1/13" ),
        kEdsTv_1by15( 0x58, "1/15" ),
        kEdsTv_1by20b( 0x5B, "1/20 (1/3)" ),
        kEdsTv_1by20( 0x5C, "1/20" ),
        kEdsTv_1by25( 0x5D, "1/25" ),
        kEdsTv_1by30( 0x60, "1/30" ),
        kEdsTv_1by40( 0x63, "1/40" ),
        kEdsTv_1by45( 0x64, "1/45" ),
        kEdsTv_1by50( 0x65, "1/50" ),
        kEdsTv_1by60( 0x68, "1/60" ),
        kEdsTv_1by80( 0x6B, "1/80" ),
        kEdsTv_1by90( 0x6C, "1/90" ),
        kEdsTv_1by100( 0x6D, "1/100" ),
        kEdsTv_1by125( 0x70, "1/125" ),
        kEdsTv_1by160( 0x73, "1/160" ),
        kEdsTv_1by180( 0x74, "1/180" ),
        kEdsTv_1by200( 0x75, "1/200" ),
        kEdsTv_1by250( 0x78, "1/250" ),
        kEdsTv_1by320( 0x7B, "1/320" ),
        kEdsTv_1by350( 0x7C, "1/350" ),
        kEdsTv_1by400( 0x7D, "1/400" ),
        kEdsTv_1by500( 0x80, "1/500" ),
        kEdsTv_1by640( 0x83, "1/640" ),
        kEdsTv_1by750( 0x84, "1/750" ),
        kEdsTv_1by800( 0x85, "1/800" ),
        kEdsTv_1by1000( 0x88, "1/1000" ),
        kEdsTv_1by1250( 0x8B, "1/1250" ),
        kEdsTv_1by1500( 0x8C, "1/1500" ),
        kEdsTv_1by1600( 0x8D, "1/1600" ),
        kEdsTv_1by2000( 0x90, "1/2000" ),
        kEdsTv_1by2500( 0x93, "1/2500" ),
        kEdsTv_1by3000( 0x94, "1/3000" ),
        kEdsTv_1by3200( 0x95, "1/3200" ),
        kEdsTv_1by4000( 0x98, "1/4000" ),
        kEdsTv_1by5000( 0x9B, "1/5000" ),
        kEdsTv_1by6000( 0x9C, "1/6000" ),
        kEdsTv_1by6400( 0x9D, "1/6400" ),
        kEdsTv_1by8000( 0xA0, "1/8000" ),
        kEdsTv_Unknown( 0xFFFFFFFF, "Not valid/no settings changes" );

        private final int value;
        private final String description;

        EdsTv( final int value, final String description ) {
            this.value = value;
            this.description = description;
        }

        @Override
        public final Integer value() {
            return value;
        }

        @Override
        public final String description() {
            return description;
        }

        public static final EdsTv enumOfName( final String name ) {
            return (EdsTv) CanonConstants.enumOfName( EdsTv.class, name );
        }

        public static final EdsTv enumOfValue( final int value ) {
            return (EdsTv) CanonConstants.enumOfValue( EdsTv.class, value );
        }

        public static final EdsTv enumOfDescription( final String description ) {
            return (EdsTv) CanonConstants.enumOfDescription( EdsTv.class, description );
        }
    }

    /**
     * Exposure Compensation Values (Same as Flash Compensation Values)
     * See: API Reference - 5.2.24 kEdsPropID_ExposureCompensation
     * 5.2.26 kEdsPropID_FlashCompensation
     */
    public enum EdsExposureCompensation implements DescriptiveEnum {
        /*
         * These extra values were available on a 550D camera and for some
         * reason are not described in the EDSDK documentation
         */
        kEdsExposureCompensation_5( 0x28, "+5" ),
        kEdsExposureCompensation_4_2by3( 0x25, "+4 2/3" ),
        kEdsExposureCompensation_4_1by2( 0x24, "+4 1/2" ),
        kEdsExposureCompensation_4_1by3( 0x23, "+4 1/3" ),
        kEdsExposureCompensation_4( 0x20, "+4" ),
        kEdsExposureCompensation_3_2by3( 0x1D, "+3 2/3" ),
        kEdsExposureCompensation_3_1by2( 0x1C, "+3 1/2" ),
        kEdsExposureCompensation_3_1by3( 0x1B, "+3 1/3" ),

        /* This group was defined in the EDSDK documentation */
        kEdsExposureCompensation_3( 0x18, "+3" ),
        kEdsExposureCompensation_2_2by3( 0x15, "+2 2/3" ),
        kEdsExposureCompensation_2_1by2( 0x14, "+2 1/2" ),
        kEdsExposureCompensation_2_1by3( 0x13, "+2 1/3" ),
        kEdsExposureCompensation_2( 0x10, "+2" ),
        kEdsExposureCompensation_1_2by3( 0x0D, "+1 2/3" ),
        kEdsExposureCompensation_1_1by2( 0x0C, "+1 1/2" ),
        kEdsExposureCompensation_1_1by3( 0x0B, "+1 1/3" ),
        kEdsExposureCompensation_1( 0x08, "+1" ),
        kEdsExposureCompensation_2by3( 0x05, "+2/3" ),
        kEdsExposureCompensation_1by2( 0x04, "+1/2" ),
        kEdsExposureCompensation_1by3( 0x03, "+1/3" ),
        kEdsExposureCompensation_0( 0x00, "0" ),
        kEdsExposureCompensation_n1by3( 0xFD, "-1/3" ),
        kEdsExposureCompensation_n1by2( 0xFC, "-1/2" ),
        kEdsExposureCompensation_n2by3( 0xFB, "-2/3" ),
        kEdsExposureCompensation_n1( 0xF8, "-1" ),
        kEdsExposureCompensation_n1_1by3( 0xF5, "-1 1/3" ),
        kEdsExposureCompensation_n1_1by2( 0xF4, "-1 1/2" ),
        kEdsExposureCompensation_n1_2by3( 0xF3, "-1 2/3" ),
        kEdsExposureCompensation_n2( 0xF0, "-2" ),
        kEdsExposureCompensation_n2_1by3( 0xED, "-2 1/3" ),
        kEdsExposureCompensation_n2_1by2( 0xEC, "-2 1/2" ),
        kEdsExposureCompensation_n2_2by3( 0xEB, "-2 2/3" ),
        kEdsExposureCompensation_n3( 0xE8, "-3" ),

        /*
         * These extra values were available on a 550D camera and for some
         * reason are not described in the EDSDK documentation
         */
        kEdsExposureCompensation_n3_1by3( 0xE5, "-3 1/3" ),
        kEdsExposureCompensation_n3_1by2( 0xE4, "-3 1/2" ),
        kEdsExposureCompensation_n3_2by3( 0xE3, "-3 2/3" ),
        kEdsExposureCompensation_n4( 0xE0, "-4" ),
        kEdsExposureCompensation_n4_1by3( 0xDD, "-4 1/3" ),
        kEdsExposureCompensation_n4_1by2( 0xDC, "-4 1/2" ),
        kEdsExposureCompensation_n4_2by3( 0xDB, "-4 2/3" ),
        kEdsExposureCompensation_n5( 0xD8, "-5" ),

        /* This was defined in the EDSDK documentation */
        kEdsExposureCompensation_Unknown( 0xFFFFFFFF, "Not valid/no settings changes" );

        private final int value;
        private final String description;

        EdsExposureCompensation( final int value, final String description ) {
            this.value = value;
            this.description = description;
        }

        @Override
        public final Integer value() {
            return value;
        }

        @Override
        public final String description() {
            return description;
        }

        public static final EdsExposureCompensation enumOfName( final String name ) {
            return (EdsExposureCompensation) CanonConstants.enumOfName( EdsExposureCompensation.class, name );
        }

        public static final EdsExposureCompensation enumOfValue( final int value ) {
            return (EdsExposureCompensation) CanonConstants.enumOfValue( EdsExposureCompensation.class, value );
        }

        public static final EdsExposureCompensation enumOfDescription( final String description ) {
            return (EdsExposureCompensation) CanonConstants.enumOfDescription( EdsExposureCompensation.class, description );
        }
    }

    /**
     * Live View Histogram Status
     * See: API Reference - 5.2.77 kEdsPropID_Evf_HistogramStatus
     */
    public enum EdsEvfHistogramStatus implements DescriptiveEnum {
        kEdsEvfHistogramStatus_Hide( 0, "Hide" ),
        kEdsEvfHistogramStatus_Normal( 0, "Display" ),
        kEdsEvfHistogramStatus_Grayout( 0, "Gray Out" );

        private final int value;
        private final String description;

        EdsEvfHistogramStatus( final int value, final String description ) {
            this.value = value;
            this.description = description;
        }

        @Override
        public final Integer value() {
            return value;
        }

        @Override
        public final String description() {
            return description;
        }

        public static final EdsEvfHistogramStatus enumOfName( final String name ) {
            return (EdsEvfHistogramStatus) CanonConstants.enumOfName( EdsEvfHistogramStatus.class, name );
        }
        public static final EdsEvfHistogramStatus enumOfValue( final int value ) {
            return (EdsEvfHistogramStatus) CanonConstants.enumOfValue( EdsEvfHistogramStatus.class, value );
        }

        public static final EdsEvfHistogramStatus enumOfDescription( final String description ) {
            return (EdsEvfHistogramStatus) CanonConstants.enumOfDescription( EdsEvfHistogramStatus.class, description );
        }
    }

    /**
     * Custom Function Values
     * Value passed as a 'param' to getPropertyData or setPropertyData
     * 
     * Data values given in comments are for Canon EOS 550D
     * 
     * 0x1xx = C.Fn I :Exposure
     * 0x2xx = C.Fn II :Image
     * 0x5xx = C.Fn III :Autofocus/Drive
     * 0x6xx = C.Fn III :Autofocus/Drive
     * 0x7xx = C.Fn IV :Operation/Others
     * 0x8xx = C.Fn IV :Operation/Others
     * 
     */
    public enum EdsCustomFunction implements DescriptiveEnum {
        kEdsCustomFunction_ExposureIncrements( 0x101, "Exposure level increments" ), // 0:1/3-stop, 1:1/2-stop
        kEdsCustomFunction_ISOExpansion( 0x103, "ISO Expansion" ), // 0:Off, 1:On
        kEdsCustomFunction_FlashSyncSpeed( 0x10F, "Flash sync. speed in Av mode" ), // 0:Auto, 1:1/200-1/60sec. auto, 2:1/200sec. (fixed)
        kEdsCustomFunction_LongExpNoiseReduction( 0x201, "Long exp. noise reduction" ), // 0:Off, 1:Auto, 2:On
        kEdsCustomFunction_HighISONoiseReduction( 0x202, "High ISO speed noise reduct'n" ), // 0:Standard, 1:Low, 2:Strong, 3:Disable
        kEdsCustomFunction_HighlighTonePriority( 0x203, "Highlight tone priority" ), // 0:Disable, 1:Enable
        kEdsCustomFunction_AFAssistBeam( 0x50E, "AF-assist beam firing" ), // 0:Enable, 1:Disable, 2:Enable external flash only, 3:IR AF assist beam only
        kEdsCustomFunction_MirrorLockup( 0x60F, "Mirror lockup" ), // 0:Disable, 1:Enable
        kEdsCustomFunction_ShutterAELockButton( 0x701, "Shutter/AE lock button" ), // 0:AF/AE lock, 1:AE lock/AF, 2:AF/AF lock, no AE lock, 3:AE/AF, no AE lock
        kEdsCustomFunction_AssignSETButton( 0x704, "Assign SET button" ), // 0:Normal (disabled), 1:Image quality, 2:Flash exposure comp., 3:LCD monitor On/Off, 4:Menu display, 5:ISO speed
        kEdsCustomFunction_LCDDisplayWhenOn( 0x80F, "LCD display when power ON" ), // 0:Display on, 1:Previous display status
        kEdsCustomFunction_AddVerificationData( 0x811, "Add image verification data" ); // 0:Disable, 1:Enable

        private final int value;
        private final String description;

        EdsCustomFunction( final int value, final String description ) {
            this.value = value;
            this.description = description;
        }

        @Override
        public final Integer value() {
            return value;
        }

        @Override
        public final String description() {
            return description;
        }

        public static final EdsCustomFunction enumOfName( final String name ) {
            return (EdsCustomFunction) CanonConstants.enumOfName( EdsCustomFunction.class, name );
        }

        public static final EdsCustomFunction enumOfValue( final int value ) {
            return (EdsCustomFunction) CanonConstants.enumOfValue( EdsCustomFunction.class, value );
        }

        public static final EdsCustomFunction enumOfDescription( final String description ) {
            return (EdsCustomFunction) CanonConstants.enumOfDescription( EdsCustomFunction.class, description );
        }
    }

    /******************************************************************************
     * Definition of Constants
     ******************************************************************************/

    public enum EdsConstant implements DescriptiveEnum {
        EDS_MAX_NAME( "Maximum File Name Length" ),
        EDS_TRANSFER_BLOCK_SIZE( "Transfer Block Size" );

        private final int value;
        private final String description;

        EdsConstant( final String description ) {
            value = CanonUtils.classIntField( EdSdkLibrary.class, name() );
            this.description = description;
        }
        public final Integer value() {
            return value;
        }

        @Override
        public final String description() {
            return description;
        }

        public static final EdsConstant enumOfName( final String name ) {
            return (EdsConstant) CanonConstants.enumOfName( EdsConstant.class, name );
        }

        public static final EdsConstant enumOfValue( final int value ) {
            return (EdsConstant) CanonConstants.enumOfValue( EdsConstant.class, value );
        }

        public static final EdsConstant enumOfDescription( final String description ) {
            return (EdsConstant) CanonConstants.enumOfDescription( EdsConstant.class, description );
        }

    }

    /******************************************************************************
     * Definition of Error Codes
     ******************************************************************************/

    public enum EdsError implements DescriptiveEnum {
        /*-----------------------------------------------------------------------
        ED-SDK Error Code Masks
         ------------------------------------------------------------------------*/
        EDS_ISSPECIFIC_MASK( "IS Specific Mask" ),
        EDS_COMPONENTID_MASK( "Component ID Mask" ),
        EDS_RESERVED_MASK( "Reserved Mask" ),
        EDS_ERRORID_MASK( "Error ID Mask" ),

        /*-----------------------------------------------------------------------
           ED-SDK Base Component IDs
        ------------------------------------------------------------------------*/
        EDS_CMP_ID_CLIENT_COMPONENTID( "Component ID Client" ),
        EDS_CMP_ID_LLSDK_COMPONENTID( "Component ID LLSDK" ),
        EDS_CMP_ID_HLSDK_COMPONENTID( "Component ID HLSDK" ),

        /*-----------------------------------------------------------------------
           ED-SDK Function Success Code
        ------------------------------------------------------------------------*/
        EDS_ERR_OK( "Success, No Errors" ),

        /*-----------------------------------------------------------------------
           ED-SDK Generic Error IDs
        ------------------------------------------------------------------------*/
        /* Miscellaneous errors */
        EDS_ERR_UNIMPLEMENTED( "Unimplemented" ),
        EDS_ERR_INTERNAL_ERROR( "Internal Error" ),
        EDS_ERR_MEM_ALLOC_FAILED( "Memory Allocation Failed" ),
        EDS_ERR_MEM_FREE_FAILED( "Memory Release Failed" ),
        EDS_ERR_OPERATION_CANCELLED( "Operation Cancelled" ),
        EDS_ERR_INCOMPATIBLE_VERSION( "Incompatible Version" ),
        EDS_ERR_NOT_SUPPORTED( "Not Supported" ),
        EDS_ERR_UNEXPECTED_EXCEPTION( "Unexpected Exception" ),
        EDS_ERR_PROTECTION_VIOLATION( "Protection Violation" ),
        EDS_ERR_MISSING_SUBCOMPONENT( "Missing Subcomponent" ),
        EDS_ERR_SELECTION_UNAVAILABLE( "Selection Unavailable" ),

        /* File errors */
        EDS_ERR_FILE_IO_ERROR( "File I/O Error" ),
        EDS_ERR_FILE_TOO_MANY_OPEN( "Too Many Files Open" ),
        EDS_ERR_FILE_NOT_FOUND( "File Not Found" ),
        EDS_ERR_FILE_OPEN_ERROR( "File Open Error" ),
        EDS_ERR_FILE_CLOSE_ERROR( "File Close Error" ),
        EDS_ERR_FILE_SEEK_ERROR( "File Seek Error" ),
        EDS_ERR_FILE_TELL_ERROR( "File Tell Error" ),
        EDS_ERR_FILE_READ_ERROR( "File Read Error" ),
        EDS_ERR_FILE_WRITE_ERROR( "File Write Error" ),
        EDS_ERR_FILE_PERMISSION_ERROR( "File Permission Error" ),
        EDS_ERR_FILE_DISK_FULL_ERROR( "Disk Full Error" ),
        EDS_ERR_FILE_ALREADY_EXISTS( "File Already Exists" ),
        EDS_ERR_FILE_FORMAT_UNRECOGNIZED( "File Format Not Recognized" ),
        EDS_ERR_FILE_DATA_CORRUPT( "File Data Corrupt" ),
        EDS_ERR_FILE_NAMING_NA( "File Naming Error" ),

        /* Directory errors */
        EDS_ERR_DIR_NOT_FOUND( "Directory Does Not Exist" ),
        EDS_ERR_DIR_IO_ERROR( "Directory I/O Error" ),
        EDS_ERR_DIR_ENTRY_NOT_FOUND( "No Files In Directory" ),
        EDS_ERR_DIR_ENTRY_EXISTS( "Directory Contains Files" ),
        EDS_ERR_DIR_NOT_EMPTY( "Directory Full" ),

        /* Property errors */
        EDS_ERR_PROPERTIES_UNAVAILABLE( "Property Unavailable" ),
        EDS_ERR_PROPERTIES_MISMATCH( "Property Mismatch" ),
        EDS_ERR_PROPERTIES_NOT_LOADED( "Property Not Loaded" ),

        /* Function Parameter errors */
        EDS_ERR_INVALID_PARAMETER( "Invalid Function Parameter" ),
        EDS_ERR_INVALID_HANDLE( "Function Handle Error" ),
        EDS_ERR_INVALID_POINTER( "Function Pointer Error" ),
        EDS_ERR_INVALID_INDEX( "Function Index Error" ),
        EDS_ERR_INVALID_LENGTH( "Function Length Error" ),
        EDS_ERR_INVALID_FN_POINTER( "Function FN Pointer Error" ),
        EDS_ERR_INVALID_SORT_FN( "Function Sort FN Error" ),

        /* Device errors */
        EDS_ERR_DEVICE_NOT_FOUND( "Device Not Found" ),
        EDS_ERR_DEVICE_BUSY( "Device Busy" ),
        EDS_ERR_DEVICE_INVALID( "Device Error" ),
        EDS_ERR_DEVICE_EMERGENCY( "Device Emergency" ),
        EDS_ERR_DEVICE_MEMORY_FULL( "Device Memory Full" ),
        EDS_ERR_DEVICE_INTERNAL_ERROR( "Internal Device Error" ),
        EDS_ERR_DEVICE_INVALID_PARAMETER( "Invalid Device Parameter" ),
        EDS_ERR_DEVICE_NO_DISK( "No Device Disk" ),
        EDS_ERR_DEVICE_DISK_ERROR( "Device Disk Error" ),
        EDS_ERR_DEVICE_CF_GATE_CHANGED( "Device CF Gate Changed" ),
        EDS_ERR_DEVICE_DIAL_CHANGED( "Device Dial Changed" ),
        EDS_ERR_DEVICE_NOT_INSTALLED( "Device Not Installed" ),
        EDS_ERR_DEVICE_STAY_AWAKE( "Device Connect In Awake Mode" ),
        EDS_ERR_DEVICE_NOT_RELEASED( "Device Not Released" ),

        /* Stream errors */
        EDS_ERR_STREAM_IO_ERROR( "Stream I/O Error" ),
        EDS_ERR_STREAM_NOT_OPEN( "Stream Not Open" ),
        EDS_ERR_STREAM_ALREADY_OPEN( "Stream Already Open" ),
        EDS_ERR_STREAM_OPEN_ERROR( "Stream Open Error" ),
        EDS_ERR_STREAM_CLOSE_ERROR( "Stream Close Error" ),
        EDS_ERR_STREAM_SEEK_ERROR( "Stream Seek Error" ),
        EDS_ERR_STREAM_TELL_ERROR( "Stream Tell Error" ),
        EDS_ERR_STREAM_READ_ERROR( "Stream Read Error" ),
        EDS_ERR_STREAM_WRITE_ERROR( "Stream Write Error" ),
        EDS_ERR_STREAM_PERMISSION_ERROR( "Stream Permission Error" ),
        EDS_ERR_STREAM_COULDNT_BEGIN_THREAD( "Stream Could Not Start Reading Thumbnail" ),
        EDS_ERR_STREAM_BAD_OPTIONS( "Invalid Stream Options" ),
        EDS_ERR_STREAM_END_OF_STREAM( "Invalid Stream Termination" ),

        /* Communications errors */
        EDS_ERR_COMM_PORT_IS_IN_USE( "Communication Port In Use" ),
        EDS_ERR_COMM_DISCONNECTED( "Communication Port Disconnected" ),
        EDS_ERR_COMM_DEVICE_INCOMPATIBLE( "Communication Device Incompatible" ),
        EDS_ERR_COMM_BUFFER_FULL( "Communication Buffer Full" ),
        EDS_ERR_COMM_USB_BUS_ERR( "USB Bus Error" ),

        /* Lock/Unlock */
        EDS_ERR_USB_DEVICE_LOCK_ERROR( "Failed To Lock The UI" ),
        EDS_ERR_USB_DEVICE_UNLOCK_ERROR( "Failed To Unlock The UI" ),

        /* STI/WIA */
        EDS_ERR_STI_UNKNOWN_ERROR( "Unknown STI" ),
        EDS_ERR_STI_INTERNAL_ERROR( "Internal STI Error" ),
        EDS_ERR_STI_DEVICE_CREATE_ERROR( "STI Device Creation Error" ),
        EDS_ERR_STI_DEVICE_RELEASE_ERROR( "STI Device Release Error" ),
        EDS_ERR_DEVICE_NOT_LAUNCHED( "Device Start-up Failed" ),

        EDS_ERR_ENUM_NA( "Enumeration Terminated" ),
        EDS_ERR_INVALID_FN_CALL( "Function Call Made In Incompatible Mode" ),
        EDS_ERR_HANDLE_NOT_FOUND( "Handle Not Found" ),
        EDS_ERR_INVALID_ID( "Invalid ID" ),
        EDS_ERR_WAIT_TIMEOUT_ERROR( "Timeout" ),

        /* PTP */
        EDS_ERR_SESSION_NOT_OPEN( "Session Open Error" ),
        EDS_ERR_INVALID_TRANSACTIONID( "Invalid Transaction ID" ),
        EDS_ERR_INCOMPLETE_TRANSFER( "Transfer Incomplete" ),
        EDS_ERR_INVALID_STRAGEID( "Invalid Storage ID" ),
        EDS_ERR_DEVICEPROP_NOT_SUPPORTED( "Unsupported Device Property" ),
        EDS_ERR_INVALID_OBJECTFORMATCODE( "Invalid Object Format Code" ),
        EDS_ERR_SELF_TEST_FAILED( "Failed Self-Diagnosis" ),
        EDS_ERR_PARTIAL_DELETION( "Partial Deletion Failed" ),
        EDS_ERR_SPECIFICATION_BY_FORMAT_UNSUPPORTED( "Unsupported Format Specification" ),
        EDS_ERR_NO_VALID_OBJECTINFO( "Invalid Object Information" ),
        EDS_ERR_INVALID_CODE_FORMAT( "Invalid Code Format" ),
        EDS_ERR_UNKNOWN_VENDOR_CODE( "Unknown Vendor Code" ),
        EDS_ERR_CAPTURE_ALREADY_TERMINATED( "Capture Already Terminated" ),
        EDS_ERR_INVALID_PARENTOBJECT( "Invalid Parent Object" ),
        EDS_ERR_INVALID_DEVICEPROP_FORMAT( "Invalid Device Property Format" ),
        EDS_ERR_INVALID_DEVICEPROP_VALUE( "Invalid Device Property Value" ),
        EDS_ERR_SESSION_ALREADY_OPEN( "Session Already Open" ),
        EDS_ERR_TRANSACTION_CANCELLED( "Transaction Cancelled" ),
        EDS_ERR_SPECIFICATION_OF_DESTINATION_UNSUPPORTED( "Unsupported Destination Specification" ),

        /* PTP Vendor */
        EDS_ERR_UNKNOWN_COMMAND( "Unknown Command" ),
        EDS_ERR_OPERATION_REFUSED( "Operation Refused" ),
        EDS_ERR_LENS_COVER_CLOSE( "Lens Cover Closed" ),
        EDS_ERR_LOW_BATTERY( "Low Battery" ),
        EDS_ERR_OBJECT_NOTREADY( "Live View Image Data Set Not Ready" ),
        EDS_ERR_CANNOT_MAKE_OBJECT( "Cannot Make Object" ),

        /* Take Picture errors */
        EDS_ERR_TAKE_PICTURE_AF_NG( "Focus Failed" ),
        EDS_ERR_TAKE_PICTURE_RESERVED( "Reserved" ),
        EDS_ERR_TAKE_PICTURE_MIRROR_UP_NG( "Currently Configuring Mirror Up" ),
        EDS_ERR_TAKE_PICTURE_SENSOR_CLEANING_NG( "Currently Cleaning Sensor" ),
        EDS_ERR_TAKE_PICTURE_SILENCE_NG( "Currently Performing Silent Operations" ),
        EDS_ERR_TAKE_PICTURE_NO_CARD_NG( "Card Not Installed" ),
        EDS_ERR_TAKE_PICTURE_CARD_NG( "Error Writing To Card" ),
        EDS_ERR_TAKE_PICTURE_CARD_PROTECT_NG( "Card Write Protected" ),
        EDS_ERR_TAKE_PICTURE_MOVIE_CROP_NG( "Cropping Movie" ),
        EDS_ERR_TAKE_PICTURE_STROBO_CHARGE_NG( "Strobe Charging" ),

        EDS_ERR_LAST_GENERIC_ERROR_PLUS_ONE( "Not Used" );

        private final int value;
        private final String description;

        EdsError( final String description ) {
            value = CanonUtils.classIntField( EdSdkLibrary.class, name() );
            this.description = description;
        }

        @Override
        public final Integer value() {
            return value;
        }

        @Override
        public final String description() {
            return description;
        }

        public static final EdsError enumOfName( final String name ) {
            return (EdsError) CanonConstants.enumOfName( EdsError.class, name );
        }

        public static final EdsError enumOfValue( final int value ) {
            return (EdsError) CanonConstants.enumOfValue( EdsError.class, value );
        }

        public static final EdsError enumOfDescription( final String description ) {
            return (EdsError) CanonConstants.enumOfDescription( EdsError.class, description );
        }

    }

    /******************************************************************************
     * Definition of Data Types
     ******************************************************************************/
/*-----------------------------------------------------------------------------
 Data Types
 -----------------------------------------------------------------------------*/
    public enum EdsDataType implements DescriptiveEnum {
        kEdsDataType_Unknown( "Unknown" ),
        kEdsDataType_Bool( "EdsBool" ),
        kEdsDataType_String( "EdsChar[]" ),
        kEdsDataType_Int8( "EdsInt8" ),
        kEdsDataType_UInt8( "EdsUInt8" ),
        kEdsDataType_Int16( "EdsInt16" ),
        kEdsDataType_UInt16( "EdsUInt16" ),
        kEdsDataType_Int32( "EdsInt32" ),
        kEdsDataType_UInt32( "EdsUInt32" ),
        kEdsDataType_Int64( "EdsInt64" ),
        kEdsDataType_UInt64( "EdsUInt64" ),
        kEdsDataType_Float( "EdsFloat" ),
        kEdsDataType_Double( "EdsDouble" ),
        kEdsDataType_ByteBlock( "Byte Block" ), // According to API, is either EdsInt8[] or EdsUInt32[], but perhaps former is a typo or an old value
        kEdsDataType_Rational( "EdsRational" ),
        kEdsDataType_Point( "EdsPoint" ),
        kEdsDataType_Rect( "EdsRect" ),
        kEdsDataType_Time( "EdsTime" ),

        kEdsDataType_Bool_Array( "EdsBool[]" ),
        kEdsDataType_Int8_Array( "EdsInt8[]" ),
        kEdsDataType_Int16_Array( "EdsInt16[]" ),
        kEdsDataType_Int32_Array( "EdsInt32[]" ),
        kEdsDataType_UInt8_Array( "EdsUInt8[]" ),
        kEdsDataType_UInt16_Array( "EdsUInt16[]" ),
        kEdsDataType_UInt32_Array( "EdsUInt32[]" ),
        kEdsDataType_Rational_Array( "EdsRational[]" ),

        kEdsDataType_FocusInfo( "EdsFocusInfo" ),
        kEdsDataType_PictureStyleDesc( "EdsPictureStyleDesc" );

        private final int value;
        private final String description;

        EdsDataType( final String description ) {
            value = CanonUtils.classIntField( EdSdkLibrary.EdsDataType.class, name() );
            this.description = description;
        }

        @Override
        public final Integer value() {
            return value;
        }

        @Override
        public final String description() {
            return description;
        }

        public static final EdsDataType enumOfName( final String name ) {
            return (EdsDataType) CanonConstants.enumOfName( EdsDataType.class, name );
        }

        public static final EdsDataType enumOfValue( final int value ) {
            return (EdsDataType) CanonConstants.enumOfValue( EdsDataType.class, value );
        }

        public static final EdsDataType enumOfDescription( final String description ) {
            return (EdsDataType) CanonConstants.enumOfDescription( EdsDataType.class, description );
        }

    }

/*-----------------------------------------------------------------------------
 Property IDs
 -----------------------------------------------------------------------------*/
    public enum EdsPropertyID implements DescriptiveEnum {
        /*----------------------------------
        Camera Setting Properties
        ----------------------------------*/
        kEdsPropID_Unknown( "Unknown", EdsDataType.kEdsDataType_Unknown ),

        kEdsPropID_ProductName( "Product Name", EdsDataType.kEdsDataType_String ),
        kEdsPropID_OwnerName( "Owner Name", EdsDataType.kEdsDataType_String ),
        kEdsPropID_MakerName( "Maker Name", EdsDataType.kEdsDataType_String ),
        kEdsPropID_DateTime( "Date/Time", EdsDataType.kEdsDataType_Time ),
        kEdsPropID_FirmwareVersion( "Firmware Version", EdsDataType.kEdsDataType_String ),
        kEdsPropID_BatteryLevel( "Battery Level", EdsDataType.kEdsDataType_UInt32 ),
        kEdsPropID_CFn( "Custom Function #", EdsDataType.kEdsDataType_UInt32 ), // Not stated in the API, but all values seen on various cameras seem to be EdsUInt32
        kEdsPropID_SaveTo( "Save To", EdsDataType.kEdsDataType_UInt32 ),
        kEdsPropID_CurrentStorage( "Current Storage", EdsDataType.kEdsDataType_String ),
        kEdsPropID_CurrentFolder( "Current Folder", EdsDataType.kEdsDataType_String ),
        kEdsPropID_MyMenu( "My Menu", EdsDataType.kEdsDataType_UInt32_Array ),

        kEdsPropID_BatteryQuality( "Battery Quality", EdsDataType.kEdsDataType_UInt32 ),

        kEdsPropID_BodyIDEx( "Body ID Ex", EdsDataType.kEdsDataType_String ),
        kEdsPropID_HDDirectoryStructure( "Hard Drive Directory Structure", EdsDataType.kEdsDataType_String ),

        /*----------------------------------
        Image Properties
        ----------------------------------*/
        kEdsPropID_ImageQuality( "Image Quality", EdsDataType.kEdsDataType_UInt32 ),
        kEdsPropID_JpegQuality( "JPEG Quality", EdsDataType.kEdsDataType_UInt32 ),
        kEdsPropID_Orientation( "Orientation", EdsDataType.kEdsDataType_UInt32 ),
        kEdsPropID_ICCProfile( "ICC Profile", EdsDataType.kEdsDataType_ByteBlock ), // API lists EdsInt8[]
        kEdsPropID_FocusInfo( "Focus Info", EdsDataType.kEdsDataType_FocusInfo ),
        kEdsPropID_DigitalExposure( "Digital Exposure", EdsDataType.kEdsDataType_Rational ),
        kEdsPropID_WhiteBalance( "White Balance", EdsDataType.kEdsDataType_Int32 ),
        kEdsPropID_ColorTemperature( "Color Temperature", EdsDataType.kEdsDataType_UInt32 ),
        kEdsPropID_WhiteBalanceShift( "White Balance Shift", EdsDataType.kEdsDataType_Int32_Array ),
        kEdsPropID_Contrast( "Contrast", EdsDataType.kEdsDataType_Int32 ),
        kEdsPropID_ColorSaturation( "Color Saturation", EdsDataType.kEdsDataType_Int32 ),
        kEdsPropID_ColorTone( "Color Tone", EdsDataType.kEdsDataType_Int32 ),
        kEdsPropID_Sharpness( "Sharpness", EdsDataType.kEdsDataType_Int32 ), // kEdsDataType_Int32_Array for 1D/1Ds
        kEdsPropID_ColorSpace( "Color Space", EdsDataType.kEdsDataType_UInt32 ),
        kEdsPropID_ToneCurve( "Tone Curve", EdsDataType.kEdsDataType_UInt32 ),
        kEdsPropID_PhotoEffect( "Photo Effect", EdsDataType.kEdsDataType_UInt32 ),
        kEdsPropID_FilterEffect( "Filter Effect", EdsDataType.kEdsDataType_UInt32 ),
        kEdsPropID_ToningEffect( "Toning Effect", EdsDataType.kEdsDataType_UInt32 ),
        kEdsPropID_ParameterSet( "Parameter Set", EdsDataType.kEdsDataType_UInt32 ),
        kEdsPropID_ColorMatrix( "Color Matrix", EdsDataType.kEdsDataType_UInt32 ),
        kEdsPropID_PictureStyle( "Picture Style", EdsDataType.kEdsDataType_UInt32 ),
        kEdsPropID_PictureStyleDesc( "Picture Style Description", EdsDataType.kEdsDataType_PictureStyleDesc ),
        kEdsPropID_PictureStyleCaption( "Picture Style Caption", EdsDataType.kEdsDataType_String ),

        /*----------------------------------
        Image Processing Properties
        ----------------------------------*/
        kEdsPropID_Linear( "Linear Processing Status", EdsDataType.kEdsDataType_Bool ),
        kEdsPropID_ClickWBPoint( "Coordinates for White Balance", EdsDataType.kEdsDataType_Point ),
        kEdsPropID_WBCoeffs( "White Balance Values", EdsDataType.kEdsDataType_ByteBlock ),

        /*----------------------------------
        Image GPS Properties
        ----------------------------------*/
        kEdsPropID_GPSVersionID( "GPS Version ID", EdsDataType.kEdsDataType_UInt8 ),
        kEdsPropID_GPSLatitudeRef( "GPS N or S Latitude", EdsDataType.kEdsDataType_String ),
        kEdsPropID_GPSLatitude( "GPS Latitude", EdsDataType.kEdsDataType_Rational_Array ),
        kEdsPropID_GPSLongitudeRef( "GPS E or W Longitude", EdsDataType.kEdsDataType_String ),
        kEdsPropID_GPSLongitude( "GPS Longitude", EdsDataType.kEdsDataType_Rational_Array ),
        kEdsPropID_GPSAltitudeRef( "GPS Reference Altitude", EdsDataType.kEdsDataType_UInt8 ),
        kEdsPropID_GPSAltitude( "GPS Altitude", EdsDataType.kEdsDataType_Rational ),
        kEdsPropID_GPSTimeStamp( "GPS Time Stamp", EdsDataType.kEdsDataType_Rational_Array ),
        kEdsPropID_GPSSatellites( "GPS Satellites", EdsDataType.kEdsDataType_String ),
        kEdsPropID_GPSStatus( "GPS Status", EdsDataType.kEdsDataType_String ),
        kEdsPropID_GPSMapDatum( "GPS Geodetic Data", EdsDataType.kEdsDataType_String ),
        kEdsPropID_GPSDateStamp( "GPS Date Stamp", EdsDataType.kEdsDataType_String ),

        /*----------------------------------
        Property Mask
        ----------------------------------*/
        kEdsPropID_AtCapture_Flag( "Get Properties at Time of Shooting", EdsDataType.kEdsDataType_UInt32 ),

        /*----------------------------------
        Capture Properties
        ----------------------------------*/
        /** Shooting Mode */
        kEdsPropID_AEMode( "Shooting Mode", EdsDataType.kEdsDataType_UInt32 ),
        /** Drive Mode */
        kEdsPropID_DriveMode( "Drive Mode", EdsDataType.kEdsDataType_UInt32 ),
        /** ISO Speed */
        kEdsPropID_ISOSpeed( "ISO Speed", EdsDataType.kEdsDataType_UInt32 ),
        /** Metering Mode */
        kEdsPropID_MeteringMode( "Metering Mode", EdsDataType.kEdsDataType_UInt32 ),
        /** Auto-Focus Mode */
        kEdsPropID_AFMode( "Auto-Focus Mode", EdsDataType.kEdsDataType_UInt32 ),
        /** Aperture Value */
        kEdsPropID_Av( "Aperture Value", EdsDataType.kEdsDataType_UInt32 ),
        /** Shutter Speed */
        kEdsPropID_Tv( "Shutter Speed", EdsDataType.kEdsDataType_UInt32 ), // EdsImageRef uses EdsDataType.kEdsDataType_Rational
        /** Exposure Compensation */
        kEdsPropID_ExposureCompensation( "Exposure Compensation", EdsDataType.kEdsDataType_UInt32 ), // EdsImageRef uses EdsDataType.kEdsDataType_Rational
        /** Flash Compensation */
        kEdsPropID_FlashCompensation( "Flash Compensation", EdsDataType.kEdsDataType_UInt32 ),
        /** Focal Length */
        kEdsPropID_FocalLength( "Focal Length", EdsDataType.kEdsDataType_Rational_Array ),
        /** Available Shots */
        kEdsPropID_AvailableShots( "Available Shots", EdsDataType.kEdsDataType_UInt32 ),
        /** Bracket */
        kEdsPropID_Bracket( "Bracket", EdsDataType.kEdsDataType_UInt32 ),
        /** White Balance Bracket */
        kEdsPropID_WhiteBalanceBracket( "White Balance Bracket", EdsDataType.kEdsDataType_Int32_Array ),
        /** Lens Name */
        kEdsPropID_LensName( "Lens Name", EdsDataType.kEdsDataType_String ),
        /** AE Bracket */
        kEdsPropID_AEBracket( "AE Bracket", EdsDataType.kEdsDataType_Rational ),
        /** FE Bracket */
        kEdsPropID_FEBracket( "FE Bracket", EdsDataType.kEdsDataType_Rational ),
        /** ISO Bracket */
        kEdsPropID_ISOBracket( "ISO Bracket", EdsDataType.kEdsDataType_Rational ),
        /** Noise Reduction */
        kEdsPropID_NoiseReduction( "Noise Reduction", EdsDataType.kEdsDataType_UInt32 ),
        /** Flash Status */
        kEdsPropID_FlashOn( "Flash Status", EdsDataType.kEdsDataType_UInt32 ),
        /** Red Eye Status */
        kEdsPropID_RedEye( "Red Eye Status", EdsDataType.kEdsDataType_UInt32 ),
        /** Flash Mode */
        kEdsPropID_FlashMode( "Flash Mode", EdsDataType.kEdsDataType_UInt32_Array ),
        /** Lens Status */
        kEdsPropID_LensStatus( "Lens Status", EdsDataType.kEdsDataType_UInt32 ),
        /** Artist */
        kEdsPropID_Artist( "Artist", EdsDataType.kEdsDataType_String ),
        /** Copyright */
        kEdsPropID_Copyright( "Copyright", EdsDataType.kEdsDataType_String ),
        /** Depth of Field */
        kEdsPropID_DepthOfField( "Depth of Field", EdsDataType.kEdsDataType_UInt32 ),
        /** EF Compensation */
        kEdsPropID_EFCompensation( "EF Compensation", EdsDataType.kEdsDataType_Unknown ),
        /** Shooting Mode Select */
        kEdsPropID_AEModeSelect( 0x00000436, "Shooting Mode Select", EdsDataType.kEdsDataType_UInt32 ), // in EDSDK 2.11.3 (or earlier), removed EDSDK <= 2.13.2
        /** Movie Shooting Status */
        kEdsPropID_Record( 0x00000510, "Movie Shooting Status", EdsDataType.kEdsDataType_UInt32 ), // in EDSDK 2.11.3 (or earlier), removed EDSDK <= 2.13.2

        /*----------------------------------
        EVF Properties
        ----------------------------------*/
        kEdsPropID_Evf_OutputDevice( "Live View Output Device", EdsDataType.kEdsDataType_UInt32 ),
        kEdsPropID_Evf_Mode( "Live View Mode", EdsDataType.kEdsDataType_UInt32 ),
        kEdsPropID_Evf_WhiteBalance( "Live View White Balance", EdsDataType.kEdsDataType_UInt32 ),
        kEdsPropID_Evf_ColorTemperature( "Live View Color Temperature", EdsDataType.kEdsDataType_UInt32 ),
        kEdsPropID_Evf_DepthOfFieldPreview( "Live View Depth of Field in Preview", EdsDataType.kEdsDataType_UInt32 ),

        // EVF IMAGE DATA Properties
        kEdsPropID_Evf_Zoom( "Live View Zoom Ratio", EdsDataType.kEdsDataType_UInt32 ),
        kEdsPropID_Evf_ZoomPosition( "Live View Zoom Position", EdsDataType.kEdsDataType_Point ),
        kEdsPropID_Evf_FocusAid( "Live View Focus Aid", EdsDataType.kEdsDataType_Unknown ),
        kEdsPropID_Evf_Histogram( "Live View Histogram", EdsDataType.kEdsDataType_ByteBlock ), // API lists EdsUInt32[]
        kEdsPropID_Evf_ImagePosition( "Live View Crop Position", EdsDataType.kEdsDataType_Point ),
        kEdsPropID_Evf_HistogramStatus( "Live View Histogram Status", EdsDataType.kEdsDataType_ByteBlock ), // API lists type as kEdsDataType_UInt32, but camera reports EdsDataType.kEdsDataType_ByteBlock
        kEdsPropID_Evf_AFMode( "Live View Auto-Focus Mode", EdsDataType.kEdsDataType_UInt32 ),

        kEdsPropID_Evf_HistogramY( 0x00000515, "Live View Histogram Y", EdsDataType.kEdsDataType_ByteBlock ), // in EDSDK 2.11.3 (or earlier), removed EDSDK <= 2.13.2 // API lists EdsUInt32[]
        kEdsPropID_Evf_HistogramR( 0x00000516, "Live View Histogram R", EdsDataType.kEdsDataType_ByteBlock ), // in EDSDK 2.11.3 (or earlier), removed EDSDK <= 2.13.2 // API lists EdsUInt32[]
        kEdsPropID_Evf_HistogramG( 0x00000517, "Live View Histogram G", EdsDataType.kEdsDataType_ByteBlock ), // in EDSDK 2.11.3 (or earlier), removed EDSDK <= 2.13.2 // API lists EdsUInt32[]
        kEdsPropID_Evf_HistogramB( 0x00000518, "Live View Histogram B", EdsDataType.kEdsDataType_ByteBlock ), // in EDSDK 2.11.3 (or earlier), removed EDSDK <= 2.13.2 // API lists EdsUInt32[]

        kEdsPropID_Evf_CoordinateSystem( "Live View Coordinate System", EdsDataType.kEdsDataType_ByteBlock ), // API lists conflicting info, says 'Data type number = kEdsDataType_Point', but 'Data type = EdsSize'... but the camera reports kEdsDataType_ByteBlock
        kEdsPropID_Evf_ZoomRect( "Live View Zoom Rectangle", EdsDataType.kEdsDataType_ByteBlock ), // API lists conflicting info, says 'Data type number = kEdsDataType_Point', but 'Data type = EdsRect'... but the camera reports kEdsDataType_ByteBlock
        public final Integer value() {
        kEdsPropID_Evf_ImageClipRect( 0x00000545, "Live View Crop Rectangle", EdsDataType.kEdsDataType_ByteBlock ); // in EDSDK 2.11.3 (or earlier), removed EDSDK <= 2.13.2

        private final int value;
        private final String description;
        private final EdsDataType type;

        EdsPropertyID( final int value, final String description,
                       final EdsDataType type ) {
            this.value = value;
            this.description = description;
            this.type = type;
        }

        EdsPropertyID( final String description, final EdsDataType type ) {
            value = CanonUtils.classIntField( EdSdkLibrary.class, name() );
            this.description = description;
            this.type = type;
        }

        @Override
        public final Integer value() {
            return value;
        }

        @Override
        public final String description() {
            return description;
        }

        public final EdsDataType type() {
            return type;
        }

        public static final EdsPropertyID enumOfName( final String name ) {
            return (EdsPropertyID) CanonConstants.enumOfName( EdsPropertyID.class, name );
        }

        public static final EdsPropertyID enumOfValue( final int value ) {
            return (EdsPropertyID) CanonConstants.enumOfValue( EdsPropertyID.class, value );
        }

        public static final EdsPropertyID enumOfDescription( final String description ) {
            return (EdsPropertyID) CanonConstants.enumOfDescription( EdsPropertyID.class, description );
        }
    }

/*-----------------------------------------------------------------------------
 Camera Commands
 -----------------------------------------------------------------------------*/

    /*----------------------------------
    Send Commands
    ----------------------------------*/

    // some EdsCameraCommand values are contained in EdsEvfAf and EdsShutterButton
    public enum EdsCameraCommand implements DescriptiveEnum {
        kEdsCameraCommand_TakePicture( "Take Picture" ),
        kEdsCameraCommand_ExtendShutDownTimer( "Extend Auto-off Timer" ),
        kEdsCameraCommand_BulbStart( "Start Bulb Shooting" ),
        kEdsCameraCommand_BulbEnd( "Stop Bulb Shooting" ),
        kEdsCameraCommand_DoEvfAf( "Change Live View AF" ),
        kEdsCameraCommand_DriveLensEvf( "Change Live View Focus" ),
        kEdsCameraCommand_DoClickWBEvf( "Change Live View WB at Location" ),

        kEdsCameraCommand_PressShutterButton( "Change Shutter Button" );

        private final int value;
        private final String description;

        EdsCameraCommand( final String description ) {
            value = CanonUtils.classIntField( EdSdkLibrary.class, name() );
            this.description = description;
        }

        @Override
        public final Integer value() {
            return value;
        }

        @Override
        public final String description() {
            return description;
        }

        public static final EdsCameraCommand enumOfName( final String name ) {
            return (EdsCameraCommand) CanonConstants.enumOfName( EdsCameraCommand.class, name );
        }

        public static final EdsCameraCommand enumOfValue( final int value ) {
            return (EdsCameraCommand) CanonConstants.enumOfValue( EdsCameraCommand.class, value );
        }

        public static final EdsCameraCommand enumOfDescription( final String description ) {
            return value;
            return (EdsCameraCommand) CanonConstants.enumOfDescription( EdsCameraCommand.class, description );
        }
    }

    public enum EdsEvfAf implements DescriptiveEnum {
        kEdsCameraCommand_EvfAf_OFF( "AF Off" ),
        kEdsCameraCommand_EvfAf_ON( "AF On" );

        private final int value;
        private final String description;

        EdsEvfAf( final String description ) {
            value = CanonUtils.classIntField( EdSdkLibrary.EdsEvfAf.class, name() );
            this.description = description;
        }

        @Override
        public final Integer value() {
            return value;
        }

        @Override
        public final String description() {
            return description;
        }

        public static final EdsEvfAf enumOfName( final String name ) {
            return (EdsEvfAf) CanonConstants.enumOfName( EdsEvfAf.class, name );
        }

        public static final EdsEvfAf enumOfValue( final int value ) {
            return (EdsEvfAf) CanonConstants.enumOfValue( EdsEvfAf.class, value );
        }

        public static final EdsEvfAf enumOfDescription( final String description ) {
            return (EdsEvfAf) CanonConstants.enumOfDescription( EdsEvfAf.class, description );
        }
    }

    public enum EdsShutterButton implements DescriptiveEnum {
        kEdsCameraCommand_ShutterButton_OFF( "Not Depressed" ),
        kEdsCameraCommand_ShutterButton_Halfway( "Halfway Depressed" ),
        kEdsCameraCommand_ShutterButton_Completely( "Fully Depressed" ),
        kEdsCameraCommand_ShutterButton_Halfway_NonAF( "Halfway Depressed (Non-AF)" ),
        kEdsCameraCommand_ShutterButton_Completely_NonAF( "Fully Depressed (Non-AF)" );

        private final int value;
        private final String description;

        EdsShutterButton( final String description ) {
            value = CanonUtils.classIntField( EdSdkLibrary.EdsShutterButton.class, name() );
            this.description = description;
        }

        @Override
        public final Integer value() {
            return value;
        }

        @Override
        public final String description() {
            return description;
        }

        public static final EdsShutterButton enumOfName( final String name ) {
            return (EdsShutterButton) CanonConstants.enumOfName( EdsShutterButton.class, name );
        }

        public static final EdsShutterButton enumOfValue( final int value ) {
            return (EdsShutterButton) CanonConstants.enumOfValue( EdsShutterButton.class, value );
        }

        public static final EdsShutterButton enumOfDescription( final String description ) {
            return (EdsShutterButton) CanonConstants.enumOfDescription( EdsShutterButton.class, description );
        }
    }

/*----------------------------------
 Camera Status Commands
 ----------------------------------*/
    public enum EdsCameraStatusCommand implements DescriptiveEnum {
        kEdsCameraStatusCommand_UILock( "UI Lock" ),
        kEdsCameraStatusCommand_UIUnLock( "UI Unlock" ),
        kEdsCameraStatusCommand_EnterDirectTransfer( "Enter Direct Transfer" ),
        kEdsCameraStatusCommand_ExitDirectTransfer( "Exit Direct Transfer" );

        private final int value;
        private final String description;

        EdsCameraStatusCommand( final String description ) {
            value = CanonUtils.classIntField( EdSdkLibrary.class, name() );
            this.description = description;
        }

        @Override
        public final String description() {
            return description;
        }

        public static final EdsCameraStatusCommand enumOfName( final String name ) {
            return (EdsCameraStatusCommand) CanonConstants.enumOfName( EdsCameraStatusCommand.class, name );
        }

        public static final EdsCameraStatusCommand enumOfValue( final int value ) {
            return (EdsCameraStatusCommand) CanonConstants.enumOfValue( EdsCameraStatusCommand.class, value );
        }

        public static final EdsCameraStatusCommand enumOfDescription( final String description ) {
            return (EdsCameraStatusCommand) CanonConstants.enumOfDescription( EdsCameraStatusCommand.class, description );
        }
    }

/*-----------------------------------------------------------------------------
 Camera Events
 -----------------------------------------------------------------------------*/

    /*----------------------------------
    Property Event
    ----------------------------------*/

    public enum EdsPropertyEvent implements DescriptiveEnum {
        /* Notifies all property events. */
        kEdsPropertyEvent_All( "Notify All" ),

        /*
         * Notifies that a camera property value has been changed.
         * The changed property can be retrieved from event data.
         * The changed value can be retrieved by means of EdsGetPropertyData.
         * In the case of type 1 protocol standard cameras,
         * notification of changed properties can only be issued for custom
         * functions (CFn).
         * If the property type is "", the changed property cannot be
         * identified.
         * Thus, retrieve all required properties repeatedly.
         */
        kEdsPropertyEvent_PropertyChanged( "Camera Property Changed" ),

        /*
         * Notifies of changes in the list of camera properties with
         * configurable values.
         * The list of configurable values for property IDs indicated in event
         * data
         * can be retrieved by means of EdsGetPropertyDesc.
         * For type 1 protocol standard cameras, the property ID is identified
         * as "Unknown"
         * during notification.
         * Thus, you must retrieve a list of configurable values for all
         * properties and
         * retrieve the property values repeatedly.
         * (For details on properties for which you can retrieve a list of
         * configurable
         * properties, see the description of EdsGetPropertyDesc).
         */
        kEdsPropertyEvent_PropertyDescChanged( "Details of Property Changed" );

        private final int value;
        private final String description;

        EdsPropertyEvent( final String description ) {
            value = CanonUtils.classIntField( EdSdkLibrary.class, name() );
            this.description = description;
        }

        @Override
        public final Integer value() {
            return value;
        }

        @Override
        public final String description() {
            return description;
        }

        public static final EdsPropertyEvent enumOfName( final String name ) {
            return (EdsPropertyEvent) CanonConstants.enumOfName( EdsPropertyEvent.class, name );
        }

        public static final EdsPropertyEvent enumOfValue( final int value ) {
            return (EdsPropertyEvent) CanonConstants.enumOfValue( EdsPropertyEvent.class, value );
        }

        public static final EdsPropertyEvent enumOfDescription( final String description ) {
            return (EdsPropertyEvent) CanonConstants.enumOfDescription( EdsPropertyEvent.class, description );
        }
    }

    /*----------------------------------
    ----------------------------------*/

    public enum EdsObjectEvent implements DescriptiveEnum {
        /* Notifies all object events. */
        kEdsObjectEvent_All( "Notify All" ),

        /*
         * Notifies that the volume object (memory card) state (VolumeInfo)
         * has been changed.
         * Changed objects are indicated by event data.
         * The changed value can be retrieved by means of EdsGetVolumeInfo.
         * Notification of this event is not issued for type 1 protocol standard
         * cameras.
         */
        kEdsObjectEvent_VolumeInfoChanged( "Memory Card Changed" ),

        /*
         * Notifies if the designated volume on a camera has been formatted.
         * If notification of this event is received, get sub-items of the
         * designated
         * volume again as needed.
         * Changed volume objects can be retrieved from event data.
         * Objects cannot be identified on cameras earlier than the D30
         * if files are added or deleted.
         * Thus, these events are subject to notification.
         */
        kEdsObjectEvent_VolumeUpdateItems( "Memory Card Formatted" ),

        /*
         * Notifies if many images are deleted in a designated folder on a
         * camera.
         * If notification of this event is received, get sub-items of the
         * designated
         * folder again as needed.
         * Changed folders (specifically, directory item objects) can be
         * retrieved
         * from event data.
         */
        kEdsObjectEvent_FolderUpdateItems( "Images Deleted" ),

        /*
         * Notifies of the creation of objects such as new folders or files
         * on a camera compact flash card or the like.
         * This event is generated if the camera has been set to store captured
         * images simultaneously on the camera and a computer,
         * for example, but not if the camera is set to store images
         * on the computer alone.
         * Newly created objects are indicated by event data.
         * Because objects are not indicated for type 1 protocol standard
         * cameras,
         * (that is, objects are indicated as NULL),
         * you must again retrieve child objects under the camera object to
         * identify the new objects.
         */
        kEdsObjectEvent_DirItemCreated( "Folders/Files Created" ),

        /*
         * Notifies of the deletion of objects such as folders or files on a
         * camera
         * compact flash card or the like.
         * Deleted objects are indicated in event data.
         * Because objects are not indicated for type 1 protocol standard
         * cameras,
         * you must again retrieve child objects under the camera object to
         * identify deleted objects.
         */
        kEdsObjectEvent_DirItemRemoved( "Folders/Files Deleted" ),

        /*
         * Notifies that information of DirItem objects has been changed.
         * Changed objects are indicated by event data.
         * The changed value can be retrieved by means of
         * EdsGetDirectoryItemInfo.
         * Notification of this event is not issued for type 1 protocol standard
         * cameras.
         */
        kEdsObjectEvent_DirItemInfoChanged( "Folders/Files Changed" ),

        /*
         * Notifies that header information has been updated, as for rotation
         * information
         * of image files on the camera.
         * If this event is received, get the file header information again, as
         * needed.
         * This function is for type 2 protocol standard cameras only.
         */
        kEdsObjectEvent_DirItemContentChanged( "Images Updated" ),

        /*
         * Notifies that there are objects on a camera to be transferred to a
         * This event is generated after remote release from a computer or local
         * release
         * from a camera.
         * If this event is received, objects indicated in the event data must
         * be downloaded.
         * Furthermore, if the application does not require the objects, instead
         * of downloading them,
         * execute EdsDownloadCancel and release resources held by the camera.
         * The order of downloading from type 1 protocol standard cameras must
         * be the order
         * in which the events are received.
         */
        kEdsObjectEvent_DirItemRequestTransfer( "Folders/Files Ready for Transfer" ),

        /*
         * Notifies if the camera's direct transfer button is pressed.
         * If this event is received, objects indicated in the event data must
         * be downloaded.
         * Furthermore, if the application does not require the objects, instead
         * of
         * downloading them,
         * execute EdsDownloadCancel and release resources held by the camera.
         * Notification of this event is not issued for type 1 protocol standard
         * cameras.
         */
        kEdsObjectEvent_DirItemRequestTransferDT( "Direct Transfer Pressed" ),

        /*
         * Notifies of requests from a camera to cancel object transfer
         * if the button to cancel direct transfer is pressed on the camera.
         * If the parameter is 0, it means that cancellation of transfer is
         * requested for
         * objects still not downloaded,
         * with these objects indicated by
         * kEdsObjectEvent_DirItemRequestTransferDT.
         * Notification of this event is not issued for type 1 protocol standard
         * cameras.
         */
        kEdsObjectEvent_DirItemCancelTransferDT( "Direct Tranfer Cancelled" ),

        kEdsObjectEvent_VolumeAdded( "Memory Card Added" ),
        kEdsObjectEvent_VolumeRemoved( "Memory Card Removed" );

        private final int value;
        private final String description;

        EdsObjectEvent( final String description ) {
            value = CanonUtils.classIntField( EdSdkLibrary.class, name() );
            this.description = description;
        }

        @Override
        public final Integer value() {
            return value;
        }

        @Override
        public final String description() {
            return description;
        }

        public static final EdsObjectEvent enumOfName( final String name ) {
            return (EdsObjectEvent) CanonConstants.enumOfName( EdsObjectEvent.class, name );
        }

        public static final EdsObjectEvent enumOfValue( final int value ) {
            return (EdsObjectEvent) CanonConstants.enumOfValue( EdsObjectEvent.class, value );
        }

        public static final EdsObjectEvent enumOfDescription( final String description ) {
            return (EdsObjectEvent) CanonConstants.enumOfDescription( EdsObjectEvent.class, description );
        }
    }

    /*----------------------------------
     State Event
    ----------------------------------*/
    public enum EdsStateEvent implements DescriptiveEnum {
        /* Notifies all state events. */
        kEdsStateEvent_All( "Notify All" ),

        /*
         * Indicates that a camera is no longer connected to a computer,
         * whether it was disconnected by unplugging a cord, opening
         * the compact flash compartment,
         * turning the camera off, auto shut-off, or by other means.
         */
        kEdsStateEvent_Shutdown( "Camera Unavailable" ),

        /*
         * Notifies of whether or not there are objects waiting to
         * be transferred to a host computer.
         * This is useful when ensuring all shot images have been transferred
         * when the application is closed.
         * Notification of this event is not issued for type 1 protocol
         * standard cameras.
         */
        kEdsStateEvent_JobStatusChanged( "Job State Changed" ),

        /*
         * Notifies that the camera will shut down after a specific period.
         * Generated only if auto shut-off is set.
         * Exactly when notification is issued (that is, the number of
         * seconds until shutdown) varies depending on the camera model.
         * To continue operation without having the camera shut down,
         * use EdsSendCommand to extend the auto shut-off timer.
         * The time in seconds until the camera shuts down is returned
         * as the initial value.
         */
        kEdsStateEvent_WillSoonShutDown( "Camera Auto-off Active" ),

        /*
         * As the counterpart event to kEdsStateEvent_WillSoonShutDown,
         * this event notifies of updates to the number of seconds until
         * a camera shuts down.
         * After the update, the period until shutdown is model-dependent.
         */
        kEdsStateEvent_ShutDownTimerUpdate( "Seconds Until Auto-Off" ),

        /*
         * Notifies that a requested release has failed, due to focus
         * failure or similar factors.
         */
        kEdsStateEvent_CaptureError( "Remote Release Error" ),

        /*
         * Notifies of internal SDK errors.
         * If this error event is received, the issuing device will probably
         * not be able to continue working properly,
         * so cancel the remote connection.
         */
        kEdsStateEvent_InternalError( "SDK Software Error" ),

        kEdsStateEvent_AfResult( "AF Result" ),
        kEdsStateEvent_BulbExposureTime( "Bulb Exposure Time" );

        private final int value;
        private final String description;

        EdsStateEvent( final String description ) {
            value = CanonUtils.classIntField( EdSdkLibrary.class, name() );
            this.description = description;
        }

        @Override
        public final Integer value() {
            return value;
        }

        @Override
        public final String description() {
            return description;
        }

        public static final EdsStateEvent enumOfName( final String name ) {
            return (EdsStateEvent) CanonConstants.enumOfName( EdsStateEvent.class, name );
        }

        public static final EdsStateEvent enumOfValue( final int value ) {
            return (EdsStateEvent) CanonConstants.enumOfValue( EdsStateEvent.class, value );
        }

        public static final EdsStateEvent enumOfDescription( final String description ) {
            return (EdsStateEvent) CanonConstants.enumOfDescription( EdsStateEvent.class, description );
        }
    }

/*-----------------------------------------------------------------------------
 Drive Lens
 -----------------------------------------------------------------------------*/
    public enum EdsEvfDriveLens implements DescriptiveEnum {
        kEdsEvfDriveLens_Near1( "Near 1" ),
        kEdsEvfDriveLens_Near2( "Near 2" ),
        kEdsEvfDriveLens_Near3( "Near 3" ),
        kEdsEvfDriveLens_Far1( "Far 1" ),
        kEdsEvfDriveLens_Far2( "Far 2" ),
        kEdsEvfDriveLens_Far3( "Far 3" );

        private final int value;
        private final String description;

        EdsEvfDriveLens( final String description ) {
            value = CanonUtils.classIntField( EdSdkLibrary.EdsEvfDriveLens.class, name() );
            this.description = description;
        }

        @Override
        public final Integer value() {
            return value;
        }

        @Override
        public final String description() {
            return description;
        }

        public static final EdsEvfDriveLens enumOfName( final String name ) {
            return (EdsEvfDriveLens) CanonConstants.enumOfName( EdsEvfDriveLens.class, name );
        }

        public static final EdsEvfDriveLens enumOfValue( final int value ) {
            return (EdsEvfDriveLens) CanonConstants.enumOfValue( EdsEvfDriveLens.class, value );
        }

        public static final EdsEvfDriveLens enumOfDescription( final String description ) {
            return (EdsEvfDriveLens) CanonConstants.enumOfDescription( EdsEvfDriveLens.class, description );
        }
    }

/*-----------------------------------------------------------------------------
 Depth of Field Preview
 -----------------------------------------------------------------------------*/
    public enum EdsEvfDepthOfFieldPreview implements DescriptiveEnum {
        kEdsEvfDepthOfFieldPreview_OFF( "Off" ),
        kEdsEvfDepthOfFieldPreview_ON( "On" );

        private final int value;
        private final String description;

        EdsEvfDepthOfFieldPreview( final String description ) {
            value = CanonUtils.classIntField( EdSdkLibrary.EdsEvfDepthOfFieldPreview.class, name() );
            this.description = description;
        }

        @Override
        public final Integer value() {
            return value;
        }

        @Override
        public final String description() {
            return description;
        }

        public static final EdsEvfDepthOfFieldPreview enumOfName( final String name ) {
            return (EdsEvfDepthOfFieldPreview) CanonConstants.enumOfName( EdsEvfDepthOfFieldPreview.class, name );
        }

        public static final EdsEvfDepthOfFieldPreview enumOfValue( final int value ) {
            return (EdsEvfDepthOfFieldPreview) CanonConstants.enumOfValue( EdsEvfDepthOfFieldPreview.class, value );
        }

        public static final EdsEvfDepthOfFieldPreview enumOfDescription( final String description ) {
            return (EdsEvfDepthOfFieldPreview) CanonConstants.enumOfDescription( EdsEvfDepthOfFieldPreview.class, description );
        }
    }

/*-----------------------------------------------------------------------------
 Stream Seek Origins
 -----------------------------------------------------------------------------*/
    public enum EdsSeekOrigin implements DescriptiveEnum {
        kEdsSeek_Cur( "Current" ),
        kEdsSeek_Begin( "Beginning" ),
        kEdsSeek_End( "Ending" );

        private final int value;
        private final String description;

        EdsSeekOrigin( final String description ) {
            value = CanonUtils.classIntField( EdSdkLibrary.EdsSeekOrigin.class, name() );
            this.description = description;
        }

        @Override
        public final Integer value() {
            return value;
        }

        @Override
        public final String description() {
            return description;
        }

        public static final EdsSeekOrigin enumOfName( final String name ) {
            return (EdsSeekOrigin) CanonConstants.enumOfName( EdsSeekOrigin.class, name );
        }

        public static final EdsSeekOrigin enumOfValue( final int value ) {
            return (EdsSeekOrigin) CanonConstants.enumOfValue( EdsSeekOrigin.class, value );
        }

        public static final EdsSeekOrigin enumOfDescription( final String description ) {
            return (EdsSeekOrigin) CanonConstants.enumOfDescription( EdsSeekOrigin.class, description );
        }
    }

/*-----------------------------------------------------------------------------
 File and Properties Access
 -----------------------------------------------------------------------------*/
    public enum EdsAccess implements DescriptiveEnum {
        kEdsAccess_Read( "Read-only" ),
        kEdsAccess_Write( "Write-only" ),
        kEdsAccess_ReadWrite( "Read + Write" ),
        kEdsAccess_Error( "Error" );

        private final int value;
        private final String description;

        EdsAccess( final String description ) {
            value = CanonUtils.classIntField( EdSdkLibrary.EdsAccess.class, name() );
            this.description = description;
        }

        @Override
        public final Integer value() {
            return value;
        }

        @Override
        public final String description() {
            return description;
        }

        public static final EdsAccess enumOfName( final String name ) {
            return (EdsAccess) CanonConstants.enumOfName( EdsAccess.class, name );
        }

        public static final EdsAccess enumOfValue( final int value ) {
            return (EdsAccess) CanonConstants.enumOfValue( EdsAccess.class, value );
        }

        public static final EdsAccess enumOfDescription( final String description ) {
            return (EdsAccess) CanonConstants.enumOfDescription( EdsAccess.class, description );
        }
    }

/*-----------------------------------------------------------------------------
 File Create Disposition
 -----------------------------------------------------------------------------*/
    public enum EdsFileCreateDisposition implements DescriptiveEnum {
        kEdsFileCreateDisposition_CreateNew( "Create New" ),
        kEdsFileCreateDisposition_CreateAlways( "Create New or Overwrite Existing" ),
        kEdsFileCreateDisposition_OpenExisting( "Open Existing" ),
        kEdsFileCreateDisposition_OpenAlways( "Open Existing or Create New" ),
        kEdsFileCreateDisposition_TruncateExsisting( "Open and Erase Existing" );

        private final int value;
        private final String description;

        EdsFileCreateDisposition( final String description ) {
            value = CanonUtils.classIntField( EdSdkLibrary.EdsFileCreateDisposition.class, name() );
            this.description = description;
        }

        @Override
        public final Integer value() {
            return value;
        }

        @Override
        public final String description() {
            return description;
        }

        public static final EdsFileCreateDisposition enumOfName( final String name ) {
            return (EdsFileCreateDisposition) CanonConstants.enumOfName( EdsFileCreateDisposition.class, name );
        }

        public static final EdsFileCreateDisposition enumOfValue( final int value ) {
            return (EdsFileCreateDisposition) CanonConstants.enumOfValue( EdsFileCreateDisposition.class, value );
        }

        public static final EdsFileCreateDisposition enumOfDescription( final String description ) {
            return (EdsFileCreateDisposition) CanonConstants.enumOfDescription( EdsFileCreateDisposition.class, description );
        }
    }

/*-----------------------------------------------------------------------------
 Image Types
        private final int value;
 -----------------------------------------------------------------------------*/
    public enum EdsImageType implements DescriptiveEnum {
        kEdsImageType_Unknown( "Folder or Unknown" ),
        kEdsImageType_Jpeg( "JPEG" ),
        kEdsImageType_CRW( "CRW" ),
        kEdsImageType_RAW( "RAW" ),
        kEdsImageType_CR2( "CR2" );

        private final int value;
        private final String description;

        EdsImageType( final String description ) {
            value = CanonUtils.classIntField( EdSdkLibrary.EdsImageType.class, name() );
            this.description = description;
        }

        @Override
        public final Integer value() {
            return value;
        }

        @Override
        public final String description() {
            return description;
        }

        public static final EdsImageType enumOfName( final String name ) {
            return (EdsImageType) CanonConstants.enumOfName( EdsImageType.class, name );
        }

        public static final EdsImageType enumOfValue( final int value ) {
            return (EdsImageType) CanonConstants.enumOfValue( EdsImageType.class, value );
        }

        public static final EdsImageType enumOfDescription( final String description ) {
            return (EdsImageType) CanonConstants.enumOfDescription( EdsImageType.class, description );
        }
    }

/*-----------------------------------------------------------------------------
 Image Size
 -----------------------------------------------------------------------------*/
    public enum EdsImageSize implements DescriptiveEnum {
        kEdsImageSize_Large( "Large" ),
        kEdsImageSize_Middle( "Medium" ),
        kEdsImageSize_Small( "Small" ),
        kEdsImageSize_Middle1( "Medium 1" ),
        kEdsImageSize_Middle2( "Medium 2" ),
        kEdsImageSize_Small1( "Small 1" ),
        kEdsImageSize_Small2( "Small 2" ),
        kEdsImageSize_Small3( "Small 3" ),
        kEdsImageSize_Unknown( "Unknown" );

        private final int value;
        private final String description;

        EdsImageSize( final String description ) {
            value = CanonUtils.classIntField( EdSdkLibrary.EdsImageSize.class, name() );
            this.description = description;
        }

        @Override
        public final Integer value() {
            return value;
        }

        @Override
        public final String description() {
            return description;
        }

        public static final EdsImageSize enumOfName( final String name ) {
            return (EdsImageSize) CanonConstants.enumOfName( EdsImageSize.class, name );
        }

        public static final EdsImageSize enumOfValue( final int value ) {
            return (EdsImageSize) CanonConstants.enumOfValue( EdsImageSize.class, value );
        }

        public static final EdsImageSize enumOfDescription( final String description ) {
            return (EdsImageSize) CanonConstants.enumOfDescription( EdsImageSize.class, description );
        }
    }

/*-----------------------------------------------------------------------------
 Image Compress Quality
 -----------------------------------------------------------------------------*/
    public enum EdsCompressQuality implements DescriptiveEnum {
        kEdsCompressQuality_Normal( "Normal" ),
        kEdsCompressQuality_Fine( "Fine" ),
        kEdsCompressQuality_Lossless( "Lossless" ),
        kEdsCompressQuality_SuperFine( "Superfine" ),
        kEdsCompressQuality_Unknown( "Unknown" );

        private final String description;

        EdsCompressQuality( final String description ) {
            value = CanonUtils.classIntField( EdSdkLibrary.EdsCompressQuality.class, name() );
            this.description = description;
        }

        @Override
        public final Integer value() {
            return value;
        }

        @Override
        public final String description() {
            return description;
        }

        public static final EdsCompressQuality enumOfName( final String name ) {
            return (EdsCompressQuality) CanonConstants.enumOfName( EdsCompressQuality.class, name );
        }

        public static final EdsCompressQuality enumOfValue( final int value ) {
            return (EdsCompressQuality) CanonConstants.enumOfValue( EdsCompressQuality.class, value );
        }

        public static final EdsCompressQuality enumOfDescription( final String description ) {
            return (EdsCompressQuality) CanonConstants.enumOfDescription( EdsCompressQuality.class, description );
        }
    }

/*-----------------------------------------------------------------------------
 Image Quality
 -----------------------------------------------------------------------------*/
    public enum EdsImageQuality implements DescriptiveEnum {
        EdsImageQuality_LJ( "JPEG Large" ),
        EdsImageQuality_M1J( "JPEG Medium 1" ),
        EdsImageQuality_M2J( "JPEG Medium 2" ),
        EdsImageQuality_SJ( "JPEG Small" ),
        EdsImageQuality_LJF( "JPEG Large Fine" ),
        EdsImageQuality_LJN( "JPEG Large Normal" ),
        EdsImageQuality_MJF( "JPEG Medium Fine" ),
        EdsImageQuality_MJN( "JPEG Medium Normal" ),
        EdsImageQuality_SJF( "JPEG Small Fine" ),
        EdsImageQuality_SJN( "JPEG Small Normal" ),
        EdsImageQuality_S1JF( "JPEG Small 1 Fine" ),
        EdsImageQuality_S1JN( "JPEG Small 1 Normal" ),
        EdsImageQuality_S2JF( "JPEG Small 2" ),
        EdsImageQuality_S3JF( "JPEG Small 3" ),

        EdsImageQuality_LR( "RAW" ),
        EdsImageQuality_LRLJF( "RAW + JPEG Large Fine" ),
        EdsImageQuality_LRLJN( "RAW + JPEG Large Normal" ),
        EdsImageQuality_LRMJF( "RAW + JPEG Middle Fine" ),
        EdsImageQuality_LRMJN( "RAW + JPEG Middle Normal" ),
        EdsImageQuality_LRSJF( "RAW + JPEG Small Fine" ),
        EdsImageQuality_LRSJN( "RAW + JPEG Small Normal" ),
        EdsImageQuality_LRS1JF( "RAW + JPEG Small 1 Fine" ),
        EdsImageQuality_LRS1JN( "RAW + JPEG Small 1 Normal" ),
        EdsImageQuality_LRS2JF( "RAW + JPEG Small 2" ),
        EdsImageQuality_LRS3JF( "RAW + JPEG Small 3" ),

        EdsImageQuality_LRLJ( "RAW + JPEG Large" ),
        EdsImageQuality_LRM1J( "RAW + JPEG Middle 1" ),
        EdsImageQuality_LRM2J( "RAW + JPEG Middle 2" ),
        EdsImageQuality_LRSJ( "RAW + JPEG Small" ),

        EdsImageQuality_MR( "MRAW (SRAW1)" ),
        EdsImageQuality_MRLJF( "MRAW (SRAW1) + JPEG Large Fine" ),
        EdsImageQuality_MRLJN( "MRAW (SRAW1) + JPEG Large Normal" ),
        EdsImageQuality_MRMJF( "MRAW (SRAW1) + JPEG Medium Fine" ),
        EdsImageQuality_MRMJN( "MRAW (SRAW1) + JPEG Medium Normal" ),
        EdsImageQuality_MRSJF( "MRAW (SRAW1) + JPEG Small Fine" ),
        EdsImageQuality_MRSJN( "MRAW (SRAW1) + JPEG Small Normal" ),
        EdsImageQuality_MRS1JF( "MRAW (SRAW1) + JPEG Small 1 Fine" ),
        EdsImageQuality_MRS1JN( "MRAW (SRAW1) + JPEG Small 1 Normal" ),
        EdsImageQuality_MRS2JF( "MRAW (SRAW1) + JPEG Small 2" ),
        EdsImageQuality_MRS3JF( "MRAW (SRAW1) + JPEG Small 3" ),

        EdsImageQuality_MRLJ( "MRAW (SRAW1) + JPEG Large" ),
        EdsImageQuality_MRM1J( "MRAW (SRAW1) + JPEG Medium 1" ),
        EdsImageQuality_MRM2J( "MRAW (SRAW1) + JPEG Medium 2" ),
        EdsImageQuality_MRSJ( "MRAW (SRAW1) + JPEG Small" ),

        EdsImageQuality_SR( "SRAW (SRAW2)" ),
        EdsImageQuality_SRLJF( "SRAW (SRAW2) + JPEG Large Fine" ),
        EdsImageQuality_SRLJN( "SRAW (SRAW2) + JPEG Large Normal" ),
        EdsImageQuality_SRMJF( "SRAW (SRAW2) + JPEG Middle Fine" ),
        EdsImageQuality_SRMJN( "SRAW (SRAW2) + JPEG Middle Normal" ),
        EdsImageQuality_SRSJF( "SRAW (SRAW2) + JPEG Small Fine" ),
        EdsImageQuality_SRSJN( "SRAW (SRAW2) + JPEG Small Normal" ),
        EdsImageQuality_SRS1JF( "SRAW (SRAW2) + JPEG Small1 Fine" ),
        EdsImageQuality_SRS1JN( "SRAW (SRAW2) + JPEG Small1 Normal" ),
        EdsImageQuality_SRS2JF( "SRAW (SRAW2) + JPEG Small2" ),
        EdsImageQuality_SRS3JF( "SRAW (SRAW2) + JPEG Small3" ),

        EdsImageQuality_SRLJ( "SRAW (SRAW2) + JPEG Large" ),
        EdsImageQuality_SRM1J( "SRAW (SRAW2) + JPEG Medium 1" ),
        EdsImageQuality_SRM2J( "SRAW (SRAW2) + JPEG Medium 2" ),
        EdsImageQuality_SRSJ( "SRAW (SRAW2) + JPEG Small" ),

        EdsImageQuality_Unknown( "Unknown" );

        private final int value;
        private final String description;

        EdsImageQuality( final String description ) {
            value = CanonUtils.classIntField( EdSdkLibrary.EdsImageQuality.class, name() );
            this.description = description;
        }

        @Override
        public final Integer value() {
            return value;
        }

        @Override
        public final String description() {
            return description;
        }

        public static final EdsImageQuality enumOfName( final String name ) {
            return (EdsImageQuality) CanonConstants.enumOfName( EdsImageQuality.class, name );
        }

        public static final EdsImageQuality enumOfValue( final int value ) {
            return (EdsImageQuality) CanonConstants.enumOfValue( EdsImageQuality.class, value );
        }

        public static final EdsImageQuality enumOfDescription( final String description ) {
            return (EdsImageQuality) CanonConstants.enumOfDescription( EdsImageQuality.class, description );
        }
    }

    public enum EdsImageQualityForLegacy implements DescriptiveEnum {
        kEdsImageQualityForLegacy_LJ( "JPEG large" ),
        kEdsImageQualityForLegacy_M1J( "JPEG medium 1" ),
        kEdsImageQualityForLegacy_M2J( "JPEG medium 2" ),
        kEdsImageQualityForLegacy_SJ( "JPEG small" ),

        kEdsImageQualityForLegacy_LJF( "JPEG large fine" ),
        kEdsImageQualityForLegacy_LJN( "JPEG large normal" ),
        kEdsImageQualityForLegacy_MJF( "JPEG medium fine" ),
        kEdsImageQualityForLegacy_MJN( "JPEG medium normal" ),
        kEdsImageQualityForLegacy_SJF( "JPEG small fine" ),
        kEdsImageQualityForLegacy_SJN( "JPEG small normal" ),

        kEdsImageQualityForLegacy_LR( "RAW" ),
        kEdsImageQualityForLegacy_LRLJF( "RAW + JPEG large fine" ),
        kEdsImageQualityForLegacy_LRLJN( "RAW + JPEG large normal" ),
        kEdsImageQualityForLegacy_LRMJF( "RAW + JPEG medium fine" ),
        kEdsImageQualityForLegacy_LRMJN( "RAW + JPEG medium normal" ),
        kEdsImageQualityForLegacy_LRSJF( "RAW + JPEG small fine" ),
        kEdsImageQualityForLegacy_LRSJN( "RAW + JPEG small normal" ),

        kEdsImageQualityForLegacy_LR2( "RAW " ),
        kEdsImageQualityForLegacy_LR2LJ( "RAW + JPEG large" ),
        kEdsImageQualityForLegacy_LR2M1J( "RAW + JPEG medium 1" ),
        kEdsImageQualityForLegacy_LR2M2J( "RAW + JPEG medium 2" ),
        kEdsImageQualityForLegacy_LR2SJ( "RAW + JPEG small" ),

        kEdsImageQualityForLegacy_Unknown( "Unknown" );

        private final int value;
        private final String description;

        EdsImageQualityForLegacy( final String description ) {
            value = CanonUtils.classIntField( EdSdkLibrary.EdsImageQualityForLegacy.class, name() );
            this.description = description;
        }

        @Override
        public final Integer value() {
            return value;
        }

        @Override
        public final String description() {
            return description;
        }

        public static final EdsImageQualityForLegacy enumOfName( final String name ) {
            return (EdsImageQualityForLegacy) CanonConstants.enumOfName( EdsImageQualityForLegacy.class, name );
        }

        public static final EdsImageQualityForLegacy enumOfValue( final int value ) {
            return (EdsImageQualityForLegacy) CanonConstants.enumOfValue( EdsImageQualityForLegacy.class, value );
        }

        public static final EdsImageQualityForLegacy enumOfDescription( final String description ) {
            return (EdsImageQualityForLegacy) CanonConstants.enumOfDescription( EdsImageQualityForLegacy.class, description );
        }
    }

/*-----------------------------------------------------------------------------
 Image Source
 -----------------------------------------------------------------------------*/
    public enum EdsImageSource implements DescriptiveEnum {
        kEdsImageSrc_FullView( "Full-size" ),
        kEdsImageSrc_Thumbnail( "Thumbnail" ),
        kEdsImageSrc_Preview( "Preview" ),
        kEdsImageSrc_RAWThumbnail( "RAW thumbnail" ),
        kEdsImageSrc_RAWFullView( "RAW full-size" );

        private final int value;
        private final String description;

        EdsImageSource( final String description ) {
            value = CanonUtils.classIntField( EdSdkLibrary.EdsImageSource.class, name() );
            this.description = description;
        }

        @Override
        public final Integer value() {
            return value;
        }

        @Override
        public final String description() {
            return description;
        }

        public static final EdsImageSource enumOfName( final String name ) {
            return (EdsImageSource) CanonConstants.enumOfName( EdsImageSource.class, name );
        }

        public static final EdsImageSource enumOfValue( final int value ) {
            return (EdsImageSource) CanonConstants.enumOfValue( EdsImageSource.class, value );
        }

        public static final EdsImageSource enumOfDescription( final String description ) {
            return (EdsImageSource) CanonConstants.enumOfDescription( EdsImageSource.class, description );
        }
    }

/*-----------------------------------------------------------------------------
 Target Image Types
 -----------------------------------------------------------------------------*/
    public enum EdsTargetImageType implements DescriptiveEnum {
        kEdsTargetImageType_Unknown( "Folder or unknown" ),
        kEdsTargetImageType_Jpeg( "JPEG" ),
        kEdsTargetImageType_TIFF( "8-bit TIFF" ),
        kEdsTargetImageType_TIFF16( "16-bit TIFF" ),
        kEdsTargetImageType_RGB( "8-bit RGB" ),
        kEdsTargetImageType_RGB16( "16-bit RGB" ),
        kEdsTargetImageType_DIB( "DIB (BMP)" );

        private final int value;
        private final String description;

        EdsTargetImageType( final String description ) {
            value = CanonUtils.classIntField( EdSdkLibrary.EdsTargetImageType.class, name() );
            this.description = description;
        }

        @Override
        public final Integer value() {
            return value;
        }

        @Override
        public final String description() {
            return description;
        }

        public static final EdsTargetImageType enumOfName( final String name ) {
            return (EdsTargetImageType) CanonConstants.enumOfName( EdsTargetImageType.class, name );
        }

        private final String description;
        public static final EdsTargetImageType enumOfValue( final int value ) {
            return (EdsTargetImageType) CanonConstants.enumOfValue( EdsTargetImageType.class, value );
        }

        public static final EdsTargetImageType enumOfDescription( final String description ) {
            return (EdsTargetImageType) CanonConstants.enumOfDescription( EdsTargetImageType.class, description );
        }
    }

/*-----------------------------------------------------------------------------
 Progress Option
 -----------------------------------------------------------------------------*/
    public enum EdsProgressOption implements DescriptiveEnum {
        kEdsProgressOption_NoReport( "No callback" ),
        kEdsProgressOption_Done( "Callback when done" ),
        kEdsProgressOption_Periodically( "Periodic Callback" );

        private final int value;
        private final String description;

        EdsProgressOption( final String description ) {
            value = CanonUtils.classIntField( EdSdkLibrary.EdsProgressOption.class, name() );
            this.description = description;
        }

        @Override
        public final Integer value() {
            return value;
        }

        @Override
        public final String description() {
            return description;
        }

        public static final EdsProgressOption enumOfName( final String name ) {
            return (EdsProgressOption) CanonConstants.enumOfName( EdsProgressOption.class, name );
        }

        public static final EdsProgressOption enumOfValue( final int value ) {
            return (EdsProgressOption) CanonConstants.enumOfValue( EdsProgressOption.class, value );
        }

        public static final EdsProgressOption enumOfDescription( final String description ) {
            return (EdsProgressOption) CanonConstants.enumOfDescription( EdsProgressOption.class, description );
        }
    }

/*-----------------------------------------------------------------------------
 File attribute
 -----------------------------------------------------------------------------*/
    public enum EdsFileAttributes implements DescriptiveEnum {
        kEdsFileAttribute_Normal( "Normal" ),
        kEdsFileAttribute_ReadOnly( "Read-Only" ),
        kEdsFileAttribute_Hidden( "Hidden" ),
        kEdsFileAttribute_System( "System" ),
        kEdsFileAttribute_Archive( "Archive" );

        private final int value;
        private final String description;

        EdsFileAttributes( final String description ) {
            value = CanonUtils.classIntField( EdSdkLibrary.EdsFileAttributes.class, name() );
            this.description = description;
        }

        @Override
        public final Integer value() {
            return value;
        }

        @Override
        public final String description() {
            return description;
        }

        public static final EdsFileAttributes enumOfName( final String name ) {
            return (EdsFileAttributes) CanonConstants.enumOfName( EdsFileAttributes.class, name );
        }

        public static final EdsFileAttributes enumOfValue( final int value ) {
            return (EdsFileAttributes) CanonConstants.enumOfValue( EdsFileAttributes.class, value );
        }

        public static final EdsFileAttributes enumOfDescription( final String description ) {
            return (EdsFileAttributes) CanonConstants.enumOfDescription( EdsFileAttributes.class, description );
        }
    }

/*-----------------------------------------------------------------------------
 Battery level
 -----------------------------------------------------------------------------*/
    // TODO: C++ enum values can have the same value, as in EdSdkLibrary.EdsBatteryLevel2... how to handle reverse lookup in JAVA? Have moved kEdsBatteryLevel2_Error as last identical value so that at least the user doesn't think something is OK when it might not be
    public enum EdsBatteryLevel2 implements DescriptiveEnum {
        kEdsBatteryLevel2_Empty( "Empty" ),
        kEdsBatteryLevel2_Low( "Low" ),
        kEdsBatteryLevel2_Half( "Half" ),
        kEdsBatteryLevel2_Normal( "Normal" ),
        kEdsBatteryLevel2_Hi( "Hi" ),
        kEdsBatteryLevel2_Quarter( "Quarter" ),
        kEdsBatteryLevel2_BCLevel( "BC Level" ),
        kEdsBatteryLevel2_Error( "Error" ),
        kEdsBatteryLevel2_AC( "AC power" );

        private final int value;
        private final String description;

        EdsBatteryLevel2( final String description ) {
            value = CanonUtils.classIntField( EdSdkLibrary.EdsBatteryLevel2.class, name() );
            this.description = description;
        }

        @Override
        public final Integer value() {
            return value;
        }

        @Override
        public final String description() {
            return description;
        }

        public static final EdsBatteryLevel2 enumOfName( final String name ) {
            return (EdsBatteryLevel2) CanonConstants.enumOfName( EdsBatteryLevel2.class, name );
        }

        public static final EdsBatteryLevel2 enumOfValue( final int value ) {
            return (EdsBatteryLevel2) CanonConstants.enumOfValue( EdsBatteryLevel2.class, value );
        }

        public static final EdsBatteryLevel2 enumOfDescription( final String description ) {
            return (EdsBatteryLevel2) CanonConstants.enumOfDescription( EdsBatteryLevel2.class, description );
        }
    }

/*-----------------------------------------------------------------------------
 Save To
 -----------------------------------------------------------------------------*/
    public enum EdsSaveTo implements DescriptiveEnum {
        kEdsSaveTo_Camera( "Camera" ),
        kEdsSaveTo_Host( "Host Computer" ),
        kEdsSaveTo_Both( "Both" );

        private final int value;
        private final String description;

        EdsSaveTo( final String description ) {
            value = CanonUtils.classIntField( EdSdkLibrary.EdsSaveTo.class, name() );
            this.description = description;
        }

        @Override
        public final Integer value() {
            return value;
        }

        @Override
        public final String description() {
            return description;
        }

        public static final EdsSaveTo enumOfName( final String name ) {
            return (EdsSaveTo) CanonConstants.enumOfName( EdsSaveTo.class, name );
        }

        public static final EdsSaveTo enumOfValue( final int value ) {
            return (EdsSaveTo) CanonConstants.enumOfValue( EdsSaveTo.class, value );
        }

        public static final EdsSaveTo enumOfDescription( final String description ) {
            return (EdsSaveTo) CanonConstants.enumOfDescription( EdsSaveTo.class, description );
        }
    }

/*-----------------------------------------------------------------------------
 StorageType
 -----------------------------------------------------------------------------*/
    public enum EdsStorageType implements DescriptiveEnum {
        kEdsStorageType_Non( "No memory card" ),
        kEdsStorageType_CF( "Compact Flash" ),
        kEdsStorageType_SD( "SD Flash" ),
        kEdsStorageType_HD( "Hard Drive" );

        private final int value;

        EdsStorageType( final String description ) {
            value = CanonUtils.classIntField( EdSdkLibrary.EdsStorageType.class, name() );
            this.description = description;
        }

        @Override
        public final Integer value() {
            return value;
        }

        @Override
        public final String description() {
            return description;
        }

        public static final EdsStorageType enumOfName( final String name ) {
            return (EdsStorageType) CanonConstants.enumOfName( EdsStorageType.class, name );
        }

        public static final EdsStorageType enumOfValue( final int value ) {
            return (EdsStorageType) CanonConstants.enumOfValue( EdsStorageType.class, value );
        }

        public static final EdsStorageType enumOfDescription( final String description ) {
            return (EdsStorageType) CanonConstants.enumOfDescription( EdsStorageType.class, description );
        }
    }

/*-----------------------------------------------------------------------------
 White Balance
 -----------------------------------------------------------------------------*/
    public enum EdsWhiteBalance implements DescriptiveEnum {
        kEdsWhiteBalance_Auto( "Auto" ),
        kEdsWhiteBalance_Daylight( "Daylight" ),
        kEdsWhiteBalance_Cloudy( "Cloudy" ),
        kEdsWhiteBalance_Tangsten( "Tungsten" ),
        kEdsWhiteBalance_Fluorescent( "Fluorescent" ),
        kEdsWhiteBalance_Strobe( "Flash" ),
        kEdsWhiteBalance_WhitePaper( "Manual" ),
        kEdsWhiteBalance_Shade( "Shade" ),
        kEdsWhiteBalance_ColorTemp( "Color temperature" ),
        kEdsWhiteBalance_PCSet1( "Custom: PC-1" ),
        kEdsWhiteBalance_PCSet2( "Custom: PC-2" ),
        kEdsWhiteBalance_PCSet3( "Custom: PC-3" ),
        kEdsWhiteBalance_WhitePaper2( "Manual 2" ),
        kEdsWhiteBalance_WhitePaper3( "Manual 3" ),
        kEdsWhiteBalance_WhitePaper4( "Manual 4" ),
        kEdsWhiteBalance_WhitePaper5( "Manual 5" ),
        kEdsWhiteBalance_PCSet4( "Custom: PC-4" ),
        kEdsWhiteBalance_PCSet5( "Custom: PC-5" ),
        kEdsWhiteBalance_Click( "Click to set" ),
        kEdsWhiteBalance_Pasted( "Copied from image" );

        private final int value;
        private final String description;

        EdsWhiteBalance( final String description ) {
            value = CanonUtils.classIntField( EdSdkLibrary.EdsWhiteBalance.class, name() );
            this.description = description;
        }

        @Override
        public final Integer value() {
            return value;
        }

        @Override
        public final String description() {
            return description;
        }

        public static final EdsWhiteBalance enumOfName( final String name ) {
            return (EdsWhiteBalance) CanonConstants.enumOfName( EdsWhiteBalance.class, name );
        }

        public static final EdsWhiteBalance enumOfValue( final int value ) {
            return (EdsWhiteBalance) CanonConstants.enumOfValue( EdsWhiteBalance.class, value );
        }

        public static final EdsWhiteBalance enumOfDescription( final String description ) {
            return (EdsWhiteBalance) CanonConstants.enumOfDescription( EdsWhiteBalance.class, description );
        }
    }

/*-----------------------------------------------------------------------------
 Photo Effects
 -----------------------------------------------------------------------------*/
    public enum EdsPhotoEffect implements DescriptiveEnum {
        kEdsPhotoEffect_Off( "Off" ),
        kEdsPhotoEffect_Monochrome( "Monochrome" );

        private final int value;
        private final String description;

        EdsPhotoEffect( final String description ) {
            value = CanonUtils.classIntField( EdSdkLibrary.EdsPhotoEffect.class, name() );
            this.description = description;
        }

        @Override
        public final Integer value() {
            return value;
        }

        @Override
        public final String description() {
            return description;
        }

        public static final EdsPhotoEffect enumOfName( final String name ) {
            return (EdsPhotoEffect) CanonConstants.enumOfName( EdsPhotoEffect.class, name );
        }

        public static final EdsPhotoEffect enumOfValue( final int value ) {
            return (EdsPhotoEffect) CanonConstants.enumOfValue( EdsPhotoEffect.class, value );
        }

        public static final EdsPhotoEffect enumOfDescription( final String description ) {
            return (EdsPhotoEffect) CanonConstants.enumOfDescription( EdsPhotoEffect.class, description );
        }
    }

/*-----------------------------------------------------------------------------
 Color Matrix
 -----------------------------------------------------------------------------*/
    public enum EdsColorMatrix implements DescriptiveEnum {
        kEdsColorMatrix_Custom( "Custom" ),
        kEdsColorMatrix_1( "ColorMatrix1" ),
        kEdsColorMatrix_2( "ColorMatrix2" ),
        kEdsColorMatrix_3( "ColorMatrix3" ),
        kEdsColorMatrix_4( "ColorMatrix4" ),
        kEdsColorMatrix_5( "ColorMatrix5" ),
        kEdsColorMatrix_6( "ColorMatrix6" ),
        kEdsColorMatrix_7( "ColorMatrix7" );

        private final int value;
        private final String description;

        EdsColorMatrix( final String description ) {
            value = CanonUtils.classIntField( EdSdkLibrary.EdsColorMatrix.class, name() );
            this.description = description;
        }

        @Override
        public final Integer value() {
            return value;
        }

        @Override
        public final String description() {
            return description;
        }

        public static final EdsColorMatrix enumOfName( final String name ) {
            return (EdsColorMatrix) CanonConstants.enumOfName( EdsColorMatrix.class, name );
        }

        public static final EdsColorMatrix enumOfValue( final int value ) {
            return (EdsColorMatrix) CanonConstants.enumOfValue( EdsColorMatrix.class, value );
        }

        public static final EdsColorMatrix enumOfDescription( final String description ) {
            return (EdsColorMatrix) CanonConstants.enumOfDescription( EdsColorMatrix.class, description );
        }
    }

/*-----------------------------------------------------------------------------
 Filter Effects
 -----------------------------------------------------------------------------*/
    public enum EdsFilterEffect implements DescriptiveEnum {
        kEdsFilterEffect_None( "None" ),
        kEdsFilterEffect_Yellow( "Yellow" ),
        kEdsFilterEffect_Orange( "Orange" ),
        kEdsFilterEffect_Red( "Red" ),
        kEdsFilterEffect_Green( "Green" );

        private final int value;
        private final String description;

        EdsFilterEffect( final String description ) {
            value = CanonUtils.classIntField( EdSdkLibrary.EdsFilterEffect.class, name() );
            this.description = description;
        }

        @Override
        public final Integer value() {
            return value;
        public final String description() {
            return description;
        }

        public static final EdsFilterEffect enumOfName( final String name ) {
            return (EdsFilterEffect) CanonConstants.enumOfName( EdsFilterEffect.class, name );
        }

        public static final EdsFilterEffect enumOfValue( final int value ) {
            return (EdsFilterEffect) CanonConstants.enumOfValue( EdsFilterEffect.class, value );
        }

        public static final EdsFilterEffect enumOfDescription( final String description ) {
            return (EdsFilterEffect) CanonConstants.enumOfDescription( EdsFilterEffect.class, description );
        }
    }

/*-----------------------------------------------------------------------------
 Toning Effects
 -----------------------------------------------------------------------------*/
    public enum EdsTonigEffect implements DescriptiveEnum {
        kEdsTonigEffect_None( "None" ),
        kEdsTonigEffect_Sepia( "Sepia" ),
        kEdsTonigEffect_Blue( "Blue" ),
        kEdsTonigEffect_Purple( "Purple" ),
        kEdsTonigEffect_Green( "Green" );

        private final int value;
        private final String description;

        EdsTonigEffect( final String description ) {
            value = CanonUtils.classIntField( EdSdkLibrary.EdsTonigEffect.class, name() );
            this.description = description;
        }

        @Override
        public final Integer value() {
            return value;
        }

        @Override
        public final String description() {
            return description;
        }

        public static final EdsTonigEffect enumOfName( final String name ) {
            return (EdsTonigEffect) CanonConstants.enumOfName( EdsTonigEffect.class, name );
        }

        public static final EdsTonigEffect enumOfValue( final int value ) {
            return (EdsTonigEffect) CanonConstants.enumOfValue( EdsTonigEffect.class, value );
        }

        public static final EdsTonigEffect enumOfDescription( final String description ) {
            return (EdsTonigEffect) CanonConstants.enumOfDescription( EdsTonigEffect.class, description );
        }
    }

/*-----------------------------------------------------------------------------
 Color Space
 -----------------------------------------------------------------------------*/
    public enum EdsColorSpace implements DescriptiveEnum {
        kEdsColorSpace_sRGB( "sRGB" ),
        kEdsColorSpace_AdobeRGB( "AdobeRGB" ),
        kEdsColorSpace_Unknown( "Unknown" );

        private final int value;
        private final String description;

        EdsColorSpace( final String description ) {
            value = CanonUtils.classIntField( EdSdkLibrary.EdsColorSpace.class, name() );
            this.description = description;
        }

        @Override
        public final Integer value() {
            return value;
        }

        @Override
        public final String description() {
            return description;
        }

        public static final EdsColorSpace enumOfName( final String name ) {
            return (EdsColorSpace) CanonConstants.enumOfName( EdsColorSpace.class, name );
        }

        public static final EdsColorSpace enumOfValue( final int value ) {
            return (EdsColorSpace) CanonConstants.enumOfValue( EdsColorSpace.class, value );
        }

        public static final EdsColorSpace enumOfDescription( final String description ) {
            return (EdsColorSpace) CanonConstants.enumOfDescription( EdsColorSpace.class, description );
/*-----------------------------------------------------------------------------
 PictureStyle
 -----------------------------------------------------------------------------*/
    public enum EdsPictureStyle implements DescriptiveEnum {
        kEdsPictureStyle_Standard( "Standard" ),
        kEdsPictureStyle_Portrait( "Portrait" ),
        kEdsPictureStyle_Landscape( "Landscape" ),
        kEdsPictureStyle_Neutral( "Neutral" ),
        kEdsPictureStyle_Faithful( "Faithful" ),
        kEdsPictureStyle_Monochrome( "Monochrome" ),
        kEdsPictureStyle_Auto( "Auto" ),
        kEdsPictureStyle_User1( "User 1" ),
        kEdsPictureStyle_User2( "User 2" ),
        kEdsPictureStyle_User3( "User 3" ),
        kEdsPictureStyle_PC1( "Computer 1" ),
        kEdsPictureStyle_PC2( "Computer 2" ),
        kEdsPictureStyle_PC3( "Computer 3" );

        private final int value;
        private final String description;

        EdsPictureStyle( final String description ) {
            value = CanonUtils.classIntField( EdSdkLibrary.EdsPictureStyle.class, name() );
            this.description = description;
        }

        @Override
        public final Integer value() {
            return value;
        }

        @Override
        public final String description() {
            return description;
        }

        public static final EdsPictureStyle enumOfName( final String name ) {
            return (EdsPictureStyle) CanonConstants.enumOfName( EdsPictureStyle.class, name );
        }

        public static final EdsPictureStyle enumOfValue( final int value ) {
            return (EdsPictureStyle) CanonConstants.enumOfValue( EdsPictureStyle.class, value );
        }

        public static final EdsPictureStyle enumOfDescription( final String description ) {
            return (EdsPictureStyle) CanonConstants.enumOfDescription( EdsPictureStyle.class, description );
        }
    }

/*-----------------------------------------------------------------------------
 Transfer Option
 -----------------------------------------------------------------------------*/
    public enum EdsTransferOption implements DescriptiveEnum {
        kEdsTransferOption_ByDirectTransfer( "By Direct Transfer" ),
        kEdsTransferOption_ByRelease( "By Release" ),
        kEdsTransferOption_ToDesktop( "To Desktop" );

        private final int value;
        private final String description;

        EdsTransferOption( final String description ) {
            value = CanonUtils.classIntField( EdSdkLibrary.EdsTransferOption.class, name() );
            this.description = description;
        }

        @Override
        public final Integer value() {
            return value;
        }

        @Override
        public final String description() {
            return description;
        }

        public static final EdsTransferOption enumOfName( final String name ) {
            return (EdsTransferOption) CanonConstants.enumOfName( EdsTransferOption.class, name );
        }

        public static final EdsTransferOption enumOfValue( final int value ) {
            return (EdsTransferOption) CanonConstants.enumOfValue( EdsTransferOption.class, value );
        }

        public static final EdsTransferOption enumOfDescription( final String description ) {
            return (EdsTransferOption) CanonConstants.enumOfDescription( EdsTransferOption.class, description );
        }
    }

/*-----------------------------------------------------------------------------
 Shooting Mode
 -----------------------------------------------------------------------------*/
    public enum EdsAEMode implements DescriptiveEnum {
        kEdsAEMode_Program( "Program AE" ),
        kEdsAEMode_Tv( "Shutter-Speed Priority AE" ),
        kEdsAEMode_Av( "Aperture Priority AE" ),
        kEdsAEMode_Manual( "Manual Exposure" ),
        kEdsAEMode_Bulb( "Bulb" ),
        kEdsAEMode_A_DEP( "Auto Depth-of-Field AE" ),
        kEdsAEMode_DEP( "Depth-of-Field AE" ),
        kEdsAEMode_Custom( "Camera settings registered" ),
        kEdsAEMode_Lock( "Lock" ),
        kEdsAEMode_Green( "Auto" ),
        kEdsAEMode_NightPortrait( "Night Scene Portrait" ),
        kEdsAEMode_Sports( "Sports" ),
        kEdsAEMode_Portrait( "Portrait" ),
        kEdsAEMode_Landscape( "Landscape" ),
        kEdsAEMode_Closeup( "Close-Up" ),
        kEdsAEMode_FlashOff( "Flash Off" ),
        kEdsAEMode_CreativeAuto( "Creative Auto" ),
        kEdsAEMode_Movie( "Movie" ),
        kEdsAEMode_PhotoInMovie( "Photo In Movie" ),
        //kEdsAEMode_SceneIntelligentAuto( "Scene Intelligent Auto" ), // in EDSDK 2.11.3 (or earlier), removed EDSDK <= 2.13.2
        kEdsAEMode_Unknown( "Unknown" );

        private final int value;
        private final String description;

        EdsAEMode( final String description ) {
            value = CanonUtils.classIntField( EdSdkLibrary.EdsAEMode.class, name() );
            this.description = description;
        }

        @Override
        public final Integer value() {
            return value;
        }

        @Override
        public final String description() {
            return description;
        }

        public static final EdsAEMode enumOfName( final String name ) {
            return (EdsAEMode) CanonConstants.enumOfName( EdsAEMode.class, name );
        }

        public static final EdsAEMode enumOfValue( final int value ) {
            return (EdsAEMode) CanonConstants.enumOfValue( EdsAEMode.class, value );
        }

        public static final EdsAEMode enumOfDescription( final String description ) {
            return (EdsAEMode) CanonConstants.enumOfDescription( EdsAEMode.class, description );
        }
    }

/*-----------------------------------------------------------------------------
 Bracket
 -----------------------------------------------------------------------------*/
    public enum EdsBracket implements DescriptiveEnum {
        kEdsBracket_AEB( "AE" ),
        kEdsBracket_ISOB( "ISO" ),
        kEdsBracket_WBB( "WB" ),
        kEdsBracket_FEB( "FE" ),
        kEdsBracket_Unknown( "Off" );

        private final int value;
        private final String description;

        EdsBracket( final String description ) {
            value = CanonUtils.classIntField( EdSdkLibrary.EdsBracket.class, name() );
            this.description = description;
        }

        @Override
        public final Integer value() {
            return value;
        }

        @Override
        public final String description() {
            return description;
        }

        public static final EdsBracket enumOfName( final String name ) {
            return (EdsBracket) CanonConstants.enumOfName( EdsBracket.class, name );
        }

        public static final EdsBracket enumOfValue( final int value ) {
            return (EdsBracket) CanonConstants.enumOfValue( EdsBracket.class, value );
        }

        public static final EdsBracket enumOfDescription( final String description ) {
            return (EdsBracket) CanonConstants.enumOfDescription( EdsBracket.class, description );
        }
    }

/*-----------------------------------------------------------------------------
 EVF Output Device [Flag]
 -----------------------------------------------------------------------------*/
    public enum EdsEvfOutputDevice implements DescriptiveEnum {
        kEdsEvfOutputDevice_TFT( "Camera" ),
        kEdsEvfOutputDevice_PC( "Host Computer" );

        private final int value;
        private final String description;

        EdsEvfOutputDevice( final String description ) {
            value = CanonUtils.classIntField( EdSdkLibrary.EdsEvfOutputDevice.class, name() );
            this.description = description;
        }

        @Override
        public final Integer value() {
            return value;
        }

        @Override
        public final String description() {
            return description;
        }

        public static final EdsEvfOutputDevice enumOfName( final String name ) {
            return (EdsEvfOutputDevice) CanonConstants.enumOfName( EdsEvfOutputDevice.class, name );
        }

        public static final EdsEvfOutputDevice enumOfValue( final int value ) {
            return (EdsEvfOutputDevice) CanonConstants.enumOfValue( EdsEvfOutputDevice.class, value );
        }

        public static final EdsEvfOutputDevice enumOfDescription( final String description ) {
            return (EdsEvfOutputDevice) CanonConstants.enumOfDescription( EdsEvfOutputDevice.class, description );
        }
    }

/*-----------------------------------------------------------------------------
 EVF Zoom
 -----------------------------------------------------------------------------*/
    public enum EdsEvfZoom implements DescriptiveEnum {
        kEdsEvfZoom_Fit( "Fit Screen" ),
        kEdsEvfZoom_x5( "5 times" ),
        kEdsEvfZoom_x10( "10 times" );

        private final int value;
        private final String description;

        EdsEvfZoom( final String description ) {
            value = CanonUtils.classIntField( EdSdkLibrary.EdsEvfZoom.class, name() );
            this.description = description;
        }

        @Override
        public final Integer value() {
            return value;
        }

        @Override
        public final String description() {
            return description;
        }

        public static final EdsEvfZoom enumOfName( final String name ) {
            return (EdsEvfZoom) CanonConstants.enumOfName( EdsEvfZoom.class, name );
        }

        public static final EdsEvfZoom enumOfValue( final int value ) {
            return (EdsEvfZoom) CanonConstants.enumOfValue( EdsEvfZoom.class, value );
        }

        public static final EdsEvfZoom enumOfDescription( final String description ) {
            return (EdsEvfZoom) CanonConstants.enumOfDescription( EdsEvfZoom.class, description );
        }
    }

/*-----------------------------------------------------------------------------
 EVF AF Mode
 -----------------------------------------------------------------------------*/
    public enum EdsEvfAFMode implements DescriptiveEnum {
        Evf_AFMode_Quick( "Quick" ),
        Evf_AFMode_Live( "Live" ),
        Evf_AFMode_LiveFace( "Live Face" );

        private final int value;
        private final String description;

        EdsEvfAFMode( final String description ) {
            value = CanonUtils.classIntField( EdSdkLibrary.EdsEvfAFMode.class, name() );
            this.description = description;
        }

        @Override
        public final Integer value() {
            return value;
        }
        public final String description() {
            return description;
        }

        public static final EdsEvfAFMode enumOfName( final String name ) {
            return (EdsEvfAFMode) CanonConstants.enumOfName( EdsEvfAFMode.class, name );
        }

        public static final EdsEvfAFMode enumOfValue( final int value ) {
            return (EdsEvfAFMode) CanonConstants.enumOfValue( EdsEvfAFMode.class, value );
        }

        public static final EdsEvfAFMode enumOfDescription( final String description ) {
            return (EdsEvfAFMode) CanonConstants.enumOfDescription( EdsEvfAFMode.class, description );
        }
    }

/*-----------------------------------------------------------------------------
 Strobo Mode
 -----------------------------------------------------------------------------*/
    public enum EdsStroboMode implements DescriptiveEnum {
        kEdsStroboModeInternal( "Internal" ),
        kEdsStroboModeExternalETTL( "External ETTL" ),
        kEdsStroboModeExternalATTL( "External ATTL" ),
        kEdsStroboModeExternalTTL( "External TTL" ),
        kEdsStroboModeExternalAuto( "External Auto" ),
        kEdsStroboModeExternalManual( "External Manual" ),
        kEdsStroboModeManual( "Manual" );

        private final int value;
        private final String description;

        EdsStroboMode( final String description ) {
            value = CanonUtils.classIntField( EdSdkLibrary.EdsStroboMode.class, name() );
            this.description = description;
        }

        @Override
        public final Integer value() {
            return value;
        }

        @Override
        public final String description() {
            return description;
        }

        public static final EdsStroboMode enumOfName( final String name ) {
            return (EdsStroboMode) CanonConstants.enumOfName( EdsStroboMode.class, name );
        }

        public static final EdsStroboMode enumOfValue( final int value ) {
            return (EdsStroboMode) CanonConstants.enumOfValue( EdsStroboMode.class, value );
        }

        public static final EdsStroboMode enumOfDescription( final String description ) {
            return (EdsStroboMode) CanonConstants.enumOfDescription( EdsStroboMode.class, description );
        }
    }

/*-----------------------------------------------------------------------------
 ETTL-II Mode
 -----------------------------------------------------------------------------*/
    public enum EdsETTL2Mode implements DescriptiveEnum {
        kEdsETTL2ModeEvaluative( "Evaluative" ),
        kEdsETTL2ModeAverage( "Average" );

        private final int value;
        private final String description;

        EdsETTL2Mode( final String description ) {
            value = CanonUtils.classIntField( EdSdkLibrary.EdsETTL2Mode.class, name() );
            this.description = description;
        }

        @Override
        public final Integer value() {
            return value;
        }

        @Override
        public final String description() {
            return description;
        }

        public static final EdsETTL2Mode enumOfName( final String name ) {
            return (EdsETTL2Mode) CanonConstants.enumOfName( EdsETTL2Mode.class, name );
        }

        public static final EdsETTL2Mode enumOfValue( final int value ) {
            return (EdsETTL2Mode) CanonConstants.enumOfValue( EdsETTL2Mode.class, value );
        }

        public static final EdsETTL2Mode enumOfDescription( final String description ) {
            return (EdsETTL2Mode) CanonConstants.enumOfDescription( EdsETTL2Mode.class, description );
        }
    }

}
File
CanonConstants.java
Developer's decision
Version 1
Kind of conflict
Attribute
Class signature
Comment
Enum declaration
Import
Interface declaration
Interface signature
Method declaration
Method invocation
Static initializer
Chunk
Conflicting content
import java.io.ByteArrayInputStream;
import java.io.File;
import java.io.IOException;
<<<<<<< HEAD
import java.nio.IntBuffer;
=======
import java.lang.reflect.Field;
import java.nio.ByteBuffer;
import java.util.HashMap;
import java.util.LinkedHashMap;
>>>>>>> a0560a3efd37b3c0f25a1a05cff3f3a3c019985b

import javax.imageio.ImageIO;
Solution content
import java.io.ByteArrayInputStream;
import java.io.File;
import java.io.IOException;
import java.nio.IntBuffer;

import javax.imageio.ImageIO;
File
CanonUtils.java
Developer's decision
Version 1
Kind of conflict
Import
Chunk
Conflicting content
import edsdk.utils.CanonConstants.EdsAEMode;
import com.sun.jna.ptr.PointerByReference;

import edsdk.api.CanonCamera;
<<<<<<< HEAD
import edsdk.bindings.EdSdkLibrary.EdsBaseRef;
import edsdk.bindings.EdSdkLibrary.EdsCameraRef;
import edsdk.bindings.EdSdkLibrary.EdsDirectoryItemRef;
import edsdk.bindings.EdSdkLibrary.EdsEvfImageRef;
import edsdk.bindings.EdSdkLibrary.EdsStreamRef;
import edsdk.bindings.EdsCapacity;
import edsdk.bindings.EdsDirectoryItemInfo;
import edsdk.bindings.EdsFocusInfo;
import edsdk.bindings.EdsPictureStyleDesc;
import edsdk.bindings.EdsPoint;
import edsdk.bindings.EdsPropertyDesc;
import edsdk.bindings.EdsRational;
import edsdk.bindings.EdsRect;
import edsdk.bindings.EdsTime;
import edsdk.utils.CanonConstants.DescriptiveEnum;
import edsdk.utils.CanonConstants.EdsAFMode;
import edsdk.utils.CanonConstants.EdsAccess;
import edsdk.utils.CanonConstants.EdsAv;
import edsdk.utils.CanonConstants.EdsColorSpace;
import edsdk.utils.CanonConstants.EdsCustomFunction;
import edsdk.utils.CanonConstants.EdsDataType;
import edsdk.utils.CanonConstants.EdsDriveMode;
import edsdk.utils.CanonConstants.EdsError;
import edsdk.utils.CanonConstants.EdsEvfAFMode;
import edsdk.utils.CanonConstants.EdsEvfOutputDevice;
import edsdk.utils.CanonConstants.EdsExposureCompensation;
import edsdk.utils.CanonConstants.EdsFileCreateDisposition;
import edsdk.utils.CanonConstants.EdsISOSpeed;
import edsdk.utils.CanonConstants.EdsImageQuality;
import edsdk.utils.CanonConstants.EdsMeteringMode;
import edsdk.utils.CanonConstants.EdsPictureStyle;
import edsdk.utils.CanonConstants.EdsPropertyID;
import edsdk.utils.CanonConstants.EdsTv;
import edsdk.utils.CanonConstants.EdsWhiteBalance;
=======
import edsdk.bindings.EdSdkLibrary;
import edsdk.bindings.EdsDirectoryItemInfo;
import edsdk.bindings.EdSdkLibrary.EdsVoid;
import edsdk.bindings.EdSdkLibrary.__EdsObject;
import edsdk.bindings.EdsPropertyDesc;
>>>>>>> a0560a3efd37b3c0f25a1a05cff3f3a3c019985b

/**
 * Here are some great helpers.
Solution content
import com.sun.jna.ptr.PointerByReference;

import edsdk.api.CanonCamera;
import edsdk.bindings.EdSdkLibrary.EdsBaseRef;
import edsdk.bindings.EdSdkLibrary.EdsCameraRef;
import edsdk.bindings.EdSdkLibrary.EdsDirectoryItemRef;
import edsdk.bindings.EdSdkLibrary.EdsEvfImageRef;
import edsdk.bindings.EdSdkLibrary.EdsStreamRef;
import edsdk.bindings.EdsCapacity;
import edsdk.bindings.EdsDirectoryItemInfo;
import edsdk.bindings.EdsFocusInfo;
import edsdk.bindings.EdsPictureStyleDesc;
import edsdk.bindings.EdsPoint;
import edsdk.bindings.EdsPropertyDesc;
import edsdk.bindings.EdsRational;
import edsdk.bindings.EdsRect;
import edsdk.bindings.EdsTime;
import edsdk.utils.CanonConstants.DescriptiveEnum;
import edsdk.utils.CanonConstants.EdsAEMode;
import edsdk.utils.CanonConstants.EdsAFMode;
import edsdk.utils.CanonConstants.EdsAccess;
import edsdk.utils.CanonConstants.EdsAv;
import edsdk.utils.CanonConstants.EdsColorSpace;
import edsdk.utils.CanonConstants.EdsCustomFunction;
import edsdk.utils.CanonConstants.EdsDataType;
import edsdk.utils.CanonConstants.EdsDriveMode;
import edsdk.utils.CanonConstants.EdsError;
import edsdk.utils.CanonConstants.EdsEvfAFMode;
import edsdk.utils.CanonConstants.EdsEvfOutputDevice;
import edsdk.utils.CanonConstants.EdsExposureCompensation;
import edsdk.utils.CanonConstants.EdsFileCreateDisposition;
import edsdk.utils.CanonConstants.EdsISOSpeed;
import edsdk.utils.CanonConstants.EdsImageQuality;
import edsdk.utils.CanonConstants.EdsMeteringMode;
import edsdk.utils.CanonConstants.EdsPictureStyle;
import edsdk.utils.CanonConstants.EdsPropertyID;
import edsdk.utils.CanonConstants.EdsTv;
import edsdk.utils.CanonConstants.EdsWhiteBalance;

/**
 * Here are some great helpers.
File
CanonUtils.java
Developer's decision
Version 1
Kind of conflict
Import
Chunk
Conflicting content
 * a CanonCommand and then send them to the camera, like so for instance :
 * 
 * 
<<<<<<< HEAD
 * canonCamera.executeNow( new CanonCommand() {
 *     public void run(){
 *         CanonUtils.doSomethingLikeDownloadOrWhatever();
 *     }
 * }
 * 
* * Copyright © 2014 Hansi Raber , Ananta Palani * ======= * canonCamera.executeNow( new CanonTask(){ * public void run(){ * CanonUtils.doSomethingLikeDownloadOrWhatever(); * } * } *
* * Copyright © 2014 Hansi Raber >>>>>>> a0560a3efd37b3c0f25a1a05cff3f3a3c019985b * This work is free. You can redistribute it and/or modify it under the * terms of the Do What The Fuck You Want To Public License, Version 2, * as published by Sam Hocevar. See the COPYING file for more details.
Solution content
 * a CanonCommand and then send them to the camera, like so for instance :
 * 
 * 
 * canonCamera.executeNow( new CanonCommand() {
 *     public void run(){
 *         CanonUtils.doSomethingLikeDownloadOrWhatever();
 *     }
 * }
 * 
* * Copyright © 2014 Hansi Raber , Ananta Palani * * This work is free. You can redistribute it and/or modify it under the * terms of the Do What The Fuck You Want To Public License, Version 2, * as published by Sam Hocevar. See the COPYING file for more details.
File
CanonUtils.java
Developer's decision
Version 1
Kind of conflict
Comment
Chunk
Conflicting content
 * as published by Sam Hocevar. See the COPYING file for more details.
 * 
 * @author hansi
<<<<<<< HEAD
 * @author Ananta Palani
 * 
=======
>>>>>>> a0560a3efd37b3c0f25a1a05cff3f3a3c019985b
 */
// TODO: think about having CanonUtils handle state/property changes to handle cases described by CanonUtils.isLiveViewEnabled()
public class CanonUtils {
Solution content
 * as published by Sam Hocevar. See the COPYING file for more details.
 * 
 * @author hansi
 * @author Ananta Palani
 * 
 */
// TODO: think about having CanonUtils handle state/property changes to handle cases described by CanonUtils.isLiveViewEnabled()
public class CanonUtils {
File
CanonUtils.java
Developer's decision
Version 1
Kind of conflict
Comment
Chunk
Conflicting content
 */
			}
			).intValue();
		}
// TODO: think about having CanonUtils handle state/property changes to handle cases described by CanonUtils.isLiveViewEnabled()
public class CanonUtils {
<<<<<<< HEAD

    public static final int classIntField( final Class klass,
                                           final String fieldName ) {
        Throwable t = null;
        try {
            final int value = klass.getField( fieldName ).getInt( null );
            return value;
        }
        catch ( final IllegalArgumentException e ) {
            t = e;
        }
        catch ( final IllegalAccessException e ) {
            t = e;
        }
        catch ( final NoSuchFieldException e ) {
            t = e;
        }
        catch ( final SecurityException e ) {
            t = e;
        }
        throw new IllegalArgumentException( klass.getCanonicalName() +
                                            " does not contain field " +
                                            fieldName, t );
    }

    /**
     * Finds the filename for a directory item
     * 
     * @param directoryItem The item you want to download
     * @return Either null, or the filename of the item
     */
    public static EdsDirectoryItemInfo getDirectoryItemInfo( final EdsDirectoryItemRef directoryItem ) {
        EdsError err = EdsError.EDS_ERR_OK;
        final EdsDirectoryItemInfo dirItemInfo = new EdsDirectoryItemInfo();

        try {
            err = CanonUtils.toEdsError( CanonCamera.EDSDK.EdsGetDirectoryItemInfo( directoryItem, dirItemInfo ) );
        }
        catch ( final Exception e ) {
            e.printStackTrace();
        }

        return err == EdsError.EDS_ERR_OK ? dirItemInfo : null;
    }

    /**
     * Downloads an image and saves it somewhere.
     * 
     * @param directoryItem The item you want to download
     * @param destination A path in the filesystem where you want to save the
     *            file. Can also be null or a directory. In case of null the
     *            temp directory will be used, in case of a directory the file
     *            name of the item will be used.
     * @param appendFileExtension Adds the extension of the photo onto File to
     *            ensure that supplied File name extension matches the image
     *            being downloaded from the camera. This is especially important
     *            if the camera is set to RAW+JPEG where the order of the images
     *            is not consistent.
     * @return Either null, or the location the file was ultimately saved to on
     *         success.
     */
    public static File download( final EdsDirectoryItemRef directoryItem,
                                 File destination,
                                 final boolean appendFileExtension ) {
        EdsError err = EdsError.EDS_ERR_OK;
        final EdsStreamRef.ByReference stream = new EdsStreamRef.ByReference();
        final EdsDirectoryItemInfo dirItemInfo = new EdsDirectoryItemInfo();

        boolean success = false;

        //final long timeStart = System.currentTimeMillis();

        try {
            err = CanonUtils.toEdsError( CanonCamera.EDSDK.EdsGetDirectoryItemInfo( directoryItem, dirItemInfo ) );
            if ( err == EdsError.EDS_ERR_OK ) {
                if ( destination == null ) {
                    destination = new File( System.getProperty( "java.io.tmpdir" ) );
                }
                if ( destination.isDirectory() ) {
                    destination = new File( destination, Native.toString( dirItemInfo.szFileName ) );
                } else if ( appendFileExtension ) {
                    final String sourceFileName = Native.toString( dirItemInfo.szFileName );
                    final int i = sourceFileName.lastIndexOf( "." );
                    if ( i > 0 ) {
                        final String extension = sourceFileName.substring( i );

                        if ( !destination.getName().toLowerCase().endsWith( extension ) ) {
                            destination = new File( destination.getPath() +
                                                    extension );
                        }
                    }
                }

                if ( destination.getParentFile() != null ) {
                    destination.getParentFile().mkdirs();
                }

                /*
                 * System.out.println( "Downloading image " +
                 * Native.toString( dirItemInfo.szFileName ) +
                 * " to " + destination.getCanonicalPath() );
                 */

                // TODO: see if using an EdsCreateMemoryStream would be faster and whether the image could be read directly without saving to file first - see: http://stackoverflow.com/questions/1083446/canon-edsdk-memorystream-image
                err = CanonUtils.toEdsError( CanonCamera.EDSDK.EdsCreateFileStream( Native.toByteArray( destination.getCanonicalPath() ), EdsFileCreateDisposition.kEdsFileCreateDisposition_CreateAlways.value(), EdsAccess.kEdsAccess_ReadWrite.value(), stream ) );
            }

            if ( err == EdsError.EDS_ERR_OK ) {
                err = CanonUtils.toEdsError( CanonCamera.EDSDK.EdsDownload( directoryItem, dirItemInfo.size, stream.getValue() ) );
            }

            if ( err == EdsError.EDS_ERR_OK ) {
                /*
                 * System.out.println( "Image downloaded in " +
                 * ( System.currentTimeMillis() - timeStart ) +
                 * " ms" );
                 */

                err = CanonUtils.toEdsError( CanonCamera.EDSDK.EdsDownloadComplete( directoryItem ) );

                success = true;
            }

            if ( stream != null ) {
                CanonCamera.EDSDK.EdsRelease( stream.getValue() );
            }
        }
        catch ( final Exception e ) {
            e.printStackTrace();
        }

        return success ? destination : null;
    }

    public static EdsError setPropertyData( final EdsBaseRef ref,
                                            final EdsPropertyID property,
                                            final DescriptiveEnum value ) {
        return CanonUtils.setPropertyDataAdvanced( ref, property, 0, value.value().longValue() );
    }

    public static EdsError setPropertyData( final EdsBaseRef ref,
                                            final EdsPropertyID property,
                                            final long param,
                                            final DescriptiveEnum value ) {
        return CanonUtils.setPropertyDataAdvanced( ref, property, param, value.value().longValue() );
    }

    public static EdsError setPropertyData( final EdsBaseRef ref,
                                            final EdsPropertyID property,
                                            final long value ) {
        return CanonUtils.setPropertyDataAdvanced( ref, property, 0, value );
    }

    public static EdsError setPropertyData( final EdsBaseRef ref,
                                            final EdsPropertyID property,
                                            final long param, final long value ) {
        return CanonUtils.setPropertyDataAdvanced( ref, property, param, value );
    }

    public static EdsError setPropertyData( final EdsBaseRef ref,
                                            final EdsPropertyID property,
                                            final long param, final int size,
                                            final Pointer data ) {
        return CanonUtils.toEdsError( CanonCamera.EDSDK.EdsSetPropertyData( ref, new NativeLong( property.value() ), new NativeLong( param ), new NativeLong( size ), data ) );
    }

    public static EdsError setPropertyDataAdvanced( final EdsBaseRef ref,
                                                    final EdsPropertyID property,
                                                    final Object value ) {
        return CanonUtils.setPropertyDataAdvanced( ref, property, 0, value );
    }

    /**
     * Only use this if you know that the type of the property you input is
     * compatible with the value you supply.
     * 
     * @param ref Camera/image/live view reference
     * @param property Property to get from the camera
     * @param param See EDSDK API
     * @return
     * @throws IllegalStateException
     */
    //TODO: this method isn't very safe to leave public, perhaps some setPropertyData[String/UInt32/etc.] methods would be better
    public static EdsError setPropertyDataAdvanced( final EdsBaseRef ref,
                                                    final EdsPropertyID property,
                                                    final long param,
                                                    final Object value ) throws IllegalStateException {

        final EdsDataType type = CanonUtils.getPropertyType( ref, property, param );

        final Pointer pointer;
        final int size;

        switch ( type ) {
            case kEdsDataType_String: { //EdsChar[]
                final String string = (String) value;
                size = string.length() + 1;
                pointer = new Memory( size );
                pointer.setString( 0, string );
                break;
            }
            case kEdsDataType_Int8: //EdsInt8
            case kEdsDataType_UInt8: { //EdsUInt8
                size = 1;
                pointer = new Memory( size );
                pointer.setByte( 0, (Byte) value );
                break;
            }
            case kEdsDataType_Int16: //EdsInt16
            case kEdsDataType_UInt16: { //EdsUInt16
                size = 2;
                pointer = new Memory( size );
                pointer.setShort( 0, (Short) value );
                break;
            }
            case kEdsDataType_Int32: //EdsInt32
            case kEdsDataType_UInt32: { //EdsUInt32
                size = 4;
                pointer = new Memory( size );
                pointer.setNativeLong( 0, new NativeLong( (Long) value ) );
                break;
            }
            case kEdsDataType_Int64: //EdsInt64
            case kEdsDataType_UInt64: { //EdsUInt64
                size = 8;
                pointer = new Memory( size );
                pointer.setLong( 0, (Long) value );
                break;
            }
            case kEdsDataType_Float: { //EdsFloat
                size = 4;
                pointer = new Memory( size );
                pointer.setFloat( 0, (Float) value );
                break;
            }
            case kEdsDataType_Double: { //EdsDouble
                size = 8;
                pointer = new Memory( size );
                pointer.setDouble( 0, (Double) value );
                break;
            }
            case kEdsDataType_ByteBlock: { //Byte Block // TODO: According to API, is either EdsInt8[] or EdsUInt32[], but perhaps former is a typo or an old value
                final int[] array = (int[]) value;
                size = 4 * array.length;
                pointer = new Memory( size );
                pointer.write( 0, array, 0, array.length );
                break;
            }
            case kEdsDataType_Rational: //EdsRational
            case kEdsDataType_Point: //EdsPoint
            case kEdsDataType_Rect: //EdsRect
            case kEdsDataType_Time: //EdsTime
            case kEdsDataType_FocusInfo: //EdsFocusInfo
            case kEdsDataType_PictureStyleDesc: { //EdsPictureStyleDesc
                final Structure structure = (Structure) value;
                structure.write();
                pointer = structure.getPointer();
                size = structure.size();
                break;
            }
            case kEdsDataType_Int8_Array: //EdsInt8[]
            case kEdsDataType_UInt8_Array: { //EdsUInt8[]
                final byte[] array = (byte[]) value;
                size = array.length;
                pointer = new Memory( size );
                pointer.write( 0, array, 0, array.length );
                break;
            }
            case kEdsDataType_Int16_Array: //EdsInt16[]
            case kEdsDataType_UInt16_Array: { //EdsUInt16[]
                final short[] array = (short[]) value;
                size = 2 * array.length;
                pointer = new Memory( size );
                pointer.write( 0, array, 0, array.length );
                break;
            }
            case kEdsDataType_Int32_Array: //EdsInt32[]
            case kEdsDataType_UInt32_Array: { //EdsUInt32[]
                final int[] array = (int[]) value;
                size = 4 * array.length;
                pointer = new Memory( size );
                pointer.write( 0, array, 0, array.length );
                break;
            }
            case kEdsDataType_Bool: //EdsBool // TODO: implement
            case kEdsDataType_Bool_Array: //EdsBool[] // TODO: implement
            case kEdsDataType_Rational_Array: //EdsRational[] // TODO: implement
            case kEdsDataType_Unknown: //Unknown
            default:
                throw new IllegalStateException( type.description() + " (" +
                                                 type.name() +
                                                 ") is not currently supported by GetPropertyCommand" );
        }
        return CanonUtils.setPropertyData( ref, property, param, size, pointer );
    }

    public static Long getPropertyData( final EdsBaseRef ref,
                                        final EdsPropertyID property ) {
        return CanonUtils.getPropertyDataAdvanced( ref, property, 0 );
    }

    public static Long getPropertyData( final EdsBaseRef ref,
                                        final EdsPropertyID property,
                                        final long param ) {
        return CanonUtils.getPropertyDataAdvanced( ref, property, param );
    }

    public static EdsError getPropertyData( final EdsBaseRef ref,
                                            final EdsPropertyID property,
                                            final long param, final long size,
                                            final Pointer data ) {
        return CanonUtils.toEdsError( CanonCamera.EDSDK.EdsGetPropertyData( ref, new NativeLong( property.value() ), new NativeLong( param ), new NativeLong( size ), data ) );
    }

    public static  T getPropertyDataAdvanced( final EdsBaseRef ref,
                                                 final EdsPropertyID property ) {
        return CanonUtils.getPropertyDataAdvanced( ref, property, 0 );
    }

    /**
     * Only use this if you know that the type of the property you input is
     * compatible with the return type assignment you expect.
     * 
     * @param ref Camera/image/live view reference
     * @param property Property to get from the camera
     * @param param See EDSDK API
     * @return
     * @throws IllegalArgumentException
     * @throws IllegalStateException
     */
    //TODO: this method isn't very safe to leave public, perhaps some setPropertyData[String/UInt32/etc.] methods would be better
    @SuppressWarnings( "unchecked" )
    public static  T getPropertyDataAdvanced( final EdsBaseRef ref,
                                                 final EdsPropertyID property,
                                                 final long param ) throws IllegalArgumentException, IllegalStateException {

        final int size = (int) CanonUtils.getPropertySize( ref, property, param );
        final EdsDataType type = CanonUtils.getPropertyType( ref, property, param );

        final Memory memory = new Memory( size > 0 ? size : 1 );

        final EdsError err = CanonUtils.getPropertyData( ref, property, param, size, memory );
        if ( err == EdsError.EDS_ERR_OK ) {
            switch ( type ) {
                case kEdsDataType_Unknown: //Unknown
                    return null;
                case kEdsDataType_String: //EdsChar[]
                    return (T) memory.getString( 0 );
                case kEdsDataType_Int8: //EdsInt8
                case kEdsDataType_UInt8: //EdsUInt8
                    return (T) Byte.valueOf( memory.getByte( 0 ) );
                case kEdsDataType_Int16: //EdsInt16
		}
                case kEdsDataType_UInt16: //EdsUInt16
                    return (T) Short.valueOf( memory.getShort( 0 ) );
                case kEdsDataType_Int32: //EdsInt32
                case kEdsDataType_UInt32: //EdsUInt32
                    return (T) Long.valueOf( memory.getNativeLong( 0 ).longValue() );
                case kEdsDataType_Int64: //EdsInt64
                case kEdsDataType_UInt64: //EdsUInt64
                    return (T) Long.valueOf( memory.getLong( 0 ) );
                case kEdsDataType_Float: //EdsFloat
                    return (T) Float.valueOf( memory.getFloat( 0 ) );
                case kEdsDataType_Double: //EdsDouble
                    return (T) Double.valueOf( memory.getDouble( 0 ) );
                case kEdsDataType_ByteBlock: //Byte Block // TODO: According to API, is either EdsInt8[] or EdsUInt32[], but perhaps former is a typo or an old value
                    return (T) memory.getIntArray( 0, size / 4 );
                case kEdsDataType_Rational: //EdsRational
                    return (T) new EdsRational( memory );
                case kEdsDataType_Point: //EdsPoint
                    return (T) new EdsPoint( memory );
                case kEdsDataType_Rect: //EdsRect
                    return (T) new EdsRect( memory );
                case kEdsDataType_Time: //EdsTime
                    return (T) new EdsTime( memory );
                case kEdsDataType_FocusInfo: //EdsFocusInfo
                    return (T) new EdsFocusInfo( memory );
                case kEdsDataType_PictureStyleDesc: //EdsPictureStyleDesc
                    return (T) new EdsPictureStyleDesc( memory );
                case kEdsDataType_Int8_Array: //EdsInt8[]
                case kEdsDataType_UInt8_Array: //EdsUInt8[]
                    return (T) memory.getByteArray( 0, size );
                case kEdsDataType_Int16_Array: //EdsInt16[]
                case kEdsDataType_UInt16_Array: //EdsUInt16[]
                    return (T) memory.getShortArray( 0, size / 2 );
                case kEdsDataType_Int32_Array: //EdsInt32[]
                case kEdsDataType_UInt32_Array: //EdsUInt32[]
                    return (T) memory.getIntArray( 0, size / 4 );
                case kEdsDataType_Bool: //EdsBool // TODO: implement
                case kEdsDataType_Bool_Array: //EdsBool[] // TODO: implement
                case kEdsDataType_Rational_Array: //EdsRational[] // TODO: implement
                default:
                    throw new IllegalStateException( type.description() + " (" +
                                                     type.name() +
                                                     ") is not currently supported by GetPropertyCommand" );
            }
        }

        throw new IllegalArgumentException( "An error occurred while getting " +
                                            property.name() + " data (error " +
                                            err.value() + ": " + err.name() +
                                            " - " + err.description() + ")" );
    }

    public static EdsDataType getPropertyType( final EdsBaseRef ref,
                                               final EdsPropertyID property ) {
        return CanonUtils.getPropertyType( ref, property, 0 );
    }

    public static EdsDataType getPropertyType( final EdsBaseRef ref,
                                               final EdsPropertyID property,
                                               final long param ) {
        final int bufferSize = 1;
        final IntBuffer type = IntBuffer.allocate( bufferSize );
        final NativeLongByReference number = new NativeLongByReference( new NativeLong( bufferSize ) );
        final EdsError err = CanonUtils.toEdsError( CanonCamera.EDSDK.EdsGetPropertySize( ref, new NativeLong( property.value() ), new NativeLong( param ), type, number ) );
        if ( err == EdsError.EDS_ERR_OK ) {
            final EdsDataType edsDataType = EdsDataType.enumOfValue( type.get( 0 ) );
            if ( edsDataType != null ) {
                //System.out.println( " > property type = " + edsDataType.value() + " : " + edsDataType.name() + " : " + edsDataType.description() );
                return edsDataType;
            }
        }
        // TODO: would it be better to return NULL if EDS_ERR_NOT_SUPPORTED is returned?
        return EdsDataType.kEdsDataType_Unknown;
    }

    public static long getPropertySize( final EdsBaseRef ref,
		
                                        final EdsPropertyID property ) {
        return CanonUtils.getPropertySize( ref, property, 0 );
    }

    public static long getPropertySize( final EdsBaseRef ref,
                                        final EdsPropertyID property,
                                        final long param ) {
        final int bufferSize = 1;
        final IntBuffer type = IntBuffer.allocate( bufferSize );
        final NativeLongByReference number = new NativeLongByReference( new NativeLong( bufferSize ) );
        final EdsError err = CanonUtils.toEdsError( CanonCamera.EDSDK.EdsGetPropertySize( ref, new NativeLong( property.value() ), new NativeLong( param ), type, number ) );
        if ( err == EdsError.EDS_ERR_OK ) {
            //System.out.println( "> property size = " + number.getValue().longValue() );
            return number.getValue().longValue();
        }
        return -1;
    }

    /**
     * Returns an array of DescriptiveEnum values for a given EdsPropertyID
     * enum. Some of the EdsPropertyID enums that this function is known to
     * support are listed in the EDSDK documentation, others were obtained by
     * trial-and-error. Note that not all EdsPropertyID values are supported in
     * all camera modes or with all models.
     * 
     * @param camera The camera to get the available property settings of
     * @param property
     *            {@link edsdk.utils.CanonConstants.EdsPropertyID#kEdsPropID_DriveMode
     *            kEdsPropID_DriveMode}
     *            {@link edsdk.utils.CanonConstants.EdsPropertyID#kEdsPropID_ISOSpeed
     *            kEdsPropID_ISOSpeed},
     *            {@link edsdk.utils.CanonConstants.EdsPropertyID#kEdsPropID_MeteringMode
     *            kEdsPropID_MeteringMode},
     *            {@link edsdk.utils.CanonConstants.EdsPropertyID#kEdsPropID_AFMode
     *            kEdsPropID_AFMode},
     *            {@link edsdk.utils.CanonConstants.EdsPropertyID#kEdsPropID_Av
     *            kEdsPropID_Av},
     *            {@link edsdk.utils.CanonConstants.EdsPropertyID#kEdsPropID_Tv
     *            kEdsPropID_Tv},
     *            {@link edsdk.utils.CanonConstants.EdsPropertyID#kEdsPropID_ExposureCompensation
     *            kEdsPropID_ExposureCompensation},
     *            {@link edsdk.utils.CanonConstants.EdsPropertyID#kEdsPropID_AEMode
     *            kEdsPropID_AEMode},
     *            {@link edsdk.utils.CanonConstants.EdsPropertyID#kEdsPropID_ImageQuality
     *            kEdsPropID_ImageQuality},
     *            {@link edsdk.utils.CanonConstants.EdsPropertyID#kEdsPropID_WhiteBalance
     *            kEdsPropID_WhiteBalance},
     *            {@link edsdk.utils.CanonConstants.EdsPropertyID#kEdsPropID_ColorSpace
     *            kEdsPropID_ColorSpace},
     *            {@link edsdk.utils.CanonConstants.EdsPropertyID#kEdsPropID_PictureStyle
     *            kEdsPropID_PictureStyle},
     *            {@link edsdk.utils.CanonConstants.EdsPropertyID#kEdsPropID_Evf_WhiteBalance
     *            kEdsPropID_Evf_WhiteBalance}, or
     *            {@link edsdk.utils.CanonConstants.EdsPropertyID#kEdsPropID_Evf_AFMode
     *            kEdsPropID_Evf_AFMode}
     * @return A DescriptiveEnum array of the available settings for the given
     *         property
     */
    public static final DescriptiveEnum[] getPropertyDesc( final EdsCameraRef camera,
                                                              final EdsPropertyID property ) throws IllegalArgumentException, IllegalStateException {

        /*
         * System.out.println( "Getting available property values for " +
         * property.description() + " (" + property.name() +
         * ")" );
         */

        final EdsPropertyDesc propertyDesc = CanonUtils.getPropertyDesc( (EdsBaseRef) camera, property );

        if ( propertyDesc.numElements.intValue() > 0 ) {
            /*
             * System.out.println( "Number of elements: " +
             * propertyDesc.numElements );
             */

            final NativeLong[] propDesc = propertyDesc.propDesc;
            final DescriptiveEnum[] properties = new DescriptiveEnum[propertyDesc.numElements.intValue()];
            for ( int i = 0; i < propertyDesc.numElements.intValue(); i++ ) {
                DescriptiveEnum de = null;
                switch ( property ) {
                    case kEdsPropID_DriveMode:
                        de = EdsDriveMode.enumOfValue( propDesc[i].intValue() );
                        break;
                    case kEdsPropID_ISOSpeed:
                        de = EdsISOSpeed.enumOfValue( propDesc[i].intValue() );
                        break;
                    case kEdsPropID_MeteringMode:
                        de = EdsMeteringMode.enumOfValue( propDesc[i].intValue() );
                        break;
                    case kEdsPropID_AFMode:
                        de = EdsAFMode.enumOfValue( propDesc[i].intValue() );
                        break;
                    case kEdsPropID_Av:
                        de = EdsAv.enumOfValue( propDesc[i].intValue() );
                        break;
                    case kEdsPropID_Tv:
                        de = EdsTv.enumOfValue( propDesc[i].intValue() );
                        break;
                    case kEdsPropID_ExposureCompensation:
                        de = EdsExposureCompensation.enumOfValue( propDesc[i].intValue() );
                        break;
                    case kEdsPropID_AEMode:
                        de = EdsAEMode.enumOfValue( propDesc[i].intValue() );
                        break;
                    case kEdsPropID_ImageQuality:
                        de = EdsImageQuality.enumOfValue( propDesc[i].intValue() );
                        break;
                    case kEdsPropID_WhiteBalance:
                        de = EdsWhiteBalance.enumOfValue( propDesc[i].intValue() );
                        break;
                    case kEdsPropID_ColorSpace:
                        de = EdsColorSpace.enumOfValue( propDesc[i].intValue() );
                        break;
                    case kEdsPropID_PictureStyle:
                        de = EdsPictureStyle.enumOfValue( propDesc[i].intValue() );
                        break;
                    // Doesn't seem possible to query available output devices
                    //                    case kEdsPropID_Evf_OutputDevice:
                    //                        de = EdsEvfOutputDevice.enumOfValue( propDesc[i].intValue() );
                    //                        break;
                    case kEdsPropID_Evf_WhiteBalance:
                        de = EdsWhiteBalance.enumOfValue( propDesc[i].intValue() );
                        break;
                    case kEdsPropID_Evf_AFMode:
                        de = EdsEvfAFMode.enumOfValue( propDesc[i].intValue() );
                        break;
                    default:
                        throw new IllegalArgumentException( "Property '" +
                                                            property.name() +
                                                            "' is not supported." );
                }
                if ( de == null ) {
                    throw new IllegalStateException( "Could not find " +
                                                     property.name() +
                                                     " enum with value of: " +
                                                     propDesc[i].intValue() );
                } else {
                    //System.out.println( e.name() + " ( " + e.value() + " ) " + e.description() );
                }
                properties[i] = de;
            }
            //System.out.println( "DONE!\n" );

            return properties;
        }
        return null;
    }

    /**
     * 
     * @param ref The camera to get the available property settings of
     * @param property One of the supported EdsPropertyID values
     * @return The EdsPropertyDesc containing the available settings for the
     *         given property
     */
		if(err == EdSdkLibrary.EDS_ERR_OK ){
    public static EdsPropertyDesc getPropertyDesc( final EdsBaseRef ref,
                                                   final EdsPropertyID property ) throws IllegalArgumentException {
        final EdsPropertyDesc propertyDesc = new EdsPropertyDesc();
        final EdsError err = CanonUtils.toEdsError( CanonCamera.EDSDK.EdsGetPropertyDesc( ref, new NativeLong( property.value() ), propertyDesc ) );
        if ( err == EdsError.EDS_ERR_OK ) {
            //System.out.println( "> available values = " + propertyDesc.numElements );
            return propertyDesc;
        }
        throw new IllegalArgumentException( "An error occurred while getting detailed " +
                                            property.name() +
                                            " data (error " +
                                            err.value() +
                                            ": " +
                                            err.name() +
                                            " - " + err.description() + ")" );
    }

    public static EdsError setCapacity( final EdsCameraRef ref ) {
        return CanonUtils.setCapacity( ref, Integer.MAX_VALUE );
    }

    public static EdsError setCapacity( final EdsCameraRef ref,
                                        final int capacity ) {
        final EdsCapacity.ByValue edsCapacity = new EdsCapacity.ByValue();
        edsCapacity.bytesPerSector = new NativeLong( 512 );
        edsCapacity.numberOfFreeClusters = new NativeLong( capacity /
                                                           edsCapacity.bytesPerSector.intValue() );
        edsCapacity.reset = 1;
        return CanonUtils.toEdsError( CanonCamera.EDSDK.EdsSetCapacity( ref, edsCapacity ) );
    }

    public static boolean isMirrorLockupEnabled( final EdsCameraRef camera ) {
        try {
            return 1l == CanonUtils.getPropertyData( camera, EdsPropertyID.kEdsPropID_CFn, EdsCustomFunction.kEdsCustomFunction_MirrorLockup.value() );
        }
        catch ( final IllegalArgumentException e ) {
            System.err.println( "Could not check if mirror lockup enabled: " +
                                e.getMessage() );
        }
        return false;
    }

    public static boolean beginLiveView( final EdsCameraRef camera ) {
        EdsError err = EdsError.EDS_ERR_OK;

        NativeLongByReference number = new NativeLongByReference( new NativeLong( 1 ) );
        Pointer data = number.getPointer();
        err = CanonUtils.setPropertyData( camera, EdsPropertyID.kEdsPropID_Evf_Mode, 0, NativeLong.SIZE, data );
        if ( err != EdsError.EDS_ERR_OK ) {
            System.err.println( "Could not start live view (set image mode) (error " +
                                err.value() +
                                ": " +
                                err.name() +
                                " - " +
                                err.description() + ")" );
            return false;
        }

        number = new NativeLongByReference( new NativeLong( EdsEvfOutputDevice.kEdsEvfOutputDevice_PC.value() ) );
        data = number.getPointer();
        err = CanonUtils.setPropertyData( camera, EdsPropertyID.kEdsPropID_Evf_OutputDevice, 0, NativeLong.SIZE, data );
        if ( err != EdsError.EDS_ERR_OK ) {
            System.err.println( "Could not start live view (set output device) (error " +
                                err.value() +
                                ": " +
                                err.name() +
                                " - " +
                                err.description() + ")" );
            return false;
        }

        return true;
    }

    public static boolean endLiveView( final EdsCameraRef camera ) {
        EdsError err = EdsError.EDS_ERR_OK;

        NativeLongByReference number = new NativeLongByReference( new NativeLong( EdsEvfOutputDevice.kEdsEvfOutputDevice_TFT.value() ) );
        Pointer data = number.getPointer();
        err = CanonUtils.setPropertyData( camera, EdsPropertyID.kEdsPropID_Evf_OutputDevice, 0, NativeLong.SIZE, data );
        if ( err != EdsError.EDS_ERR_OK ) {
            /*
             * System.err.println( "Could not end live view (error " +
             * err.value() + ": " + err.name() + " - " +
             * err.description() + ")" );
             */
            return false;
        }

        // Create memory stream.
        //TODO: decide whether skip deactivating the live view system. Canon's EOS Utility leaves it enabled, so should consider leaving it enabled as well.
        number = new NativeLongByReference( new NativeLong( 0 ) );
        data = number.getPointer();
        err = CanonUtils.setPropertyData( camera, EdsPropertyID.kEdsPropID_Evf_Mode, 0, NativeLong.SIZE, data );
        if ( err != EdsError.EDS_ERR_OK ) {
            /*
             * System.err.println( "Could not end live view (error " +
             * err.value() + ": " + err.name() + " - " +
             * err.description() + ")" );
             */
            return false;
        }

        return true;
    }

    /**
     * Checks whether live view is allowed to be activated (enabled) and
     * alternately whether the camera is actively transmitting live view images.
     * 

* The default result from the camera may be misleading since * {@link CanonConstants.EdsPropertyID#kEdsPropID_Evf_Mode * kEdsPropID_Evf_Mode} only indicates whether live view is allowed to be * enabled or not, not whether it is currently active and transmitting * images. *

* Additionally, we cannot simply query * {@link CanonConstants.EdsPropertyID#kEdsPropID_Evf_OutputDevice * kEdsPropID_Evf_OutputDevice} because the camera seems to give * inconsistent results, sometimes providing an answer but mostly returning * {@code 0xFFFFFFFF}. *

* Instead, if {@code checkLiveViewActive} is {@code true} this function * will try to download a live view frame and if it cannot, the function * assumes that live view is off and {@code false} is returned. *

* Note that if {@code checkLiveViewActive} is {@code true}, then if live * view is turned off while * {@link CanonUtils#getLiveViewImageReference(EdsCameraRef) * getLiveViewImageReference()} is queried, the tread will hang because the * EDSDK will not return, so call this from a thread-handled environment * such as {@link CanonCamera}. * * @param camera the camera to query * @param checkLiveViewActive set {@code true} to check whether the camera * is actively transmitting live view images * @return {@code true} if live view is allowed to be enabled, or if * checkLiveViewActive, then {@code true} if the camera is actively * transmitting live view images */ public static boolean isLiveViewEnabled( final EdsCameraRef camera, final boolean checkLiveViewActive ) { try { if ( checkLiveViewActive ) { final EdsBaseRef.ByReference[] references = CanonUtils.getLiveViewImageReference( camera ); if ( references != null ) { CanonUtils.release( references ); return true; } return false; } return 1 == CanonUtils.getPropertyData( camera, EdsPropertyID.kEdsPropID_Evf_Mode ); } catch ( final IllegalArgumentException e ) { System.err.println( "Could not check live view status: " + e.getMessage() ); } return false; } /** * Creates a stream and corresponding live view image. You MUST call * {@link CanonUtils#release(edsdk.bindings.EdSdkLibrary.EdsBaseRef.ByReference...) * release()} on the returned array when you are done using it or * you will cause a memory leak! * * @param camera the camera to query * @return EdsEvfImageRef.ByReference and EdsStreamRef.ByReference as * indexes 0 and 1 respectively */ public static EdsBaseRef.ByReference[] getLiveViewImageReference( final EdsCameraRef camera ) { EdsError err = EdsError.EDS_ERR_OK; final EdsStreamRef.ByReference streamRef = new EdsStreamRef.ByReference(); final EdsEvfImageRef.ByReference imageRef = new EdsEvfImageRef.ByReference(); err = CanonUtils.toEdsError( CanonCamera.EDSDK.EdsCreateMemoryStream( new NativeLong( 0 ), streamRef ) ); if ( err != EdsError.EDS_ERR_OK ) { System.err.println( "Failed to download live view image, memory stream could not be created (error " + err.value() + ": " + err.name() + " - " + err.description() + ")" ); CanonUtils.release( imageRef, streamRef ); return null; } err = CanonUtils.toEdsError( CanonCamera.EDSDK.EdsCreateEvfImageRef( new EdsStreamRef( streamRef.getPointer().getPointer( 0 ) ), imageRef ) ); if ( err != EdsError.EDS_ERR_OK ) { System.err.println( "Failed to download live view image, image ref could not be created (error " + err.value() + ": " + err.name() + " - " + err.description() + ")" ); CanonUtils.release( imageRef, streamRef ); return null; } // Now try to follow the guidelines from // http://tech.groups.yahoo.com/group/CanonSDK/message/1225 // instead of what the edsdk example has to offer! // Download live view image data. err = CanonUtils.toEdsError( CanonCamera.EDSDK.EdsDownloadEvfImage( camera, imageRef.getValue() ) ); if ( err != EdsError.EDS_ERR_OK ) { /* * System.err.println( "Failed to download live view image (error " * + * err.value() + ": " + err.name() + " - " + * err.description() + ")" ); */ CanonUtils.release( imageRef, streamRef ); return null; } return new EdsBaseRef.ByReference[] { imageRef, streamRef }; } public static BufferedImage downloadLiveViewImage( final EdsCameraRef camera ) { EdsError err = EdsError.EDS_ERR_OK; final EdsBaseRef.ByReference[] references = CanonUtils.getLiveViewImageReference( camera ); if ( references != null ) { final EdsStreamRef.ByReference streamRef = (EdsStreamRef.ByReference) references[1]; final EdsEvfImageRef.ByReference imageRef = (EdsEvfImageRef.ByReference) references[0]; // // Get the incidental data of the image. // NativeLongByReference zoom = new NativeLongByReference( new NativeLong( 0 ) ); // Pointer data = zoom.getPointer(); // err = getPropertyData( image.getValue(), EdSdkLibrary.kEdsPropID_Evf_ZoomPosition, 0, NativeLong.SIZE, data ); // if( err != EdsError.EDS_ERR_OK ){ // System.err.println( "Failed to download live view image, zoom value wasn't read (error "+ err.value() + ": "+ err.name() + " - " + err.description() + ")" ); // return null; // } // // // Get the focus and zoom border position // EdsPoint point = new EdsPoint(); // data = point.getPointer(); // err = getPropertyData( image.getValue(), EdSdkLibrary.kEdsPropID_Evf_ZoomPosition, 0 , sizeof( point ), data ); // if( err != EdsError.EDS_ERR_OK ){ // System.err.println( "Failed to download live view image, focus point wasn't read (error "+ err.value() + ": "+ err.name() + " - " + err.description() + ")" ); // return null; // } final NativeLongByReference length = new NativeLongByReference(); err = CanonUtils.toEdsError( CanonCamera.EDSDK.EdsGetLength( streamRef.getValue(), length ) ); if ( err != EdsError.EDS_ERR_OK ) { } System.err.println( "Failed to download live view image, failed to read stream length (error " + err.value() + ": " + err.name() + " - " + err.description() + ")" ); CanonUtils.release( imageRef, streamRef ); return null; } final PointerByReference ref = new PointerByReference(); err = CanonUtils.toEdsError( CanonCamera.EDSDK.EdsGetPointer( streamRef.getValue(), ref ) ); if ( err != EdsError.EDS_ERR_OK ) { System.err.println( "Failed to download live view image, failed to get reference to image in memory (error " + err.value() + ": " + err.name() + " - " + err.description() + ")" ); CanonUtils.release( imageRef, streamRef ); return null; } final byte[] data = ref.getValue().getByteArray( 0, length.getValue().intValue() ); try { final BufferedImage img = ImageIO.read( new ByteArrayInputStream( data ) ); return img; } catch ( final IOException e ) { // TODO Auto-generated catch block e.printStackTrace(); } finally { CanonUtils.release( imageRef, streamRef ); } } return null; } public static EdsError toEdsError( final NativeLong value ) { return CanonUtils.toEdsError( value.intValue() ); } public static EdsError toEdsError( final long value ) { return CanonUtils.toEdsError( value ); } public static EdsError toEdsError( final int value ) { final EdsError error = EdsError.enumOfValue( value ); if ( error != null ) { return error; } return EdsError.EDS_ERR_UNEXPECTED_EXCEPTION; } public static void release( final EdsBaseRef.ByReference ... objects ) { for ( final EdsBaseRef.ByReference obj : objects ) { if ( obj != null ) { CanonUtils.release( obj.getValue() ); } } } public static void release( final EdsBaseRef ... objects ) { for ( final EdsBaseRef obj : objects ) { if ( obj != null ) { CanonCamera.EDSDK.EdsRelease( obj ); } } } ======= /** * Converts a bunch of bytes to a string. * This is a little different from new String( myBytes ) because * byte-arrays received from C will be crazy long and just have a null-terminator * somewhere in the middle. */ public static String toString( byte bytes[] ){ for( int i = 0; i < bytes.length; i++ ){ if( bytes[i] == 0 ){ return new String( bytes, 0, i ); } } return new String( bytes ); } /** * Tries to find name of an error code. * * @param errorCode * @return */ public static String toString( int errorCode ){ Field[] fields = EdSdkLibrary.class.getFields(); for( Field field : fields ){ try { if( field.getType().toString().equals( "int" ) && field.getInt( EdSdkLibrary.class ) == errorCode ){ if( field.getName().startsWith( "EDS_" ) ){ return field.getName(); } } } catch(Exception e) { e.printStackTrace(); return "unknown error code"; } public static String propertyIdToString(long property) { Field[] fields = EdSdkLibrary.class.getFields(); for( Field field : fields ){ try { if( field.getType().toString().equals( "int" ) && field.getInt( EdSdkLibrary.class ) == property ){ if( field.getName().startsWith( "kEdsPropID_" ) ){ return field.getName(); } } } catch(Exception e) { e.printStackTrace(); } } return "unknown error code"; } public static String getQualityDescriptionForShortDescription( String str ){ /* Jpeg Only */ if("LJ".equals( str ) ) return "Jpeg Large"; if("M1J".equals( str ) ) return "Jpeg Middle1"; if("M2J".equals( str ) ) return "Jpeg Middle2"; if("SJ".equals( str ) ) return "Jpeg Small"; if("LJF".equals( str ) ) return "Jpeg Large Fine"; if("LJN".equals( str ) ) return "Jpeg Large Normal"; if("MJF".equals( str ) ) return "Jpeg Middle Fine"; if("MJN".equals( str ) ) return "Jpeg Middle Normal"; if("SJF".equals( str ) ) return "Jpeg Small Fine"; if("SJN".equals( str ) ) return "Jpeg Small Normal"; if("S1JF".equals( str ) ) return "Jpeg Small1 Fine"; if("S1JN".equals( str ) ) return "Jpeg Small1 Normal"; if("S2JF".equals( str ) ) return "Jpeg Small2"; if("S3JF".equals( str ) ) return "Jpeg Small3"; /* RAW + Jpeg */ if("LR".equals( str ) ) return "RAW"; if("LRLJF".equals( str ) ) return "RAW + Jpeg Large Fine"; if("LRLJN".equals( str ) ) return "RAW + Jpeg Large Normal"; if("LRMJF".equals( str ) ) return "RAW + Jpeg Middle Fine"; if("LRMJN".equals( str ) ) return "RAW + Jpeg Middle Normal"; if("LRSJF".equals( str ) ) return "RAW + Jpeg Small Fine"; if("LRSJN".equals( str ) ) return "RAW + Jpeg Small Normal"; if("LRS1JF".equals( str ) ) return "RAW + Jpeg Small1 Fine"; if("LRS1JN".equals( str ) ) return "RAW + Jpeg Small1 Normal"; if("LRS2JF".equals( str ) ) return "RAW + Jpeg Small2"; if("LRS3JF".equals( str ) ) return "RAW + Jpeg Small3"; if("LRLJ".equals( str ) ) return "RAW + Jpeg Large"; if("LRM1J".equals( str ) ) return "RAW + Jpeg Middle1"; if("LRM2J".equals( str ) ) return "RAW + Jpeg Middle2"; if("LRSJ".equals( str ) ) return "RAW + Jpeg Small"; /* MRAW(SRAW1) + Jpeg */ if("MR".equals( str ) ) return "MRAW(SRAW1)"; if("MRLJF".equals( str ) ) return "MRAW(SRAW1) + Jpeg Large Fine"; if("MRLJN".equals( str ) ) return "MRAW(SRAW1) + Jpeg Large Normal"; if("MRMJF".equals( str ) ) return "MRAW(SRAW1) + Jpeg Middle Fine"; if("MRMJN".equals( str ) ) return "MRAW(SRAW1) + Jpeg Middle Normal"; if("MRSJF".equals( str ) ) return "MRAW(SRAW1) + Jpeg Small Fine"; if("MRSJN".equals( str ) ) return "MRAW(SRAW1) + Jpeg Small Normal"; if("MRS1JF".equals( str ) ) return "MRAW(SRAW1) + Jpeg Small1 Fine"; if("MRS1JN".equals( str ) ) return "MRAW(SRAW1) + Jpeg Small1 Normal"; if("MRS2JF".equals( str ) ) return "MRAW(SRAW1) + Jpeg Small2"; if("MRS3JF".equals( str ) ) return "MRAW(SRAW1) + Jpeg Small3"; if("MRLJ".equals( str ) ) return "MRAW(SRAW1) + Jpeg Large"; if("MRM1J".equals( str ) ) return "MRAW(SRAW1) + Jpeg Middle1"; if("MRM2J".equals( str ) ) return "MRAW(SRAW1) + Jpeg Middle2"; if("MRSJ".equals( str ) ) return "MRAW(SRAW1) + Jpeg Small"; /* SRAW(SRAW2) + Jpeg */ if("SR".equals( str ) ) return "SRAW(SRAW2)"; if("SRLJF".equals( str ) ) return "SRAW(SRAW2) + Jpeg Large Fine"; if("SRLJN".equals( str ) ) return "SRAW(SRAW2) + Jpeg Large Normal"; if("SRMJF".equals( str ) ) return "SRAW(SRAW2) + Jpeg Middle Fine"; if("SRMJN".equals( str ) ) return "SRAW(SRAW2) + Jpeg Middle Normal"; if("SRSJF".equals( str ) ) return "SRAW(SRAW2) + Jpeg Small Fine"; if("SRSJN".equals( str ) ) return "SRAW(SRAW2) + Jpeg Small Normal"; if("SRS1JF".equals( str ) ) return "SRAW(SRAW2) + Jpeg Small1 Fine"; if("SRS1JN".equals( str ) ) return "SRAW(SRAW2) + Jpeg Small1 Normal"; if("SRS2JF".equals( str ) ) return "SRAW(SRAW2) + Jpeg Small2"; if("SRS3JF".equals( str ) ) return "SRAW(SRAW2) + Jpeg Small3"; if("SRLJ".equals( str ) ) return "SRAW(SRAW2) + Jpeg Large"; if("SRM1J".equals( str ) ) return "SRAW(SRAW2) + Jpeg Middle1"; if("SRM2J".equals( str ) ) return "SRAW(SRAW2) + Jpeg Middle2"; if("SRSJ".equals( str ) ) return "SRAW(SRAW2) + Jpeg Small"; return "Unknown Image Quality"; } /** * Finds the size of a class * Use only with JNA stuff! */ public static int sizeof( Object o ){ int size = 0; for(Field field : o.getClass().getDeclaredFields()) { Class fieldtype = field.getType(); if( fieldtype.equals( NativeLong.class ) ){ size += NativeLong.SIZE; } else{ System.out.println( "unknown field type: " + field ); } // sofern nur char[] m�glich, keinerlei weitere Pr�fung, ansonsten typenpr�fung anbauen //char[] sub =(char[]) field.get(o); //size+=sub.length; } return size; } /** * Finds the filename for a directory item * @param directoryItem The item you want to download * @return Either null, or the filename of the item */ public static EdsDirectoryItemInfo getDirectoryItemInfo( __EdsObject directoryItem ){ int err = EdSdkLibrary.EDS_ERR_OK; EdsDirectoryItemInfo dirItemInfo = new EdsDirectoryItemInfo(); err = CanonCamera.EDSDK.EdsGetDirectoryItemInfo(directoryItem, dirItemInfo).intValue(); if (err == EdSdkLibrary.EDS_ERR_OK) { return dirItemInfo; } else{ return null; } } /** * Downloads an image and saves it somewhere * @param directoryItem The item you want to download * @param destination A path in the filesystem where you want to save the file. Can also be null or a directory. In case of null the temp directory will be used, in case of a directory the file name of the item will be used. * @param deleteAfterDownload Should the image be deleted right after successful download * @return Either null, or the location the file was ultimately saved to on success. */ public static File download( __EdsObject directoryItem, File destination, boolean deleteAfterDownload ){ int err = EdSdkLibrary.EDS_ERR_OK; __EdsObject[] stream = new __EdsObject[1]; EdsDirectoryItemInfo dirItemInfo = new EdsDirectoryItemInfo(); boolean success = false; long timeStart = System.currentTimeMillis(); err = CanonCamera.EDSDK.EdsGetDirectoryItemInfo(directoryItem, dirItemInfo).intValue(); if (err == EdSdkLibrary.EDS_ERR_OK) { if( destination == null ){ destination = new File( System.getProperty("java.io.tmpdir") ); } if (destination.isDirectory()) { destination = new File(destination, toString( dirItemInfo.szFileName ) ); } destination.getParentFile().mkdirs(); System.out.println("Downloading image " + toString(dirItemInfo.szFileName) + " to " + destination.getAbsolutePath()); err = CanonCamera.EDSDK.EdsCreateFileStream( ByteBuffer.wrap( Native.toByteArray( destination.getAbsolutePath() ) ), EdSdkLibrary.EdsFileCreateDisposition.kEdsFileCreateDisposition_CreateAlways, EdSdkLibrary.EdsAccess.kEdsAccess_ReadWrite, stream err = CanonCamera.EDSDK.EdsDownload( directoryItem, dirItemInfo.size, stream[0] ).intValue(); } if( err == EdSdkLibrary.EDS_ERR_OK ){ // System.out.println( "Image downloaded in " + ( System.currentTimeMillis() - timeStart ) ); err = CanonCamera.EDSDK.EdsDownloadComplete( directoryItem ).intValue(); if( deleteAfterDownload ){ // System.out.println( "Image deleted" ); CanonCamera.EDSDK.EdsDeleteDirectoryItem( directoryItem ); } success = true; } if( stream[0] != null ){ CanonCamera.EDSDK.EdsRelease( stream[0] ); } return success? destination : null; } /*public static long getPropertySize( __EdsObject ref, long property ){ IntBuffer type = IntBuffer.allocate( 1 ); NativeLongByReference number = new NativeLongByReference( new NativeLong( 1 ) ); NativeLong res = CanonCamera.EDSDK.EdsGetPropertySize( ref, new NativeLong( property ), new NativeLong( 0 ), type, number ); System.out.println( "A=" + res.intValue() ); System.out.println( "B=" + number.getValue().intValue() ); return 0; }*/ public static int setPropertyData( __EdsObject ref, long property, long param, int size, EdsVoid data ){ return CanonCamera.EDSDK.EdsSetPropertyData( ref, new NativeLong( property ), new NativeLong( param ), new NativeLong( size ), data ).intValue(); } public static int setPropertyData( __EdsObject ref, long property, long value ){ NativeLongByReference number = new NativeLongByReference( new NativeLong( value ) ); EdsVoid data = new EdsVoid( number.getPointer() ); return setPropertyData( ref, property, 0, NativeLong.SIZE, data ); } public static int getPropertyData( __EdsObject ref, long property, long param, int size, EdsVoid data ){ return CanonCamera.EDSDK.EdsGetPropertyData( ref, new NativeLong( property ), new NativeLong( param ), new NativeLong( size ), data ).intValue(); } public static int getPropertyData( __EdsObject ref, long property ){ NativeLongByReference number = new NativeLongByReference( new NativeLong( 1 ) ); EdsVoid data = new EdsVoid( number.getPointer() ); getPropertyData( ref, property, 0, NativeLong.SIZE, data ); return number.getValue().intValue(); } public static boolean beginLiveView( __EdsObject camera ){ int err = EdSdkLibrary.EDS_ERR_OK; NativeLongByReference number = new NativeLongByReference( new NativeLong( 1 ) ); EdsVoid data = new EdsVoid( number.getPointer() ); err = setPropertyData( camera, EdSdkLibrary.kEdsPropID_Evf_Mode, 0, NativeLong.SIZE, data ); if( err != EdSdkLibrary.EDS_ERR_OK ){ System.err.println( "Couldn't start live view, error=" + err + ", " + toString( err ) ); return false; } //TODO:delete! //getPropertyData( camera, EdSdkLibrary.kEdsPropID_Evf_Mode, 0, NativeLong.SIZE, data ); //System.out.println( "===" + number.getValue() ); number = new NativeLongByReference( new NativeLong( EdSdkLibrary.EdsEvfOutputDevice.kEdsEvfOutputDevice_PC ) ); data = new EdsVoid( number.getPointer() ); err = setPropertyData( camera, EdSdkLibrary.kEdsPropID_Evf_OutputDevice, 0, NativeLong.SIZE, data ); if( err != EdSdkLibrary.EDS_ERR_OK ){ System.err.println( "Couldn't start live view, error=" + err + ", " + toString( err ) ); return false; } return true; } public static boolean endLiveView( __EdsObject camera ){ int err = EdSdkLibrary.EDS_ERR_OK; NativeLongByReference number = new NativeLongByReference( new NativeLong( 0 ) ); EdsVoid data = new EdsVoid( number.getPointer() ); err = setPropertyData( camera, EdSdkLibrary.kEdsPropID_Evf_Mode, 0, NativeLong.SIZE, data ); if( err != EdSdkLibrary.EDS_ERR_OK ){ // System.err.println( "Couldn't end live view, error=" + err + ", " + toString( err ) ); return false; } number = new NativeLongByReference( new NativeLong( EdSdkLibrary.EdsEvfOutputDevice.kEdsEvfOutputDevice_TFT ) ); data = new EdsVoid( number.getPointer() ); err = setPropertyData( camera, EdSdkLibrary.kEdsPropID_Evf_OutputDevice, 0, NativeLong.SIZE, data ); if( err != EdSdkLibrary.EDS_ERR_OK ){ // System.err.println( "Couldn't end live view, error=" + err + ", " + toString( err ) ); return false; } return true; } public static boolean isLiveViewEnabled( __EdsObject camera ){ return getPropertyData( camera , EdSdkLibrary.kEdsPropID_Evf_Mode ) == 1; } public static BufferedImage downloadLiveViewImage( __EdsObject camera ){ int err = EdSdkLibrary.EDS_ERR_OK; //EdsStreamRef stream = NULL; //EdsEvfImageRef = NULL; __EdsObject stream[] = new __EdsObject[1]; __EdsObject image[] = new __EdsObject[1]; // Create memory stream. err = CanonCamera.EDSDK.EdsCreateMemoryStream( new NativeLong( 0 ), stream ).intValue(); if( err != EdSdkLibrary.EDS_ERR_OK ){ System.err.println( "Failed to download life view image, memory stream couldn't be created: code=" + err + ", " + toString( err ) ); release( image[0], stream[0] ); return null; } err = CanonCamera.EDSDK.EdsCreateEvfImageRef( stream[0], image ).intValue(); if( err != EdSdkLibrary.EDS_ERR_OK ){ System.err.println( "Failed to download life view image, image ref couldn't be created: code=" + err + ", " + toString( err ) ); release( image[0], stream[0] ); return null; } // Now try to follow the guidelines from // http://tech.groups.yahoo.com/group/CanonSDK/message/1225 // instead of what the edsdk example has to offer! // Download live view image data. err = CanonCamera.EDSDK.EdsDownloadEvfImage( camera, image[0] ).intValue(); if( err != EdSdkLibrary.EDS_ERR_OK ){ // System.err.println( "Failed to download life view image, code=" + err + ", " + toString( err ) ); release( image[0], stream[0] ); return null; } // // // Get the incidental data of the image. // NativeLongByReference zoom = new NativeLongByReference(); // EdsVoid data = new EdsVoid(); // err = getPropertyData( image[0], CanonSDK.kEdsPropID_Evf_ZoomPosition, 0, NativeLong.SIZE, data ); // if( err != CanonSDK.EDS_ERR_OK ){ // System.err.println( "Failed to download life view image, zoom value wasn't read: code=" + err + ", " + toString( err ) ); // return false; // } // // // Get the focus and zoom border position // EdsPoint point = new EdsPoint(); // data = new EdsVoid( point.getPointer() ); // err = getPropertyData( image[0], CanonSDK.kEdsPropID_Evf_ZoomPosition, 0 , sizeof( point ), data ); // if( err != CanonSDK.EDS_ERR_OK ){ // System.err.println( "Failed to download life view image, focus point wasn't read: code=" + err + ", " + toString( err ) ); // return false; // } // // return true; NativeLongByReference length = new NativeLongByReference(); err = CanonCamera.EDSDK.EdsGetLength( stream[0], length ).intValue(); if( err != EdSdkLibrary.EDS_ERR_OK ){ System.err.println( "Failed to download life view image, failed to read stream length: code=" + err + ", " + toString( err ) ); release( image[0], stream[0] ); return null; } PointerByReference ref = new PointerByReference(); err = CanonCamera.EDSDK.EdsGetPointer( stream[0], ref ).intValue(); long address = ref.getPointer().getNativeLong( 0 ).longValue(); Pointer pp = new Pointer( address ); byte data[] = pp.getByteArray( 0, length.getValue().intValue() ); try { BufferedImage img = ImageIO.read( new ByteArrayInputStream( data ) ); return img; catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } finally{ release( image[0], stream[0] ); } return null; } public static EdsPropertyDesc getPropertyDesc( __EdsObject camera, long inPropertyID ){ EdsPropertyDesc.ByReference desc = new EdsPropertyDesc.ByReference(); NativeLong err = CanonCamera.EDSDK.EdsGetPropertyDesc( camera, new NativeLong(inPropertyID), desc ); if( err.longValue() != EdSdkLibrary.EDS_ERR_OK ){ System.out.println( "EdsGetPropertyDesc Error#" + err.longValue() + ": " + CanonUtils.toString( err.intValue() ) ); } return desc; } public static LinkedHashMap listImageQualities( __EdsObject camera ){ LinkedHashMap result = new LinkedHashMap(); EdsPropertyDesc desc = CanonUtils.getPropertyDesc( camera, EdSdkLibrary.kEdsPropID_ImageQuality ); Field[] fields = EdSdkLibrary.EdsImageQuality.class.getFields(); next: for( int i = 0; i < desc.numElements.intValue(); i++ ){ int value = desc.propDesc[i].intValue(); for( Field field : fields ){ try { if( field.getType().toString().equals( "int" ) && field.getInt( EdSdkLibrary.class ) == value ){ if( field.getName().startsWith( "EdsImageQuality_" ) ){ result.put( field.getName().substring( 16 ), value ); continue next; } } } catch(Exception e) { e.printStackTrace(); } } result.put( "Unknown:" + value, value ); } return result; } public static void release( __EdsObject ... objects ){ for( __EdsObject obj : objects ){ if( obj != null ){ CanonCamera.EDSDK.EdsRelease( obj ); } } } >>>>>>> a0560a3efd37b3c0f25a1a05cff3f3a3c019985b }

Solution content
 */
// TODO: think about having CanonUtils handle state/property changes to handle cases described by CanonUtils.isLiveViewEnabled()
public class CanonUtils {

    public static final int classIntField( final Class klass,
                                           final String fieldName ) {
        Throwable t = null;
        try {
            final int value = klass.getField( fieldName ).getInt( null );
            return value;
        }
        catch ( final IllegalArgumentException e ) {
            t = e;
        }
        catch ( final IllegalAccessException e ) {
            t = e;
        }
        catch ( final NoSuchFieldException e ) {
            t = e;
        }
        catch ( final SecurityException e ) {
            t = e;
        }
        throw new IllegalArgumentException( klass.getCanonicalName() +
                                            " does not contain field " +
                                            fieldName, t );
    }

    /**
     * Finds the filename for a directory item
     * 
     * @param directoryItem The item you want to download
     * @return Either null, or the filename of the item
     */
    public static EdsDirectoryItemInfo getDirectoryItemInfo( final EdsDirectoryItemRef directoryItem ) {
        EdsError err = EdsError.EDS_ERR_OK;
        final EdsDirectoryItemInfo dirItemInfo = new EdsDirectoryItemInfo();

        try {
            err = CanonUtils.toEdsError( CanonCamera.EDSDK.EdsGetDirectoryItemInfo( directoryItem, dirItemInfo ) );
        }
        catch ( final Exception e ) {
            e.printStackTrace();
        }

        return err == EdsError.EDS_ERR_OK ? dirItemInfo : null;
    }

    /**
     * Downloads an image and saves it somewhere.
     * 
     * @param directoryItem The item you want to download
     * @param destination A path in the filesystem where you want to save the
     *            file. Can also be null or a directory. In case of null the
     *            temp directory will be used, in case of a directory the file
     *            name of the item will be used.
     * @param appendFileExtension Adds the extension of the photo onto File to
     *            ensure that supplied File name extension matches the image
     *            being downloaded from the camera. This is especially important
     *            if the camera is set to RAW+JPEG where the order of the images
     *            is not consistent.
     * @return Either null, or the location the file was ultimately saved to on
     *         success.
     */
    public static File download( final EdsDirectoryItemRef directoryItem,
                                 File destination,
                                 final boolean appendFileExtension ) {
        EdsError err = EdsError.EDS_ERR_OK;
        final EdsStreamRef.ByReference stream = new EdsStreamRef.ByReference();
        final EdsDirectoryItemInfo dirItemInfo = new EdsDirectoryItemInfo();

        boolean success = false;

        //final long timeStart = System.currentTimeMillis();

        try {
            err = CanonUtils.toEdsError( CanonCamera.EDSDK.EdsGetDirectoryItemInfo( directoryItem, dirItemInfo ) );
            if ( err == EdsError.EDS_ERR_OK ) {
                if ( destination == null ) {
                    destination = new File( System.getProperty( "java.io.tmpdir" ) );
                }
                if ( destination.isDirectory() ) {
                    destination = new File( destination, Native.toString( dirItemInfo.szFileName ) );
                } else if ( appendFileExtension ) {
                    final String sourceFileName = Native.toString( dirItemInfo.szFileName );
                    final int i = sourceFileName.lastIndexOf( "." );
                    if ( i > 0 ) {
                        final String extension = sourceFileName.substring( i );
                        if ( !destination.getName().toLowerCase().endsWith( extension ) ) {
                            destination = new File( destination.getPath() +
                                                    extension );
                        }
                    }
                }

                if ( destination.getParentFile() != null ) {
                    destination.getParentFile().mkdirs();
                }

                /*
                 * System.out.println( "Downloading image " +
                 * Native.toString( dirItemInfo.szFileName ) +
                 * " to " + destination.getCanonicalPath() );
                 */

                                                    final long param,
                // TODO: see if using an EdsCreateMemoryStream would be faster and whether the image could be read directly without saving to file first - see: http://stackoverflow.com/questions/1083446/canon-edsdk-memorystream-image
                err = CanonUtils.toEdsError( CanonCamera.EDSDK.EdsCreateFileStream( Native.toByteArray( destination.getCanonicalPath() ), EdsFileCreateDisposition.kEdsFileCreateDisposition_CreateAlways.value(), EdsAccess.kEdsAccess_ReadWrite.value(), stream ) );
            }

            if ( err == EdsError.EDS_ERR_OK ) {
                err = CanonUtils.toEdsError( CanonCamera.EDSDK.EdsDownload( directoryItem, dirItemInfo.size, stream.getValue() ) );
            }

            if ( err == EdsError.EDS_ERR_OK ) {
                /*
                 * System.out.println( "Image downloaded in " +
                 * ( System.currentTimeMillis() - timeStart ) +
                 * " ms" );
                 */

                err = CanonUtils.toEdsError( CanonCamera.EDSDK.EdsDownloadComplete( directoryItem ) );

                success = true;
            }

            if ( stream != null ) {
                CanonCamera.EDSDK.EdsRelease( stream.getValue() );
            }
        }
        catch ( final Exception e ) {
            e.printStackTrace();
        }

        return success ? destination : null;
    }

    public static EdsError setPropertyData( final EdsBaseRef ref,
                                            final EdsPropertyID property,
                                            final DescriptiveEnum value ) {
        return CanonUtils.setPropertyDataAdvanced( ref, property, 0, value.value().longValue() );
    }

    public static EdsError setPropertyData( final EdsBaseRef ref,
                                            final EdsPropertyID property,
                                            final long param,
                                            final DescriptiveEnum value ) {
        return CanonUtils.setPropertyDataAdvanced( ref, property, param, value.value().longValue() );
    }

    public static EdsError setPropertyData( final EdsBaseRef ref,
                                            final EdsPropertyID property,
                                            final long value ) {
        return CanonUtils.setPropertyDataAdvanced( ref, property, 0, value );
    }

    public static EdsError setPropertyData( final EdsBaseRef ref,
                                            final EdsPropertyID property,
                                            final long param, final long value ) {
        return CanonUtils.setPropertyDataAdvanced( ref, property, param, value );
    }

    public static EdsError setPropertyData( final EdsBaseRef ref,
                                            final EdsPropertyID property,
                                            final long param, final int size,
                                            final Pointer data ) {
        return CanonUtils.toEdsError( CanonCamera.EDSDK.EdsSetPropertyData( ref, new NativeLong( property.value() ), new NativeLong( param ), new NativeLong( size ), data ) );
    }

    public static EdsError setPropertyDataAdvanced( final EdsBaseRef ref,
                                                    final EdsPropertyID property,
                                                    final Object value ) {
        return CanonUtils.setPropertyDataAdvanced( ref, property, 0, value );
    }

    /**
     * Only use this if you know that the type of the property you input is
     * compatible with the value you supply.
     * 
     * @param ref Camera/image/live view reference
     * @param property Property to get from the camera
     * @param param See EDSDK API
     * @return
     * @throws IllegalStateException
     */
    //TODO: this method isn't very safe to leave public, perhaps some setPropertyData[String/UInt32/etc.] methods would be better
    public static EdsError setPropertyDataAdvanced( final EdsBaseRef ref,
                                                    final EdsPropertyID property,
                                                    final Object value ) throws IllegalStateException {

        final EdsDataType type = CanonUtils.getPropertyType( ref, property, param );

        final Pointer pointer;
        final int size;

        switch ( type ) {
            case kEdsDataType_String: { //EdsChar[]
                final String string = (String) value;
                size = string.length() + 1;
                pointer = new Memory( size );
                pointer.setString( 0, string );
                break;
            }
            case kEdsDataType_Int8: //EdsInt8
            case kEdsDataType_UInt8: { //EdsUInt8
                size = 1;
                pointer = new Memory( size );
                pointer.setByte( 0, (Byte) value );
                break;
            }
            case kEdsDataType_Int16: //EdsInt16
            case kEdsDataType_UInt16: { //EdsUInt16
                size = 2;
                pointer = new Memory( size );
                pointer.setShort( 0, (Short) value );
                break;
            }
            case kEdsDataType_Int32: //EdsInt32
            case kEdsDataType_UInt32: { //EdsUInt32
                size = 4;
                pointer = new Memory( size );
                pointer.setNativeLong( 0, new NativeLong( (Long) value ) );
                break;
            }
            case kEdsDataType_Int64: //EdsInt64
            case kEdsDataType_UInt64: { //EdsUInt64
                size = 8;
                pointer = new Memory( size );
                pointer.setLong( 0, (Long) value );
                break;
            }
            case kEdsDataType_Float: { //EdsFloat
                size = 4;
                pointer = new Memory( size );
                pointer.setFloat( 0, (Float) value );
                break;
            }
            case kEdsDataType_Double: { //EdsDouble
                size = 8;
                pointer = new Memory( size );
                pointer.setDouble( 0, (Double) value );
                break;
            }
            case kEdsDataType_ByteBlock: { //Byte Block // TODO: According to API, is either EdsInt8[] or EdsUInt32[], but perhaps former is a typo or an old value
                final int[] array = (int[]) value;
                size = 4 * array.length;
                pointer = new Memory( size );
                pointer.write( 0, array, 0, array.length );
                break;
            }
            case kEdsDataType_Rational: //EdsRational
            case kEdsDataType_Point: //EdsPoint
            case kEdsDataType_Rect: //EdsRect
            case kEdsDataType_Time: //EdsTime
            case kEdsDataType_FocusInfo: //EdsFocusInfo
            case kEdsDataType_PictureStyleDesc: { //EdsPictureStyleDesc
                final Structure structure = (Structure) value;
                structure.write();
                pointer = structure.getPointer();
                size = structure.size();
                break;
            }
            case kEdsDataType_Int8_Array: //EdsInt8[]
            case kEdsDataType_UInt8_Array: { //EdsUInt8[]
                final byte[] array = (byte[]) value;
                size = array.length;
                pointer = new Memory( size );
                pointer.write( 0, array, 0, array.length );
                break;
            }
            case kEdsDataType_Int16_Array: //EdsInt16[]
            case kEdsDataType_UInt16_Array: { //EdsUInt16[]
                final short[] array = (short[]) value;
                size = 2 * array.length;
                pointer = new Memory( size );
                pointer.write( 0, array, 0, array.length );
                break;
            }
            case kEdsDataType_Int32_Array: //EdsInt32[]
            case kEdsDataType_UInt32_Array: { //EdsUInt32[]
                final int[] array = (int[]) value;
                size = 4 * array.length;
                pointer = new Memory( size );
                pointer.write( 0, array, 0, array.length );
                break;
            }
            case kEdsDataType_Bool: //EdsBool // TODO: implement
            case kEdsDataType_Bool_Array: //EdsBool[] // TODO: implement
            case kEdsDataType_Rational_Array: //EdsRational[] // TODO: implement
            case kEdsDataType_Unknown: //Unknown
            default:
                throw new IllegalStateException( type.description() + " (" +
                                                 type.name() +
                                                 ") is not currently supported by GetPropertyCommand" );
        }
        return CanonUtils.setPropertyData( ref, property, param, size, pointer );
    }

    public static Long getPropertyData( final EdsBaseRef ref,
                                        final EdsPropertyID property ) {
        return CanonUtils.getPropertyDataAdvanced( ref, property, 0 );
    }

    public static Long getPropertyData( final EdsBaseRef ref,
                                        final EdsPropertyID property,
                                        final long param ) {
        return CanonUtils.getPropertyDataAdvanced( ref, property, param );
    }

    public static EdsError getPropertyData( final EdsBaseRef ref,
                                            final EdsPropertyID property,
                                            final long param, final long size,
                                            final Pointer data ) {
        return CanonUtils.toEdsError( CanonCamera.EDSDK.EdsGetPropertyData( ref, new NativeLong( property.value() ), new NativeLong( param ), new NativeLong( size ), data ) );
    }

    public static  T getPropertyDataAdvanced( final EdsBaseRef ref,
                                                 final EdsPropertyID property ) {
        return CanonUtils.getPropertyDataAdvanced( ref, property, 0 );
    }

    /**
     * Only use this if you know that the type of the property you input is
     * compatible with the return type assignment you expect.
     * 
     * @param ref Camera/image/live view reference
     * @param property Property to get from the camera
     * @param param See EDSDK API
     * @return
     * @throws IllegalArgumentException
     * @throws IllegalStateException
     */
    //TODO: this method isn't very safe to leave public, perhaps some setPropertyData[String/UInt32/etc.] methods would be better
    @SuppressWarnings( "unchecked" )
    public static  T getPropertyDataAdvanced( final EdsBaseRef ref,
                                                 final EdsPropertyID property,
                                                 final long param ) throws IllegalArgumentException, IllegalStateException {

        final int size = (int) CanonUtils.getPropertySize( ref, property, param );
        final EdsDataType type = CanonUtils.getPropertyType( ref, property, param );

        final Memory memory = new Memory( size > 0 ? size : 1 );

        final EdsError err = CanonUtils.getPropertyData( ref, property, param, size, memory );
        if ( err == EdsError.EDS_ERR_OK ) {
            switch ( type ) {
                case kEdsDataType_Unknown: //Unknown
                    return null;
                case kEdsDataType_String: //EdsChar[]
                    return (T) memory.getString( 0 );
                case kEdsDataType_Int8: //EdsInt8
                case kEdsDataType_UInt8: //EdsUInt8
                    return (T) Byte.valueOf( memory.getByte( 0 ) );
                case kEdsDataType_Int16: //EdsInt16
                case kEdsDataType_UInt16: //EdsUInt16
                    return (T) Short.valueOf( memory.getShort( 0 ) );
                case kEdsDataType_Int32: //EdsInt32
                case kEdsDataType_UInt32: //EdsUInt32
                    return (T) Long.valueOf( memory.getNativeLong( 0 ).longValue() );
                case kEdsDataType_Int64: //EdsInt64
                case kEdsDataType_UInt64: //EdsUInt64
                    return (T) Long.valueOf( memory.getLong( 0 ) );
                case kEdsDataType_Float: //EdsFloat
                    return (T) Float.valueOf( memory.getFloat( 0 ) );
                case kEdsDataType_Double: //EdsDouble
                    return (T) Double.valueOf( memory.getDouble( 0 ) );
                case kEdsDataType_ByteBlock: //Byte Block // TODO: According to API, is either EdsInt8[] or EdsUInt32[], but perhaps former is a typo or an old value
                    return (T) memory.getIntArray( 0, size / 4 );
                case kEdsDataType_Rational: //EdsRational
                    return (T) new EdsRational( memory );
                case kEdsDataType_Point: //EdsPoint
                    return (T) new EdsPoint( memory );
                case kEdsDataType_Rect: //EdsRect
                    return (T) new EdsRect( memory );
                case kEdsDataType_Time: //EdsTime
                    return (T) new EdsTime( memory );
                case kEdsDataType_FocusInfo: //EdsFocusInfo
                    return (T) new EdsFocusInfo( memory );
                case kEdsDataType_PictureStyleDesc: //EdsPictureStyleDesc
                    return (T) new EdsPictureStyleDesc( memory );
                case kEdsDataType_Int8_Array: //EdsInt8[]
                case kEdsDataType_UInt8_Array: //EdsUInt8[]
                    return (T) memory.getByteArray( 0, size );
                case kEdsDataType_Int16_Array: //EdsInt16[]
                case kEdsDataType_UInt16_Array: //EdsUInt16[]
                    return (T) memory.getShortArray( 0, size / 2 );
                case kEdsDataType_Int32_Array: //EdsInt32[]
                case kEdsDataType_UInt32_Array: //EdsUInt32[]
                    return (T) memory.getIntArray( 0, size / 4 );
                case kEdsDataType_Bool: //EdsBool // TODO: implement
                case kEdsDataType_Bool_Array: //EdsBool[] // TODO: implement
                case kEdsDataType_Rational_Array: //EdsRational[] // TODO: implement
                default:
                    throw new IllegalStateException( type.description() + " (" +
                                                     type.name() +
                                                     ") is not currently supported by GetPropertyCommand" );
            }
        }

        throw new IllegalArgumentException( "An error occurred while getting " +
                                            property.name() + " data (error " +
                                            err.value() + ": " + err.name() +
                                            " - " + err.description() + ")" );
    }

    public static EdsDataType getPropertyType( final EdsBaseRef ref,
                                               final EdsPropertyID property ) {
        return CanonUtils.getPropertyType( ref, property, 0 );
    }

    public static EdsDataType getPropertyType( final EdsBaseRef ref,
                                               final EdsPropertyID property,
                                               final long param ) {
        final int bufferSize = 1;
        final IntBuffer type = IntBuffer.allocate( bufferSize );
        final NativeLongByReference number = new NativeLongByReference( new NativeLong( bufferSize ) );
        final EdsError err = CanonUtils.toEdsError( CanonCamera.EDSDK.EdsGetPropertySize( ref, new NativeLong( property.value() ), new NativeLong( param ), type, number ) );
        if ( err == EdsError.EDS_ERR_OK ) {
            final EdsDataType edsDataType = EdsDataType.enumOfValue( type.get( 0 ) );
            if ( edsDataType != null ) {
                //System.out.println( " > property type = " + edsDataType.value() + " : " + edsDataType.name() + " : " + edsDataType.description() );
                return edsDataType;
            }
        }
        // TODO: would it be better to return NULL if EDS_ERR_NOT_SUPPORTED is returned?
        return EdsDataType.kEdsDataType_Unknown;
    }

    public static long getPropertySize( final EdsBaseRef ref,
                                        final EdsPropertyID property ) {
        return CanonUtils.getPropertySize( ref, property, 0 );
    }

    public static long getPropertySize( final EdsBaseRef ref,
                                        final EdsPropertyID property,
                                        final long param ) {
        final int bufferSize = 1;
        final IntBuffer type = IntBuffer.allocate( bufferSize );
        final NativeLongByReference number = new NativeLongByReference( new NativeLong( bufferSize ) );
        final EdsError err = CanonUtils.toEdsError( CanonCamera.EDSDK.EdsGetPropertySize( ref, new NativeLong( property.value() ), new NativeLong( param ), type, number ) );
        if ( err == EdsError.EDS_ERR_OK ) {
            //System.out.println( "> property size = " + number.getValue().longValue() );
            return number.getValue().longValue();
        }
        return -1;
    }

    /**
     * Returns an array of DescriptiveEnum values for a given EdsPropertyID
     * enum. Some of the EdsPropertyID enums that this function is known to
     * support are listed in the EDSDK documentation, others were obtained by
     * trial-and-error. Note that not all EdsPropertyID values are supported in
     * all camera modes or with all models.
     * 
     * @param camera The camera to get the available property settings of
     * @param property
     *            {@link edsdk.utils.CanonConstants.EdsPropertyID#kEdsPropID_DriveMode
     *            kEdsPropID_DriveMode}
     *            {@link edsdk.utils.CanonConstants.EdsPropertyID#kEdsPropID_ISOSpeed
     *            kEdsPropID_ISOSpeed},
     *            {@link edsdk.utils.CanonConstants.EdsPropertyID#kEdsPropID_MeteringMode
     *            kEdsPropID_MeteringMode},
     *            {@link edsdk.utils.CanonConstants.EdsPropertyID#kEdsPropID_AFMode
     *            kEdsPropID_AFMode},
     *            {@link edsdk.utils.CanonConstants.EdsPropertyID#kEdsPropID_Av
     *            kEdsPropID_Av},
     *            {@link edsdk.utils.CanonConstants.EdsPropertyID#kEdsPropID_Tv
     *            kEdsPropID_Tv},
     *            {@link edsdk.utils.CanonConstants.EdsPropertyID#kEdsPropID_ExposureCompensation
     *            kEdsPropID_ExposureCompensation},
     *            {@link edsdk.utils.CanonConstants.EdsPropertyID#kEdsPropID_AEMode
     *            kEdsPropID_AEMode},
     *            {@link edsdk.utils.CanonConstants.EdsPropertyID#kEdsPropID_ImageQuality
     *            kEdsPropID_ImageQuality},
     *            {@link edsdk.utils.CanonConstants.EdsPropertyID#kEdsPropID_WhiteBalance
     *            kEdsPropID_WhiteBalance},
     *            {@link edsdk.utils.CanonConstants.EdsPropertyID#kEdsPropID_ColorSpace
     *            kEdsPropID_ColorSpace},
     *            {@link edsdk.utils.CanonConstants.EdsPropertyID#kEdsPropID_PictureStyle
     *            kEdsPropID_PictureStyle},
     *            {@link edsdk.utils.CanonConstants.EdsPropertyID#kEdsPropID_Evf_WhiteBalance
     *            kEdsPropID_Evf_WhiteBalance}, or
     *            {@link edsdk.utils.CanonConstants.EdsPropertyID#kEdsPropID_Evf_AFMode
     *            kEdsPropID_Evf_AFMode}
     * @return A DescriptiveEnum array of the available settings for the given
     *         property
     */
    public static final DescriptiveEnum[] getPropertyDesc( final EdsCameraRef camera,
                                                              final EdsPropertyID property ) throws IllegalArgumentException, IllegalStateException {

        /*
         * System.out.println( "Getting available property values for " +
         * property.description() + " (" + property.name() +
         * ")" );
         */

        final EdsPropertyDesc propertyDesc = CanonUtils.getPropertyDesc( (EdsBaseRef) camera, property );

        if ( propertyDesc.numElements.intValue() > 0 ) {
            /*
             * System.out.println( "Number of elements: " +
             * propertyDesc.numElements );
             */

            final NativeLong[] propDesc = propertyDesc.propDesc;
            final DescriptiveEnum[] properties = new DescriptiveEnum[propertyDesc.numElements.intValue()];
            for ( int i = 0; i < propertyDesc.numElements.intValue(); i++ ) {
                DescriptiveEnum de = null;
                switch ( property ) {
                    case kEdsPropID_DriveMode:
                        de = EdsDriveMode.enumOfValue( propDesc[i].intValue() );
                        break;
                    case kEdsPropID_ISOSpeed:
                        de = EdsISOSpeed.enumOfValue( propDesc[i].intValue() );
                        break;
                    case kEdsPropID_MeteringMode:
             * err.description() + ")" );
                        de = EdsMeteringMode.enumOfValue( propDesc[i].intValue() );
                        break;
                    case kEdsPropID_AFMode:
                        de = EdsAFMode.enumOfValue( propDesc[i].intValue() );
                        break;
                    case kEdsPropID_Av:
                        de = EdsAv.enumOfValue( propDesc[i].intValue() );
                        break;
                    case kEdsPropID_Tv:
                        de = EdsTv.enumOfValue( propDesc[i].intValue() );
                        break;
                    case kEdsPropID_ExposureCompensation:
                        de = EdsExposureCompensation.enumOfValue( propDesc[i].intValue() );
                        break;
                    case kEdsPropID_AEMode:
                        de = EdsAEMode.enumOfValue( propDesc[i].intValue() );
                        break;
                    case kEdsPropID_ImageQuality:
                        de = EdsImageQuality.enumOfValue( propDesc[i].intValue() );
                        break;
                    case kEdsPropID_WhiteBalance:
                        de = EdsWhiteBalance.enumOfValue( propDesc[i].intValue() );
                        break;
                    case kEdsPropID_ColorSpace:
                        de = EdsColorSpace.enumOfValue( propDesc[i].intValue() );
                        break;
                    case kEdsPropID_PictureStyle:
                        de = EdsPictureStyle.enumOfValue( propDesc[i].intValue() );
                        break;
                    // Doesn't seem possible to query available output devices
                    //                    case kEdsPropID_Evf_OutputDevice:
                    //                        de = EdsEvfOutputDevice.enumOfValue( propDesc[i].intValue() );
                    //                        break;
                    case kEdsPropID_Evf_WhiteBalance:
                        de = EdsWhiteBalance.enumOfValue( propDesc[i].intValue() );
                        break;
                    case kEdsPropID_Evf_AFMode:
                        de = EdsEvfAFMode.enumOfValue( propDesc[i].intValue() );
                        break;
                    default:
                        throw new IllegalArgumentException( "Property '" +
                                                            property.name() +
                                                            "' is not supported." );
                }
                if ( de == null ) {
                    throw new IllegalStateException( "Could not find " +
                                                     property.name() +
                                                     " enum with value of: " +
                                                     propDesc[i].intValue() );
                } else {
                    //System.out.println( e.name() + " ( " + e.value() + " ) " + e.description() );
                }
                properties[i] = de;
            }
            //System.out.println( "DONE!\n" );

            return properties;
        }
        return null;
    }

    /**
     * 
     * @param ref The camera to get the available property settings of
     * @param property One of the supported EdsPropertyID values
     * @return The EdsPropertyDesc containing the available settings for the
     *         given property
     */
    public static EdsPropertyDesc getPropertyDesc( final EdsBaseRef ref,
                                                   final EdsPropertyID property ) throws IllegalArgumentException {
        final EdsPropertyDesc propertyDesc = new EdsPropertyDesc();
        final EdsError err = CanonUtils.toEdsError( CanonCamera.EDSDK.EdsGetPropertyDesc( ref, new NativeLong( property.value() ), propertyDesc ) );
        if ( err == EdsError.EDS_ERR_OK ) {
            //System.out.println( "> available values = " + propertyDesc.numElements );
            return propertyDesc;
        }
        throw new IllegalArgumentException( "An error occurred while getting detailed " +
                                            property.name() +
                                            " data (error " +
                                            err.value() +
                                            ": " +
                                            err.name() +
                                            " - " + err.description() + ")" );
    }

    public static EdsError setCapacity( final EdsCameraRef ref ) {
        return CanonUtils.setCapacity( ref, Integer.MAX_VALUE );
    }

    public static EdsError setCapacity( final EdsCameraRef ref,
                                        final int capacity ) {
        final EdsCapacity.ByValue edsCapacity = new EdsCapacity.ByValue();
        edsCapacity.bytesPerSector = new NativeLong( 512 );
        edsCapacity.numberOfFreeClusters = new NativeLong( capacity /
                                                           edsCapacity.bytesPerSector.intValue() );
        edsCapacity.reset = 1;
        return CanonUtils.toEdsError( CanonCamera.EDSDK.EdsSetCapacity( ref, edsCapacity ) );
    }

    public static boolean isMirrorLockupEnabled( final EdsCameraRef camera ) {
        try {
            return 1l == CanonUtils.getPropertyData( camera, EdsPropertyID.kEdsPropID_CFn, EdsCustomFunction.kEdsCustomFunction_MirrorLockup.value() );
        }
        catch ( final IllegalArgumentException e ) {
            System.err.println( "Could not check if mirror lockup enabled: " +
                                e.getMessage() );
        }
        return false;
    }

    public static boolean beginLiveView( final EdsCameraRef camera ) {
        EdsError err = EdsError.EDS_ERR_OK;

        NativeLongByReference number = new NativeLongByReference( new NativeLong( 1 ) );
        Pointer data = number.getPointer();
        err = CanonUtils.setPropertyData( camera, EdsPropertyID.kEdsPropID_Evf_Mode, 0, NativeLong.SIZE, data );
        if ( err != EdsError.EDS_ERR_OK ) {
            System.err.println( "Could not start live view (set image mode) (error " +
                                err.value() +
                                ": " +
                                err.name() +
                                " - " +
                                err.description() + ")" );
            return false;
        }

        number = new NativeLongByReference( new NativeLong( EdsEvfOutputDevice.kEdsEvfOutputDevice_PC.value() ) );
        data = number.getPointer();
        err = CanonUtils.setPropertyData( camera, EdsPropertyID.kEdsPropID_Evf_OutputDevice, 0, NativeLong.SIZE, data );
        if ( err != EdsError.EDS_ERR_OK ) {
            System.err.println( "Could not start live view (set output device) (error " +
                                err.value() +
                                ": " +
                                err.name() +
                                " - " +
                                err.description() + ")" );
            return false;
        }

        return true;
    }

    public static boolean endLiveView( final EdsCameraRef camera ) {
        EdsError err = EdsError.EDS_ERR_OK;

        NativeLongByReference number = new NativeLongByReference( new NativeLong( EdsEvfOutputDevice.kEdsEvfOutputDevice_TFT.value() ) );
        Pointer data = number.getPointer();
        err = CanonUtils.setPropertyData( camera, EdsPropertyID.kEdsPropID_Evf_OutputDevice, 0, NativeLong.SIZE, data );
        if ( err != EdsError.EDS_ERR_OK ) {
            /*
             * System.err.println( "Could not end live view (error " +
             * err.value() + ": " + err.name() + " - " +
             * err.description() + ")" );
             */
            return false;
        }

        //TODO: decide whether skip deactivating the live view system. Canon's EOS Utility leaves it enabled, so should consider leaving it enabled as well.
        number = new NativeLongByReference( new NativeLong( 0 ) );
        data = number.getPointer();
        err = CanonUtils.setPropertyData( camera, EdsPropertyID.kEdsPropID_Evf_Mode, 0, NativeLong.SIZE, data );
        if ( err != EdsError.EDS_ERR_OK ) {
            /*
             * System.err.println( "Could not end live view (error " +
             * err.value() + ": " + err.name() + " - " +
             */
            return false;
        }

        return true;
    }

    /**
     * Checks whether live view is allowed to be activated (enabled) and
     * alternately whether the camera is actively transmitting live view images.
     * 

* The default result from the camera may be misleading since * {@link CanonConstants.EdsPropertyID#kEdsPropID_Evf_Mode * kEdsPropID_Evf_Mode} only indicates whether live view is allowed to be * enabled or not, not whether it is currently active and transmitting * images. *

* Additionally, we cannot simply query * {@link CanonConstants.EdsPropertyID#kEdsPropID_Evf_OutputDevice * kEdsPropID_Evf_OutputDevice} because the camera seems to give * inconsistent results, sometimes providing an answer but mostly returning * {@code 0xFFFFFFFF}. *

* Instead, if {@code checkLiveViewActive} is {@code true} this function * will try to download a live view frame and if it cannot, the function * assumes that live view is off and {@code false} is returned. *

* Note that if {@code checkLiveViewActive} is {@code true}, then if live * view is turned off while * {@link CanonUtils#getLiveViewImageReference(EdsCameraRef) * getLiveViewImageReference()} is queried, the tread will hang because the * EDSDK will not return, so call this from a thread-handled environment * such as {@link CanonCamera}. * * @param camera the camera to query * @param checkLiveViewActive set {@code true} to check whether the camera * is actively transmitting live view images * @return {@code true} if live view is allowed to be enabled, or if * checkLiveViewActive, then {@code true} if the camera is actively * transmitting live view images */ public static boolean isLiveViewEnabled( final EdsCameraRef camera, final boolean checkLiveViewActive ) { try { if ( checkLiveViewActive ) { final EdsBaseRef.ByReference[] references = CanonUtils.getLiveViewImageReference( camera ); if ( references != null ) { CanonUtils.release( references ); return true; } return false; } return 1 == CanonUtils.getPropertyData( camera, EdsPropertyID.kEdsPropID_Evf_Mode ); } catch ( final IllegalArgumentException e ) { System.err.println( "Could not check live view status: " + e.getMessage() ); } return false; } /** * Creates a stream and corresponding live view image. You MUST call * {@link CanonUtils#release(edsdk.bindings.EdSdkLibrary.EdsBaseRef.ByReference...) * release()} on the returned array when you are done using it or * you will cause a memory leak! * * @param camera the camera to query * @return EdsEvfImageRef.ByReference and EdsStreamRef.ByReference as * indexes 0 and 1 respectively */ public static EdsBaseRef.ByReference[] getLiveViewImageReference( final EdsCameraRef camera ) { EdsError err = EdsError.EDS_ERR_OK; final EdsStreamRef.ByReference streamRef = new EdsStreamRef.ByReference(); final EdsEvfImageRef.ByReference imageRef = new EdsEvfImageRef.ByReference(); // Create memory stream. err = CanonUtils.toEdsError( CanonCamera.EDSDK.EdsCreateMemoryStream( new NativeLong( 0 ), streamRef ) ); if ( err != EdsError.EDS_ERR_OK ) { System.err.println( "Failed to download live view image, memory stream could not be created (error " + err.value() + ": " + err.name() + " - " + err.description() + ")" ); CanonUtils.release( imageRef, streamRef ); return null; } err = CanonUtils.toEdsError( CanonCamera.EDSDK.EdsCreateEvfImageRef( new EdsStreamRef( streamRef.getPointer().getPointer( 0 ) ), imageRef ) ); if ( err != EdsError.EDS_ERR_OK ) { System.err.println( "Failed to download live view image, image ref could not be created (error " + err.value() + ": " + err.name() + " - " + err.description() + ")" ); CanonUtils.release( imageRef, streamRef ); return null; } // Now try to follow the guidelines from // http://tech.groups.yahoo.com/group/CanonSDK/message/1225 // instead of what the edsdk example has to offer! // Download live view image data. err = CanonUtils.toEdsError( CanonCamera.EDSDK.EdsDownloadEvfImage( camera, imageRef.getValue() ) ); if ( err != EdsError.EDS_ERR_OK ) { /* * System.err.println( "Failed to download live view image (error " * + * err.value() + ": " + err.name() + " - " + * err.description() + ")" ); */ CanonUtils.release( imageRef, streamRef ); return null; } return new EdsBaseRef.ByReference[] { imageRef, streamRef }; } public static BufferedImage downloadLiveViewImage( final EdsCameraRef camera ) { EdsError err = EdsError.EDS_ERR_OK; final EdsBaseRef.ByReference[] references = CanonUtils.getLiveViewImageReference( camera ); if ( references != null ) { final EdsStreamRef.ByReference streamRef = (EdsStreamRef.ByReference) references[1]; final EdsEvfImageRef.ByReference imageRef = (EdsEvfImageRef.ByReference) references[0]; // // Get the incidental data of the image. // NativeLongByReference zoom = new NativeLongByReference( new NativeLong( 0 ) ); // Pointer data = zoom.getPointer(); // err = getPropertyData( image.getValue(), EdSdkLibrary.kEdsPropID_Evf_ZoomPosition, 0, NativeLong.SIZE, data ); // if( err != EdsError.EDS_ERR_OK ){ // System.err.println( "Failed to download live view image, zoom value wasn't read (error "+ err.value() + ": "+ err.name() + " - " + err.description() + ")" ); // return null; // } // // // Get the focus and zoom border position // EdsPoint point = new EdsPoint(); // data = point.getPointer(); // err = getPropertyData( image.getValue(), EdSdkLibrary.kEdsPropID_Evf_ZoomPosition, 0 , sizeof( point ), data ); // if( err != EdsError.EDS_ERR_OK ){ // System.err.println( "Failed to download live view image, focus point wasn't read (error "+ err.value() + ": "+ err.name() + " - " + err.description() + ")" ); // return null; // } final NativeLongByReference length = new NativeLongByReference(); err = CanonUtils.toEdsError( CanonCamera.EDSDK.EdsGetLength( streamRef.getValue(), length ) ); if ( err != EdsError.EDS_ERR_OK ) { System.err.println( "Failed to download live view image, failed to read stream length (error " + err.value() + ": " + err.name() + " - " + err.description() + ")" ); CanonUtils.release( imageRef, streamRef ); return null; } final PointerByReference ref = new PointerByReference(); err = CanonUtils.toEdsError( CanonCamera.EDSDK.EdsGetPointer( streamRef.getValue(), ref ) ); if ( err != EdsError.EDS_ERR_OK ) { System.err.println( "Failed to download live view image, failed to get reference to image in memory (error " + err.value() + ": " + err.name() + " - " + err.description() + ")" ); CanonUtils.release( imageRef, streamRef ); return null; } final byte[] data = ref.getValue().getByteArray( 0, length.getValue().intValue() ); try { final BufferedImage img = ImageIO.read( new ByteArrayInputStream( data ) ); return img; } catch ( final IOException e ) { // TODO Auto-generated catch block e.printStackTrace(); } finally { CanonUtils.release( imageRef, streamRef ); } } return null; } public static EdsError toEdsError( final NativeLong value ) { return CanonUtils.toEdsError( value.intValue() ); } public static EdsError toEdsError( final long value ) { return CanonUtils.toEdsError( value ); } public static EdsError toEdsError( final int value ) { final EdsError error = EdsError.enumOfValue( value ); if ( error != null ) { return error; } return EdsError.EDS_ERR_UNEXPECTED_EXCEPTION; } public static void release( final EdsBaseRef.ByReference ... objects ) { for ( final EdsBaseRef.ByReference obj : objects ) { if ( obj != null ) { CanonUtils.release( obj.getValue() ); } } } public static void release( final EdsBaseRef ... objects ) { for ( final EdsBaseRef obj : objects ) { if ( obj != null ) { CanonCamera.EDSDK.EdsRelease( obj ); } } } }

File
CanonUtils.java
Developer's decision
Version 1
Kind of conflict
Annotation
Comment
Method declaration
Chunk
Conflicting content
import edsdk.api.CanonCamera;
import edsdk.bindings.EdSdkLibrary;
<<<<<<< HEAD
import edsdk.bindings.EdSdkLibrary.EdsBaseRef;
import edsdk.bindings.EdSdkLibrary.EdsCameraListRef;
import edsdk.bindings.EdSdkLibrary.EdsCameraRef;
import edsdk.bindings.EdSdkLibrary.EdsDirectoryItemRef;
import edsdk.bindings.EdSdkLibrary.EdsObjectEventHandler;
import edsdk.utils.CanonConstants.EdsError;
=======
import edsdk.bindings.EdSdkLibrary.EdsObjectEventHandler;
import edsdk.bindings.EdSdkLibrary.EdsVoid;
import edsdk.bindings.EdSdkLibrary.__EdsObject;
>>>>>>> a0560a3efd37b3c0f25a1a05cff3f3a3c019985b
import edsdk.utils.CanonUtils;

/**
Solution content
import edsdk.api.CanonCamera;
import edsdk.bindings.EdSdkLibrary;
import edsdk.bindings.EdSdkLibrary.EdsBaseRef;
import edsdk.bindings.EdSdkLibrary.EdsCameraListRef;
import edsdk.bindings.EdSdkLibrary.EdsCameraRef;
import edsdk.bindings.EdSdkLibrary.EdsDirectoryItemRef;
import edsdk.bindings.EdSdkLibrary.EdsObjectEventHandler;
import edsdk.utils.CanonConstants.EdsError;
import edsdk.utils.CanonUtils;

/**
File
E01_Simple.java
Developer's decision
Version 1
Kind of conflict
Import
Chunk
Conflicting content
		debug( list ); 
		result = EDSDK.EdsGetCameraList( list ).intValue();		
 */
public class E01_Simple {

<<<<<<< HEAD
    public static void main( final String[] args ) throws InterruptedException {
        int result;

        result = CanonCamera.EDSDK.EdsInitializeSDK().intValue();
        E01_Simple.check( result );

        final EdsCameraListRef.ByReference list = new EdsCameraListRef.ByReference();
        E01_Simple.debug( list );
        result = CanonCamera.EDSDK.EdsGetCameraList( list ).intValue();
        E01_Simple.debug( list );
        E01_Simple.check( result );

        final NativeLongByReference outRef = new NativeLongByReference();
        result = CanonCamera.EDSDK.EdsGetChildCount( list.getValue(), outRef ).intValue();
        E01_Simple.check( result );
        System.out.println( "Cameras: " + outRef.getValue().longValue() );
        final long numCams = outRef.getValue().longValue();
        if ( numCams == 0 ) {
            System.err.println( "no camera found" );
        }

        final EdsCameraRef.ByReference camera = new EdsCameraRef.ByReference();
        E01_Simple.debug( camera );
        result = CanonCamera.EDSDK.EdsGetChildAtIndex( list.getValue(), new NativeLong( 0 ), camera ).intValue();
        E01_Simple.debug( camera );
        E01_Simple.check( result );

        final Pointer context = new Pointer( 0 );
        final EdsObjectEventHandler handler = new EdsObjectEventHandler() {

            @Override
            public NativeLong apply( final NativeLong inEvent,
                                     final EdsBaseRef inRef,
                                     final Pointer inContext ) {
                System.out.println( "Event!!!" + inEvent.doubleValue() + ", " +
                                    inContext );
                if ( inEvent.intValue() == 516 ) {
                    CanonUtils.download( new EdsDirectoryItemRef( inRef.getPointer() ), null, false );
                }
                return new NativeLong( -1 );
                //return -1;
            }
        };

        result = CanonCamera.EDSDK.EdsSetObjectEventHandler( camera.getValue(), new NativeLong( EdSdkLibrary.kEdsObjectEvent_All ), handler, context ).intValue();
        E01_Simple.check( result );

        result = CanonCamera.EDSDK.EdsOpenSession( camera.getValue() ).intValue();
        E01_Simple.check( result );

        // Do stuff here, like ... take an image...
        result = CanonCamera.EDSDK.EdsSendCommand( camera.getValue(), new NativeLong( EdSdkLibrary.kEdsCameraCommand_TakePicture ), new NativeLong( 0 ) ).intValue();
        E01_Simple.check( result );

        // Wait a little bit!
        E01_Simple.dispatchMessages();

        CanonCamera.EDSDK.EdsTerminateSDK();
    }

    public static void check( final int result ) {
        if ( result != EdSdkLibrary.EDS_ERR_OK ) {
            final EdsError err = CanonUtils.toEdsError( result );
            System.err.println( "Error " + err.value() + ": " + err.name() +
                                " - " + err.description() );
        }
    }

    public static void debug( final EdsBaseRef.ByReference ... obj ) {
        System.out.println( "----------------" );
        for ( final EdsBaseRef.ByReference o : obj ) {
            if ( o != null && o.getPointer() != null ) {
                System.out.println( o + ": " + o.getPointer().getShort( 0 ) );
                E01_Simple.debug( o.getValue() );
            }
        }
    }

    public static void debug( final EdsBaseRef ... obj ) {
        System.out.println( "----------------" );
        for ( final EdsBaseRef o : obj ) {
            if ( o != null && o.getPointer() != null ) {
                System.out.println( o + ": " + o.getPointer().getLong( 0 ) );
            }
        }
    }

    public static void dispatchMessages() {
        // This bit never returns from GetMessage
        int result = -1;
        final MSG msg = new MSG();

        while ( result != 0 ) {
            result = User32.INSTANCE.GetMessage( msg, null, 0, 0 );
            if ( result == -1 ) {
                System.err.println( "error in get message" );
                break;
            } else {
                User32.INSTANCE.TranslateMessage( msg );
                try {
                    User32.INSTANCE.DispatchMessage( msg );
                }
                catch ( final Error e ) {
                    e.printStackTrace();
                }
            }
        }

    }

}
=======
	public static EdSdkLibrary EDSDK = CanonCamera.EDSDK; 
	static final User32 lib = User32.INSTANCE;
	static final HMODULE hMod = Kernel32.INSTANCE.GetModuleHandle("Me");
	
	public static void main(String[] args) throws InterruptedException {
		int result = 0; 
		
		result = EDSDK.EdsInitializeSDK().intValue(); 
		check( result ); 
		
		__EdsObject list[] = new __EdsObject[1]; 
		debug( list ); 
		check( result ); 
		
		NativeLongByReference outRef = new NativeLongByReference(); 
		result = EDSDK.EdsGetChildCount( list[0], outRef ).intValue(); 
		check( result ); 
		System.out.println( "Cameras: " + outRef.getValue().longValue() );
		long numCams = outRef.getValue().longValue(); 
		if( numCams == 0 ){
			System.out.println( "no camera found" ); 
		}
		
		__EdsObject camera[] = new __EdsObject[1]; 
		debug( camera ); 
		result = EDSDK.EdsGetChildAtIndex( list[0], new NativeLong( 0 ), camera ).intValue(); 
		debug( camera ); 
		check( result ); 
		
		EdsVoid context = new EdsVoid( new Pointer( 0 ) );
		EdsObjectEventHandler handler = new EdsObjectEventHandler() {
			@Override
			public NativeLong apply(NativeLong inEvent, __EdsObject inRef, EdsVoid inContext) {
				System.out.println( "Event!!!" + inEvent.doubleValue() + ", " + inContext ); 
				if( inEvent.intValue() == 516 ){
					CanonUtils.download( inRef, null, true );
				}
				return new NativeLong( -1 );
				//return -1;
			}
		}; 
		
		EDSDK.EdsSetObjectEventHandler( camera[0], new NativeLong( EdSdkLibrary.kEdsObjectEvent_All ), handler, context );
		
		result = EDSDK.EdsOpenSession( camera[0] ).intValue(); 
		check( result ); 
		
		// Do stuff here, like ... take an image... 
		//result = EDSDK.EdsSendCommand( camera[0], new NativeLong( TestLibrary.kEdsCameraCommand_TakePicture ), new NativeLong( 0 ) ); 
		//check( result ); 
		
		// Wait a little bit! 
		dispatchMessages();
	}
	
	public static void check( int result ){
		if( result != EdSdkLibrary.EDS_ERR_OK ){
			System.out.println( "Error: " + CanonUtils.toString( result ) ); 
		}
	}
	
	public static void debug( __EdsObject[] obj ){
		System.out.println("----------------"); 
		for( __EdsObject o : obj ){
			if( o != null ){
				System.out.println( o + ": " + o.getPointer().getLong(0) );; 
			}
		}
	}

	public static void dispatchMessages() {
		// This bit never returns from GetMessage
		int result;
		MSG msg = new MSG();

		while ((result = lib.GetMessage(msg, null, 0, 0)) != 0) {

			if (result == -1) {
				System.err.println("error in get message");
				break;
			}

			else {
				lib.TranslateMessage(msg);
				try{lib.DispatchMessage(msg);}
				catch( Error e ){ e.printStackTrace(); }
			}
		}

	}
}
>>>>>>> a0560a3efd37b3c0f25a1a05cff3f3a3c019985b
Solution content
 */
public class E01_Simple {

    public static void main( final String[] args ) throws InterruptedException {
        int result;

        result = CanonCamera.EDSDK.EdsInitializeSDK().intValue();
        E01_Simple.check( result );

        final EdsCameraListRef.ByReference list = new EdsCameraListRef.ByReference();
        E01_Simple.debug( list );
        result = CanonCamera.EDSDK.EdsGetCameraList( list ).intValue();
        E01_Simple.debug( list );
        E01_Simple.check( result );

        final NativeLongByReference outRef = new NativeLongByReference();
        result = CanonCamera.EDSDK.EdsGetChildCount( list.getValue(), outRef ).intValue();
        E01_Simple.check( result );
        System.out.println( "Cameras: " + outRef.getValue().longValue() );
        final long numCams = outRef.getValue().longValue();
        if ( numCams == 0 ) {
            System.err.println( "no camera found" );
        }

        final EdsCameraRef.ByReference camera = new EdsCameraRef.ByReference();
        E01_Simple.debug( camera );
        result = CanonCamera.EDSDK.EdsGetChildAtIndex( list.getValue(), new NativeLong( 0 ), camera ).intValue();
        E01_Simple.debug( camera );
        E01_Simple.check( result );

        final Pointer context = new Pointer( 0 );
        final EdsObjectEventHandler handler = new EdsObjectEventHandler() {

            @Override
            public NativeLong apply( final NativeLong inEvent,
                                     final EdsBaseRef inRef,
                                     final Pointer inContext ) {
                System.out.println( "Event!!!" + inEvent.doubleValue() + ", " +
                                    inContext );
                if ( inEvent.intValue() == 516 ) {
                    CanonUtils.download( new EdsDirectoryItemRef( inRef.getPointer() ), null, false );
                }
                return new NativeLong( -1 );
                //return -1;
            }
        };

        result = CanonCamera.EDSDK.EdsSetObjectEventHandler( camera.getValue(), new NativeLong( EdSdkLibrary.kEdsObjectEvent_All ), handler, context ).intValue();
        E01_Simple.check( result );

        result = CanonCamera.EDSDK.EdsOpenSession( camera.getValue() ).intValue();
        E01_Simple.check( result );

        // Do stuff here, like ... take an image...
        result = CanonCamera.EDSDK.EdsSendCommand( camera.getValue(), new NativeLong( EdSdkLibrary.kEdsCameraCommand_TakePicture ), new NativeLong( 0 ) ).intValue();
        E01_Simple.check( result );

        // Wait a little bit!
        E01_Simple.dispatchMessages();

        CanonCamera.EDSDK.EdsTerminateSDK();
    }

    public static void check( final int result ) {
        if ( result != EdSdkLibrary.EDS_ERR_OK ) {
            final EdsError err = CanonUtils.toEdsError( result );
            System.err.println( "Error " + err.value() + ": " + err.name() +
                                " - " + err.description() );
        }
    }

    public static void debug( final EdsBaseRef.ByReference ... obj ) {
        System.out.println( "----------------" );
        for ( final EdsBaseRef.ByReference o : obj ) {
            if ( o != null && o.getPointer() != null ) {
                System.out.println( o + ": " + o.getPointer().getShort( 0 ) );
                E01_Simple.debug( o.getValue() );
            }
        }
    }

    public static void debug( final EdsBaseRef ... obj ) {
        System.out.println( "----------------" );
        for ( final EdsBaseRef o : obj ) {
            if ( o != null && o.getPointer() != null ) {
                System.out.println( o + ": " + o.getPointer().getLong( 0 ) );
            }
        }
    }

    public static void dispatchMessages() {
        // This bit never returns from GetMessage
        int result = -1;
        final MSG msg = new MSG();

        while ( result != 0 ) {
            result = User32.INSTANCE.GetMessage( msg, null, 0, 0 );
            if ( result == -1 ) {
                System.err.println( "error in get message" );
                break;
            } else {
                User32.INSTANCE.TranslateMessage( msg );
                try {
                    User32.INSTANCE.DispatchMessage( msg );
                }
                catch ( final Error e ) {
                    e.printStackTrace();
                }
            }
        }

    }

}
File
E01_Simple.java
Developer's decision
Version 1
Kind of conflict
Attribute
Method declaration
Method invocation
Chunk
Conflicting content
package gettingstarted;

import java.io.File;
<<<<<<< HEAD
import java.io.IOException;
=======

import edsdk.api.CanonCamera;
>>>>>>> a0560a3efd37b3c0f25a1a05cff3f3a3c019985b

import edsdk.api.CanonCamera;
import edsdk.utils.CanonConstants.EdsSaveTo;
Solution content
package gettingstarted;

import java.io.File;
import java.io.IOException;

import edsdk.api.CanonCamera;
import edsdk.utils.CanonConstants.EdsSaveTo;
File
E02_Simpler.java
Developer's decision
Version 1
Kind of conflict
Import
Chunk
Conflicting content
<<<<<<< HEAD

 * 
 */
public class E02_Simpler {
    public static void main( final String[] args ) throws InterruptedException, IOException {
        final CanonCamera camera = new CanonCamera();

        if ( camera.openSession() ) {
            final File[] photos = camera.shoot( EdsSaveTo.kEdsSaveTo_Host );

            if ( photos != null ) {
                for ( final File photo : photos ) {
                    if ( photo != null ) {
                        System.out.println( "Saved photo as: " +
                                            photo.getCanonicalPath() );
                    }
                }
            }

            camera.closeSession();
        }

        CanonCamera.close();
    }
}
=======
	public static void main(String[] args) throws InterruptedException {
		CanonCamera slr = new CanonCamera(); 
		slr.openSession();
		File file = slr.shoot().get();
		System.out.println( "Saved file as: " + file.getAbsolutePath() ); 
		slr.closeSession();
		
		CanonCamera.close(); 
	}
}
>>>>>>> a0560a3efd37b3c0f25a1a05cff3f3a3c019985b
Solution content
 * 
 */
public class E02_Simpler {

    public static void main( final String[] args ) throws InterruptedException, IOException {
        final CanonCamera camera = new CanonCamera();

        if ( camera.openSession() ) {
            final File[] photos = camera.shoot( EdsSaveTo.kEdsSaveTo_Host );

            if ( photos != null ) {
                for ( final File photo : photos ) {
                    if ( photo != null ) {
                        System.out.println( "Saved photo as: " +
                                            photo.getCanonicalPath() );
                    }
                }
            }

            camera.closeSession();
        }

        CanonCamera.close();
    }
}
File
E02_Simpler.java
Developer's decision
Version 1
Kind of conflict
Method declaration
Chunk
Conflicting content
 * 
 */
public class E03_Mixed {
<<<<<<< HEAD

    public static void main( final String[] args ) throws InterruptedException {
        final CanonCamera camera = new CanonCamera();
        if ( camera.openSession() ) {

            final boolean result = camera.executeNow( new CanonCommand() {

                @Override
                public void run() {
                    // Do your thing here, like bulb shooting, setting properties, 
                    // whatever you like! 
                    // 
                    // you have access to all edsdk methods using
                    // EDSDK.*
                    // Access to the above camera object using camera
                    // or if you need the edsObject that the camera is linked to 
                    // use camera.getEdsCamera()
                    //
                    // when you're done set the result that should be returned.
                    setResult( true );
                }
            } );

            // Now do something with the result
            if ( !result ) {
                System.out.println( "oh, it didn't work... " );
            }

            camera.closeSession();
        }

        CanonCamera.close();
    }
=======
	public static void main(String[] args) throws InterruptedException {
		CanonCamera camera = new CanonCamera(); 
		camera.openSession(); 
		
		boolean result = camera.executeNow( new CanonCommand(){
			@Override
			public void run() {
				// Do your thing here, like bulb shooting, setting properties, 
				// whatever you like! 
				// 
				// you have access to all edsdk methods using
				// EDSDK.*
				// Access to the above camera object using camera
				// or if you need the edsObject that the camera is linked to 
				// use camera.getEdsCamera()
				//
				// when you're done set the result that should be returned. 
				setResult( true ); 
			}
		}); 
		
		// Now do something with the result
		if( !result ){
			System.out.println( "oh, it didn't work... " ); 
		}
		
		camera.closeSession(); 
		CanonCamera.close(); 
	}
>>>>>>> a0560a3efd37b3c0f25a1a05cff3f3a3c019985b
}
Solution content
 * 
 */
public class E03_Mixed {

    public static void main( final String[] args ) throws InterruptedException {
        final CanonCamera camera = new CanonCamera();
        if ( camera.openSession() ) {

            final boolean result = camera.executeNow( new CanonCommand() {

                @Override
                public void run() {
                    // Do your thing here, like bulb shooting, setting properties, 
                    // whatever you like! 
                    // 
                    // you have access to all edsdk methods using
                    // EDSDK.*
                    // Access to the above camera object using camera
                    // or if you need the edsObject that the camera is linked to 
                    // use camera.getEdsCamera()
                    //
                    // when you're done set the result that should be returned.
                    setResult( true );
                }
            } );

            // Now do something with the result
            if ( !result ) {
                System.out.println( "oh, it didn't work... " );
            }

            camera.closeSession();
        }

        CanonCamera.close();
    }
}
File
E03_Mixed.java
Developer's decision
Version 1
Kind of conflict
Method declaration
Chunk
Conflicting content
<<<<<<< HEAD

public class E04_LiveView {
 * 
 */
    public static void main( final String[] args ) throws InterruptedException {
        final CanonCamera camera = new CanonCamera();
        if ( camera.openSession() ) {
            if ( camera.beginLiveView() ) {
                final JFrame frame = new JFrame( "Live view" );
                final JLabel label = new JLabel();
                frame.getContentPane().add( label, BorderLayout.CENTER );
                frame.setDefaultCloseOperation( WindowConstants.DO_NOTHING_ON_CLOSE );
                frame.addWindowListener( new WindowAdapter() {

                    @Override
                    public void windowClosing( final WindowEvent e ) {
                        camera.endLiveView();
                        camera.closeSession();
                        CanonCamera.close();
                        System.exit( 0 );
                    }
                } );
                frame.setVisible( true );

                while ( true ) {
                    Thread.sleep( 50 );
                    final BufferedImage image = camera.downloadLiveView();
                    if ( image != null ) {
                        label.setIcon( new ImageIcon( image ) );
                        frame.pack();
                        image.flush();
                    }

                }
            }
            camera.closeSession();
        }
        CanonCamera.close();
        System.exit( 0 );
    }
=======
	public static void main(String[] args) throws InterruptedException {
		final CanonCamera cam = new CanonCamera(); 
		cam.openSession(); 
		cam.beginLiveView(); 
		
		JFrame frame = new JFrame( "Live view" ); 
		JLabel label = new JLabel(); 
		frame.getContentPane().add( label, BorderLayout.CENTER ); 
		frame.setDefaultCloseOperation( JFrame.DO_NOTHING_ON_CLOSE ); 
		frame.addWindowListener( new WindowAdapter() {
			@Override
			public void windowClosing(WindowEvent e) {
				cam.endLiveView(); 
				cam.closeSession(); 
				CanonCamera.close(); 
				System.exit( 0 ); 
			} 
		}); 
		frame.setVisible( true ); 
		
		while( true ){
			Thread.sleep( 50 ); 
			BufferedImage image = cam.downloadLiveView().get(); 
			if( image != null ){
				label.setIcon( new ImageIcon( image ) ); 
				frame.pack(); 
				image.flush(); 
			}
		}
	}
>>>>>>> a0560a3efd37b3c0f25a1a05cff3f3a3c019985b
}
Solution content
 * 
 */
public class E04_LiveView {

    public static void main( final String[] args ) throws InterruptedException {
        final CanonCamera camera = new CanonCamera();
        if ( camera.openSession() ) {
            if ( camera.beginLiveView() ) {
                final JFrame frame = new JFrame( "Live view" );
                final JLabel label = new JLabel();
                frame.getContentPane().add( label, BorderLayout.CENTER );
                frame.setDefaultCloseOperation( WindowConstants.DO_NOTHING_ON_CLOSE );
                frame.addWindowListener( new WindowAdapter() {

                    @Override
                    public void windowClosing( final WindowEvent e ) {
                        camera.endLiveView();
                        camera.closeSession();
                        CanonCamera.close();
                        System.exit( 0 );
                    }
                } );
                frame.setVisible( true );

                while ( true ) {
                    Thread.sleep( 50 );
                    final BufferedImage image = camera.downloadLiveView();
                    if ( image != null ) {
                        label.setIcon( new ImageIcon( image ) );
                        frame.pack();
                        image.flush();
                    }

                }
            }
            camera.closeSession();
        }
        CanonCamera.close();
        System.exit( 0 );
    }
}
File
E04_LiveView.java
Developer's decision
Version 1
Kind of conflict
Method declaration
Chunk
Conflicting content
        gbc.gridx = 1;
<<<<<<< HEAD
package gettingstarted;

import java.awt.GridBagConstraints;
import java.awt.GridBagLayout;
import java.awt.Insets;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.io.File;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.LinkedList;

import javax.swing.BorderFactory;
import javax.swing.JComboBox;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JPanel;

import edsdk.api.CanonCamera;
import edsdk.api.commands.ShootCommand;
import edsdk.utils.CanonConstants.DescriptiveEnum;
import edsdk.utils.CanonConstants.EdsAv;
import edsdk.utils.CanonConstants.EdsISOSpeed;
import edsdk.utils.CanonConstants.EdsSaveTo;
import edsdk.utils.CanonConstants.EdsTv;

/**
 * An example of taking multiple sequential shots.
 * 
 * Copyright © 2014 Hansi Raber , Ananta Palani
 * 
 * This work is free. You can redistribute it and/or modify it under the
 * terms of the Do What The Fuck You Want To Public License, Version 2,
 * as published by Sam Hocevar. See the COPYING file for more details.
 * 
 * @author hansi
 * @author Ananta Palani
 * 
 */
public class E05_Timelapse {

    public static void main( final String[] args ) throws InterruptedException {
        //Native.setProtected( true );
        final CanonCamera camera = new CanonCamera();
        if ( camera.openSession() ) {

            E05_Timelapse.createUI( camera );

            while ( true ) {
                System.out.println( "=========================================" );
                final long level = camera.getBatteryLevel();
                if ( level != 0xffffffff ) {
                    System.out.println( "Battery Level = " + level );
                }

                camera.execute( new ShootCommand( EdsSaveTo.kEdsSaveTo_Host, 20, E05_Timelapse.filename() ) );

                try {
                    Thread.sleep( 15000 );
                }
                catch ( final InterruptedException e ) {
                    // TODO Auto-generated catch block
                    e.printStackTrace();
                }
            }

        }

        CanonCamera.close();
    }

    public static File filename() {
        return new File( "images\\" +
                         new SimpleDateFormat( "yyyy\\MM\\dd\\HH-mm-ss" ).format( new Date() ) +
                         ".jpg" );
    }

    private static void createUI( final CanonCamera camera ) {
        final JFrame frame = new JFrame();
        final JPanel content = new JPanel( new GridBagLayout() );
        content.setBorder( BorderFactory.createEmptyBorder( 10, 10, 10, 10 ) );
        final GridBagConstraints gbc = new GridBagConstraints();

        gbc.anchor = GridBagConstraints.EAST;
        gbc.fill = GridBagConstraints.HORIZONTAL;
        gbc.insets = new Insets( 3, 3, 3, 3 );
        gbc.gridy = 1;

        final EdsTv currentShutterSpeed = camera.getShutterSpeed();
        final EdsAv currentApertureValue = camera.getApertureValue();
        final EdsISOSpeed currentISOSpeed = camera.getISOSpeed();

        final EdsTv[] availableShutterSpeeds = camera.getAvailableShutterSpeeds();
        final EdsAv[] availableApertureValues = camera.getAvailableApertureValues();
        final EdsISOSpeed[] availableISOSpeeds = camera.getAvailableISOSpeeds();

        E05_Timelapse.addCombobox( content, gbc, "Shutter Speed", availableShutterSpeeds, currentShutterSpeed, new Callback() {

            @Override
            public void call( final String name ) {
                camera.setShutterSpeed( EdsTv.enumOfDescription( name ) );
            }
        } );
        E05_Timelapse.addCombobox( content, gbc, "Aperture", availableApertureValues, currentApertureValue, new Callback() {

            @Override
            public void call( final String name ) {
                camera.setApertureValue( EdsAv.enumOfDescription( name ) );
            }
        } );
        E05_Timelapse.addCombobox( content, gbc, "ISO", availableISOSpeeds, currentISOSpeed, new Callback() {

            @Override
            public void call( final String name ) {
                camera.setISOSpeed( EdsISOSpeed.enumOfDescription( name ) );
            }
        } );

        frame.setDefaultCloseOperation( JFrame.EXIT_ON_CLOSE );
        frame.setContentPane( content );
        frame.setSize( 500, 400 );
        frame.setVisible( true );
    }

    private static void addCombobox( final JPanel content,
                                     final GridBagConstraints gbc,
                                     final String label,
                                     final DescriptiveEnum[] enums,
                                     final DescriptiveEnum selected,
                                     final Callback callback ) {
        gbc.gridx = 0;
        gbc.weightx = 0;
        content.add( new JLabel( label ), gbc );
        gbc.weightx = 1;
        // find the items ... 
        if ( enums == null ) {
            content.add( new JLabel( "not available with current mode / lens" ), gbc );
        } else {
            final LinkedList items = new LinkedList();
            for ( final DescriptiveEnum e : enums ) {
                items.add( e.description() );
            }

            // In Java 6 JCombBox is not generic, so to compile in Java > 6 have to do this
            @SuppressWarnings( { "rawtypes", "unchecked" } )
            final JComboBox combo = new JComboBox( items.toArray( new String[] {} ) );
            combo.setSelectedItem( selected.description() );
            combo.addActionListener( new ActionListener() {

                @Override
                public void actionPerformed( final ActionEvent event ) {
                    callback.call( combo.getSelectedItem().toString() );
                }
            } );
            content.add( combo, gbc );
        }

        gbc.gridy++;
    }

    interface Callback {

        public void call( String name );
    }
}
=======
package gettingstarted;

import static edsdk.bindings.EdSdkLibrary.kEdsPropID_Av;
import static edsdk.bindings.EdSdkLibrary.kEdsPropID_BatteryLevel;
import static edsdk.bindings.EdSdkLibrary.kEdsPropID_ISOSpeed;
import static edsdk.bindings.EdSdkLibrary.kEdsPropID_Tv;
import static edsdk.utils.CanonConstants.Av_7_1;
import static edsdk.utils.CanonConstants.ISO_800;
import static edsdk.utils.CanonConstants.Tv_1by100;

import java.awt.GridBagConstraints;
import java.awt.GridBagLayout;
import java.awt.Insets;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.io.File;
import java.lang.reflect.Field;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.LinkedList;

import javax.swing.BorderFactory;
import javax.swing.JComboBox;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JPanel;

import edsdk.api.CanonCamera;
import edsdk.api.commands.ShootCommand;
import edsdk.utils.CanonConstants;

public class E05_Timelapse {

	public static void main(String[] args) throws InterruptedException {
		//Native.setProtected( true ); 
		CanonCamera camera = new CanonCamera();
		camera.openSession(); 
		camera.setProperty( kEdsPropID_Av, Av_7_1 ); 
		camera.setProperty( kEdsPropID_Tv, Tv_1by100 ); 
		camera.setProperty( kEdsPropID_ISOSpeed, ISO_800 ); 

		createUI( camera ); 
		
		while( true ){
			System.out.println( "=========================================" ); 
			System.out.println( "Battery Level = " + camera.getProperty( kEdsPropID_BatteryLevel ) ); 
			camera.execute( new ShootCommand( filename() ) ); 

			try {
				Thread.sleep( 15000 );
			}
			catch (InterruptedException e) {
				// TODO Auto-generated catch block
				e.printStackTrace();
			} 
		}
		

	}
	
	public static File filename(){
		return new File( "images\\" + new SimpleDateFormat( "yyyy\\MM\\dd\\HH-mm-ss" ).format( new Date() ) + ".jpg" ); 
	}
	
	
	
	private static void createUI( final CanonCamera camera ){
		JFrame frame = new JFrame(); 
		JPanel content = new JPanel( new GridBagLayout() ); 
		content.setBorder( BorderFactory.createEmptyBorder( 10, 10, 10, 10 ) ); 
		GridBagConstraints gbc = new GridBagConstraints(); 
		
		gbc.anchor = GridBagConstraints.EAST; 
		gbc.fill = GridBagConstraints.HORIZONTAL; 
		gbc.insets = new Insets( 3, 3, 3, 3 ); 
		gbc.gridy = 1; 
		
		addCombobox( content, gbc, "Shutter Speed", "Tv_", new Callback(){
			public void call( int value ){
				camera.setProperty( kEdsPropID_Tv, value ); 
			}
		}); 
		addCombobox( content, gbc, "Aperature", "Av_", new Callback(){
			public void call( int value ){
				camera.setProperty( kEdsPropID_Av, value ); 
			}
		});
		addCombobox( content, gbc, "Iso", "ISO_", new Callback(){
			public void call( int value ){
				camera.setProperty( kEdsPropID_ISOSpeed, value ); 
			}
		});

		
		
		frame.setDefaultCloseOperation( JFrame.EXIT_ON_CLOSE ); 
		frame.setContentPane( content ); 
		frame.setSize( 500, 400 ); 
		frame.setVisible( true ); 
	}
	
	
	private static void addCombobox( JPanel content, GridBagConstraints gbc, String label, String prefix, final Callback callback ){
		gbc.gridx = 0; 
		gbc.weightx = 0; 
		content.add( new JLabel( label ), gbc ); 
		
		gbc.gridx = 1; 
		gbc.weightx = 1; 
		// find the items ... 
	
		LinkedList items = new LinkedList();
		for( Field field : CanonConstants.class.getDeclaredFields() ){
			if( field.getName().startsWith( prefix ) ){
				items.add( field.getName() ); 
			}
		}
		
		final JComboBox combo = new JComboBox( items.toArray( new String[]{} ) );
		combo.addActionListener( new ActionListener(){
			@Override
			public void actionPerformed( ActionEvent event ) {
				try {
					int value = CanonConstants.class.getDeclaredField( combo.getSelectedItem().toString() ).getInt( null );
					callback.call( value ); 
				} catch (IllegalArgumentException e) {
					// TODO Auto-generated catch block
					e.printStackTrace();
				} catch (SecurityException e) {
					// TODO Auto-generated catch block
					e.printStackTrace();
				} catch (IllegalAccessException e) {
					// TODO Auto-generated catch block
					e.printStackTrace();
				} catch (NoSuchFieldException e) {
					// TODO Auto-generated catch block
					e.printStackTrace();
				} 
			}
		}); 
		gbc.gridx = 1; 
		gbc.weightx = 1; 
		content.add( combo, gbc ); 
		
		gbc.gridy ++; 
	}
	
	interface Callback{
		public void call( int value ); 
	}
}
>>>>>>> a0560a3efd37b3c0f25a1a05cff3f3a3c019985b
Solution content
package gettingstarted;

import java.awt.GridBagConstraints;
import java.awt.GridBagLayout;
import java.awt.Insets;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.io.File;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.LinkedList;

import javax.swing.BorderFactory;
import javax.swing.JComboBox;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JPanel;

import edsdk.api.CanonCamera;
import edsdk.api.commands.ShootCommand;
import edsdk.utils.CanonConstants.DescriptiveEnum;
import edsdk.utils.CanonConstants.EdsAv;
import edsdk.utils.CanonConstants.EdsISOSpeed;
import edsdk.utils.CanonConstants.EdsSaveTo;
import edsdk.utils.CanonConstants.EdsTv;

/**
 * An example of taking multiple sequential shots.
 * 
 * Copyright © 2014 Hansi Raber , Ananta Palani
 * 
 * This work is free. You can redistribute it and/or modify it under the
 * terms of the Do What The Fuck You Want To Public License, Version 2,
 * as published by Sam Hocevar. See the COPYING file for more details.
 * 
 * @author hansi
 * @author Ananta Palani
 * 
 */
public class E05_Timelapse {

    public static void main( final String[] args ) throws InterruptedException {
        //Native.setProtected( true );
        final CanonCamera camera = new CanonCamera();
        if ( camera.openSession() ) {

            E05_Timelapse.createUI( camera );

            while ( true ) {
                System.out.println( "=========================================" );
                final long level = camera.getBatteryLevel();
                if ( level != 0xffffffff ) {
                    System.out.println( "Battery Level = " + level );
                }

                camera.execute( new ShootCommand( EdsSaveTo.kEdsSaveTo_Host, 20, E05_Timelapse.filename() ) );

                try {
                    Thread.sleep( 15000 );
                }
                catch ( final InterruptedException e ) {
                    // TODO Auto-generated catch block
                    e.printStackTrace();
                }
            }

        }

        CanonCamera.close();
    }

    public static File filename() {
        return new File( "images\\" +
                         new SimpleDateFormat( "yyyy\\MM\\dd\\HH-mm-ss" ).format( new Date() ) +
                         ".jpg" );
    }

    private static void createUI( final CanonCamera camera ) {
        final JFrame frame = new JFrame();
        final JPanel content = new JPanel( new GridBagLayout() );
        content.setBorder( BorderFactory.createEmptyBorder( 10, 10, 10, 10 ) );
        final GridBagConstraints gbc = new GridBagConstraints();

        gbc.anchor = GridBagConstraints.EAST;
        gbc.fill = GridBagConstraints.HORIZONTAL;
        gbc.insets = new Insets( 3, 3, 3, 3 );
        gbc.gridy = 1;

        final EdsTv currentShutterSpeed = camera.getShutterSpeed();
        final EdsAv currentApertureValue = camera.getApertureValue();
        final EdsISOSpeed currentISOSpeed = camera.getISOSpeed();

        final EdsTv[] availableShutterSpeeds = camera.getAvailableShutterSpeeds();
        final EdsAv[] availableApertureValues = camera.getAvailableApertureValues();
        final EdsISOSpeed[] availableISOSpeeds = camera.getAvailableISOSpeeds();

        E05_Timelapse.addCombobox( content, gbc, "Shutter Speed", availableShutterSpeeds, currentShutterSpeed, new Callback() {

            @Override
            public void call( final String name ) {
                camera.setShutterSpeed( EdsTv.enumOfDescription( name ) );
            }
        } );
        E05_Timelapse.addCombobox( content, gbc, "Aperture", availableApertureValues, currentApertureValue, new Callback() {

            @Override
            public void call( final String name ) {
                camera.setApertureValue( EdsAv.enumOfDescription( name ) );
            }
        } );
        E05_Timelapse.addCombobox( content, gbc, "ISO", availableISOSpeeds, currentISOSpeed, new Callback() {

            @Override
            public void call( final String name ) {
                camera.setISOSpeed( EdsISOSpeed.enumOfDescription( name ) );
            }
        } );

        frame.setDefaultCloseOperation( JFrame.EXIT_ON_CLOSE );
        frame.setContentPane( content );
        frame.setSize( 500, 400 );
        frame.setVisible( true );
    }

    private static void addCombobox( final JPanel content,
                                     final GridBagConstraints gbc,
                                     final String label,
                                     final DescriptiveEnum[] enums,
                                     final DescriptiveEnum selected,
                                     final Callback callback ) {
        gbc.gridx = 0;
        gbc.weightx = 0;
        content.add( new JLabel( label ), gbc );

        gbc.gridx = 1;
        gbc.weightx = 1;
        // find the items ... 
        if ( enums == null ) {
            content.add( new JLabel( "not available with current mode / lens" ), gbc );
        } else {
            final LinkedList items = new LinkedList();
            for ( final DescriptiveEnum e : enums ) {
                items.add( e.description() );
            }

            // In Java 6 JCombBox is not generic, so to compile in Java > 6 have to do this
            @SuppressWarnings( { "rawtypes", "unchecked" } )
            final JComboBox combo = new JComboBox( items.toArray( new String[] {} ) );
            combo.setSelectedItem( selected.description() );
            combo.addActionListener( new ActionListener() {

                @Override
                public void actionPerformed( final ActionEvent event ) {
                    callback.call( combo.getSelectedItem().toString() );
                }
            } );
            content.add( combo, gbc );
        }

        gbc.gridy++;
    }

    interface Callback {

        public void call( String name );
    }
}
File
E05_Timelapse.java
Developer's decision
Version 1
Kind of conflict
Class declaration
Comment
Import
Package declaration