Watch, Follow, &
Connect with Us

For forums, blogs and more please visit our
Developer Tools Community.


Welcome, Guest
Guest Settings
Help

Thread: Classic Bluetooth sample not working



Permlink Replies: 3 - Last Post: Dec 9, 2017 12:02 PM Last Post By: Scott Pinkham
Thomas Rook

Posts: 1
Registered: 7/14/10
Classic Bluetooth sample not working
Click to report abuse...   Click to reply to this thread Reply
  Posted: Apr 25, 2017 7:00 AM
Hello,

when I want to pair with a bluetooth device with the sample program: Classic Bluetooth Basic app located in: ..\Samples\Object Pascal\Multi-Device Samples\Device Sensors and Services\Bluetooth\Classic Bluetooth Basic app

The button pair doesn't work when it's compiled for Windows.
It hangs for a couple of seconds (about 10 secs) and then does nothing.
Sometimes Windows comes immediate with an popup when I click the pair button.

info:

When it's already paired, unpairing is working perfectly. even services can be read.

My IDE is working on a Windows 10 PC.
PC Version: Microsoft Windows 10.0.14393 (14393.1066, build 1607)
I've tried compiling with different IDE versions (XE8, XE10.1, XE10.2) and even the c++ builder versions
It's compiled in 32bit and 64bit and tested on windows 7, Windows 10 Pro and Windows 10 Embedded.

what's wrong?

Thanks!

Edited by: Thomas Rook on Apr 25, 2017 7:08 AM

Scott Pinkham

Posts: 54
Registered: 3/19/07
Re: Classic Bluetooth sample not working
Click to report abuse...   Click to reply to this thread Reply
  Posted: Apr 27, 2017 8:58 AM   in response to: Thomas Rook in response to: Thomas Rook
Thomas Rook wrote:
Hello,

when I want to pair with a bluetooth device with the sample program: Classic Bluetooth Basic app located in: ..\Samples\Object Pascal\Multi-Device Samples\Device Sensors and Services\Bluetooth\Classic Bluetooth Basic app

The button pair doesn't work when it's compiled for Windows.
It hangs for a couple of seconds (about 10 secs) and then does nothing.
Sometimes Windows comes immediate with an popup when I click the pair button.

info:

When it's already paired, unpairing is working perfectly. even services can be read.

My IDE is working on a Windows 10 PC.
PC Version: Microsoft Windows 10.0.14393 (14393.1066, build 1607)
I've tried compiling with different IDE versions (XE8, XE10.1, XE10.2) and even the c++ builder versions
It's compiled in 32bit and 64bit and tested on windows 7, Windows 10 Pro and Windows 10 Embedded.

what's wrong?

Thanks!

Edited by: Thomas Rook on Apr 25, 2017 7:08 AM


I believe that in Windows you have to manually pair the device first using the Bluetooth control panel applet. What kind of device are you using?
I use the Bluetooth components with Delphi a lot, but mostly on mobile and OSX and it works great there, but I do struggle with it whenever trying to use it with Windows. Windows support for Bluetooth isn't that great (some profiles aren't supported at all in Windows yet).
Steven Ollmann

Posts: 1
Registered: 7/3/04
Re: Classic Bluetooth sample not working
Click to report abuse...   Click to reply to this thread Reply
  Posted: Dec 8, 2017 1:35 PM   in response to: Scott Pinkham in response to: Scott Pinkham
I have Tokyo 10.2 build 1 and trying to use the Bluetooth Demo applications.

For ExplorerDevicesLECpp sample, it doesn't do anything. When exiting you get an error "Abnormal program termination" and have to use Task Manager to fully "kill" the application.

Understood that Windows 10 you must "pair" first. I can take any OBD-II scanner program and connect to any of 3 different brands of OBD-II Bluetooth ELM327 adapters.

With ClBluetoothCpp, it can find the device if already paired. Different OBD-II devices have different number of services, some have both PnP and SPP services and some just SPP services, however trying to send a text message using this tool, you get error message: "Cannot connect to device: (10049): the requested address is not valid in its context".

I removed the Bluetooth module from one of the devices and connected a TTL to USB adapter and I can send straight text to the device and get text responses.

With some searching on YouTube I was able to find the reference from both McKeeth and David I on connecting an "undefined" scale, they used the ExplorerDevices sample (referenced above) to find all of the pertinent information to connect and leverage services from the device. Unfortunately, it doesn't work for me.

Searching here, I was hoping to find a better answer as to why or how to get Bluetooth working on C++ Builder.

Certainly there is something silly or some setting that precludes a successful compile, run, and test of the sample programs. I thought maybe there was an intentional or unintentional bug in the project that with a quick edit and voila, all is great in the Bluetooth world.

Anyone having similar problems? Any advice on next steps? I'd hate to buy OBD-II Bluetooth devices and remove the Bluetooth to create a functional application / service to my clients. :(
Scott Pinkham

Posts: 54
Registered: 3/19/07
Re: Classic Bluetooth sample not working
Click to report abuse...   Click to reply to this thread Reply
  Posted: Dec 9, 2017 12:02 PM   in response to: Steven Ollmann in response to: Steven Ollmann
Without seeing some code examples I'm not sure how much help I can offer. I can say this -- I've been working on Bluetooth apps using Delphi for quite a while now, and have pretty much given up on targeting Windows because Windows support for Bluetooth is 'not great'. I have an app that uses Bluetooth and works great on iOS, Android and macOS, but won't work on Windows at all. My app uses Bluetooth LE, not 'classic' Bluetooth, so my experience may not be applicable to your application. I haven't used classic Bluetooth in any apps.

-Scott

Steven Ollmann wrote:
I have Tokyo 10.2 build 1 and trying to use the Bluetooth Demo applications.

For ExplorerDevicesLECpp sample, it doesn't do anything. When exiting you get an error "Abnormal program termination" and have to use Task Manager to fully "kill" the application.

Understood that Windows 10 you must "pair" first. I can take any OBD-II scanner program and connect to any of 3 different brands of OBD-II Bluetooth ELM327 adapters.

With ClBluetoothCpp, it can find the device if already paired. Different OBD-II devices have different number of services, some have both PnP and SPP services and some just SPP services, however trying to send a text message using this tool, you get error message: "Cannot connect to device: (10049): the requested address is not valid in its context".

I removed the Bluetooth module from one of the devices and connected a TTL to USB adapter and I can send straight text to the device and get text responses.

With some searching on YouTube I was able to find the reference from both McKeeth and David I on connecting an "undefined" scale, they used the ExplorerDevices sample (referenced above) to find all of the pertinent information to connect and leverage services from the device. Unfortunately, it doesn't work for me.

Searching here, I was hoping to find a better answer as to why or how to get Bluetooth working on C++ Builder.

Certainly there is something silly or some setting that precludes a successful compile, run, and test of the sample programs. I thought maybe there was an intentional or unintentional bug in the project that with a quick edit and voila, all is great in the Bluetooth world.

Anyone having similar problems? Any advice on next steps? I'd hate to buy OBD-II Bluetooth devices and remove the Bluetooth to create a functional application / service to my clients. :(
Legend
Helpful Answer (5 pts)
Correct Answer (10 pts)

Server Response from: ETNAJIVE02