|
From: <bo...@us...> - 2008-02-26 23:34:23
|
Revision: 92
http://gearbox.svn.sourceforge.net/gearbox/?rev=92&view=rev
Author: borax00
Date: 2008-02-26 15:33:55 -0800 (Tue, 26 Feb 2008)
Log Message:
-----------
Modified Paths:
--------------
gearbox/trunk/submitted/gbxserialacfr/serial.cpp
gearbox/trunk/submitted/gbxserialacfr/serial.h
gearbox/trunk/submitted/gbxsickacfr/driver.cpp
gearbox/trunk/submitted/gbxsickacfr/driver.h
Modified: gearbox/trunk/submitted/gbxserialacfr/serial.cpp
===================================================================
--- gearbox/trunk/submitted/gbxserialacfr/serial.cpp 2008-02-26 08:58:08 UTC (rev 91)
+++ gearbox/trunk/submitted/gbxserialacfr/serial.cpp 2008-02-26 23:33:55 UTC (rev 92)
@@ -623,7 +623,7 @@
int
-Serial::readLine(void *buf, int count, char termchar)
+Serial::readUntil(void *buf, int count, char termchar)
{
if ( debugLevel_ > 0 ){
cout<<"TRACE(serial.cpp): "<<__func__<<"(): ";
Modified: gearbox/trunk/submitted/gbxserialacfr/serial.h
===================================================================
--- gearbox/trunk/submitted/gbxserialacfr/serial.h 2008-02-26 08:58:08 UTC (rev 91)
+++ gearbox/trunk/submitted/gbxserialacfr/serial.h 2008-02-26 23:33:55 UTC (rev 92)
@@ -96,13 +96,13 @@
//!
int readFull(void *buf, int count);
- //! Reads a line of data up to @ref count bytes-1 (including @ref termchar), terminated by @ref termchar.
+ //! Reads up to @ref count bytes-1 (including @ref termchar), terminated by @ref termchar.
//! Returns the number of bytes read.
- //! After reading the line then the string will be NULL terminated.
+ //! After reading the data, the string will be NULL terminated.
//!
//! Example: if you expect to read the string "1234\n", you need something like:
//! char buf[6];
- //! serial.readLine( buf, 6 );
+ //! serial.readUntil( buf, 6, '\n' );
//!
//! where the two extra characters are for the "\n" and the terminating "\0".
//!
@@ -113,8 +113,12 @@
//! NOTE: The timeout applies for each individual read() call. We might have to make lots of them,
//! so the total time for which this function blocks might be longer than the specified timeout.
//!
- int readLine(void *buf, int count, char termchar='\n');
+ int readUntil(void *buf, int count, char termchar);
+ //! Short-hand for "readUntil(buf,count,'\n');"
+ int readLine(void *buf, int count)
+ { return readUntil(buf,count,'\n'); }
+
//! Returns the number of bytes available for reading (non-blocking).
int bytesAvailable();
Modified: gearbox/trunk/submitted/gbxsickacfr/driver.cpp
===================================================================
--- gearbox/trunk/submitted/gbxsickacfr/driver.cpp 2008-02-26 08:58:08 UTC (rev 91)
+++ gearbox/trunk/submitted/gbxsickacfr/driver.cpp 2008-02-26 23:33:55 UTC (rev 92)
@@ -546,9 +546,12 @@
}
void
-Driver::read( Data &data, int timeoutMs )
+Driver::read( Data &data )
{
TimedLmsResponse response;
+
+ // This timeout is greater than the scan inter-arrival time for all baudrates.
+ const int timeoutMs = 1000;
bool received = waitForResponseType( ACK_REQUEST_MEASURED_VALUES, response, timeoutMs );
if ( !received )
{
Modified: gearbox/trunk/submitted/gbxsickacfr/driver.h
===================================================================
--- gearbox/trunk/submitted/gbxsickacfr/driver.h 2008-02-26 08:58:08 UTC (rev 91)
+++ gearbox/trunk/submitted/gbxsickacfr/driver.h 2008-02-26 23:33:55 UTC (rev 92)
@@ -67,14 +67,22 @@
public:
//! Constructor
- Driver( const Config &config, gbxutilacfr::Tracer& tracer, gbxutilacfr::Status& status );
+ //!
+ //! gbxutilacfr::Tracer and gbxutilacfr::Status allow
+ //! (human-readable and machine-readable respectively) external
+ //! monitorining of the driver's internal state.
+ Driver( const Config &config,
+ gbxutilacfr::Tracer &tracer,
+ gbxutilacfr::Status &status );
- //! Blocks till new data is available, but not for longer than timeoutMs.
+ //! Blocks till new data is available, but times out (and throws a gbxutilacfr::Exception)
+ //! if it has waited an abnormally long time without receiving a scan.
+ //!
//! The ranges and intensities in 'data' are expected to have been pre-sized correctly.
- //! Throws exceptions on un-recoverable faults.
//!
- //! The default timeout is greater than the scan inter-arrival time for all baudrates.
- void read( Data &data, int timeoutMs=1000 );
+ //! Throws gbxutilacfr::Exception's on un-recoverable faults.
+ //!
+ void read( Data &data );
private:
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|