VISA read raw data from USB board Analog Devices ADISUSBZ

Hi
I am trying to use VISA to read the raw data from a USB dev board (Analog Devices ADISUSBZ). but always get below errors
"BFFF003A Unable to start operation because setup is invalid."
what I did.
1) uninstalled and deleted the origanl USB driver for ADISUSBZ
2) plugin ADISUSBZ USB Dev board, windows see a unknow device, using VISA Driver Wizard to create a USB driver inf file for ADISUSBZ
3) installed the new driver which VISA Driver Wizard created, restarted computer, ADISUSBZ is identified and loaded with VISA USB driver. also showing "This device is working properly."
4) Run Measurement & Automation Explorer, in the Devices and Interfaces list, I can see that USB device which is the ADISUSBZ. but the name is
Unkown USB0::0x0456::0xEF02::NI-VISA-40002::RAW   (the VID PID tell me, it is the ADISUSBZ USB Dev board)
5) Open VISA Test panel -> View All Settable Attributes, I got below data, where  VI_ATTR_USB_BULK_IN_STATUS = -1 (not active???)
VI_ATTR_TMO_VALUE = 2000
VI_ATTR_MAX_QUEUE_LENGTH = 50
VI_ATTR_TERMCHAR = 0x0A
VI_ATTR_TERMCHAR_EN = VI_FALSE
VI_ATTR_IO_PROT = 1
VI_ATTR_SUPPRESS_END_EN = VI_FALSE
VI_ATTR_USB_MAX_INTR_SIZE = 1
VI_ATTR_USB_CTRL_PIPE = 0x0000
VI_ATTR_USB_BULK_OUT_PIPE = 0xFFFF
VI_ATTR_USB_BULK_IN_PIPE = 0xFFFF
VI_ATTR_USB_INTR_IN_PIPE = 0xFFFF
VI_ATTR_USB_ALT_SETTING = 0
VI_ATTR_USB_BULK_OUT_STATUS = -1
VI_ATTR_USB_BULK_IN_STATUS = -1
VI_ATTR_USB_INTR_IN_STATUS = -1
VI_ATTR_USB_END_IN = 5
6) Basic I/O  -> viRead  , set count to 1 or default 1024 , execute
return status is always BFFF003A
I searched in error list, it says
"BFFF003A Unable to start operation because setup is invalid."
any idea what is wrong? help
BTW, the ADISUSBZ USB board works fine, test with its own software, it is not hardware faulty
Eric

Hi Eric
I have a few questions for you as well as a number
of likes that will help you.
What software are you using NI VISA with is it just
Measurement and automation explorer ?
Which version of NI VISA are you using?
Which operating system are you using?
In measurement and automation explorer is there a
yellow question mark against the device?
I would advise reading the likes below if you have
not already creating the VISA driver again checking the manufacture ID and
model code if these options are available to you.
The following link will help you with the VISA
http://digital.ni.com/public.nsf/websearch/E3A2C4F​E42D7ED0D86256DB7005C65C9
This tutorial gives a step by step guide on how to
create a VISA driver.
http://zone.ni.com/devzone/cda/tut/p/id/4713
The Difference between USB Raw Control and USB Raw
Bulk
http://digital.ni.com/public.nsf/allkb/400D6EAB5CF​E1C6B86257395005F5D48?OpenDocument
Can VISA Read be used to read USB Interrupt Data?
http://digital.ni.com/public.nsf/allkb/D38E5A65DA5​4C9A2862571E900810FEA?OpenDocument
Regards
Robert
National Instruments UK & Ireland

