diff --git a/docs/v1.0/annotated.html b/docs/v1.0/annotated.html index ecf4d3b..732a744 100644 --- a/docs/v1.0/annotated.html +++ b/docs/v1.0/annotated.html @@ -109,7 +109,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/docs/v1.0/class_serial_1_1_scoped_read_lock.html b/docs/v1.0/class_serial_1_1_scoped_read_lock.html index 9e123d6..d1fe683 100644 --- a/docs/v1.0/class_serial_1_1_scoped_read_lock.html +++ b/docs/v1.0/class_serial_1_1_scoped_read_lock.html @@ -157,7 +157,7 @@ Public Member Functions diff --git a/docs/v1.0/class_serial_1_1_scoped_write_lock.html b/docs/v1.0/class_serial_1_1_scoped_write_lock.html index c0e2f7b..e6c4228 100644 --- a/docs/v1.0/class_serial_1_1_scoped_write_lock.html +++ b/docs/v1.0/class_serial_1_1_scoped_write_lock.html @@ -157,7 +157,7 @@ Public Member Functions diff --git a/docs/v1.0/classes.html b/docs/v1.0/classes.html index 352b7ab..24f4a46 100644 --- a/docs/v1.0/classes.html +++ b/docs/v1.0/classes.html @@ -114,7 +114,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/docs/v1.0/classserial_1_1_i_o_exception.html b/docs/v1.0/classserial_1_1_i_o_exception.html index 901e39e..96394b0 100644 --- a/docs/v1.0/classserial_1_1_i_o_exception.html +++ b/docs/v1.0/classserial_1_1_i_o_exception.html @@ -271,7 +271,7 @@ Public Member Functions diff --git a/docs/v1.0/classserial_1_1_port_not_opened_exception.html b/docs/v1.0/classserial_1_1_port_not_opened_exception.html index c3e4541..87d0e2d 100644 --- a/docs/v1.0/classserial_1_1_port_not_opened_exception.html +++ b/docs/v1.0/classserial_1_1_port_not_opened_exception.html @@ -180,7 +180,7 @@ Public Member Functions diff --git a/docs/v1.0/classserial_1_1_serial.html b/docs/v1.0/classserial_1_1_serial.html index 4dd5fc9..444c69d 100644 --- a/docs/v1.0/classserial_1_1_serial.html +++ b/docs/v1.0/classserial_1_1_serial.html @@ -1523,7 +1523,7 @@ Public Member Functions diff --git a/docs/v1.0/classserial_1_1_serial_execption.html b/docs/v1.0/classserial_1_1_serial_execption.html index 27e3aec..2a77ec9 100644 --- a/docs/v1.0/classserial_1_1_serial_execption.html +++ b/docs/v1.0/classserial_1_1_serial_execption.html @@ -180,7 +180,7 @@ Public Member Functions diff --git a/docs/v1.0/classserial_1_1serial_1_1_serial_1_1_serial_impl.html b/docs/v1.0/classserial_1_1serial_1_1_serial_1_1_serial_impl.html index e083610..f8db4a0 100644 --- a/docs/v1.0/classserial_1_1serial_1_1_serial_1_1_serial_impl.html +++ b/docs/v1.0/classserial_1_1serial_1_1_serial_1_1_serial_impl.html @@ -1168,17 +1168,17 @@ Protected Member Functions } // set up raw mode / no echo / binary - options.c_cflag |= (unsigned long) (CLOCAL | CREAD); - options.c_lflag &= (unsigned long) ~(ICANON | ECHO | ECHOE | ECHOK | ECHONL | + options.c_cflag |= (tcflag_t) (CLOCAL | CREAD); + options.c_lflag &= (tcflag_t) ~(ICANON | ECHO | ECHOE | ECHOK | ECHONL | ISIG | IEXTEN); //|ECHOPRT - options.c_oflag &= (unsigned long) ~(OPOST); - options.c_iflag &= (unsigned long) ~(INLCR | IGNCR | ICRNL | IGNBRK); + options.c_oflag &= (tcflag_t) ~(OPOST); + options.c_iflag &= (tcflag_t) ~(INLCR | IGNCR | ICRNL | IGNBRK); #ifdef IUCLC - options.c_iflag &= (unsigned long) ~IUCLC; + options.c_iflag &= (tcflag_t) ~IUCLC; #endif #ifdef PARMRK - options.c_iflag &= (unsigned long) ~PARMRK; + options.c_iflag &= (tcflag_t) ~PARMRK; #endif // setup baud rate @@ -1283,7 +1283,7 @@ Protected Member Functions struct serial_struct ser; ioctl (fd_, TIOCGSERIAL, &ser); // set custom divisor - ser.custom_divisor = ser.baud_base / baudrate_; + ser.custom_divisor = ser.baud_base / (int) baudrate_; // update flags ser.flags &= ~ASYNC_SPD_MASK; ser.flags |= ASYNC_SPD_CUST; @@ -1305,7 +1305,7 @@ Protected Member Functions } // setup char len - options.c_cflag &= (unsigned long) ~CSIZE; + options.c_cflag &= (tcflag_t) ~CSIZE; if (bytesize_ == eightbits) options.c_cflag |= CS8; else if (bytesize_ == sevenbits) @@ -1318,7 +1318,7 @@ Protected Member Functions throw invalid_argument ("invalid char len"); // setup stopbits if (stopbits_ == stopbits_one) - options.c_cflag &= (unsigned long) ~(CSTOPB); + options.c_cflag &= (tcflag_t) ~(CSTOPB); else if (stopbits_ == stopbits_one_point_five) // ONE POINT FIVE same as TWO.. there is no POSIX support for 1.5 options.c_cflag |= (CSTOPB); @@ -1327,11 +1327,11 @@ Protected Member Functions else throw invalid_argument ("invalid stop bit"); // setup parity - options.c_iflag &= (unsigned long) ~(INPCK | ISTRIP); + options.c_iflag &= (tcflag_t) ~(INPCK | ISTRIP); if (parity_ == parity_none) { - options.c_cflag &= (unsigned long) ~(PARENB | PARODD); + options.c_cflag &= (tcflag_t) ~(PARENB | PARODD); } else if (parity_ == parity_even) { - options.c_cflag &= (unsigned long) ~(PARODD); + options.c_cflag &= (tcflag_t) ~(PARODD); options.c_cflag |= (PARENB); } else if (parity_ == parity_odd) { options.c_cflag |= (PARENB | PARODD); @@ -1344,12 +1344,12 @@ Protected Member Functions if (xonxoff_) options.c_iflag |= (IXON | IXOFF); //|IXANY) else - options.c_iflag &= (unsigned long) ~(IXON | IXOFF | IXANY); + options.c_iflag &= (tcflag_t) ~(IXON | IXOFF | IXANY); #else if (xonxoff_) options.c_iflag |= (IXON | IXOFF); else - options.c_iflag &= (unsigned long) ~(IXON | IXOFF); + options.c_iflag &= (tcflag_t) ~(IXON | IXOFF); #endif // rtscts #ifdef CRTSCTS @@ -2105,7 +2105,7 @@ Protected Member Functions diff --git a/docs/v1.0/files.html b/docs/v1.0/files.html index 28ae325..ef48145 100644 --- a/docs/v1.0/files.html +++ b/docs/v1.0/files.html @@ -108,7 +108,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/docs/v1.0/functions.html b/docs/v1.0/functions.html index 42d82bc..20d9d46 100644 --- a/docs/v1.0/functions.html +++ b/docs/v1.0/functions.html @@ -395,7 +395,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/docs/v1.0/functions_func.html b/docs/v1.0/functions_func.html index bb29dd6..50dc074 100644 --- a/docs/v1.0/functions_func.html +++ b/docs/v1.0/functions_func.html @@ -381,7 +381,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/docs/v1.0/functions_vars.html b/docs/v1.0/functions_vars.html index c5bc1b7..f93a5b1 100644 --- a/docs/v1.0/functions_vars.html +++ b/docs/v1.0/functions_vars.html @@ -119,7 +119,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/docs/v1.0/globals.html b/docs/v1.0/globals.html index 00c09f4..8c83bfe 100644 --- a/docs/v1.0/globals.html +++ b/docs/v1.0/globals.html @@ -121,7 +121,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/docs/v1.0/globals_defs.html b/docs/v1.0/globals_defs.html index 55dae40..6c45001 100644 --- a/docs/v1.0/globals_defs.html +++ b/docs/v1.0/globals_defs.html @@ -109,7 +109,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/docs/v1.0/globals_func.html b/docs/v1.0/globals_func.html index e260028..2bd7541 100644 --- a/docs/v1.0/globals_func.html +++ b/docs/v1.0/globals_func.html @@ -115,7 +115,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/docs/v1.0/graph_legend.html b/docs/v1.0/graph_legend.html index 98f11a3..e80c987 100644 --- a/docs/v1.0/graph_legend.html +++ b/docs/v1.0/graph_legend.html @@ -156,7 +156,7 @@ A yellow dashed arrow denotes a relation between a template instance and the tem diff --git a/docs/v1.0/index.html b/docs/v1.0/index.html index 2a014a7..2e119fd 100644 --- a/docs/v1.0/index.html +++ b/docs/v1.0/index.html @@ -144,7 +144,7 @@ Installing diff --git a/docs/v1.0/namespacemembers.html b/docs/v1.0/namespacemembers.html index 0a9b43b..59561b4 100644 --- a/docs/v1.0/namespacemembers.html +++ b/docs/v1.0/namespacemembers.html @@ -151,7 +151,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/docs/v1.0/namespacemembers_enum.html b/docs/v1.0/namespacemembers_enum.html index 2473cf3..aa4de9a 100644 --- a/docs/v1.0/namespacemembers_enum.html +++ b/docs/v1.0/namespacemembers_enum.html @@ -115,7 +115,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/docs/v1.0/namespacemembers_eval.html b/docs/v1.0/namespacemembers_eval.html index c0f938b..6978978 100644 --- a/docs/v1.0/namespacemembers_eval.html +++ b/docs/v1.0/namespacemembers_eval.html @@ -139,7 +139,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/docs/v1.0/namespaces.html b/docs/v1.0/namespaces.html index 64fdefe..a3adc7a 100644 --- a/docs/v1.0/namespaces.html +++ b/docs/v1.0/namespaces.html @@ -103,7 +103,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/docs/v1.0/namespaceserial.html b/docs/v1.0/namespaceserial.html index 5f4a126..0935fcb 100644 --- a/docs/v1.0/namespaceserial.html +++ b/docs/v1.0/namespaceserial.html @@ -249,7 +249,7 @@ Enumerations diff --git a/docs/v1.0/namespaceserial_1_1serial.html b/docs/v1.0/namespaceserial_1_1serial.html index 6330ed7..ac19311 100644 --- a/docs/v1.0/namespaceserial_1_1serial.html +++ b/docs/v1.0/namespaceserial_1_1serial.html @@ -111,7 +111,7 @@ Namespaces diff --git a/docs/v1.0/namespaceserial_1_1serial_1_1_serial.html b/docs/v1.0/namespaceserial_1_1serial_1_1_serial.html index df53e9e..60c0f3b 100644 --- a/docs/v1.0/namespaceserial_1_1serial_1_1_serial.html +++ b/docs/v1.0/namespaceserial_1_1serial_1_1_serial.html @@ -112,7 +112,7 @@ Data Structures diff --git a/docs/v1.0/serial_8cc.html b/docs/v1.0/serial_8cc.html index a5d0bf9..d86161c 100644 --- a/docs/v1.0/serial_8cc.html +++ b/docs/v1.0/serial_8cc.html @@ -96,15 +96,14 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
src/serial.cc File Reference
-
#include <alloca.h>
-#include "serial/serial.h"
+
#include "serial/serial.h"
#include "serial/impl/unix.h"
Include dependency graph for serial.cc:
- +
diff --git a/docs/v1.0/serial_8cc__incl.map b/docs/v1.0/serial_8cc__incl.map index 9b93ade..7a11706 100644 --- a/docs/v1.0/serial_8cc__incl.map +++ b/docs/v1.0/serial_8cc__incl.map @@ -1,5 +1,5 @@ - - - + + + diff --git a/docs/v1.0/serial_8cc__incl.md5 b/docs/v1.0/serial_8cc__incl.md5 index 3cbf1cc..ca4d8e1 100644 --- a/docs/v1.0/serial_8cc__incl.md5 +++ b/docs/v1.0/serial_8cc__incl.md5 @@ -1 +1 @@ -c658af7c9cee1bc94ae43edfaee9db94 \ No newline at end of file +90ebab7e162d611065ad362f55d24cb1 \ No newline at end of file diff --git a/docs/v1.0/serial_8cc__incl.png b/docs/v1.0/serial_8cc__incl.png index 574e4e8..72152d9 100644 Binary files a/docs/v1.0/serial_8cc__incl.png and b/docs/v1.0/serial_8cc__incl.png differ diff --git a/docs/v1.0/serial_8dox.html b/docs/v1.0/serial_8dox.html index 3fdd3f4..c666cfc 100644 --- a/docs/v1.0/serial_8dox.html +++ b/docs/v1.0/serial_8dox.html @@ -98,7 +98,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/docs/v1.0/serial_8h.html b/docs/v1.0/serial_8h.html index 94186b2..55e8a6e 100644 --- a/docs/v1.0/serial_8h.html +++ b/docs/v1.0/serial_8h.html @@ -205,7 +205,7 @@ __LINE__, (message) ) diff --git a/docs/v1.0/serial_8h_source.html b/docs/v1.0/serial_8h_source.html index fc2cdd2..cc522f5 100644 --- a/docs/v1.0/serial_8h_source.html +++ b/docs/v1.0/serial_8h_source.html @@ -137,277 +137,280 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); 00087 } flowcontrol_t; 00088 00095struct Timeout { -00096static uint32_t max() {returnstd::numeric_limits<uint32_t>::max();} -00106staticTimeoutsimpleTimeout(uint32_t timeout) { -00107 returnTimeout(max(), timeout, 0, timeout, 0); -00108 } -00109 -00111 uint32_t inter_byte_timeout; -00113 uint32_t read_timeout_constant; -00117 uint32_t read_timeout_multiplier; -00119 uint32_t write_timeout_constant; -00123 uint32_t write_timeout_multiplier; -00124 -00125Timeout (uint32_t inter_byte_timeout_=0, uint32_t read_timeout_constant_=0, -00126 uint32_t read_timeout_multiplier_=0, uint32_t write_timeout_constant_=0, -00127 uint32_t write_timeout_multiplier_=0) -00128 : inter_byte_timeout(inter_byte_timeout_), -00129 read_timeout_constant(read_timeout_constant_), -00130 read_timeout_multiplier(read_timeout_multiplier_), -00131 write_timeout_constant(write_timeout_constant_), -00132 write_timeout_multiplier(write_timeout_multiplier_) -00133 {} -00134 }; -00135 -00139class Serial { -00140 public: -00170 Serial (const std::string &port = "", -00171 uint32_t baudrate = 9600, -00172 Timeout timeout = Timeout(), -00173 bytesize_t bytesize = eightbits, -00174 parity_t parity = parity_none, -00175 stopbits_t stopbits = stopbits_one, -00176 flowcontrol_t flowcontrol = flowcontrol_none); -00177 -00179 virtual~Serial (); +00096 #ifdef max +00097 # undef max +00098 #endif +00099static uint32_t max() {returnstd::numeric_limits<uint32_t>::max();} +00109staticTimeoutsimpleTimeout(uint32_t timeout) { +00110 returnTimeout(max(), timeout, 0, timeout, 0); +00111 } +00112 +00114 uint32_t inter_byte_timeout; +00116 uint32_t read_timeout_constant; +00120 uint32_t read_timeout_multiplier; +00122 uint32_t write_timeout_constant; +00126 uint32_t write_timeout_multiplier; +00127 +00128Timeout (uint32_t inter_byte_timeout_=0, uint32_t read_timeout_constant_=0, +00129 uint32_t read_timeout_multiplier_=0, uint32_t write_timeout_constant_=0, +00130 uint32_t write_timeout_multiplier_=0) +00131 : inter_byte_timeout(inter_byte_timeout_), +00132 read_timeout_constant(read_timeout_constant_), +00133 read_timeout_multiplier(read_timeout_multiplier_), +00134 write_timeout_constant(write_timeout_constant_), +00135 write_timeout_multiplier(write_timeout_multiplier_) +00136 {} +00137 }; +00138 +00142class Serial { +00143 public: +00173 Serial (const std::string &port = "", +00174 uint32_t baudrate = 9600, +00175 Timeout timeout = Timeout(), +00176 bytesize_t bytesize = eightbits, +00177 parity_t parity = parity_none, +00178 stopbits_t stopbits = stopbits_one, +00179 flowcontrol_t flowcontrol = flowcontrol_none); 00180 -00194 void -00195 open (); -00196 -00201 bool -00202 isOpen () const; -00203 -00205 void -00206 close (); -00207 -00209 size_t -00210 available (); -00211 -00237 size_t -00238 read (uint8_t *buffer, size_t size); -00239 -00248 size_t -00249 read (std::vector<uint8_t> &buffer, size_t size = 1); -00250 -00259 size_t -00260 read (std::string &buffer, size_t size = 1); -00261 -00269 std::string -00270 read (size_t size = 1); -00271 -00282 size_t -00283 readline (std::string &buffer, size_t size = 65536, std::string eol = "\n"); -00284 -00294 std::string -00295 readline (size_t size = 65536, std::string eol = "\n"); -00296 -00308 std::vector<std::string> -00309 readlines (size_t size = 65536, std::string eol = "\n"); -00310 -00322 size_t -00323 write (const uint8_t *data, size_t size); -00324 -00333 size_t -00334 write (const std::vector<uint8_t> &data); -00335 -00344 size_t -00345 write (const std::string &data); -00346 -00355 void -00356 setPort (const std::string &port); -00357 -00364 std::string -00365 getPort () const; -00366 -00401 void -00402 setTimeout (Timeout &timeout); -00403 -00405 void -00406setTimeout (uint32_t inter_byte_timeout, uint32_t read_timeout_constant, -00407 uint32_t read_timeout_multiplier, uint32_t write_timeout_constant, -00408 uint32_t write_timeout_multiplier) -00409 { -00410 Timeout timeout(inter_byte_timeout, read_timeout_constant, -00411 read_timeout_multiplier, write_timeout_constant, -00412 write_timeout_multiplier); -00413 returnsetTimeout(timeout); -00414 } -00415 -00423 Timeout -00424 getTimeout () const; -00425 -00438 void -00439 setBaudrate (uint32_t baudrate); -00440 -00449 uint32_t -00450 getBaudrate () const; -00451 -00460 void -00461 setBytesize (bytesize_t bytesize); -00462 -00469 bytesize_t -00470 getBytesize () const; -00471 -00479 void -00480 setParity (parity_t parity); -00481 -00488 parity_t -00489 getParity () const; -00490 -00498 void -00499 setStopbits (stopbits_t stopbits); -00500 -00507 stopbits_t -00508 getStopbits () const; -00509 -00518 void -00519 setFlowcontrol (flowcontrol_t flowcontrol); -00520 -00527 flowcontrol_t -00528 getFlowcontrol () const; -00529 -00531 void -00532 flush (); -00533 -00535 void -00536 flushInput (); -00537 -00539 void -00540 flushOutput (); -00541 -00543 void -00544 sendBreak (int duration); -00545 -00547 void -00548 setBreak (bool level = true); -00549 -00551 void -00552 setRTS (bool level = true); -00553 -00555 void -00556 setDTR (bool level = true); -00557 -00572 bool -00573 waitForChange (); -00574 -00576 bool -00577 getCTS (); -00578 -00580 bool -00581 getDSR (); -00582 -00584 bool -00585 getRI (); -00586 -00588 bool -00589 getCD (); -00590 -00591 private: -00592 // Disable copy constructors -00593 Serial(constSerial&); -00594 void operator=(constSerial&); -00595 constSerial& operator=(Serial); -00596 -00597 std::string read_cache_; -00598 -00599 // Pimpl idiom, d_pointer -00600 class SerialImpl; -00601 SerialImpl *pimpl_; -00602 -00603 // Scoped Lock Classes -00604 class ScopedReadLock; -00605 class ScopedWriteLock; -00606 -00607 // Read common function -00608 size_t -00609 read_ (uint8_t *buffer, size_t size); -00610 // Write common function +00182 virtual~Serial (); +00183 +00197 void +00198 open (); +00199 +00204 bool +00205 isOpen () const; +00206 +00208 void +00209 close (); +00210 +00212 size_t +00213 available (); +00214 +00240 size_t +00241 read (uint8_t *buffer, size_t size); +00242 +00251 size_t +00252 read (std::vector<uint8_t> &buffer, size_t size = 1); +00253 +00262 size_t +00263 read (std::string &buffer, size_t size = 1); +00264 +00272 std::string +00273 read (size_t size = 1); +00274 +00285 size_t +00286 readline (std::string &buffer, size_t size = 65536, std::string eol = "\n"); +00287 +00297 std::string +00298 readline (size_t size = 65536, std::string eol = "\n"); +00299 +00311 std::vector<std::string> +00312 readlines (size_t size = 65536, std::string eol = "\n"); +00313 +00325 size_t +00326 write (const uint8_t *data, size_t size); +00327 +00336 size_t +00337 write (const std::vector<uint8_t> &data); +00338 +00347 size_t +00348 write (const std::string &data); +00349 +00358 void +00359 setPort (const std::string &port); +00360 +00367 std::string +00368 getPort () const; +00369 +00404 void +00405 setTimeout (Timeout &timeout); +00406 +00408 void +00409setTimeout (uint32_t inter_byte_timeout, uint32_t read_timeout_constant, +00410 uint32_t read_timeout_multiplier, uint32_t write_timeout_constant, +00411 uint32_t write_timeout_multiplier) +00412 { +00413 Timeout timeout(inter_byte_timeout, read_timeout_constant, +00414 read_timeout_multiplier, write_timeout_constant, +00415 write_timeout_multiplier); +00416 returnsetTimeout(timeout); +00417 } +00418 +00426 Timeout +00427 getTimeout () const; +00428 +00441 void +00442 setBaudrate (uint32_t baudrate); +00443 +00452 uint32_t +00453 getBaudrate () const; +00454 +00463 void +00464 setBytesize (bytesize_t bytesize); +00465 +00472 bytesize_t +00473 getBytesize () const; +00474 +00482 void +00483 setParity (parity_t parity); +00484 +00491 parity_t +00492 getParity () const; +00493 +00501 void +00502 setStopbits (stopbits_t stopbits); +00503 +00510 stopbits_t +00511 getStopbits () const; +00512 +00521 void +00522 setFlowcontrol (flowcontrol_t flowcontrol); +00523 +00530 flowcontrol_t +00531 getFlowcontrol () const; +00532 +00534 void +00535 flush (); +00536 +00538 void +00539 flushInput (); +00540 +00542 void +00543 flushOutput (); +00544 +00546 void +00547 sendBreak (int duration); +00548 +00550 void +00551 setBreak (bool level = true); +00552 +00554 void +00555 setRTS (bool level = true); +00556 +00558 void +00559 setDTR (bool level = true); +00560 +00575 bool +00576 waitForChange (); +00577 +00579 bool +00580 getCTS (); +00581 +00583 bool +00584 getDSR (); +00585 +00587 bool +00588 getRI (); +00589 +00591 bool +00592 getCD (); +00593 +00594 private: +00595 // Disable copy constructors +00596 Serial(constSerial&); +00597 void operator=(constSerial&); +00598 constSerial& operator=(Serial); +00599 +00600 std::string read_cache_; +00601 +00602 // Pimpl idiom, d_pointer +00603 class SerialImpl; +00604 SerialImpl *pimpl_; +00605 +00606 // Scoped Lock Classes +00607 class ScopedReadLock; +00608 class ScopedWriteLock; +00609 +00610 // Read common function00611 size_t -00612 write_ (const uint8_t *data, size_t length); -00613 -00614 }; -00615 -00616class SerialExecption : public std::exception -00617 { -00618 // Disable copy constructors -00619 void operator=(constSerialExecption&); -00620 constSerialExecption& operator=(SerialExecption); -00621 constchar* e_what_; -00622 public: -00623SerialExecption (constchar *description) : e_what_ (description) {} -00624SerialExecption (constSerialExecption& other) { -00625 e_what_ = other.e_what_; -00626 } -00627 -00628virtualconstchar* what () const throw () -00629 { -00630 std::stringstream ss; -00631 ss << "SerialException " << e_what_ << " failed."; -00632 return ss.str ().c_str (); -00633 } -00634 }; -00635 -00636class IOException : public std::exception -00637 { -00638 // Disable copy constructors -00639 void operator=(constIOException&); -00640 constIOException& operator=(IOException); -00641 std::string file_; -00642 int line_; -00643 constchar* e_what_; -00644 int errno_; -00645 public: -00646explicitIOException (std::string file, int line, int errnum) -00647 : file_(file), line_(line), e_what_ (strerror (errnum)), errno_(errnum) {} -00648explicitIOException (std::string file, int line, constchar * description) -00649 : file_(file), line_(line), e_what_ (description), errno_(0) {} -00650virtual~IOException() throw() {} -00651IOException (constIOException& other) { -00652 e_what_ = other.e_what_; -00653 } -00654 -00655intgetErrorNumber () { return errno_; } -00656 -00657virtualconstchar* what () const throw () -00658 { -00659 std::stringstream ss; -00660 if (errno_ == 0) -00661 ss << "IO Exception: " << e_what_; -00662 else -00663 ss << "IO Exception (" << errno_ << "): " << e_what_; -00664 ss << ", file " << file_ << ", line " << line_ << "."; -00665 return ss.str ().c_str (); -00666 } -00667 }; -00668 -00669class PortNotOpenedException : public std::exception -00670 { -00671 // Disable copy constructors -00672 void operator=(constPortNotOpenedException&); -00673 constPortNotOpenedException& operator=(PortNotOpenedException); -00674 constchar * e_what_; -00675 public: -00676PortNotOpenedException (constchar * description) : e_what_ (description) {} -00677PortNotOpenedException (constPortNotOpenedException& other) { -00678 e_what_ = other.e_what_; -00679 } -00680 -00681virtualconstchar* what () const throw () -00682 { -00683 std::stringstream ss; -00684 ss << e_what_ << " called before port was opened."; -00685 return ss.str ().c_str (); -00686 } -00687 }; -00688 -00689 } // namespace serial -00690 -00691 #endif +00612 read_ (uint8_t *buffer, size_t size); +00613 // Write common function +00614 size_t +00615 write_ (const uint8_t *data, size_t length); +00616 +00617 }; +00618 +00619class SerialExecption : public std::exception +00620 { +00621 // Disable copy constructors +00622 void operator=(constSerialExecption&); +00623 constSerialExecption& operator=(SerialExecption); +00624 constchar* e_what_; +00625 public: +00626SerialExecption (constchar *description) : e_what_ (description) {} +00627SerialExecption (constSerialExecption& other) { +00628 e_what_ = other.e_what_; +00629 } +00630 +00631virtualconstchar* what () const throw () +00632 { +00633 std::stringstream ss; +00634 ss << "SerialException " << e_what_ << " failed."; +00635 return ss.str ().c_str (); +00636 } +00637 }; +00638 +00639class IOException : public std::exception +00640 { +00641 // Disable copy constructors +00642 void operator=(constIOException&); +00643 constIOException& operator=(IOException); +00644 std::string file_; +00645 int line_; +00646 constchar* e_what_; +00647 int errno_; +00648 public: +00649explicitIOException (std::string file, int line, int errnum) +00650 : file_(file), line_(line), e_what_ (strerror (errnum)), errno_(errnum) {} +00651explicitIOException (std::string file, int line, constchar * description) +00652 : file_(file), line_(line), e_what_ (description), errno_(0) {} +00653virtual~IOException() throw() {} +00654IOException (constIOException& other) { +00655 e_what_ = other.e_what_; +00656 } +00657 +00658intgetErrorNumber () { return errno_; } +00659 +00660virtualconstchar* what () const throw () +00661 { +00662 std::stringstream ss; +00663 if (errno_ == 0) +00664 ss << "IO Exception: " << e_what_; +00665 else +00666 ss << "IO Exception (" << errno_ << "): " << e_what_; +00667 ss << ", file " << file_ << ", line " << line_ << "."; +00668 return ss.str ().c_str (); +00669 } +00670 }; +00671 +00672class PortNotOpenedException : public std::exception +00673 { +00674 // Disable copy constructors +00675 void operator=(constPortNotOpenedException&); +00676 constPortNotOpenedException& operator=(PortNotOpenedException); +00677 constchar * e_what_; +00678 public: +00679PortNotOpenedException (constchar * description) : e_what_ (description) {} +00680PortNotOpenedException (constPortNotOpenedException& other) { +00681 e_what_ = other.e_what_; +00682 } +00683 +00684virtualconstchar* what () const throw () +00685 { +00686 std::stringstream ss; +00687 ss << e_what_ << " called before port was opened."; +00688 return ss.str ().c_str (); +00689 } +00690 }; +00691 +00692 } // namespace serial +00693 +00694 #endif diff --git a/docs/v1.0/serial__example_8cc.html b/docs/v1.0/serial__example_8cc.html index f983125..27628a1 100644 --- a/docs/v1.0/serial__example_8cc.html +++ b/docs/v1.0/serial__example_8cc.html @@ -165,7 +165,7 @@ Functions
                                          {
-#ifdef __WIN32__
+#ifdef _WIN32
       Sleep(milliseconds); // 100 ms
 #else
       usleep(milliseconds*1000); // 100 ms
@@ -212,7 +212,7 @@ Functions
   sscanf(argv[2], "%lu", &baud);
 
   // port, baudrate, timeout in milliseconds
-  serial::Serial my_serial(port, baud, 1000);
+  serial::Serial my_serial(port, baud, serial::Timeout::simpleTimeout(1000));
 
   cout << "Is the serial port open?";
   if(my_serial.isOpen())
@@ -244,7 +244,7 @@ Functions
   }
 
   // Test the timeout at 250ms
-  my_serial.setTimeout(250);
+  my_serial.setTimeout(serial::Timeout::max(), 250, 0, 250, 0);
   count = 0;
   cout << "Timeout == 250ms, asking for 1 more byte than written." << endl;
   while (count < 10) {
@@ -298,7 +298,7 @@ Functions
 
 
 
diff --git a/docs/v1.0/structserial_1_1_timeout.html b/docs/v1.0/structserial_1_1_timeout.html
index 2b014a9..35da142 100644
--- a/docs/v1.0/structserial_1_1_timeout.html
+++ b/docs/v1.0/structserial_1_1_timeout.html
@@ -302,7 +302,7 @@ Data Fields
 
 
 
diff --git a/docs/v1.0/unix_8cc.html b/docs/v1.0/unix_8cc.html
index 0d3ad7d..5710b40 100644
--- a/docs/v1.0/unix_8cc.html
+++ b/docs/v1.0/unix_8cc.html
@@ -178,7 +178,7 @@ Functions
 
 
 
diff --git a/docs/v1.0/unix_8h.html b/docs/v1.0/unix_8h.html
index 578b47b..f92fa2a 100644
--- a/docs/v1.0/unix_8h.html
+++ b/docs/v1.0/unix_8h.html
@@ -142,7 +142,7 @@ DESCRIPTION
 
 
 
diff --git a/docs/v1.0/unix_8h_source.html b/docs/v1.0/unix_8h_source.html
index 90d193c..d74d303 100644
--- a/docs/v1.0/unix_8h_source.html
+++ b/docs/v1.0/unix_8h_source.html
@@ -261,7 +261,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
 
 
 
diff --git a/docs/v1.0/v8stdint_8h.html b/docs/v1.0/v8stdint_8h.html
index bca8f28..2e363d2 100644
--- a/docs/v1.0/v8stdint_8h.html
+++ b/docs/v1.0/v8stdint_8h.html
@@ -115,7 +115,7 @@ This graph shows which files directly or indirectly include this file:
diff --git a/docs/v1.0/v8stdint_8h_source.html b/docs/v1.0/v8stdint_8h_source.html index 794c490..895850c 100644 --- a/docs/v1.0/v8stdint_8h_source.html +++ b/docs/v1.0/v8stdint_8h_source.html @@ -155,7 +155,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/docs/v1.0/win_8cc.html b/docs/v1.0/win_8cc.html index c254067..b1e1788 100644 --- a/docs/v1.0/win_8cc.html +++ b/docs/v1.0/win_8cc.html @@ -106,7 +106,7 @@ Include dependency graph for win.cc:
diff --git a/docs/v1.0/win_8h.html b/docs/v1.0/win_8h.html index 9b38f3a..6ebc6d2 100644 --- a/docs/v1.0/win_8h.html +++ b/docs/v1.0/win_8h.html @@ -127,7 +127,7 @@ Namespaces diff --git a/docs/v1.0/win_8h_source.html b/docs/v1.0/win_8h_source.html index e56af7e..ad27599 100644 --- a/docs/v1.0/win_8h_source.html +++ b/docs/v1.0/win_8h_source.html @@ -259,7 +259,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');

@@ -116,7 +115,7 @@ Data Structures