Welcome! Log In Create A New Profile

Advanced

Bluetooth Services WD23

Posted by Lee Shroder 
Bluetooth Services WD23
April 04, 2019 01:04AM
Hi everyone smiling smiley

I am having some difficulty with connecting to a bluetooth printer via WD23 and a windows 10 PC and I am really hoping someone can shed some light on this problem for me..

The requirement is for the windev application to pair to a bluetooth printer which creates a virtual com port.

The way I am performing this task in Windev is I find the bluetooth devices via the command :-

sListDevices = BTListDevice(btDetailedList,btStatusAll)

Within the list returned I can find the device I wish to connect to.

I select the specific device and then list the services available using:-

sListServices = BTListService(nDeviceNumber)

nDeviceNumber being the device ID selected from the BTListDevice command.

This returns a service called SerialPortServiceClass_UUID

Next I use the following command to connect to the service:-

IF BTEnableService(TABLE_Devices.COL_DeviceNo,TABLE_Services.COL_ServiceDetail) = True THEN

Info(TABLE_Services + " Connected")

ELSE
Trace("Device: " + TABLE_Devices.COL_DeviceNo + ", service: " + TABLE_Services.COL_ServiceDetail)
Info(ErrorInfo(errFullDetails))

END

This works OK and if I now study the available COM ports a new virtual com port will appear that I can use to print to the printer with no problem and all seems to be OK. Open ComX send print data close Comx and the printer will print the data sent.

If I then power the printer off, then power back on I can then no longer open the com port to print to the printer.

Windows still see's the com port associated with the bluetooth printer but no applications within Windows can open the com port and communicate with the printer. The only way to restore communication is to completely remove the device and start the process again which is impossible to manage as the application has no idea if the printer has been power cycled.

Here is the interesting part, when creating the connection through Windev, the settings within Windows Bluetooth Com Ports list a single com port:-

COM17 Outgoing TOSHIBA TEC BT 'SPP Dev'

If I completely remove the device and connect the device using Windows (not Windev) and check the Bluetooth Com Ports, windows creates 2 com ports as follows:-

COM17 Outgoing TOSHIBA TEC BT 'SPP Dev'
COM18 Incoming TOSHIBA TEC BT

When there are two COM ports configured this way I am able to power cycle the printer and still print to COM17, I believe the incoming COM port is required by the device for some form of handshaking at power up and first communication.

So the question is how can I create the incoming com port connection using Windev?

I hope this all makes sense and thank you for any help offered.


Kindest Regards,

Lee Shroder
Author:

Your Email:


Subject:


Spam prevention:
Please, enter the code that you see below in the input field. This is for blocking bots that try to post this form automatically. If the code is hard to read, then just try to guess it right. If you enter the wrong code, a new image is created and you get another chance to enter it right.
Message: