Link to home
Start Free TrialLog in
Avatar of RamzyNEbeid
RamzyNEbeidFlag for Egypt

asked on

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,
Avatar of hjgode
hjgode
Flag of Germany image

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.
Avatar of RamzyNEbeid

ASKER

i have a problem is how to connect the "EXTECH Instruments Model S3750THS" Printer to my device MC70 & MC75.
i need steps

thanks,
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,
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.
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
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
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"
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 ?
when i print the word "Ramzy" the result in the printer was "¿ ¿ ¿ ¿ ¿" which are arabic charecters ?

i need help please

thanks,
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
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");
Thanks i will try it and tell you
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):

User generated image
where can i write this Code ?

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

i dont know why it is not printing what i am sending
may be it is becuse of the arabic language?
instead of saying Arabic i say unicode is this correct ?
ASKER CERTIFIED SOLUTION
Avatar of hjgode
hjgode
Flag of Germany image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
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.
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.
you mean like this
comPort5.Writeline("0x00 "H" 0x00 "e" 0x00 "l" 0x00 "l" 0x00 "o"")
?
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