Solved

Sending files to bluetooth device using vb.net

Posted on 2010-08-22
4
3,413 Views
Last Modified: 2013-12-14
We write software for the Symbol/Motorola 9090 scanner, using vb.net 2005, Windows CE, Framework 2.0.  One feature that works well is an interface to a weight scale with a serial interface, where we can send and receive data through the scanner's COM1 port on the bottom, using the snap-on cable.  And, we can send lines of print to a dot matrix printer, going out that same COM1 port, and converting the serial data to the parallel port on the printer.  We use Franson serial tools to manage the coding for the serial port, which I think it just an easy-to-use version of the serial commands built into vb.net 2005.

But now a customer wants to be able to send print lines from the scanner to a Zebra bluetooth printer--which raises questions, since we've never done this before:

1) Will I simply pair the scanner to the printer, much like pairing a cell phone to a bluetooth-equipped car?

2) The documentation for the scanner says I can pick from COM4, COM5, or COM9 for my "virtual serial port".  Since they are referred to as COM ports, does this mean that I should be able to use the Fransion serial tools code that I now use for a normal COM1 port, simply setting the right COM port and baud rate, etc.?  Or, is it somehow more complicated sending data to a bluetooth printer through a "virtual COM port"...and if so, in what way?

3) Will I need to define which of these virtual COM ports I want to use on the printer itself?  Or, will it be sufficient to simply pair with it, and then I can expect the data to flow from scanner to printer, regardless of which virtual COM port I choose on the scanner?

4) Maybe I just need some general guidelines on how to send data to a bluetooth device from a vb.net program???

TIA
0
Comment
Question by:sasllc
  • 2
4 Comments
 
LVL 53

Assisted Solution

by:Dhaest
Dhaest earned 100 total points
Comment Utility
I never did it myself, but I'm studying it now through this example:

Make Bluetooth Work for You: Build a Sample Chat Application
http://www.devx.com/wireless/Article/11511/1954?pf=true
0
 
LVL 24

Accepted Solution

by:
alexey_gusev earned 400 total points
Comment Utility
>> 1) Will I simply pair the scanner to the printer, much like pairing a cell phone to a bluetooth-equipped >> car?
Yes, you would need to discover that printer in BT Settings on PDA and pair

>> 2) The documentation for the scanner says I can pick from COM4, COM5, or COM9 for my "virtual
>> serial port".  Since they are referred to as COM ports, does this mean that I should be able to use the
>> Franson serial tools code that I now use for a normal COM1 port, simply setting the right COM port >> and baud rate, etc.?  Or, is it somehow more complicated sending data to a bluetooth printer through >> a "virtual COM port"...and if so, in what way?
In general, under WM when you pair BT device, you have In and Out com ports (COM5 and COM7 if I remember correctly), so you could use Franson in the same way as with COM1

>> 3) Will I need to define which of these virtual COM ports I want to use on the printer itself?  Or, will it
>> be sufficient to simply pair with it, and then I can expect the data to flow from scanner to printer,
>> regardless of which virtual COM port I choose on the scanner?
Pairing should be enough (and then choosing the port). As far as I understand, WM uses Bluetooth SPP (Serial Port Profile) in this case, so you only need to configure PDA's side.

>> 4) Maybe I just need some general guidelines on how to send data to a bluetooth device from a vb.net >> program???
It depends on Bluetooth profiles that Zebra printer supports and BT stack on the device. Have a look at http://inthehand.com/Default.aspx  or you could create your own wrappers for Win32 API and sockets
0
 
LVL 3

Author Comment

by:sasllc
Comment Utility
After much experimentation, I finally got this working on a Symbol/Motorola 9090 running Win CE and a Zebra P4T mobile printer.  A few things I learned:

The Symbol 9090 does not appear to make a distinction between input and output COM ports.  I picked the lowest one on their list--COM4--and used it, and I unchecked the other two, which was probably not necessary.

I paired the scanner to the printer using the bluetooth utilities built into the scanner, so that I did not need to worry with putting software in my app to do discovery, etc.

I was indeed able to output data to COM4 using the same Franson commands that I normally use to output serial data over COM1.  Apparently it does not care about the settings for baud rate and parity, etc. because it's running in bluetooth mode.

For the longest time I could not get any output from the printer, making me think that I was doing something wrong in my app.  This was especially true since I WAS able to get text output when the printer was connected to my PC via USB--such as "this is a test" sent from Notepad.  But the problem ended being a setting in the printer, which can be adjusted using Zebra's free Label Vista software.  In Label Vista, I found a setup screen at Priner> Printer Settings that allowed me to define the Printer Language to "Line Print", which then accepted plain text and printed just fine.  Once I realized that I did have a connection after all, I was then able to go back and change that setting to ZPL and send ZPL-formatted text to create bar codes as usual.
0
 
LVL 24

Expert Comment

by:alexey_gusev
Comment Utility
ah, you're right, Zebra printers have Label and Journal modes

and I've misread that this is WinCE, not WinMo, so Bluetooth config and ports are slightly different :), just as you have described. BT Virtual com port doesn't care much about parity and other settings because internally it uses BT serial profile and opens ACM port (as far as I remember it)
0

Featured Post

What Should I Do With This Threat Intelligence?

Are you wondering if you actually need threat intelligence? The answer is yes. We explain the basics for creating useful threat intelligence.

Join & Write a Comment

Introduction This article is a continuation of Part-1 as evident from the title. Please visit this page (http://www.experts-exchange.com/articles/18706/Backing-up-personal-data-on-your-Android-device-Part-1.html) to read the earlier Part -1. If y…
Working settings for French ISP Orange "Prêt à Surfer" SIM cards for data connections only. Can't be found anywhere else !
This Micro Tutorial will show you how to maximize your wireless card to its maximum capability. This will be demonstrated using Intel(R) Centrino(R) Wireless-N 2230 wireless card on Windows 8 operating system.
Viewers will learn how to connect to a wireless network using the network security key. They will also learn how to access the IP address and DNS server for connections that must be done manually. After setting up a router, find the network security…

772 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now