[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 2690
  • Last Modified:

how to send data to EXTECH & Data Max -Oneil Printers from my Windows Mobile application using C#

Dear all
I am working on my new Windows mobile application using VS2008.
WM5 & 6 & 6.5
I have to printers I want to use them with my new application.
Here are the models:
1 – EXTECH Instruments Model S3750THS Intertek
2 – Data Max – Oneil Apex 3 Intertek

I want to know how I can connect to these printers using Bluetooth and send data to be printed on these printers.
Thanks,
0
RamzyNEbeid
Asked:
RamzyNEbeid
  • 13
  • 10
1 Solution
 
hjgodeCommented:
Hello

to print from windows mobile to a BT printer you have first to create a connection to the printer to be used. You may use a virtual COM port connected to the BT printer or a socket to communicate with the BT printer. BT printers offer the Serial Port Profile via there BT service.

When you have a connection to the printer, you have to use the printers programming or printing language. Windows Mobile devices do not offer a printing subsystem as desktop windows does. There is no printer driver support. So you have to communicate directly with the printer and send commands the printer understands.

The Extech S3750THS uses a ESC/P like programming/printing command set. There should be a S3750THS programmer’s manual at Extech site, but they are now part of ONeil and I was unable to find the manual shortly.

The ONeil Apex 3 uses a ExPCL called printing language. I found a programmers manual here.

I have some code at google showing a BT connect: http://code.google.com/p/win-mobile-code/source/browse/#svn%2Ftrunk%2FCommAppCFbtSearch The code uses the 32Feet lib.

Another code shows how to send prepared files to COM port: http://code.google.com/p/win-mobile-code/source/browse/#svn%2Ftrunk%2FCommAppCFSerial

Further info on Datamax ONeil Apex 3: http://www.datamax-oneil.com/do/com/en-us/home/service-support/technical-resources&p=83966056-A172-9A9D-D61A25AF6FA47B45#SM1

Let me know, if you need further assistance with general windows mobile BT printing.
0
 
RamzyNEbeidAuthor Commented:
i have a problem is how to connect the "EXTECH Instruments Model S3750THS" Printer to my device MC70 & MC75.
i need steps

thanks,
0
 
RamzyNEbeidAuthor Commented:
i found a DLL Symbol.Printing

which as the documentation said it will help me in this subject.

i will try it and give you my feedback

but please tell me how to configure the Printer first.

thnaks,
0
Veeam Disaster Recovery in Microsoft Azure

Veeam PN for Microsoft Azure is a FREE solution designed to simplify and automate the setup of a DR site in Microsoft Azure using lightweight software-defined networking. It reduces the complexity of VPN deployments and is designed for businesses of ALL sizes.

 
hjgodeCommented:
In general you dont need symbol printing DLL (except it has support for datamax).

You normally have to open Start-Settings-Connections-Bluetooth. Then enable bluetooth and do a device search. The connect to the found BT printer and select SPP as service to be used of the printer. ( see also here: http://www.ehow.com/how_6389192_print-via-bluetooth-pocket-pc.html)

Then in your program you can use the assigned serial COM port for sending printer language commands.
0
 
RamzyNEbeidAuthor Commented:
how can i download thid Code
I have some code at google showing a BT connect:
http://code.google.com/p/win-mobile-code/source/browse/#svn%2Ftrunk%2FCommAppCFbtSearch The code uses the 32Feet lib
0
 
hjgodeCommented:
As described on the source code page of code.google.com/p/win-mobile-code you need TortoiseSVN or AnkhSVN (VS plugin).

In the SVN client of your choice you have to use this information:

 # Non-members may check out a read-only working copy anonymously over HTTP.
svn checkout http://win-mobile-code.googlecode.com/svn/trunk/ win-mobile-code-read-only

That means the checkout location you have to use in TortoiseSVN/AnkhSVN is http://win-mobile-code.googlecode.com/svn/trunk/ win-mobile-code-read-only
0
 
RamzyNEbeidAuthor Commented:
i wrote this Code and it worked:
using System.IO.Ports;

SerialPort comPort5 = new SerialPort("COM5", 57600, Parity.Even, 8, StopBits.One);
            comPort5.Open();
            comPort5.WriteLine("165 169 170 171");
            comPort5.Close();

it is working but if i send Charecters then it print ????
so i recognized that it Prints olny arabic charecters

so i dont know what to do next ?

also i dont know what these values means: "57600, Parity.Even, 8, StopBits.One"
0
 
RamzyNEbeidAuthor Commented:
i need your help on this ?
i wrote this Code and it worked:
using System.IO.Ports;

SerialPort comPort5 = new SerialPort("COM5", 57600, Parity.Even, 8, StopBits.One);
            comPort5.Open();
            comPort5.WriteLine("165 169 170 171");
            comPort5.Close();

it is working but if i send Charecters then it print ????
so i recognized that it Prints olny arabic charecters

so i dont know what to do next ?
0
 
RamzyNEbeidAuthor Commented:
when i print the word "Ramzy" the result in the printer was "¿ ¿ ¿ ¿ ¿" which are arabic charecters ?

i need help please

thanks,
0
 
hjgodeCommented:
Hello

does the datamatrix really print arabic in it's default setting?

I recommend you to print a config sheet (there should be a note in the manual of the printer). The printer should also be possible to be configured using any tool provided by datamatrix.

If the printer is unicode aware, you should always use a byte[] buffer for serial communication and usse the encoding class to encode strings to byte[].

Where did you get "comPort5.WriteLine("165 169 170 171");" from?

Which printer language is active in the printer?

Can you run the configuration utility described at http://www.datamax-oneil.com/do/com/en-us/home/printers-software/portable-printers/thermal-receipt-printers/apex-3

I am sorry, but I dont have a copy of the CD ROM, possibly you can upload anywhere to share the contents with me.

All my tipps currently are for general printing. I know different printer languages but dont know what the Apex 3 is using.

~josef
0
 
hjgodeCommented:
If  the printer is using ExPCL you may try this:

byte[] bTest = new byte[3];
bTest[0] = 0x1b;
bTest[1] = 0x46;
bTest[2] = 0x31;
//the above is the sequence to switch to charset International 1.
comPort.write(bTest, 0, 3);

comPort.writeline("Hello");
0
 
RamzyNEbeidAuthor Commented:
Thanks i will try it and tell you
0
 
hjgodeCommented:
I just found a presentation about ExTch printers: http://www.docstoc.com/docs/68237361/Extech_20Portable_20Printers_202009_20-_20Programming

There is one code sample for page mode (in contrast to line printer mode):

extech pageprint
0
 
RamzyNEbeidAuthor Commented:
where can i write this Code ?

BeginPage()
and the rest of the lines?
0
 
hjgodeCommented:
As all other print commands: in comPort5.WriteLine();
0
 
RamzyNEbeidAuthor Commented:
for me i am doing the Same

i dont know why it is not printing what i am sending
0
 
RamzyNEbeidAuthor Commented:
may be it is becuse of the arabic language?
0
 
RamzyNEbeidAuthor Commented:
instead of saying Arabic i say unicode is this correct ?
0
 
hjgodeCommented:
If the printer is interpreting input in unicode, you may to send a string "hello" instead as a byte sequence of 0x00 "H" 0x00 "e" 0x00 "l" 0x00 "l" 0x00 "o".

What about a printer config sheet? What is about the printer configuration utility?

From the apex3 manual to print  a self test and config sheet:
=============================================
Press the <ON/OFF> switch to turn the printer off. The
LED turns off.

To start the self-test, press and hold the <FEED>
switch then press the <ON/OFF> switches.

The printer will start printing the self-test message.
Release the <FEED> switch.

Press the <ON/OFF> or <FEED> switch to stop or
cancel the self-test print.

The first few lines of self-test show the printer
firmware version, the current printer settings (for
example Bluetooth™ or Serial mode) and a list of
any optional or special features installed. Figure 9
shows a printing sample.
=============================================
apex 3 self test print
0
 
hjgodeCommented:
If the printer has a special arabic firmware installed, this has to be replaced by the english one.

All resources (SDK, Programmers manual, a Desktop C# sample, the config tool can be found here http://www.datamax-oneil.com/do/com/en-us/home/service-support/technical-resources&p=83966056-A172-9A9D-D61A25AF6FA47B45#SM1

There is even a printer demo program for win mobile: http://www.datamax-oneil.com/do/com/en-us/file.cfm/Printer%20Demo_PPC_ARM_V1_01_59.zip?contentID=4915

Please check the above.
0
 
RamzyNEbeidAuthor Commented:
this is the Code i am using:

SerialPort comPort5 = new SerialPort("COM5", 57600, Parity.None, 8, StopBits.One);
comPort5.Open();
comPort5.Writeline("my text");
comPort5.Close();

this the whole code in the click event of a button.
0
 
RamzyNEbeidAuthor Commented:
you mean like this
comPort5.Writeline("0x00 "H" 0x00 "e" 0x00 "l" 0x00 "l" 0x00 "o"")
?
0
 
hjgodeCommented:
Hello

to get a byte array of a string, you can use
         byte[] valAsByteArray = Encoding.ASCII.GetBytes(String);
The above will return the ASCII encoding of the string, a byte sequence with { 'H','e','l','l','o' }
If you use
        Byte[] bytes;
        UnicodeEncoding Unicode = new UnicodeEncoding();        
        int byteCount = Unicode.GetByteCount(string.ToCharArray(), 8, 8);
        bytes = new Byte[byteCount];
        int bytesEncodedCount = Unicode.GetBytes(string, 8, 8, bytes, 0);
you will get an unicode encoded byte array (should be { 0x00,'H', 0x00, 'e',0x00,'l',...}. Every char is prepended by a 0x00 byte.

I am not sure, but it is possible that I can access an Apex3 tomorrow.

cu

~josef
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

  • 13
  • 10
Tackle projects and never again get stuck behind a technical roadblock.
Join Now