VB6 User Interface for Bluetooth device
I want to use VB6 to create a GUI for communicating with a Bluetooth device. The 'device' is a TI processor with a custom made application, which you can connect to and send a few commands. On the PC side I have a Bluetooth dongle (BLED112) , which appears to behave as a serial port (happens COM9 on my PC). An existing user interface is written in Python, but as said I'd like to use VB6. .. I know my way around in VB6 (sort of..), but little or no experience with Bluetooth... So much for the introduction.
Questions:
Do you know how/what to send to the COM port (using MSCOMM offcourse) to interact with the BT dongle? Is that specific for a dongle, or is there a standard for this? Is Bluetooth communicattion always through a serial port?
I used a SerialPortMonitor uitility to 'listen' what is sent over the serial line during a "connect". It seems only to be a few bytes. I tried to repeat those bytes, sending the same bytes as seen with PortMon, and indeed I got some response, but no clue what I see.... I understand that is is a process of 'advertising' !?
I guess this is more a Bluetooth question than VB6, nevertheless it would be cool for me to demonstrate the use of VB6 to communicate to the BT device.. A VB6 GUI is so much more impressive than Python, so I'd appreciate any help in my quest...:)
_Wim_
Re: VB6 User Interface for Bluetooth device
Re: VB6 User Interface for Bluetooth device
A Bluetooth adapter does not appear as a serial port device. The question is what your "TI processor with a custom made application" does.
Sure, it is possible that this device presents as a serial port device over Bluetooth. If so it shouldn't be a problem for an instance of MSCommLib.MSComm as long as it uses a data rate and character format that the control supports.
Don't get confused though. For example see List of Bluetooth profiles.
It sounds like you may have a simple case of a device that is using the Serial Port Profile. Surely inspecting the Python script would tell you what you need to know?
Re: VB6 User Interface for Bluetooth device
Thanks for helping me out here. Again I realize this is not a real VB6 question, but as as you all out here (and there are many!!) are enthusiastic VB6 programmers I had hoped that one of you has experience with Bluetooth and/or this Bluetooth dongle BLED112.
The dongle I have acts as a virtual COM port.. really. I was suprised as well. Device manager shows "Bluegiga Bluetooth Low Energy (COM9)" under "ports (COM & LPT)". So its not that the application is a serial port. Thats the reason I want to use mscomm in VB6 to make a GUI for the application. Reading the list of profiles (thanks for the link), I recognized GATT as profile apparently used.
I guess it boils down to what API is used, and indeed the Python sources would be a good start, but despite what people say, Python is not my cup of tea.. I prefer VB6 :)
1 Attachment(s)
Re: VB6 User Interface for Bluetooth device
Quote:
Originally Posted by
_Wim_
I want to use VB6 to create a GUI for communicating with a Bluetooth device. The 'device' is a TI processor with a custom made application, which you can connect to and send a few commands. On the PC side I have a Bluetooth dongle (BLED112) , which appears to behave as a serial port (happens COM9 on my PC). An existing user interface is written in Python, but as said I'd like to use VB6. .. I know my way around in VB6 (sort of..), but little or no experience with Bluetooth... So much for the introduction.
Questions:
Do you know how/what to send to the COM port (using MSCOMM offcourse) to interact with the BT dongle? Is that specific for a dongle, or is there a standard for this? Is Bluetooth communicattion always through a serial port?
I used a SerialPortMonitor uitility to 'listen' what is sent over the serial line during a "connect". It seems only to be a few bytes. I tried to repeat those bytes, sending the same bytes as seen with PortMon, and indeed I got some response, but no clue what I see.... I understand that is is a process of 'advertising' !?
I guess this is more a Bluetooth question than VB6, nevertheless it would be cool for me to demonstrate the use of VB6 to communicate to the BT device.. A VB6 GUI is so much more impressive than Python, so I'd appreciate any help in my quest...:)
_Wim_
I have not really tried bluetooth with VB6, but I did find a project lying around. It detects bluetooth devices but I have no idea how to work with it other than that, have not played with it much. Please post a follow up if you make any progress on your question. There are about 18 BT API at pinvoke with the reference to "irprops.cpl".
Re: VB6 User Interface for Bluetooth device
I have only worked with Bluetooth a few times. In all cases it was just serial communications. In one case it was a blue tooth dongle that was used to connect a blue tooth scanner. To VB it was just another serial port. In the other cases it was a portable printer used with a Windows mobile device using Vb.Net and again it was just another serial port as far as VB is concerned.
Just needed to set the port, baud, stop bits, data bits and parity correctly then send or receive the data to/from the port as if it were any other com port.
Re: VB6 User Interface for Bluetooth device
It sounds like you are using some USB Bluetooth adapter that calls itself "Bluegiga Bluetooth Low Energy." So you have a totem pole of adapters, but this is the easiest way to get BT support on an older PC with no built in BT adapter.
The important point here is that "Bluegiga Bluetooth Low Energy" is just the name. BLE does not support the Serial Port profile, so it isn't using BLE for that. Your COM9: device is a Bluetooth serial port, not a "Bluetooth Low Energy" serial port since no such thing exists.
If you can open this port and type stuff and get something back, even if it looks like garbage, then it seems very likely that the paired device just looks like any other serial port to application software.
If the paired device (your TI thingy) is actually using BLE/GATT you'd have a tough row to hoe here. BLE support in Windows was all but non-existent until Windows 8 or so and very minimal until Windows 10 1709. Even then there isn't any easy way to use it outside of WinRT ("Store Apps" a.k.a. UWP) as far as I can tell.
But it seems very unlikely that's in use here anyway.
Re: VB6 User Interface for Bluetooth device
This BLED112 dongle was choosen by our FW supplier, that writes the FW for a application involving the TI BLE processor. The idea is that through this dongle one can communicate to this TI board. This supplier also provides a minimalistic user interface, written in Python. but I want to use VB6 to make a GUI.
I found a API document for the dongle, that lists all commands one can send to the dongle, and I could relate the bytes to send and expected to be received as response, compared with a dump using a Port Monitor program.
Now my plan is to make VB6 to send these commands to the COM port with mscomm (easy), and grab the received bytes by the event handler of mscomm, collect the received message and process the stuff. Since it is a "command & response" type of communication, it should be fairly simple I guess..
BTW I've seen that BTEnum Demo thing, but that shows connected and/or remembered devices. But I'm not sure what to do with it.. (BTW... this demo shows an interesting way of dealing with a textbox used as a log window and setting tabs. At least I think it is interesting..)
Nevertheless thanks for 'listening', suprises me every day how many people out there still using VB6 and willing to help out...!
Re: VB6 User Interface for Bluetooth device
What you need to look it are the specs of this external device and the firmware that it is running. That should spell out what you need such as the data rate, message formats, and interaction flow.
If no SDK is available documenting this... dump the hardware or at least the firmware and find another vendor. If that's impractical then all you can do is read through the Python script and try to extract the information so you can write your own documentation. Once you have that it should be a piece of cake... aside from features that the script didn't make use of or do quite correctly.
You really ought to be able to treat this as a dumb RS-232 null modem cable with a UART and microcontroller at the other end.
This sounds like shoddy work by some hardware company. They don't budget for software so you get poor quality software, probably done by a student intern or some junior "engineer" who had a few Arduino and Python classes in college.
Or worse yet something cobbled up by contract through one of those "Low-Ball Coder dot Com" sites.
I've worked with stuff from a lot of Chinese hardware companies and even they aren't this bad about documentation. Sometimes it can take a while to figure out where to download the info from though, and sometimes you need to request it.
Re: VB6 User Interface for Bluetooth device
Just to wrap up this topic, so I can set it to solved...
Meanwhile I found a API manual for this BLED112 dongle. It is actually very simple, once you know it .. :)
I can open the dongle as a normal serial port using MsComm control. The idea is that you send commands, and expect response back. Kind of acknowledge. Some commands also send back Events.
Commands I send using as example:
Code:
MsComm1.output=GAP_DISCOVER & Chr(mode) '('pseudo' Const set as Chr(0) & Chr(1) & Chr(6) & Chr(2) )
Response and Events I collect in the On_Comm event. Just by adding any data received to an (global declared) InpBuf as string variable:
Code:
InpBuf = InpBuf & MsComm.Input
Then separate 'Expect' routine that extracts expected data from InpBuf. Since the format of expected data is well defined this is also not a big deal. Meanwhile I can open and connect to the dongle, send a BLE_HELLO command, and get result back. Now working on getting real data from the wireless application...
The only question I now have is how to map in a more elegant way the data read back into a structure. But I open a new topic for that, since that is not really related to this one. So this topic is closed.