I have this system ive been working on where in the user has to print in a bluetooth thermal printer after every transaction. Can someone give me a source reference or a sample code for this particular function? he bluetooth printer brand is just generic, most of the sources in the website all have brands particularly Zebra. But i wont be using that since it might be different. any help would be nice. Thanks!
Please see inTheHand (or 32feet.net) for a framework using Bluetooth.
You need to discover and connect to the BT printer and then use a socket stream to send print commands.
You may also use RegisterDevice with the BT mAC address and then use the provided serial COM port to communicate with the printer.
To be more detailed you need to describe your needs in more details and shorter english sentences.
i wanna print to a receipt printer. This would be plugged to a RS323 port. Mostly over a USB adapter.
The reason is, that I try to implement a small cashier app. So there would it be fantastic if I can print through a receipt printer device.
So my Question is, is it possible to communicate with this device within a windows store app (WinRT)? Or is that not possible in general?
Serial and parallel ports are not supported in WinRT as can be seen in: MSDN
There is a line in the table describing that there is no WinRT alternative for the serial and parallel port support that existed int the Win32 API.
Best regards
I want to read data from an I2C device in windows XP, but i am beginner in working with serial ports and I2C devices.I have searched a lot however i have just found some codes to write on an I2C device but not read from it.please describe me how should i start?
Edit: I have an I2C device, an I2C to USB convertor and a USB cable.I have connect them together with this sequence:
The I2C device is connected to I2C-USB convertor with a cable and the convertor is connected to the USB cable finally the USB cable is connected to my computer system.
by the way i have using Windows XP on my system.
I have a very similar situation. However, my USB-to-I2C device came with a C library, so my code simply has to execute i2c_read() or i2c_write() functions. Then the library takes care to talk to the driver, then the USB-to-I2C device and so on. It is pointless for me to give you the code that I use because we have a custom device and custom library (made specifically for my company).
Since you have the "write" example, there should have been the read functionality as well.
Since you did not provide any particulars on which USB-to-I2C device you have, this is all the information that can be provided.
I have a ticket printer I am trying to send raw print commands to,
I am currently sending the commands by pinvoke to winspool.drv and calling WritePrinter. This is working for most of the commands I am sending, but I cannot get feedback from the printer this way (for example, the printer has a barcode reader on it, I can send them command read barcode but I cannot receive the data back as it is stopped by the windows spooler).
Is there a way to open a USB port and send a byte[] of commands in C#?
Many Thanks
Shaun
You can exchange data over USB in a similar manner as you read/write to a file. Here's an interesting article on that topic.
Using the windows printer driver has some advantages though. Are you sure you want to do this yourself?
Hope you can help me on this.
I have a serial device, this device will then be connected to a USB-Serial converter, then the converter will be connected to my PC's usb port. The system will add another COM port to the Device Manager.
My question is, how can I possibly map the COM port number to the converter in C#? I can successfully enumerate available COM port in the system by doing the SerialPort.GetPortNames(), but not sure what COM port number this converter have.
thanks
ar
You can usually get some decent info out of a WMI query, although it requires the device driver to cooperate. Most do afaik. Run a query on the Win32_SerialPort class. You can use the WMI Code Creator tool to experiment with the query and auto-generate the C# code you need.
Don't count on being able to auto-select the device. You'll need a config option to allow the user to select the port. You can display the info you got from the query to help her pick the right one. Or ask her to unplug the device and plug it back in, the added COM port should be the right one.
We solved this different ways for different applications. We used explicit configuration for an instance where we had exactly one device of a particular type, but it wasn't clear what COM port it was going to be assigned until the system was configured. In another case, we had one USB cable that broke out into a hub with a bunch of converters on it, so we probed all the COM ports we could open successfully to look for our devices of interest.
A couple caveats with USB/serial converters on Windows -- if your device is something like a GPS unit that sends out data whenever it's powered on, Windows might detect it as an old serial mouse if it's plugged in during boot. Also, plugging into a different USB port is likely to chew up an additional COM port number (as well as break any explicit configuration you've done).
When i had the same problem (RFID reader), I checked each port if there was any data.
Probably it would be something in COM4 : COM9.
I know that it's not the best solution, but i used it on mobile device where i am sure about my COM connections...
Maybe in your driver's *.ini file there is some information about COM number.
If you are using an FTDI based solution for the USB<-> serial conversion, you can use the FT_PROG utility which is available from the FTDI web site to assign custom VID:PID pairs to the converter, which you can then query to identify which adapter is assigned to which virtual port.
Alternatively, you can make use of the FTDIChip-ID which is unique for each chip, details on this including code samples are located here: http://ftdichip.com/Support/SoftwareExamples/FTDIChip-ID.htm
You would have to look this up somewhere in the registry.
I can only assume this is a FTDI chip. If so, you may be able to get info from using their public API, which is included with the drivers.
If no other answers, I will check later tonite at home, as my JTAG debugger has the same chip.
Update:
Here is the registry key for my device's assigned COM port (under PortName)
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Enum\USB\VID_0483&PID_5740\498C54823932\Device Parameters
I guess you can just enumerate thru the USB devices with the usbser driver.