Examples of EdsDataType


Examples of edsdk.utils.CanonConstants.EdsDataType

                                    baseref.getClass().getSimpleName() );
                System.out.println( "---------------------------------------" );
                for ( final EdsPropertyID id : EdsPropertyID.values() ) {
                    final long size = CanonUtils.getPropertySize( baseref, id );

                    final EdsDataType type = CanonUtils.getPropertyType( baseref, id );

                    if ( size > -1 || !hideNegativeSizeProperties ) {
                        System.out.println( id.name() );
                        System.out.println( "  Size: " + size );
                        System.out.println( "  Type: " + type.description() );
                        if ( size == -1 &&
                             type.equals( EdsDataType.kEdsDataType_Unknown ) ) {
                            System.out.println( id.name() +
                                                " - VALUE NOT AVAILABLE ON THIS CAMERA AND/OR WITH CURRENT SETTINGS" );
                        } else {
                            final Object value;
                            switch ( type ) {
                                case kEdsDataType_String: {
                                    final String data = CanonUtils.getPropertyDataAdvanced( baseref, id );
                                    value = data;
                                    break;
                                }
                                case kEdsDataType_Rational: {
                                    final EdsRational struct = CanonUtils.getPropertyDataAdvanced( baseref, id );
                                    value = struct;
                                    break;
                                }
                                case kEdsDataType_Point: {
                                    final EdsPoint struct = CanonUtils.getPropertyDataAdvanced( baseref, id );
                                    value = struct;
                                    break;
                                }
                                case kEdsDataType_Rect: {
                                    final EdsRect struct = CanonUtils.getPropertyDataAdvanced( baseref, id );
                                    value = struct;
                                    break;
                                }
                                case kEdsDataType_Time: {
                                    final EdsTime struct = CanonUtils.getPropertyDataAdvanced( baseref, id );
                                    value = struct;
                                    break;
                                }
                                case kEdsDataType_FocusInfo: {
                                    final EdsFocusInfo struct = CanonUtils.getPropertyDataAdvanced( baseref, id );
                                    value = struct;
                                    break;
                                }
                                case kEdsDataType_PictureStyleDesc: {
                                    final EdsPictureStyleDesc struct = CanonUtils.getPropertyDataAdvanced( baseref, id );
                                    value = struct;
                                    break;
                                }
                                case kEdsDataType_ByteBlock:
                                case kEdsDataType_Int8_Array:
                                case kEdsDataType_UInt8_Array:
                                case kEdsDataType_Int16_Array:
                                case kEdsDataType_UInt16_Array:
                                case kEdsDataType_Int32_Array:
                                case kEdsDataType_UInt32_Array: {
                                    final int[] array = CanonUtils.getPropertyDataAdvanced( baseref, id );
                                    value = array;
                                    break;
                                }
                                default:
                                    value = Long.valueOf( CanonUtils.getPropertyData( baseref, id ) );
                            }
                            System.out.println( " Value: " +
                                                Test.toString( value ) );
                        }
                    }
                }
                System.out.println( "\n" );
            }

            //TEST READING CUSTOM FUNCTIONS
            System.out.println( "Custom Functions" );
            System.out.println( "---------------------------------------" );
            for ( int i = -10000; i < 10000; i++ ) {
                final long size = CanonUtils.getPropertySize( camera.getEdsCamera(), EdsPropertyID.kEdsPropID_CFn, i );

                final EdsDataType type = CanonUtils.getPropertyType( camera.getEdsCamera(), EdsPropertyID.kEdsPropID_CFn, i );

                if ( size > -1 || !hideNegativeSizeCustomFunctions ) {
                    System.out.println( "Number: " + i + " (0x" +
                                        Integer.toHexString( i ) + ")" );
                    System.out.println( "  Type: " + type.description() );
                    System.out.println( "  Size: " + size );
                    if ( size == -1 &&
                         type.equals( EdsDataType.kEdsDataType_Unknown ) ) {
                        System.out.println( " VALUE NOT AVAILABLE ON THIS CAMERA AND/OR WITH CURRENT SETTINGS" );
                    } else {
                        final Long value = CanonUtils.getPropertyData( camera.getEdsCamera(), EdsPropertyID.kEdsPropID_CFn, i );
                        System.out.println( " Value: " + value );
                        final EdsCustomFunction e = EdsCustomFunction.enumOfValue( i );
                        if ( e != null ) {
                            System.out.println( " Known: Yes, " + e.name() +
                                                " (" + e.description() + ")" );
                        } else {
                            System.out.println( " Known: NO" );
                        }
                    }
                }
            }
            System.out.println( "\n" );

            if ( liverefs != null ) {
                CanonUtils.release( liverefs );
            }

            //TEST GETTERS FROM CanonCamera
            System.out.println( "Property Getters in CanonCamera" );
            System.out.println( "---------------------------------------" );
            final Method[] methods = camera.getClass().getMethods();
            for ( final Method method : methods ) {
                if ( method.getName().startsWith( "get" ) &&
                     method.getParameterTypes().length == 0 ) {
                    System.out.println( "Trying " + method.getName() );
                    try {
                        final Object o = method.invoke( camera, (Object[]) null );
                        System.out.println( " Result: " + Test.toString( o ) );
                    }
                    catch ( final IllegalAccessException e ) {
                        // TODO Auto-generated catch block
                        e.printStackTrace();
                    }
                    catch ( final IllegalArgumentException e ) {
                        // TODO Auto-generated catch block
                        e.printStackTrace();
                    }
                    catch ( final InvocationTargetException e ) {
                        // TODO Auto-generated catch block
                        e.printStackTrace();
                    }
                }
            }
            System.out.println( "\n\n" );

            //TEST CUSTOM FUNCTION FROM CanonCamera
            System.out.println( "EdsCustomFunction with CanonCamera.getCustomFunction" );
            System.out.println( "----------------------------------------------------" );
            for ( final EdsCustomFunction e : EdsCustomFunction.values() ) {
                System.out.println( "\nTrying " + e.description() + " (" +
                                    e.name() + ")" );
                final Long result = camera.getCustomFunction( e );
                System.out.println( "    Value: " + Test.toString( result ) );
            }
            System.out.println( "\n" );

            //TEST FOR MISSING EdsPropID CONSTANTS
            System.out.println( "Testing if its possible to get values from the camera for undefined property IDs from 0x0 to 0xFFFF" );
            System.out.println( "----------------------------------------------------" );
            for ( int i = 0; i < 0xFFFF; i++ ) {
                if ( null == EdsPropertyID.enumOfValue( i ) ) {
                    final int bufferSize = 1;
                    final IntBuffer type = IntBuffer.allocate( bufferSize );
                    final NativeLongByReference number = new NativeLongByReference( new NativeLong( bufferSize ) );
                    EdsError err = CanonUtils.toEdsError( CanonCamera.EDSDK.EdsGetPropertySize( camera.getEdsCamera(), new NativeLong( i ), new NativeLong( 0 ), type, number ) );
                    if ( !err.equals( EdsError.EDS_ERR_PROPERTIES_UNAVAILABLE ) ) {
                        System.out.println( i + " (0x" +
                                            Integer.toHexString( i ) + "): " +
                                            err.description() );
                    }
                    if ( err == EdsError.EDS_ERR_OK ) {
                        final int size = (int) number.getValue().longValue();
                        final EdsDataType edsType = EdsDataType.enumOfValue( type.get( 0 ) );
                        if ( size > -1 ) {
                            if ( edsType == null ||
                                 edsType.equals( EdsDataType.kEdsDataType_Unknown ) ) {
                                System.out.println( "WARNING: size is greater than -1 (" +
                                                    size +
                                                    "), but edsType is unknown!" );
                            } else {
                                final Memory memory = new Memory( size > 0
                                                                          ? size
                                                                          : 1 );
                                err = CanonUtils.toEdsError( CanonCamera.EDSDK.EdsGetPropertyData( camera.getEdsCamera(), new NativeLong( i ), new NativeLong( 0 ), new NativeLong( size ), memory ) );
                                if ( err == EdsError.EDS_ERR_OK ) {
                                    if ( edsType.equals( EdsDataType.kEdsDataType_Int32 ) ||
                                         edsType.equals( EdsDataType.kEdsDataType_UInt32 ) ) {
                                        System.out.println( "    property: " +
                                                            i +
                                                            " (0x" +
                                                            Integer.toHexString( i ) +
                                                            "), value: " +
                                                            memory.getNativeLong( 0 ) +
                                                            ", data type: " +
                                                            edsType.description() +
                                                            ", size: " + size );
                                    } else if ( edsType.equals( EdsDataType.kEdsDataType_String ) ) {
                                        System.out.println( "    property: " +
                                                            i +
                                                            " (0x" +
                                                            Integer.toHexString( i ) +
                                                            "), value: " +
                                                            memory.getString( 0 ) +
                                                            ", data type: " +
                                                            edsType.description() +
                                                            ", size: " + size );
                                    } else {
                                        System.out.println( "    property: " +
                                                            i +
                                                            " (0x" +
                                                            Integer.toHexString( i ) +
                                                            "), value: NOT SUPPORTED, data type: " +
                                                            edsType.description() +
                                                            ", size: " + size );
                                    }
                                }
                            }
                        }
View Full Code Here

Examples of edsdk.utils.CanonConstants.EdsDataType

    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 );
    }
View Full Code Here

Examples of edsdk.utils.CanonConstants.EdsDataType

    public static <T> 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 " +
View Full Code Here

Examples of edsdk.utils.CanonConstants.EdsDataType

        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;
            }
        }
