Bluetooth printing in C# windows mobile - c#

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.

Related

Use a receiptprinter in WinRT over serial port

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

sending sms through mobile connected with pc

I am trying to develop the application which, any mobile is connected with PC and needs to send SMS through the mobile one by one, software is used only to connect the mobile and type the message.
When the send button is clicked the message should send through mobile not through any modems.
I have tried to search everywhere, but I couldn't find anything.
Can anybody guide me on how to proceed?
Thanks in advance.
If you want to do it on your own without using a sms-library you can open the modem in handset through a serial port and send out hayes at-commands for sms-operation.
Before you program you can try it using a terminal program.
Example
; Send message to "0170 00000" (Ctrl+Z to finish and send the message)
AT+CMGS="017000000"
> This is a SMS Test!!^Z
+CMGS: 3 ; OK, message gone
Note: these at-commands are not supported on every handset. Maybe the handset needs additional configuration through extra at commands (set textmode, set sms-gateway, ...)
Several sms hayes related commands are described in http://www.cellular.co.za/at_etsi.htm .
Yes, absolutely you can send sms through your pc connected with your cell phones. "Nokia PC Suite" is the only software; after installing software in your computer, connect your Nokia handset by usb cable with computer and select pc suite option. After then launch Nokia PC Suite. Now there u go.
What you are trying to do is difficult. It is difficult not because the programming is difficult, but because there are restrictions (security!) from the carrier side and from the mobile manufacturer side.
To be able to send messages from a mobile device connected to a PC, the mobile device must provide access to the internal functions its OS uses to deliver those SMSs. They could be low level modem commands, or a high level API; but in any case it will depend on the device manufacturer SDK.
If you want to type more efficiently, then maybe a mobile device with support for a bluetooth keyboard is a good idea.
I guess that depends strongly on the used mobile phone. I don't think there's a generic solution for all manufacturers. And such feature is probably hardly documented.
However, I'm not sure, if this is worth the effort at all, because e.g. Nokia provides the software "Ovi Suite" (or older PC Suite), which already supports sending SMS via connected phone. I think there are similar programs from other manufacturers.
It is possible to send SMS from a computer via a connected phone, but the phone itself will be the modem (I assume you don't want to connect another device for SMS). You can see this question, this question and (possibly) GSMComm for more info

How to query Zebra printer magnetic card reader over USB

I'd like to write a simple C# app to collect the output of a Zebra printer's magnetic card reader. (Model RW420) My only interface to the device is USB. The CPCL language specifies an MCR command for this purpose, but I cannot figure out how to issue this command to the printer via .NET. Neither the online documentation nor support staff can tell me. Does anyone have an idea?
You need to write native code in order to read back from USB (using pInvoke). You need to find the usb device path with Zebra's vendor ID in it. You would pass this device path to CreateFile
see: MSDN Create File
Please note that the RW420 manual (page 29) states:
Note that the RW series USB port is
intended for setup and maintenance of
the printer only and not for permanent
communications use to a terminal.
We have networked Zebra printers here, so my best guess is that if you can communicate over USB, in the way you intend, there will be a serial (or parallel) port exposed to talk to given by Zebra's USB driver. Start by looking in the Device Manager in Windows. If this is the case, you should be able to do standard serial communications to the printer, and follow the CPCL manual for querying the magstripe reader (see page 10-23 of the CPCL manual)

Sending Printer Commands via USB in C#

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?

Getting info on USB-Serial converter

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.

Categories

Resources