mirror of
https://github.com/wjwwood/serial.git
synced 2026-01-22 19:54:57 +08:00
Compare commits
85 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
69e0372cf0 | ||
|
|
33e5a31ab7 | ||
|
|
ed9f89ca31 | ||
|
|
9fc9e81fc1 | ||
|
|
57f72772a9 | ||
|
|
a93fc844d9 | ||
|
|
7439db1228 | ||
|
|
9e331e7977 | ||
|
|
cbcca7c837 | ||
|
|
683e12d2f6 | ||
|
|
fba8d81b5d | ||
|
|
2ef29d7b10 | ||
|
|
5a354eaab7 | ||
|
|
bdba3a80ad | ||
|
|
17e3223e68 | ||
|
|
764fab8b5e | ||
|
|
235a5f716d | ||
|
|
534141aa8f | ||
|
|
ce085ce88c | ||
|
|
d3713af096 | ||
|
|
827c4a784d | ||
|
|
771e62c220 | ||
|
|
02dfff7883 | ||
|
|
4d69fb2e41 | ||
|
|
c16faab6ea | ||
|
|
d76b7d6b7f | ||
|
|
2d416f1560 | ||
|
|
22dce33fa4 | ||
|
|
e12d81eadf | ||
|
|
c5b4bbd181 | ||
|
|
98f1c31e81 | ||
|
|
ef7f77d411 | ||
|
|
402657574c | ||
|
|
a81087ec85 | ||
|
|
9b80fc3fbf | ||
|
|
c57285f30a | ||
|
|
cd5053cb32 | ||
|
|
6144d579af | ||
|
|
1580f10d39 | ||
|
|
99e57e633c | ||
|
|
b8320d31a7 | ||
|
|
10ac4e1c25 | ||
|
|
03ca3be6a8 | ||
|
|
52197afbc8 | ||
|
|
e438077cba | ||
|
|
985c3a5172 | ||
|
|
1a70b09bb1 | ||
|
|
33bbde42c8 | ||
|
|
3a9e6be834 | ||
|
|
42aa78ae98 | ||
|
|
d7084ce775 | ||
|
|
e26a977173 | ||
|
|
5b13be4d7c | ||
|
|
29cb551c41 | ||
|
|
e70643380d | ||
|
|
32792b3ee1 | ||
|
|
2473a8770f | ||
|
|
dda5b6308e | ||
|
|
17da2dea31 | ||
|
|
c3d55880c8 | ||
|
|
bd0980b69a | ||
|
|
31fa9c9e34 | ||
|
|
a622105543 | ||
|
|
8036553a1e | ||
|
|
6f464948f0 | ||
|
|
6e47bdd0ae | ||
|
|
b376f85fb0 | ||
|
|
c19a5a3cc9 | ||
|
|
7bce3e0fdc | ||
|
|
7de61c1603 | ||
|
|
49b6762927 | ||
|
|
8fe085c45f | ||
|
|
b55e9f797f | ||
|
|
54d7a9474a | ||
|
|
88ee4b3e3b | ||
|
|
3f0d49a602 | ||
|
|
124e601d2f | ||
|
|
60bb787f93 | ||
|
|
d107487228 | ||
|
|
e315dc5a48 | ||
|
|
17aac9b77d | ||
|
|
24564c59d3 | ||
|
|
1697fe2c56 | ||
|
|
d9847ff87b | ||
|
|
e16f43b1e4 |
7
.gitignore
vendored
7
.gitignore
vendored
@ -25,3 +25,10 @@ msg_gen
|
|||||||
srv_gen
|
srv_gen
|
||||||
doc/html
|
doc/html
|
||||||
*sublime-workspace
|
*sublime-workspace
|
||||||
|
*.user
|
||||||
|
*.suo
|
||||||
|
*.sdf
|
||||||
|
*.opensdf
|
||||||
|
ipch
|
||||||
|
Debug
|
||||||
|
Release
|
||||||
|
|||||||
16
.travis.yml
16
.travis.yml
@ -1,12 +1,10 @@
|
|||||||
|
os:
|
||||||
|
- linux
|
||||||
|
- osx
|
||||||
language: cpp
|
language: cpp
|
||||||
compiler:
|
|
||||||
- gcc
|
|
||||||
- clang
|
|
||||||
install:
|
install:
|
||||||
- sudo sh -c 'echo "deb http://packages.ros.org/ros/ubuntu precise main" > /etc/apt/sources.list.d/ros-latest.list'
|
- make install_deps
|
||||||
- wget http://packages.ros.org/ros.key -O - | sudo apt-key add -
|
- source setup.bash
|
||||||
- sudo apt-get update
|
|
||||||
- sudo apt-get install ros-groovy-catkin libboost-dev
|
|
||||||
- source /opt/ros/groovy/setup.bash
|
|
||||||
script:
|
script:
|
||||||
- make && make test
|
- mkdir build && cd build && cmake .. -DPYTHON_EXECUTABLE=$(which python2) && make && make tests && make run_tests
|
||||||
|
- catkin_test_results .
|
||||||
|
|||||||
@ -2,6 +2,22 @@
|
|||||||
Changelog for package serial
|
Changelog for package serial
|
||||||
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||||
|
|
||||||
|
1.2.1 (2015-04-21)
|
||||||
|
------------------
|
||||||
|
* Removed the use of a C++11 feature for compatibility with older browsers.
|
||||||
|
* Fixed an issue with cross compiling with mingw on Windows.
|
||||||
|
* Restructured Visual Studio project layout.
|
||||||
|
* Added include of ``#include <AvailabilityMacros.h>`` on OS X (listing of ports).
|
||||||
|
* Fixed MXE for the listing of ports on Windows.
|
||||||
|
* Now closes file device if ``reconfigureDevice`` fails (Windows).
|
||||||
|
* Added the MARK/SPACE parity bit option, also made it optional.
|
||||||
|
Adding the enumeration values for MARK and SPACE was the only code change to an API header.
|
||||||
|
It should not affect ABI or API.
|
||||||
|
* Added support for 576000 baud on Linux.
|
||||||
|
* Now releases iterator properly in listing of ports code for OS X.
|
||||||
|
* Fixed the ability to open COM ports over COM10 on Windows.
|
||||||
|
* Fixed up some documentation about exceptions in ``serial.h``.
|
||||||
|
|
||||||
1.2.0 (2014-07-02)
|
1.2.0 (2014-07-02)
|
||||||
------------------
|
------------------
|
||||||
* Removed vestigial ``read_cache_`` private member variable from Serial::Serial
|
* Removed vestigial ``read_cache_`` private member variable from Serial::Serial
|
||||||
|
|||||||
@ -11,6 +11,8 @@ endif()
|
|||||||
|
|
||||||
if(UNIX AND NOT APPLE)
|
if(UNIX AND NOT APPLE)
|
||||||
# If Linux, add rt and pthread
|
# If Linux, add rt and pthread
|
||||||
|
set(rt_LIBRARIES rt)
|
||||||
|
set(pthread_LIBRARIES pthread)
|
||||||
catkin_package(
|
catkin_package(
|
||||||
LIBRARIES ${PROJECT_NAME}
|
LIBRARIES ${PROJECT_NAME}
|
||||||
INCLUDE_DIRS include
|
INCLUDE_DIRS include
|
||||||
@ -38,9 +40,10 @@ elseif(UNIX)
|
|||||||
# If unix
|
# If unix
|
||||||
list(APPEND serial_SRCS src/impl/unix.cc)
|
list(APPEND serial_SRCS src/impl/unix.cc)
|
||||||
list(APPEND serial_SRCS src/impl/list_ports/list_ports_linux.cc)
|
list(APPEND serial_SRCS src/impl/list_ports/list_ports_linux.cc)
|
||||||
elseif()
|
else()
|
||||||
# If windows
|
# If windows
|
||||||
list(APPEND serial_SRCS src/impl/win.cc)
|
list(APPEND serial_SRCS src/impl/win.cc)
|
||||||
|
list(APPEND serial_SRCS src/impl/list_ports/list_ports_win.cc)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
## Add serial library
|
## Add serial library
|
||||||
@ -49,6 +52,8 @@ if(APPLE)
|
|||||||
target_link_libraries(${PROJECT_NAME} ${FOUNDATION_LIBRARY} ${IOKIT_LIBRARY})
|
target_link_libraries(${PROJECT_NAME} ${FOUNDATION_LIBRARY} ${IOKIT_LIBRARY})
|
||||||
elseif(UNIX)
|
elseif(UNIX)
|
||||||
target_link_libraries(${PROJECT_NAME} rt pthread)
|
target_link_libraries(${PROJECT_NAME} rt pthread)
|
||||||
|
else()
|
||||||
|
target_link_libraries(${PROJECT_NAME} setupapi)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
## Uncomment for example
|
## Uncomment for example
|
||||||
@ -63,6 +68,7 @@ include_directories(include)
|
|||||||
install(TARGETS ${PROJECT_NAME}
|
install(TARGETS ${PROJECT_NAME}
|
||||||
ARCHIVE DESTINATION ${CATKIN_PACKAGE_LIB_DESTINATION}
|
ARCHIVE DESTINATION ${CATKIN_PACKAGE_LIB_DESTINATION}
|
||||||
LIBRARY DESTINATION ${CATKIN_PACKAGE_LIB_DESTINATION}
|
LIBRARY DESTINATION ${CATKIN_PACKAGE_LIB_DESTINATION}
|
||||||
|
RUNTIME DESTINATION ${CATKIN_GLOBAL_BIN_DESTINATION}
|
||||||
)
|
)
|
||||||
|
|
||||||
## Install headers
|
## Install headers
|
||||||
|
|||||||
7
LICENSE
Normal file
7
LICENSE
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
Copyright (c) 2012 William Woodall, John Harrison
|
||||||
|
|
||||||
|
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
||||||
|
|
||||||
|
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
||||||
|
|
||||||
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||||
29
Makefile
29
Makefile
@ -1,13 +1,36 @@
|
|||||||
all: serial
|
all: serial
|
||||||
|
|
||||||
CMAKE_FLAGS := -DCMAKE_INSTALL_PREFIX=/tmp/usr/local
|
CMAKE_FLAGS := -DCMAKE_INSTALL_PREFIX=/tmp/usr/local
|
||||||
|
UNAME := $(shell uname -s)
|
||||||
|
|
||||||
|
install_deps:
|
||||||
|
ifeq ($(UNAME),Darwin)
|
||||||
|
brew tap ros/deps
|
||||||
|
brew update
|
||||||
|
brew outdated boost || brew upgrade boost || brew install boost
|
||||||
|
brew outdated python || brew upgrade python || brew install python
|
||||||
|
sudo -H python2 -m pip install -U pip setuptools
|
||||||
|
sudo -H python2 -m pip install --force-reinstall --no-deps -U pip
|
||||||
|
sudo -H python2 -m pip install rosinstall_generator wstool rosdep empy catkin_pkg
|
||||||
|
sudo -H rosdep init
|
||||||
|
rosdep update
|
||||||
|
mkdir catkin_ws
|
||||||
|
cd catkin_ws && rosinstall_generator catkin --rosdistro hydro --tar > catkin.rosinstall
|
||||||
|
cd catkin_ws && wstool init src catkin.rosinstall
|
||||||
|
cd catkin_ws && rosdep install --from-paths src --ignore-src -y
|
||||||
|
cd catkin_ws && python2 ./src/catkin/bin/catkin_make -DPYTHON_EXECUTABLE=`which python2` install
|
||||||
|
echo "source catkin_ws/install/setup.bash" > setup.bash
|
||||||
|
else
|
||||||
|
sudo sh -c 'echo "deb http://packages.ros.org/ros/ubuntu precise main" > /etc/apt/sources.list.d/ros-latest.list'
|
||||||
|
wget http://packages.ros.org/ros.key -O - | sudo apt-key add -
|
||||||
|
sudo apt-get update
|
||||||
|
sudo apt-get install ros-hydro-catkin libboost-dev
|
||||||
|
echo "source /opt/ros/hydro/setup.bash" > setup.bash
|
||||||
|
endif
|
||||||
|
|
||||||
install:
|
install:
|
||||||
cd build && make install
|
cd build && make install
|
||||||
|
|
||||||
uninstall:
|
|
||||||
cd build && make uninstall
|
|
||||||
|
|
||||||
serial:
|
serial:
|
||||||
@mkdir -p build
|
@mkdir -p build
|
||||||
cd build && cmake $(CMAKE_FLAGS) ..
|
cd build && cmake $(CMAKE_FLAGS) ..
|
||||||
|
|||||||
27
README.md
27
README.md
@ -1,5 +1,7 @@
|
|||||||
# Serial Communication Library
|
# Serial Communication Library
|
||||||
|
|
||||||
|
[](https://travis-ci.org/wjwwood/serial)*(Linux and OS X)* [](https://ci.appveyor.com/project/wjwwood/serial)*(Windows)*
|
||||||
|
|
||||||
This is a cross-platform library for interfacing with rs-232 serial like ports written in C++. It provides a modern C++ interface with a workflow designed to look and feel like PySerial, but with the speed and control provided by C++.
|
This is a cross-platform library for interfacing with rs-232 serial like ports written in C++. It provides a modern C++ interface with a workflow designed to look and feel like PySerial, but with the speed and control provided by C++.
|
||||||
|
|
||||||
This library is in use in several robotics related projects and can be built and installed to the OS like most unix libraries with make and then sudo make install, but because it is a catkin project it can also be built along side other catkin projects in a catkin workspace.
|
This library is in use in several robotics related projects and can be built and installed to the OS like most unix libraries with make and then sudo make install, but because it is a catkin project it can also be built along side other catkin projects in a catkin workspace.
|
||||||
@ -8,18 +10,23 @@ Serial is a class that provides the basic interface common to serial libraries (
|
|||||||
|
|
||||||
### Documentation
|
### Documentation
|
||||||
|
|
||||||
Website: http://wjwwood.github.com/serial/
|
Website: http://wjwwood.github.io/serial/
|
||||||
|
|
||||||
API Documentation: http://wjwwood.github.com/serial/doc/1.1.0/index.html
|
API Documentation: http://wjwwood.github.io/serial/doc/1.1.0/index.html
|
||||||
|
|
||||||
### Dependencies
|
### Dependencies
|
||||||
|
|
||||||
|
Required:
|
||||||
* [catkin](http://www.ros.org/wiki/catkin) - cmake and Python based buildsystem
|
* [catkin](http://www.ros.org/wiki/catkin) - cmake and Python based buildsystem
|
||||||
* [cmake](http://www.cmake.org) - buildsystem
|
* [cmake](http://www.cmake.org) - buildsystem
|
||||||
* [Python](http://www.python.org) - scripting language
|
* [Python](http://www.python.org) - scripting language
|
||||||
* [empy](http://www.alcyone.com/pyos/empy/) - Python templating library
|
* [empy](http://www.alcyone.com/pyos/empy/) - Python templating library
|
||||||
* [catkin_pkg](http://pypi.python.org/pypi/catkin_pkg/) - Runtime Python library for catkin
|
* [catkin_pkg](http://pypi.python.org/pypi/catkin_pkg/) - Runtime Python library for catkin
|
||||||
|
|
||||||
|
Optional (for documentation):
|
||||||
|
* [Doxygen](http://www.doxygen.org/) - Documentation generation tool
|
||||||
|
* [graphviz](http://www.graphviz.org/) - Graph visualization software
|
||||||
|
|
||||||
### Install
|
### Install
|
||||||
|
|
||||||
Get the code:
|
Get the code:
|
||||||
@ -36,27 +43,15 @@ Build and run the tests:
|
|||||||
|
|
||||||
Build the documentation:
|
Build the documentation:
|
||||||
|
|
||||||
make docs
|
make doc
|
||||||
|
|
||||||
Install:
|
Install:
|
||||||
|
|
||||||
make install
|
make install
|
||||||
|
|
||||||
Uninstall:
|
|
||||||
|
|
||||||
make uninstall
|
|
||||||
|
|
||||||
### License
|
### License
|
||||||
|
|
||||||
The MIT License
|
[The MIT License](LICENSE)
|
||||||
|
|
||||||
Copyright (c) 2012 William Woodall, John Harrison
|
|
||||||
|
|
||||||
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
|
||||||
|
|
||||||
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
|
||||||
|
|
||||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
||||||
|
|
||||||
### Authors
|
### Authors
|
||||||
|
|
||||||
|
|||||||
2492
doc/Doxyfile
2492
doc/Doxyfile
File diff suppressed because it is too large
Load Diff
@ -55,10 +55,4 @@ To install simply:
|
|||||||
sudo make install
|
sudo make install
|
||||||
</pre>
|
</pre>
|
||||||
|
|
||||||
To uninstall simply:
|
|
||||||
|
|
||||||
<pre>
|
|
||||||
sudo make uninstall
|
|
||||||
</pre>
|
|
||||||
|
|
||||||
*/
|
*/
|
||||||
@ -66,7 +66,9 @@ typedef enum {
|
|||||||
typedef enum {
|
typedef enum {
|
||||||
parity_none = 0,
|
parity_none = 0,
|
||||||
parity_odd = 1,
|
parity_odd = 1,
|
||||||
parity_even = 2
|
parity_even = 2,
|
||||||
|
parity_mark = 3,
|
||||||
|
parity_space = 4
|
||||||
} parity_t;
|
} parity_t;
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
@ -255,6 +257,9 @@ public:
|
|||||||
*
|
*
|
||||||
* \return A size_t representing the number of bytes read as a result of the
|
* \return A size_t representing the number of bytes read as a result of the
|
||||||
* call to read.
|
* call to read.
|
||||||
|
*
|
||||||
|
* \throw serial::PortNotOpenedException
|
||||||
|
* \throw serial::SerialException
|
||||||
*/
|
*/
|
||||||
size_t
|
size_t
|
||||||
read (uint8_t *buffer, size_t size);
|
read (uint8_t *buffer, size_t size);
|
||||||
@ -266,6 +271,9 @@ public:
|
|||||||
*
|
*
|
||||||
* \return A size_t representing the number of bytes read as a result of the
|
* \return A size_t representing the number of bytes read as a result of the
|
||||||
* call to read.
|
* call to read.
|
||||||
|
*
|
||||||
|
* \throw serial::PortNotOpenedException
|
||||||
|
* \throw serial::SerialException
|
||||||
*/
|
*/
|
||||||
size_t
|
size_t
|
||||||
read (std::vector<uint8_t> &buffer, size_t size = 1);
|
read (std::vector<uint8_t> &buffer, size_t size = 1);
|
||||||
@ -277,6 +285,9 @@ public:
|
|||||||
*
|
*
|
||||||
* \return A size_t representing the number of bytes read as a result of the
|
* \return A size_t representing the number of bytes read as a result of the
|
||||||
* call to read.
|
* call to read.
|
||||||
|
*
|
||||||
|
* \throw serial::PortNotOpenedException
|
||||||
|
* \throw serial::SerialException
|
||||||
*/
|
*/
|
||||||
size_t
|
size_t
|
||||||
read (std::string &buffer, size_t size = 1);
|
read (std::string &buffer, size_t size = 1);
|
||||||
@ -287,6 +298,9 @@ public:
|
|||||||
* \param size A size_t defining how many bytes to be read.
|
* \param size A size_t defining how many bytes to be read.
|
||||||
*
|
*
|
||||||
* \return A std::string containing the data read from the port.
|
* \return A std::string containing the data read from the port.
|
||||||
|
*
|
||||||
|
* \throw serial::PortNotOpenedException
|
||||||
|
* \throw serial::SerialException
|
||||||
*/
|
*/
|
||||||
std::string
|
std::string
|
||||||
read (size_t size = 1);
|
read (size_t size = 1);
|
||||||
@ -300,6 +314,9 @@ public:
|
|||||||
* \param eol A string to match against for the EOL.
|
* \param eol A string to match against for the EOL.
|
||||||
*
|
*
|
||||||
* \return A size_t representing the number of bytes read.
|
* \return A size_t representing the number of bytes read.
|
||||||
|
*
|
||||||
|
* \throw serial::PortNotOpenedException
|
||||||
|
* \throw serial::SerialException
|
||||||
*/
|
*/
|
||||||
size_t
|
size_t
|
||||||
readline (std::string &buffer, size_t size = 65536, std::string eol = "\n");
|
readline (std::string &buffer, size_t size = 65536, std::string eol = "\n");
|
||||||
@ -312,6 +329,9 @@ public:
|
|||||||
* \param eol A string to match against for the EOL.
|
* \param eol A string to match against for the EOL.
|
||||||
*
|
*
|
||||||
* \return A std::string containing the line.
|
* \return A std::string containing the line.
|
||||||
|
*
|
||||||
|
* \throw serial::PortNotOpenedException
|
||||||
|
* \throw serial::SerialException
|
||||||
*/
|
*/
|
||||||
std::string
|
std::string
|
||||||
readline (size_t size = 65536, std::string eol = "\n");
|
readline (size_t size = 65536, std::string eol = "\n");
|
||||||
@ -326,6 +346,9 @@ public:
|
|||||||
* \param eol A string to match against for the EOL.
|
* \param eol A string to match against for the EOL.
|
||||||
*
|
*
|
||||||
* \return A vector<string> containing the lines.
|
* \return A vector<string> containing the lines.
|
||||||
|
*
|
||||||
|
* \throw serial::PortNotOpenedException
|
||||||
|
* \throw serial::SerialException
|
||||||
*/
|
*/
|
||||||
std::vector<std::string>
|
std::vector<std::string>
|
||||||
readlines (size_t size = 65536, std::string eol = "\n");
|
readlines (size_t size = 65536, std::string eol = "\n");
|
||||||
@ -340,6 +363,10 @@ public:
|
|||||||
*
|
*
|
||||||
* \return A size_t representing the number of bytes actually written to
|
* \return A size_t representing the number of bytes actually written to
|
||||||
* the serial port.
|
* the serial port.
|
||||||
|
*
|
||||||
|
* \throw serial::PortNotOpenedException
|
||||||
|
* \throw serial::SerialException
|
||||||
|
* \throw serial::IOException
|
||||||
*/
|
*/
|
||||||
size_t
|
size_t
|
||||||
write (const uint8_t *data, size_t size);
|
write (const uint8_t *data, size_t size);
|
||||||
@ -351,6 +378,10 @@ public:
|
|||||||
*
|
*
|
||||||
* \return A size_t representing the number of bytes actually written to
|
* \return A size_t representing the number of bytes actually written to
|
||||||
* the serial port.
|
* the serial port.
|
||||||
|
*
|
||||||
|
* \throw serial::PortNotOpenedException
|
||||||
|
* \throw serial::SerialException
|
||||||
|
* \throw serial::IOException
|
||||||
*/
|
*/
|
||||||
size_t
|
size_t
|
||||||
write (const std::vector<uint8_t> &data);
|
write (const std::vector<uint8_t> &data);
|
||||||
@ -362,6 +393,10 @@ public:
|
|||||||
*
|
*
|
||||||
* \return A size_t representing the number of bytes actually written to
|
* \return A size_t representing the number of bytes actually written to
|
||||||
* the serial port.
|
* the serial port.
|
||||||
|
*
|
||||||
|
* \throw serial::PortNotOpenedException
|
||||||
|
* \throw serial::SerialException
|
||||||
|
* \throw serial::IOException
|
||||||
*/
|
*/
|
||||||
size_t
|
size_t
|
||||||
write (const std::string &data);
|
write (const std::string &data);
|
||||||
@ -372,7 +407,7 @@ public:
|
|||||||
* serial port, which would be something like 'COM1' on Windows and
|
* serial port, which would be something like 'COM1' on Windows and
|
||||||
* '/dev/ttyS0' on Linux.
|
* '/dev/ttyS0' on Linux.
|
||||||
*
|
*
|
||||||
* \throw InvalidConfigurationException
|
* \throw std::invalid_argument
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
setPort (const std::string &port);
|
setPort (const std::string &port);
|
||||||
@ -381,7 +416,7 @@ public:
|
|||||||
*
|
*
|
||||||
* \see Serial::setPort
|
* \see Serial::setPort
|
||||||
*
|
*
|
||||||
* \throw InvalidConfigurationException
|
* \throw std::invalid_argument
|
||||||
*/
|
*/
|
||||||
std::string
|
std::string
|
||||||
getPort () const;
|
getPort () const;
|
||||||
@ -415,6 +450,8 @@ public:
|
|||||||
* reading or writing is complete, when a timeout occurs, or when an
|
* reading or writing is complete, when a timeout occurs, or when an
|
||||||
* exception occurs.
|
* exception occurs.
|
||||||
*
|
*
|
||||||
|
* A timeout of 0 enables non-blocking mode.
|
||||||
|
*
|
||||||
* \param timeout A serial::Timeout struct containing the inter byte
|
* \param timeout A serial::Timeout struct containing the inter byte
|
||||||
* timeout, and the read and write timeout constants and multipliers.
|
* timeout, and the read and write timeout constants and multipliers.
|
||||||
*
|
*
|
||||||
@ -451,11 +488,11 @@ public:
|
|||||||
* 110, 300, 600, 1200, 2400, 4800, 9600, 14400, 19200, 28800, 38400, 56000,
|
* 110, 300, 600, 1200, 2400, 4800, 9600, 14400, 19200, 28800, 38400, 56000,
|
||||||
* 57600, 115200
|
* 57600, 115200
|
||||||
* Some other baudrates that are supported by some comports:
|
* Some other baudrates that are supported by some comports:
|
||||||
* 128000, 153600, 230400, 256000, 460800, 921600
|
* 128000, 153600, 230400, 256000, 460800, 500000, 921600
|
||||||
*
|
*
|
||||||
* \param baudrate An integer that sets the baud rate for the serial port.
|
* \param baudrate An integer that sets the baud rate for the serial port.
|
||||||
*
|
*
|
||||||
* \throw InvalidConfigurationException
|
* \throw std::invalid_argument
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
setBaudrate (uint32_t baudrate);
|
setBaudrate (uint32_t baudrate);
|
||||||
@ -466,7 +503,7 @@ public:
|
|||||||
*
|
*
|
||||||
* \see Serial::setBaudrate
|
* \see Serial::setBaudrate
|
||||||
*
|
*
|
||||||
* \throw InvalidConfigurationException
|
* \throw std::invalid_argument
|
||||||
*/
|
*/
|
||||||
uint32_t
|
uint32_t
|
||||||
getBaudrate () const;
|
getBaudrate () const;
|
||||||
@ -477,7 +514,7 @@ public:
|
|||||||
* default is eightbits, possible values are: fivebits, sixbits, sevenbits,
|
* default is eightbits, possible values are: fivebits, sixbits, sevenbits,
|
||||||
* eightbits
|
* eightbits
|
||||||
*
|
*
|
||||||
* \throw InvalidConfigurationException
|
* \throw std::invalid_argument
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
setBytesize (bytesize_t bytesize);
|
setBytesize (bytesize_t bytesize);
|
||||||
@ -486,7 +523,7 @@ public:
|
|||||||
*
|
*
|
||||||
* \see Serial::setBytesize
|
* \see Serial::setBytesize
|
||||||
*
|
*
|
||||||
* \throw InvalidConfigurationException
|
* \throw std::invalid_argument
|
||||||
*/
|
*/
|
||||||
bytesize_t
|
bytesize_t
|
||||||
getBytesize () const;
|
getBytesize () const;
|
||||||
@ -496,7 +533,7 @@ public:
|
|||||||
* \param parity Method of parity, default is parity_none, possible values
|
* \param parity Method of parity, default is parity_none, possible values
|
||||||
* are: parity_none, parity_odd, parity_even
|
* are: parity_none, parity_odd, parity_even
|
||||||
*
|
*
|
||||||
* \throw InvalidConfigurationException
|
* \throw std::invalid_argument
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
setParity (parity_t parity);
|
setParity (parity_t parity);
|
||||||
@ -505,7 +542,7 @@ public:
|
|||||||
*
|
*
|
||||||
* \see Serial::setParity
|
* \see Serial::setParity
|
||||||
*
|
*
|
||||||
* \throw InvalidConfigurationException
|
* \throw std::invalid_argument
|
||||||
*/
|
*/
|
||||||
parity_t
|
parity_t
|
||||||
getParity () const;
|
getParity () const;
|
||||||
@ -515,7 +552,7 @@ public:
|
|||||||
* \param stopbits Number of stop bits used, default is stopbits_one,
|
* \param stopbits Number of stop bits used, default is stopbits_one,
|
||||||
* possible values are: stopbits_one, stopbits_one_point_five, stopbits_two
|
* possible values are: stopbits_one, stopbits_one_point_five, stopbits_two
|
||||||
*
|
*
|
||||||
* \throw InvalidConfigurationException
|
* \throw std::invalid_argument
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
setStopbits (stopbits_t stopbits);
|
setStopbits (stopbits_t stopbits);
|
||||||
@ -524,7 +561,7 @@ public:
|
|||||||
*
|
*
|
||||||
* \see Serial::setStopbits
|
* \see Serial::setStopbits
|
||||||
*
|
*
|
||||||
* \throw InvalidConfigurationException
|
* \throw std::invalid_argument
|
||||||
*/
|
*/
|
||||||
stopbits_t
|
stopbits_t
|
||||||
getStopbits () const;
|
getStopbits () const;
|
||||||
@ -535,7 +572,7 @@ public:
|
|||||||
* possible values are: flowcontrol_none, flowcontrol_software,
|
* possible values are: flowcontrol_none, flowcontrol_software,
|
||||||
* flowcontrol_hardware
|
* flowcontrol_hardware
|
||||||
*
|
*
|
||||||
* \throw InvalidConfigurationException
|
* \throw std::invalid_argument
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
setFlowcontrol (flowcontrol_t flowcontrol);
|
setFlowcontrol (flowcontrol_t flowcontrol);
|
||||||
@ -544,7 +581,7 @@ public:
|
|||||||
*
|
*
|
||||||
* \see Serial::setFlowcontrol
|
* \see Serial::setFlowcontrol
|
||||||
*
|
*
|
||||||
* \throw InvalidConfigurationException
|
* \throw std::invalid_argument
|
||||||
*/
|
*/
|
||||||
flowcontrol_t
|
flowcontrol_t
|
||||||
getFlowcontrol () const;
|
getFlowcontrol () const;
|
||||||
@ -682,7 +719,7 @@ public:
|
|||||||
virtual ~IOException() throw() {}
|
virtual ~IOException() throw() {}
|
||||||
IOException (const IOException& other) : line_(other.line_), e_what_(other.e_what_), errno_(other.errno_) {}
|
IOException (const IOException& other) : line_(other.line_), e_what_(other.e_what_), errno_(other.errno_) {}
|
||||||
|
|
||||||
int getErrorNumber () { return errno_; }
|
int getErrorNumber () const { return errno_; }
|
||||||
|
|
||||||
virtual const char* what () const throw () {
|
virtual const char* what () const throw () {
|
||||||
return e_what_.c_str();
|
return e_what_.c_str();
|
||||||
|
|||||||
@ -1,9 +1,11 @@
|
|||||||
<?xml version="1.0"?>
|
<?xml version="1.0"?>
|
||||||
<package>
|
<package>
|
||||||
<name>serial</name>
|
<name>serial</name>
|
||||||
<version>1.2.0</version>
|
<version>1.2.1</version>
|
||||||
<description>
|
<description>
|
||||||
Serial is a cross-platform, simple to use library for using serial ports on computers. This library provides a C++, object oriented interface for interacting with RS-232 like devices on Linux and Windows.
|
Serial is a cross-platform, simple to use library for using serial ports on computers.
|
||||||
|
This library provides a C++, object oriented interface for interacting with RS-232
|
||||||
|
like devices on Linux and Windows.
|
||||||
</description>
|
</description>
|
||||||
|
|
||||||
<maintainer email="william@osrfoundation.org">William Woodall</maintainer>
|
<maintainer email="william@osrfoundation.org">William Woodall</maintainer>
|
||||||
@ -19,6 +21,4 @@
|
|||||||
|
|
||||||
<buildtool_depend>catkin</buildtool_depend>
|
<buildtool_depend>catkin</buildtool_depend>
|
||||||
|
|
||||||
<test_depend>boost</test_depend>
|
|
||||||
|
|
||||||
</package>
|
</package>
|
||||||
|
|||||||
@ -11,9 +11,12 @@
|
|||||||
{
|
{
|
||||||
"sublimeclang_options":
|
"sublimeclang_options":
|
||||||
[
|
[
|
||||||
"-I/usr/include",
|
"-I/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1",
|
||||||
"-I/usr/local/include",
|
"-I/usr/local/include",
|
||||||
"-I${folder:${project_path:serial.sublime-project}}/include"
|
"-I/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/9.0.0/include",
|
||||||
|
"-I/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include",
|
||||||
|
"-I/usr/include",
|
||||||
|
"-I${folder:${project_path:serial.sublime-project}}/include",
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -305,6 +305,7 @@ serial::list_ports()
|
|||||||
search_globs.push_back("/dev/ttyUSB*");
|
search_globs.push_back("/dev/ttyUSB*");
|
||||||
search_globs.push_back("/dev/tty.*");
|
search_globs.push_back("/dev/tty.*");
|
||||||
search_globs.push_back("/dev/cu.*");
|
search_globs.push_back("/dev/cu.*");
|
||||||
|
search_globs.push_back("/dev/rfcomm*");
|
||||||
|
|
||||||
vector<string> devices_found = glob( search_globs );
|
vector<string> devices_found = glob( search_globs );
|
||||||
|
|
||||||
|
|||||||
@ -279,6 +279,7 @@ serial::list_ports(void)
|
|||||||
devices_found.push_back(port_info);
|
devices_found.push_back(port_info);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
IOObjectRelease(serial_port_iterator);
|
||||||
return devices_found;
|
return devices_found;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -8,8 +8,10 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include "serial/serial.h"
|
#include "serial/serial.h"
|
||||||
|
#include <tchar.h>
|
||||||
#include <windows.h>
|
#include <windows.h>
|
||||||
#include <SetupAPI.h>
|
#include <setupapi.h>
|
||||||
|
#include <initguid.h>
|
||||||
#include <devguid.h>
|
#include <devguid.h>
|
||||||
#include <cstring>
|
#include <cstring>
|
||||||
|
|
||||||
@ -21,10 +23,19 @@ static const DWORD port_name_max_length = 256;
|
|||||||
static const DWORD friendly_name_max_length = 256;
|
static const DWORD friendly_name_max_length = 256;
|
||||||
static const DWORD hardware_id_max_length = 256;
|
static const DWORD hardware_id_max_length = 256;
|
||||||
|
|
||||||
|
// Convert a wide Unicode string to an UTF8 string
|
||||||
|
std::string utf8_encode(const std::wstring &wstr)
|
||||||
|
{
|
||||||
|
int size_needed = WideCharToMultiByte(CP_UTF8, 0, &wstr[0], (int)wstr.size(), NULL, 0, NULL, NULL);
|
||||||
|
std::string strTo( size_needed, 0 );
|
||||||
|
WideCharToMultiByte (CP_UTF8, 0, &wstr[0], (int)wstr.size(), &strTo[0], size_needed, NULL, NULL);
|
||||||
|
return strTo;
|
||||||
|
}
|
||||||
|
|
||||||
vector<PortInfo>
|
vector<PortInfo>
|
||||||
serial::list_ports()
|
serial::list_ports()
|
||||||
{
|
{
|
||||||
decltype( serial::list_ports() ) devices_found;
|
vector<PortInfo> devices_found;
|
||||||
|
|
||||||
HDEVINFO device_info_set = SetupDiGetClassDevs(
|
HDEVINFO device_info_set = SetupDiGetClassDevs(
|
||||||
(const GUID *) &GUID_DEVCLASS_PORTS,
|
(const GUID *) &GUID_DEVCLASS_PORTS,
|
||||||
@ -51,12 +62,12 @@ serial::list_ports()
|
|||||||
DIREG_DEV,
|
DIREG_DEV,
|
||||||
KEY_READ);
|
KEY_READ);
|
||||||
|
|
||||||
char port_name[port_name_max_length];
|
TCHAR port_name[port_name_max_length];
|
||||||
DWORD port_name_length = port_name_max_length;
|
DWORD port_name_length = port_name_max_length;
|
||||||
|
|
||||||
LONG return_code = RegQueryValueEx(
|
LONG return_code = RegQueryValueEx(
|
||||||
hkey,
|
hkey,
|
||||||
"PortName",
|
_T("PortName"),
|
||||||
NULL,
|
NULL,
|
||||||
NULL,
|
NULL,
|
||||||
(LPBYTE)port_name,
|
(LPBYTE)port_name,
|
||||||
@ -74,12 +85,12 @@ serial::list_ports()
|
|||||||
|
|
||||||
// Ignore parallel ports
|
// Ignore parallel ports
|
||||||
|
|
||||||
if(strstr(port_name, "LPT") != NULL)
|
if(_tcsstr(port_name, _T("LPT")) != NULL)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
// Get port friendly name
|
// Get port friendly name
|
||||||
|
|
||||||
char friendly_name[friendly_name_max_length];
|
TCHAR friendly_name[friendly_name_max_length];
|
||||||
DWORD friendly_name_actual_length = 0;
|
DWORD friendly_name_actual_length = 0;
|
||||||
|
|
||||||
BOOL got_friendly_name = SetupDiGetDeviceRegistryProperty(
|
BOOL got_friendly_name = SetupDiGetDeviceRegistryProperty(
|
||||||
@ -98,7 +109,7 @@ serial::list_ports()
|
|||||||
|
|
||||||
// Get hardware ID
|
// Get hardware ID
|
||||||
|
|
||||||
char hardware_id[hardware_id_max_length];
|
TCHAR hardware_id[hardware_id_max_length];
|
||||||
DWORD hardware_id_actual_length = 0;
|
DWORD hardware_id_actual_length = 0;
|
||||||
|
|
||||||
BOOL got_hardware_id = SetupDiGetDeviceRegistryProperty(
|
BOOL got_hardware_id = SetupDiGetDeviceRegistryProperty(
|
||||||
@ -115,10 +126,20 @@ serial::list_ports()
|
|||||||
else
|
else
|
||||||
hardware_id[0] = '\0';
|
hardware_id[0] = '\0';
|
||||||
|
|
||||||
|
#ifdef UNICODE
|
||||||
|
std::string portName = utf8_encode(port_name);
|
||||||
|
std::string friendlyName = utf8_encode(friendly_name);
|
||||||
|
std::string hardwareId = utf8_encode(hardware_id);
|
||||||
|
#else
|
||||||
|
std::string portName = port_name;
|
||||||
|
std::string friendlyName = friendly_name;
|
||||||
|
std::string hardwareId = hardware_id;
|
||||||
|
#endif
|
||||||
|
|
||||||
PortInfo port_entry;
|
PortInfo port_entry;
|
||||||
port_entry.port = port_name;
|
port_entry.port = portName;
|
||||||
port_entry.description = friendly_name;
|
port_entry.description = friendlyName;
|
||||||
port_entry.hardware_id = hardware_id;
|
port_entry.hardware_id = hardwareId;
|
||||||
|
|
||||||
devices_found.push_back(port_entry);
|
devices_found.push_back(port_entry);
|
||||||
}
|
}
|
||||||
|
|||||||
121
src/impl/unix.cc
121
src/impl/unix.cc
@ -27,6 +27,7 @@
|
|||||||
#include <sys/time.h>
|
#include <sys/time.h>
|
||||||
#include <time.h>
|
#include <time.h>
|
||||||
#ifdef __MACH__
|
#ifdef __MACH__
|
||||||
|
#include <AvailabilityMacros.h>
|
||||||
#include <mach/clock.h>
|
#include <mach/clock.h>
|
||||||
#include <mach/mach.h>
|
#include <mach/mach.h>
|
||||||
#endif
|
#endif
|
||||||
@ -61,7 +62,7 @@ MillisecondTimer::MillisecondTimer (const uint32_t millis)
|
|||||||
int64_t tv_nsec = expiry.tv_nsec + (millis * 1e6);
|
int64_t tv_nsec = expiry.tv_nsec + (millis * 1e6);
|
||||||
if (tv_nsec >= 1e9) {
|
if (tv_nsec >= 1e9) {
|
||||||
int64_t sec_diff = tv_nsec / static_cast<int> (1e9);
|
int64_t sec_diff = tv_nsec / static_cast<int> (1e9);
|
||||||
expiry.tv_nsec = tv_nsec - static_cast<int> (1e9 * sec_diff);
|
expiry.tv_nsec = tv_nsec % static_cast<int>(1e9);
|
||||||
expiry.tv_sec += sec_diff;
|
expiry.tv_sec += sec_diff;
|
||||||
} else {
|
} else {
|
||||||
expiry.tv_nsec = tv_nsec;
|
expiry.tv_nsec = tv_nsec;
|
||||||
@ -84,13 +85,13 @@ MillisecondTimer::timespec_now ()
|
|||||||
# ifdef __MACH__ // OS X does not have clock_gettime, use clock_get_time
|
# ifdef __MACH__ // OS X does not have clock_gettime, use clock_get_time
|
||||||
clock_serv_t cclock;
|
clock_serv_t cclock;
|
||||||
mach_timespec_t mts;
|
mach_timespec_t mts;
|
||||||
host_get_clock_service(mach_host_self(), CALENDAR_CLOCK, &cclock);
|
host_get_clock_service(mach_host_self(), SYSTEM_CLOCK, &cclock);
|
||||||
clock_get_time(cclock, &mts);
|
clock_get_time(cclock, &mts);
|
||||||
mach_port_deallocate(mach_task_self(), cclock);
|
mach_port_deallocate(mach_task_self(), cclock);
|
||||||
time.tv_sec = mts.tv_sec;
|
time.tv_sec = mts.tv_sec;
|
||||||
time.tv_nsec = mts.tv_nsec;
|
time.tv_nsec = mts.tv_nsec;
|
||||||
# else
|
# else
|
||||||
clock_gettime(CLOCK_REALTIME, &time);
|
clock_gettime(CLOCK_MONOTONIC, &time);
|
||||||
# endif
|
# endif
|
||||||
return time;
|
return time;
|
||||||
}
|
}
|
||||||
@ -268,6 +269,12 @@ Serial::SerialImpl::reconfigurePort ()
|
|||||||
#ifdef B460800
|
#ifdef B460800
|
||||||
case 460800: baud = B460800; break;
|
case 460800: baud = B460800; break;
|
||||||
#endif
|
#endif
|
||||||
|
#ifdef B500000
|
||||||
|
case 500000: baud = B500000; break;
|
||||||
|
#endif
|
||||||
|
#ifdef B576000
|
||||||
|
case 576000: baud = B576000; break;
|
||||||
|
#endif
|
||||||
#ifdef B921600
|
#ifdef B921600
|
||||||
case 921600: baud = B921600; break;
|
case 921600: baud = B921600; break;
|
||||||
#endif
|
#endif
|
||||||
@ -297,36 +304,6 @@ Serial::SerialImpl::reconfigurePort ()
|
|||||||
#endif
|
#endif
|
||||||
default:
|
default:
|
||||||
custom_baud = true;
|
custom_baud = true;
|
||||||
// OS X support
|
|
||||||
#if defined(MAC_OS_X_VERSION_10_4) && (MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_4)
|
|
||||||
// Starting with Tiger, the IOSSIOSPEED ioctl can be used to set arbitrary baud rates
|
|
||||||
// other than those specified by POSIX. The driver for the underlying serial hardware
|
|
||||||
// ultimately determines which baud rates can be used. This ioctl sets both the input
|
|
||||||
// and output speed.
|
|
||||||
speed_t new_baud = static_cast<speed_t> (baudrate_);
|
|
||||||
if (-1 == ioctl (fd_, IOSSIOSPEED, &new_baud, 1)) {
|
|
||||||
THROW (IOException, errno);
|
|
||||||
}
|
|
||||||
// Linux Support
|
|
||||||
#elif defined(__linux__) && defined (TIOCSSERIAL)
|
|
||||||
struct serial_struct ser;
|
|
||||||
|
|
||||||
if (-1 == ioctl (fd_, TIOCGSERIAL, &ser)) {
|
|
||||||
THROW (IOException, errno);
|
|
||||||
}
|
|
||||||
|
|
||||||
// set custom divisor
|
|
||||||
ser.custom_divisor = ser.baud_base / static_cast<int> (baudrate_);
|
|
||||||
// update flags
|
|
||||||
ser.flags &= ~ASYNC_SPD_MASK;
|
|
||||||
ser.flags |= ASYNC_SPD_CUST;
|
|
||||||
|
|
||||||
if (-1 == ioctl (fd_, TIOCSSERIAL, &ser)) {
|
|
||||||
THROW (IOException, errno);
|
|
||||||
}
|
|
||||||
#else
|
|
||||||
throw invalid_argument ("OS does not currently support custom bauds");
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
if (custom_baud == false) {
|
if (custom_baud == false) {
|
||||||
#ifdef _BSD_SOURCE
|
#ifdef _BSD_SOURCE
|
||||||
@ -368,7 +345,22 @@ Serial::SerialImpl::reconfigurePort ()
|
|||||||
options.c_cflag |= (PARENB);
|
options.c_cflag |= (PARENB);
|
||||||
} else if (parity_ == parity_odd) {
|
} else if (parity_ == parity_odd) {
|
||||||
options.c_cflag |= (PARENB | PARODD);
|
options.c_cflag |= (PARENB | PARODD);
|
||||||
} else {
|
}
|
||||||
|
#ifdef CMSPAR
|
||||||
|
else if (parity_ == parity_mark) {
|
||||||
|
options.c_cflag |= (PARENB | CMSPAR | PARODD);
|
||||||
|
}
|
||||||
|
else if (parity_ == parity_space) {
|
||||||
|
options.c_cflag |= (PARENB | CMSPAR);
|
||||||
|
options.c_cflag &= (tcflag_t) ~(PARODD);
|
||||||
|
}
|
||||||
|
#else
|
||||||
|
// CMSPAR is not defined on OSX. So do not support mark or space parity.
|
||||||
|
else if (parity_ == parity_mark || parity_ == parity_space) {
|
||||||
|
throw invalid_argument ("OS does not support mark or space parity");
|
||||||
|
}
|
||||||
|
#endif // ifdef CMSPAR
|
||||||
|
else {
|
||||||
throw invalid_argument ("invalid parity");
|
throw invalid_argument ("invalid parity");
|
||||||
}
|
}
|
||||||
// setup flow control
|
// setup flow control
|
||||||
@ -421,6 +413,41 @@ Serial::SerialImpl::reconfigurePort ()
|
|||||||
// activate settings
|
// activate settings
|
||||||
::tcsetattr (fd_, TCSANOW, &options);
|
::tcsetattr (fd_, TCSANOW, &options);
|
||||||
|
|
||||||
|
// apply custom baud rate, if any
|
||||||
|
if (custom_baud == true) {
|
||||||
|
// OS X support
|
||||||
|
#if defined(MAC_OS_X_VERSION_10_4) && (MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_4)
|
||||||
|
// Starting with Tiger, the IOSSIOSPEED ioctl can be used to set arbitrary baud rates
|
||||||
|
// other than those specified by POSIX. The driver for the underlying serial hardware
|
||||||
|
// ultimately determines which baud rates can be used. This ioctl sets both the input
|
||||||
|
// and output speed.
|
||||||
|
speed_t new_baud = static_cast<speed_t> (baudrate_);
|
||||||
|
// PySerial uses IOSSIOSPEED=0x80045402
|
||||||
|
if (-1 == ioctl (fd_, IOSSIOSPEED, &new_baud, 1)) {
|
||||||
|
THROW (IOException, errno);
|
||||||
|
}
|
||||||
|
// Linux Support
|
||||||
|
#elif defined(__linux__) && defined (TIOCSSERIAL)
|
||||||
|
struct serial_struct ser;
|
||||||
|
|
||||||
|
if (-1 == ioctl (fd_, TIOCGSERIAL, &ser)) {
|
||||||
|
THROW (IOException, errno);
|
||||||
|
}
|
||||||
|
|
||||||
|
// set custom divisor
|
||||||
|
ser.custom_divisor = ser.baud_base / static_cast<int> (baudrate_);
|
||||||
|
// update flags
|
||||||
|
ser.flags &= ~ASYNC_SPD_MASK;
|
||||||
|
ser.flags |= ASYNC_SPD_CUST;
|
||||||
|
|
||||||
|
if (-1 == ioctl (fd_, TIOCSSERIAL, &ser)) {
|
||||||
|
THROW (IOException, errno);
|
||||||
|
}
|
||||||
|
#else
|
||||||
|
throw invalid_argument ("OS does not currently support custom bauds");
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
// Update byte_time_ based on the new settings.
|
// Update byte_time_ based on the new settings.
|
||||||
uint32_t bit_time_ns = 1e9 / baudrate_;
|
uint32_t bit_time_ns = 1e9 / baudrate_;
|
||||||
byte_time_ns_ = bit_time_ns * (1 + bytesize_ + parity_ + stopbits_);
|
byte_time_ns_ = bit_time_ns * (1 + bytesize_ + parity_ + stopbits_);
|
||||||
@ -503,7 +530,7 @@ Serial::SerialImpl::waitReadable (uint32_t timeout)
|
|||||||
void
|
void
|
||||||
Serial::SerialImpl::waitByteTimes (size_t count)
|
Serial::SerialImpl::waitByteTimes (size_t count)
|
||||||
{
|
{
|
||||||
timespec wait_time = { 0, byte_time_ns_ * count };
|
timespec wait_time = { 0, static_cast<long>(byte_time_ns_ * count)};
|
||||||
pselect (0, NULL, NULL, NULL, &wait_time, NULL);
|
pselect (0, NULL, NULL, NULL, &wait_time, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -598,12 +625,17 @@ Serial::SerialImpl::write (const uint8_t *data, size_t length)
|
|||||||
total_timeout_ms += timeout_.write_timeout_multiplier * static_cast<long> (length);
|
total_timeout_ms += timeout_.write_timeout_multiplier * static_cast<long> (length);
|
||||||
MillisecondTimer total_timeout(total_timeout_ms);
|
MillisecondTimer total_timeout(total_timeout_ms);
|
||||||
|
|
||||||
|
bool first_iteration = true;
|
||||||
while (bytes_written < length) {
|
while (bytes_written < length) {
|
||||||
int64_t timeout_remaining_ms = total_timeout.remaining();
|
int64_t timeout_remaining_ms = total_timeout.remaining();
|
||||||
if (timeout_remaining_ms <= 0) {
|
// Only consider the timeout if it's not the first iteration of the loop
|
||||||
|
// otherwise a timeout of 0 won't be allowed through
|
||||||
|
if (!first_iteration && (timeout_remaining_ms <= 0)) {
|
||||||
// Timed out
|
// Timed out
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
first_iteration = false;
|
||||||
|
|
||||||
timespec timeout(timespec_from_ms(timeout_remaining_ms));
|
timespec timeout(timespec_from_ms(timeout_remaining_ms));
|
||||||
|
|
||||||
FD_ZERO (&writefds);
|
FD_ZERO (&writefds);
|
||||||
@ -633,14 +665,27 @@ Serial::SerialImpl::write (const uint8_t *data, size_t length)
|
|||||||
// This will write some
|
// This will write some
|
||||||
ssize_t bytes_written_now =
|
ssize_t bytes_written_now =
|
||||||
::write (fd_, data + bytes_written, length - bytes_written);
|
::write (fd_, data + bytes_written, length - bytes_written);
|
||||||
|
|
||||||
|
// even though pselect returned readiness the call might still be
|
||||||
|
// interrupted. In that case simply retry.
|
||||||
|
if (bytes_written_now == -1 && errno == EINTR) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
// write should always return some data as select reported it was
|
// write should always return some data as select reported it was
|
||||||
// ready to write when we get to this point.
|
// ready to write when we get to this point.
|
||||||
if (bytes_written_now < 1) {
|
if (bytes_written_now < 1) {
|
||||||
// Disconnected devices, at least on Linux, show the
|
// Disconnected devices, at least on Linux, show the
|
||||||
// behavior that they are always ready to write immediately
|
// behavior that they are always ready to write immediately
|
||||||
// but writing returns nothing.
|
// but writing returns nothing.
|
||||||
throw SerialException ("device reports readiness to write but "
|
std::stringstream strs;
|
||||||
"returned no data (device disconnected?)");
|
strs << "device reports readiness to write but "
|
||||||
|
"returned no data (device disconnected?)";
|
||||||
|
strs << " errno=" << errno;
|
||||||
|
strs << " bytes_written_now= " << bytes_written_now;
|
||||||
|
strs << " bytes_written=" << bytes_written;
|
||||||
|
strs << " length=" << length;
|
||||||
|
throw SerialException(strs.str().c_str());
|
||||||
}
|
}
|
||||||
// Update bytes_written
|
// Update bytes_written
|
||||||
bytes_written += static_cast<size_t> (bytes_written_now);
|
bytes_written += static_cast<size_t> (bytes_written_now);
|
||||||
|
|||||||
@ -20,6 +20,16 @@ using serial::SerialException;
|
|||||||
using serial::PortNotOpenedException;
|
using serial::PortNotOpenedException;
|
||||||
using serial::IOException;
|
using serial::IOException;
|
||||||
|
|
||||||
|
inline wstring
|
||||||
|
_prefix_port_if_needed(const wstring &input)
|
||||||
|
{
|
||||||
|
static wstring windows_com_port_prefix = L"\\\\.\\";
|
||||||
|
if (input.compare(0, windows_com_port_prefix.size(), windows_com_port_prefix) != 0)
|
||||||
|
{
|
||||||
|
return windows_com_port_prefix + input;
|
||||||
|
}
|
||||||
|
return input;
|
||||||
|
}
|
||||||
|
|
||||||
Serial::SerialImpl::SerialImpl (const string &port, unsigned long baudrate,
|
Serial::SerialImpl::SerialImpl (const string &port, unsigned long baudrate,
|
||||||
bytesize_t bytesize,
|
bytesize_t bytesize,
|
||||||
@ -29,10 +39,10 @@ Serial::SerialImpl::SerialImpl (const string &port, unsigned long baudrate,
|
|||||||
baudrate_ (baudrate), parity_ (parity),
|
baudrate_ (baudrate), parity_ (parity),
|
||||||
bytesize_ (bytesize), stopbits_ (stopbits), flowcontrol_ (flowcontrol)
|
bytesize_ (bytesize), stopbits_ (stopbits), flowcontrol_ (flowcontrol)
|
||||||
{
|
{
|
||||||
read_mutex = CreateMutex(NULL, false, NULL);
|
|
||||||
write_mutex = CreateMutex(NULL, false, NULL);
|
|
||||||
if (port_.empty () == false)
|
if (port_.empty () == false)
|
||||||
open ();
|
open ();
|
||||||
|
read_mutex = CreateMutex(NULL, false, NULL);
|
||||||
|
write_mutex = CreateMutex(NULL, false, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
Serial::SerialImpl::~SerialImpl ()
|
Serial::SerialImpl::~SerialImpl ()
|
||||||
@ -52,7 +62,9 @@ Serial::SerialImpl::open ()
|
|||||||
throw SerialException ("Serial port already open.");
|
throw SerialException ("Serial port already open.");
|
||||||
}
|
}
|
||||||
|
|
||||||
LPCWSTR lp_port = port_.c_str();
|
// See: https://github.com/wjwwood/serial/issues/84
|
||||||
|
wstring port_with_prefix = _prefix_port_if_needed(port_);
|
||||||
|
LPCWSTR lp_port = port_with_prefix.c_str();
|
||||||
fd_ = CreateFileW(lp_port,
|
fd_ = CreateFileW(lp_port,
|
||||||
GENERIC_READ | GENERIC_WRITE,
|
GENERIC_READ | GENERIC_WRITE,
|
||||||
0,
|
0,
|
||||||
@ -62,15 +74,15 @@ Serial::SerialImpl::open ()
|
|||||||
0);
|
0);
|
||||||
|
|
||||||
if (fd_ == INVALID_HANDLE_VALUE) {
|
if (fd_ == INVALID_HANDLE_VALUE) {
|
||||||
DWORD errno_ = GetLastError();
|
DWORD create_file_err = GetLastError();
|
||||||
stringstream ss;
|
stringstream ss;
|
||||||
switch (errno_) {
|
switch (create_file_err) {
|
||||||
case ERROR_FILE_NOT_FOUND:
|
case ERROR_FILE_NOT_FOUND:
|
||||||
// Use this->getPort to convert to a std::string
|
// Use this->getPort to convert to a std::string
|
||||||
ss << "Specified port, " << this->getPort() << ", does not exist.";
|
ss << "Specified port, " << this->getPort() << ", does not exist.";
|
||||||
THROW (IOException, ss.str().c_str());
|
THROW (IOException, ss.str().c_str());
|
||||||
default:
|
default:
|
||||||
ss << "Unknown error opening the serial port: " << errno;
|
ss << "Unknown error opening the serial port: " << create_file_err;
|
||||||
THROW (IOException, ss.str().c_str());
|
THROW (IOException, ss.str().c_str());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -216,6 +228,10 @@ Serial::SerialImpl::reconfigurePort ()
|
|||||||
dcbSerialParams.Parity = EVENPARITY;
|
dcbSerialParams.Parity = EVENPARITY;
|
||||||
} else if (parity_ == parity_odd) {
|
} else if (parity_ == parity_odd) {
|
||||||
dcbSerialParams.Parity = ODDPARITY;
|
dcbSerialParams.Parity = ODDPARITY;
|
||||||
|
} else if (parity_ == parity_mark) {
|
||||||
|
dcbSerialParams.Parity = MARKPARITY;
|
||||||
|
} else if (parity_ == parity_space) {
|
||||||
|
dcbSerialParams.Parity = SPACEPARITY;
|
||||||
} else {
|
} else {
|
||||||
throw invalid_argument ("invalid parity");
|
throw invalid_argument ("invalid parity");
|
||||||
}
|
}
|
||||||
@ -223,25 +239,26 @@ Serial::SerialImpl::reconfigurePort ()
|
|||||||
// setup flowcontrol
|
// setup flowcontrol
|
||||||
if (flowcontrol_ == flowcontrol_none) {
|
if (flowcontrol_ == flowcontrol_none) {
|
||||||
dcbSerialParams.fOutxCtsFlow = false;
|
dcbSerialParams.fOutxCtsFlow = false;
|
||||||
dcbSerialParams.fRtsControl = 0x00;
|
dcbSerialParams.fRtsControl = RTS_CONTROL_DISABLE;
|
||||||
dcbSerialParams.fOutX = false;
|
dcbSerialParams.fOutX = false;
|
||||||
dcbSerialParams.fInX = false;
|
dcbSerialParams.fInX = false;
|
||||||
}
|
}
|
||||||
if (flowcontrol_ == flowcontrol_software) {
|
if (flowcontrol_ == flowcontrol_software) {
|
||||||
dcbSerialParams.fOutxCtsFlow = false;
|
dcbSerialParams.fOutxCtsFlow = false;
|
||||||
dcbSerialParams.fRtsControl = 0x00;
|
dcbSerialParams.fRtsControl = RTS_CONTROL_DISABLE;
|
||||||
dcbSerialParams.fOutX = true;
|
dcbSerialParams.fOutX = true;
|
||||||
dcbSerialParams.fInX = true;
|
dcbSerialParams.fInX = true;
|
||||||
}
|
}
|
||||||
if (flowcontrol_ == flowcontrol_hardware) {
|
if (flowcontrol_ == flowcontrol_hardware) {
|
||||||
dcbSerialParams.fOutxCtsFlow = true;
|
dcbSerialParams.fOutxCtsFlow = true;
|
||||||
dcbSerialParams.fRtsControl = 0x03;
|
dcbSerialParams.fRtsControl = RTS_CONTROL_HANDSHAKE;
|
||||||
dcbSerialParams.fOutX = false;
|
dcbSerialParams.fOutX = false;
|
||||||
dcbSerialParams.fInX = false;
|
dcbSerialParams.fInX = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// activate settings
|
// activate settings
|
||||||
if (!SetCommState(fd_, &dcbSerialParams)){
|
if (!SetCommState(fd_, &dcbSerialParams)){
|
||||||
|
CloseHandle(fd_);
|
||||||
THROW (IOException, "Error setting serial port settings.");
|
THROW (IOException, "Error setting serial port settings.");
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -298,14 +315,14 @@ Serial::SerialImpl::available ()
|
|||||||
}
|
}
|
||||||
|
|
||||||
bool
|
bool
|
||||||
Serial::SerialImpl::waitReadable (uint32_t timeout)
|
Serial::SerialImpl::waitReadable (uint32_t /*timeout*/)
|
||||||
{
|
{
|
||||||
THROW (IOException, "waitReadable is not implemented on Windows.");
|
THROW (IOException, "waitReadable is not implemented on Windows.");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
Serial::SerialImpl::waitByteTimes (size_t count)
|
Serial::SerialImpl::waitByteTimes (size_t /*count*/)
|
||||||
{
|
{
|
||||||
THROW (IOException, "waitByteTimes is not implemented on Windows.");
|
THROW (IOException, "waitByteTimes is not implemented on Windows.");
|
||||||
}
|
}
|
||||||
@ -317,7 +334,7 @@ Serial::SerialImpl::read (uint8_t *buf, size_t size)
|
|||||||
throw PortNotOpenedException ("Serial::read");
|
throw PortNotOpenedException ("Serial::read");
|
||||||
}
|
}
|
||||||
DWORD bytes_read;
|
DWORD bytes_read;
|
||||||
if (!ReadFile(fd_, buf, size, &bytes_read, NULL)) {
|
if (!ReadFile(fd_, buf, static_cast<DWORD>(size), &bytes_read, NULL)) {
|
||||||
stringstream ss;
|
stringstream ss;
|
||||||
ss << "Error while reading from the serial port: " << GetLastError();
|
ss << "Error while reading from the serial port: " << GetLastError();
|
||||||
THROW (IOException, ss.str().c_str());
|
THROW (IOException, ss.str().c_str());
|
||||||
@ -332,7 +349,7 @@ Serial::SerialImpl::write (const uint8_t *data, size_t length)
|
|||||||
throw PortNotOpenedException ("Serial::write");
|
throw PortNotOpenedException ("Serial::write");
|
||||||
}
|
}
|
||||||
DWORD bytes_written;
|
DWORD bytes_written;
|
||||||
if (!WriteFile(fd_, data, length, &bytes_written, NULL)) {
|
if (!WriteFile(fd_, data, static_cast<DWORD>(length), &bytes_written, NULL)) {
|
||||||
stringstream ss;
|
stringstream ss;
|
||||||
ss << "Error while writing to the serial port: " << GetLastError();
|
ss << "Error while writing to the serial port: " << GetLastError();
|
||||||
THROW (IOException, ss.str().c_str());
|
THROW (IOException, ss.str().c_str());
|
||||||
@ -454,17 +471,23 @@ Serial::SerialImpl::flush ()
|
|||||||
void
|
void
|
||||||
Serial::SerialImpl::flushInput ()
|
Serial::SerialImpl::flushInput ()
|
||||||
{
|
{
|
||||||
THROW (IOException, "flushInput is not supported on Windows.");
|
if (is_open_ == false) {
|
||||||
|
throw PortNotOpenedException("Serial::flushInput");
|
||||||
|
}
|
||||||
|
PurgeComm(fd_, PURGE_RXCLEAR);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
Serial::SerialImpl::flushOutput ()
|
Serial::SerialImpl::flushOutput ()
|
||||||
{
|
{
|
||||||
THROW (IOException, "flushOutput is not supported on Windows.");
|
if (is_open_ == false) {
|
||||||
|
throw PortNotOpenedException("Serial::flushOutput");
|
||||||
|
}
|
||||||
|
PurgeComm(fd_, PURGE_TXCLEAR);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
Serial::SerialImpl::sendBreak (int duration)
|
Serial::SerialImpl::sendBreak (int /*duration*/)
|
||||||
{
|
{
|
||||||
THROW (IOException, "sendBreak is not supported on Windows.");
|
THROW (IOException, "sendBreak is not supported on Windows.");
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,7 +1,7 @@
|
|||||||
/* Copyright 2012 William Woodall and John Harrison */
|
/* Copyright 2012 William Woodall and John Harrison */
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
|
|
||||||
#if !defined(_WIN32) && !defined(__OpenBSD__)
|
#if !defined(_WIN32) && !defined(__OpenBSD__) && !defined(__FreeBSD__)
|
||||||
# include <alloca.h>
|
# include <alloca.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -132,7 +132,16 @@ Serial::read (std::vector<uint8_t> &buffer, size_t size)
|
|||||||
{
|
{
|
||||||
ScopedReadLock lock(this->pimpl_);
|
ScopedReadLock lock(this->pimpl_);
|
||||||
uint8_t *buffer_ = new uint8_t[size];
|
uint8_t *buffer_ = new uint8_t[size];
|
||||||
size_t bytes_read = this->pimpl_->read (buffer_, size);
|
size_t bytes_read = 0;
|
||||||
|
|
||||||
|
try {
|
||||||
|
bytes_read = this->pimpl_->read (buffer_, size);
|
||||||
|
}
|
||||||
|
catch (const std::exception &e) {
|
||||||
|
delete[] buffer_;
|
||||||
|
throw;
|
||||||
|
}
|
||||||
|
|
||||||
buffer.insert (buffer.end (), buffer_, buffer_+bytes_read);
|
buffer.insert (buffer.end (), buffer_, buffer_+bytes_read);
|
||||||
delete[] buffer_;
|
delete[] buffer_;
|
||||||
return bytes_read;
|
return bytes_read;
|
||||||
@ -143,7 +152,14 @@ Serial::read (std::string &buffer, size_t size)
|
|||||||
{
|
{
|
||||||
ScopedReadLock lock(this->pimpl_);
|
ScopedReadLock lock(this->pimpl_);
|
||||||
uint8_t *buffer_ = new uint8_t[size];
|
uint8_t *buffer_ = new uint8_t[size];
|
||||||
size_t bytes_read = this->pimpl_->read (buffer_, size);
|
size_t bytes_read = 0;
|
||||||
|
try {
|
||||||
|
bytes_read = this->pimpl_->read (buffer_, size);
|
||||||
|
}
|
||||||
|
catch (const std::exception &e) {
|
||||||
|
delete[] buffer_;
|
||||||
|
throw;
|
||||||
|
}
|
||||||
buffer.append (reinterpret_cast<const char*>(buffer_), bytes_read);
|
buffer.append (reinterpret_cast<const char*>(buffer_), bytes_read);
|
||||||
delete[] buffer_;
|
delete[] buffer_;
|
||||||
return bytes_read;
|
return bytes_read;
|
||||||
@ -172,6 +188,7 @@ Serial::readline (string &buffer, size_t size, string eol)
|
|||||||
if (bytes_read == 0) {
|
if (bytes_read == 0) {
|
||||||
break; // Timeout occured on reading 1 byte
|
break; // Timeout occured on reading 1 byte
|
||||||
}
|
}
|
||||||
|
if(read_so_far < eol_len) continue;
|
||||||
if (string (reinterpret_cast<const char*>
|
if (string (reinterpret_cast<const char*>
|
||||||
(buffer_ + read_so_far - eol_len), eol_len) == eol) {
|
(buffer_ + read_so_far - eol_len), eol_len) == eol) {
|
||||||
break; // EOL found
|
break; // EOL found
|
||||||
@ -213,6 +230,7 @@ Serial::readlines (size_t size, string eol)
|
|||||||
}
|
}
|
||||||
break; // Timeout occured on reading 1 byte
|
break; // Timeout occured on reading 1 byte
|
||||||
}
|
}
|
||||||
|
if(read_so_far < eol_len) continue;
|
||||||
if (string (reinterpret_cast<const char*>
|
if (string (reinterpret_cast<const char*>
|
||||||
(buffer_ + read_so_far - eol_len), eol_len) == eol) {
|
(buffer_ + read_so_far - eol_len), eol_len) == eol) {
|
||||||
// EOL found
|
// EOL found
|
||||||
|
|||||||
@ -1,10 +1,12 @@
|
|||||||
if(UNIX)
|
if(UNIX)
|
||||||
catkin_add_gtest(${PROJECT_NAME}-test unix_serial_tests.cc)
|
catkin_add_gtest(${PROJECT_NAME}-test unix_serial_tests.cc)
|
||||||
target_link_libraries(${PROJECT_NAME}-test ${PROJECT_NAME} ${Boost_LIBRARIES})
|
target_link_libraries(${PROJECT_NAME}-test ${PROJECT_NAME})
|
||||||
if(NOT APPLE)
|
if(NOT APPLE)
|
||||||
target_link_libraries(${PROJECT_NAME}-test util)
|
target_link_libraries(${PROJECT_NAME}-test util)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
if(NOT APPLE) # these tests are unreliable on macOS
|
||||||
catkin_add_gtest(${PROJECT_NAME}-test-timer unit/unix_timer_tests.cc)
|
catkin_add_gtest(${PROJECT_NAME}-test-timer unit/unix_timer_tests.cc)
|
||||||
target_link_libraries(${PROJECT_NAME}-test-timer ${PROJECT_NAME})
|
target_link_libraries(${PROJECT_NAME}-test-timer ${PROJECT_NAME})
|
||||||
endif()
|
endif()
|
||||||
|
endif()
|
||||||
|
|||||||
@ -20,8 +20,6 @@ void loop()
|
|||||||
#include <string>
|
#include <string>
|
||||||
#include "gtest/gtest.h"
|
#include "gtest/gtest.h"
|
||||||
|
|
||||||
#include <boost/bind.hpp>
|
|
||||||
|
|
||||||
// Use FRIEND_TEST... its not as nasty, thats what friends are for
|
// Use FRIEND_TEST... its not as nasty, thats what friends are for
|
||||||
// // OMG this is so nasty...
|
// // OMG this is so nasty...
|
||||||
// #define private public
|
// #define private public
|
||||||
|
|||||||
@ -5,23 +5,47 @@
|
|||||||
<Configuration>Debug</Configuration>
|
<Configuration>Debug</Configuration>
|
||||||
<Platform>Win32</Platform>
|
<Platform>Win32</Platform>
|
||||||
</ProjectConfiguration>
|
</ProjectConfiguration>
|
||||||
|
<ProjectConfiguration Include="Debug|x64">
|
||||||
|
<Configuration>Debug</Configuration>
|
||||||
|
<Platform>x64</Platform>
|
||||||
|
</ProjectConfiguration>
|
||||||
<ProjectConfiguration Include="Release|Win32">
|
<ProjectConfiguration Include="Release|Win32">
|
||||||
<Configuration>Release</Configuration>
|
<Configuration>Release</Configuration>
|
||||||
<Platform>Win32</Platform>
|
<Platform>Win32</Platform>
|
||||||
</ProjectConfiguration>
|
</ProjectConfiguration>
|
||||||
|
<ProjectConfiguration Include="Release|x64">
|
||||||
|
<Configuration>Release</Configuration>
|
||||||
|
<Platform>x64</Platform>
|
||||||
|
</ProjectConfiguration>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<PropertyGroup Label="Globals">
|
<PropertyGroup Label="Globals">
|
||||||
<ProjectGuid>{A8517FB2-C74E-43BD-B3C6-B05D3FC11ECD}</ProjectGuid>
|
<ProjectGuid>{A8517FB2-C74E-43BD-B3C6-B05D3FC11ECD}</ProjectGuid>
|
||||||
<RootNamespace>serial</RootNamespace>
|
<RootNamespace>serial</RootNamespace>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
<PropertyGroup>
|
||||||
|
<PlatformToolset Condition="'$(PlatformToolset)' == '' and '$(VisualStudioVersion)' == '14.0'">v140_xp</PlatformToolset>
|
||||||
|
<PlatformToolset Condition="'$(PlatformToolset)' == '' and '$(VisualStudioVersion)' == '12.0'">v120_xp</PlatformToolset>
|
||||||
|
<PlatformToolset Condition="'$(PlatformToolset)' == '' and '$(VisualStudioVersion)' == '11.0'">v110_xp</PlatformToolset>
|
||||||
|
</PropertyGroup>
|
||||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
|
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
|
||||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
|
||||||
<ConfigurationType>StaticLibrary</ConfigurationType>
|
<ConfigurationType>StaticLibrary</ConfigurationType>
|
||||||
<UseDebugLibraries>true</UseDebugLibraries>
|
<UseDebugLibraries>true</UseDebugLibraries>
|
||||||
<CharacterSet>MultiByte</CharacterSet>
|
<CharacterSet>MultiByte</CharacterSet>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
|
||||||
|
<ConfigurationType>StaticLibrary</ConfigurationType>
|
||||||
|
<UseDebugLibraries>true</UseDebugLibraries>
|
||||||
|
<CharacterSet>MultiByte</CharacterSet>
|
||||||
|
</PropertyGroup>
|
||||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
|
||||||
<ConfigurationType>Application</ConfigurationType>
|
<ConfigurationType>StaticLibrary</ConfigurationType>
|
||||||
|
<UseDebugLibraries>false</UseDebugLibraries>
|
||||||
|
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||||
|
<CharacterSet>MultiByte</CharacterSet>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
|
||||||
|
<ConfigurationType>StaticLibrary</ConfigurationType>
|
||||||
<UseDebugLibraries>false</UseDebugLibraries>
|
<UseDebugLibraries>false</UseDebugLibraries>
|
||||||
<WholeProgramOptimization>true</WholeProgramOptimization>
|
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||||
<CharacterSet>MultiByte</CharacterSet>
|
<CharacterSet>MultiByte</CharacterSet>
|
||||||
@ -32,22 +56,43 @@
|
|||||||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||||
</ImportGroup>
|
</ImportGroup>
|
||||||
|
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="PropertySheets">
|
||||||
|
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||||
|
</ImportGroup>
|
||||||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||||
</ImportGroup>
|
</ImportGroup>
|
||||||
|
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="PropertySheets">
|
||||||
|
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||||
|
</ImportGroup>
|
||||||
<PropertyGroup Label="UserMacros" />
|
<PropertyGroup Label="UserMacros" />
|
||||||
<PropertyGroup />
|
<PropertyGroup />
|
||||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||||
<ClCompile>
|
<ClCompile>
|
||||||
<WarningLevel>Level3</WarningLevel>
|
<WarningLevel>Level3</WarningLevel>
|
||||||
<Optimization>Disabled</Optimization>
|
<Optimization>Disabled</Optimization>
|
||||||
<AdditionalIncludeDirectories>..\..\..\serial\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
<AdditionalIncludeDirectories>$(ProjectDir)..\..\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
<Link>
|
<Link>
|
||||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||||
</Link>
|
</Link>
|
||||||
<Lib>
|
<Lib>
|
||||||
<AdditionalDependencies>setupapi.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
<AdditionalDependencies>setupapi.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||||
|
<SubSystem>Windows</SubSystem>
|
||||||
|
</Lib>
|
||||||
|
</ItemDefinitionGroup>
|
||||||
|
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||||
|
<ClCompile>
|
||||||
|
<WarningLevel>Level3</WarningLevel>
|
||||||
|
<Optimization>Disabled</Optimization>
|
||||||
|
<AdditionalIncludeDirectories>$(ProjectDir)..\..\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||||
|
</ClCompile>
|
||||||
|
<Link>
|
||||||
|
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||||
|
</Link>
|
||||||
|
<Lib>
|
||||||
|
<AdditionalDependencies>setupapi.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||||
|
<SubSystem>Windows</SubSystem>
|
||||||
</Lib>
|
</Lib>
|
||||||
</ItemDefinitionGroup>
|
</ItemDefinitionGroup>
|
||||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||||
@ -56,12 +101,35 @@
|
|||||||
<Optimization>MaxSpeed</Optimization>
|
<Optimization>MaxSpeed</Optimization>
|
||||||
<FunctionLevelLinking>true</FunctionLevelLinking>
|
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||||
<IntrinsicFunctions>true</IntrinsicFunctions>
|
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||||
|
<AdditionalIncludeDirectories>$(ProjectDir)..\..\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
<Link>
|
<Link>
|
||||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||||
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||||
<OptimizeReferences>true</OptimizeReferences>
|
<OptimizeReferences>true</OptimizeReferences>
|
||||||
</Link>
|
</Link>
|
||||||
|
<Lib>
|
||||||
|
<AdditionalDependencies>setupapi.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||||
|
<SubSystem>Windows</SubSystem>
|
||||||
|
</Lib>
|
||||||
|
</ItemDefinitionGroup>
|
||||||
|
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||||
|
<ClCompile>
|
||||||
|
<WarningLevel>Level3</WarningLevel>
|
||||||
|
<Optimization>MaxSpeed</Optimization>
|
||||||
|
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||||
|
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||||
|
<AdditionalIncludeDirectories>$(ProjectDir)..\..\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||||
|
</ClCompile>
|
||||||
|
<Link>
|
||||||
|
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||||
|
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||||
|
<OptimizeReferences>true</OptimizeReferences>
|
||||||
|
</Link>
|
||||||
|
<Lib>
|
||||||
|
<AdditionalDependencies>setupapi.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||||
|
<SubSystem>Windows</SubSystem>
|
||||||
|
</Lib>
|
||||||
</ItemDefinitionGroup>
|
</ItemDefinitionGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ClCompile Include="..\..\src\impl\list_ports\list_ports_win.cc" />
|
<ClCompile Include="..\..\src\impl\list_ports\list_ports_win.cc" />
|
||||||
|
|||||||
@ -1,3 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
|
||||||
</Project>
|
|
||||||
@ -5,46 +5,88 @@
|
|||||||
<Configuration>Debug</Configuration>
|
<Configuration>Debug</Configuration>
|
||||||
<Platform>Win32</Platform>
|
<Platform>Win32</Platform>
|
||||||
</ProjectConfiguration>
|
</ProjectConfiguration>
|
||||||
|
<ProjectConfiguration Include="Debug|x64">
|
||||||
|
<Configuration>Debug</Configuration>
|
||||||
|
<Platform>x64</Platform>
|
||||||
|
</ProjectConfiguration>
|
||||||
<ProjectConfiguration Include="Release|Win32">
|
<ProjectConfiguration Include="Release|Win32">
|
||||||
<Configuration>Release</Configuration>
|
<Configuration>Release</Configuration>
|
||||||
<Platform>Win32</Platform>
|
<Platform>Win32</Platform>
|
||||||
</ProjectConfiguration>
|
</ProjectConfiguration>
|
||||||
|
<ProjectConfiguration Include="Release|x64">
|
||||||
|
<Configuration>Release</Configuration>
|
||||||
|
<Platform>x64</Platform>
|
||||||
|
</ProjectConfiguration>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<PropertyGroup Label="Globals">
|
<PropertyGroup Label="Globals">
|
||||||
<ProjectGuid>{92EE7E58-C737-41F9-B795-9B6ACF6AB0B8}</ProjectGuid>
|
<ProjectGuid>{92EE7E58-C737-41F9-B795-9B6ACF6AB0B8}</ProjectGuid>
|
||||||
<RootNamespace>test_serial</RootNamespace>
|
<RootNamespace>test_serial</RootNamespace>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
<PropertyGroup>
|
||||||
|
<PlatformToolset Condition="'$(PlatformToolset)' == '' and '$(VisualStudioVersion)' == '14.0'">v140_xp</PlatformToolset>
|
||||||
|
<PlatformToolset Condition="'$(PlatformToolset)' == '' and '$(VisualStudioVersion)' == '12.0'">v120_xp</PlatformToolset>
|
||||||
|
<PlatformToolset Condition="'$(PlatformToolset)' == '' and '$(VisualStudioVersion)' == '11.0'">v110_xp</PlatformToolset>
|
||||||
|
</PropertyGroup>
|
||||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
|
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
|
||||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
|
||||||
<ConfigurationType>Application</ConfigurationType>
|
<ConfigurationType>Application</ConfigurationType>
|
||||||
<UseDebugLibraries>true</UseDebugLibraries>
|
<UseDebugLibraries>true</UseDebugLibraries>
|
||||||
<CharacterSet>MultiByte</CharacterSet>
|
<CharacterSet>MultiByte</CharacterSet>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
|
||||||
|
<ConfigurationType>Application</ConfigurationType>
|
||||||
|
<UseDebugLibraries>true</UseDebugLibraries>
|
||||||
|
<CharacterSet>MultiByte</CharacterSet>
|
||||||
|
</PropertyGroup>
|
||||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
|
||||||
<ConfigurationType>Application</ConfigurationType>
|
<ConfigurationType>Application</ConfigurationType>
|
||||||
<UseDebugLibraries>false</UseDebugLibraries>
|
<UseDebugLibraries>false</UseDebugLibraries>
|
||||||
<WholeProgramOptimization>true</WholeProgramOptimization>
|
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||||
<CharacterSet>MultiByte</CharacterSet>
|
<CharacterSet>MultiByte</CharacterSet>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
|
||||||
|
<ConfigurationType>Application</ConfigurationType>
|
||||||
|
<UseDebugLibraries>false</UseDebugLibraries>
|
||||||
|
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||||
|
<CharacterSet>MultiByte</CharacterSet>
|
||||||
|
</PropertyGroup>
|
||||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
|
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
|
||||||
<ImportGroup Label="ExtensionSettings">
|
<ImportGroup Label="ExtensionSettings">
|
||||||
</ImportGroup>
|
</ImportGroup>
|
||||||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||||
</ImportGroup>
|
</ImportGroup>
|
||||||
|
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="PropertySheets">
|
||||||
|
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||||
|
</ImportGroup>
|
||||||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||||
</ImportGroup>
|
</ImportGroup>
|
||||||
|
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="PropertySheets">
|
||||||
|
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||||
|
</ImportGroup>
|
||||||
<PropertyGroup Label="UserMacros" />
|
<PropertyGroup Label="UserMacros" />
|
||||||
<PropertyGroup />
|
<PropertyGroup />
|
||||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||||
<ClCompile>
|
<ClCompile>
|
||||||
<WarningLevel>Level3</WarningLevel>
|
<WarningLevel>Level3</WarningLevel>
|
||||||
<Optimization>Disabled</Optimization>
|
<Optimization>Disabled</Optimization>
|
||||||
<AdditionalIncludeDirectories>..\..\..\serial\include</AdditionalIncludeDirectories>
|
<AdditionalIncludeDirectories>$(ProjectDir)..\..\include</AdditionalIncludeDirectories>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
<Link>
|
<Link>
|
||||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||||
|
<SubSystem>Console</SubSystem>
|
||||||
|
</Link>
|
||||||
|
</ItemDefinitionGroup>
|
||||||
|
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||||
|
<ClCompile>
|
||||||
|
<WarningLevel>Level3</WarningLevel>
|
||||||
|
<Optimization>Disabled</Optimization>
|
||||||
|
<AdditionalIncludeDirectories>$(ProjectDir)..\..\include</AdditionalIncludeDirectories>
|
||||||
|
</ClCompile>
|
||||||
|
<Link>
|
||||||
|
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||||
|
<SubSystem>Console</SubSystem>
|
||||||
</Link>
|
</Link>
|
||||||
</ItemDefinitionGroup>
|
</ItemDefinitionGroup>
|
||||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||||
@ -53,11 +95,28 @@
|
|||||||
<Optimization>MaxSpeed</Optimization>
|
<Optimization>MaxSpeed</Optimization>
|
||||||
<FunctionLevelLinking>true</FunctionLevelLinking>
|
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||||
<IntrinsicFunctions>true</IntrinsicFunctions>
|
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||||
|
<AdditionalIncludeDirectories>$(ProjectDir)..\..\include</AdditionalIncludeDirectories>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
<Link>
|
<Link>
|
||||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||||
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||||
<OptimizeReferences>true</OptimizeReferences>
|
<OptimizeReferences>true</OptimizeReferences>
|
||||||
|
<SubSystem>Console</SubSystem>
|
||||||
|
</Link>
|
||||||
|
</ItemDefinitionGroup>
|
||||||
|
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||||
|
<ClCompile>
|
||||||
|
<WarningLevel>Level3</WarningLevel>
|
||||||
|
<Optimization>MaxSpeed</Optimization>
|
||||||
|
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||||
|
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||||
|
<AdditionalIncludeDirectories>$(ProjectDir)..\..\include</AdditionalIncludeDirectories>
|
||||||
|
</ClCompile>
|
||||||
|
<Link>
|
||||||
|
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||||
|
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||||
|
<OptimizeReferences>true</OptimizeReferences>
|
||||||
|
<SubSystem>Console</SubSystem>
|
||||||
</Link>
|
</Link>
|
||||||
</ItemDefinitionGroup>
|
</ItemDefinitionGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
|||||||
@ -8,17 +8,27 @@ EndProject
|
|||||||
Global
|
Global
|
||||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||||
Debug|Win32 = Debug|Win32
|
Debug|Win32 = Debug|Win32
|
||||||
|
Debug|x64 = Debug|x64
|
||||||
Release|Win32 = Release|Win32
|
Release|Win32 = Release|Win32
|
||||||
|
Release|x64 = Release|x64
|
||||||
EndGlobalSection
|
EndGlobalSection
|
||||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||||
{A8517FB2-C74E-43BD-B3C6-B05D3FC11ECD}.Debug|Win32.ActiveCfg = Debug|Win32
|
{A8517FB2-C74E-43BD-B3C6-B05D3FC11ECD}.Debug|Win32.ActiveCfg = Debug|Win32
|
||||||
{A8517FB2-C74E-43BD-B3C6-B05D3FC11ECD}.Debug|Win32.Build.0 = Debug|Win32
|
{A8517FB2-C74E-43BD-B3C6-B05D3FC11ECD}.Debug|Win32.Build.0 = Debug|Win32
|
||||||
|
{A8517FB2-C74E-43BD-B3C6-B05D3FC11ECD}.Debug|x64.ActiveCfg = Debug|x64
|
||||||
|
{A8517FB2-C74E-43BD-B3C6-B05D3FC11ECD}.Debug|x64.Build.0 = Debug|x64
|
||||||
{A8517FB2-C74E-43BD-B3C6-B05D3FC11ECD}.Release|Win32.ActiveCfg = Release|Win32
|
{A8517FB2-C74E-43BD-B3C6-B05D3FC11ECD}.Release|Win32.ActiveCfg = Release|Win32
|
||||||
{A8517FB2-C74E-43BD-B3C6-B05D3FC11ECD}.Release|Win32.Build.0 = Release|Win32
|
{A8517FB2-C74E-43BD-B3C6-B05D3FC11ECD}.Release|Win32.Build.0 = Release|Win32
|
||||||
|
{A8517FB2-C74E-43BD-B3C6-B05D3FC11ECD}.Release|x64.ActiveCfg = Release|x64
|
||||||
|
{A8517FB2-C74E-43BD-B3C6-B05D3FC11ECD}.Release|x64.Build.0 = Release|x64
|
||||||
{92EE7E58-C737-41F9-B795-9B6ACF6AB0B8}.Debug|Win32.ActiveCfg = Debug|Win32
|
{92EE7E58-C737-41F9-B795-9B6ACF6AB0B8}.Debug|Win32.ActiveCfg = Debug|Win32
|
||||||
{92EE7E58-C737-41F9-B795-9B6ACF6AB0B8}.Debug|Win32.Build.0 = Debug|Win32
|
{92EE7E58-C737-41F9-B795-9B6ACF6AB0B8}.Debug|Win32.Build.0 = Debug|Win32
|
||||||
|
{92EE7E58-C737-41F9-B795-9B6ACF6AB0B8}.Debug|x64.ActiveCfg = Debug|x64
|
||||||
|
{92EE7E58-C737-41F9-B795-9B6ACF6AB0B8}.Debug|x64.Build.0 = Debug|x64
|
||||||
{92EE7E58-C737-41F9-B795-9B6ACF6AB0B8}.Release|Win32.ActiveCfg = Release|Win32
|
{92EE7E58-C737-41F9-B795-9B6ACF6AB0B8}.Release|Win32.ActiveCfg = Release|Win32
|
||||||
{92EE7E58-C737-41F9-B795-9B6ACF6AB0B8}.Release|Win32.Build.0 = Release|Win32
|
{92EE7E58-C737-41F9-B795-9B6ACF6AB0B8}.Release|Win32.Build.0 = Release|Win32
|
||||||
|
{92EE7E58-C737-41F9-B795-9B6ACF6AB0B8}.Release|x64.ActiveCfg = Release|x64
|
||||||
|
{92EE7E58-C737-41F9-B795-9B6ACF6AB0B8}.Release|x64.Build.0 = Release|x64
|
||||||
EndGlobalSection
|
EndGlobalSection
|
||||||
GlobalSection(SolutionProperties) = preSolution
|
GlobalSection(SolutionProperties) = preSolution
|
||||||
HideSolutionNode = FALSE
|
HideSolutionNode = FALSE
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user