Changeset 1633 in ntrip
- Timestamp:
- Feb 20, 2009, 11:51:16 PM (16 years ago)
- Location:
- trunk/BNC
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/BNC/bncgetthread.cpp
r1632 r1633 261 261 } 262 262 263 _serialPort->setTimeout( 3600,0);263 _serialPort->setTimeout(0,100); 264 264 _serialPort->setFlowControl(FLOW_OFF); 265 265 } … … 395 395 } 396 396 if (_serialPort) { 397 slotSerialReadyRead(); 397 398 _serialPort->write(data); 398 399 } … … 593 594 void bncGetThread::slotSerialReadyRead() { 594 595 if (_serialPort) { 595 QByteArray data = _serialPort->readAll(); 596 if (_serialOutFile) { 597 _serialOutFile->write(data); 598 _serialOutFile->flush(); 599 } 600 } 601 } 596 int nb = _serialPort->bytesAvailable(); 597 if (nb > 0) { 598 QByteArray data = _serialPort->read(nb); 599 if (_serialOutFile) { 600 _serialOutFile->write(data); 601 _serialOutFile->flush(); 602 } 603 } 604 } 605 } -
trunk/BNC/test_serial.cpp
r1608 r1633 6 6 int main(int argc, char* argv[]) { 7 7 8 FILE* fp = fopen("/dev/ttyS0", " w");8 FILE* fp = fopen("/dev/ttyS0", "r"); 9 9 10 10 if (!fp) { … … 13 13 } 14 14 15 c onst char* msg = "message\n";15 char msg[100]; 16 16 17 17 while (true) { 18 int nb = fprintf(fp, msg, sizeof(msg)); 19 fflush(fp); 20 printf("written %d\n", nb); 18 int nb = fread(msg, sizeof(msg), 1, fp); 19 printf("read %d\n", nb); 21 20 sleep(1); 22 21 }
Note:
See TracChangeset
for help on using the changeset viewer.