View Full Code Here

Examples of edsdk.utils.CanonConstants.EdsDataType

                }
            } else {
                baseRef = camera.getEdsCamera();
            }

            final EdsDataType type = CanonUtils.getPropertyType( baseRef, property, param );

            EdsError err = EdsError.EDS_ERR_DEVICE_BUSY;
            int retries = 0;
            while ( retries < busyRetryCount &&
                    err == EdsError.EDS_ERR_DEVICE_BUSY ) {
                //TODO: it would be better to use the actual error from CanonUtils.getPropertyType(), but in testing a valid value was always returned if something was supported
                err = EdsError.EDS_ERR_NOT_SUPPORTED;
                switch ( type ) {
                    case kEdsDataType_Int32: //EdsInt32
                    case kEdsDataType_UInt32: { //EdsUInt32
                        final long longValue;

                        if ( Boolean.class.isAssignableFrom( klass ) ) {
                            // Boolean
                            longValue = (Boolean) value ? 1l : 0l;
                        } else if ( DescriptiveEnum.class.isAssignableFrom( klass ) ) {
                            // DescriptiveEnum
                            longValue = ( (DescriptiveEnum<? extends Number>) value ).value().longValue();
                        } else {
                            // Long
                            longValue = (Long) value;
                        }

                        err = CanonUtils.setPropertyData( baseRef, property, param, longValue );
                        break;
                    }
                    case kEdsDataType_String: //EdsChar[]
                    case kEdsDataType_Point: //EdsPoint
                    case kEdsDataType_Rect: //EdsRect
                    case kEdsDataType_Time: //EdsTime
                    case kEdsDataType_FocusInfo: //EdsFocusInfo
                    case kEdsDataType_PictureStyleDesc: { //EdsPictureStyleDesc
                        err = CanonUtils.setPropertyDataAdvanced( baseRef, property, param, value );
                        break;
                    }
                    case kEdsDataType_ByteBlock: //EdsUInt32[]
                    case kEdsDataType_Int32_Array: //EdsInt32[]
                    case kEdsDataType_UInt32_Array: { //EdsUInt32[]
                        final int[] array;

                        if ( DescriptiveEnum[].class.isAssignableFrom( klass ) ) {
                            // DescriptiveEnum[]
                            final DescriptiveEnum<? extends Number>[] valueArray = (DescriptiveEnum<? extends Number>[]) value;
                            array = new int[valueArray.length];
                            for ( int i = 0; i < valueArray.length; i++ ) {
                                array[i] = valueArray[i].value().intValue();
                            }
                        } else if ( DescriptiveEnum.class.isAssignableFrom( klass ) ) {
                            // DescriptiveEnum
                            array = new int[] { ( (DescriptiveEnum<? extends Number>) value ).value().intValue() };
                        } else if ( EdsRect.class.isAssignableFrom( klass ) ) {
                            // EdsRect
                            final EdsRect edsRect = (EdsRect) value;
                            array = new int[] { edsRect.point.x.intValue(),
                                               edsRect.point.y.intValue(),
                                               edsRect.size.width.intValue(),
                                               edsRect.size.height.intValue() };
                        } else if ( EdsSize.class.isAssignableFrom( klass ) ) {
                            // EdsSize
                            final EdsSize edsSize = (EdsSize) value;
                            array = new int[] { edsSize.width.intValue(),
                                               edsSize.height.intValue() };
                        } else {
                            // int[]
                            array = (int[]) value;
                        }

                        err = CanonUtils.setPropertyDataAdvanced( baseRef, property, param, array );
                        break;
                    }
                    default:
                        System.err.println( type.description() +
                                            " (" +
                                            type.name() +
                                            ") is not currently supported by SetPropertyCommand. Likely this camera does not support property " +
                                            property.name() +
                                            " in the current mode or at all." );

                        //                    throw new IllegalStateException( type.description() + " (" +
View Full Code Here

Examples of edsdk.utils.CanonConstants.EdsDataType

                }
            } else {
                baseRef = camera.getEdsCamera();
            }

            final EdsDataType type = CanonUtils.getPropertyType( baseRef, property, param );

            T result = null;
            switch ( type ) {
                case kEdsDataType_Int32: //EdsInt32
                case kEdsDataType_UInt32: { //EdsUInt32
                    final Long data = CanonUtils.getPropertyData( baseRef, property, param );

                    if ( data != null ) {
                        if ( klass != null &&
                             Boolean.class.isAssignableFrom( klass ) ) {
                            // Boolean
                            result = (T) Boolean.valueOf( data == 1l );
                        } else if ( klass != null &&
                                    DescriptiveEnum.class.isAssignableFrom( klass ) ) {
                            // DescriptiveEnum
                            result = (T) CanonConstants.enumOfValue( (Class<? extends DescriptiveEnum<?>>) klass, data.intValue() );
                        } else {
                            // Long
                            result = (T) Long.valueOf( data );
                        }
                    }

                    break;
                }
                case kEdsDataType_String: { //EdsChar[]
                    final String data = CanonUtils.getPropertyDataAdvanced( baseRef, property, param );
                    result = (T) data;
                    break;
                }
                case kEdsDataType_Point: { //EdsPoint
                    final EdsPoint data = CanonUtils.getPropertyDataAdvanced( baseRef, property, param );
                    result = (T) data;
                    break;
                }
                case kEdsDataType_Rect: { //EdsRect
                    final EdsRect data = CanonUtils.getPropertyDataAdvanced( baseRef, property, param );
                    result = (T) data;
                    break;
                }
                case kEdsDataType_Time: { //EdsTime
                    final EdsTime data = CanonUtils.getPropertyDataAdvanced( baseRef, property, param );
                    result = (T) data;
                    break;
                }
                case kEdsDataType_FocusInfo: { //EdsFocusInfo
                    final EdsFocusInfo data = CanonUtils.getPropertyDataAdvanced( baseRef, property, param );
                    result = (T) data;
                    break;
                }
                case kEdsDataType_PictureStyleDesc: { //EdsPictureStyleDesc
                    final EdsPictureStyleDesc data = CanonUtils.getPropertyDataAdvanced( baseRef, property, param );
                    result = (T) data;
                    break;
                }
                case kEdsDataType_ByteBlock: //EdsUInt32[]
                case kEdsDataType_Int32_Array: //EdsInt32[]
                case kEdsDataType_UInt32_Array: { //EdsUInt32[]
                    final int[] data = CanonUtils.getPropertyDataAdvanced( baseRef, property, param );

                    if ( data != null ) {
                        if ( klass != null &&
                             DescriptiveEnum[].class.isAssignableFrom( klass ) ) {
                            // DescriptiveEnum[]
                            final DescriptiveEnum<?>[] array = (DescriptiveEnum<?>[]) Array.newInstance( klass.getComponentType(), data.length );
                            for ( int i = 0; i < data.length; i++ ) {
                                array[i] = CanonConstants.enumOfValue( (Class<? extends DescriptiveEnum<?>>) klass.getComponentType(), data[i] );
                            }
                            result = (T) array;
                        } else if ( klass != null &&
                                    DescriptiveEnum.class.isAssignableFrom( klass ) ) {
                            // DescriptiveEnum
                            if ( data.length > 1 ) {
                                throw new IllegalStateException( "Only single result expected but multiple results returned!" );
                            }
                            result = (T) CanonConstants.enumOfValue( (Class<? extends DescriptiveEnum<?>>) klass, data[0] );
                        } else if ( klass != null &&
                                    EdsRect.class.isAssignableFrom( klass ) ) {
                            // EdsRect
                            if ( data.length != 4 ) {
                                throw new IllegalStateException( "Four values expected for an EdsRect!" );
                            }
                            result = (T) new EdsRect( new EdsPoint( new NativeLong( data[0] ), new NativeLong( data[1] ) ), new EdsSize( new NativeLong( data[2] ), new NativeLong( data[3] ) ) );
                        } else if ( klass != null &&
                                    EdsSize.class.isAssignableFrom( klass ) ) {
                            // EdsSize
                            if ( data.length != 2 ) {
                                throw new IllegalStateException( "Two values expected for an EdsSize!" );
                            }
                            result = (T) new EdsSize( new NativeLong( data[0] ), new NativeLong( data[1] ) );
                        } else {
                            // int[]
                            result = (T) data;
                        }
                    }

                    break;
                }
                default:
                    System.err.println( type.description() +
                                        " (" +
                                        type.name() +
                                        ") is not currently supported by GetPropertyCommand. Likely this camera does not support property " +
                                        property.name() +
                                        " in the current mode or at all." );

                    //                    throw new IllegalStateException( type.description() + " (" +
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.