DiscoverSingleDevice is covered in the Palm OS Programmers API Reference - p1881 under Bluetooth Library: Management section.

Yes I agree that you don't necessarily have to fiddle with BtLib as it will do a lot of the work for you, doing the discovery and presenting the user with a handy list of nearby available Bluetooth devices. However, the reason I have "gone deep" with BtLib is so that the connection and transmission via Bluetooth is a seamless as possible as whilst most users will be fine selecting the right device from the list, you will always have one who will try to connect to their mobile phone or PC instead of the modem which is what the program is looking for!

So both approaches work, it is what your users want and how you want your program to flow which dictates which path you take.


Edward Jones

Shorin wrote:
Where's the documentation for that? Is it in the ACCESS docs somewhere or on palmdev? (link would be helpful)

Thanks

Henk Jonas wrote:
Actually, there is no need to fiddle with the BtLib. Even if you need to Discover a single device (to remember it's address for later use) you just call the DiscoverSingleDevice function. Or you don't care and just open the serial connection. the BtStack will go and ask the user which device he wants to connect to.

Shorin wrote:
!!!!!!!!! THANK YOU! I think I will be well on my way with that detailed help you gave me. I do not remember any instructions like that in the ACCESS documentation...which didn't cover bluetooth specifically and seems to be a little outdated. Oh also, I didn't know that you could write palm apps with Pascal... I'm using C++. From what you said, I doubt the process is much different.

Thanks!!

Shorin

Edward Jones wrote:
Error 0x03EA sounds like you haven't paired the device you are connecting with, you need to go through this process before you can send and receive any data. Also note that before using SrmExtOpen to open your Bluetooth serial connection you must close the Bluetooth library otherwise you will get error 0x30A.

So after pairing the devices, Palm->mobile phone or Palm->modem or Palm->pc etc (once done you should not need to do this everytime), the process I go through to setup and use a Bluetooth serial connection is:

1) open the Bluetooth lib
2) setup a callback routine to deal with Bluetooth discovery responses (BtLibRegisterManagementNotification)
3) start the discovery process (BtLibStartInquiry)
4) find out if the device I want to connect to is in range and responding in my callback routine setup in step 2 5) once I have the device, fill in the Palm structures sppUid, btParams and SrmConfig
6) close the BtLib (**important**!)
7) open the serial connection using SrmExtOpen
8) send data to the paired device over the serial ink using SrmSend
8) use SrmReceiveWait to wait for incoming traffic and receive that data using SrmReceive
9) finally once I am done, use SrmClose to close the serial port

If you want I have a working example in Pascal which goes through the processes to connect to a Bluetooth modem.

Hope this helps!


Edward Jones



Shorin wrote:
Hi,

I'm relatively new to Palm OS Programming (but not programming in general). I can't seem to get the serial port open with the Bluetooth Connection panel serial port. The VirtRfComm doesn't work either, but I know that needs some extra settings passed to SrmOpenEx to open. I've been trying this with SrmOpen and SrmOpenBackground. Those functions keep failing with something like 0x03EA or something like that. This used to make my phone go into a reset loop until i deleted the program. I think i had other bad files that were causing that, though.

So anyways, whats the REAL way to open a bluetooth serial connection?

Thanks,

Shorin







--
For information on using the ACCESS Developer Forums, or to unsubscribe, please 
see http://www.access-company.com/developers/forums/

Reply via email to