Subversion Repositories Programming Utils

Compare Revisions

Ignore whitespace Rev 64 → Rev 65

/trunk/JavaSerial/NativeCode/SerialPortImpl.c
70,6 → 70,13
struct port_descriptor** port_list = NULL;
int port_list_size;
 
#ifdef _WIN32
//Unfortunately, Windows does not let us get the state of the DTR/RTS lines.
//So, we need to keep track of that manually.
int winDTR = 0;
int winRTS = 0;
#endif
 
//
// Helper Methods
//
1013,6 → 1020,14
ret_val |= ( 0x01 << 2 );
}
if( winDTR ){
ret_val |= ( 0x01 << 3 );
}
if( winRTS ){
ret_val |= ( 0x01 << 4 );
}
if( get_val & MS_RING_ON ){
// Ring Indicator
ret_val |= ( 0x01 << 5 );
1059,7 → 1074,6
return ret_val;
}
 
 
/*
* Class: com_rm5248_serial_SerialPort
* Method: setSerialLineStateInternal
1083,11 → 1097,13
throw_io_exception_message( env, "Could not set DTR" );
return -1;
}
winDTR = 1;
}else{
if( !EscapeCommFunction( desc->port, CLRDTR ) ){
throw_io_exception_message( env, "Could not set DTR" );
return -1;
}
winDTR = 0;
}
 
if( get_bool( env, serial, "requestToSend" ) ){
1095,11 → 1111,13
throw_io_exception_message( env, "Could not set RTS" );
return -1;
}
winRTS = 1;
}else{
if( !EscapeCommFunction( desc->port, CLRRTS ) ){
throw_io_exception_message( env, "Could not set RTS" );
return -1;
}
winRTS = 0;
}
#else
int toSet = 0;
1211,6 → 1229,14
// Data Set Ready
ret_val |= ( 0x01 << 11 );
}
if( winDTR ){
ret_val |= ( 0x01 << 12 );
}
if( winRTS ){
ret_val |= ( 0x01 << 13 );
}
if( get_val & MS_RING_ON ){
// Ring Indicator
/trunk/JavaSerial/src/com/rm5248/serial/SerialPort.java
180,15 → 180,20
// do some sort of bitwise operations here....
if( ( state & 0x01 ) > 0 ){
s.carrierDetect = true;
}else if( ( state & (0x01 << 1 ) ) > 0 ){
}
if( ( state & (0x01 << 1 ) ) > 0 ){
s.clearToSend = true;
}else if( ( state & (0x01 << 2 ) ) > 0 ){
}
if( ( state & (0x01 << 2 ) ) > 0 ){
s.dataSetReady = true;
}else if( ( state & (0x01 << 3 ) ) > 0 ){
}
if( ( state & (0x01 << 3 ) ) > 0 ){
s.dataTerminalReady = true;
}else if( ( state & (0x01 << 4 ) ) > 0 ){
}
if( ( state & (0x01 << 4 ) ) > 0 ){
s.requestToSend = true;
}else if( ( state & (0x01 << 5 ) ) > 0 ){
}
if( ( state & (0x01 << 5 ) ) > 0 ){
s.ringIndicator = true;
}
 
357,15 → 362,20
state = getSerialLineStateInternalNonblocking();
if( ( state & 0x01 ) > 0 ){
s.carrierDetect = true;
}else if( ( state & (0x01 << 1 ) ) > 0 ){
}
if( ( state & (0x01 << 1 ) ) > 0 ){
s.clearToSend = true;
}else if( ( state & (0x01 << 2 ) ) > 0 ){
}
if( ( state & (0x01 << 2 ) ) > 0 ){
s.dataSetReady = true;
}else if( ( state & (0x01 << 3 ) ) > 0 ){
}
if( ( state & (0x01 << 3 ) ) > 0 ){
s.dataTerminalReady = true;
}else if( ( state & (0x01 << 4 ) ) > 0 ){
}
if( ( state & (0x01 << 4 ) ) > 0 ){
s.requestToSend = true;
}else if( ( state & (0x01 << 5 ) ) > 0 ){
}
if( ( state & (0x01 << 5 ) ) > 0 ){
s.ringIndicator = true;
}
 
580,6 → 590,14
}
setSerialLineStateInternal( state );
//Now, because Windows is weird, we need to post a serial changed event here.
//however, since we can only set DTR and RTS, only post an event if those are
//the things that changed
if( this.state.dataTerminalReady != state.dataTerminalReady ||
this.state.requestToSend != state.requestToSend ){
this.postSerialChangedEvent( state );
}
}
 
/**