├── .gitignore
├── doc
├── html
│ ├── bc_s.png
│ ├── bdwn.png
│ ├── doc.png
│ ├── open.png
│ ├── closed.png
│ ├── doxygen.png
│ ├── nav_f.png
│ ├── nav_g.png
│ ├── nav_h.png
│ ├── sync_on.png
│ ├── tab_a.png
│ ├── tab_b.png
│ ├── tab_h.png
│ ├── tab_s.png
│ ├── splitbar.png
│ ├── sync_off.png
│ ├── folderclosed.png
│ ├── folderopen.png
│ ├── search
│ │ ├── close.png
│ │ ├── mag_sel.png
│ │ ├── search_l.png
│ │ ├── search_m.png
│ │ ├── search_r.png
│ │ ├── namespaces_0.js
│ │ ├── classes_0.js
│ │ ├── all_8.js
│ │ ├── all_c.js
│ │ ├── functions_0.js
│ │ ├── functions_3.js
│ │ ├── all_3.js
│ │ ├── functions_1.js
│ │ ├── functions_5.js
│ │ ├── functions_6.js
│ │ ├── typedefs_0.js
│ │ ├── typedefs_2.js
│ │ ├── typedefs_3.js
│ │ ├── typedefs_1.js
│ │ ├── files_1.js
│ │ ├── files_0.js
│ │ ├── files_2.js
│ │ ├── all_2.js
│ │ ├── all_5.js
│ │ ├── variables_0.js
│ │ ├── defines_2.js
│ │ ├── defines_3.js
│ │ ├── defines_4.js
│ │ ├── all_0.js
│ │ ├── defines_0.js
│ │ ├── all_a.js
│ │ ├── functions_4.js
│ │ ├── all_9.js
│ │ ├── nomatches.html
│ │ ├── all_4.js
│ │ ├── defines_1.js
│ │ ├── defines_5.js
│ │ ├── searchdata.js
│ │ ├── all_7.js
│ │ ├── functions_2.js
│ │ ├── all_1.js
│ │ ├── all_b.js
│ │ ├── variables_1.js
│ │ ├── all_6.js
│ │ ├── all_0.html
│ │ ├── all_1.html
│ │ ├── all_2.html
│ │ ├── all_3.html
│ │ ├── all_4.html
│ │ ├── all_5.html
│ │ ├── all_6.html
│ │ ├── all_7.html
│ │ ├── all_8.html
│ │ ├── all_9.html
│ │ ├── all_a.html
│ │ ├── all_b.html
│ │ ├── all_c.html
│ │ ├── files_0.html
│ │ ├── files_1.html
│ │ ├── files_2.html
│ │ ├── classes_0.html
│ │ ├── defines_0.html
│ │ ├── defines_1.html
│ │ ├── defines_2.html
│ │ ├── defines_3.html
│ │ ├── defines_4.html
│ │ ├── defines_5.html
│ │ ├── typedefs_0.html
│ │ ├── typedefs_1.html
│ │ ├── typedefs_2.html
│ │ ├── typedefs_3.html
│ │ ├── functions_0.html
│ │ ├── functions_1.html
│ │ ├── functions_2.html
│ │ ├── functions_3.html
│ │ ├── functions_4.html
│ │ ├── functions_5.html
│ │ ├── functions_6.html
│ │ ├── namespaces_0.html
│ │ ├── variables_0.html
│ │ ├── variables_1.html
│ │ └── search.css
│ ├── menudata.js
│ ├── menu.js
│ ├── index.html
│ ├── namespaces.html
│ ├── functions_type.html
│ ├── globals_func.html
│ ├── namespaceserial.html
│ ├── classes.html
│ ├── dir_d44c64559bbebec7f509842c48db8b23.html
│ ├── functions_func.html
│ ├── dir_4fef79e7177ba769987a8da36c892c5f.html
│ ├── _serial_8cpp.html
│ ├── annotated.html
│ ├── dir_68267d1309a1af8e8297ef4c3efbcdba.html
│ ├── dir_d35034a6a5b6ec8b3911eeb39d01b9d3.html
│ ├── dir_b1bc0f711a4aefd646da842425484e61.html
│ ├── globals_vars.html
│ ├── dir_2c5165dfc253fd514319589541070b54.html
│ ├── dynsections.js
│ ├── functions.html
│ ├── dir_63772b626f2709090f0bdca0f40827b4.html
│ ├── _serial_port_8cpp.html
│ ├── _serial_8h.html
│ ├── globals_defs.html
│ ├── feature__tests_8cxx.html
│ ├── classserial_1_1_serial-members.html
│ └── feature__tests_8c.html
└── images
│ └── readme.jpg
├── src
└── SerialPort.cpp
├── examples
└── SerialEcho.cpp
├── LICENSE
├── CMakeLists.txt
├── README.md
└── include
└── Serial.h
/.gitignore:
--------------------------------------------------------------------------------
1 | .vscode
2 | build/
--------------------------------------------------------------------------------
/doc/html/bc_s.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/karthickai/serial/HEAD/doc/html/bc_s.png
--------------------------------------------------------------------------------
/doc/html/bdwn.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/karthickai/serial/HEAD/doc/html/bdwn.png
--------------------------------------------------------------------------------
/doc/html/doc.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/karthickai/serial/HEAD/doc/html/doc.png
--------------------------------------------------------------------------------
/doc/html/open.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/karthickai/serial/HEAD/doc/html/open.png
--------------------------------------------------------------------------------
/doc/html/closed.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/karthickai/serial/HEAD/doc/html/closed.png
--------------------------------------------------------------------------------
/doc/html/doxygen.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/karthickai/serial/HEAD/doc/html/doxygen.png
--------------------------------------------------------------------------------
/doc/html/nav_f.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/karthickai/serial/HEAD/doc/html/nav_f.png
--------------------------------------------------------------------------------
/doc/html/nav_g.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/karthickai/serial/HEAD/doc/html/nav_g.png
--------------------------------------------------------------------------------
/doc/html/nav_h.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/karthickai/serial/HEAD/doc/html/nav_h.png
--------------------------------------------------------------------------------
/doc/html/sync_on.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/karthickai/serial/HEAD/doc/html/sync_on.png
--------------------------------------------------------------------------------
/doc/html/tab_a.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/karthickai/serial/HEAD/doc/html/tab_a.png
--------------------------------------------------------------------------------
/doc/html/tab_b.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/karthickai/serial/HEAD/doc/html/tab_b.png
--------------------------------------------------------------------------------
/doc/html/tab_h.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/karthickai/serial/HEAD/doc/html/tab_h.png
--------------------------------------------------------------------------------
/doc/html/tab_s.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/karthickai/serial/HEAD/doc/html/tab_s.png
--------------------------------------------------------------------------------
/doc/html/splitbar.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/karthickai/serial/HEAD/doc/html/splitbar.png
--------------------------------------------------------------------------------
/doc/html/sync_off.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/karthickai/serial/HEAD/doc/html/sync_off.png
--------------------------------------------------------------------------------
/doc/images/readme.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/karthickai/serial/HEAD/doc/images/readme.jpg
--------------------------------------------------------------------------------
/doc/html/folderclosed.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/karthickai/serial/HEAD/doc/html/folderclosed.png
--------------------------------------------------------------------------------
/doc/html/folderopen.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/karthickai/serial/HEAD/doc/html/folderopen.png
--------------------------------------------------------------------------------
/doc/html/search/close.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/karthickai/serial/HEAD/doc/html/search/close.png
--------------------------------------------------------------------------------
/doc/html/search/mag_sel.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/karthickai/serial/HEAD/doc/html/search/mag_sel.png
--------------------------------------------------------------------------------
/doc/html/search/search_l.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/karthickai/serial/HEAD/doc/html/search/search_l.png
--------------------------------------------------------------------------------
/doc/html/search/search_m.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/karthickai/serial/HEAD/doc/html/search/search_m.png
--------------------------------------------------------------------------------
/doc/html/search/search_r.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/karthickai/serial/HEAD/doc/html/search/search_r.png
--------------------------------------------------------------------------------
/doc/html/search/namespaces_0.js:
--------------------------------------------------------------------------------
1 | var searchData=
2 | [
3 | ['serial',['serial',['../namespaceserial.html',1,'']]]
4 | ];
5 |
--------------------------------------------------------------------------------
/doc/html/search/classes_0.js:
--------------------------------------------------------------------------------
1 | var searchData=
2 | [
3 | ['serial',['Serial',['../classserial_1_1_serial.html',1,'serial']]]
4 | ];
5 |
--------------------------------------------------------------------------------
/doc/html/search/all_8.js:
--------------------------------------------------------------------------------
1 | var searchData=
2 | [
3 | ['open',['open',['../classserial_1_1_serial.html#aaef0c8a34738616876ae2397ba64ba86',1,'serial::Serial']]]
4 | ];
5 |
--------------------------------------------------------------------------------
/doc/html/search/all_c.js:
--------------------------------------------------------------------------------
1 | var searchData=
2 | [
3 | ['_7eserial',['~Serial',['../classserial_1_1_serial.html#a071000a2f5f77a40df8311fad5044481',1,'serial::Serial']]]
4 | ];
5 |
--------------------------------------------------------------------------------
/doc/html/search/functions_0.js:
--------------------------------------------------------------------------------
1 | var searchData=
2 | [
3 | ['close',['close',['../classserial_1_1_serial.html#a501082725b61e4baf615266065bbac5f',1,'serial::Serial']]]
4 | ];
5 |
--------------------------------------------------------------------------------
/doc/html/search/functions_3.js:
--------------------------------------------------------------------------------
1 | var searchData=
2 | [
3 | ['open',['open',['../classserial_1_1_serial.html#aaef0c8a34738616876ae2397ba64ba86',1,'serial::Serial']]]
4 | ];
5 |
--------------------------------------------------------------------------------
/doc/html/search/all_3.js:
--------------------------------------------------------------------------------
1 | var searchData=
2 | [
3 | ['errorcode',['errorCode',['../classserial_1_1_serial.html#af7d30495c321c8ebc8d81278b2df2706',1,'serial::Serial']]]
4 | ];
5 |
--------------------------------------------------------------------------------
/doc/html/search/functions_1.js:
--------------------------------------------------------------------------------
1 | var searchData=
2 | [
3 | ['isopen',['isOpen',['../classserial_1_1_serial.html#adeab783cf03aca6b51640a871876ab04',1,'serial::Serial']]]
4 | ];
5 |
--------------------------------------------------------------------------------
/doc/html/search/functions_5.js:
--------------------------------------------------------------------------------
1 | var searchData=
2 | [
3 | ['serial',['Serial',['../classserial_1_1_serial.html#ab4d8c523610ac8640b52a69b5287b93c',1,'serial::Serial']]]
4 | ];
5 |
--------------------------------------------------------------------------------
/doc/html/search/functions_6.js:
--------------------------------------------------------------------------------
1 | var searchData=
2 | [
3 | ['_7eserial',['~Serial',['../classserial_1_1_serial.html#a071000a2f5f77a40df8311fad5044481',1,'serial::Serial']]]
4 | ];
5 |
--------------------------------------------------------------------------------
/doc/html/search/typedefs_0.js:
--------------------------------------------------------------------------------
1 | var searchData=
2 | [
3 | ['errorcode',['errorCode',['../classserial_1_1_serial.html#af7d30495c321c8ebc8d81278b2df2706',1,'serial::Serial']]]
4 | ];
5 |
--------------------------------------------------------------------------------
/doc/html/search/typedefs_2.js:
--------------------------------------------------------------------------------
1 | var searchData=
2 | [
3 | ['paritytype',['parityType',['../classserial_1_1_serial.html#a4ab9d6bc487d9f07907917d3b5e7c90f',1,'serial::Serial']]]
4 | ];
5 |
--------------------------------------------------------------------------------
/doc/html/search/typedefs_3.js:
--------------------------------------------------------------------------------
1 | var searchData=
2 | [
3 | ['stopbitstype',['stopBitsType',['../classserial_1_1_serial.html#ae41b45f62e5e46f53f650f2a2678b407',1,'serial::Serial']]]
4 | ];
5 |
--------------------------------------------------------------------------------
/doc/html/search/typedefs_1.js:
--------------------------------------------------------------------------------
1 | var searchData=
2 | [
3 | ['flowcontroltype',['flowControlType',['../classserial_1_1_serial.html#a99b2dca0960526547c5a4a573237c615',1,'serial::Serial']]]
4 | ];
5 |
--------------------------------------------------------------------------------
/doc/html/search/files_1.js:
--------------------------------------------------------------------------------
1 | var searchData=
2 | [
3 | ['feature_5ftests_2ec',['feature_tests.c',['../feature__tests_8c.html',1,'']]],
4 | ['feature_5ftests_2ecxx',['feature_tests.cxx',['../feature__tests_8cxx.html',1,'']]]
5 | ];
6 |
--------------------------------------------------------------------------------
/doc/html/search/files_0.js:
--------------------------------------------------------------------------------
1 | var searchData=
2 | [
3 | ['cmakeccompilerid_2ec',['CMakeCCompilerId.c',['../_c_make_c_compiler_id_8c.html',1,'']]],
4 | ['cmakecxxcompilerid_2ecpp',['CMakeCXXCompilerId.cpp',['../_c_make_c_x_x_compiler_id_8cpp.html',1,'']]]
5 | ];
6 |
--------------------------------------------------------------------------------
/doc/html/search/files_2.js:
--------------------------------------------------------------------------------
1 | var searchData=
2 | [
3 | ['serial_2ecpp',['Serial.cpp',['../_serial_8cpp.html',1,'']]],
4 | ['serial_2eh',['Serial.h',['../_serial_8h.html',1,'']]],
5 | ['serialport_2ecpp',['SerialPort.cpp',['../_serial_port_8cpp.html',1,'']]]
6 | ];
7 |
--------------------------------------------------------------------------------
/doc/html/search/all_2.js:
--------------------------------------------------------------------------------
1 | var searchData=
2 | [
3 | ['dec',['DEC',['../_c_make_c_compiler_id_8c.html#ad1280362da42492bbc11aa78cbf776ad',1,'DEC(): CMakeCCompilerId.c'],['../_c_make_c_x_x_compiler_id_8cpp.html#ad1280362da42492bbc11aa78cbf776ad',1,'DEC(): CMakeCXXCompilerId.cpp']]]
4 | ];
5 |
--------------------------------------------------------------------------------
/doc/html/search/all_5.js:
--------------------------------------------------------------------------------
1 | var searchData=
2 | [
3 | ['hex',['HEX',['../_c_make_c_compiler_id_8c.html#a46d5d95daa1bef867bd0179594310ed5',1,'HEX(): CMakeCCompilerId.c'],['../_c_make_c_x_x_compiler_id_8cpp.html#a46d5d95daa1bef867bd0179594310ed5',1,'HEX(): CMakeCXXCompilerId.cpp']]]
4 | ];
5 |
--------------------------------------------------------------------------------
/doc/html/search/variables_0.js:
--------------------------------------------------------------------------------
1 | var searchData=
2 | [
3 | ['features',['features',['../feature__tests_8c.html#a1582568e32f689337602a16bf8a5bff0',1,'features(): feature_tests.c'],['../feature__tests_8cxx.html#a1582568e32f689337602a16bf8a5bff0',1,'features(): feature_tests.cxx']]]
4 | ];
5 |
--------------------------------------------------------------------------------
/doc/html/search/defines_2.js:
--------------------------------------------------------------------------------
1 | var searchData=
2 | [
3 | ['dec',['DEC',['../_c_make_c_compiler_id_8c.html#ad1280362da42492bbc11aa78cbf776ad',1,'DEC(): CMakeCCompilerId.c'],['../_c_make_c_x_x_compiler_id_8cpp.html#ad1280362da42492bbc11aa78cbf776ad',1,'DEC(): CMakeCXXCompilerId.cpp']]]
4 | ];
5 |
--------------------------------------------------------------------------------
/doc/html/search/defines_3.js:
--------------------------------------------------------------------------------
1 | var searchData=
2 | [
3 | ['hex',['HEX',['../_c_make_c_compiler_id_8c.html#a46d5d95daa1bef867bd0179594310ed5',1,'HEX(): CMakeCCompilerId.c'],['../_c_make_c_x_x_compiler_id_8cpp.html#a46d5d95daa1bef867bd0179594310ed5',1,'HEX(): CMakeCXXCompilerId.cpp']]]
4 | ];
5 |
--------------------------------------------------------------------------------
/doc/html/search/defines_4.js:
--------------------------------------------------------------------------------
1 | var searchData=
2 | [
3 | ['platform_5fid',['PLATFORM_ID',['../_c_make_c_compiler_id_8c.html#adbc5372f40838899018fadbc89bd588b',1,'PLATFORM_ID(): CMakeCCompilerId.c'],['../_c_make_c_x_x_compiler_id_8cpp.html#adbc5372f40838899018fadbc89bd588b',1,'PLATFORM_ID(): CMakeCXXCompilerId.cpp']]]
4 | ];
5 |
--------------------------------------------------------------------------------
/doc/html/search/all_0.js:
--------------------------------------------------------------------------------
1 | var searchData=
2 | [
3 | ['architecture_5fid',['ARCHITECTURE_ID',['../_c_make_c_compiler_id_8c.html#aba35d0d200deaeb06aee95ca297acb28',1,'ARCHITECTURE_ID(): CMakeCCompilerId.c'],['../_c_make_c_x_x_compiler_id_8cpp.html#aba35d0d200deaeb06aee95ca297acb28',1,'ARCHITECTURE_ID(): CMakeCXXCompilerId.cpp']]]
4 | ];
5 |
--------------------------------------------------------------------------------
/doc/html/search/defines_0.js:
--------------------------------------------------------------------------------
1 | var searchData=
2 | [
3 | ['architecture_5fid',['ARCHITECTURE_ID',['../_c_make_c_compiler_id_8c.html#aba35d0d200deaeb06aee95ca297acb28',1,'ARCHITECTURE_ID(): CMakeCCompilerId.c'],['../_c_make_c_x_x_compiler_id_8cpp.html#aba35d0d200deaeb06aee95ca297acb28',1,'ARCHITECTURE_ID(): CMakeCXXCompilerId.cpp']]]
4 | ];
5 |
--------------------------------------------------------------------------------
/doc/html/search/all_a.js:
--------------------------------------------------------------------------------
1 | var searchData=
2 | [
3 | ['receive',['receive',['../classserial_1_1_serial.html#ace8d009eb8a44748f0085f611b8b8fb5',1,'serial::Serial::receive()'],['../classserial_1_1_serial.html#a20f135c34016f3dd2ebef5d8e3526685',1,'serial::Serial::receive(size_t const num_bytes)'],['../classserial_1_1_serial.html#a76259c27ce0cdf1d4344ccf10e0a3686',1,'serial::Serial::receive(size_t const num_bytes, unsigned int timeout)']]]
4 | ];
5 |
--------------------------------------------------------------------------------
/doc/html/search/functions_4.js:
--------------------------------------------------------------------------------
1 | var searchData=
2 | [
3 | ['receive',['receive',['../classserial_1_1_serial.html#ace8d009eb8a44748f0085f611b8b8fb5',1,'serial::Serial::receive()'],['../classserial_1_1_serial.html#a20f135c34016f3dd2ebef5d8e3526685',1,'serial::Serial::receive(size_t const num_bytes)'],['../classserial_1_1_serial.html#a76259c27ce0cdf1d4344ccf10e0a3686',1,'serial::Serial::receive(size_t const num_bytes, unsigned int timeout)']]]
4 | ];
5 |
--------------------------------------------------------------------------------
/doc/html/search/all_9.js:
--------------------------------------------------------------------------------
1 | var searchData=
2 | [
3 | ['paritytype',['parityType',['../classserial_1_1_serial.html#a4ab9d6bc487d9f07907917d3b5e7c90f',1,'serial::Serial']]],
4 | ['platform_5fid',['PLATFORM_ID',['../_c_make_c_compiler_id_8c.html#adbc5372f40838899018fadbc89bd588b',1,'PLATFORM_ID(): CMakeCCompilerId.c'],['../_c_make_c_x_x_compiler_id_8cpp.html#adbc5372f40838899018fadbc89bd588b',1,'PLATFORM_ID(): CMakeCXXCompilerId.cpp']]]
5 | ];
6 |
--------------------------------------------------------------------------------
/doc/html/search/nomatches.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
11 |
12 |
13 |
--------------------------------------------------------------------------------
/doc/html/search/all_4.js:
--------------------------------------------------------------------------------
1 | var searchData=
2 | [
3 | ['feature_5ftests_2ec',['feature_tests.c',['../feature__tests_8c.html',1,'']]],
4 | ['feature_5ftests_2ecxx',['feature_tests.cxx',['../feature__tests_8cxx.html',1,'']]],
5 | ['features',['features',['../feature__tests_8c.html#a1582568e32f689337602a16bf8a5bff0',1,'features(): feature_tests.c'],['../feature__tests_8cxx.html#a1582568e32f689337602a16bf8a5bff0',1,'features(): feature_tests.cxx']]],
6 | ['flowcontroltype',['flowControlType',['../classserial_1_1_serial.html#a99b2dca0960526547c5a4a573237c615',1,'serial::Serial']]]
7 | ];
8 |
--------------------------------------------------------------------------------
/doc/html/search/defines_1.js:
--------------------------------------------------------------------------------
1 | var searchData=
2 | [
3 | ['c_5fdialect',['C_DIALECT',['../_c_make_c_compiler_id_8c.html#a07f8e5783674099cd7f5110e22a78cdb',1,'CMakeCCompilerId.c']]],
4 | ['compiler_5fid',['COMPILER_ID',['../_c_make_c_compiler_id_8c.html#a81dee0709ded976b2e0319239f72d174',1,'COMPILER_ID(): CMakeCCompilerId.c'],['../_c_make_c_x_x_compiler_id_8cpp.html#a81dee0709ded976b2e0319239f72d174',1,'COMPILER_ID(): CMakeCXXCompilerId.cpp']]],
5 | ['cxx_5fstd',['CXX_STD',['../_c_make_c_x_x_compiler_id_8cpp.html#a34cc889e576a1ae6c84ae9e0a851ba21',1,'CMakeCXXCompilerId.cpp']]]
6 | ];
7 |
--------------------------------------------------------------------------------
/doc/html/search/defines_5.js:
--------------------------------------------------------------------------------
1 | var searchData=
2 | [
3 | ['stringify',['STRINGIFY',['../_c_make_c_compiler_id_8c.html#a43e1cad902b6477bec893cb6430bd6c8',1,'STRINGIFY(): CMakeCCompilerId.c'],['../_c_make_c_x_x_compiler_id_8cpp.html#a43e1cad902b6477bec893cb6430bd6c8',1,'STRINGIFY(): CMakeCXXCompilerId.cpp']]],
4 | ['stringify_5fhelper',['STRINGIFY_HELPER',['../_c_make_c_compiler_id_8c.html#a2ae9b72bb13abaabfcf2ee0ba7d3fa1d',1,'STRINGIFY_HELPER(): CMakeCCompilerId.c'],['../_c_make_c_x_x_compiler_id_8cpp.html#a2ae9b72bb13abaabfcf2ee0ba7d3fa1d',1,'STRINGIFY_HELPER(): CMakeCXXCompilerId.cpp']]]
5 | ];
6 |
--------------------------------------------------------------------------------
/doc/html/search/searchdata.js:
--------------------------------------------------------------------------------
1 | var indexSectionsWithContent =
2 | {
3 | 0: "acdefhimoprs~",
4 | 1: "s",
5 | 2: "s",
6 | 3: "cfs",
7 | 4: "cimors~",
8 | 5: "fi",
9 | 6: "efps",
10 | 7: "acdhps"
11 | };
12 |
13 | var indexSectionNames =
14 | {
15 | 0: "all",
16 | 1: "classes",
17 | 2: "namespaces",
18 | 3: "files",
19 | 4: "functions",
20 | 5: "variables",
21 | 6: "typedefs",
22 | 7: "defines"
23 | };
24 |
25 | var indexSectionLabels =
26 | {
27 | 0: "All",
28 | 1: "Classes",
29 | 2: "Namespaces",
30 | 3: "Files",
31 | 4: "Functions",
32 | 5: "Variables",
33 | 6: "Typedefs",
34 | 7: "Macros"
35 | };
36 |
37 |
--------------------------------------------------------------------------------
/doc/html/search/all_7.js:
--------------------------------------------------------------------------------
1 | var searchData=
2 | [
3 | ['main',['main',['../_c_make_c_compiler_id_8c.html#a0ddf1224851353fc92bfbff6f499fa97',1,'main(int argc, char *argv[]): CMakeCCompilerId.c'],['../_c_make_c_x_x_compiler_id_8cpp.html#a0ddf1224851353fc92bfbff6f499fa97',1,'main(int argc, char *argv[]): CMakeCXXCompilerId.cpp'],['../feature__tests_8c.html#a3c04138a5bfe5d72780bb7e82a18e627',1,'main(int argc, char **argv): feature_tests.c'],['../feature__tests_8cxx.html#a3c04138a5bfe5d72780bb7e82a18e627',1,'main(int argc, char **argv): feature_tests.cxx'],['../_serial_port_8cpp.html#ae66f6b31b5ad750f1fe042a706a4e3d4',1,'main(): SerialPort.cpp']]]
4 | ];
5 |
--------------------------------------------------------------------------------
/doc/html/search/functions_2.js:
--------------------------------------------------------------------------------
1 | var searchData=
2 | [
3 | ['main',['main',['../_c_make_c_compiler_id_8c.html#a0ddf1224851353fc92bfbff6f499fa97',1,'main(int argc, char *argv[]): CMakeCCompilerId.c'],['../_c_make_c_x_x_compiler_id_8cpp.html#a0ddf1224851353fc92bfbff6f499fa97',1,'main(int argc, char *argv[]): CMakeCXXCompilerId.cpp'],['../feature__tests_8c.html#a3c04138a5bfe5d72780bb7e82a18e627',1,'main(int argc, char **argv): feature_tests.c'],['../feature__tests_8cxx.html#a3c04138a5bfe5d72780bb7e82a18e627',1,'main(int argc, char **argv): feature_tests.cxx'],['../_serial_port_8cpp.html#ae66f6b31b5ad750f1fe042a706a4e3d4',1,'main(): SerialPort.cpp']]]
4 | ];
5 |
--------------------------------------------------------------------------------
/src/SerialPort.cpp:
--------------------------------------------------------------------------------
1 |
2 | #include
3 | #include "Serial.h"
4 |
5 | int main()
6 | {
7 | std::cout << "Serial Port Library!\n";
8 |
9 | serial::Serial s;
10 | std::cout << s.isOpen() << std::endl;
11 | s.open("COM3");
12 | std::cout << s.isOpen() << std::endl;
13 |
14 | auto start = std::chrono::system_clock::now();
15 |
16 | auto future = s.receiveAsync(5, 5000);
17 | auto const v = future.get();
18 |
19 | auto end = std::chrono::system_clock::now();
20 | std::chrono::duration elapsed_seconds = end - start;
21 |
22 | if (v.size() < 1)
23 | std::cout << "TIMEOUT" << "elapsed time: " << elapsed_seconds.count() << std::endl;
24 | else {
25 | for (auto val : v) {
26 | std::cout << std::hex << val << " ";
27 | }
28 | std::cout << std::endl;
29 | s.transmit(v);
30 | }
31 |
32 | s.close();
33 | }
34 |
--------------------------------------------------------------------------------
/examples/SerialEcho.cpp:
--------------------------------------------------------------------------------
1 |
2 | #include
3 | #include "../include/Serial.h"
4 |
5 | int main()
6 | {
7 | std::cout << "Serial Port Virtual Emulator!\n";
8 | std::cout << "It will echos msg serially\n\n";
9 | std::cout << "Enter the COM PORT : ";
10 | std::string comport{};
11 | std::cin >> comport;
12 | std::cout << "\nEnter the baud rate : ";
13 | unsigned int baud{};
14 | std::cin >> baud;
15 | std::cout << std::endl;
16 |
17 |
18 | serial::Serial s;
19 | s.open(comport, baud);
20 |
21 | if (s.isOpen()) {
22 | std::cout << "COM PORT OPENED\n";
23 |
24 | while (true) {
25 | std::future> future = s.receiveAsync(1);
26 |
27 | std::vector const received_data = future.get();
28 |
29 | s.transmitAsync(received_data);
30 | }
31 | }
32 |
33 | std::cout << "COM PORT OPENED\n";
34 |
35 |
36 | s.close();
37 | }
38 |
--------------------------------------------------------------------------------
/doc/html/search/all_1.js:
--------------------------------------------------------------------------------
1 | var searchData=
2 | [
3 | ['c_5fdialect',['C_DIALECT',['../_c_make_c_compiler_id_8c.html#a07f8e5783674099cd7f5110e22a78cdb',1,'CMakeCCompilerId.c']]],
4 | ['close',['close',['../classserial_1_1_serial.html#a501082725b61e4baf615266065bbac5f',1,'serial::Serial']]],
5 | ['cmakeccompilerid_2ec',['CMakeCCompilerId.c',['../_c_make_c_compiler_id_8c.html',1,'']]],
6 | ['cmakecxxcompilerid_2ecpp',['CMakeCXXCompilerId.cpp',['../_c_make_c_x_x_compiler_id_8cpp.html',1,'']]],
7 | ['compiler_5fid',['COMPILER_ID',['../_c_make_c_compiler_id_8c.html#a81dee0709ded976b2e0319239f72d174',1,'COMPILER_ID(): CMakeCCompilerId.c'],['../_c_make_c_x_x_compiler_id_8cpp.html#a81dee0709ded976b2e0319239f72d174',1,'COMPILER_ID(): CMakeCXXCompilerId.cpp']]],
8 | ['cxx_5fstd',['CXX_STD',['../_c_make_c_x_x_compiler_id_8cpp.html#a34cc889e576a1ae6c84ae9e0a851ba21',1,'CMakeCXXCompilerId.cpp']]]
9 | ];
10 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | MIT License
2 |
3 | Copyright (c) 2019 Karthick Ai
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in all
13 | copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 | SOFTWARE.
22 |
--------------------------------------------------------------------------------
/doc/html/search/all_b.js:
--------------------------------------------------------------------------------
1 | var searchData=
2 | [
3 | ['serial',['Serial',['../classserial_1_1_serial.html',1,'serial::Serial'],['../namespaceserial.html',1,'serial'],['../classserial_1_1_serial.html#ab4d8c523610ac8640b52a69b5287b93c',1,'serial::Serial::Serial()']]],
4 | ['serial_2ecpp',['Serial.cpp',['../_serial_8cpp.html',1,'']]],
5 | ['serial_2eh',['Serial.h',['../_serial_8h.html',1,'']]],
6 | ['serialport_2ecpp',['SerialPort.cpp',['../_serial_port_8cpp.html',1,'']]],
7 | ['stopbitstype',['stopBitsType',['../classserial_1_1_serial.html#ae41b45f62e5e46f53f650f2a2678b407',1,'serial::Serial']]],
8 | ['stringify',['STRINGIFY',['../_c_make_c_compiler_id_8c.html#a43e1cad902b6477bec893cb6430bd6c8',1,'STRINGIFY(): CMakeCCompilerId.c'],['../_c_make_c_x_x_compiler_id_8cpp.html#a43e1cad902b6477bec893cb6430bd6c8',1,'STRINGIFY(): CMakeCXXCompilerId.cpp']]],
9 | ['stringify_5fhelper',['STRINGIFY_HELPER',['../_c_make_c_compiler_id_8c.html#a2ae9b72bb13abaabfcf2ee0ba7d3fa1d',1,'STRINGIFY_HELPER(): CMakeCCompilerId.c'],['../_c_make_c_x_x_compiler_id_8cpp.html#a2ae9b72bb13abaabfcf2ee0ba7d3fa1d',1,'STRINGIFY_HELPER(): CMakeCXXCompilerId.cpp']]]
10 | ];
11 |
--------------------------------------------------------------------------------
/doc/html/search/variables_1.js:
--------------------------------------------------------------------------------
1 | var searchData=
2 | [
3 | ['info_5farch',['info_arch',['../_c_make_c_compiler_id_8c.html#a59647e99d304ed33b15cb284c27ed391',1,'info_arch(): CMakeCCompilerId.c'],['../_c_make_c_x_x_compiler_id_8cpp.html#a59647e99d304ed33b15cb284c27ed391',1,'info_arch(): CMakeCXXCompilerId.cpp']]],
4 | ['info_5fcompiler',['info_compiler',['../_c_make_c_compiler_id_8c.html#a4b0efeb7a5d59313986b3a0390f050f6',1,'info_compiler(): CMakeCCompilerId.c'],['../_c_make_c_x_x_compiler_id_8cpp.html#a4b0efeb7a5d59313986b3a0390f050f6',1,'info_compiler(): CMakeCXXCompilerId.cpp']]],
5 | ['info_5flanguage_5fdialect_5fdefault',['info_language_dialect_default',['../_c_make_c_compiler_id_8c.html#a1ce162bad2fe6966ac8b33cc19e120b8',1,'info_language_dialect_default(): CMakeCCompilerId.c'],['../_c_make_c_x_x_compiler_id_8cpp.html#a1ce162bad2fe6966ac8b33cc19e120b8',1,'info_language_dialect_default(): CMakeCXXCompilerId.cpp']]],
6 | ['info_5fplatform',['info_platform',['../_c_make_c_compiler_id_8c.html#a2321403dee54ee23f0c2fa849c60f7d4',1,'info_platform(): CMakeCCompilerId.c'],['../_c_make_c_x_x_compiler_id_8cpp.html#a2321403dee54ee23f0c2fa849c60f7d4',1,'info_platform(): CMakeCXXCompilerId.cpp']]]
7 | ];
8 |
--------------------------------------------------------------------------------
/doc/html/search/all_6.js:
--------------------------------------------------------------------------------
1 | var searchData=
2 | [
3 | ['info_5farch',['info_arch',['../_c_make_c_compiler_id_8c.html#a59647e99d304ed33b15cb284c27ed391',1,'info_arch(): CMakeCCompilerId.c'],['../_c_make_c_x_x_compiler_id_8cpp.html#a59647e99d304ed33b15cb284c27ed391',1,'info_arch(): CMakeCXXCompilerId.cpp']]],
4 | ['info_5fcompiler',['info_compiler',['../_c_make_c_compiler_id_8c.html#a4b0efeb7a5d59313986b3a0390f050f6',1,'info_compiler(): CMakeCCompilerId.c'],['../_c_make_c_x_x_compiler_id_8cpp.html#a4b0efeb7a5d59313986b3a0390f050f6',1,'info_compiler(): CMakeCXXCompilerId.cpp']]],
5 | ['info_5flanguage_5fdialect_5fdefault',['info_language_dialect_default',['../_c_make_c_compiler_id_8c.html#a1ce162bad2fe6966ac8b33cc19e120b8',1,'info_language_dialect_default(): CMakeCCompilerId.c'],['../_c_make_c_x_x_compiler_id_8cpp.html#a1ce162bad2fe6966ac8b33cc19e120b8',1,'info_language_dialect_default(): CMakeCXXCompilerId.cpp']]],
6 | ['info_5fplatform',['info_platform',['../_c_make_c_compiler_id_8c.html#a2321403dee54ee23f0c2fa849c60f7d4',1,'info_platform(): CMakeCCompilerId.c'],['../_c_make_c_x_x_compiler_id_8cpp.html#a2321403dee54ee23f0c2fa849c60f7d4',1,'info_platform(): CMakeCXXCompilerId.cpp']]],
7 | ['isopen',['isOpen',['../classserial_1_1_serial.html#adeab783cf03aca6b51640a871876ab04',1,'serial::Serial']]]
8 | ];
9 |
--------------------------------------------------------------------------------
/doc/html/search/all_0.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
Loading...
12 |
13 |
18 |
Searching...
19 |
No Matches
20 |
28 |
29 |
30 |
31 |
--------------------------------------------------------------------------------
/doc/html/search/all_1.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
Loading...
12 |
13 |
18 |
Searching...
19 |
No Matches
20 |
28 |
29 |
30 |
31 |
--------------------------------------------------------------------------------
/doc/html/search/all_2.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
Loading...
12 |
13 |
18 |
Searching...
19 |
No Matches
20 |
28 |
29 |
30 |
31 |
--------------------------------------------------------------------------------
/doc/html/search/all_3.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
Loading...
12 |
13 |
18 |
Searching...
19 |
No Matches
20 |
28 |
29 |
30 |
31 |
--------------------------------------------------------------------------------
/doc/html/search/all_4.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
Loading...
12 |
13 |
18 |
Searching...
19 |
No Matches
20 |
28 |
29 |
30 |
31 |
--------------------------------------------------------------------------------
/doc/html/search/all_5.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
Loading...
12 |
13 |
18 |
Searching...
19 |
No Matches
20 |
28 |
29 |
30 |
31 |
--------------------------------------------------------------------------------
/doc/html/search/all_6.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
Loading...
12 |
13 |
18 |
Searching...
19 |
No Matches
20 |
28 |
29 |
30 |
31 |
--------------------------------------------------------------------------------
/doc/html/search/all_7.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
Loading...
12 |
13 |
18 |
Searching...
19 |
No Matches
20 |
28 |
29 |
30 |
31 |
--------------------------------------------------------------------------------
/doc/html/search/all_8.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
Loading...
12 |
13 |
18 |
Searching...
19 |
No Matches
20 |
28 |
29 |
30 |
31 |
--------------------------------------------------------------------------------
/doc/html/search/all_9.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
Loading...
12 |
13 |
18 |
Searching...
19 |
No Matches
20 |
28 |
29 |
30 |
31 |
--------------------------------------------------------------------------------
/doc/html/search/all_a.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
Loading...
12 |
13 |
18 |
Searching...
19 |
No Matches
20 |
28 |
29 |
30 |
31 |
--------------------------------------------------------------------------------
/doc/html/search/all_b.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
Loading...
12 |
13 |
18 |
Searching...
19 |
No Matches
20 |
28 |
29 |
30 |
31 |
--------------------------------------------------------------------------------
/doc/html/search/all_c.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
Loading...
12 |
13 |
18 |
Searching...
19 |
No Matches
20 |
28 |
29 |
30 |
31 |
--------------------------------------------------------------------------------
/doc/html/search/files_0.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
Loading...
12 |
13 |
18 |
Searching...
19 |
No Matches
20 |
28 |
29 |
30 |
31 |
--------------------------------------------------------------------------------
/doc/html/search/files_1.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
Loading...
12 |
13 |
18 |
Searching...
19 |
No Matches
20 |
28 |
29 |
30 |
31 |
--------------------------------------------------------------------------------
/doc/html/search/files_2.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
Loading...
12 |
13 |
18 |
Searching...
19 |
No Matches
20 |
28 |
29 |
30 |
31 |
--------------------------------------------------------------------------------
/doc/html/search/classes_0.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
Loading...
12 |
13 |
18 |
Searching...
19 |
No Matches
20 |
28 |
29 |
30 |
31 |
--------------------------------------------------------------------------------
/doc/html/search/defines_0.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
Loading...
12 |
13 |
18 |
Searching...
19 |
No Matches
20 |
28 |
29 |
30 |
31 |
--------------------------------------------------------------------------------
/doc/html/search/defines_1.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
Loading...
12 |
13 |
18 |
Searching...
19 |
No Matches
20 |
28 |
29 |
30 |
31 |
--------------------------------------------------------------------------------
/doc/html/search/defines_2.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
Loading...
12 |
13 |
18 |
Searching...
19 |
No Matches
20 |
28 |
29 |
30 |
31 |
--------------------------------------------------------------------------------
/doc/html/search/defines_3.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
Loading...
12 |
13 |
18 |
Searching...
19 |
No Matches
20 |
28 |
29 |
30 |
31 |
--------------------------------------------------------------------------------
/doc/html/search/defines_4.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
Loading...
12 |
13 |
18 |
Searching...
19 |
No Matches
20 |
28 |
29 |
30 |
31 |
--------------------------------------------------------------------------------
/doc/html/search/defines_5.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
Loading...
12 |
13 |
18 |
Searching...
19 |
No Matches
20 |
28 |
29 |
30 |
31 |
--------------------------------------------------------------------------------
/doc/html/search/typedefs_0.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
Loading...
12 |
13 |
18 |
Searching...
19 |
No Matches
20 |
28 |
29 |
30 |
31 |
--------------------------------------------------------------------------------
/doc/html/search/typedefs_1.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
Loading...
12 |
13 |
18 |
Searching...
19 |
No Matches
20 |
28 |
29 |
30 |
31 |
--------------------------------------------------------------------------------
/doc/html/search/typedefs_2.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
Loading...
12 |
13 |
18 |
Searching...
19 |
No Matches
20 |
28 |
29 |
30 |
31 |
--------------------------------------------------------------------------------
/doc/html/search/typedefs_3.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
Loading...
12 |
13 |
18 |
Searching...
19 |
No Matches
20 |
28 |
29 |
30 |
31 |
--------------------------------------------------------------------------------
/doc/html/search/functions_0.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
Loading...
12 |
13 |
18 |
Searching...
19 |
No Matches
20 |
28 |
29 |
30 |
31 |
--------------------------------------------------------------------------------
/doc/html/search/functions_1.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
Loading...
12 |
13 |
18 |
Searching...
19 |
No Matches
20 |
28 |
29 |
30 |
31 |
--------------------------------------------------------------------------------
/doc/html/search/functions_2.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
Loading...
12 |
13 |
18 |
Searching...
19 |
No Matches
20 |
28 |
29 |
30 |
31 |
--------------------------------------------------------------------------------
/doc/html/search/functions_3.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
Loading...
12 |
13 |
18 |
Searching...
19 |
No Matches
20 |
28 |
29 |
30 |
31 |
--------------------------------------------------------------------------------
/doc/html/search/functions_4.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
Loading...
12 |
13 |
18 |
Searching...
19 |
No Matches
20 |
28 |
29 |
30 |
31 |
--------------------------------------------------------------------------------
/doc/html/search/functions_5.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
Loading...
12 |
13 |
18 |
Searching...
19 |
No Matches
20 |
28 |
29 |
30 |
31 |
--------------------------------------------------------------------------------
/doc/html/search/functions_6.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
Loading...
12 |
13 |
18 |
Searching...
19 |
No Matches
20 |
28 |
29 |
30 |
31 |
--------------------------------------------------------------------------------
/doc/html/search/namespaces_0.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
Loading...
12 |
13 |
18 |
Searching...
19 |
No Matches
20 |
28 |
29 |
30 |
31 |
--------------------------------------------------------------------------------
/doc/html/search/variables_0.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
Loading...
12 |
13 |
18 |
Searching...
19 |
No Matches
20 |
28 |
29 |
30 |
31 |
--------------------------------------------------------------------------------
/doc/html/search/variables_1.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
Loading...
12 |
13 |
18 |
Searching...
19 |
No Matches
20 |
28 |
29 |
30 |
31 |
--------------------------------------------------------------------------------
/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | cmake_minimum_required(VERSION 3.13)
2 |
3 | project(serial)
4 |
5 | set(CMAKE_CXX_STANDARD 17)
6 |
7 |
8 | if (MSVC)
9 | set (CMAKE_VERBOSE_MAKEFILE FALSE)
10 |
11 | add_definitions (
12 | -D_WIN32_WINNT=0x0601
13 | -D_SCL_SECURE_NO_WARNINGS=1
14 | -D_CRT_SECURE_NO_WARNINGS=1
15 | -D_SILENCE_CXX17_ALLOCATOR_VOID_DEPRECATION_WARNING
16 | -D_SILENCE_CXX17_ADAPTOR_TYPEDEFS_DEPRECATION_WARNING
17 | )
18 |
19 |
20 | else()
21 | set (THREADS_PREFER_PTHREAD_FLAG ON)
22 | find_package (Threads)
23 |
24 | set( CMAKE_CXX_FLAGS
25 | "${CMAKE_CXX_FLAGS} -std=c++11 -Wall -Wextra -Wpedantic -Wno-unused-parameter")
26 |
27 | if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")
28 | set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wrange-loop-analysis")
29 | endif ()
30 | endif()
31 |
32 |
33 |
34 | set (Boost_USE_STATIC_LIBS ON)
35 | set (Boost_USE_STATIC_RUNTIME ON)
36 | set (Boost_USE_MULTITHREADED ON)
37 | unset (Boost_INCLUDE_DIR CACHE)
38 | unset (Boost_LIBRARY_DIRS CACHE)
39 |
40 | set (BOOST_ROOT "C:\\tools\\vcpkg\\installed\\x86-windows")
41 | set (BOOST_INCLUDEDIR "C:\\tools\\vcpkg\\installed\\x86-windows\\include")
42 |
43 | find_package(Boost "1.70.0" COMPONENTS ${BOOST_MANDATORY_COMPONENTS} REQUIRED)
44 | set (CMAKE_INCLUDE_CURRENT_DIR ON)
45 | include_directories (${Boost_INCLUDE_DIRS})
46 |
47 |
48 |
49 | include_directories( include )
50 | add_executable(serial src/SerialPort.cpp)
51 |
52 |
53 | target_link_libraries(serial ${Boost_LIBRARIES})
54 |
--------------------------------------------------------------------------------
/doc/html/menudata.js:
--------------------------------------------------------------------------------
1 | /*
2 | @ @licstart The following is the entire license notice for the
3 | JavaScript code in this file.
4 |
5 | Copyright (C) 1997-2017 by Dimitri van Heesch
6 |
7 | This program is free software; you can redistribute it and/or modify
8 | it under the terms of the GNU General Public License as published by
9 | the Free Software Foundation; either version 2 of the License, or
10 | (at your option) any later version.
11 |
12 | This program is distributed in the hope that it will be useful,
13 | but WITHOUT ANY WARRANTY; without even the implied warranty of
14 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 | GNU General Public License for more details.
16 |
17 | You should have received a copy of the GNU General Public License along
18 | with this program; if not, write to the Free Software Foundation, Inc.,
19 | 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
20 |
21 | @licend The above is the entire license notice
22 | for the JavaScript code in this file
23 | */
24 | var menudata={children:[
25 | {text:"Main Page",url:"index.html"},
26 | {text:"Namespaces",url:"namespaces.html",children:[
27 | {text:"Namespace List",url:"namespaces.html"}]},
28 | {text:"Classes",url:"annotated.html",children:[
29 | {text:"Class List",url:"annotated.html"},
30 | {text:"Class Index",url:"classes.html"},
31 | {text:"Class Members",url:"functions.html",children:[
32 | {text:"All",url:"functions.html"},
33 | {text:"Functions",url:"functions_func.html"},
34 | {text:"Typedefs",url:"functions_type.html"}]}]},
35 | {text:"Files",url:"files.html",children:[
36 | {text:"File List",url:"files.html"},
37 | {text:"File Members",url:"globals.html",children:[
38 | {text:"All",url:"globals.html",children:[
39 | {text:"a",url:"globals.html#index_a"},
40 | {text:"c",url:"globals.html#index_c"},
41 | {text:"d",url:"globals.html#index_d"},
42 | {text:"f",url:"globals.html#index_f"},
43 | {text:"h",url:"globals.html#index_h"},
44 | {text:"i",url:"globals.html#index_i"},
45 | {text:"m",url:"globals.html#index_m"},
46 | {text:"p",url:"globals.html#index_p"},
47 | {text:"s",url:"globals.html#index_s"}]},
48 | {text:"Functions",url:"globals_func.html"},
49 | {text:"Variables",url:"globals_vars.html"},
50 | {text:"Macros",url:"globals_defs.html"}]}]}]}
51 |
--------------------------------------------------------------------------------
/doc/html/menu.js:
--------------------------------------------------------------------------------
1 | /*
2 | @licstart The following is the entire license notice for the
3 | JavaScript code in this file.
4 |
5 | Copyright (C) 1997-2017 by Dimitri van Heesch
6 |
7 | This program is free software; you can redistribute it and/or modify
8 | it under the terms of the GNU General Public License as published by
9 | the Free Software Foundation; either version 2 of the License, or
10 | (at your option) any later version.
11 |
12 | This program is distributed in the hope that it will be useful,
13 | but WITHOUT ANY WARRANTY; without even the implied warranty of
14 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 | GNU General Public License for more details.
16 |
17 | You should have received a copy of the GNU General Public License along
18 | with this program; if not, write to the Free Software Foundation, Inc.,
19 | 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
20 |
21 | @licend The above is the entire license notice
22 | for the JavaScript code in this file
23 | */
24 | function initMenu(relPath,searchEnabled,serverSide,searchPage,search) {
25 | function makeTree(data,relPath) {
26 | var result='';
27 | if ('children' in data) {
28 | result+='';
35 | }
36 | return result;
37 | }
38 |
39 | $('#main-nav').append(makeTree(menudata,relPath));
40 | $('#main-nav').children(':first').addClass('sm sm-dox').attr('id','main-menu');
41 | if (searchEnabled) {
42 | if (serverSide) {
43 | $('#main-menu').append(' ');
44 | } else {
45 | $('#main-menu').append(' ');
46 | }
47 | }
48 | $('#main-menu').smartmenus();
49 | }
50 | /* @license-end */
51 |
--------------------------------------------------------------------------------
/doc/html/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 | Serial: Main Page
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 | Serial
25 | V.1.0.0
26 |
27 | Cross-Platform, Serial Port Library built on Boost.Asio in Modern C++ 17
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
40 |
41 |
42 |
49 |
50 |
51 |
52 |
56 |
57 |
58 |
59 |
60 |
63 |
64 |
65 |
69 |
70 |
71 |
72 |
77 |
78 |
79 |
--------------------------------------------------------------------------------
/doc/html/namespaces.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 | Serial: Namespace List
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 | Serial
25 | V.1.0.0
26 |
27 | Cross-Platform, Serial Port Library built on Boost.Asio in Modern C++ 17
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
40 |
41 |
42 |
49 |
50 |
51 |
52 |
56 |
57 |
58 |
59 |
60 |
63 |
64 |
65 |
69 |
70 |
Here is a list of all namespaces with brief descriptions:
75 |
76 |
77 |
82 |
83 |
84 |
--------------------------------------------------------------------------------
/doc/html/functions_type.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 | Serial: Class Members - Typedefs
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 | Serial
25 | V.1.0.0
26 |
27 | Cross-Platform, Serial Port Library built on Boost.Asio in Modern C++ 17
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
40 |
41 |
42 |
49 |
50 |
51 |
52 |
56 |
57 |
58 |
59 |
60 |
63 |
64 |
65 |
81 |
82 |
87 |
88 |
89 |
--------------------------------------------------------------------------------
/doc/html/globals_func.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 | Serial: File Members
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 | Serial
25 | V.1.0.0
26 |
27 | Cross-Platform, Serial Port Library built on Boost.Asio in Modern C++ 17
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
40 |
41 |
42 |
49 |
50 |
51 |
52 |
56 |
57 |
58 |
59 |
60 |
63 |
64 |
65 |
76 |
77 |
82 |
83 |
84 |
--------------------------------------------------------------------------------
/doc/html/namespaceserial.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 | Serial: serial Namespace Reference
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 | Serial
25 | V.1.0.0
26 |
27 | Cross-Platform, Serial Port Library built on Boost.Asio in Modern C++ 17
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
40 |
41 |
42 |
49 |
50 |
51 |
55 |
56 |
57 |
58 |
59 |
62 |
63 |
64 |
65 |
71 |
72 |
73 |
75 | class Serial
76 |
77 |
78 |
79 |
80 |
85 |
86 |
87 |
--------------------------------------------------------------------------------
/doc/html/classes.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 | Serial: Class Index
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 | Serial
25 | V.1.0.0
26 |
27 | Cross-Platform, Serial Port Library built on Boost.Asio in Modern C++ 17
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
40 |
41 |
42 |
49 |
50 |
51 |
52 |
56 |
57 |
58 |
59 |
60 |
63 |
64 |
65 |
69 |
80 |
81 |
86 |
87 |
88 |
--------------------------------------------------------------------------------
/doc/html/dir_d44c64559bbebec7f509842c48db8b23.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 | Serial: include Directory Reference
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 | Serial
25 | V.1.0.0
26 |
27 | Cross-Platform, Serial Port Library built on Boost.Asio in Modern C++ 17
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
40 |
41 |
42 |
49 |
50 |
51 |
55 |
56 |
57 |
58 |
59 |
62 |
63 |
64 |
68 |
69 |
73 |
81 |
82 |
87 |
88 |
89 |
--------------------------------------------------------------------------------
/doc/html/functions_func.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 | Serial: Class Members - Functions
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 | Serial
25 | V.1.0.0
26 |
27 | Cross-Platform, Serial Port Library built on Boost.Asio in Modern C++ 17
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
40 |
41 |
42 |
49 |
50 |
51 |
52 |
56 |
57 |
58 |
59 |
60 |
63 |
64 |
65 |
87 |
88 |
93 |
94 |
95 |
--------------------------------------------------------------------------------
/doc/html/dir_4fef79e7177ba769987a8da36c892c5f.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 | Serial: build Directory Reference
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 | Serial
25 | V.1.0.0
26 |
27 | Cross-Platform, Serial Port Library built on Boost.Asio in Modern C++ 17
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
40 |
41 |
42 |
49 |
50 |
51 |
55 |
56 |
57 |
58 |
59 |
62 |
63 |
64 |
68 |
69 |
73 |
81 |
82 |
87 |
88 |
89 |
--------------------------------------------------------------------------------
/doc/html/_serial_8cpp.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 | Serial: src/Serial.cpp File Reference
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 | Serial
25 | V.1.0.0
26 |
27 | Cross-Platform, Serial Port Library built on Boost.Asio in Modern C++ 17
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
40 |
41 |
42 |
49 |
50 |
51 |
55 |
56 |
57 |
58 |
59 |
62 |
63 |
64 |
68 |
69 |
75 |
76 |
#include "Serial.h "
77 |
#include <boost/bind.hpp>
78 |
84 |
85 |
86 |
91 |
92 |
93 |
--------------------------------------------------------------------------------
/doc/html/annotated.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 | Serial: Class List
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 | Serial
25 | V.1.0.0
26 |
27 | Cross-Platform, Serial Port Library built on Boost.Asio in Modern C++ 17
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
40 |
41 |
42 |
49 |
50 |
51 |
52 |
56 |
57 |
58 |
59 |
60 |
63 |
64 |
65 |
69 |
70 |
Here are the classes, structs, unions and interfaces with brief descriptions:
71 |
[detail level 1 2 ]
75 |
76 |
77 |
78 |
83 |
84 |
85 |
--------------------------------------------------------------------------------
/doc/html/dir_68267d1309a1af8e8297ef4c3efbcdba.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 | Serial: src Directory Reference
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 | Serial
25 | V.1.0.0
26 |
27 | Cross-Platform, Serial Port Library built on Boost.Asio in Modern C++ 17
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
40 |
41 |
42 |
49 |
50 |
51 |
55 |
56 |
57 |
58 |
59 |
62 |
63 |
64 |
68 |
69 |
73 |
83 |
84 |
89 |
90 |
91 |
--------------------------------------------------------------------------------
/doc/html/dir_d35034a6a5b6ec8b3911eeb39d01b9d3.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 | Serial: build/CMakeFiles/3.14.19060802-MSVC_2/CompilerIdC Directory Reference
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 | Serial
25 | V.1.0.0
26 |
27 | Cross-Platform, Serial Port Library built on Boost.Asio in Modern C++ 17
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
40 |
41 |
42 |
49 |
50 |
51 |
55 |
56 |
57 |
58 |
59 |
62 |
63 |
64 |
68 |
69 |
73 |
81 |
82 |
87 |
88 |
89 |
--------------------------------------------------------------------------------
/doc/html/dir_b1bc0f711a4aefd646da842425484e61.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 | Serial: build/CMakeFiles/3.14.19060802-MSVC_2/CompilerIdCXX Directory Reference
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 | Serial
25 | V.1.0.0
26 |
27 | Cross-Platform, Serial Port Library built on Boost.Asio in Modern C++ 17
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
40 |
41 |
42 |
49 |
50 |
51 |
55 |
56 |
57 |
58 |
59 |
62 |
63 |
64 |
68 |
69 |
73 |
81 |
82 |
87 |
88 |
89 |
--------------------------------------------------------------------------------
/doc/html/globals_vars.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 | Serial: File Members
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 | Serial
25 | V.1.0.0
26 |
27 | Cross-Platform, Serial Port Library built on Boost.Asio in Modern C++ 17
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
40 |
41 |
42 |
49 |
50 |
51 |
52 |
56 |
57 |
58 |
59 |
60 |
63 |
64 |
65 |
89 |
90 |
95 |
96 |
97 |
--------------------------------------------------------------------------------
/doc/html/dir_2c5165dfc253fd514319589541070b54.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 | Serial: build/CMakeFiles/3.14.19060802-MSVC_2 Directory Reference
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 | Serial
25 | V.1.0.0
26 |
27 | Cross-Platform, Serial Port Library built on Boost.Asio in Modern C++ 17
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
40 |
41 |
42 |
49 |
50 |
51 |
55 |
56 |
57 |
58 |
59 |
62 |
63 |
64 |
68 |
69 |
73 |
83 |
84 |
89 |
90 |
91 |
--------------------------------------------------------------------------------
/doc/html/dynsections.js:
--------------------------------------------------------------------------------
1 | /*
2 | @licstart The following is the entire license notice for the
3 | JavaScript code in this file.
4 |
5 | Copyright (C) 1997-2017 by Dimitri van Heesch
6 |
7 | This program is free software; you can redistribute it and/or modify
8 | it under the terms of the GNU General Public License as published by
9 | the Free Software Foundation; either version 2 of the License, or
10 | (at your option) any later version.
11 |
12 | This program is distributed in the hope that it will be useful,
13 | but WITHOUT ANY WARRANTY; without even the implied warranty of
14 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 | GNU General Public License for more details.
16 |
17 | You should have received a copy of the GNU General Public License along
18 | with this program; if not, write to the Free Software Foundation, Inc.,
19 | 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
20 |
21 | @licend The above is the entire license notice
22 | for the JavaScript code in this file
23 | */
24 | function toggleVisibility(linkObj)
25 | {
26 | var base = $(linkObj).attr('id');
27 | var summary = $('#'+base+'-summary');
28 | var content = $('#'+base+'-content');
29 | var trigger = $('#'+base+'-trigger');
30 | var src=$(trigger).attr('src');
31 | if (content.is(':visible')===true) {
32 | content.hide();
33 | summary.show();
34 | $(linkObj).addClass('closed').removeClass('opened');
35 | $(trigger).attr('src',src.substring(0,src.length-8)+'closed.png');
36 | } else {
37 | content.show();
38 | summary.hide();
39 | $(linkObj).removeClass('closed').addClass('opened');
40 | $(trigger).attr('src',src.substring(0,src.length-10)+'open.png');
41 | }
42 | return false;
43 | }
44 |
45 | function updateStripes()
46 | {
47 | $('table.directory tr').
48 | removeClass('even').filter(':visible:even').addClass('even');
49 | }
50 |
51 | function toggleLevel(level)
52 | {
53 | $('table.directory tr').each(function() {
54 | var l = this.id.split('_').length-1;
55 | var i = $('#img'+this.id.substring(3));
56 | var a = $('#arr'+this.id.substring(3));
57 | if (l
2 |
3 |
4 |
5 |
6 |
7 |
8 | Serial: Class Members
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 | Serial
25 | V.1.0.0
26 |
27 | Cross-Platform, Serial Port Library built on Boost.Asio in Modern C++ 17
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
40 |
41 |
42 |
49 |
50 |
51 |
52 |
56 |
57 |
58 |
59 |
60 |
63 |
64 |
65 |
66 |
Here is a list of all class members with links to the classes they belong to:
98 |
99 |
100 |
105 |
106 |
107 |
--------------------------------------------------------------------------------
/doc/html/dir_63772b626f2709090f0bdca0f40827b4.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 | Serial: build/CMakeFiles Directory Reference
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 | Serial
25 | V.1.0.0
26 |
27 | Cross-Platform, Serial Port Library built on Boost.Asio in Modern C++ 17
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
40 |
41 |
42 |
49 |
50 |
51 |
55 |
56 |
57 |
58 |
59 |
62 |
63 |
64 |
68 |
69 |
73 |
88 |
89 |
94 |
95 |
96 |
--------------------------------------------------------------------------------
/doc/html/_serial_port_8cpp.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 | Serial: src/SerialPort.cpp File Reference
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 | Serial
25 | V.1.0.0
26 |
27 | Cross-Platform, Serial Port Library built on Boost.Asio in Modern C++ 17
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
40 |
41 |
42 |
49 |
50 |
51 |
55 |
56 |
57 |
58 |
59 |
62 |
63 |
64 |
68 |
69 |
75 |
76 |
#include <iostream>
77 |
#include "Serial.h "
78 |
79 |
81 | int main ()
82 |
83 |
84 |
85 |
86 |
◆ main()
87 |
88 |
89 |
90 |
91 |
92 | int main
93 | (
94 | )
95 |
96 |
97 |
98 |
99 |
100 |
101 |
102 |
103 |
104 |
109 |
110 |
111 |
--------------------------------------------------------------------------------
/doc/html/_serial_8h.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 | Serial: include/Serial.h File Reference
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 | Serial
25 | V.1.0.0
26 |
27 | Cross-Platform, Serial Port Library built on Boost.Asio in Modern C++ 17
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
40 |
41 |
42 |
49 |
50 |
51 |
55 |
56 |
57 |
58 |
59 |
62 |
63 |
64 |
68 |
69 |
76 |
77 |
#include <thread>
78 | #include <array>
79 | #include <future>
80 | #include <chrono>
81 | #include <boost/asio.hpp>
82 | #include <boost/bind.hpp>
83 |
84 |
Go to the source code of this file.
85 |
96 |
97 |
98 |
103 |
104 |
105 |
--------------------------------------------------------------------------------
/doc/html/globals_defs.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 | Serial: File Members
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 | Serial
25 | V.1.0.0
26 |
27 | Cross-Platform, Serial Port Library built on Boost.Asio in Modern C++ 17
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
40 |
41 |
42 |
49 |
50 |
51 |
52 |
56 |
57 |
58 |
59 |
60 |
63 |
64 |
65 |
103 |
104 |
109 |
110 |
111 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 |
3 |
4 | # Cross-Platform, Serial Port Library built on Boost.Asio in Modern C++ 17
5 |
6 |
7 |
8 |
9 | ## Contents
10 |
11 | - [Introduction](#introduction)
12 | - [Appearances](#appearances)
13 | - [Description](#description)
14 | - [Requirements](#requirements)
15 | - [Building](#building)
16 | - [Usage](#usage)
17 | - [License](#license)
18 | - [Author](#author)
19 | - [Contact](#contact)
20 |
21 |
22 | ## Introduction
23 |
24 | Serial is a C++ header-only library serving as a foundation for writing
25 | interoperable Serial Port Communication by providing **low-level Serial I/O**
26 | using the consistent asynchronous model of Boost.Asio.
27 |
28 | This library is designed for:
29 |
30 | * **Ease of Use:** Boost.Asio users will immediately understand Serial.
31 |
32 | * **Performance:** Build applications with high Performance.
33 |
34 | * **Basis for Further Abstraction.** Components are well-suited for building upon.
35 |
36 |
37 | ## Description
38 |
39 | This software is in its first official release. Interfaces
40 | may change in response to user feedback. For recent changes
41 | see the [CHANGELOG](CHANGELOG.md).
42 |
43 | * [Official Site](https://github.com/karthickai/serial)
44 | * [Documentation](htt/) (master branch)
45 |
46 |
47 | ## Requirements
48 |
49 | This Serial Library requires Boost Libraries
50 |
51 | * **C++17:** Robust support for most language features.
52 | * **Boost:** Boost.Asio and some other parts of Boost.
53 | * **OpenSSL:** Required for using TLS/Secure sockets and examples/tests
54 |
55 | When using Microsoft Visual C++, Visual Studio 2017 or later is required.
56 |
57 | ## Building
58 |
59 | Serial is header-only. To use it just add the necessary `#include` line
60 | to your source files, like this:
61 | ```C++
62 | #include
63 | ```
64 |
65 | ## Building examples
66 | Building tests and examples requires Boost installed.
67 |
68 | ### Ubuntu/Debian
69 | If installed into a system directory, boost will be automatically found and used.
70 | ```bash
71 | sudo apt install libboost-all-dev
72 | ```
73 | ### Windows
74 | Replace `path` in the following code snippets with the path you installed vcpkg
75 | to. Examples assume a 32-bit build, if you build a 64-bit version replace
76 | `x32-windows` with `x64-windows` in the path.
77 | - Using [vcpkg](https://github.com/Microsoft/vcpkg) and CMD:
78 | ```bat
79 | vcpkg install boost-asio --triplet x32-windows
80 | SET BOOST_ROOT=path\installed\x32-windows
81 | ```
82 |
83 | - Using [vcpkg](https://github.com/Microsoft/vcpkg) and PowerShell:
84 | ```powershell
85 | vcpkg install boost-asio --triplet x32-windows
86 | $env:BOOST_ROOT = "path\x32-windows"
87 | ```
88 |
89 | - Using [vcpkg](https://github.com/Microsoft/vcpkg) and bash:
90 | ```bash
91 | vcpkg.exe install boost-asio --triplet x32-windows
92 | export BOOST_ROOT=path/x32-windows
93 | ```
94 |
95 | ### Mac OS
96 | Using [brew](https://github.com/Homebrew/brew):
97 | ```bash
98 | brew install boost
99 | export BOOST_ROOT=$(brew --prefix boost)
100 | ```
101 |
102 | Additional instructions for configuring, using boost libraries
103 | [Boost Wiki](https://github.com/boostorg/boost/wiki/Getting-Started).
104 |
105 | ## Visual Studio
106 |
107 | CMake may be used to generate a very nice Visual Studio solution and
108 | a set of Visual Studio project files using these commands:
109 |
110 | ```
111 | mkdir build
112 | cd build
113 | cmake .. # for 32-bit Windows builds, or
114 | cmake -G "Visual Studio 16 Win64" .. # for 64-bit Windows builds (VS2019)
115 | ```
116 |
117 | The files in the repository are laid out thusly:
118 |
119 | ```
120 | build/ Create this to hold executables and project files
121 | doc/ Source code and scripts for the documentation
122 | include/ Where the header files are located
123 | example/ Self contained example programs
124 | test/ The unit tests for Serial
125 | ```
126 |
127 | ## Usage
128 |
129 | These examples are complete, self-contained programs that you can build
130 | and run yourself (they are in the `example` directory).
131 |
132 |
133 |
134 |
135 |
136 | Distributed under the Boost Software License, Version 1.0.
137 | (See accompanying file [LICENSE_1_0.txt](LICENSE_1_0.txt) or copy at
138 | https://www.boost.org/LICENSE_1_0.txt)
139 |
140 |
141 | ---
142 | ## License
143 | The MIT License
144 |
145 | Copyright (c) 2019 Karthick P
146 |
147 | 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:
148 |
149 | The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
150 |
151 | 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.
152 |
153 | ---
154 |
155 | ## Author
156 |
157 | Karthick P
158 |
159 | ## Contact
160 | Please report issues or questions here:
161 | https://github.com/karthickai/serial/issues
162 |
163 |
--------------------------------------------------------------------------------
/doc/html/search/search.css:
--------------------------------------------------------------------------------
1 | /*---------------- Search Box */
2 |
3 | #FSearchBox {
4 | float: left;
5 | }
6 |
7 | #MSearchBox {
8 | white-space : nowrap;
9 | float: none;
10 | margin-top: 8px;
11 | right: 0px;
12 | width: 170px;
13 | height: 24px;
14 | z-index: 102;
15 | }
16 |
17 | #MSearchBox .left
18 | {
19 | display:block;
20 | position:absolute;
21 | left:10px;
22 | width:20px;
23 | height:19px;
24 | background:url('search_l.png') no-repeat;
25 | background-position:right;
26 | }
27 |
28 | #MSearchSelect {
29 | display:block;
30 | position:absolute;
31 | width:20px;
32 | height:19px;
33 | }
34 |
35 | .left #MSearchSelect {
36 | left:4px;
37 | }
38 |
39 | .right #MSearchSelect {
40 | right:5px;
41 | }
42 |
43 | #MSearchField {
44 | display:block;
45 | position:absolute;
46 | height:19px;
47 | background:url('search_m.png') repeat-x;
48 | border:none;
49 | width:115px;
50 | margin-left:20px;
51 | padding-left:4px;
52 | color: #909090;
53 | outline: none;
54 | font: 9pt Arial, Verdana, sans-serif;
55 | -webkit-border-radius: 0px;
56 | }
57 |
58 | #FSearchBox #MSearchField {
59 | margin-left:15px;
60 | }
61 |
62 | #MSearchBox .right {
63 | display:block;
64 | position:absolute;
65 | right:10px;
66 | top:8px;
67 | width:20px;
68 | height:19px;
69 | background:url('search_r.png') no-repeat;
70 | background-position:left;
71 | }
72 |
73 | #MSearchClose {
74 | display: none;
75 | position: absolute;
76 | top: 4px;
77 | background : none;
78 | border: none;
79 | margin: 0px 4px 0px 0px;
80 | padding: 0px 0px;
81 | outline: none;
82 | }
83 |
84 | .left #MSearchClose {
85 | left: 6px;
86 | }
87 |
88 | .right #MSearchClose {
89 | right: 2px;
90 | }
91 |
92 | .MSearchBoxActive #MSearchField {
93 | color: #000000;
94 | }
95 |
96 | /*---------------- Search filter selection */
97 |
98 | #MSearchSelectWindow {
99 | display: none;
100 | position: absolute;
101 | left: 0; top: 0;
102 | border: 1px solid #90A5CE;
103 | background-color: #F9FAFC;
104 | z-index: 10001;
105 | padding-top: 4px;
106 | padding-bottom: 4px;
107 | -moz-border-radius: 4px;
108 | -webkit-border-top-left-radius: 4px;
109 | -webkit-border-top-right-radius: 4px;
110 | -webkit-border-bottom-left-radius: 4px;
111 | -webkit-border-bottom-right-radius: 4px;
112 | -webkit-box-shadow: 5px 5px 5px rgba(0, 0, 0, 0.15);
113 | }
114 |
115 | .SelectItem {
116 | font: 8pt Arial, Verdana, sans-serif;
117 | padding-left: 2px;
118 | padding-right: 12px;
119 | border: 0px;
120 | }
121 |
122 | span.SelectionMark {
123 | margin-right: 4px;
124 | font-family: monospace;
125 | outline-style: none;
126 | text-decoration: none;
127 | }
128 |
129 | a.SelectItem {
130 | display: block;
131 | outline-style: none;
132 | color: #000000;
133 | text-decoration: none;
134 | padding-left: 6px;
135 | padding-right: 12px;
136 | }
137 |
138 | a.SelectItem:focus,
139 | a.SelectItem:active {
140 | color: #000000;
141 | outline-style: none;
142 | text-decoration: none;
143 | }
144 |
145 | a.SelectItem:hover {
146 | color: #FFFFFF;
147 | background-color: #3D578C;
148 | outline-style: none;
149 | text-decoration: none;
150 | cursor: pointer;
151 | display: block;
152 | }
153 |
154 | /*---------------- Search results window */
155 |
156 | iframe#MSearchResults {
157 | width: 60ex;
158 | height: 15em;
159 | }
160 |
161 | #MSearchResultsWindow {
162 | display: none;
163 | position: absolute;
164 | left: 0; top: 0;
165 | border: 1px solid #000;
166 | background-color: #EEF1F7;
167 | z-index:10000;
168 | }
169 |
170 | /* ----------------------------------- */
171 |
172 |
173 | #SRIndex {
174 | clear:both;
175 | padding-bottom: 15px;
176 | }
177 |
178 | .SREntry {
179 | font-size: 10pt;
180 | padding-left: 1ex;
181 | }
182 |
183 | .SRPage .SREntry {
184 | font-size: 8pt;
185 | padding: 1px 5px;
186 | }
187 |
188 | body.SRPage {
189 | margin: 5px 2px;
190 | }
191 |
192 | .SRChildren {
193 | padding-left: 3ex; padding-bottom: .5em
194 | }
195 |
196 | .SRPage .SRChildren {
197 | display: none;
198 | }
199 |
200 | .SRSymbol {
201 | font-weight: bold;
202 | color: #425E97;
203 | font-family: Arial, Verdana, sans-serif;
204 | text-decoration: none;
205 | outline: none;
206 | }
207 |
208 | a.SRScope {
209 | display: block;
210 | color: #425E97;
211 | font-family: Arial, Verdana, sans-serif;
212 | text-decoration: none;
213 | outline: none;
214 | }
215 |
216 | a.SRSymbol:focus, a.SRSymbol:active,
217 | a.SRScope:focus, a.SRScope:active {
218 | text-decoration: underline;
219 | }
220 |
221 | span.SRScope {
222 | padding-left: 4px;
223 | }
224 |
225 | .SRPage .SRStatus {
226 | padding: 2px 5px;
227 | font-size: 8pt;
228 | font-style: italic;
229 | }
230 |
231 | .SRResult {
232 | display: none;
233 | }
234 |
235 | DIV.searchresults {
236 | margin-left: 10px;
237 | margin-right: 10px;
238 | }
239 |
240 | /*---------------- External search page results */
241 |
242 | .searchresult {
243 | background-color: #F0F3F8;
244 | }
245 |
246 | .pages b {
247 | color: white;
248 | padding: 5px 5px 3px 5px;
249 | background-image: url("../tab_a.png");
250 | background-repeat: repeat-x;
251 | text-shadow: 0 1px 1px #000000;
252 | }
253 |
254 | .pages {
255 | line-height: 17px;
256 | margin-left: 4px;
257 | text-decoration: none;
258 | }
259 |
260 | .hl {
261 | font-weight: bold;
262 | }
263 |
264 | #searchresults {
265 | margin-bottom: 20px;
266 | }
267 |
268 | .searchpages {
269 | margin-top: 10px;
270 | }
271 |
272 |
--------------------------------------------------------------------------------
/doc/html/feature__tests_8cxx.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 | Serial: build/CMakeFiles/feature_tests.cxx File Reference
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 | Serial
25 | V.1.0.0
26 |
27 | Cross-Platform, Serial Port Library built on Boost.Asio in Modern C++ 17
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
40 |
41 |
42 |
49 |
50 |
51 |
55 |
56 |
57 |
58 |
59 |
62 |
63 |
64 |
68 |
69 |
76 |
77 |
78 |
80 | int main (int argc, char **argv)
81 |
82 |
83 |
85 | const char features []
86 |
87 |
88 |
89 |
90 |
◆ main()
91 |
92 |
93 |
94 |
95 |
96 | int main
97 | (
98 | int
99 | argc ,
100 |
101 |
102 |
103 |
104 | char **
105 | argv
106 |
107 |
108 |
109 | )
110 |
111 |
112 |
113 |
114 |
115 |
116 |
117 |
118 |
119 |
◆ features
120 |
121 |
122 |
123 |
124 |
125 | const char features[]
126 |
127 |
128 |
129 |
130 |
131 |
132 |
133 |
134 |
139 |
140 |
141 |
--------------------------------------------------------------------------------
/doc/html/classserial_1_1_serial-members.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 | Serial: Member List
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 | Serial
25 | V.1.0.0
26 |
27 | Cross-Platform, Serial Port Library built on Boost.Asio in Modern C++ 17
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
40 |
41 |
42 |
49 |
50 |
51 |
55 |
56 |
57 |
58 |
59 |
62 |
63 |
64 |
68 |
69 |
73 |
74 |
75 |
This is the complete list of members for serial::Serial , including all inherited members.
76 |
90 |
91 |
96 |
97 |
98 |
--------------------------------------------------------------------------------
/doc/html/feature__tests_8c.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 | Serial: build/CMakeFiles/feature_tests.c File Reference
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 | Serial
25 | V.1.0.0
26 |
27 | Cross-Platform, Serial Port Library built on Boost.Asio in Modern C++ 17
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
40 |
41 |
42 |
49 |
50 |
51 |
55 |
56 |
57 |
58 |
59 |
62 |
63 |
64 |
68 |
69 |
76 |
77 |
78 |
80 | int main (int argc, char **argv)
81 |
82 |
83 |
85 | const char features []
86 |
87 |
88 |
89 |
90 |
◆ main()
91 |
92 |
93 |
94 |
95 |
96 | int main
97 | (
98 | int
99 | argc ,
100 |
101 |
102 |
103 |
104 | char **
105 | argv
106 |
107 |
108 |
109 | )
110 |
111 |
112 |
113 |
114 |
115 |
116 |
117 |
118 |
119 |
◆ features
120 |
121 |
122 |
123 |
124 |
125 | const char features[]
126 |
127 |
128 |
129 |
Initial value: = {"\n"
"C_FEATURE:"
"0"
"c_function_prototypes\n"
"C_FEATURE:"
"0"
"c_variadic_macros\n"
}
130 |
131 |
132 |
133 |
134 |
139 |
140 |
141 |
--------------------------------------------------------------------------------
/include/Serial.h:
--------------------------------------------------------------------------------
1 | #pragma once
2 |
3 | #include
4 | #include
5 | #include
6 | #include
7 |
8 | #include
9 | #include
10 |
11 | namespace serial {
12 |
13 | class Serial
14 | {
15 |
16 | public:
17 | typedef boost::asio::serial_port_base::flow_control::type flowControlType;
18 | typedef boost::asio::serial_port_base::parity::type parityType;
19 | typedef boost::asio::serial_port_base::stop_bits::type stopBitsType;
20 | typedef boost::system::errc::errc_t errorCode;
21 |
22 | public:
23 | Serial();
24 | ~Serial();
25 |
26 | void open(std::string,
27 | unsigned int = 115200,
28 | flowControlType = flowControlType::none,
29 | unsigned int = 8,
30 | parityType = parityType::none,
31 | stopBitsType = stopBitsType::one);
32 |
33 | bool isOpen() const;
34 | void close();
35 | std::future> receiveAsync(size_t const num_bytes);
36 | std::future> receiveAsync(size_t const num_bytes, unsigned int timeout);
37 |
38 | void transmit(std::vector const& data);
39 | std::size_t transmitAsync(const std::vector& v);
40 |
41 |
42 |
43 |
44 | private:
45 |
46 | boost::asio::io_context io_context;
47 | boost::asio::serial_port serial_port;
48 | boost::asio::io_context::work serial_work;
49 |
50 | void asyncRead();
51 | void asyncReadHandler(boost::system::error_code const& error, size_t bytes_transferred);
52 | int16_t readByte();
53 | std::vector readBuffer(size_t len);
54 | std::vector readBufferTimeout(size_t len);
55 |
56 |
57 | std::array buf;
58 |
59 |
60 | std::vector usableReadBuffer;
61 | std::size_t readBufferSize = 256;
62 | std::unique_ptr asyncReadThread;
63 | mutable std::mutex readBufferMtx;
64 |
65 |
66 | mutable std::mutex errMtx;
67 | int error_value{};
68 | void setError(const int error_value);
69 | int getError() const;
70 |
71 | unsigned int timeoutVal = 60000;
72 |
73 |
74 |
75 | mutable std::mutex writeMtx;
76 | std::condition_variable writeCv;
77 | bool writeLocked = false;
78 | void asyncWriteHandler(const boost::system::error_code& error, std::size_t bytes_transferred);
79 |
80 |
81 | };
82 |
83 |
84 | Serial::Serial() : io_context(), serial_port(io_context), serial_work(io_context), asyncReadThread(nullptr), buf{} {};
85 |
86 |
87 | Serial::~Serial() {
88 | if (serial_port.is_open())
89 | close();
90 | }
91 |
92 | void Serial::open(std::string dev_node, unsigned int baud, flowControlType flowControl, unsigned int characterSize, parityType parity, stopBitsType stopBits)
93 | {
94 |
95 | serial_port.open(dev_node);
96 | if (!serial_port.is_open())
97 | return;
98 |
99 | serial_port.set_option(boost::asio::serial_port_base::baud_rate(baud));
100 | serial_port.set_option(boost::asio::serial_port_base::flow_control(flowControl));
101 | serial_port.set_option(boost::asio::serial_port_base::character_size(characterSize));
102 | serial_port.set_option(boost::asio::serial_port_base::parity(parity));
103 | serial_port.set_option(boost::asio::serial_port_base::stop_bits(stopBits));
104 |
105 | asyncReadThread.reset(new std::thread([this] { io_context.run(); }));
106 |
107 | asyncRead();
108 |
109 | }
110 |
111 |
112 | bool Serial::isOpen() const
113 | {
114 | return serial_port.is_open();
115 | }
116 |
117 |
118 | void Serial::close()
119 | {
120 | if (!serial_port.is_open())
121 | return;
122 |
123 | serial_port.cancel();
124 |
125 | io_context.stop();
126 | asyncReadThread->join();
127 |
128 | serial_port.close();
129 | }
130 |
131 |
132 | void Serial::asyncRead() {
133 |
134 | serial_port.async_read_some(
135 | boost::asio::buffer(buf, buf.size()),
136 | [this](const boost::system::error_code& error, std::size_t bytes_transferred) {
137 | asyncReadHandler(error, bytes_transferred);
138 | });
139 | }
140 |
141 |
142 | void Serial::asyncReadHandler(const boost::system::error_code& error, std::size_t bytes_transferred)
143 | {
144 | if (error)
145 | setError(error.value());
146 |
147 |
148 | std::unique_lock lk(readBufferMtx);
149 | for (auto i = 0; i < bytes_transferred; i++)
150 | {
151 | usableReadBuffer.push_back(buf[i]);
152 | }
153 |
154 | if (usableReadBuffer.size() > readBufferSize)
155 | {
156 |
157 | unsigned int overflow = usableReadBuffer.size() - readBufferSize;
158 | usableReadBuffer.erase(usableReadBuffer.begin(), usableReadBuffer.begin() + overflow);
159 | }
160 | lk.unlock();
161 |
162 | asyncRead();
163 |
164 | }
165 |
166 | void Serial::asyncWriteHandler(const boost::system::error_code& error, std::size_t bytes_transferred)
167 | {
168 | if (error)
169 | setError(error.value());
170 |
171 | std::unique_lock lk(writeMtx);
172 | writeLocked = false;
173 | lk.unlock();
174 | writeCv.notify_one();
175 | }
176 |
177 |
178 | int16_t Serial::readByte()
179 | {
180 | std::unique_lock lk(readBufferMtx);
181 |
182 | if (!usableReadBuffer.size())
183 | return -1;
184 |
185 | int res = usableReadBuffer[0];
186 | usableReadBuffer.erase(usableReadBuffer.begin());
187 | return res;
188 | }
189 |
190 |
191 | std::vector Serial::readBuffer(size_t len)
192 | {
193 | std::vector res;
194 |
195 | while (res.size() < len)
196 | {
197 | const int16_t b = readByte();
198 | if (b > -1)
199 | {
200 | res.push_back((uint8_t)b);
201 | }
202 | }
203 | return res;
204 | }
205 |
206 |
207 | std::vector Serial::readBufferTimeout(size_t len)
208 | {
209 | auto start = std::chrono::system_clock::now();
210 | bool timeout = false;
211 | std::vector res;
212 |
213 | while (res.size() < len && !timeout)
214 | {
215 | auto now = std::chrono::system_clock::now();
216 | auto elapsed = std::chrono::duration_cast(now - start);
217 | if (elapsed.count() >= timeoutVal)
218 | {
219 | timeout = true;
220 | }
221 | else
222 | {
223 | const int16_t b = readByte();
224 | if (b > -1)
225 | {
226 | res.push_back((uint8_t)b);
227 | }
228 | }
229 | }
230 | return res;
231 | }
232 |
233 |
234 |
235 | std::future> Serial::receiveAsync(size_t const num_bytes)
236 | {
237 | return std::async(std::launch::deferred, boost::bind(&Serial::readBuffer, this, num_bytes));
238 | }
239 |
240 | std::future> Serial::receiveAsync(size_t const num_bytes, unsigned int timeout)
241 | {
242 | timeoutVal = timeout;
243 | return std::async(std::launch::deferred, boost::bind(&Serial::readBufferTimeout, this, num_bytes));
244 | }
245 |
246 |
247 | void Serial::transmit(std::vector const& data)
248 | {
249 | boost::asio::write(serial_port, boost::asio::buffer(data));
250 | }
251 |
252 |
253 | std::size_t Serial::transmitAsync(const std::vector& v)
254 | {
255 | std::unique_lock lk(writeMtx);
256 | if (writeLocked)
257 | writeCv.wait(lk);
258 |
259 | writeLocked = true;
260 | lk.unlock();
261 |
262 | boost::asio::async_write(
263 | serial_port,
264 | boost::asio::buffer(v, v.size()),
265 | [this](const boost::system::error_code& error, std::size_t bytes_transferred) {
266 | asyncWriteHandler(error, bytes_transferred);
267 | });
268 |
269 | return v.size();
270 | }
271 |
272 |
273 | void Serial::setError(const int error)
274 | {
275 | std::unique_lock elk(errMtx);
276 | error_value = error;
277 |
278 | }
279 |
280 | int Serial::getError() const
281 | {
282 | std::unique_lock lk(errMtx);
283 | return error_value;
284 | }
285 |
286 | }
287 |
288 |
289 |
--------------------------------------------------------------------------------