Changeset 1633 in ntrip


Ignore:
Timestamp:
Feb 20, 2009, 11:51:16 PM (16 years ago)
Author:
mervart
Message:

* empty log message *

Location:
trunk/BNC
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/BNC/bncgetthread.cpp

    r1632 r1633  
    261261    }
    262262
    263     _serialPort->setTimeout(3600,0);
     263    _serialPort->setTimeout(0,100);
    264264    _serialPort->setFlowControl(FLOW_OFF);
    265265  }
     
    395395      }
    396396      if (_serialPort) {
     397        slotSerialReadyRead();
    397398        _serialPort->write(data);
    398399      }
     
    593594void bncGetThread::slotSerialReadyRead() {
    594595  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  
    66int main(int argc, char* argv[]) {
    77
    8   FILE* fp = fopen("/dev/ttyS0", "w");
     8  FILE* fp = fopen("/dev/ttyS0", "r");
    99
    1010  if (!fp) {
     
    1313  }
    1414
    15   const char* msg = "message\n";
     15  char msg[100];
    1616
    1717  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);
    2120    sleep(1);
    2221  }
Note: See TracChangeset for help on using the changeset viewer.