Skip to content

Commit 739be43

Browse files
authored
Rename library from serial to serial_cpp (#2)
1 parent a3d2ae6 commit 739be43

18 files changed

Lines changed: 236 additions & 184 deletions

CMakeLists.txt

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,33 +1,33 @@
11
cmake_minimum_required(VERSION 2.8.3...3.10)
2-
project(serial)
2+
project(serial_cpp)
33

44
if(APPLE)
55
find_library(IOKIT_LIBRARY IOKit)
66
find_library(FOUNDATION_LIBRARY Foundation)
77
endif()
88

99
## Sources
10-
set(serial_SRCS
10+
set(serial_cpp_SRCS
1111
src/serial.cc
12-
include/serial/serial.h
13-
include/serial/v8stdint.h
12+
include/serial_cpp/serial.h
13+
include/serial_cpp/v8stdint.h
1414
)
1515
if(APPLE)
1616
# If OSX
17-
list(APPEND serial_SRCS src/impl/unix.cc)
18-
list(APPEND serial_SRCS src/impl/list_ports/list_ports_osx.cc)
17+
list(APPEND serial_cpp_SRCS src/impl/unix.cc)
18+
list(APPEND serial_cpp_SRCS src/impl/list_ports/list_ports_osx.cc)
1919
elseif(UNIX)
2020
# If unix
21-
list(APPEND serial_SRCS src/impl/unix.cc)
22-
list(APPEND serial_SRCS src/impl/list_ports/list_ports_linux.cc)
21+
list(APPEND serial_cpp_SRCS src/impl/unix.cc)
22+
list(APPEND serial_cpp_SRCS src/impl/list_ports/list_ports_linux.cc)
2323
else()
2424
# If windows
25-
list(APPEND serial_SRCS src/impl/win.cc)
26-
list(APPEND serial_SRCS src/impl/list_ports/list_ports_win.cc)
25+
list(APPEND serial_cpp_SRCS src/impl/win.cc)
26+
list(APPEND serial_cpp_SRCS src/impl/list_ports/list_ports_win.cc)
2727
endif()
2828

2929
## Add serial library
30-
add_library(${PROJECT_NAME} ${serial_SRCS})
30+
add_library(${PROJECT_NAME} ${serial_cpp_SRCS})
3131
if(APPLE)
3232
target_link_libraries(${PROJECT_NAME} ${FOUNDATION_LIBRARY} ${IOKIT_LIBRARY})
3333
elseif(UNIX)
@@ -37,9 +37,9 @@ else()
3737
endif()
3838

3939
## Uncomment for example
40-
add_executable(serial_example examples/serial_example.cc)
41-
add_dependencies(serial_example ${PROJECT_NAME})
42-
target_link_libraries(serial_example ${PROJECT_NAME})
40+
add_executable(serial_cpp_example examples/serial_cpp_example.cc)
41+
add_dependencies(serial_cpp_example ${PROJECT_NAME})
42+
target_link_libraries(serial_cpp_example ${PROJECT_NAME})
4343

4444
## Include headers
4545
include_directories(include)
@@ -52,17 +52,17 @@ install(TARGETS ${PROJECT_NAME}
5252
)
5353

5454
## Install headers
55-
install(FILES include/serial/serial.h include/serial/v8stdint.h
55+
install(FILES include/serial_cpp/serial.h include/serial/v8stdint.h
5656
DESTINATION include/serial)
5757

5858
## Install CMake config
59-
install(FILES cmake/serialConfig.cmake
60-
DESTINATION share/serial/cmake)
59+
install(FILES cmake/serial_cppConfig.cmake
60+
DESTINATION share/serial_cpp/cmake)
6161

6262

6363
## Install package.xml
6464
install(FILES package.xml
65-
DESTINATION share/serial)
65+
DESTINATION share/serial_cpp)
6666

6767
## Tests
6868
include(CTest)

README.md

Lines changed: 26 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -1,63 +1,54 @@
1-
# Serial Communication Library
2-
3-
[![Build Status](https://travis-ci.org/wjwwood/serial.svg?branch=master)](https://travis-ci.org/wjwwood/serial)*(Linux and OS X)* [![Build Status](https://ci.appveyor.com/api/projects/status/github/wjwwood/serial)](https://ci.appveyor.com/project/wjwwood/serial)*(Windows)*
1+
# `serial_cpp` Serial Communication Library
42

53
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++.
64

7-
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-
9-
Serial is a class that provides the basic interface common to serial libraries (open, close, read, write, etc..) and requires no extra dependencies. It also provides tight control over timeouts and control over handshaking lines.
10-
11-
### Documentation
5+
Serial is a class that provides the basic interface common to serial libraries (open, close, read, write, etc..) and requires no extra dependencies. It also provides tight control over timeouts and control over handshaking lines.
126

13-
Website: http://wjwwood.github.io/serial/
7+
`serial_cpp` started as a friendly fork [`wjwwood/serial`](https://github.com/wjwwood/serial), see https://github.com/wjwwood/serial/issues/312 for more details.
148

15-
API Documentation: http://wjwwood.github.io/serial/doc/1.1.0/index.html
9+
> [!NOTE]
10+
> Most projects in the [`ami-iit`](https://github.com/ami-iit) use the dash (`-`) as a separator inside names. This repo makes an exception as it is a derivation of a project originally started in the ROS community, where the use of underscore (`_`) is tipically used, and so the original mantainer asked to keep an underscore, see https://github.com/wjwwood/serial/issues/312#issuecomment-2773775993 .
1611
1712
### Dependencies
1813

1914
Required:
20-
* [catkin](http://www.ros.org/wiki/catkin) - cmake and Python based buildsystem
15+
* C++ compiler
2116
* [cmake](http://www.cmake.org) - buildsystem
22-
* [Python](http://www.python.org) - scripting language
23-
* [empy](http://www.alcyone.com/pyos/empy/) - Python templating library
24-
* [catkin_pkg](http://pypi.python.org/pypi/catkin_pkg/) - Runtime Python library for catkin
2517

2618
Optional (for documentation):
2719
* [Doxygen](http://www.doxygen.org/) - Documentation generation tool
2820
* [graphviz](http://www.graphviz.org/) - Graph visualization software
2921

30-
### Install
31-
32-
Get the code:
33-
34-
git clone https://github.com/wjwwood/serial.git
22+
### Usage compiling from source
3523

36-
Build:
24+
First compile the project:
3725

38-
make
26+
~~~bash
27+
git clone https://github.com/ami-iit/serial_cpp.git
28+
cd serial_cpp
29+
cmake -DCMAKE_BUILD_TYPE=Release -Bbuild -S. -DCMAKE_INSTALL_PREFIX=<desired_install_dir>
30+
cmake --build build
31+
cmake --install build
32+
~~~
3933

40-
Build and run the tests:
34+
### Development commands
4135

42-
make test
36+
`serial_cpp` is a pure C++ project that can be installed on any system, as long as CMake is available. However, we use [`pixi`](https://pixi.sh) to simplify development, to run the tests (the same run in CI) in pixi, run:
4337

44-
Build the documentation:
45-
46-
make doc
47-
48-
Install:
49-
50-
make install
38+
~~~
39+
git clone https://github.com/ami-iit/serial_cpp.git
40+
pixi run test
41+
~~~
5142

5243
### License
5344

5445
[The MIT License](LICENSE)
5546

56-
### Authors
47+
### Mantainers
5748

58-
William Woodall <wjwwood@gmail.com>
59-
John Harrison <ash.gti@gmail.com>
49+
* Silvio Traversaro ([@traversaro](https://github.com/traversaro))
6050

61-
### Contact
51+
### Authors
6252

63-
William Woodall <william@osrfoundation.org>
53+
* William Woodall <wjwwood@gmail.com>
54+
* John Harrison <ash.gti@gmail.com>

doc/serial.dox

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,13 +12,13 @@ Want to use it with ROS(Robot Operating System)? No problem, it compiles as a un
1212

1313
Ready to jump in?
1414
- Checkout our examples: \ref serial_example.cc
15-
- Look at the main class documentation: \ref serial::Serial
15+
- Look at the main class documentation: \ref serial_cpp::Serial
1616

1717
\section features Features
1818
- Linux, Mac OS X, and Windows Support
1919
- Easy to use interface (modeled after PySerial)
2020
- Minimal dependencies (cmake)
21-
- Complete timeout control \ref serial::Serial::setTimeout
21+
- Complete timeout control \ref serial_cpp::Serial::setTimeout
2222
- Check and set handshaking lines (CTS, DSR, RI, CD and RTS, DTR)
2323
- Block for changes in handshaking lines (Linux and Windows)
2424
- Flush I/O separately and block until all writing done
@@ -32,7 +32,7 @@ Ready to jump in?
3232

3333
\subsection building Compiling
3434

35-
Once you have gathered the dependencies, you need to checkout the software from github.com:
35+
Once you have gathered the dependencies, you need to checkout the software from github.com:
3636

3737
<pre>
3838
git clone git://github.com/wjwwood/serial.git
Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
#include <unistd.h>
2828
#endif
2929

30-
#include "serial/serial.h"
30+
#include <serial_cpp/serial.h>
3131

3232
using std::string;
3333
using std::exception;
@@ -46,13 +46,13 @@ void my_sleep(unsigned long milliseconds) {
4646

4747
void enumerate_ports()
4848
{
49-
vector<serial::PortInfo> devices_found = serial::list_ports();
49+
vector<serial_cpp::PortInfo> devices_found = serial_cpp::list_ports();
5050

51-
vector<serial::PortInfo>::iterator iter = devices_found.begin();
51+
vector<serial_cpp::PortInfo>::iterator iter = devices_found.begin();
5252

5353
while( iter != devices_found.end() )
5454
{
55-
serial::PortInfo device = *iter++;
55+
serial_cpp::PortInfo device = *iter++;
5656

5757
printf( "(%s, %s, %s)\n", device.port.c_str(), device.description.c_str(),
5858
device.hardware_id.c_str() );
@@ -93,7 +93,7 @@ int run(int argc, char **argv)
9393
#endif
9494

9595
// port, baudrate, timeout in milliseconds
96-
serial::Serial my_serial(port, baud, serial::Timeout::simpleTimeout(1000));
96+
serial_cpp::Serial my_serial(port, baud, serial_cpp::Timeout::simpleTimeout(1000));
9797

9898
cout << "Is the serial port open?";
9999
if(my_serial.isOpen())
@@ -125,7 +125,7 @@ int run(int argc, char **argv)
125125
}
126126

127127
// Test the timeout at 250ms
128-
my_serial.setTimeout(serial::Timeout::max(), 250, 0, 250, 0);
128+
my_serial.setTimeout(serial_cpp::Timeout::max(), 250, 0, 250, 0);
129129
count = 0;
130130
cout << "Timeout == 250ms, asking for 1 more byte than written." << endl;
131131
while (count < 10) {
Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -40,30 +40,30 @@
4040
#ifndef SERIAL_IMPL_UNIX_H
4141
#define SERIAL_IMPL_UNIX_H
4242

43-
#include "serial/serial.h"
43+
#include "serial_cpp/serial.h"
4444

4545
#include <pthread.h>
4646

47-
namespace serial {
47+
namespace serial_cpp {
4848

4949
using std::size_t;
5050
using std::string;
5151
using std::invalid_argument;
5252

53-
using serial::SerialException;
54-
using serial::IOException;
53+
using serial_cpp::SerialException;
54+
using serial_cpp::IOException;
5555

5656
class MillisecondTimer {
5757
public:
58-
MillisecondTimer(const uint32_t millis);
58+
MillisecondTimer(const uint32_t millis);
5959
int64_t remaining();
6060

6161
private:
6262
static timespec timespec_now();
6363
timespec expiry;
6464
};
6565

66-
class serial::Serial::SerialImpl {
66+
class serial_cpp::Serial::SerialImpl {
6767
public:
6868
SerialImpl (const string &port,
6969
unsigned long baudrate,
Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -39,20 +39,20 @@
3939
#ifndef SERIAL_IMPL_WINDOWS_H
4040
#define SERIAL_IMPL_WINDOWS_H
4141

42-
#include "serial/serial.h"
42+
#include "serial_cpp/serial.h"
4343

4444
#include "windows.h"
4545

46-
namespace serial {
46+
namespace serial_cpp {
4747

4848
using std::string;
4949
using std::wstring;
5050
using std::invalid_argument;
5151

52-
using serial::SerialException;
53-
using serial::IOException;
52+
using serial_cpp::SerialException;
53+
using serial_cpp::IOException;
5454

55-
class serial::Serial::SerialImpl {
55+
class serial_cpp::Serial::SerialImpl {
5656
public:
5757
SerialImpl (const string &port,
5858
unsigned long baudrate,

0 commit comments

Comments
 (0)