Similar Messages

  • How to read a data from USB port using JAVA

    hi all,
    i need to know how to read a data from USB port using java. any API are available for java ?.........please give your valuable ideas !!!!!!!!!
    Advance Thanks!!

    You can do this. Please use this link
    [http://www.google.co.in/search?hl=en&client=firefox-a&rls=org.mozilla%3Aen-US%3Aofficial&hs=uHu&q=java+read+data+from+usb+port&btnG=Search&meta=&aq=f&oq=]
    What research did you do of your own? Have you done some testing application and tried yourself??

  • Raw Read Error Rate, Errors occurred while reading raw data from a disk

    hi
    when I turn my pavilion dv6 2170ee computer on screen shows below error.
    system diognostics (F2) does not any work
    and when my windows7 comming up this error was shown.
    I install Hard Disk Sentinel software and this program shows below:
    Failure Predicted - Attribute: 1 Raw Read Error Rate, Errors occurred while reading raw data from a disk. Indicate problem with the disk surface or the read/write heads.
    There are 28 weak sectors found on the disk surface. They may be remapped any time in the later use of the disk.
    26848 errors occured during data transfer. This may indicate problem of the device or with data/power cables. It is recommended to examine and replace the cables if possible.
    Replace hard disk immediately.
    how can I fix it?
    may drive format (Fdisk) and renewing windows can fix it?
    tanx and regards
    Mohammad

    Hello mohkhosh,
    I see that you're getting an error indicating possible hard driver failure, that you have this message from 3 different sources. I will try to help you with this.
    After reviewing everything  you're looking at needing to replace the hard drive. I would suggest contacting support to see what they can do for you.
    HP Technical Support, North America 1-800-474-6836. For all other regions click here.
    Thank you for posting on the HP Forums.
    I worked on behalf of HP.

  • What VI can read raw data from a TDMS file with scaling information entered?

    I would like to use scaling with my TDMS files so that the end user will
    only see engineering unit values, however, within my Labview application, I
    want to retrieve the raw data.  Is there a way to read the raw data using
    one of the Vi's in Labview?

    The scaling information in a TDMS file is stored as properties of the channel.  One trick (that I haven't mastered yet) is you can change the properties of the TDMS file (set properties) and set all the scales to have a offset of 0 and a scale of 1.  This will apply a scale that has the engineering units be the same as the raw values.  Then you can read the data like normal and you'll get the raw values.
    There are several issues to be aware of, the first is changing the scale and forgetting to change it back, or some how modifying the data to be incorrect units and not knowing it.  For this reason I'd recommend making a copy of the TDMS file to a temporary location to make the modifications to the properties, read it, then delete the temporary TDMS file when you are done.  
    This is the only way I know of to get the raw readings from a scaled TDMS channel.  
    Unofficial Forum Rules and Guidelines - Hooovahh - LabVIEW Overlord
    If 10 out of 10 experts in any field say something is bad, you should probably take their opinion seriously.

  • Problem while reading data  from USB with JSR80

    Hi
    Iam using Fedora 9 with 32 bit.
    Iam using JSR80 api to read the data from USB devices.
    I successfully set-up the code as per given on JSR80 site on my eclipsce ide.
    below is my code which iam using to read data from usb
    import com.ibm.jusb.*;
    import java.util.List;
    import javax.usb.*;
    import java.util.List;
    public class USBReader {
    public static  UsbInterface interf = null;
         public static void main(String[] args) {
              try
            {// Access the system USB services, and access to the root
             // hub. Then traverse through the root hub.
               System.out.println("Application started");
             UsbServices services = UsbHostManager.getUsbServices();
             UsbHub rootHub = services.getRootUsbHub();
             traverse(rootHub);
             testIO(rootHub);
            } catch (Exception e) {
                 System.out.println("The Exception occured"+e.getMessage());
          public static void traverse(UsbDevice device){
               System.out.println("Iam in traverse ");
               if (device.isUsbHub()){  
                    // This is a USB Hub, traverse through the hub.
                    System.out.println("The device is hub");
                    List attachedDevices = ((UsbHub) device).getAttachedUsbDevices();
                    System.out.println("The attached devices size:"+attachedDevices.size());
                    for (int i=0; i<attachedDevices.size(); i++){
                         traverse((UsbDevice) attachedDevices.get(i));
                    if(attachedDevices !=null){
                         for(int j=0;j<attachedDevices.size();j++){
                              System.out.println("The device is"+attachedDevices.get(j));
           else{
              // This is a USB function, not a hub.
              // Do something.
                System.out.println("The device is not hub");
          public static void testIO(UsbDevice device) throws UsbClaimException, UsbNotActiveException, UsbDisconnectedException, UsbException{
               System.out.println("Iam in testIO");
              try{
                 // Access to the active configuration of the USB device, obtain
                 // all the interfaces available in that configuration.
                 UsbConfiguration config = device.getActiveUsbConfiguration();
                 List totalInterfaces = config.getUsbInterfaces();
                 System.out.println("The Total interfaces: "+totalInterfaces.size());
                 // Traverse through all the interfaces, and access the endpoints
                 // available to that interface for I/O.
                 for (int i=0; i<totalInterfaces.size(); i++){
                    interf = (UsbInterface) totalInterfaces.get(i);
                    System.out.println("The interfaces are "+totalInterfaces.get(i));
                    String strinf=interf.getInterfaceString();
                    System.out.println("Claimed Status: "+interf.isClaimed());
                    System.out.println("Active status : "+interf.isActive());
                    System.out.println("Settings :"+interf.getNumSettings());
                    //interf.release();
                    interf.claim();
                    List totalEndpoints = interf.getUsbEndpoints();
                    for (int j=0; j<totalEndpoints.size(); j++){
                       // Access the particular endpoint, determine the direction
                       // of its data flow, and type of data transfer, and open the
                       // data pipe for I/O.
                       UsbEndpoint ep = (UsbEndpoint) totalEndpoints.get(i);
                       int direction = ep.getDirection();
                       int type = ep.getType();
                       UsbPipe pipe = ep.getUsbPipe();
                       pipe.open();
                       // Perform I/O through the USB pipe here.
                       pipe.close();
                    interf.release();
              } catch (Exception e) {
                   System.out.println("Exception in TestIO"+e.getMessage());
                   e.printStackTrace();
    }When i execute the above code i get the following exception
    Exception in TestIOCannot claim an interface on a virtual root hub.
    javax.usb.UsbException: Cannot claim an interface on a virtual root hub.
         at com.ibm.jusb.VirtualRootUsbHubImp$VirtualRootUsbInterfaceOsImp.claim(VirtualRootUsbHubImp.java:143)
         at com.ibm.jusb.os.DefaultUsbInterfaceOsImp.claim(DefaultUsbInterfaceOsImp.java:54)
         at com.ibm.jusb.UsbInterfaceImp.claim(UsbInterfaceImp.java:109)
         at com.ibm.jusb.UsbInterfaceImp.claim(UsbInterfaceImp.java:83)
         at USBReader.testIO(USBReader.java:60)
         at USBReader.main(USBReader.java:15)iam not getting the clue for it .

    Cannot claim an interface on a virtual root hubSo don't do that? I have no idea how to tell, but clearly you need to test a few more attributes before you claim. Or else just log the claim error and continue with the next interface.

  • Read data from 3 arduino analog pins

    Hi, 
    My name is Jack. I have a question about how to read multiply data from arduino analog inputs in labview. I have tried to read data from 2 pins by using same way (continuous analog samples) and the system works well. However, I failed in reading data from one more pin, no matter I used the same way as to read continuous analog samples or the method to read analog voltage. 
    My idea is to read battery voltage from pin 0, and the transducer voltages from pin 1 and pin 2 and convert them to currents. Pin 1 and Pin 2's signals work well, but pin 0 does not that good.
    Another question is that how to plot data of pin 1 and pin 2 into one waveform chart. I have tried to bundle the two arrays; it didn't work, however.
     Attached is my VI. Thanks for help. 
    Attachments:
    final final project.vi ‏747 KB

    This article presents a procedure for reading the analog ports of Arduino UNO R3 board , on which a Joystick shield was installed. The analog data are related to the position of command and can be monitored from the front panel of our program , for which we use serial communication.
    https://decibel.ni.com/content/docs/DOC-33281
    Atom
    Certified LabVIEW Associate Developer
    Attachments:
    analog_JOYSTICK_ARDUINO.zip ‏1 KB
    cmd arduino JOYSTICK.vi ‏65 KB

  • Help me,  How to read data from USB ???

    Help me, How to read data from USB ???

    If its a disk on key or some portable hard drive than once its connected to the usb and recognized by the system you can access it through java like you would access your hard drive.

  • Can I use LabVIEW to load data directly into system memory? The serial card I'm using isn't supported by NI nor does VISA recognize it. I'm using a Win32 function to read the data from the card and now I want it to go directly to system memory.

    Can I use LabVIEW to load data directly into system memory from a VI? The serial card I'm using isn't supported by NI nor does VISA recognize it. I'm using a Call Library function to read the data from the card and now I want it to go directly to system memory.
    The data is being received at 1Mbps.
    Thanks

    Two questions:
    One, if it's a serial card, then presumably it gives you more serial ports, like COM3, COM4, etc. If so, VISA would see the COM ports, and not the card directly. The drivers for the card should make it so that you see the extra serial ports from the OS. If you don't see the extra COM ports from VISA, then it sounds like the drivers for the card are not installed properly. Do the extra COM ports show up in Device Manager?
    Two, you said that you're using a Call Library function to get the data and you want to put it into system memory. Errr.... you just read the data and you have it in memory by definition. Are you saying you need a way to parse the data so it shows up on a graph or something?

  • End point data from usb 2.0

    plz does anybody tell me how to read the data from end point 2,4,6 or 8 from usb raw 2.0  (min 4 byte to max 1024) or how to confirue the usb visa  properties? plz it's very urgent.
    thanking you.
    robin

    Hello Robin,
    I guess you are using LabVIEW. Have you tested the example USB Raw –Bulk.vi from LV NI Example Library? This example should work properly for you.LAbVIEW>>Help>>Find  Examples>>search for USB >>choose USB Raq-Bulk.vi
    Before you run this VI, install a USB RAW device and configure NI Measurement & Automation Explorer (MAX) to recognize the USB device. You can read to and write from the USB RAW device only after you install and configure the USB RAW device and open a session to the device.
    Plus.
    In my opinion, the attached KnowledgeBase could be helpful. This document includes a lot of details about your issue.
    How Can I Communicate With a Device Using NI-VISA USB RAW Mode?
    http://digital.ni.com/public.nsf/allkb/E3A2C4FE42D7ED0D86256DB7005C65C9?OpenDocument
    Best regards,
    AmirG

  • Reading the data from BLOB column

    HI,
    I have a table with following structure
    Test_Mail(Attachment BLOB,Attachmentname varchar2(255),FileSize number)
    The data in the table is like
    Attachment|Attachmentname|FileSize
    BLOB|test.txt|1236
    I wants to read the data from the BLOB attachment in to new file.
    can any one help me in doing this with plsql??
    Thanks in advance,
    Balaji tk.
    Edited by: Balaji.tk on Jan 9, 2011 9:28 PM

    May be something like this ?
    DECLARE
       l_file       UTL_FILE.FILE_TYPE;
       l_buffer     RAW (32767);
       l_amount     BINARY_INTEGER     := 32767;
       l_pos        INTEGER            := 1;
       l_blob       BLOB;
       l_blob_len   INTEGER;
    BEGIN
    -- Open the destination file.
       l_file := UTL_FILE.FOPEN ('TEST_DIR', v_attachment_name, 'wb');
       --This v_attachment_name can be selected from your table.
    -- Get LOB locator
    FOR rec IN (
    SELECT attachment   l_blob
          FROM test_mail
         --Your where condition to find the row.      
       --AND ROWNUM =1
    LOOP
       l_blob_len := DBMS_LOB.getlength (rec.l_blob);
    -- Read chunks of the BLOB and write them to the file
    -- until complete.
       WHILE l_pos < l_blob_len
       LOOP
          DBMS_LOB.READ (rec.l_blob, l_amount, l_pos, l_buffer);
          UTL_FILE.put_raw (l_file, l_buffer, FALSE);
          l_pos := l_pos + l_amount;
       END LOOP;
      commit;
    END LOOP;
    -- Close the file.
       UTL_FILE.FCLOSE (l_file);
    EXCEPTION
       WHEN OTHERS
       THEN
    -- Close the file if something goes wrong.
          IF UTL_FILE.IS_OPEN (l_file)
          THEN
             UTL_FILE.FCLOSE (l_file);
          END IF;
          RAISE;
    END;

  • Reading the data from network card

    Hi,
    java.net defines the class NetworkInterface. Currently there are two network cards, one is wireless and another is for LAN.I am able to retrive their names and IP addresses using NetworkInterface methods.How to read the data from a specifc network card? Can we read all TCP packets which are passed through network card?
    using socket?
    Regards
    prasanna

    pdiwadkar wrote:
    Hi,
    java.net defines the class NetworkInterface. Currently there are two network cards, one is wireless and another is for LAN.I am able to retrive their names and IP addresses using NetworkInterface methods.How to read the data from a specifc network card? Can we read all TCP packets which are passed through network card?
    using socket?
    Regards
    prasannaYou may already know that Java is not good at doing some 'low level stuff'.
    You cannot use (pure) Java to access the raw network data.

  • NEED HELP! - Installing Camera raw presets from USB Stick

    NEED HELP! -installing Camera raw presets from USB Stick.
    I am attempting to install the Camera Raw Presets. 
    It says to put them into User Name/Library/Application Support/Adobe/CameraRaw/Settings... 
    When I get to CameraRaw the ONLY folders in there are CameraProfiles & Lens Profiles. 
    I have searched everywhere looking for a CameraRaw-Settings folder and cannot find one. 
    I have latest version of CameraRaw installed and still no settings folder. 
    I even attempted to find it by looking in camera raw where it has saved the custom settings I made as presets and it shows that they are saved but will not show me where. 
    I am using CS5 specifically Photoshop v12.0.4 and Bridge. I have Lightroom 4. I have iMac OS  10.7.3
    Do I need to reinstall Camera Raw and how do you do that?
    Will I then lose my presets that I made in CameraRaw?  
    Thanks for your help

    Here is a note from the ACR 7.1 beta release.  http://labs.adobe.com/technologies/cameraraw7-1/?tabID=details
    Perhaps this answers question.
    Frequently Asked Questions
    Why is it no longer required to place the plug-in file in the specified directory on my hard drive?
    The Camera Raw update process has grown to include lens profile and camera profile files which are easiest to install via a single installer process instead of updating several different directories manually.

  • Kinect Explorer WPF C# read depth data from the file and conversion to skeleton

    Hello,
    I am using Kinect sensor to do some research on biometrics. Since it is impossible to find people to collect some samples, I would like to use samples from the TUM - GAID database, where there exist Color View and Depth View (in .raw format) samples. Therefore,
    I need to read these samples from the file and do a batch processing, instead of performing real-time collecting of samples (where I can take automatically the Skeleton view using the Kinect SDK). So, I need help on
    1. Reading the data from the file (instead of activating the Kinect sensor) and give this data as an input for conversion to a skeleton
    2. Read the .raw files 
    Thank you very much
    Kind regards

    Hiya,
     I doubt this forum, C Sharp, will provide much help. You are asking about the Kinects system not C#
    language. However, you can try this link; http://kinectforwindows.codeplex.com/
    Hope this help. Thanks :)

  • I use LabVIEW 7.1 but I have some problem when, I use LabVEW to read the data from serial communication

    I use LabVIEW 7.1 but I have some problem when, I use LabVEW to read the data from serial communication.
    I use LabVIEW to read the data from serial communication then, i open the example (.vi) from Serial Communication - Advanced Serial Write and Read  from LabVIEW Example. BUT it have some error message that : Error - 1073807202 occured  at property node in visa configure serial port (instr).vi -> advance serial write and read .vi
    this error code is undefined. no one has provide a description for this code, or you might have wired a number that is not an error code to the error code input.
    I don't know why? please help me. thank you.

    When I copy that code into "Explain Error" I get: "VISA:  (Hex 0xBFFF009E) A code library required by VISA could not be located or loaded."
    You may have a bad install of VISA or the wrong version of VISA loaded. Try re-installing VISA. You can get the latest version from the NI support site: http://digital.ni.com/softlib.nsf/webcategories/85256410006C055586256BBB002C0E91?opendocument&node=1....
    Also ensure that you are not pointing the example towards a serial port that does not exist.
    Please let us know what you find and what gets this working for you.
         Rob

  • Read Video data from buffer or byte array

    Hi guys,
    I've developed a tx/rx module, the tx read an mpg file and transfer it over network. rx has the data in a byte array, I also feed the byte array to a media buffer. Now my question is how to creat the player and feed the player to play the content of the buffer or byte array?
    I would really appreaciate if someone could help me please...
    Thanx
    I haven't and didn't want to use any of the RTP stuff...

    Hi, I tried PullBufferDataSource. What I am trying to do is : read a .wav file into a queue, then construct a datasource with this queue. The processor will be contructed to process the datasource, and a datasink to sink data to a file. I think if this workflow could work, it should work in network transmission.
    In fact the code works partially. The trick part is the read( Buffer ) method. If I try to use 'if' statement to see if Queue has empty or not, the datasink could not format the head part of output file correctly. If I didnot use 'if' statement, the program will terminate when exception occurs. The output file is all right.
    I did not understand what is going on.
    Note: the original file is a RAW data file without format info.
    Here is the code fragments. Hopefully we can work together to figure it out.
    Thanks.
    Jim
    * QueueDataSourceTester.java
    * Created on November 11, 2002, 10:29 AM
    package bonephone;
    import javax.media.*;
    import javax.media.control.*;
    import javax.media.protocol.*;
    import javax.media.datasink.*;
    import javax.media.format.AudioFormat;
    import java.util.LinkedList;
    import java.io.*;
    * @author wguo
    public class QueueDataSourceTester implements ControllerListener, DataSinkListener {
    protected LinkedList myQueue;
    /** Creates a new instance of QueueDataSourceTester */
    public QueueDataSourceTester() {
    myQueue = new LinkedList();
    public void testIt( ){
    // Read a file into a Queue
    FileInputStream inputStream = null;
    try{
    inputStream = new FileInputStream( "c:/media/phone.wav");
    catch( IOException ioe ){
    System.err.println( "Error on open media file." );
    try{
    byte data[] = new byte[1024];
    int n ;
    while( ( n = inputStream.read( data, 0, 1024 )) != -1 ){
    myQueue.addLast( data );
    data = new byte[1024];
    inputStream.close();
    catch( IOException ioe ){
    System.err.println( "Error on reading file." );
    System.out.println( "Queue Size: " + myQueue.size() );
    System.out.println( "myQueue = " + myQueue.size() );
    QueueDataSource dataSource = new QueueDataSource( myQueue );
    Processor p = null ;
    try{
    System.out.println( "Create processor for QueueDataSource ... " );
    p = Manager.createProcessor( dataSource );
    catch( Exception e ){
    System.err.println( "Cannot create a processor for the QueueDataSource. " );
    System.out.println( "\nProcessor is created." );
    p.addControllerListener( this );
    p.configure();
    if( !waitForState( p, p.Configured ) ) {
    System.err.println( "Failed to configure the processor." );
    System.out.println( "\nProcessor is configured") ;
    // p.setContentDescriptor( new ContentDescriptor( ContentDescriptor.RAW ) );
    p.setContentDescriptor( new ContentDescriptor( FileTypeDescriptor.WAVE ) );
    TrackControl tcs[] = p.getTrackControls();
    Format f[] = tcs[0].getSupportedFormats();
    if( f == null || f.length == 0 ){
    System.err.println( "The mux does not support the input format : "+ tcs[0].getFormat() );
    tcs[0].setFormat(
    new AudioFormat( AudioFormat.ULAW,
    8000,
    8,
    1,
    Format.NOT_SPECIFIED,
    AudioFormat.SIGNED,
    8,
    Format.NOT_SPECIFIED,
    Format.byteArray ) );
    //System.out.println( "Setting the track format to: " + f[4] );
    p.realize();
    if( !waitForState( p, p.Realized )){
    System.err.println( "Failed to realize the processor" );
    DataSink dsink;
    MediaLocator outML = new MediaLocator("file:/c:/media/queue.wav" );
    if( (dsink = createDataSink( p, outML )) == null ){
    System.err.println( "Failed to create a datasink for given " +
    "mediaLocator : " + outML );
    dsink.addDataSinkListener( this );
    System.out.println( "\nProcessor is realized" );
    try{
    p.start();
    dsink.start();
    catch( IOException ioe ){
    System.err.println( "IO error during processing." );
    waitForFileDone();
    try{
    dsink.close();
    catch( Exception e ){
    p.removeControllerListener( this );
    System.err.println( "... done processing." );
    DataSink createDataSink( Processor p, MediaLocator outML ){
    DataSource ds ;
    if( ( ds = p.getDataOutput() ) == null ) {
    System.err.println( "Something is really wrong: the processor does" +
    " not have an output DataSource. " );
    return null;
    System.out.println( "DataOutput: " + ds.getContentType() );
    DataSink dsink;
    try{
    System.out.println( "- create DataSink for : " + outML );
    dsink = Manager.createDataSink( ds, outML );
    dsink.open();
    catch( Exception e ){
    System.err.println( "Cannot create the DataSink: " + e );
    return null;
    return dsink;
    Object waitSync = new Object();
    boolean stateTransitionOK = true;
    boolean waitForState( Processor p, int state ){
    synchronized( waitSync ){
    try{
    while( p.getState() < state && stateTransitionOK )
    waitSync.wait();
    catch( Exception e ){
    return stateTransitionOK;
    public void controllerUpdate(javax.media.ControllerEvent controllerEvent) {
    if( controllerEvent instanceof ConfigureCompleteEvent ||
    controllerEvent instanceof RealizeCompleteEvent ||
    controllerEvent instanceof PrefetchCompleteEvent ){
    synchronized( waitSync ){
    stateTransitionOK = true;
    waitSync.notifyAll();
    } else if( controllerEvent instanceof ResourceUnavailableEvent ){
    synchronized( waitSync ){
    stateTransitionOK = false;
    waitSync.notifyAll( );
    public static void main( String args[] ){
    QueueDataSourceTester tester = new QueueDataSourceTester();
    tester.testIt();
    Object waitFileSync = new Object();
    boolean fileDone = false;
    boolean fileSuccess = true;
    boolean waitForFileDone(){
    synchronized( waitFileSync ){
    try{
    waitFileSync.wait( 5000 );
    catch( Exception e ){
    System.err.println( "Error on waiting file to be done" );
    return fileSuccess;
    public void dataSinkUpdate(javax.media.datasink.DataSinkEvent dataSinkEvent) {
    if( dataSinkEvent instanceof EndOfStreamEvent ){
    synchronized( waitFileSync ){
    fileDone = true;
    waitFileSync.notifyAll();
    else if ( dataSinkEvent instanceof DataSinkErrorEvent ){
    synchronized( waitFileSync ){
    fileDone = true;
    fileSuccess = false;
    waitFileSync.notifyAll();
    // Inner Class
    * A datasource that will read Media data from Queue.
    * Inside queue individual RAW data packats are stored.
    * @author wguo
    public class QueueDataSource extends PullBufferDataSource{
    protected QueueSourceStream streams[];
    /** Creates a new instance of QueueDataSource */
    public QueueDataSource( LinkedList source ) {
    printDebug( "QueueDataSource: QueueDataSource( LinkedList) " );
    streams = new QueueSourceStream[1];
    streams[0] = new QueueSourceStream( source );
    public void connect() throws java.io.IOException {
    printDebug( "QueueDataSource: connect() " );
    public void disconnect() {
    printDebug( "QueueDataSource: disconnect()" );
    public String getContentType() {
    return ContentDescriptor.RAW;
    public Object getControl(String str) {
    printDebug( "QueueDataSource: getControl(String) " );
    return null;
    public Object[] getControls() {
    printDebug( "QueueDataSource: getControls() " );
    return new Object[0];
    public javax.media.Time getDuration() {
    return DURATION_UNKNOWN;
    public javax.media.protocol.PullBufferStream[] getStreams() {
    printDebug( "QueueDataSource: getStreams() " );
    return streams;
    public void start() throws java.io.IOException {
    printDebug( "QueueDataSource:start()" );
    public void stop() throws java.io.IOException {
    printDebug( "QueueDataSource: stop() " );
    private void printDebug( String methodInfo ){
    System.out.println( methodInfo + " is called" );
    // Inner Class
    public class QueueSourceStream implements PullBufferStream{
    LinkedList sourceQueue;
    AudioFormat audioFormat;
    boolean ended = false;
    /** Creates a new instance of QueueSourceStream */
    public QueueSourceStream( LinkedList sourceQueue ) {
    printDebug( "QueueSourceStream: QueueSourceStream( LinkedList )" );
    this.sourceQueue = sourceQueue;
    audioFormat = new AudioFormat(
    AudioFormat.ULAW,
    8000,
    8,
    1,
    Format.NOT_SPECIFIED,
    AudioFormat.SIGNED,
    8,
    Format.NOT_SPECIFIED,
    Format.byteArray);
    public boolean endOfStream() {
    printDebug( "QueueSourceStream: endOfStream()" );
    return ended;
    public javax.media.protocol.ContentDescriptor getContentDescriptor() {
    printDebug( "QueueSourceStream: getContentDescriptor()" );
    return new ContentDescriptor( ContentDescriptor.RAW) ;
    public long getContentLength() {
    printDebug( "QueueSourceStream:getContentLength()" );
    return 0;
    public Object getControl(String str) {
    printDebug( "QueueSourceStream:getControl( String) " );
    return null;
    public Object[] getControls() {
    printDebug( "QueueSourceStream:getControls()" );
    return new Object[0];
    public javax.media.Format getFormat() {
    printDebug( "QueueSourceStream:getFormat()" );
    return audioFormat;
    public void read(javax.media.Buffer buffer) throws java.io.IOException {
    buffer.setData( (byte[])sourceQueue.removeFirst() );
    buffer.setOffset( 0 );
    buffer.setLength( 1024 );
    buffer.setFormat( audioFormat );
    printDebug( "QueueSourceStream: read( Buffer ) " );
    else {
    buffer.setEOM( true );
    buffer.setOffset( 0 );
    buffer.setLength( 0 );
    ended = true;
    System.out.println( "Done reading byte array" );
    return;
    public boolean willReadBlock() {
    printDebug( "QueueSourceStream: willReadBlock()" );
    if( myQueue.isEmpty() )
    return true;
    else
    return false;
    private void printDebug( String methodInfo ){
    System.out.println( methodInfo + " is called. " );

Maybe you are looking for