×

Discussion Board

Results 1 to 2 of 2
  1. #1
    Registered User
    Join Date
    Jun 2005
    Posts
    2

    Question playing video while bluetooth-device-discovery

    hello,

    our mobile-java project is in big trouble!
    (we're using nokia 6630 - CLDC 1.1, MIDP 2.0 -
    mobile phones for development).

    the problem:

    from time to time a video is supposed to be shown
    to the user using the mobile media api (mmapi jsr-135)
    in the main thread.
    there's a thread (bt-thread, not the main thread!) that
    scans for bluetooth devices in an endless-loop in
    the run()-method. the whole bluetooth-handling is
    done in this thread.

    our run()-method:

    public
    void run()
    {
    while(true)
    {
    if(iShouldStop)
    {
    break;
    }

    //pause inquiry
    synchronized(this)
    {
    while(iShouldPause)
    {
    try
    {
    wait();
    }
    catch(Exception e)
    {}
    }
    }

    discoveryAgent.startInquiry(DiscoveryAgent.GIAC, this);
    }
    }

    that works fine.


    if the bt-thread isn't stopped, it is not possible
    to play the video.


    first try:

    pause the bt-thread (a call to wait() -> iSouldPause=true <- in
    the endless loop - not breaking out of run()-method()!).
    -> no video is shown


    second try:

    stop the bt-thread (break out of the endless loop and
    quit the run()-method).
    -> video is shown, but the bt-thread cannot be started again
    (common thread-behaviour).
    -> cancel all inquiries and service searches and
    destroy the old bt-thread(btThread = null
    -> create a new bt-thread and start it (newBtThread.start()
    -> problem: BluetoothStateException - discovery agent still busy,
    a new device inquiry cannot be executed


    is there anybody who has gathered experience with the
    combination of bluetooth-device-disvovery and the
    use of video using mmapi?

    thank you for devoting yourself to our problem.


    steven reinisch
    bauhaus-university, weimar, germany

  2. #2
    Registered User
    Join Date
    Dec 2004
    Posts
    369

    i think this is...

    if you posted this allready in j2me.org forums
    http://www.j2me.org/yabbse/index.php...;threadid=5515
    so i've allready posted u a reply there which i think should work ...
    try it out and get back to us...

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
×