Article View: borland.public.jbuilder.java.api
Article #356chain of data
From: Eliot
Date: Tue, 07 Oct 2003 03:36
Date: Tue, 07 Oct 2003 03:36
47 lines
2526 bytes
2526 bytes
hi i need help...urgent... i need to send an chain of data
trought the serial port and i hace the next class that send just 1
char..somebody can change the source code an tellme how to do to send a
chain onf data???
public class SerialCom {
static Enumeration listaPuertos;
static CommPortIdentifier idPuerto;
static String mensaje;
static SerialPort puertoSerie;
static OutputStream salida;
public static void main( String[] args ) {
listaPuertos = CommPortIdentifier.getPortIdentifiers();
while( listaPuertos.hasMoreElements() ) {
idPuerto = (CommPortIdentifier)listaPuertos.nextElement();
if( idPuerto.getPortType() == CommPortIdentifier.PORT_SERIAL ) {
// if( idPuerto.getName().equals("/dev/term/a") ) {
if( idPuerto.getName().equals("COM1") ) {
// Si el puerto no est� en uso, se intenta abrir
try {
puertoSerie = ( SerialPort )idPuerto.open("AplEscritura",2000);
} catch( PortInUseException e ) {}
// Se obtiene un canal de salida
try {
salida = puertoSerie.getOutputStream();
} catch( IOException e ) {}
// Se fijan los par�metros de comunicaci�n del puerto
try {
puertoSerie.setSerialPortParams( 4800,
SerialPort.DATABITS_7,
SerialPort.STOPBITS_2,
SerialPort.PARITY_EVEN );
} catch( UnsupportedCommOperationException e ) {}
// Se env�a el mensaje
try {
salida.write( mensaje.getBytes() );
} catch( IOException e ) {}
}
}
}
}
}
Technical Details
Message-ID:
<3f823484@newsgroups.borland.com>Path:
arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-01!sn-xit-09!supernews.com!diablo.theplanet.net!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mailShow Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII X-Google-Thread: 1089d0,158c18cbce606cf3,start X-Google-Attributes: gid1089d0,public X-Google-ArrivalTime: 2003-10-06 20:40:25 PST From: "Eliot" <xxx@cxx.xl> Newsgroups: borland.public.jbuilder.java.api Subject: chain of data Date: Mon, 6 Oct 2003 23:36:49 -0400 Lines: 50 X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2800.1158 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1165 NNTP-Posting-Host: 200.86.120.46 Message-ID: <3f823484@newsgroups.borland.com> X-Trace: newsgroups.borland.com 1065497732 200.86.120.46 (6 Oct 2003 20:35:32 -0700) Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-01!sn-xit-09!supernews.com!diablo.theplanet.net!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail