Continuous Bluetooth Inquiry J2ME

I'm trying to develop a midlet that will continuously inquiry for nearby devices. I want to test if it's possible to inquiry a device while he is inquiring too.
I have done this continuous inquiry by doing an initial startInquiry and then calling the startInquiry again inside the inquiryCompleted event handler.
After this i encountered two problems. The first was in the mobile emulator. The first inquiry doesn't give an error, but after that i get "BluetoothStateException: The previous device discovery is running".
When i try this in the actual device (my personal cellphone) it doesn't throw an exception but it doesn't do anything else. It blocks on the startInquiry (the second one) and does nothing. The interface continues to work (since it blocked the thread of the event handler, i think).
I've tried several solutions like calling cancelInquiry before the new startInquiry. I tried also (at least on the emulator) to put a delay before calling the next startInquiry.
How do i do this?

Hey, I don't know if this is still relevant.
But, You should start the device inquiries from another thread... mean.. have a thread starting device inquiries checking before if one is in progress.. make sure that the functions DeviceDiscovered and inquiryCompleted are short and return.
cancelInquiry doesn't work well on all stacks.. and you should check the boolean returned to see if it worked (I got to your thread because I have a problem with the cancelInquiry) anyway you can't call cancelInquiry inside inquiryCompleted because this doesn't make sense.
About debuging in mobiles... I found that newer models of SonyEricssons support on device run/debug (the debug I couldn't get working but seeing the output of the device is already nice).
Good Luck.

Similar Messages

  • Re: Where to find Continua Bluetooth Manager?

    I am looking for the Continua Bluetooth Manager for Windows, manufactured by Toshiba, but I have no idea where to find it. This (http://continuaalliance.org/certified-products/continua-bluetooth-manager-for-windows-manufactured-by-toshiba.html) is the only thing I find, but where to download it?

    Are you searching for Toshiba SDK for BT developers?
    Here check this:
    http://aps2.toshiba-tro.de/kb0/HTD9602MK0000R02.htm
    Found also interesting thread about similar question:
    http://forums.computers.toshiba-europe.com/forums/thread.jspa?threadID=57899

  • Bluetooth inquiry makes phone hanging

    Hi,
    I got interested into bluetooth, after seeing some great applications, and started programming in J2ME.
    The following code searches for devices in the BCC (Bluetooth Control Center) with the retrieveDevices() method and returns the bluetoothaddres of the first device found in the RemoteDevice[] array, that is if any PREKNOWN or CACHED devices our found. After succesfully transfering and running the application on my cellphone the lines in the form show:
    -"no CACHED devices found"
    -"no PREKNOWN devices found"
    Which looks strange to me because I have a few pre-paired devices on my cellphone.
    So I added the startInquiry() method, compiled the applet and ran it on my cellphone (Nokia 6303i).
    Now when I run the applet there is a progress bar appearing on my screen, which appeared before also when I only used the retrieveDevices() method, and that's it. I guess this is because the device is searching for nearby BT devices but even after 30 minutes this progress bar is still on my screen.
    I was hoping that any of you guys could see the mistake in my code, I know I don't. Any ideas?
    Thanks in advance,
    Rambo.
    import javax.microedition.lcdui.*;
    import javax.microedition.midlet.*;
    import javax.bluetooth.*;
    import java.util.*;
    public class Eigenschappen extends MIDlet implements CommandListener,DiscoveryListener{
         private Form form;
         private LocalDevice local;
         private DiscoveryAgent agent;
         private Display display;
         private Vector deviceList;
         private boolean booleaninquiry;
         public void startApp(){
         deviceList = new Vector();
              try{
              local = LocalDevice.getLocalDevice();
              }catch(BluetoothStateException bse){}
         agent = local.getDiscoveryAgent();
         String eig = LocalDevice.getProperty("bluetooth.l2cap.receiveMTU.max");
         RemoteDevice[] remotecache = agent.retrieveDevices(DiscoveryAgent.CACHED);
         RemoteDevice[] remotepreknown = agent.retrieveDevices(DiscoveryAgent.PREKNOWN);
         form = new Form("Properties");
         form.append("The MTU max is " + eig);
         if(remotecache != null){
         form.append("CACHED = " + remotecache[1].getBluetoothAddress());
         }else{form.append("no CACHED devices found");}
         if(remotepreknown != null){
         form.append("PREKNOWN = " + remotepreknown[1].getBluetoothAddress());
         }else{form.append("no PREKNOWN devices found");}
         if(remotecache == null && remotepreknown == null){
              try{
              booleaninquiry = agent.startInquiry(DiscoveryAgent.GIAC,this);
              synchronized(this){
                   try{
                        this.wait();
                   }catch(Exception e){}
              }catch(BluetoothStateException bse){}
              if(booleaninquiry){
              form.append("Inquiry gestart");
              }else{form.append("Inquiry niet gestart");}
         int sizeListInt = deviceList.size();
         String sizeListString = String.valueOf(sizeListInt);
         form.append("Number of found devices " + sizeListString);
         display = Display.getDisplay(this);
         display.setCurrent(form);
         public void pauseApp(){
         public void destroyApp(boolean unconditional){
         public void commandAction(Command c,Displayable d){
         public void deviceDiscovered(RemoteDevice btDevice, DeviceClass cod){
         deviceList.addElement(btDevice);
         public void servicesDiscovered(int transID, ServiceRecord[] servRecord){
         public void inquiryCompleted(int discType){
         public void serviceSearchCompleted(int transID, int respCode){
    }

    This is a user to user forum so you won't get an official reply from nokia here. If you want a comment from nokia use the "contact us" link near the top of the page.
    If you feel that your phone is getting too hot you should get it checked out at a nokia care point. It's normal for the phone to get warm, but very hot is not normal.
    Care points/service centres and repair info:
    UK • Europe • Asia-Pacific • USA •
    Canada • Middle East and Africa
    Elsewhere: Click here, select your country, go to the support section, then select repair.

  • Continuity Bluetooth Calling & SMS on Macbook Pro (via iPhone 5) Not Working

    Devices:
    Macbook Pro Mid-2010 running OSX 10.10.2
    Iphone 5 running iOS 8.1.3
    *NOTE: I understand that due to the version of the Bluetooth protocol in my machine, not all continuity features are available (Handoff, Air Drop, MBP Instant Hotspot)
    However SMS to IMessage and the ability to make and receive calls from my Mac should be OK according to Apple's system requirements one-sheeter:
    System requirements for Continuity on iPhone, iPad, iPod touch, and Mac - Apple Support
    ================================================================================ =====================
    Here's my problem.
    I finally took the plunge last night and updated my iPhone 5 from 7.1 to 8.1.3 to access the iCloud Drive and additional continuity features integrated into Yosemite.
    When I tried to pair my iPhone 5 with my MBP over Bluetooth, all seemed to go well for the first 5 seconds.
    - Both devices were in discovery mode.
    - Mac saw the phone and displayed a security code
    - iPhone displayed the same security code and asked if I would like to pair with MBP
    - Pairing took place. Each devices Bluetooth profile / device showed up in my MBP Bluetooth's Preferences  and in my iPhone's Bluetooth.
    - 5 seconds later, there's no connection between devices.
    My iPhone displays:
    "Connection Unsuccessful: Make sure [Macbook Pro] is turned on and in range." (The phone is 5 inches away)
    Then sometimes I get this message:
    "Connection Unsuccessful: [Macbook Pro] is not supported.
    No rhyme or reason between the two either.
    Here's the baffling part: When I activate my Phone's HotSpot function, the Bluetooth works and connects with my MBP allowing it to use my cell phone network's data for internet connectivity.
    I don't understand what is going on or how to correct this? Can anyone succinctly explain how to correct this problems in layman terms?
    If the devices can communicate long enough to exchange security codes and verify their identities, then use Hotspot,  there is clearly a data exchange happening. Where is the break down taking place when it comes time to stay connected to so I can continue to use the limited continuity features.
    I've seen this question posted before by people having problems with different model years of MBP including the most recents models, so I know it's not mutually exclusive to my model year, but cannot seem to find clarity on an answer.

    Handoff Continuity Troubleshooting
    iPhone, iPad, iPod touch, and Mac using Continuity - Connect

  • Bluetooth and j2me, a frustrating scenario...

    Hello all,
    I don't want to use propeitory sdk's so I need to get a bluetooth stack working with the wireless toolkit but I am not going to pay for it so I downloaded the stack from javabluetooth.org, but when trying to compile a program which uses the javax.bluetooth package I get an error...
    Error preverifying class org.javabluetooth.distributed.BluetoothTCPServer
        VERIFIER ERROR org/javabluetooth/distributed/BluetoothTCPServer.run()V:
    Cannot find class java/net/SocketI guess j2me api does not include the package socket at all?
    Does anyone have any ideas how to get a bluetooth stack working with j2me?
    Thanks for your time
    poncenby

    the WTK 2.2b is available since June 26 or so.
    To the JSR-82 API: the classes from sun (javax.bluetooth.* and javax.obex.*) are part of the WTK 2.2b and can be used. But remember: to use a bt app on a phone, the phone must support JSR82, not only MIDP and CLDC.
    I am too good for this world. You should check http://java.sun.com/j2me . There can at least 2 articles be found regarding the development of J2ME and Bluetooth, as well as the WTK downloads and many other interesting things ;-)
    here is the link to the WTK 2.2b
    http://java.sun.com/products/j2mewtoolkit/download-2_2.html
    good luck and have fun
    Killer_2001

  • Sending text over  bluetooth with J2ME

    hello..
    Can you help me about sending text over bluetooth from one phone to another one with help of J2ME?
    If you have code relation with sending text over bluetooth, please sent me.....
    mail: [email protected]
    thanks....

    Thankfully, I don't think that can be done. And I hope it will never will be possible.
    As it is there's more than enough of SMS spam without a methodology that bypasses the operators' charges.
    db

  • J2ME and Bluetooth

    Hi all,
    Can anyone tell me how to use Bluetooth in J2ME? Why I cannot accessed Motorola Bluetooth in Sun Java website?
    Does anyone know abt this? Thanks.

    Hi,
    you need the JSR-82 for accessing Bluetooth of mobile phones. BUT: this has to be implemented by the manufacturer. If he does not, you are not able to use it.
    The classes you can download from http://www.jcp.org/en/jsr/detail?id=82 are only used for compiling your application. They contain no code (except "new RuntimeException" ;) ).
    hth
    Kay

  • Bluetooth discover VI dosen't work !!

    hi
    I want to use bluetooth communication in LV 2013. in first step I want find other bluetooth machine in my local.
    I use this Function buut it doesn't find any bluetooth device. I turned on my phone bluetooth but LV cannot found that !!
    Thanks.
    Solved!
    Go to Solution.

    ajapyy 
    did you try to Decrease your Time Limit  i made my time limit (ms) is 10ms and put it inside the loop and it works perfectly . also make sure that your mobile bluetooth is dicoverable..
    Note:
    The optional input parameter, time limit (ms), specifies the length of Bluetooth inquiry. The default value is 10 ms and the maximum value is 30 s. If time limit is less than or equal to zero, the function returns a list of installed local Bluetooth devices.
    Note: Bluetooth discovery is a slow operation because of the communication involved. A Bluetooth device address is a fixed address that is usually printed on the actual device and you can query the address from the device control setting. This address is unique to each device. If you know the Bluetooth address of the specific device you want to connect to, you can skip the discovery process and use the Bluetooth Open Connection function to connect to the device directly.
    Thank you & Best regards
    syrpimp
    =======================================================
    “You must continue to gain expertise, but avoid thinking like an expert." -Denis Waitley

  • No longer can use bluetooth to phone

    Hi,
    I was transferring files to my phone a few days a ago, but since last update am unable to do so any more ;-(
    Phone asks for pin which I enter but it fails to connect
    Tried changing hcid.conf to none [security and pin!]
    Still nothing
    bluetooth-sendto sees phone and tries to connect...
    cannot get obexftp will not work either
    Wondered if I need to alter my config or make some other change?
    Thanks
    MrG

    try to run blueman or gnome-applet as root from bash. After some initialization I am getting this message.
    bash wrote:[root@* /]# blueman
    * Initializing 'Bluetooth.manager' Class
    * Initializing 'Bluetooth.services' Class
    * Adapter Found
    * Initializing adapter hci0
    * Initializing 'Bluetooth.inquiry' Class
    * Initializing 'Bluetooth.dbusAgent' Class
    * Killing Bluetooth applet
    * Passkey agent registered
    * Authorization agent registered
    libnotify-Message: Unable to get session bus: Did not receive a reply. Possible causes include: the remote application did not send a reply, the message bus security policy blocked the reply, the reply timeout expired, or the network connection was broken.

  • SonyEricsson and Bluetooth, even possible?

    So I'm getting kind of frustrated. I'm digging into Bluetooth and J2ME for the first time, and am using my SonyEricsson T610 as a test phone.
    I am compiling using the Sony Ericsson Wireless Toolkit, a modified version of Sun's, and am doing everything in J2ME 1.1.
    Here is the code (shamelessly ripped from someone else) that I am trying to get to run. It compiles fine, and I can package it up using the wireless toolkit. But I'm starting to wonder if Java can even get to the bluetooth functions of my phone. My phone is calling it an invalid program, and the emulator throws exceptions.
    Thank you guys so much for ANY help or pointers. I'm getting nervous that what I've chosen for a final project for the semester may be impossible, and I'm running out of time :(
    these are the runtime errors from the emulator:
    startApp threw an Exception
    java.lang.RuntimeException: Not Implemented! Used to compile Code
         at javax.bluetooth.LocalDevice.getLocalDevice(+9)
         at BlueToothTest.startApp(+3)
         at javax.microedition.midlet.MIDletProxy.startApp(+7)
         at com.sun.midp.midlet.Scheduler.schedule(+225)
         at com.sun.midp.dev.DevMIDletSuiteImpl.schedule(+7)
         at com.sun.midp.Main.runLocalClass(+20)
         at com.sun.midp.Main.main(+92)
    And here is the code:
    import javax.microedition.midlet.MIDletStateChangeException;
    import javax.microedition.midlet.MIDlet;
    import javax.microedition.lcdui.Display;
    import javax.microedition.lcdui.Form;
    import javax.bluetooth.*;
    import java.io.IOException;
    public class BlueToothTest extends MIDlet implements DiscoveryListener
         RemoteDevice btDev = null;
         Display dis;
         Form form = new Form("Client");
         protected void startApp() throws MIDletStateChangeException
              try
                   DiscoveryAgent agent = LocalDevice.getLocalDevice().getDiscoveryAgent();
                   agent.startInquiry(DiscoveryAgent.GIAC, this);
                   dis = Display.getDisplay(this);
                   dis.setCurrent(form);
                   form.append("searching...");
              catch (BluetoothStateException e)
                   e.printStackTrace();
         protected void pauseApp()
         protected void destroyApp(boolean b) throws MIDletStateChangeException
         public void deviceDiscovered(RemoteDevice remoteDevice, DeviceClass deviceClass)
              try
                   form.append("Device :- " + remoteDevice.getFriendlyName(false));
                   btDev = remoteDevice;
              catch (IOException e)
                   e.printStackTrace();
         public void servicesDiscovered(int i, ServiceRecord[] serviceRecords)
              //form.append("Service:- "+ )
         public void serviceSearchCompleted(int i, int i1)
         public void inquiryCompleted(int i)
              form.append("No Device Found.");
    }

    Okay, so I may have figured a few things out...
    Would I be correct in guessing that the reason the emulator throws exceptions is because the emulator doesn't actually have a bluetooth device to interact with? Does it not emulate the bluetooth hardware?
    Also, I built an obfuscated package instead of a regular package, and I can upload the jar file and run it now without the phone giving me an invalid app error. However, Java loads, the App appears to lunch, and a second later it goes back to the main menu.
    I can't find a Delay() function in the API in order to slow the app down... if in fact that is the problem, the app does everything correctly, but does it too fast to actually display anything that I can see.
    It's hard to test and trouble shoot when you aren't exactly sure what to expect, or what is "normal" :(

  • Mobile game programming with bluetooth technology

    hi,
    i want to develop mobile game with 2 players,blutooth .(J2ME)
    but i dont know anything about connecting 2 telephones with bluetooth.If anyone knows about it,please help me,because this project is very important for me.
    thanks a lot

    Hi
    Here are 2 tutorials on how to use Bluetooth in J2ME:
    http://developers.sun.com/techtopics/mobility/midp/articles/bluetooth1/
    AND
    http://developers.sun.com/techtopics/mobility/midp/articles/bluetooth2/
    Also, Benhui has some really good resources regarding this:
    http://benhui.net/modules.php?name=Bluetooth
    Mihai

  • PDA While Loop using Bluetooth results in interface lockup

    The PDA Module ships with an example project that demonstrates client/server Bluetooth communication.  I decided to try it out with my PC acting as the server and my PDA as the client.  The demo basically transmits waveform data continuously via Bluetooth from server to client.  Attached is the code for the client PDA and the heart of the code is a while loop which continuously accepts data via Bluetooth and outputs the data onto the display.  For the most part, this is the stock example VI
    that ships but I had to modify the interface with an event structure so
    that I could use the PDA virtual keyboard to enter in the proper server
    address.
    The Bluetooth portion of the demo actually works great!  When the data set is set to random, the PDA very quickly displays new random data on the LCD.
    The problem occurs when I try to stop the VI.  Both the disconnect and Exit booleans are unresponsive when I tap their respective buttons.  My desired application will behave similarly to this demo which is why this is of concern to me.  Is there a better way to implement a continuous Bluetooth polling system but still retain the functionality of my front panel?
    System specifications:
    PDA Module 8.0.1
    iPAQ hx2790
    Windows Mobile 5.0.
    Attachments:
    NI PDA Bluetooth demo.JPG ‏106 KB

    Hi,
    Just by looking at the snapshot it is hard to tell what's going wrong. Since the bluetooth part is working fine, I would suggest that you try to strip the bluetooth part from your VI and run the VI in highlight execution mode. This should shed some light on what happens when you click on Stop or Exit buttons. If you still need help after that, please post your stripped VI here and someone from the community will be sure to help you out.  
    Regards,
    Ankita

  • Bluetooth modes in blackberry

    Is there any way to set park or sniff mode of bluetooth using J2ME or Native BlackBerry APIs?
    response will appriciated!!!

    Hi,
             I have Tested as per your suggestion by trasferring data over bluetooth to anyother bluetooth device. below is scenario what i have done.
      1. I set input language as french in Torch 9860 and set input language as english in blackberry curve 8520.
      2. Now i try to pair Torch device to 8520 blackberry curve from bluetooth option. It able to pair device.
      3. Now i go to media option and try to send image from torch 9860 (input language as french) TO curve 8520
          (input language as English). But it was failed to send image. i get message "trasfert de fichier service   introuvable"       which means file transfer service not found. if i set input lanague as english in torch then i am
    able to transfer the image but in case of french i am not able to transfer image.
     please let me know how can i resolve this issue as even blackberry itself  not able to transfer data  as this feature work fine in android and iphone but blackberry stuck as in standrd procedure. i have attached image of torch mobile with this reply.
    Regards,

  • MIDP and Bluetooth as Java Card substitute

    Hi,
    I'm a Java developer, but not a Java Card developer, so I'm curious about the opinions of Java Card developers. It seems to me that IR and Bluetooth enabled J2ME/MIDP devices could be used in many situations where Java Cards are currently used. Depending on the adoption rates of
    a) Bluetooth enabled computers, devices, access points, etc... and
    b) cell phones with both Bluetooth and J2ME
    It may soon (a year or two) become cheaper and/or more convenient to issue users without a J2ME Bluetooth phone, such a device, than to issue all users Java Cards.
    So, entrenched coders
    1) Is this migration sane?
    2) Is anybody doing it, now?
    3) How hard/trivial is porting the applications?
    Thanks,
    Curt

    I'm aware of the JSR, but what is the security element ?On Sun Tech Days I was told it should be a Java Card. ;-))
    The main advantage of a smartcard is that it provides a trustworthy and tamper-resistant environment.
    Please have a look at
    http://www.simalliance.org/portal_upload/SIMalliance_comm.PDF
    I quote from the SIM Alliance site:
    "Thanks to a defined standard, easy downloading and powerful operating systems displaying high quality graphics, J2ME phones are making their mark. This leads to the question with such success and a memory capacity up to 1000 times the (U)SIM, will this relegate the Smart Card to a second class citizen?
    While Smart Card cannot compete with a Java handset for the sexy aspects of applications such as graphics, the core attributes of a Smart Card offer a number of significant benefits to application delivery, execution and management. All of these features require privacy management, security, portability and one-to-one personalization.
    Wireless applications must be secure and robust. However, it is feared that operators' revenue streams and secure pipeline will be threatened by the free delivery of applications mimicking the loss-making Internet portal model.
    This is where the Smart Card, (UICC, (U)SIM, and equivalent), will play an essential role in providing security, building trust and protecting revenues for mobile businesses.
    The card will become an integral part of the architecture for distributed applications running at the same time on Server, Handset and Smart Card to leverage the respective benefits of each part of the infrastructure.
    By looking at the strong points of each of the Java standards, Java Card and J2ME are not competing technologies but instead can be used in tandem to create an "open" and "secure" infrastructure that operators and content providers need in order to increase their ARPU and diminish costs. At present this infrastructure does not exist but leading operators, handset manufacturers, content providers and (U)SIM suppliers are working to make it a reality."

  • Nokia OVI keeps bluetooth connection active

    Hi. I recently switched from PC suite to the new OVI suite. This new application keeps the bluetooth connection to the phone active from the moment that you connect to the phone. With PC suite there was only a connection active during communciation. The result is that OVI is communicating with my phone continuously, thus consuming a lot of battery power constantly. I have switched off all automatic sync options. Does anyone know how to stop this continuous bluetooth connection? Thanks in advance. With kind regards, Ron. Nokia Ovi Suite 2.0.2.42 PC Connectivity Solution 9.45.0.0 Connectivity Cable Driver 7.1.23.0 Nokia Ovi Suite Software Updater 2009.40.0.60128 Maps Service API 3.0.38.0 Nokia mPlatform 2.6.40 Ovi Desktop Sync Engine 1.1.0.77 Operating system: Microsoft Windows XP 32-bit Edition, Service Pack 3 Language: English Detected internet browsers: - Microsoft Internet Explorer 7.0.5730.13 Detected Bluetooth stacks: - Microsoft (Version: 5.1.2600, Build: 5512) - IVT BlueSoleil (Version: 2.7.0, Build: 8)

    Being a lazy user of Nokia PC Suite (let others go to the Bleeding Edge, don't try and do difficult functions, use it only for basic phone security, ...), I was happily bumbling along, backing up my Contacts, Calendar etc., without a care in the world.  Then along comes a 'new and better' version of PC Suite and without much thought I install it and trash the previous version install files.  And guess what?  The ***bleep*** new version fails to do backup of the Contacts file (just hangs forever). Any bug-fixing or other quick correction for PC Suite now looks unlikely, especially given comments here about Ovi becoming the only Nokia-supported option (even if actually support is patchy or non-existent).
    So, looking for pain-free (or at least pain-reduced) alternatives, I investigate Ovi.  And one of the first comments I see says that it's a reduced-function form of PC Suite!  And PC Suite doesn't work properly anyway!!
    And oh look!  Ovi may not actually support my phone (6600 Slide) and according to this thread is misuses Bluetooth to the point of draining the phone battery even if no useful activity is in progress.   Give me strength!!!  Why release ANOTHER pile of , when judging by the LONG list of problems here, there has been no success making its predecessor work properly? 
    Message Edited by wildreamer on 19-Dec-2009 10:48 AM

Maybe you are looking for

  • How to show multiple values for Unique records in Report

    Here's my question/problem: I've joined two tables, one table (TBL1) contains an object id (OBJ_ID) that repeats and the other table (TBL2) contains a date (DT), object type id (OBJ_TYP_ID), and object type description (OBJ_TYP_DES). The tables are j

  • Issue w/ Spaces - Applications moving from screen to screen

    Have been using that laptop for 2 months now - love it. Spaces is a very nifty feature (have it set it up on 4 screens). While I know how to navigate between spaces (using control+arrow for example), very often, my apps are moving from one space to t

  • FYI... indexing with version 9.0.2.x

    I have been working for a while trying to figure out how to get indexes to work properly using XML DB on version 9.0.2.4. I finally ran across this and figured I would share it to hopefully save someone some time if they have the same issue. with sto

  • Condition tables -Urgent

    Dear Gurus, Please provide me the sufficient answer for the following query condition tables are not allowed upto 001 to 500 why Regards Ramesh babu

  • Version of Presenter 8 to download if OS Windows 7 64 bits and PPoint is 2010 32 bits

    I am traying to install Presenter 8 in my computer which has Windows 7 64 bits and Power Point 2010 32 bits.  The program downloads well, but it presents an error when installing eigther version (64 or 32 bits).  Neither completes installation after