Hagamos que México crezca..

Prefiere el consumo de lo Hecho en México

Prefiere el consumo de lo Hecho en México
BúsquedaHagamos que México crezca..
![]() Prefiere el consumo de lo Hecho en México Posts Recientes
Conversación |
Printing with Zebra Technologies RW-420 Printer and Symbol Motorola MC70 Mobile Terminal using Bluetooth connections..
http://www.opennetcf.com/FreeSoftware/OpenNETCFIOSerial/tabid/252/Default.aspx Then using the library I make a light class to print CPCL Code in Zebra RW 420. The Bluetooth connection between the RW420 and MC70 was successfully, Creating a Serial Com Port in ther mobile terminal with Windows Mobile 2005. Only I need Label Vista for Zebra to configure the properties of serial port of the mobile printer. If anyboy have any problem using RW420 printer, I put the code of my class, only you will need add the class in a namespace:
class Zebra { OpenNETCF.IO.Serial.Port Serial; string status; string status_error; string receive_data; public Zebra() { status = ""; status_error = ""; receive_data = ""; } public Boolean OpenPort(string portName) { StatusClean(); OpenNETCF.IO.Serial.HandshakeNone portSettings = new OpenNETCF.IO.Serial.HandshakeNone(); Serial = new OpenNETCF.IO.Serial.Port(portName, portSettings); Serial.DataReceived += new OpenNETCF.IO.Serial.Port.CommEvent(dataReceived); Serial.RThreshold = 1; Serial.InputLen = 30; Serial.SThreshold = 1; Serial.Settings.BaudRate = OpenNETCF.IO.Serial.BaudRates.CBR_57600; Serial.Settings.Parity = OpenNETCF.IO.Serial.Parity.none; Serial.Settings.StopBits = OpenNETCF.IO.Serial.StopBits.one; Serial.Settings.ByteSize = 8; if (!Serial.IsOpen) { try { Serial.Open(); status = "Port opened"; return true; } catch (Exception ex) { status_error = "Error in port opening"; return false; } } else { return true; } } /// <summary> /// Close Serial Port /// </summary> public void ClosePort() { StatusClean(); try { status = "Serial Port closed successfully"; Serial.Close(); } catch { status_error = "Seial Port not closed"; } } /// <summary> /// Send a string to the Serial Port /// </summary> /// <param name="cmd"></param> public void SendCmd(string cmd) { StatusClean(); if (Serial != null) { if (Serial.IsOpen) { try { Serial.Output = StrToByteArray(cmd); } catch (Exception ex) { status_error = ex.Message.ToString(); } } } else { status_error = "Port is not opened"; } } /// <summary> /// Allow to know the incoming string from serial port /// </summary> /// <param name="s"></param> /// <param name="e"></param> public void ReceivedData(object s, EventArgs e) { byte[] inputData = new byte[30]; inputData = Serial.Input; string displayString = Encoding.ASCII.GetString(inputData, 0, inputData.Length); receive_data += displayString; } //________________________ /// <summary> /// Convert a string to byte array /// </summary> /// <param name="str"></param> /// <returns></returns> public static byte[] StrToByteArray(string str) { System.Text.ASCIIEncoding encoding = new System.Text.ASCIIEncoding(); return encoding.GetBytes(str); } /// <summary> /// Clean the status properties /// </summary> private void StatusClean(){ status_error = ""; status_error = ""; status = ""; }
//Create the property in your class private Zebra ZebraPrinter; // call to the constructor ZebraPrinter = new Zebra(); //And execute the OpenPort Method given the Serial Port of your Connection if (ZebraPrinter.OpenPort("COM4") == true) { //If the connection is successfully then send the string to Serial Port ZebraPrinter.SendCmd("! 0 200 200 800 1\r\nLABEL\r\nCONTRAST 0\r\nTONE 0\r\nSPEED 3\r\nPAGE-WIDTH 240\r\nBAR-SENSE\r\nTEXT90 4 3 36 288 .88\r\nTEXT90 5 2 163 273 SWEATSHIRT\r\nVBARCODE UPCA 2 1 45 139 576 04364503284\r\nTEXT90 7 0 191 511 043645032841\r\nTEXT90 5 0 4 524 COMPARE AT\r\nTEXT90 4 0 30 508 $ 30.00\r\nTEXT90 5 0 115 575 ZD-180-KL\r\nTEXT90 5 2 119 269 ALL COTTON\r\nTEXT90 7 0 114 389 01/17/98\r\nTEXT90 0 0 208 173 EA00-732-00560\r\nTEXT90 5 0 82 519 ELSEWHERE\r\nBOX 189 358 217 527 1\r\nPRINT\r\n"); } //Close the POrt when you finish to send data to the Zebra Printer ZebraPrinter.closePort(); My English suck.. but I need to practice it... Dejar un comentario
Fuentes XML de comentario: RSS | Atom
|
Nube de EtiquetasEventosEncuestaComentarios Recientes
|
# Re:Printing with Zebra Technologies RW-420 Printer and Symbol Motorola MC70 Mobile Terminal using Bluetooth connections..
La función send lo único es enviar datos al puero serial, imagino que te refieres al código que se envía, ese es código CPCL, busca en google o en la página de zebra el manual sobre el lenguaje CPCL para que tengas una idea más clara de como se parametriza esta información saludos.