Package com.sun.jna.ptr

Examples of com.sun.jna.ptr.NativeLongByReference


      System.err.println(desc);
     
      System.exit(agent.getLastError());
    }
   
    NativeLongByReference pdwConnID = new NativeLongByReference();

    // 4. 连接服务器
    if(agent.connect("localhost", (short)5555, pdwConnID))
    {
      NativeLong dwConnID = pdwConnID.getValue();
     
      int count = 10;
      byte[][] arrays = new byte[count][];
     
      for(int i = 1; i <= count; i++)
View Full Code Here


    }

    this.arch = arch;
    this.mode = mode;
    ns = new NativeStruct();
    ns.handleRef = new NativeLongByReference();
    if (cs.cs_open(arch, mode, ns.handleRef) != CS_ERR_OK) {
      throw new RuntimeException("ERROR: Wrong arch or mode");
    }
    ns.csh = ns.handleRef.getValue();
    this.detail = CS_OPT_OFF;
View Full Code Here

    }

    this.arch = arch;
    this.mode = mode;
    ns = new NativeStruct();
    ns.handleRef = new NativeLongByReference();
    if (cs.cs_open(arch, mode, ns.handleRef) != CS_ERR_OK) {
      throw new RuntimeException("ERROR: Wrong arch or mode");
    }
    ns.csh = ns.handleRef.getValue();
    this.detail = CS_OPT_OFF;
View Full Code Here

            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 (" +
View Full Code Here

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

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

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

    }

    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() +
                                ": " +
View Full Code Here

    }

    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() + " - " +
View Full Code Here

            //    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 ) {
View Full Code Here

TOP

Related Classes of com.sun.jna.ptr.NativeLongByReference

Copyright © 2018 www.massapicom. 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.