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


Reply With Quote

