Browse Source

串口启动指定的应用程序

sat23 3 years ago
parent
commit
48b1c9682a
30 changed files with 8366 additions and 0 deletions
  1. 31 0
      StartAPPbyCOM/StartAPPbyCOM.sln
  2. 2567 0
      StartAPPbyCOM/StartAPPbyCOM/CSerialPort/include/CSerialPort/Doxyfile
  3. 299 0
      StartAPPbyCOM/StartAPPbyCOM/CSerialPort/include/CSerialPort/SerialPort.h
  4. 307 0
      StartAPPbyCOM/StartAPPbyCOM/CSerialPort/include/CSerialPort/SerialPortBase.h
  5. 50 0
      StartAPPbyCOM/StartAPPbyCOM/CSerialPort/include/CSerialPort/SerialPortInfo.h
  6. 54 0
      StartAPPbyCOM/StartAPPbyCOM/CSerialPort/include/CSerialPort/SerialPortInfoBase.h
  7. 36 0
      StartAPPbyCOM/StartAPPbyCOM/CSerialPort/include/CSerialPort/SerialPortInfoUnixBase.h
  8. 44 0
      StartAPPbyCOM/StartAPPbyCOM/CSerialPort/include/CSerialPort/SerialPortInfoWinBase.h
  9. 421 0
      StartAPPbyCOM/StartAPPbyCOM/CSerialPort/include/CSerialPort/SerialPortUnixBase.h
  10. 384 0
      StartAPPbyCOM/StartAPPbyCOM/CSerialPort/include/CSerialPort/SerialPortWinBase.h
  11. 163 0
      StartAPPbyCOM/StartAPPbyCOM/CSerialPort/include/CSerialPort/SerialPort_global.h
  12. 72 0
      StartAPPbyCOM/StartAPPbyCOM/CSerialPort/include/CSerialPort/osplatformutil.h
  13. 527 0
      StartAPPbyCOM/StartAPPbyCOM/CSerialPort/include/CSerialPort/sigslot.h
  14. 362 0
      StartAPPbyCOM/StartAPPbyCOM/CSerialPort/src/SerialPort.cpp
  15. 38 0
      StartAPPbyCOM/StartAPPbyCOM/CSerialPort/src/SerialPortBase.cpp
  16. 23 0
      StartAPPbyCOM/StartAPPbyCOM/CSerialPort/src/SerialPortInfo.cpp
  17. 5 0
      StartAPPbyCOM/StartAPPbyCOM/CSerialPort/src/SerialPortInfoBase.cpp
  18. 282 0
      StartAPPbyCOM/StartAPPbyCOM/CSerialPort/src/SerialPortInfoUnixBase.cpp
  19. 117 0
      StartAPPbyCOM/StartAPPbyCOM/CSerialPort/src/SerialPortInfoWinBase.cpp
  20. 652 0
      StartAPPbyCOM/StartAPPbyCOM/CSerialPort/src/SerialPortUnixBase.cpp
  21. 961 0
      StartAPPbyCOM/StartAPPbyCOM/CSerialPort/src/SerialPortWinBase.cpp
  22. 1 0
      StartAPPbyCOM/StartAPPbyCOM/CSerialPort/src/directory_comment.txt
  23. 205 0
      StartAPPbyCOM/StartAPPbyCOM/CmdHelper.h
  24. 245 0
      StartAPPbyCOM/StartAPPbyCOM/SerialPortManager.cpp
  25. 59 0
      StartAPPbyCOM/StartAPPbyCOM/SerialPortManager.h
  26. 71 0
      StartAPPbyCOM/StartAPPbyCOM/StartAPPbyCOM.cpp
  27. 100 0
      StartAPPbyCOM/StartAPPbyCOM/StartAPPbyCOM.rc
  28. 187 0
      StartAPPbyCOM/StartAPPbyCOM/StartAPPbyCOM.vcxproj
  29. 89 0
      StartAPPbyCOM/StartAPPbyCOM/StartAPPbyCOM.vcxproj.filters
  30. 14 0
      StartAPPbyCOM/StartAPPbyCOM/resource.h

+ 31 - 0
StartAPPbyCOM/StartAPPbyCOM.sln

@@ -0,0 +1,31 @@
+
+Microsoft Visual Studio Solution File, Format Version 12.00
+# Visual Studio Version 16
+VisualStudioVersion = 16.0.30907.101
+MinimumVisualStudioVersion = 10.0.40219.1
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "StartAPPbyCOM", "StartAPPbyCOM\StartAPPbyCOM.vcxproj", "{34AF4DB2-8E55-4F33-B78A-F6C8C3A68391}"
+EndProject
+Global
+	GlobalSection(SolutionConfigurationPlatforms) = preSolution
+		Debug|x64 = Debug|x64
+		Debug|x86 = Debug|x86
+		Release|x64 = Release|x64
+		Release|x86 = Release|x86
+	EndGlobalSection
+	GlobalSection(ProjectConfigurationPlatforms) = postSolution
+		{34AF4DB2-8E55-4F33-B78A-F6C8C3A68391}.Debug|x64.ActiveCfg = Debug|x64
+		{34AF4DB2-8E55-4F33-B78A-F6C8C3A68391}.Debug|x64.Build.0 = Debug|x64
+		{34AF4DB2-8E55-4F33-B78A-F6C8C3A68391}.Debug|x86.ActiveCfg = Debug|Win32
+		{34AF4DB2-8E55-4F33-B78A-F6C8C3A68391}.Debug|x86.Build.0 = Debug|Win32
+		{34AF4DB2-8E55-4F33-B78A-F6C8C3A68391}.Release|x64.ActiveCfg = Release|x64
+		{34AF4DB2-8E55-4F33-B78A-F6C8C3A68391}.Release|x64.Build.0 = Release|x64
+		{34AF4DB2-8E55-4F33-B78A-F6C8C3A68391}.Release|x86.ActiveCfg = Release|Win32
+		{34AF4DB2-8E55-4F33-B78A-F6C8C3A68391}.Release|x86.Build.0 = Release|Win32
+	EndGlobalSection
+	GlobalSection(SolutionProperties) = preSolution
+		HideSolutionNode = FALSE
+	EndGlobalSection
+	GlobalSection(ExtensibilityGlobals) = postSolution
+		SolutionGuid = {6A0350C7-2F66-4E22-A81D-7DC9ADA213EC}
+	EndGlobalSection
+EndGlobal

+ 2567 - 0
StartAPPbyCOM/StartAPPbyCOM/CSerialPort/include/CSerialPort/Doxyfile

@@ -0,0 +1,2567 @@
+# Doxyfile 1.8.16
+
+# This file describes the settings to be used by the documentation system
+# doxygen (www.doxygen.org) for a project.
+#
+# All text after a double hash (##) is considered a comment and is placed in
+# front of the TAG it is preceding.
+#
+# All text after a single hash (#) is considered a comment and will be ignored.
+# The format is:
+# TAG = value [value, ...]
+# For lists, items can also be appended using:
+# TAG += value [value, ...]
+# Values that contain spaces should be placed between quotes (\" \").
+
+#---------------------------------------------------------------------------
+# Project related configuration options
+#---------------------------------------------------------------------------
+
+# This tag specifies the encoding used for all characters in the configuration
+# file that follow. The default is UTF-8 which is also the encoding used for all
+# text before the first occurrence of this tag. Doxygen uses libiconv (or the
+# iconv built into libc) for the transcoding. See
+# https://www.gnu.org/software/libiconv/ for the list of possible encodings.
+# The default value is: UTF-8.
+
+DOXYFILE_ENCODING      = UTF-8
+
+# The PROJECT_NAME tag is a single word (or a sequence of words surrounded by
+# double-quotes, unless you are using Doxywizard) that should identify the
+# project for which the documentation is generated. This name is used in the
+# title of most generated pages and in a few other places.
+# The default value is: My Project.
+
+PROJECT_NAME           = CSerialPort
+
+# The PROJECT_NUMBER tag can be used to enter a project or revision number. This
+# could be handy for archiving the generated documentation or if some version
+# control system is used.
+
+PROJECT_NUMBER         = 4.1.0.201010
+
+# Using the PROJECT_BRIEF tag one can provide an optional one line description
+# for a project that appears at the top of each page and should give viewer a
+# quick idea about the purpose of the project. Keep the description short.
+
+PROJECT_BRIEF          = https://github.com/itas109
+
+# With the PROJECT_LOGO tag one can specify a logo or an icon that is included
+# in the documentation. The maximum height of the logo should not exceed 55
+# pixels and the maximum width should not exceed 200 pixels. Doxygen will copy
+# the logo to the output directory.
+
+PROJECT_LOGO           =
+
+# The OUTPUT_DIRECTORY tag is used to specify the (relative or absolute) path
+# into which the generated documentation will be written. If a relative path is
+# entered, it will be relative to the location where doxygen was started. If
+# left blank the current directory will be used.
+
+OUTPUT_DIRECTORY       = .
+
+# If the CREATE_SUBDIRS tag is set to YES then doxygen will create 4096 sub-
+# directories (in 2 levels) under the output directory of each output format and
+# will distribute the generated files over these directories. Enabling this
+# option can be useful when feeding doxygen a huge amount of source files, where
+# putting all generated files in the same directory would otherwise causes
+# performance problems for the file system.
+# The default value is: NO.
+
+CREATE_SUBDIRS         = NO
+
+# If the ALLOW_UNICODE_NAMES tag is set to YES, doxygen will allow non-ASCII
+# characters to appear in the names of generated files. If set to NO, non-ASCII
+# characters will be escaped, for example _xE3_x81_x84 will be used for Unicode
+# U+3044.
+# The default value is: NO.
+
+ALLOW_UNICODE_NAMES    = NO
+
+# The OUTPUT_LANGUAGE tag is used to specify the language in which all
+# documentation generated by doxygen is written. Doxygen will use this
+# information to generate all constant output in the proper language.
+# Possible values are: Afrikaans, Arabic, Armenian, Brazilian, Catalan, Chinese,
+# Chinese-Traditional, Croatian, Czech, Danish, Dutch, English (United States),
+# Esperanto, Farsi (Persian), Finnish, French, German, Greek, Hungarian,
+# Indonesian, Italian, Japanese, Japanese-en (Japanese with English messages),
+# Korean, Korean-en (Korean with English messages), Latvian, Lithuanian,
+# Macedonian, Norwegian, Persian (Farsi), Polish, Portuguese, Romanian, Russian,
+# Serbian, Serbian-Cyrillic, Slovak, Slovene, Spanish, Swedish, Turkish,
+# Ukrainian and Vietnamese.
+# The default value is: English.
+
+OUTPUT_LANGUAGE        = Chinese
+
+# The OUTPUT_TEXT_DIRECTION tag is used to specify the direction in which all
+# documentation generated by doxygen is written. Doxygen will use this
+# information to generate all generated output in the proper direction.
+# Possible values are: None, LTR, RTL and Context.
+# The default value is: None.
+
+OUTPUT_TEXT_DIRECTION  = None
+
+# If the BRIEF_MEMBER_DESC tag is set to YES, doxygen will include brief member
+# descriptions after the members that are listed in the file and class
+# documentation (similar to Javadoc). Set to NO to disable this.
+# The default value is: YES.
+
+BRIEF_MEMBER_DESC      = YES
+
+# If the REPEAT_BRIEF tag is set to YES, doxygen will prepend the brief
+# description of a member or function before the detailed description
+#
+# Note: If both HIDE_UNDOC_MEMBERS and BRIEF_MEMBER_DESC are set to NO, the
+# brief descriptions will be completely suppressed.
+# The default value is: YES.
+
+REPEAT_BRIEF           = YES
+
+# This tag implements a quasi-intelligent brief description abbreviator that is
+# used to form the text in various listings. Each string in this list, if found
+# as the leading text of the brief description, will be stripped from the text
+# and the result, after processing the whole list, is used as the annotated
+# text. Otherwise, the brief description is used as-is. If left blank, the
+# following values are used ($name is automatically replaced with the name of
+# the entity):The $name class, The $name widget, The $name file, is, provides,
+# specifies, contains, represents, a, an and the.
+
+ABBREVIATE_BRIEF       = "The $name class" \
+                         "The $name widget" \
+                         "The $name file" \
+                         is \
+                         provides \
+                         specifies \
+                         contains \
+                         represents \
+                         a \
+                         an \
+                         the
+
+# If the ALWAYS_DETAILED_SEC and REPEAT_BRIEF tags are both set to YES then
+# doxygen will generate a detailed section even if there is only a brief
+# description.
+# The default value is: NO.
+
+ALWAYS_DETAILED_SEC    = NO
+
+# If the INLINE_INHERITED_MEMB tag is set to YES, doxygen will show all
+# inherited members of a class in the documentation of that class as if those
+# members were ordinary class members. Constructors, destructors and assignment
+# operators of the base classes will not be shown.
+# The default value is: NO.
+
+INLINE_INHERITED_MEMB  = NO
+
+# If the FULL_PATH_NAMES tag is set to YES, doxygen will prepend the full path
+# before files name in the file list and in the header files. If set to NO the
+# shortest path that makes the file name unique will be used
+# The default value is: YES.
+
+FULL_PATH_NAMES        = YES
+
+# The STRIP_FROM_PATH tag can be used to strip a user-defined part of the path.
+# Stripping is only done if one of the specified strings matches the left-hand
+# part of the path. The tag can be used to show relative paths in the file list.
+# If left blank the directory from which doxygen is run is used as the path to
+# strip.
+#
+# Note that you can specify absolute paths here, but also relative paths, which
+# will be relative from the directory where doxygen is started.
+# This tag requires that the tag FULL_PATH_NAMES is set to YES.
+
+STRIP_FROM_PATH        =
+
+# The STRIP_FROM_INC_PATH tag can be used to strip a user-defined part of the
+# path mentioned in the documentation of a class, which tells the reader which
+# header file to include in order to use a class. If left blank only the name of
+# the header file containing the class definition is used. Otherwise one should
+# specify the list of include paths that are normally passed to the compiler
+# using the -I flag.
+
+STRIP_FROM_INC_PATH    =
+
+# If the SHORT_NAMES tag is set to YES, doxygen will generate much shorter (but
+# less readable) file names. This can be useful is your file systems doesn't
+# support long names like on DOS, Mac, or CD-ROM.
+# The default value is: NO.
+
+SHORT_NAMES            = NO
+
+# If the JAVADOC_AUTOBRIEF tag is set to YES then doxygen will interpret the
+# first line (until the first dot) of a Javadoc-style comment as the brief
+# description. If set to NO, the Javadoc-style will behave just like regular Qt-
+# style comments (thus requiring an explicit @brief command for a brief
+# description.)
+# The default value is: NO.
+
+JAVADOC_AUTOBRIEF      = NO
+
+# If the JAVADOC_BANNER tag is set to YES then doxygen will interpret a line
+# such as
+# /***************
+# as being the beginning of a Javadoc-style comment "banner". If set to NO, the
+# Javadoc-style will behave just like regular comments and it will not be
+# interpreted by doxygen.
+# The default value is: NO.
+
+JAVADOC_BANNER         = NO
+
+# If the QT_AUTOBRIEF tag is set to YES then doxygen will interpret the first
+# line (until the first dot) of a Qt-style comment as the brief description. If
+# set to NO, the Qt-style will behave just like regular Qt-style comments (thus
+# requiring an explicit \brief command for a brief description.)
+# The default value is: NO.
+
+QT_AUTOBRIEF           = NO
+
+# The MULTILINE_CPP_IS_BRIEF tag can be set to YES to make doxygen treat a
+# multi-line C++ special comment block (i.e. a block of //! or /// comments) as
+# a brief description. This used to be the default behavior. The new default is
+# to treat a multi-line C++ comment block as a detailed description. Set this
+# tag to YES if you prefer the old behavior instead.
+#
+# Note that setting this tag to YES also means that rational rose comments are
+# not recognized any more.
+# The default value is: NO.
+
+MULTILINE_CPP_IS_BRIEF = NO
+
+# If the INHERIT_DOCS tag is set to YES then an undocumented member inherits the
+# documentation from any documented member that it re-implements.
+# The default value is: YES.
+
+INHERIT_DOCS           = YES
+
+# If the SEPARATE_MEMBER_PAGES tag is set to YES then doxygen will produce a new
+# page for each member. If set to NO, the documentation of a member will be part
+# of the file/class/namespace that contains it.
+# The default value is: NO.
+
+SEPARATE_MEMBER_PAGES  = NO
+
+# The TAB_SIZE tag can be used to set the number of spaces in a tab. Doxygen
+# uses this value to replace tabs by spaces in code fragments.
+# Minimum value: 1, maximum value: 16, default value: 4.
+
+TAB_SIZE               = 4
+
+# This tag can be used to specify a number of aliases that act as commands in
+# the documentation. An alias has the form:
+# name=value
+# For example adding
+# "sideeffect=@par Side Effects:\n"
+# will allow you to put the command \sideeffect (or @sideeffect) in the
+# documentation, which will result in a user-defined paragraph with heading
+# "Side Effects:". You can put \n's in the value part of an alias to insert
+# newlines (in the resulting output). You can put ^^ in the value part of an
+# alias to insert a newline as if a physical newline was in the original file.
+# When you need a literal { or } or , in the value part of an alias you have to
+# escape them by means of a backslash (\), this can lead to conflicts with the
+# commands \{ and \} for these it is advised to use the version @{ and @} or use
+# a double escape (\\{ and \\})
+
+ALIASES                =
+
+# This tag can be used to specify a number of word-keyword mappings (TCL only).
+# A mapping has the form "name=value". For example adding "class=itcl::class"
+# will allow you to use the command class in the itcl::class meaning.
+
+TCL_SUBST              =
+
+# Set the OPTIMIZE_OUTPUT_FOR_C tag to YES if your project consists of C sources
+# only. Doxygen will then generate output that is more tailored for C. For
+# instance, some of the names that are used will be different. The list of all
+# members will be omitted, etc.
+# The default value is: NO.
+
+OPTIMIZE_OUTPUT_FOR_C  = NO
+
+# Set the OPTIMIZE_OUTPUT_JAVA tag to YES if your project consists of Java or
+# Python sources only. Doxygen will then generate output that is more tailored
+# for that language. For instance, namespaces will be presented as packages,
+# qualified scopes will look different, etc.
+# The default value is: NO.
+
+OPTIMIZE_OUTPUT_JAVA   = NO
+
+# Set the OPTIMIZE_FOR_FORTRAN tag to YES if your project consists of Fortran
+# sources. Doxygen will then generate output that is tailored for Fortran.
+# The default value is: NO.
+
+OPTIMIZE_FOR_FORTRAN   = NO
+
+# Set the OPTIMIZE_OUTPUT_VHDL tag to YES if your project consists of VHDL
+# sources. Doxygen will then generate output that is tailored for VHDL.
+# The default value is: NO.
+
+OPTIMIZE_OUTPUT_VHDL   = NO
+
+# Set the OPTIMIZE_OUTPUT_SLICE tag to YES if your project consists of Slice
+# sources only. Doxygen will then generate output that is more tailored for that
+# language. For instance, namespaces will be presented as modules, types will be
+# separated into more groups, etc.
+# The default value is: NO.
+
+OPTIMIZE_OUTPUT_SLICE  = NO
+
+# Doxygen selects the parser to use depending on the extension of the files it
+# parses. With this tag you can assign which parser to use for a given
+# extension. Doxygen has a built-in mapping, but you can override or extend it
+# using this tag. The format is ext=language, where ext is a file extension, and
+# language is one of the parsers supported by doxygen: IDL, Java, Javascript,
+# Csharp (C#), C, C++, D, PHP, md (Markdown), Objective-C, Python, Slice,
+# Fortran (fixed format Fortran: FortranFixed, free formatted Fortran:
+# FortranFree, unknown formatted Fortran: Fortran. In the later case the parser
+# tries to guess whether the code is fixed or free formatted code, this is the
+# default for Fortran type files), VHDL, tcl. For instance to make doxygen treat
+# .inc files as Fortran files (default is PHP), and .f files as C (default is
+# Fortran), use: inc=Fortran f=C.
+#
+# Note: For files without extension you can use no_extension as a placeholder.
+#
+# Note that for custom extensions you also need to set FILE_PATTERNS otherwise
+# the files are not read by doxygen.
+
+EXTENSION_MAPPING      =
+
+# If the MARKDOWN_SUPPORT tag is enabled then doxygen pre-processes all comments
+# according to the Markdown format, which allows for more readable
+# documentation. See https://daringfireball.net/projects/markdown/ for details.
+# The output of markdown processing is further processed by doxygen, so you can
+# mix doxygen, HTML, and XML commands with Markdown formatting. Disable only in
+# case of backward compatibilities issues.
+# The default value is: YES.
+
+MARKDOWN_SUPPORT       = YES
+
+# When the TOC_INCLUDE_HEADINGS tag is set to a non-zero value, all headings up
+# to that level are automatically included in the table of contents, even if
+# they do not have an id attribute.
+# Note: This feature currently applies only to Markdown headings.
+# Minimum value: 0, maximum value: 99, default value: 5.
+# This tag requires that the tag MARKDOWN_SUPPORT is set to YES.
+
+TOC_INCLUDE_HEADINGS   = 0
+
+# When enabled doxygen tries to link words that correspond to documented
+# classes, or namespaces to their corresponding documentation. Such a link can
+# be prevented in individual cases by putting a % sign in front of the word or
+# globally by setting AUTOLINK_SUPPORT to NO.
+# The default value is: YES.
+
+AUTOLINK_SUPPORT       = YES
+
+# If you use STL classes (i.e. std::string, std::vector, etc.) but do not want
+# to include (a tag file for) the STL sources as input, then you should set this
+# tag to YES in order to let doxygen match functions declarations and
+# definitions whose arguments contain STL classes (e.g. func(std::string);
+# versus func(std::string) {}). This also make the inheritance and collaboration
+# diagrams that involve STL classes more complete and accurate.
+# The default value is: NO.
+
+BUILTIN_STL_SUPPORT    = NO
+
+# If you use Microsoft's C++/CLI language, you should set this option to YES to
+# enable parsing support.
+# The default value is: NO.
+
+CPP_CLI_SUPPORT        = NO
+
+# Set the SIP_SUPPORT tag to YES if your project consists of sip (see:
+# https://www.riverbankcomputing.com/software/sip/intro) sources only. Doxygen
+# will parse them like normal C++ but will assume all classes use public instead
+# of private inheritance when no explicit protection keyword is present.
+# The default value is: NO.
+
+SIP_SUPPORT            = NO
+
+# For Microsoft's IDL there are propget and propput attributes to indicate
+# getter and setter methods for a property. Setting this option to YES will make
+# doxygen to replace the get and set methods by a property in the documentation.
+# This will only work if the methods are indeed getting or setting a simple
+# type. If this is not the case, or you want to show the methods anyway, you
+# should set this option to NO.
+# The default value is: YES.
+
+IDL_PROPERTY_SUPPORT   = YES
+
+# If member grouping is used in the documentation and the DISTRIBUTE_GROUP_DOC
+# tag is set to YES then doxygen will reuse the documentation of the first
+# member in the group (if any) for the other members of the group. By default
+# all members of a group must be documented explicitly.
+# The default value is: NO.
+
+DISTRIBUTE_GROUP_DOC   = NO
+
+# If one adds a struct or class to a group and this option is enabled, then also
+# any nested class or struct is added to the same group. By default this option
+# is disabled and one has to add nested compounds explicitly via \ingroup.
+# The default value is: NO.
+
+GROUP_NESTED_COMPOUNDS = NO
+
+# Set the SUBGROUPING tag to YES to allow class member groups of the same type
+# (for instance a group of public functions) to be put as a subgroup of that
+# type (e.g. under the Public Functions section). Set it to NO to prevent
+# subgrouping. Alternatively, this can be done per class using the
+# \nosubgrouping command.
+# The default value is: YES.
+
+SUBGROUPING            = YES
+
+# When the INLINE_GROUPED_CLASSES tag is set to YES, classes, structs and unions
+# are shown inside the group in which they are included (e.g. using \ingroup)
+# instead of on a separate page (for HTML and Man pages) or section (for LaTeX
+# and RTF).
+#
+# Note that this feature does not work in combination with
+# SEPARATE_MEMBER_PAGES.
+# The default value is: NO.
+
+INLINE_GROUPED_CLASSES = NO
+
+# When the INLINE_SIMPLE_STRUCTS tag is set to YES, structs, classes, and unions
+# with only public data fields or simple typedef fields will be shown inline in
+# the documentation of the scope in which they are defined (i.e. file,
+# namespace, or group documentation), provided this scope is documented. If set
+# to NO, structs, classes, and unions are shown on a separate page (for HTML and
+# Man pages) or section (for LaTeX and RTF).
+# The default value is: NO.
+
+INLINE_SIMPLE_STRUCTS  = NO
+
+# When TYPEDEF_HIDES_STRUCT tag is enabled, a typedef of a struct, union, or
+# enum is documented as struct, union, or enum with the name of the typedef. So
+# typedef struct TypeS {} TypeT, will appear in the documentation as a struct
+# with name TypeT. When disabled the typedef will appear as a member of a file,
+# namespace, or class. And the struct will be named TypeS. This can typically be
+# useful for C code in case the coding convention dictates that all compound
+# types are typedef'ed and only the typedef is referenced, never the tag name.
+# The default value is: NO.
+
+TYPEDEF_HIDES_STRUCT   = NO
+
+# The size of the symbol lookup cache can be set using LOOKUP_CACHE_SIZE. This
+# cache is used to resolve symbols given their name and scope. Since this can be
+# an expensive process and often the same symbol appears multiple times in the
+# code, doxygen keeps a cache of pre-resolved symbols. If the cache is too small
+# doxygen will become slower. If the cache is too large, memory is wasted. The
+# cache size is given by this formula: 2^(16+LOOKUP_CACHE_SIZE). The valid range
+# is 0..9, the default is 0, corresponding to a cache size of 2^16=65536
+# symbols. At the end of a run doxygen will report the cache usage and suggest
+# the optimal cache size from a speed point of view.
+# Minimum value: 0, maximum value: 9, default value: 0.
+
+LOOKUP_CACHE_SIZE      = 0
+
+#---------------------------------------------------------------------------
+# Build related configuration options
+#---------------------------------------------------------------------------
+
+# If the EXTRACT_ALL tag is set to YES, doxygen will assume all entities in
+# documentation are documented, even if no documentation was available. Private
+# class members and static file members will be hidden unless the
+# EXTRACT_PRIVATE respectively EXTRACT_STATIC tags are set to YES.
+# Note: This will also disable the warnings about undocumented members that are
+# normally produced when WARNINGS is set to YES.
+# The default value is: NO.
+
+EXTRACT_ALL            = YES
+
+# If the EXTRACT_PRIVATE tag is set to YES, all private members of a class will
+# be included in the documentation.
+# The default value is: NO.
+
+EXTRACT_PRIVATE        = NO
+
+# If the EXTRACT_PRIV_VIRTUAL tag is set to YES, documented private virtual
+# methods of a class will be included in the documentation.
+# The default value is: NO.
+
+EXTRACT_PRIV_VIRTUAL   = NO
+
+# If the EXTRACT_PACKAGE tag is set to YES, all members with package or internal
+# scope will be included in the documentation.
+# The default value is: NO.
+
+EXTRACT_PACKAGE        = NO
+
+# If the EXTRACT_STATIC tag is set to YES, all static members of a file will be
+# included in the documentation.
+# The default value is: NO.
+
+EXTRACT_STATIC         = NO
+
+# If the EXTRACT_LOCAL_CLASSES tag is set to YES, classes (and structs) defined
+# locally in source files will be included in the documentation. If set to NO,
+# only classes defined in header files are included. Does not have any effect
+# for Java sources.
+# The default value is: YES.
+
+EXTRACT_LOCAL_CLASSES  = YES
+
+# This flag is only useful for Objective-C code. If set to YES, local methods,
+# which are defined in the implementation section but not in the interface are
+# included in the documentation. If set to NO, only methods in the interface are
+# included.
+# The default value is: NO.
+
+EXTRACT_LOCAL_METHODS  = NO
+
+# If this flag is set to YES, the members of anonymous namespaces will be
+# extracted and appear in the documentation as a namespace called
+# 'anonymous_namespace{file}', where file will be replaced with the base name of
+# the file that contains the anonymous namespace. By default anonymous namespace
+# are hidden.
+# The default value is: NO.
+
+EXTRACT_ANON_NSPACES   = NO
+
+# If the HIDE_UNDOC_MEMBERS tag is set to YES, doxygen will hide all
+# undocumented members inside documented classes or files. If set to NO these
+# members will be included in the various overviews, but no documentation
+# section is generated. This option has no effect if EXTRACT_ALL is enabled.
+# The default value is: NO.
+
+HIDE_UNDOC_MEMBERS     = NO
+
+# If the HIDE_UNDOC_CLASSES tag is set to YES, doxygen will hide all
+# undocumented classes that are normally visible in the class hierarchy. If set
+# to NO, these classes will be included in the various overviews. This option
+# has no effect if EXTRACT_ALL is enabled.
+# The default value is: NO.
+
+HIDE_UNDOC_CLASSES     = NO
+
+# If the HIDE_FRIEND_COMPOUNDS tag is set to YES, doxygen will hide all friend
+# (class|struct|union) declarations. If set to NO, these declarations will be
+# included in the documentation.
+# The default value is: NO.
+
+HIDE_FRIEND_COMPOUNDS  = NO
+
+# If the HIDE_IN_BODY_DOCS tag is set to YES, doxygen will hide any
+# documentation blocks found inside the body of a function. If set to NO, these
+# blocks will be appended to the function's detailed documentation block.
+# The default value is: NO.
+
+HIDE_IN_BODY_DOCS      = NO
+
+# The INTERNAL_DOCS tag determines if documentation that is typed after a
+# \internal command is included. If the tag is set to NO then the documentation
+# will be excluded. Set it to YES to include the internal documentation.
+# The default value is: NO.
+
+INTERNAL_DOCS          = NO
+
+# If the CASE_SENSE_NAMES tag is set to NO then doxygen will only generate file
+# names in lower-case letters. If set to YES, upper-case letters are also
+# allowed. This is useful if you have classes or files whose names only differ
+# in case and if your file system supports case sensitive file names. Windows
+# (including Cygwin) ands Mac users are advised to set this option to NO.
+# The default value is: system dependent.
+
+CASE_SENSE_NAMES       = NO
+
+# If the HIDE_SCOPE_NAMES tag is set to NO then doxygen will show members with
+# their full class and namespace scopes in the documentation. If set to YES, the
+# scope will be hidden.
+# The default value is: NO.
+
+HIDE_SCOPE_NAMES       = NO
+
+# If the HIDE_COMPOUND_REFERENCE tag is set to NO (default) then doxygen will
+# append additional text to a page's title, such as Class Reference. If set to
+# YES the compound reference will be hidden.
+# The default value is: NO.
+
+HIDE_COMPOUND_REFERENCE= NO
+
+# If the SHOW_INCLUDE_FILES tag is set to YES then doxygen will put a list of
+# the files that are included by a file in the documentation of that file.
+# The default value is: YES.
+
+SHOW_INCLUDE_FILES     = YES
+
+# If the SHOW_GROUPED_MEMB_INC tag is set to YES then Doxygen will add for each
+# grouped member an include statement to the documentation, telling the reader
+# which file to include in order to use the member.
+# The default value is: NO.
+
+SHOW_GROUPED_MEMB_INC  = NO
+
+# If the FORCE_LOCAL_INCLUDES tag is set to YES then doxygen will list include
+# files with double quotes in the documentation rather than with sharp brackets.
+# The default value is: NO.
+
+FORCE_LOCAL_INCLUDES   = NO
+
+# If the INLINE_INFO tag is set to YES then a tag [inline] is inserted in the
+# documentation for inline members.
+# The default value is: YES.
+
+INLINE_INFO            = YES
+
+# If the SORT_MEMBER_DOCS tag is set to YES then doxygen will sort the
+# (detailed) documentation of file and class members alphabetically by member
+# name. If set to NO, the members will appear in declaration order.
+# The default value is: YES.
+
+SORT_MEMBER_DOCS       = YES
+
+# If the SORT_BRIEF_DOCS tag is set to YES then doxygen will sort the brief
+# descriptions of file, namespace and class members alphabetically by member
+# name. If set to NO, the members will appear in declaration order. Note that
+# this will also influence the order of the classes in the class list.
+# The default value is: NO.
+
+SORT_BRIEF_DOCS        = NO
+
+# If the SORT_MEMBERS_CTORS_1ST tag is set to YES then doxygen will sort the
+# (brief and detailed) documentation of class members so that constructors and
+# destructors are listed first. If set to NO the constructors will appear in the
+# respective orders defined by SORT_BRIEF_DOCS and SORT_MEMBER_DOCS.
+# Note: If SORT_BRIEF_DOCS is set to NO this option is ignored for sorting brief
+# member documentation.
+# Note: If SORT_MEMBER_DOCS is set to NO this option is ignored for sorting
+# detailed member documentation.
+# The default value is: NO.
+
+SORT_MEMBERS_CTORS_1ST = NO
+
+# If the SORT_GROUP_NAMES tag is set to YES then doxygen will sort the hierarchy
+# of group names into alphabetical order. If set to NO the group names will
+# appear in their defined order.
+# The default value is: NO.
+
+SORT_GROUP_NAMES       = NO
+
+# If the SORT_BY_SCOPE_NAME tag is set to YES, the class list will be sorted by
+# fully-qualified names, including namespaces. If set to NO, the class list will
+# be sorted only by class name, not including the namespace part.
+# Note: This option is not very useful if HIDE_SCOPE_NAMES is set to YES.
+# Note: This option applies only to the class list, not to the alphabetical
+# list.
+# The default value is: NO.
+
+SORT_BY_SCOPE_NAME     = NO
+
+# If the STRICT_PROTO_MATCHING option is enabled and doxygen fails to do proper
+# type resolution of all parameters of a function it will reject a match between
+# the prototype and the implementation of a member function even if there is
+# only one candidate or it is obvious which candidate to choose by doing a
+# simple string match. By disabling STRICT_PROTO_MATCHING doxygen will still
+# accept a match between prototype and implementation in such cases.
+# The default value is: NO.
+
+STRICT_PROTO_MATCHING  = NO
+
+# The GENERATE_TODOLIST tag can be used to enable (YES) or disable (NO) the todo
+# list. This list is created by putting \todo commands in the documentation.
+# The default value is: YES.
+
+GENERATE_TODOLIST      = YES
+
+# The GENERATE_TESTLIST tag can be used to enable (YES) or disable (NO) the test
+# list. This list is created by putting \test commands in the documentation.
+# The default value is: YES.
+
+GENERATE_TESTLIST      = YES
+
+# The GENERATE_BUGLIST tag can be used to enable (YES) or disable (NO) the bug
+# list. This list is created by putting \bug commands in the documentation.
+# The default value is: YES.
+
+GENERATE_BUGLIST       = YES
+
+# The GENERATE_DEPRECATEDLIST tag can be used to enable (YES) or disable (NO)
+# the deprecated list. This list is created by putting \deprecated commands in
+# the documentation.
+# The default value is: YES.
+
+GENERATE_DEPRECATEDLIST= YES
+
+# The ENABLED_SECTIONS tag can be used to enable conditional documentation
+# sections, marked by \if <section_label> ... \endif and \cond <section_label>
+# ... \endcond blocks.
+
+ENABLED_SECTIONS       =
+
+# The MAX_INITIALIZER_LINES tag determines the maximum number of lines that the
+# initial value of a variable or macro / define can have for it to appear in the
+# documentation. If the initializer consists of more lines than specified here
+# it will be hidden. Use a value of 0 to hide initializers completely. The
+# appearance of the value of individual variables and macros / defines can be
+# controlled using \showinitializer or \hideinitializer command in the
+# documentation regardless of this setting.
+# Minimum value: 0, maximum value: 10000, default value: 30.
+
+MAX_INITIALIZER_LINES  = 30
+
+# Set the SHOW_USED_FILES tag to NO to disable the list of files generated at
+# the bottom of the documentation of classes and structs. If set to YES, the
+# list will mention the files that were used to generate the documentation.
+# The default value is: YES.
+
+SHOW_USED_FILES        = YES
+
+# Set the SHOW_FILES tag to NO to disable the generation of the Files page. This
+# will remove the Files entry from the Quick Index and from the Folder Tree View
+# (if specified).
+# The default value is: YES.
+
+SHOW_FILES             = YES
+
+# Set the SHOW_NAMESPACES tag to NO to disable the generation of the Namespaces
+# page. This will remove the Namespaces entry from the Quick Index and from the
+# Folder Tree View (if specified).
+# The default value is: YES.
+
+SHOW_NAMESPACES        = YES
+
+# The FILE_VERSION_FILTER tag can be used to specify a program or script that
+# doxygen should invoke to get the current version for each file (typically from
+# the version control system). Doxygen will invoke the program by executing (via
+# popen()) the command command input-file, where command is the value of the
+# FILE_VERSION_FILTER tag, and input-file is the name of an input file provided
+# by doxygen. Whatever the program writes to standard output is used as the file
+# version. For an example see the documentation.
+
+FILE_VERSION_FILTER    =
+
+# The LAYOUT_FILE tag can be used to specify a layout file which will be parsed
+# by doxygen. The layout file controls the global structure of the generated
+# output files in an output format independent way. To create the layout file
+# that represents doxygen's defaults, run doxygen with the -l option. You can
+# optionally specify a file name after the option, if omitted DoxygenLayout.xml
+# will be used as the name of the layout file.
+#
+# Note that if you run doxygen from a directory containing a file called
+# DoxygenLayout.xml, doxygen will parse it automatically even if the LAYOUT_FILE
+# tag is left empty.
+
+LAYOUT_FILE            =
+
+# The CITE_BIB_FILES tag can be used to specify one or more bib files containing
+# the reference definitions. This must be a list of .bib files. The .bib
+# extension is automatically appended if omitted. This requires the bibtex tool
+# to be installed. See also https://en.wikipedia.org/wiki/BibTeX for more info.
+# For LaTeX the style of the bibliography can be controlled using
+# LATEX_BIB_STYLE. To use this feature you need bibtex and perl available in the
+# search path. See also \cite for info how to create references.
+
+CITE_BIB_FILES         =
+
+#---------------------------------------------------------------------------
+# Configuration options related to warning and progress messages
+#---------------------------------------------------------------------------
+
+# The QUIET tag can be used to turn on/off the messages that are generated to
+# standard output by doxygen. If QUIET is set to YES this implies that the
+# messages are off.
+# The default value is: NO.
+
+QUIET                  = NO
+
+# The WARNINGS tag can be used to turn on/off the warning messages that are
+# generated to standard error (stderr) by doxygen. If WARNINGS is set to YES
+# this implies that the warnings are on.
+#
+# Tip: Turn warnings on while writing the documentation.
+# The default value is: YES.
+
+WARNINGS               = YES
+
+# If the WARN_IF_UNDOCUMENTED tag is set to YES then doxygen will generate
+# warnings for undocumented members. If EXTRACT_ALL is set to YES then this flag
+# will automatically be disabled.
+# The default value is: YES.
+
+WARN_IF_UNDOCUMENTED   = YES
+
+# If the WARN_IF_DOC_ERROR tag is set to YES, doxygen will generate warnings for
+# potential errors in the documentation, such as not documenting some parameters
+# in a documented function, or documenting parameters that don't exist or using
+# markup commands wrongly.
+# The default value is: YES.
+
+WARN_IF_DOC_ERROR      = YES
+
+# This WARN_NO_PARAMDOC option can be enabled to get warnings for functions that
+# are documented, but have no documentation for their parameters or return
+# value. If set to NO, doxygen will only warn about wrong or incomplete
+# parameter documentation, but not about the absence of documentation. If
+# EXTRACT_ALL is set to YES then this flag will automatically be disabled.
+# The default value is: NO.
+
+WARN_NO_PARAMDOC       = NO
+
+# If the WARN_AS_ERROR tag is set to YES then doxygen will immediately stop when
+# a warning is encountered.
+# The default value is: NO.
+
+WARN_AS_ERROR          = NO
+
+# The WARN_FORMAT tag determines the format of the warning messages that doxygen
+# can produce. The string should contain the $file, $line, and $text tags, which
+# will be replaced by the file and line number from which the warning originated
+# and the warning text. Optionally the format may contain $version, which will
+# be replaced by the version of the file (if it could be obtained via
+# FILE_VERSION_FILTER)
+# The default value is: $file:$line: $text.
+
+WARN_FORMAT            = "$file:$line: $text"
+
+# The WARN_LOGFILE tag can be used to specify a file to which warning and error
+# messages should be written. If left blank the output is written to standard
+# error (stderr).
+
+WARN_LOGFILE           =
+
+#---------------------------------------------------------------------------
+# Configuration options related to the input files
+#---------------------------------------------------------------------------
+
+# The INPUT tag is used to specify the files and/or directories that contain
+# documented source files. You may enter file names like myfile.cpp or
+# directories like /usr/src/myproject. Separate the files or directories with
+# spaces. See also FILE_PATTERNS and EXTENSION_MAPPING
+# Note: If this tag is empty the current directory is searched.
+
+INPUT                  = .
+
+# This tag can be used to specify the character encoding of the source files
+# that doxygen parses. Internally doxygen uses the UTF-8 encoding. Doxygen uses
+# libiconv (or the iconv built into libc) for the transcoding. See the libiconv
+# documentation (see: https://www.gnu.org/software/libiconv/) for the list of
+# possible encodings.
+# The default value is: UTF-8.
+
+INPUT_ENCODING         = UTF-8
+
+# If the value of the INPUT tag contains directories, you can use the
+# FILE_PATTERNS tag to specify one or more wildcard patterns (like *.cpp and
+# *.h) to filter out the source-files in the directories.
+#
+# Note that for custom extensions or not directly supported extensions you also
+# need to set EXTENSION_MAPPING for the extension otherwise the files are not
+# read by doxygen.
+#
+# If left blank the following patterns are tested:*.c, *.cc, *.cxx, *.cpp,
+# *.c++, *.java, *.ii, *.ixx, *.ipp, *.i++, *.inl, *.idl, *.ddl, *.odl, *.h,
+# *.hh, *.hxx, *.hpp, *.h++, *.cs, *.d, *.php, *.php4, *.php5, *.phtml, *.inc,
+# *.m, *.markdown, *.md, *.mm, *.dox, *.py, *.pyw, *.f90, *.f95, *.f03, *.f08,
+# *.f, *.for, *.tcl, *.vhd, *.vhdl, *.ucf, *.qsf and *.ice.
+
+FILE_PATTERNS          = *.c \
+                         *.cc \
+                         *.cxx \
+                         *.cpp \
+                         *.c++ \
+                         *.java \
+                         *.ii \
+                         *.ixx \
+                         *.ipp \
+                         *.i++ \
+                         *.inl \
+                         *.idl \
+                         *.ddl \
+                         *.odl \
+                         *.h \
+                         *.hh \
+                         *.hxx \
+                         *.hpp \
+                         *.h++ \
+                         *.cs \
+                         *.d \
+                         *.php \
+                         *.php4 \
+                         *.php5 \
+                         *.phtml \
+                         *.inc \
+                         *.m \
+                         *.markdown \
+                         *.md \
+                         *.mm \
+                         *.dox \
+                         *.py \
+                         *.pyw \
+                         *.f90 \
+                         *.f95 \
+                         *.f03 \
+                         *.f08 \
+                         *.f \
+                         *.for \
+                         *.tcl \
+                         *.vhd \
+                         *.vhdl \
+                         *.ucf \
+                         *.qsf \
+                         *.ice
+
+# The RECURSIVE tag can be used to specify whether or not subdirectories should
+# be searched for input files as well.
+# The default value is: NO.
+
+RECURSIVE              = YES
+
+# The EXCLUDE tag can be used to specify files and/or directories that should be
+# excluded from the INPUT source files. This way you can easily exclude a
+# subdirectory from a directory tree whose root is specified with the INPUT tag.
+#
+# Note that relative paths are relative to the directory from which doxygen is
+# run.
+
+EXCLUDE                =
+
+# The EXCLUDE_SYMLINKS tag can be used to select whether or not files or
+# directories that are symbolic links (a Unix file system feature) are excluded
+# from the input.
+# The default value is: NO.
+
+EXCLUDE_SYMLINKS       = NO
+
+# If the value of the INPUT tag contains directories, you can use the
+# EXCLUDE_PATTERNS tag to specify one or more wildcard patterns to exclude
+# certain files from those directories.
+#
+# Note that the wildcards are matched against the file with absolute path, so to
+# exclude all test directories for example use the pattern */test/*
+
+EXCLUDE_PATTERNS       =
+
+# The EXCLUDE_SYMBOLS tag can be used to specify one or more symbol names
+# (namespaces, classes, functions, etc.) that should be excluded from the
+# output. The symbol name can be a fully qualified name, a word, or if the
+# wildcard * is used, a substring. Examples: ANamespace, AClass,
+# AClass::ANamespace, ANamespace::*Test
+#
+# Note that the wildcards are matched against the file with absolute path, so to
+# exclude all test directories use the pattern */test/*
+
+EXCLUDE_SYMBOLS        =
+
+# The EXAMPLE_PATH tag can be used to specify one or more files or directories
+# that contain example code fragments that are included (see the \include
+# command).
+
+EXAMPLE_PATH           =
+
+# If the value of the EXAMPLE_PATH tag contains directories, you can use the
+# EXAMPLE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp and
+# *.h) to filter out the source-files in the directories. If left blank all
+# files are included.
+
+EXAMPLE_PATTERNS       = *
+
+# If the EXAMPLE_RECURSIVE tag is set to YES then subdirectories will be
+# searched for input files to be used with the \include or \dontinclude commands
+# irrespective of the value of the RECURSIVE tag.
+# The default value is: NO.
+
+EXAMPLE_RECURSIVE      = NO
+
+# The IMAGE_PATH tag can be used to specify one or more files or directories
+# that contain images that are to be included in the documentation (see the
+# \image command).
+
+IMAGE_PATH             =
+
+# The INPUT_FILTER tag can be used to specify a program that doxygen should
+# invoke to filter for each input file. Doxygen will invoke the filter program
+# by executing (via popen()) the command:
+#
+# <filter> <input-file>
+#
+# where <filter> is the value of the INPUT_FILTER tag, and <input-file> is the
+# name of an input file. Doxygen will then use the output that the filter
+# program writes to standard output. If FILTER_PATTERNS is specified, this tag
+# will be ignored.
+#
+# Note that the filter must not add or remove lines; it is applied before the
+# code is scanned, but not when the output code is generated. If lines are added
+# or removed, the anchors will not be placed correctly.
+#
+# Note that for custom extensions or not directly supported extensions you also
+# need to set EXTENSION_MAPPING for the extension otherwise the files are not
+# properly processed by doxygen.
+
+INPUT_FILTER           =
+
+# The FILTER_PATTERNS tag can be used to specify filters on a per file pattern
+# basis. Doxygen will compare the file name with each pattern and apply the
+# filter if there is a match. The filters are a list of the form: pattern=filter
+# (like *.cpp=my_cpp_filter). See INPUT_FILTER for further information on how
+# filters are used. If the FILTER_PATTERNS tag is empty or if none of the
+# patterns match the file name, INPUT_FILTER is applied.
+#
+# Note that for custom extensions or not directly supported extensions you also
+# need to set EXTENSION_MAPPING for the extension otherwise the files are not
+# properly processed by doxygen.
+
+FILTER_PATTERNS        =
+
+# If the FILTER_SOURCE_FILES tag is set to YES, the input filter (if set using
+# INPUT_FILTER) will also be used to filter the input files that are used for
+# producing the source files to browse (i.e. when SOURCE_BROWSER is set to YES).
+# The default value is: NO.
+
+FILTER_SOURCE_FILES    = NO
+
+# The FILTER_SOURCE_PATTERNS tag can be used to specify source filters per file
+# pattern. A pattern will override the setting for FILTER_PATTERN (if any) and
+# it is also possible to disable source filtering for a specific pattern using
+# *.ext= (so without naming a filter).
+# This tag requires that the tag FILTER_SOURCE_FILES is set to YES.
+
+FILTER_SOURCE_PATTERNS =
+
+# If the USE_MDFILE_AS_MAINPAGE tag refers to the name of a markdown file that
+# is part of the input, its contents will be placed on the main page
+# (index.html). This can be useful if you have a project on for instance GitHub
+# and want to reuse the introduction page also for the doxygen output.
+
+USE_MDFILE_AS_MAINPAGE =
+
+#---------------------------------------------------------------------------
+# Configuration options related to source browsing
+#---------------------------------------------------------------------------
+
+# If the SOURCE_BROWSER tag is set to YES then a list of source files will be
+# generated. Documented entities will be cross-referenced with these sources.
+#
+# Note: To get rid of all source code in the generated output, make sure that
+# also VERBATIM_HEADERS is set to NO.
+# The default value is: NO.
+
+SOURCE_BROWSER         = YES
+
+# Setting the INLINE_SOURCES tag to YES will include the body of functions,
+# classes and enums directly into the documentation.
+# The default value is: NO.
+
+INLINE_SOURCES         = NO
+
+# Setting the STRIP_CODE_COMMENTS tag to YES will instruct doxygen to hide any
+# special comment blocks from generated source code fragments. Normal C, C++ and
+# Fortran comments will always remain visible.
+# The default value is: YES.
+
+STRIP_CODE_COMMENTS    = YES
+
+# If the REFERENCED_BY_RELATION tag is set to YES then for each documented
+# entity all documented functions referencing it will be listed.
+# The default value is: NO.
+
+REFERENCED_BY_RELATION = NO
+
+# If the REFERENCES_RELATION tag is set to YES then for each documented function
+# all documented entities called/used by that function will be listed.
+# The default value is: NO.
+
+REFERENCES_RELATION    = NO
+
+# If the REFERENCES_LINK_SOURCE tag is set to YES and SOURCE_BROWSER tag is set
+# to YES then the hyperlinks from functions in REFERENCES_RELATION and
+# REFERENCED_BY_RELATION lists will link to the source code. Otherwise they will
+# link to the documentation.
+# The default value is: YES.
+
+REFERENCES_LINK_SOURCE = YES
+
+# If SOURCE_TOOLTIPS is enabled (the default) then hovering a hyperlink in the
+# source code will show a tooltip with additional information such as prototype,
+# brief description and links to the definition and documentation. Since this
+# will make the HTML file larger and loading of large files a bit slower, you
+# can opt to disable this feature.
+# The default value is: YES.
+# This tag requires that the tag SOURCE_BROWSER is set to YES.
+
+SOURCE_TOOLTIPS        = YES
+
+# If the USE_HTAGS tag is set to YES then the references to source code will
+# point to the HTML generated by the htags(1) tool instead of doxygen built-in
+# source browser. The htags tool is part of GNU's global source tagging system
+# (see https://www.gnu.org/software/global/global.html). You will need version
+# 4.8.6 or higher.
+#
+# To use it do the following:
+# - Install the latest version of global
+# - Enable SOURCE_BROWSER and USE_HTAGS in the configuration file
+# - Make sure the INPUT points to the root of the source tree
+# - Run doxygen as normal
+#
+# Doxygen will invoke htags (and that will in turn invoke gtags), so these
+# tools must be available from the command line (i.e. in the search path).
+#
+# The result: instead of the source browser generated by doxygen, the links to
+# source code will now point to the output of htags.
+# The default value is: NO.
+# This tag requires that the tag SOURCE_BROWSER is set to YES.
+
+USE_HTAGS              = NO
+
+# If the VERBATIM_HEADERS tag is set the YES then doxygen will generate a
+# verbatim copy of the header file for each class for which an include is
+# specified. Set to NO to disable this.
+# See also: Section \class.
+# The default value is: YES.
+
+VERBATIM_HEADERS       = YES
+
+# If the CLANG_ASSISTED_PARSING tag is set to YES then doxygen will use the
+# clang parser (see: http://clang.llvm.org/) for more accurate parsing at the
+# cost of reduced performance. This can be particularly helpful with template
+# rich C++ code for which doxygen's built-in parser lacks the necessary type
+# information.
+# Note: The availability of this option depends on whether or not doxygen was
+# generated with the -Duse_libclang=ON option for CMake.
+# The default value is: NO.
+
+CLANG_ASSISTED_PARSING = NO
+
+# If clang assisted parsing is enabled you can provide the compiler with command
+# line options that you would normally use when invoking the compiler. Note that
+# the include paths will already be set by doxygen for the files and directories
+# specified with INPUT and INCLUDE_PATH.
+# This tag requires that the tag CLANG_ASSISTED_PARSING is set to YES.
+
+CLANG_OPTIONS          =
+
+# If clang assisted parsing is enabled you can provide the clang parser with the
+# path to the compilation database (see:
+# http://clang.llvm.org/docs/HowToSetupToolingForLLVM.html) used when the files
+# were built. This is equivalent to specifying the "-p" option to a clang tool,
+# such as clang-check. These options will then be passed to the parser.
+# Note: The availability of this option depends on whether or not doxygen was
+# generated with the -Duse_libclang=ON option for CMake.
+
+CLANG_DATABASE_PATH    =
+
+#---------------------------------------------------------------------------
+# Configuration options related to the alphabetical class index
+#---------------------------------------------------------------------------
+
+# If the ALPHABETICAL_INDEX tag is set to YES, an alphabetical index of all
+# compounds will be generated. Enable this if the project contains a lot of
+# classes, structs, unions or interfaces.
+# The default value is: YES.
+
+ALPHABETICAL_INDEX     = YES
+
+# The COLS_IN_ALPHA_INDEX tag can be used to specify the number of columns in
+# which the alphabetical index list will be split.
+# Minimum value: 1, maximum value: 20, default value: 5.
+# This tag requires that the tag ALPHABETICAL_INDEX is set to YES.
+
+COLS_IN_ALPHA_INDEX    = 5
+
+# In case all classes in a project start with a common prefix, all classes will
+# be put under the same header in the alphabetical index. The IGNORE_PREFIX tag
+# can be used to specify a prefix (or a list of prefixes) that should be ignored
+# while generating the index headers.
+# This tag requires that the tag ALPHABETICAL_INDEX is set to YES.
+
+IGNORE_PREFIX          =
+
+#---------------------------------------------------------------------------
+# Configuration options related to the HTML output
+#---------------------------------------------------------------------------
+
+# If the GENERATE_HTML tag is set to YES, doxygen will generate HTML output
+# The default value is: YES.
+
+GENERATE_HTML          = YES
+
+# The HTML_OUTPUT tag is used to specify where the HTML docs will be put. If a
+# relative path is entered the value of OUTPUT_DIRECTORY will be put in front of
+# it.
+# The default directory is: html.
+# This tag requires that the tag GENERATE_HTML is set to YES.
+
+HTML_OUTPUT            = html
+
+# The HTML_FILE_EXTENSION tag can be used to specify the file extension for each
+# generated HTML page (for example: .htm, .php, .asp).
+# The default value is: .html.
+# This tag requires that the tag GENERATE_HTML is set to YES.
+
+HTML_FILE_EXTENSION    = .html
+
+# The HTML_HEADER tag can be used to specify a user-defined HTML header file for
+# each generated HTML page. If the tag is left blank doxygen will generate a
+# standard header.
+#
+# To get valid HTML the header file that includes any scripts and style sheets
+# that doxygen needs, which is dependent on the configuration options used (e.g.
+# the setting GENERATE_TREEVIEW). It is highly recommended to start with a
+# default header using
+# doxygen -w html new_header.html new_footer.html new_stylesheet.css
+# YourConfigFile
+# and then modify the file new_header.html. See also section "Doxygen usage"
+# for information on how to generate the default header that doxygen normally
+# uses.
+# Note: The header is subject to change so you typically have to regenerate the
+# default header when upgrading to a newer version of doxygen. For a description
+# of the possible markers and block names see the documentation.
+# This tag requires that the tag GENERATE_HTML is set to YES.
+
+HTML_HEADER            =
+
+# The HTML_FOOTER tag can be used to specify a user-defined HTML footer for each
+# generated HTML page. If the tag is left blank doxygen will generate a standard
+# footer. See HTML_HEADER for more information on how to generate a default
+# footer and what special commands can be used inside the footer. See also
+# section "Doxygen usage" for information on how to generate the default footer
+# that doxygen normally uses.
+# This tag requires that the tag GENERATE_HTML is set to YES.
+
+HTML_FOOTER            =
+
+# The HTML_STYLESHEET tag can be used to specify a user-defined cascading style
+# sheet that is used by each HTML page. It can be used to fine-tune the look of
+# the HTML output. If left blank doxygen will generate a default style sheet.
+# See also section "Doxygen usage" for information on how to generate the style
+# sheet that doxygen normally uses.
+# Note: It is recommended to use HTML_EXTRA_STYLESHEET instead of this tag, as
+# it is more robust and this tag (HTML_STYLESHEET) will in the future become
+# obsolete.
+# This tag requires that the tag GENERATE_HTML is set to YES.
+
+HTML_STYLESHEET        =
+
+# The HTML_EXTRA_STYLESHEET tag can be used to specify additional user-defined
+# cascading style sheets that are included after the standard style sheets
+# created by doxygen. Using this option one can overrule certain style aspects.
+# This is preferred over using HTML_STYLESHEET since it does not replace the
+# standard style sheet and is therefore more robust against future updates.
+# Doxygen will copy the style sheet files to the output directory.
+# Note: The order of the extra style sheet files is of importance (e.g. the last
+# style sheet in the list overrules the setting of the previous ones in the
+# list). For an example see the documentation.
+# This tag requires that the tag GENERATE_HTML is set to YES.
+
+HTML_EXTRA_STYLESHEET  =
+
+# The HTML_EXTRA_FILES tag can be used to specify one or more extra images or
+# other source files which should be copied to the HTML output directory. Note
+# that these files will be copied to the base HTML output directory. Use the
+# $relpath^ marker in the HTML_HEADER and/or HTML_FOOTER files to load these
+# files. In the HTML_STYLESHEET file, use the file name only. Also note that the
+# files will be copied as-is; there are no commands or markers available.
+# This tag requires that the tag GENERATE_HTML is set to YES.
+
+HTML_EXTRA_FILES       =
+
+# The HTML_COLORSTYLE_HUE tag controls the color of the HTML output. Doxygen
+# will adjust the colors in the style sheet and background images according to
+# this color. Hue is specified as an angle on a colorwheel, see
+# https://en.wikipedia.org/wiki/Hue for more information. For instance the value
+# 0 represents red, 60 is yellow, 120 is green, 180 is cyan, 240 is blue, 300
+# purple, and 360 is red again.
+# Minimum value: 0, maximum value: 359, default value: 220.
+# This tag requires that the tag GENERATE_HTML is set to YES.
+
+HTML_COLORSTYLE_HUE    = 220
+
+# The HTML_COLORSTYLE_SAT tag controls the purity (or saturation) of the colors
+# in the HTML output. For a value of 0 the output will use grayscales only. A
+# value of 255 will produce the most vivid colors.
+# Minimum value: 0, maximum value: 255, default value: 100.
+# This tag requires that the tag GENERATE_HTML is set to YES.
+
+HTML_COLORSTYLE_SAT    = 100
+
+# The HTML_COLORSTYLE_GAMMA tag controls the gamma correction applied to the
+# luminance component of the colors in the HTML output. Values below 100
+# gradually make the output lighter, whereas values above 100 make the output
+# darker. The value divided by 100 is the actual gamma applied, so 80 represents
+# a gamma of 0.8, The value 220 represents a gamma of 2.2, and 100 does not
+# change the gamma.
+# Minimum value: 40, maximum value: 240, default value: 80.
+# This tag requires that the tag GENERATE_HTML is set to YES.
+
+HTML_COLORSTYLE_GAMMA  = 80
+
+# If the HTML_TIMESTAMP tag is set to YES then the footer of each generated HTML
+# page will contain the date and time when the page was generated. Setting this
+# to YES can help to show when doxygen was last run and thus if the
+# documentation is up to date.
+# The default value is: NO.
+# This tag requires that the tag GENERATE_HTML is set to YES.
+
+HTML_TIMESTAMP         = NO
+
+# If the HTML_DYNAMIC_MENUS tag is set to YES then the generated HTML
+# documentation will contain a main index with vertical navigation menus that
+# are dynamically created via Javascript. If disabled, the navigation index will
+# consists of multiple levels of tabs that are statically embedded in every HTML
+# page. Disable this option to support browsers that do not have Javascript,
+# like the Qt help browser.
+# The default value is: YES.
+# This tag requires that the tag GENERATE_HTML is set to YES.
+
+HTML_DYNAMIC_MENUS     = YES
+
+# If the HTML_DYNAMIC_SECTIONS tag is set to YES then the generated HTML
+# documentation will contain sections that can be hidden and shown after the
+# page has loaded.
+# The default value is: NO.
+# This tag requires that the tag GENERATE_HTML is set to YES.
+
+HTML_DYNAMIC_SECTIONS  = NO
+
+# With HTML_INDEX_NUM_ENTRIES one can control the preferred number of entries
+# shown in the various tree structured indices initially; the user can expand
+# and collapse entries dynamically later on. Doxygen will expand the tree to
+# such a level that at most the specified number of entries are visible (unless
+# a fully collapsed tree already exceeds this amount). So setting the number of
+# entries 1 will produce a full collapsed tree by default. 0 is a special value
+# representing an infinite number of entries and will result in a full expanded
+# tree by default.
+# Minimum value: 0, maximum value: 9999, default value: 100.
+# This tag requires that the tag GENERATE_HTML is set to YES.
+
+HTML_INDEX_NUM_ENTRIES = 100
+
+# If the GENERATE_DOCSET tag is set to YES, additional index files will be
+# generated that can be used as input for Apple's Xcode 3 integrated development
+# environment (see: https://developer.apple.com/xcode/), introduced with OSX
+# 10.5 (Leopard). To create a documentation set, doxygen will generate a
+# Makefile in the HTML output directory. Running make will produce the docset in
+# that directory and running make install will install the docset in
+# ~/Library/Developer/Shared/Documentation/DocSets so that Xcode will find it at
+# startup. See https://developer.apple.com/library/archive/featuredarticles/Doxy
+# genXcode/_index.html for more information.
+# The default value is: NO.
+# This tag requires that the tag GENERATE_HTML is set to YES.
+
+GENERATE_DOCSET        = NO
+
+# This tag determines the name of the docset feed. A documentation feed provides
+# an umbrella under which multiple documentation sets from a single provider
+# (such as a company or product suite) can be grouped.
+# The default value is: Doxygen generated docs.
+# This tag requires that the tag GENERATE_DOCSET is set to YES.
+
+DOCSET_FEEDNAME        = "Doxygen generated docs"
+
+# This tag specifies a string that should uniquely identify the documentation
+# set bundle. This should be a reverse domain-name style string, e.g.
+# com.mycompany.MyDocSet. Doxygen will append .docset to the name.
+# The default value is: org.doxygen.Project.
+# This tag requires that the tag GENERATE_DOCSET is set to YES.
+
+DOCSET_BUNDLE_ID       = org.doxygen.Project
+
+# The DOCSET_PUBLISHER_ID tag specifies a string that should uniquely identify
+# the documentation publisher. This should be a reverse domain-name style
+# string, e.g. com.mycompany.MyDocSet.documentation.
+# The default value is: org.doxygen.Publisher.
+# This tag requires that the tag GENERATE_DOCSET is set to YES.
+
+DOCSET_PUBLISHER_ID    = org.doxygen.Publisher
+
+# The DOCSET_PUBLISHER_NAME tag identifies the documentation publisher.
+# The default value is: Publisher.
+# This tag requires that the tag GENERATE_DOCSET is set to YES.
+
+DOCSET_PUBLISHER_NAME  = Publisher
+
+# If the GENERATE_HTMLHELP tag is set to YES then doxygen generates three
+# additional HTML index files: index.hhp, index.hhc, and index.hhk. The
+# index.hhp is a project file that can be read by Microsoft's HTML Help Workshop
+# (see: https://www.microsoft.com/en-us/download/details.aspx?id=21138) on
+# Windows.
+#
+# The HTML Help Workshop contains a compiler that can convert all HTML output
+# generated by doxygen into a single compiled HTML file (.chm). Compiled HTML
+# files are now used as the Windows 98 help format, and will replace the old
+# Windows help format (.hlp) on all Windows platforms in the future. Compressed
+# HTML files also contain an index, a table of contents, and you can search for
+# words in the documentation. The HTML workshop also contains a viewer for
+# compressed HTML files.
+# The default value is: NO.
+# This tag requires that the tag GENERATE_HTML is set to YES.
+
+GENERATE_HTMLHELP      = YES
+
+# The CHM_FILE tag can be used to specify the file name of the resulting .chm
+# file. You can add a path in front of the file if the result should not be
+# written to the html output directory.
+# This tag requires that the tag GENERATE_HTMLHELP is set to YES.
+
+CHM_FILE               =
+
+# The HHC_LOCATION tag can be used to specify the location (absolute path
+# including file name) of the HTML help compiler (hhc.exe). If non-empty,
+# doxygen will try to run the HTML help compiler on the generated index.hhp.
+# The file has to be specified with full path.
+# This tag requires that the tag GENERATE_HTMLHELP is set to YES.
+
+HHC_LOCATION           = "C:/Program Files (x86)/HTML Help Workshop/hhc.exe"
+
+# The GENERATE_CHI flag controls if a separate .chi index file is generated
+# (YES) or that it should be included in the master .chm file (NO).
+# The default value is: NO.
+# This tag requires that the tag GENERATE_HTMLHELP is set to YES.
+
+GENERATE_CHI           = NO
+
+# The CHM_INDEX_ENCODING is used to encode HtmlHelp index (hhk), content (hhc)
+# and project file content.
+# This tag requires that the tag GENERATE_HTMLHELP is set to YES.
+
+CHM_INDEX_ENCODING     = GBK
+
+# The BINARY_TOC flag controls whether a binary table of contents is generated
+# (YES) or a normal table of contents (NO) in the .chm file. Furthermore it
+# enables the Previous and Next buttons.
+# The default value is: NO.
+# This tag requires that the tag GENERATE_HTMLHELP is set to YES.
+
+BINARY_TOC             = NO
+
+# The TOC_EXPAND flag can be set to YES to add extra items for group members to
+# the table of contents of the HTML help documentation and to the tree view.
+# The default value is: NO.
+# This tag requires that the tag GENERATE_HTMLHELP is set to YES.
+
+TOC_EXPAND             = NO
+
+# If the GENERATE_QHP tag is set to YES and both QHP_NAMESPACE and
+# QHP_VIRTUAL_FOLDER are set, an additional index file will be generated that
+# can be used as input for Qt's qhelpgenerator to generate a Qt Compressed Help
+# (.qch) of the generated HTML documentation.
+# The default value is: NO.
+# This tag requires that the tag GENERATE_HTML is set to YES.
+
+GENERATE_QHP           = NO
+
+# If the QHG_LOCATION tag is specified, the QCH_FILE tag can be used to specify
+# the file name of the resulting .qch file. The path specified is relative to
+# the HTML output folder.
+# This tag requires that the tag GENERATE_QHP is set to YES.
+
+QCH_FILE               =
+
+# The QHP_NAMESPACE tag specifies the namespace to use when generating Qt Help
+# Project output. For more information please see Qt Help Project / Namespace
+# (see: https://doc.qt.io/archives/qt-4.8/qthelpproject.html#namespace).
+# The default value is: org.doxygen.Project.
+# This tag requires that the tag GENERATE_QHP is set to YES.
+
+QHP_NAMESPACE          = org.doxygen.Project
+
+# The QHP_VIRTUAL_FOLDER tag specifies the namespace to use when generating Qt
+# Help Project output. For more information please see Qt Help Project / Virtual
+# Folders (see: https://doc.qt.io/archives/qt-4.8/qthelpproject.html#virtual-
+# folders).
+# The default value is: doc.
+# This tag requires that the tag GENERATE_QHP is set to YES.
+
+QHP_VIRTUAL_FOLDER     = doc
+
+# If the QHP_CUST_FILTER_NAME tag is set, it specifies the name of a custom
+# filter to add. For more information please see Qt Help Project / Custom
+# Filters (see: https://doc.qt.io/archives/qt-4.8/qthelpproject.html#custom-
+# filters).
+# This tag requires that the tag GENERATE_QHP is set to YES.
+
+QHP_CUST_FILTER_NAME   =
+
+# The QHP_CUST_FILTER_ATTRS tag specifies the list of the attributes of the
+# custom filter to add. For more information please see Qt Help Project / Custom
+# Filters (see: https://doc.qt.io/archives/qt-4.8/qthelpproject.html#custom-
+# filters).
+# This tag requires that the tag GENERATE_QHP is set to YES.
+
+QHP_CUST_FILTER_ATTRS  =
+
+# The QHP_SECT_FILTER_ATTRS tag specifies the list of the attributes this
+# project's filter section matches. Qt Help Project / Filter Attributes (see:
+# https://doc.qt.io/archives/qt-4.8/qthelpproject.html#filter-attributes).
+# This tag requires that the tag GENERATE_QHP is set to YES.
+
+QHP_SECT_FILTER_ATTRS  =
+
+# The QHG_LOCATION tag can be used to specify the location of Qt's
+# qhelpgenerator. If non-empty doxygen will try to run qhelpgenerator on the
+# generated .qhp file.
+# This tag requires that the tag GENERATE_QHP is set to YES.
+
+QHG_LOCATION           =
+
+# If the GENERATE_ECLIPSEHELP tag is set to YES, additional index files will be
+# generated, together with the HTML files, they form an Eclipse help plugin. To
+# install this plugin and make it available under the help contents menu in
+# Eclipse, the contents of the directory containing the HTML and XML files needs
+# to be copied into the plugins directory of eclipse. The name of the directory
+# within the plugins directory should be the same as the ECLIPSE_DOC_ID value.
+# After copying Eclipse needs to be restarted before the help appears.
+# The default value is: NO.
+# This tag requires that the tag GENERATE_HTML is set to YES.
+
+GENERATE_ECLIPSEHELP   = NO
+
+# A unique identifier for the Eclipse help plugin. When installing the plugin
+# the directory name containing the HTML and XML files should also have this
+# name. Each documentation set should have its own identifier.
+# The default value is: org.doxygen.Project.
+# This tag requires that the tag GENERATE_ECLIPSEHELP is set to YES.
+
+ECLIPSE_DOC_ID         = org.doxygen.Project
+
+# If you want full control over the layout of the generated HTML pages it might
+# be necessary to disable the index and replace it with your own. The
+# DISABLE_INDEX tag can be used to turn on/off the condensed index (tabs) at top
+# of each HTML page. A value of NO enables the index and the value YES disables
+# it. Since the tabs in the index contain the same information as the navigation
+# tree, you can set this option to YES if you also set GENERATE_TREEVIEW to YES.
+# The default value is: NO.
+# This tag requires that the tag GENERATE_HTML is set to YES.
+
+DISABLE_INDEX          = NO
+
+# The GENERATE_TREEVIEW tag is used to specify whether a tree-like index
+# structure should be generated to display hierarchical information. If the tag
+# value is set to YES, a side panel will be generated containing a tree-like
+# index structure (just like the one that is generated for HTML Help). For this
+# to work a browser that supports JavaScript, DHTML, CSS and frames is required
+# (i.e. any modern browser). Windows users are probably better off using the
+# HTML help feature. Via custom style sheets (see HTML_EXTRA_STYLESHEET) one can
+# further fine-tune the look of the index. As an example, the default style
+# sheet generated by doxygen has an example that shows how to put an image at
+# the root of the tree instead of the PROJECT_NAME. Since the tree basically has
+# the same information as the tab index, you could consider setting
+# DISABLE_INDEX to YES when enabling this option.
+# The default value is: NO.
+# This tag requires that the tag GENERATE_HTML is set to YES.
+
+GENERATE_TREEVIEW      = NO
+
+# The ENUM_VALUES_PER_LINE tag can be used to set the number of enum values that
+# doxygen will group on one line in the generated HTML documentation.
+#
+# Note that a value of 0 will completely suppress the enum values from appearing
+# in the overview section.
+# Minimum value: 0, maximum value: 20, default value: 4.
+# This tag requires that the tag GENERATE_HTML is set to YES.
+
+ENUM_VALUES_PER_LINE   = 4
+
+# If the treeview is enabled (see GENERATE_TREEVIEW) then this tag can be used
+# to set the initial width (in pixels) of the frame in which the tree is shown.
+# Minimum value: 0, maximum value: 1500, default value: 250.
+# This tag requires that the tag GENERATE_HTML is set to YES.
+
+TREEVIEW_WIDTH         = 250
+
+# If the EXT_LINKS_IN_WINDOW option is set to YES, doxygen will open links to
+# external symbols imported via tag files in a separate window.
+# The default value is: NO.
+# This tag requires that the tag GENERATE_HTML is set to YES.
+
+EXT_LINKS_IN_WINDOW    = NO
+
+# Use this tag to change the font size of LaTeX formulas included as images in
+# the HTML documentation. When you change the font size after a successful
+# doxygen run you need to manually remove any form_*.png images from the HTML
+# output directory to force them to be regenerated.
+# Minimum value: 8, maximum value: 50, default value: 10.
+# This tag requires that the tag GENERATE_HTML is set to YES.
+
+FORMULA_FONTSIZE       = 10
+
+# Use the FORMULA_TRANSPARENT tag to determine whether or not the images
+# generated for formulas are transparent PNGs. Transparent PNGs are not
+# supported properly for IE 6.0, but are supported on all modern browsers.
+#
+# Note that when changing this option you need to delete any form_*.png files in
+# the HTML output directory before the changes have effect.
+# The default value is: YES.
+# This tag requires that the tag GENERATE_HTML is set to YES.
+
+FORMULA_TRANSPARENT    = YES
+
+# Enable the USE_MATHJAX option to render LaTeX formulas using MathJax (see
+# https://www.mathjax.org) which uses client side Javascript for the rendering
+# instead of using pre-rendered bitmaps. Use this if you do not have LaTeX
+# installed or if you want to formulas look prettier in the HTML output. When
+# enabled you may also need to install MathJax separately and configure the path
+# to it using the MATHJAX_RELPATH option.
+# The default value is: NO.
+# This tag requires that the tag GENERATE_HTML is set to YES.
+
+USE_MATHJAX            = NO
+
+# When MathJax is enabled you can set the default output format to be used for
+# the MathJax output. See the MathJax site (see:
+# http://docs.mathjax.org/en/latest/output.html) for more details.
+# Possible values are: HTML-CSS (which is slower, but has the best
+# compatibility), NativeMML (i.e. MathML) and SVG.
+# The default value is: HTML-CSS.
+# This tag requires that the tag USE_MATHJAX is set to YES.
+
+MATHJAX_FORMAT         = HTML-CSS
+
+# When MathJax is enabled you need to specify the location relative to the HTML
+# output directory using the MATHJAX_RELPATH option. The destination directory
+# should contain the MathJax.js script. For instance, if the mathjax directory
+# is located at the same level as the HTML output directory, then
+# MATHJAX_RELPATH should be ../mathjax. The default value points to the MathJax
+# Content Delivery Network so you can quickly see the result without installing
+# MathJax. However, it is strongly recommended to install a local copy of
+# MathJax from https://www.mathjax.org before deployment.
+# The default value is: https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.5/.
+# This tag requires that the tag USE_MATHJAX is set to YES.
+
+MATHJAX_RELPATH        = https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.5/
+
+# The MATHJAX_EXTENSIONS tag can be used to specify one or more MathJax
+# extension names that should be enabled during MathJax rendering. For example
+# MATHJAX_EXTENSIONS = TeX/AMSmath TeX/AMSsymbols
+# This tag requires that the tag USE_MATHJAX is set to YES.
+
+MATHJAX_EXTENSIONS     =
+
+# The MATHJAX_CODEFILE tag can be used to specify a file with javascript pieces
+# of code that will be used on startup of the MathJax code. See the MathJax site
+# (see: http://docs.mathjax.org/en/latest/output.html) for more details. For an
+# example see the documentation.
+# This tag requires that the tag USE_MATHJAX is set to YES.
+
+MATHJAX_CODEFILE       =
+
+# When the SEARCHENGINE tag is enabled doxygen will generate a search box for
+# the HTML output. The underlying search engine uses javascript and DHTML and
+# should work on any modern browser. Note that when using HTML help
+# (GENERATE_HTMLHELP), Qt help (GENERATE_QHP), or docsets (GENERATE_DOCSET)
+# there is already a search function so this one should typically be disabled.
+# For large projects the javascript based search engine can be slow, then
+# enabling SERVER_BASED_SEARCH may provide a better solution. It is possible to
+# search using the keyboard; to jump to the search box use <access key> + S
+# (what the <access key> is depends on the OS and browser, but it is typically
+# <CTRL>, <ALT>/<option>, or both). Inside the search box use the <cursor down
+# key> to jump into the search results window, the results can be navigated
+# using the <cursor keys>. Press <Enter> to select an item or <escape> to cancel
+# the search. The filter options can be selected when the cursor is inside the
+# search box by pressing <Shift>+<cursor down>. Also here use the <cursor keys>
+# to select a filter and <Enter> or <escape> to activate or cancel the filter
+# option.
+# The default value is: YES.
+# This tag requires that the tag GENERATE_HTML is set to YES.
+
+SEARCHENGINE           = YES
+
+# When the SERVER_BASED_SEARCH tag is enabled the search engine will be
+# implemented using a web server instead of a web client using Javascript. There
+# are two flavors of web server based searching depending on the EXTERNAL_SEARCH
+# setting. When disabled, doxygen will generate a PHP script for searching and
+# an index file used by the script. When EXTERNAL_SEARCH is enabled the indexing
+# and searching needs to be provided by external tools. See the section
+# "External Indexing and Searching" for details.
+# The default value is: NO.
+# This tag requires that the tag SEARCHENGINE is set to YES.
+
+SERVER_BASED_SEARCH    = NO
+
+# When EXTERNAL_SEARCH tag is enabled doxygen will no longer generate the PHP
+# script for searching. Instead the search results are written to an XML file
+# which needs to be processed by an external indexer. Doxygen will invoke an
+# external search engine pointed to by the SEARCHENGINE_URL option to obtain the
+# search results.
+#
+# Doxygen ships with an example indexer (doxyindexer) and search engine
+# (doxysearch.cgi) which are based on the open source search engine library
+# Xapian (see: https://xapian.org/).
+#
+# See the section "External Indexing and Searching" for details.
+# The default value is: NO.
+# This tag requires that the tag SEARCHENGINE is set to YES.
+
+EXTERNAL_SEARCH        = NO
+
+# The SEARCHENGINE_URL should point to a search engine hosted by a web server
+# which will return the search results when EXTERNAL_SEARCH is enabled.
+#
+# Doxygen ships with an example indexer (doxyindexer) and search engine
+# (doxysearch.cgi) which are based on the open source search engine library
+# Xapian (see: https://xapian.org/). See the section "External Indexing and
+# Searching" for details.
+# This tag requires that the tag SEARCHENGINE is set to YES.
+
+SEARCHENGINE_URL       =
+
+# When SERVER_BASED_SEARCH and EXTERNAL_SEARCH are both enabled the unindexed
+# search data is written to a file for indexing by an external tool. With the
+# SEARCHDATA_FILE tag the name of this file can be specified.
+# The default file is: searchdata.xml.
+# This tag requires that the tag SEARCHENGINE is set to YES.
+
+SEARCHDATA_FILE        = searchdata.xml
+
+# When SERVER_BASED_SEARCH and EXTERNAL_SEARCH are both enabled the
+# EXTERNAL_SEARCH_ID tag can be used as an identifier for the project. This is
+# useful in combination with EXTRA_SEARCH_MAPPINGS to search through multiple
+# projects and redirect the results back to the right project.
+# This tag requires that the tag SEARCHENGINE is set to YES.
+
+EXTERNAL_SEARCH_ID     =
+
+# The EXTRA_SEARCH_MAPPINGS tag can be used to enable searching through doxygen
+# projects other than the one defined by this configuration file, but that are
+# all added to the same external search index. Each project needs to have a
+# unique id set via EXTERNAL_SEARCH_ID. The search mapping then maps the id of
+# to a relative location where the documentation can be found. The format is:
+# EXTRA_SEARCH_MAPPINGS = tagname1=loc1 tagname2=loc2 ...
+# This tag requires that the tag SEARCHENGINE is set to YES.
+
+EXTRA_SEARCH_MAPPINGS  =
+
+#---------------------------------------------------------------------------
+# Configuration options related to the LaTeX output
+#---------------------------------------------------------------------------
+
+# If the GENERATE_LATEX tag is set to YES, doxygen will generate LaTeX output.
+# The default value is: YES.
+
+GENERATE_LATEX         = NO
+
+# The LATEX_OUTPUT tag is used to specify where the LaTeX docs will be put. If a
+# relative path is entered the value of OUTPUT_DIRECTORY will be put in front of
+# it.
+# The default directory is: latex.
+# This tag requires that the tag GENERATE_LATEX is set to YES.
+
+LATEX_OUTPUT           = latex
+
+# The LATEX_CMD_NAME tag can be used to specify the LaTeX command name to be
+# invoked.
+#
+# Note that when not enabling USE_PDFLATEX the default is latex when enabling
+# USE_PDFLATEX the default is pdflatex and when in the later case latex is
+# chosen this is overwritten by pdflatex. For specific output languages the
+# default can have been set differently, this depends on the implementation of
+# the output language.
+# This tag requires that the tag GENERATE_LATEX is set to YES.
+
+LATEX_CMD_NAME         =
+
+# The MAKEINDEX_CMD_NAME tag can be used to specify the command name to generate
+# index for LaTeX.
+# Note: This tag is used in the Makefile / make.bat.
+# See also: LATEX_MAKEINDEX_CMD for the part in the generated output file
+# (.tex).
+# The default file is: makeindex.
+# This tag requires that the tag GENERATE_LATEX is set to YES.
+
+MAKEINDEX_CMD_NAME     = makeindex
+
+# The LATEX_MAKEINDEX_CMD tag can be used to specify the command name to
+# generate index for LaTeX. In case there is no backslash (\) as first character
+# it will be automatically added in the LaTeX code.
+# Note: This tag is used in the generated output file (.tex).
+# See also: MAKEINDEX_CMD_NAME for the part in the Makefile / make.bat.
+# The default value is: makeindex.
+# This tag requires that the tag GENERATE_LATEX is set to YES.
+
+LATEX_MAKEINDEX_CMD    = \makeindex
+
+# If the COMPACT_LATEX tag is set to YES, doxygen generates more compact LaTeX
+# documents. This may be useful for small projects and may help to save some
+# trees in general.
+# The default value is: NO.
+# This tag requires that the tag GENERATE_LATEX is set to YES.
+
+COMPACT_LATEX          = NO
+
+# The PAPER_TYPE tag can be used to set the paper type that is used by the
+# printer.
+# Possible values are: a4 (210 x 297 mm), letter (8.5 x 11 inches), legal (8.5 x
+# 14 inches) and executive (7.25 x 10.5 inches).
+# The default value is: a4.
+# This tag requires that the tag GENERATE_LATEX is set to YES.
+
+PAPER_TYPE             = a4
+
+# The EXTRA_PACKAGES tag can be used to specify one or more LaTeX package names
+# that should be included in the LaTeX output. The package can be specified just
+# by its name or with the correct syntax as to be used with the LaTeX
+# \usepackage command. To get the times font for instance you can specify :
+# EXTRA_PACKAGES=times or EXTRA_PACKAGES={times}
+# To use the option intlimits with the amsmath package you can specify:
+# EXTRA_PACKAGES=[intlimits]{amsmath}
+# If left blank no extra packages will be included.
+# This tag requires that the tag GENERATE_LATEX is set to YES.
+
+EXTRA_PACKAGES         =
+
+# The LATEX_HEADER tag can be used to specify a personal LaTeX header for the
+# generated LaTeX document. The header should contain everything until the first
+# chapter. If it is left blank doxygen will generate a standard header. See
+# section "Doxygen usage" for information on how to let doxygen write the
+# default header to a separate file.
+#
+# Note: Only use a user-defined header if you know what you are doing! The
+# following commands have a special meaning inside the header: $title,
+# $datetime, $date, $doxygenversion, $projectname, $projectnumber,
+# $projectbrief, $projectlogo. Doxygen will replace $title with the empty
+# string, for the replacement values of the other commands the user is referred
+# to HTML_HEADER.
+# This tag requires that the tag GENERATE_LATEX is set to YES.
+
+LATEX_HEADER           =
+
+# The LATEX_FOOTER tag can be used to specify a personal LaTeX footer for the
+# generated LaTeX document. The footer should contain everything after the last
+# chapter. If it is left blank doxygen will generate a standard footer. See
+# LATEX_HEADER for more information on how to generate a default footer and what
+# special commands can be used inside the footer.
+#
+# Note: Only use a user-defined footer if you know what you are doing!
+# This tag requires that the tag GENERATE_LATEX is set to YES.
+
+LATEX_FOOTER           =
+
+# The LATEX_EXTRA_STYLESHEET tag can be used to specify additional user-defined
+# LaTeX style sheets that are included after the standard style sheets created
+# by doxygen. Using this option one can overrule certain style aspects. Doxygen
+# will copy the style sheet files to the output directory.
+# Note: The order of the extra style sheet files is of importance (e.g. the last
+# style sheet in the list overrules the setting of the previous ones in the
+# list).
+# This tag requires that the tag GENERATE_LATEX is set to YES.
+
+LATEX_EXTRA_STYLESHEET =
+
+# The LATEX_EXTRA_FILES tag can be used to specify one or more extra images or
+# other source files which should be copied to the LATEX_OUTPUT output
+# directory. Note that the files will be copied as-is; there are no commands or
+# markers available.
+# This tag requires that the tag GENERATE_LATEX is set to YES.
+
+LATEX_EXTRA_FILES      =
+
+# If the PDF_HYPERLINKS tag is set to YES, the LaTeX that is generated is
+# prepared for conversion to PDF (using ps2pdf or pdflatex). The PDF file will
+# contain links (just like the HTML output) instead of page references. This
+# makes the output suitable for online browsing using a PDF viewer.
+# The default value is: YES.
+# This tag requires that the tag GENERATE_LATEX is set to YES.
+
+PDF_HYPERLINKS         = YES
+
+# If the USE_PDFLATEX tag is set to YES, doxygen will use pdflatex to generate
+# the PDF file directly from the LaTeX files. Set this option to YES, to get a
+# higher quality PDF documentation.
+# The default value is: YES.
+# This tag requires that the tag GENERATE_LATEX is set to YES.
+
+USE_PDFLATEX           = YES
+
+# If the LATEX_BATCHMODE tag is set to YES, doxygen will add the \batchmode
+# command to the generated LaTeX files. This will instruct LaTeX to keep running
+# if errors occur, instead of asking the user for help. This option is also used
+# when generating formulas in HTML.
+# The default value is: NO.
+# This tag requires that the tag GENERATE_LATEX is set to YES.
+
+LATEX_BATCHMODE        = NO
+
+# If the LATEX_HIDE_INDICES tag is set to YES then doxygen will not include the
+# index chapters (such as File Index, Compound Index, etc.) in the output.
+# The default value is: NO.
+# This tag requires that the tag GENERATE_LATEX is set to YES.
+
+LATEX_HIDE_INDICES     = NO
+
+# If the LATEX_SOURCE_CODE tag is set to YES then doxygen will include source
+# code with syntax highlighting in the LaTeX output.
+#
+# Note that which sources are shown also depends on other settings such as
+# SOURCE_BROWSER.
+# The default value is: NO.
+# This tag requires that the tag GENERATE_LATEX is set to YES.
+
+LATEX_SOURCE_CODE      = NO
+
+# The LATEX_BIB_STYLE tag can be used to specify the style to use for the
+# bibliography, e.g. plainnat, or ieeetr. See
+# https://en.wikipedia.org/wiki/BibTeX and \cite for more info.
+# The default value is: plain.
+# This tag requires that the tag GENERATE_LATEX is set to YES.
+
+LATEX_BIB_STYLE        = plain
+
+# If the LATEX_TIMESTAMP tag is set to YES then the footer of each generated
+# page will contain the date and time when the page was generated. Setting this
+# to NO can help when comparing the output of multiple runs.
+# The default value is: NO.
+# This tag requires that the tag GENERATE_LATEX is set to YES.
+
+LATEX_TIMESTAMP        = NO
+
+# The LATEX_EMOJI_DIRECTORY tag is used to specify the (relative or absolute)
+# path from which the emoji images will be read. If a relative path is entered,
+# it will be relative to the LATEX_OUTPUT directory. If left blank the
+# LATEX_OUTPUT directory will be used.
+# This tag requires that the tag GENERATE_LATEX is set to YES.
+
+LATEX_EMOJI_DIRECTORY  =
+
+#---------------------------------------------------------------------------
+# Configuration options related to the RTF output
+#---------------------------------------------------------------------------
+
+# If the GENERATE_RTF tag is set to YES, doxygen will generate RTF output. The
+# RTF output is optimized for Word 97 and may not look too pretty with other RTF
+# readers/editors.
+# The default value is: NO.
+
+GENERATE_RTF           = NO
+
+# The RTF_OUTPUT tag is used to specify where the RTF docs will be put. If a
+# relative path is entered the value of OUTPUT_DIRECTORY will be put in front of
+# it.
+# The default directory is: rtf.
+# This tag requires that the tag GENERATE_RTF is set to YES.
+
+RTF_OUTPUT             = rtf
+
+# If the COMPACT_RTF tag is set to YES, doxygen generates more compact RTF
+# documents. This may be useful for small projects and may help to save some
+# trees in general.
+# The default value is: NO.
+# This tag requires that the tag GENERATE_RTF is set to YES.
+
+COMPACT_RTF            = NO
+
+# If the RTF_HYPERLINKS tag is set to YES, the RTF that is generated will
+# contain hyperlink fields. The RTF file will contain links (just like the HTML
+# output) instead of page references. This makes the output suitable for online
+# browsing using Word or some other Word compatible readers that support those
+# fields.
+#
+# Note: WordPad (write) and others do not support links.
+# The default value is: NO.
+# This tag requires that the tag GENERATE_RTF is set to YES.
+
+RTF_HYPERLINKS         = NO
+
+# Load stylesheet definitions from file. Syntax is similar to doxygen's
+# configuration file, i.e. a series of assignments. You only have to provide
+# replacements, missing definitions are set to their default value.
+#
+# See also section "Doxygen usage" for information on how to generate the
+# default style sheet that doxygen normally uses.
+# This tag requires that the tag GENERATE_RTF is set to YES.
+
+RTF_STYLESHEET_FILE    =
+
+# Set optional variables used in the generation of an RTF document. Syntax is
+# similar to doxygen's configuration file. A template extensions file can be
+# generated using doxygen -e rtf extensionFile.
+# This tag requires that the tag GENERATE_RTF is set to YES.
+
+RTF_EXTENSIONS_FILE    =
+
+# If the RTF_SOURCE_CODE tag is set to YES then doxygen will include source code
+# with syntax highlighting in the RTF output.
+#
+# Note that which sources are shown also depends on other settings such as
+# SOURCE_BROWSER.
+# The default value is: NO.
+# This tag requires that the tag GENERATE_RTF is set to YES.
+
+RTF_SOURCE_CODE        = NO
+
+#---------------------------------------------------------------------------
+# Configuration options related to the man page output
+#---------------------------------------------------------------------------
+
+# If the GENERATE_MAN tag is set to YES, doxygen will generate man pages for
+# classes and files.
+# The default value is: NO.
+
+GENERATE_MAN           = NO
+
+# The MAN_OUTPUT tag is used to specify where the man pages will be put. If a
+# relative path is entered the value of OUTPUT_DIRECTORY will be put in front of
+# it. A directory man3 will be created inside the directory specified by
+# MAN_OUTPUT.
+# The default directory is: man.
+# This tag requires that the tag GENERATE_MAN is set to YES.
+
+MAN_OUTPUT             = man
+
+# The MAN_EXTENSION tag determines the extension that is added to the generated
+# man pages. In case the manual section does not start with a number, the number
+# 3 is prepended. The dot (.) at the beginning of the MAN_EXTENSION tag is
+# optional.
+# The default value is: .3.
+# This tag requires that the tag GENERATE_MAN is set to YES.
+
+MAN_EXTENSION          = .3
+
+# The MAN_SUBDIR tag determines the name of the directory created within
+# MAN_OUTPUT in which the man pages are placed. If defaults to man followed by
+# MAN_EXTENSION with the initial . removed.
+# This tag requires that the tag GENERATE_MAN is set to YES.
+
+MAN_SUBDIR             =
+
+# If the MAN_LINKS tag is set to YES and doxygen generates man output, then it
+# will generate one additional man file for each entity documented in the real
+# man page(s). These additional files only source the real man page, but without
+# them the man command would be unable to find the correct page.
+# The default value is: NO.
+# This tag requires that the tag GENERATE_MAN is set to YES.
+
+MAN_LINKS              = NO
+
+#---------------------------------------------------------------------------
+# Configuration options related to the XML output
+#---------------------------------------------------------------------------
+
+# If the GENERATE_XML tag is set to YES, doxygen will generate an XML file that
+# captures the structure of the code including all documentation.
+# The default value is: NO.
+
+GENERATE_XML           = NO
+
+# The XML_OUTPUT tag is used to specify where the XML pages will be put. If a
+# relative path is entered the value of OUTPUT_DIRECTORY will be put in front of
+# it.
+# The default directory is: xml.
+# This tag requires that the tag GENERATE_XML is set to YES.
+
+XML_OUTPUT             = xml
+
+# If the XML_PROGRAMLISTING tag is set to YES, doxygen will dump the program
+# listings (including syntax highlighting and cross-referencing information) to
+# the XML output. Note that enabling this will significantly increase the size
+# of the XML output.
+# The default value is: YES.
+# This tag requires that the tag GENERATE_XML is set to YES.
+
+XML_PROGRAMLISTING     = YES
+
+# If the XML_NS_MEMB_FILE_SCOPE tag is set to YES, doxygen will include
+# namespace members in file scope as well, matching the HTML output.
+# The default value is: NO.
+# This tag requires that the tag GENERATE_XML is set to YES.
+
+XML_NS_MEMB_FILE_SCOPE = NO
+
+#---------------------------------------------------------------------------
+# Configuration options related to the DOCBOOK output
+#---------------------------------------------------------------------------
+
+# If the GENERATE_DOCBOOK tag is set to YES, doxygen will generate Docbook files
+# that can be used to generate PDF.
+# The default value is: NO.
+
+GENERATE_DOCBOOK       = NO
+
+# The DOCBOOK_OUTPUT tag is used to specify where the Docbook pages will be put.
+# If a relative path is entered the value of OUTPUT_DIRECTORY will be put in
+# front of it.
+# The default directory is: docbook.
+# This tag requires that the tag GENERATE_DOCBOOK is set to YES.
+
+DOCBOOK_OUTPUT         = docbook
+
+# If the DOCBOOK_PROGRAMLISTING tag is set to YES, doxygen will include the
+# program listings (including syntax highlighting and cross-referencing
+# information) to the DOCBOOK output. Note that enabling this will significantly
+# increase the size of the DOCBOOK output.
+# The default value is: NO.
+# This tag requires that the tag GENERATE_DOCBOOK is set to YES.
+
+DOCBOOK_PROGRAMLISTING = NO
+
+#---------------------------------------------------------------------------
+# Configuration options for the AutoGen Definitions output
+#---------------------------------------------------------------------------
+
+# If the GENERATE_AUTOGEN_DEF tag is set to YES, doxygen will generate an
+# AutoGen Definitions (see http://autogen.sourceforge.net/) file that captures
+# the structure of the code including all documentation. Note that this feature
+# is still experimental and incomplete at the moment.
+# The default value is: NO.
+
+GENERATE_AUTOGEN_DEF   = NO
+
+#---------------------------------------------------------------------------
+# Configuration options related to the Perl module output
+#---------------------------------------------------------------------------
+
+# If the GENERATE_PERLMOD tag is set to YES, doxygen will generate a Perl module
+# file that captures the structure of the code including all documentation.
+#
+# Note that this feature is still experimental and incomplete at the moment.
+# The default value is: NO.
+
+GENERATE_PERLMOD       = NO
+
+# If the PERLMOD_LATEX tag is set to YES, doxygen will generate the necessary
+# Makefile rules, Perl scripts and LaTeX code to be able to generate PDF and DVI
+# output from the Perl module output.
+# The default value is: NO.
+# This tag requires that the tag GENERATE_PERLMOD is set to YES.
+
+PERLMOD_LATEX          = NO
+
+# If the PERLMOD_PRETTY tag is set to YES, the Perl module output will be nicely
+# formatted so it can be parsed by a human reader. This is useful if you want to
+# understand what is going on. On the other hand, if this tag is set to NO, the
+# size of the Perl module output will be much smaller and Perl will parse it
+# just the same.
+# The default value is: YES.
+# This tag requires that the tag GENERATE_PERLMOD is set to YES.
+
+PERLMOD_PRETTY         = YES
+
+# The names of the make variables in the generated doxyrules.make file are
+# prefixed with the string contained in PERLMOD_MAKEVAR_PREFIX. This is useful
+# so different doxyrules.make files included by the same Makefile don't
+# overwrite each other's variables.
+# This tag requires that the tag GENERATE_PERLMOD is set to YES.
+
+PERLMOD_MAKEVAR_PREFIX =
+
+#---------------------------------------------------------------------------
+# Configuration options related to the preprocessor
+#---------------------------------------------------------------------------
+
+# If the ENABLE_PREPROCESSING tag is set to YES, doxygen will evaluate all
+# C-preprocessor directives found in the sources and include files.
+# The default value is: YES.
+
+ENABLE_PREPROCESSING   = YES
+
+# If the MACRO_EXPANSION tag is set to YES, doxygen will expand all macro names
+# in the source code. If set to NO, only conditional compilation will be
+# performed. Macro expansion can be done in a controlled way by setting
+# EXPAND_ONLY_PREDEF to YES.
+# The default value is: NO.
+# This tag requires that the tag ENABLE_PREPROCESSING is set to YES.
+
+MACRO_EXPANSION        = NO
+
+# If the EXPAND_ONLY_PREDEF and MACRO_EXPANSION tags are both set to YES then
+# the macro expansion is limited to the macros specified with the PREDEFINED and
+# EXPAND_AS_DEFINED tags.
+# The default value is: NO.
+# This tag requires that the tag ENABLE_PREPROCESSING is set to YES.
+
+EXPAND_ONLY_PREDEF     = NO
+
+# If the SEARCH_INCLUDES tag is set to YES, the include files in the
+# INCLUDE_PATH will be searched if a #include is found.
+# The default value is: YES.
+# This tag requires that the tag ENABLE_PREPROCESSING is set to YES.
+
+SEARCH_INCLUDES        = YES
+
+# The INCLUDE_PATH tag can be used to specify one or more directories that
+# contain include files that are not input files but should be processed by the
+# preprocessor.
+# This tag requires that the tag SEARCH_INCLUDES is set to YES.
+
+INCLUDE_PATH           =
+
+# You can use the INCLUDE_FILE_PATTERNS tag to specify one or more wildcard
+# patterns (like *.h and *.hpp) to filter out the header-files in the
+# directories. If left blank, the patterns specified with FILE_PATTERNS will be
+# used.
+# This tag requires that the tag ENABLE_PREPROCESSING is set to YES.
+
+INCLUDE_FILE_PATTERNS  =
+
+# The PREDEFINED tag can be used to specify one or more macro names that are
+# defined before the preprocessor is started (similar to the -D option of e.g.
+# gcc). The argument of the tag is a list of macros of the form: name or
+# name=definition (no spaces). If the definition and the "=" are omitted, "=1"
+# is assumed. To prevent a macro definition from being undefined via #undef or
+# recursively expanded use the := operator instead of the = operator.
+# This tag requires that the tag ENABLE_PREPROCESSING is set to YES.
+
+PREDEFINED             =
+
+# If the MACRO_EXPANSION and EXPAND_ONLY_PREDEF tags are set to YES then this
+# tag can be used to specify a list of macro names that should be expanded. The
+# macro definition that is found in the sources will be used. Use the PREDEFINED
+# tag if you want to use a different macro definition that overrules the
+# definition found in the source code.
+# This tag requires that the tag ENABLE_PREPROCESSING is set to YES.
+
+EXPAND_AS_DEFINED      =
+
+# If the SKIP_FUNCTION_MACROS tag is set to YES then doxygen's preprocessor will
+# remove all references to function-like macros that are alone on a line, have
+# an all uppercase name, and do not end with a semicolon. Such function macros
+# are typically used for boiler-plate code, and will confuse the parser if not
+# removed.
+# The default value is: YES.
+# This tag requires that the tag ENABLE_PREPROCESSING is set to YES.
+
+SKIP_FUNCTION_MACROS   = YES
+
+#---------------------------------------------------------------------------
+# Configuration options related to external references
+#---------------------------------------------------------------------------
+
+# The TAGFILES tag can be used to specify one or more tag files. For each tag
+# file the location of the external documentation should be added. The format of
+# a tag file without this location is as follows:
+# TAGFILES = file1 file2 ...
+# Adding location for the tag files is done as follows:
+# TAGFILES = file1=loc1 "file2 = loc2" ...
+# where loc1 and loc2 can be relative or absolute paths or URLs. See the
+# section "Linking to external documentation" for more information about the use
+# of tag files.
+# Note: Each tag file must have a unique name (where the name does NOT include
+# the path). If a tag file is not located in the directory in which doxygen is
+# run, you must also specify the path to the tagfile here.
+
+TAGFILES               =
+
+# When a file name is specified after GENERATE_TAGFILE, doxygen will create a
+# tag file that is based on the input files it reads. See section "Linking to
+# external documentation" for more information about the usage of tag files.
+
+GENERATE_TAGFILE       =
+
+# If the ALLEXTERNALS tag is set to YES, all external class will be listed in
+# the class index. If set to NO, only the inherited external classes will be
+# listed.
+# The default value is: NO.
+
+ALLEXTERNALS           = NO
+
+# If the EXTERNAL_GROUPS tag is set to YES, all external groups will be listed
+# in the modules index. If set to NO, only the current project's groups will be
+# listed.
+# The default value is: YES.
+
+EXTERNAL_GROUPS        = YES
+
+# If the EXTERNAL_PAGES tag is set to YES, all external pages will be listed in
+# the related pages index. If set to NO, only the current project's pages will
+# be listed.
+# The default value is: YES.
+
+EXTERNAL_PAGES         = YES
+
+#---------------------------------------------------------------------------
+# Configuration options related to the dot tool
+#---------------------------------------------------------------------------
+
+# If the CLASS_DIAGRAMS tag is set to YES, doxygen will generate a class diagram
+# (in HTML and LaTeX) for classes with base or super classes. Setting the tag to
+# NO turns the diagrams off. Note that this option also works with HAVE_DOT
+# disabled, but it is recommended to install and use dot, since it yields more
+# powerful graphs.
+# The default value is: YES.
+
+CLASS_DIAGRAMS         = YES
+
+# You can include diagrams made with dia in doxygen documentation. Doxygen will
+# then run dia to produce the diagram and insert it in the documentation. The
+# DIA_PATH tag allows you to specify the directory where the dia binary resides.
+# If left empty dia is assumed to be found in the default search path.
+
+DIA_PATH               =
+
+# If set to YES the inheritance and collaboration graphs will hide inheritance
+# and usage relations if the target is undocumented or is not a class.
+# The default value is: YES.
+
+HIDE_UNDOC_RELATIONS   = YES
+
+# If you set the HAVE_DOT tag to YES then doxygen will assume the dot tool is
+# available from the path. This tool is part of Graphviz (see:
+# http://www.graphviz.org/), a graph visualization toolkit from AT&T and Lucent
+# Bell Labs. The other options in this section have no effect if this option is
+# set to NO
+# The default value is: NO.
+
+HAVE_DOT               = NO
+
+# The DOT_NUM_THREADS specifies the number of dot invocations doxygen is allowed
+# to run in parallel. When set to 0 doxygen will base this on the number of
+# processors available in the system. You can set it explicitly to a value
+# larger than 0 to get control over the balance between CPU load and processing
+# speed.
+# Minimum value: 0, maximum value: 32, default value: 0.
+# This tag requires that the tag HAVE_DOT is set to YES.
+
+DOT_NUM_THREADS        = 0
+
+# When you want a differently looking font in the dot files that doxygen
+# generates you can specify the font name using DOT_FONTNAME. You need to make
+# sure dot is able to find the font, which can be done by putting it in a
+# standard location or by setting the DOTFONTPATH environment variable or by
+# setting DOT_FONTPATH to the directory containing the font.
+# The default value is: Helvetica.
+# This tag requires that the tag HAVE_DOT is set to YES.
+
+DOT_FONTNAME           = Helvetica
+
+# The DOT_FONTSIZE tag can be used to set the size (in points) of the font of
+# dot graphs.
+# Minimum value: 4, maximum value: 24, default value: 10.
+# This tag requires that the tag HAVE_DOT is set to YES.
+
+DOT_FONTSIZE           = 10
+
+# By default doxygen will tell dot to use the default font as specified with
+# DOT_FONTNAME. If you specify a different font using DOT_FONTNAME you can set
+# the path where dot can find it using this tag.
+# This tag requires that the tag HAVE_DOT is set to YES.
+
+DOT_FONTPATH           =
+
+# If the CLASS_GRAPH tag is set to YES then doxygen will generate a graph for
+# each documented class showing the direct and indirect inheritance relations.
+# Setting this tag to YES will force the CLASS_DIAGRAMS tag to NO.
+# The default value is: YES.
+# This tag requires that the tag HAVE_DOT is set to YES.
+
+CLASS_GRAPH            = YES
+
+# If the COLLABORATION_GRAPH tag is set to YES then doxygen will generate a
+# graph for each documented class showing the direct and indirect implementation
+# dependencies (inheritance, containment, and class references variables) of the
+# class with other documented classes.
+# The default value is: YES.
+# This tag requires that the tag HAVE_DOT is set to YES.
+
+COLLABORATION_GRAPH    = YES
+
+# If the GROUP_GRAPHS tag is set to YES then doxygen will generate a graph for
+# groups, showing the direct groups dependencies.
+# The default value is: YES.
+# This tag requires that the tag HAVE_DOT is set to YES.
+
+GROUP_GRAPHS           = YES
+
+# If the UML_LOOK tag is set to YES, doxygen will generate inheritance and
+# collaboration diagrams in a style similar to the OMG's Unified Modeling
+# Language.
+# The default value is: NO.
+# This tag requires that the tag HAVE_DOT is set to YES.
+
+UML_LOOK               = NO
+
+# If the UML_LOOK tag is enabled, the fields and methods are shown inside the
+# class node. If there are many fields or methods and many nodes the graph may
+# become too big to be useful. The UML_LIMIT_NUM_FIELDS threshold limits the
+# number of items for each type to make the size more manageable. Set this to 0
+# for no limit. Note that the threshold may be exceeded by 50% before the limit
+# is enforced. So when you set the threshold to 10, up to 15 fields may appear,
+# but if the number exceeds 15, the total amount of fields shown is limited to
+# 10.
+# Minimum value: 0, maximum value: 100, default value: 10.
+# This tag requires that the tag HAVE_DOT is set to YES.
+
+UML_LIMIT_NUM_FIELDS   = 10
+
+# If the TEMPLATE_RELATIONS tag is set to YES then the inheritance and
+# collaboration graphs will show the relations between templates and their
+# instances.
+# The default value is: NO.
+# This tag requires that the tag HAVE_DOT is set to YES.
+
+TEMPLATE_RELATIONS     = NO
+
+# If the INCLUDE_GRAPH, ENABLE_PREPROCESSING and SEARCH_INCLUDES tags are set to
+# YES then doxygen will generate a graph for each documented file showing the
+# direct and indirect include dependencies of the file with other documented
+# files.
+# The default value is: YES.
+# This tag requires that the tag HAVE_DOT is set to YES.
+
+INCLUDE_GRAPH          = YES
+
+# If the INCLUDED_BY_GRAPH, ENABLE_PREPROCESSING and SEARCH_INCLUDES tags are
+# set to YES then doxygen will generate a graph for each documented file showing
+# the direct and indirect include dependencies of the file with other documented
+# files.
+# The default value is: YES.
+# This tag requires that the tag HAVE_DOT is set to YES.
+
+INCLUDED_BY_GRAPH      = YES
+
+# If the CALL_GRAPH tag is set to YES then doxygen will generate a call
+# dependency graph for every global function or class method.
+#
+# Note that enabling this option will significantly increase the time of a run.
+# So in most cases it will be better to enable call graphs for selected
+# functions only using the \callgraph command. Disabling a call graph can be
+# accomplished by means of the command \hidecallgraph.
+# The default value is: NO.
+# This tag requires that the tag HAVE_DOT is set to YES.
+
+CALL_GRAPH             = NO
+
+# If the CALLER_GRAPH tag is set to YES then doxygen will generate a caller
+# dependency graph for every global function or class method.
+#
+# Note that enabling this option will significantly increase the time of a run.
+# So in most cases it will be better to enable caller graphs for selected
+# functions only using the \callergraph command. Disabling a caller graph can be
+# accomplished by means of the command \hidecallergraph.
+# The default value is: NO.
+# This tag requires that the tag HAVE_DOT is set to YES.
+
+CALLER_GRAPH           = NO
+
+# If the GRAPHICAL_HIERARCHY tag is set to YES then doxygen will graphical
+# hierarchy of all classes instead of a textual one.
+# The default value is: YES.
+# This tag requires that the tag HAVE_DOT is set to YES.
+
+GRAPHICAL_HIERARCHY    = YES
+
+# If the DIRECTORY_GRAPH tag is set to YES then doxygen will show the
+# dependencies a directory has on other directories in a graphical way. The
+# dependency relations are determined by the #include relations between the
+# files in the directories.
+# The default value is: YES.
+# This tag requires that the tag HAVE_DOT is set to YES.
+
+DIRECTORY_GRAPH        = YES
+
+# The DOT_IMAGE_FORMAT tag can be used to set the image format of the images
+# generated by dot. For an explanation of the image formats see the section
+# output formats in the documentation of the dot tool (Graphviz (see:
+# http://www.graphviz.org/)).
+# Note: If you choose svg you need to set HTML_FILE_EXTENSION to xhtml in order
+# to make the SVG files visible in IE 9+ (other browsers do not have this
+# requirement).
+# Possible values are: png, jpg, gif, svg, png:gd, png:gd:gd, png:cairo,
+# png:cairo:gd, png:cairo:cairo, png:cairo:gdiplus, png:gdiplus and
+# png:gdiplus:gdiplus.
+# The default value is: png.
+# This tag requires that the tag HAVE_DOT is set to YES.
+
+DOT_IMAGE_FORMAT       = png
+
+# If DOT_IMAGE_FORMAT is set to svg, then this option can be set to YES to
+# enable generation of interactive SVG images that allow zooming and panning.
+#
+# Note that this requires a modern browser other than Internet Explorer. Tested
+# and working are Firefox, Chrome, Safari, and Opera.
+# Note: For IE 9+ you need to set HTML_FILE_EXTENSION to xhtml in order to make
+# the SVG files visible. Older versions of IE do not have SVG support.
+# The default value is: NO.
+# This tag requires that the tag HAVE_DOT is set to YES.
+
+INTERACTIVE_SVG        = NO
+
+# The DOT_PATH tag can be used to specify the path where the dot tool can be
+# found. If left blank, it is assumed the dot tool can be found in the path.
+# This tag requires that the tag HAVE_DOT is set to YES.
+
+DOT_PATH               =
+
+# The DOTFILE_DIRS tag can be used to specify one or more directories that
+# contain dot files that are included in the documentation (see the \dotfile
+# command).
+# This tag requires that the tag HAVE_DOT is set to YES.
+
+DOTFILE_DIRS           =
+
+# The MSCFILE_DIRS tag can be used to specify one or more directories that
+# contain msc files that are included in the documentation (see the \mscfile
+# command).
+
+MSCFILE_DIRS           =
+
+# The DIAFILE_DIRS tag can be used to specify one or more directories that
+# contain dia files that are included in the documentation (see the \diafile
+# command).
+
+DIAFILE_DIRS           =
+
+# When using plantuml, the PLANTUML_JAR_PATH tag should be used to specify the
+# path where java can find the plantuml.jar file. If left blank, it is assumed
+# PlantUML is not used or called during a preprocessing step. Doxygen will
+# generate a warning when it encounters a \startuml command in this case and
+# will not generate output for the diagram.
+
+PLANTUML_JAR_PATH      =
+
+# When using plantuml, the PLANTUML_CFG_FILE tag can be used to specify a
+# configuration file for plantuml.
+
+PLANTUML_CFG_FILE      =
+
+# When using plantuml, the specified paths are searched for files specified by
+# the !include statement in a plantuml block.
+
+PLANTUML_INCLUDE_PATH  =
+
+# The DOT_GRAPH_MAX_NODES tag can be used to set the maximum number of nodes
+# that will be shown in the graph. If the number of nodes in a graph becomes
+# larger than this value, doxygen will truncate the graph, which is visualized
+# by representing a node as a red box. Note that doxygen if the number of direct
+# children of the root node in a graph is already larger than
+# DOT_GRAPH_MAX_NODES then the graph will not be shown at all. Also note that
+# the size of a graph can be further restricted by MAX_DOT_GRAPH_DEPTH.
+# Minimum value: 0, maximum value: 10000, default value: 50.
+# This tag requires that the tag HAVE_DOT is set to YES.
+
+DOT_GRAPH_MAX_NODES    = 50
+
+# The MAX_DOT_GRAPH_DEPTH tag can be used to set the maximum depth of the graphs
+# generated by dot. A depth value of 3 means that only nodes reachable from the
+# root by following a path via at most 3 edges will be shown. Nodes that lay
+# further from the root node will be omitted. Note that setting this option to 1
+# or 2 may greatly reduce the computation time needed for large code bases. Also
+# note that the size of a graph can be further restricted by
+# DOT_GRAPH_MAX_NODES. Using a depth of 0 means no depth restriction.
+# Minimum value: 0, maximum value: 1000, default value: 0.
+# This tag requires that the tag HAVE_DOT is set to YES.
+
+MAX_DOT_GRAPH_DEPTH    = 0
+
+# Set the DOT_TRANSPARENT tag to YES to generate images with a transparent
+# background. This is disabled by default, because dot on Windows does not seem
+# to support this out of the box.
+#
+# Warning: Depending on the platform used, enabling this option may lead to
+# badly anti-aliased labels on the edges of a graph (i.e. they become hard to
+# read).
+# The default value is: NO.
+# This tag requires that the tag HAVE_DOT is set to YES.
+
+DOT_TRANSPARENT        = NO
+
+# Set the DOT_MULTI_TARGETS tag to YES to allow dot to generate multiple output
+# files in one run (i.e. multiple -o and -T options on the command line). This
+# makes dot run faster, but since only newer versions of dot (>1.8.10) support
+# this, this feature is disabled by default.
+# The default value is: NO.
+# This tag requires that the tag HAVE_DOT is set to YES.
+
+DOT_MULTI_TARGETS      = NO
+
+# If the GENERATE_LEGEND tag is set to YES doxygen will generate a legend page
+# explaining the meaning of the various boxes and arrows in the dot generated
+# graphs.
+# The default value is: YES.
+# This tag requires that the tag HAVE_DOT is set to YES.
+
+GENERATE_LEGEND        = YES
+
+# If the DOT_CLEANUP tag is set to YES, doxygen will remove the intermediate dot
+# files that are used to generate the various graphs.
+# The default value is: YES.
+# This tag requires that the tag HAVE_DOT is set to YES.
+
+DOT_CLEANUP            = YES

+ 299 - 0
StartAPPbyCOM/StartAPPbyCOM/CSerialPort/include/CSerialPort/SerialPort.h

@@ -0,0 +1,299 @@
+/**
+ * @file SerialPort.h
+ * @author itas109 (itas109@qq.com) \n\n
+ * Blog : https://blog.csdn.net/itas109 \n
+ * Github : https://github.com/itas109 \n
+ * QQ Group : 12951803
+ * @brief a lightweight library of serial port, which can easy to read and write serical port on windows and linux with
+ * C++ 轻量级跨平台串口读写类库
+ * @version 4.1.0.201010
+ * @date 2020-10-10
+ * @copyright The CSerialPort is Copyright (C) 2021 itas109. \n
+ * Contact: itas109@qq.com \n\n
+ *  You may use, distribute and copy the CSerialPort under the terms of \n
+ *  GNU Lesser General Public License version 3, which is displayed below.
+ */
+#ifndef __CSERIALPORT_H__
+#define __CSERIALPORT_H__
+
+#include "SerialPort_global.h"
+#include <string>
+
+#include "sigslot.h"
+using namespace sigslot;
+
+class CSerialPortBase;
+
+namespace itas109
+{
+/**
+ * @brief the CSerialPort class 串口类库
+ * @see reference 引用 CSerialPortBase
+ */
+class DLL_EXPORT CSerialPort : public has_slots<>
+{
+public:
+    /**
+     * @brief Construct a new CSerialPort object 构造函数
+     *
+     */
+    CSerialPort();
+    /**
+     * @brief Construct a new CSerialPort object 通过串口名称构造函数
+     *
+     * @param portName [in] the port name 串口名称 Windows:COM1 Linux:/dev/ttyS0
+     */
+    CSerialPort(const std::string &portName);
+    /**
+     * @brief Destroy the CSerialPort object 析构函数
+     *
+     */
+    ~CSerialPort();
+
+    /**
+     * @brief init 初始化函数
+     *
+     * @param portName [in] the port name串口名称 Windows:COM1 Linux:/dev/ttyS0
+     * @param baudRate [in] the baudRate 波特率
+     * @param parity [in] the parity 校验位
+     * @param dataBits [in] the dataBits 数据位
+     * @param stopbits [in] the stopbits 停止位
+     * @param flowControl [in] flowControl type 流控制
+     * @param readBufferSize [in] the read buffer size 读取缓冲区大小
+     */
+    void init(std::string portName,
+              int baudRate = itas109::BaudRate9600,
+              itas109::Parity parity = itas109::ParityNone,
+              itas109::DataBits dataBits = itas109::DataBits8,
+              itas109::StopBits stopbits = itas109::StopOne,
+              itas109::FlowControl flowControl = itas109::FlowNone,
+              int64 readBufferSize = 512);
+
+    /**
+     * @brief Set the Operate Mode object 设置串口操作模式
+     *
+     * @param operateMode [in] the operate mode 串口操作模式 {@link itas109::OperateMode}
+     */
+    void setOperateMode(itas109::OperateMode operateMode = itas109::AsynchronousOperate);
+
+    /**
+     * @brief open serial port 打开串口
+     *
+     * @return
+     * @retval true open success 打开成功
+     * @retval false open failed 打开失败
+     */
+    bool open();
+    /**
+     * @brief close 关闭串口
+     *
+     */
+    void close();
+
+    /**
+     * @brief if serial port is open success 串口是否打开成功
+     *
+     * @return
+     * @retval true serial port open success 串口打开成功
+     * @retval false serial port open failed 串口打开失败
+     */
+    bool isOpened();
+
+    /**
+     * @brief read specified length data 读取指定长度数据
+     *
+     * @param data [out] read data result 读取结果
+     * @param maxSize [in] read length 读取长度
+     * @return return number Of bytes read 返回读取字节数
+     * @retval -1 read error 读取错误
+     * @retval [other] return number Of bytes read 返回读取字节数
+     */
+    int readData(char *data, int maxSize);
+    /**
+     * @brief read all data 读取所有数据
+     *
+     * @param data [out] read data result 读取结果
+     * @return return number Of bytes read 返回读取字节数
+     * @retval -1 read error 读取错误
+     * @retval [other] return number Of bytes read 返回读取字节数
+     */
+    int readAllData(char *data);
+    /**
+     * @brief read line data 读取一行字符串
+     * @todo Not implemented 未实现
+     *
+     * @param data
+     * @param maxSize
+     * @return int
+     */
+    int readLineData(char *data, int maxSize);
+    /**
+     * @brief write specified lenfth data 写入指定长度数据
+     *
+     * @param data [in] write data 待写入数据
+     * @param maxSize [in] wtite length 写入长度
+     * @return return number Of bytes write 返回写入字节数
+     * @retval -1 read error 写入错误
+     * @retval [other] return number Of bytes write 返回写入字节数
+     */
+    int writeData(const char *data, int maxSize);
+
+    /**
+     * @brief Set Debug Model 设置调试模式
+     * @details output serial port read and write details info 输出串口读写的详细信息
+     * @todo  Not implemented 未实现
+     *
+     * @param isDebug true if enable true为启用
+     */
+    void setDebugModel(bool isDebug);
+
+    /**
+     * @brief Set the Read Time Interval object
+     * @details use timer import effectiveness 使用定时器提高效率
+     * @todo  Not implemented 未实现
+     *
+     * @param msecs read time micro second 读取间隔时间,单位:毫秒
+     */
+    void setReadTimeInterval(int msecs);
+
+    /**
+     * @brief setMinByteReadNotify set minimum byte of read notify 设置读取通知触发最小字节数
+     * @param minByteReadNotify minimum byte of read notify 读取通知触发最小字节数
+     */
+    void setMinByteReadNotify(unsigned int minByteReadNotify = 2);
+
+    /**
+     * @brief Get the Last Error object 获取最后的错误代码
+     *
+     * @return return last error code, refrence {@link itas109::SerialPortError} 错误代码
+     */
+    int getLastError() const;
+    /**
+     * @brief clear error 清除错误信息
+     *
+     */
+    void clearError();
+
+    /**
+     * @brief Set the Port Name object 设置串口名称
+     *
+     * @param portName [in] the port name 串口名称 Windows:COM1 Linux:/dev/ttyS0
+     */
+    void setPortName(std::string portName);
+    /**
+     * @brief Get the Port Name object 获取串口名称
+     *
+     * @return return port name 返回串口名称
+     */
+    std::string getPortName() const;
+    /**
+     * @brief Set the Baud Rate object 设置波特率
+     *
+     * @param baudRate [in] the baudRate 波特率
+     */
+    void setBaudRate(int baudRate);
+    /**
+     * @brief Get the Baud Rate object 获取波特率
+     *
+     * @return return baudRate 返回波特率
+     */
+    int getBaudRate() const;
+
+    /**
+     * @brief Set the Parity object 设置校验位
+     *
+     * @param parity [in] the parity 校验位 {@link itas109::Parity}
+     */
+    void setParity(itas109::Parity parity);
+    /**
+     * @brief Get the Parity object 获取校验位
+     *
+     * @return return parity 返回校验位 {@link itas109::Parity}
+     */
+    itas109::Parity getParity() const;
+
+    /**
+     * @brief Set the Data Bits object 设置数据位
+     *
+     * @param dataBits [in] the dataBits 数据位  {@link itas109::DataBits}
+     */
+    void setDataBits(itas109::DataBits dataBits);
+    /**
+     * @brief Get the Data Bits object 获取数据位
+     *
+     * @return return dataBits 返回数据位 {@link itas109::DataBits}
+     */
+    itas109::DataBits getDataBits() const;
+
+    /**
+     * @brief Set the Stop Bits object 设置停止位
+     *
+     * @param stopbits [in] the stopbits 停止位 {@link itas109::StopBits}
+     */
+    void setStopBits(itas109::StopBits stopbits);
+    /**
+     * @brief Get the Stop Bits object 获取停止位
+     *
+     * @return return stopbits 返回停止位 {@link itas109::StopBits}
+     */
+    itas109::StopBits getStopBits() const;
+
+    /**
+     * @brief Set the Flow Control object 设置流控制
+     * @todo Not implemented 未实现
+     *
+     * @param flowControl [in]
+     */
+    void setFlowControl(itas109::FlowControl flowControl);
+    /**
+     * @brief Get the Flow Control object 获取流控制
+     * @todo Not implemented 未实现
+     *
+     * @return itas109::FlowControl
+     */
+    itas109::FlowControl getFlowControl() const;
+
+    /**
+     * @brief Set the Read Buffer Size object
+     *
+     * @param size [in] read buffer size  设置缓冲区大小
+     */
+    void setReadBufferSize(int64 size);
+    /**
+     * @brief Get the Read Buffer Size object 获取读取缓冲区大小
+     *
+     * @return return read buffer size 返回读取缓冲区大小
+     */
+    int64 getReadBufferSize() const;
+
+    /**
+     * @brief Set the Dtr object 设置DTR
+     * @todo Not implemented 未实现
+     *
+     * @param set [in]
+     */
+    void setDtr(bool set = true);
+    /**
+     * @brief Set the Rts object 设置RTS
+     * @todo Not implemented 未实现
+     *
+     * @param set [in]
+     */
+    void setRts(bool set = true);
+
+    /**
+     * @brief Get the Version object 获取版本信息
+     *
+     * @return return version 返回版本信息
+     */
+    std::string getVersion();
+
+public:
+    void onReadReady();
+    sigslot::signal0<> readReady; // sigslot
+
+private:
+    CSerialPortBase *p_serialPortBase;
+};
+} // namespace itas109
+#endif //__CSERIALPORT_H__

+ 307 - 0
StartAPPbyCOM/StartAPPbyCOM/CSerialPort/include/CSerialPort/SerialPortBase.h

@@ -0,0 +1,307 @@
+/**
+ * @file SerialPortBase.h
+ * @author itas109 (itas109@qq.com) \n\n
+ * Blog : https://blog.csdn.net/itas109 \n
+ * Github : https://github.com/itas109 \n
+ * QQ Group : 12951803
+ * @brief the CSerialPort Base class 串口基类
+ * @date 2020-04-29
+ * @copyright The CSerialPort is Copyright (C) 2021 itas109. \n
+ * Contact: itas109@qq.com \n\n
+ *  You may use, distribute and copy the CSerialPort under the terms of \n
+ *  GNU Lesser General Public License version 3, which is displayed below.
+ */
+#ifndef __CSERIALPORTBASE_H__
+#define __CSERIALPORTBASE_H__
+
+#include "SerialPort_global.h"
+#include <string>
+
+/**
+ * @brief the CSerialPort Base class 串口基类
+ *
+ */
+class CSerialPortBase
+{
+public:
+    /**
+     * @brief Construct a new CSerialPortBase object 构造函数
+     *
+     */
+    CSerialPortBase();
+    /**
+     * @brief Construct a new CSerialPortBase object 通过串口名称构造函数
+     *
+     * @param portName [in] the port name 串口名称 Windows:COM1 Linux:/dev/ttyS0
+     */
+    CSerialPortBase(const std::string &portName);
+    /**
+     * @brief Destroy the CSerialPortBase object 析构函数
+     *
+     */
+    virtual ~CSerialPortBase();
+
+    /**
+     * @brief parameter init 参数初始化
+     *
+     */
+    virtual void construct() = 0;
+
+    /**
+     * @brief init 初始化函数
+     *
+     * @param portName [in] the port name串口名称 Windows:COM1 Linux:/dev/ttyS0
+     * @param baudRate [in] the baudRate 波特率
+     * @param parity [in] the parity 校验位
+     * @param dataBits [in] the dataBits 数据位
+     * @param stopbits [in] the stopbits 停止位
+     * @param flowControl [in] flowControl type 流控制
+     * @param readBufferSize [in] the read buffer size 读取缓冲区大小
+     */
+    virtual void init(std::string portName,
+                      int baudRate,
+                      itas109::Parity parity,
+                      itas109::DataBits dataBits,
+                      itas109::StopBits stopbits,
+                      itas109::FlowControl flowControl,
+                      int64 readBufferSize) = 0;
+
+    /**
+     * @brief Set the Operate Mode object 设置串口操作模式
+     *
+     * @param operateMode [in] the operate mode 串口操作模式 {@link itas109::OperateMode}
+     */
+    virtual void setOperateMode(itas109::OperateMode operateMode);
+
+    /**
+     * @brief open serial port 打开串口
+     *
+     * @return
+     * @retval true open success 打开成功
+     * @retval false open failed 打开失败
+     */
+    virtual bool openPort() = 0;
+    /**
+     * @brief close 关闭串口
+     *
+     */
+    virtual void closePort() = 0;
+
+    /**
+     * @brief if serial port is open success 串口是否打开成功
+     *
+     * @return
+     * @retval true serial port open success 串口打开成功
+     * @retval false serial port open failed 串口打开失败
+     */
+    virtual bool isOpened() = 0;
+
+    /**
+     * @brief read specified length data 读取指定长度数据
+     *
+     * @param data [out] read data result 读取结果
+     * @param maxSize [in] read length 读取长度
+     * @return return number Of bytes read 返回读取字节数
+     * @retval -1 read error 读取错误
+     * @retval [other] return number Of bytes read 返回读取字节数
+     */
+    virtual int readData(char *data, int maxSize) = 0;
+    /**
+     * @brief read all data 读取所有数据
+     *
+     * @param data [out] read data result 读取结果
+     * @return return number Of bytes read 返回读取字节数
+     * @retval -1 read error 读取错误
+     * @retval [other] return number Of bytes read 返回读取字节数
+     */
+    virtual int readAllData(char *data) = 0;
+    /**
+     * @brief read line data 读取一行字符串
+     * @todo Not implemented 未实现
+     *
+     * @param data
+     * @param maxSize
+     * @return int
+     */
+    virtual int readLineData(char *data, int maxSize) = 0;
+    /**
+     * @brief write specified lenfth data 写入指定长度数据
+     *
+     * @param data [in] write data 待写入数据
+     * @param maxSize [in] wtite length 写入长度
+     * @return return number Of bytes write 返回写入字节数
+     * @retval -1 read error 写入错误
+     * @retval [other] return number Of bytes write 返回写入字节数
+     */
+    virtual int writeData(const char *data, int maxSize) = 0;
+
+    /**
+     * @brief Set Debug Model 设置调试模式
+     * @details output serial port read and write details info 输出串口读写的详细信息
+     *
+     * @param isDebug true if enable true为启用
+     */
+    virtual void setDebugModel(bool isDebug) = 0;
+
+    /**
+     * @brief Set the Read Time Interval object
+     * @details use timer import effectiveness 使用定时器提高效率
+     *
+     * @param msecs read time micro second 读取间隔时间,单位:毫秒
+     */
+    virtual void setReadTimeInterval(int msecs) = 0;
+
+    /**
+     * @brief setMinByteReadNotify set minimum byte of read notify 设置读取通知触发最小字节数
+     * @param minByteReadNotify minimum byte of read notify 读取通知触发最小字节数
+     */
+    virtual void setMinByteReadNotify(unsigned int minByteReadNotify) = 0;
+
+    /**
+     * @brief getMinByteReadNotify get minimum byte of read notify 获取读取通知触发最小字节数
+     * @return minimum byte of read notify 读取通知触发最小字节数
+     */
+    virtual unsigned int getMinByteReadNotify();
+
+    /**
+     * @brief Get the Last Error object 获取最后的错误代码
+     *
+     * @return return last error code, refrence {@link itas109::SerialPortError} 错误代码
+     */
+    virtual int getLastError() const;
+    /**
+     * @brief clear error 清除错误信息
+     *
+     */
+    virtual void clearError();
+
+    /**
+     * @brief Set the Port Name object 设置串口名称
+     *
+     * @param portName [in] the port name 串口名称 Windows:COM1 Linux:/dev/ttyS0
+     */
+    virtual void setPortName(std::string portName) = 0;
+    /**
+     * @brief Get the Port Name object 获取串口名称
+     *
+     * @return return port name 返回串口名称
+     */
+    virtual std::string getPortName() const = 0;
+
+    /**
+     * @brief Set the Baud Rate object 设置波特率
+     *
+     * @param baudRate [in] the baudRate 波特率
+     */
+    virtual void setBaudRate(int baudRate) = 0;
+    /**
+     * @brief Get the Baud Rate object 获取波特率
+     *
+     * @return return baudRate 返回波特率
+     */
+    virtual int getBaudRate() const = 0;
+
+    /**
+     * @brief Set the Parity object 设置校验位
+     *
+     * @param parity [in] the parity 校验位 {@link itas109::Parity}
+     */
+    virtual void setParity(itas109::Parity parity) = 0;
+    /**
+     * @brief Get the Parity object 获取校验位
+     *
+     * @return return parity 返回校验位 {@link itas109::Parity}
+     */
+    virtual itas109::Parity getParity() const = 0;
+
+    /**
+     * @brief Set the Data Bits object 设置数据位
+     *
+     * @param dataBits [in] the dataBits 数据位 {@link itas109::DataBits}
+     */
+    virtual void setDataBits(itas109::DataBits dataBits) = 0;
+    /**
+     * @brief Get the Data Bits object 获取数据位
+     *
+     * @return return dataBits 返回数据位 {@link itas109::DataBits}
+     */
+    virtual itas109::DataBits getDataBits() const = 0;
+
+    /**
+     * @brief Set the Stop Bits object 设置停止位
+     *
+     * @param stopbits [in] the stopbits 停止位 {@link itas109::StopBits}
+     */
+    virtual void setStopBits(itas109::StopBits stopbits) = 0;
+    /**
+     * @brief Get the Stop Bits object 获取停止位
+     *
+     * @return return stopbits 返回停止位 {@link itas109::StopBits}
+     */
+    virtual itas109::StopBits getStopBits() const = 0;
+
+    /**
+     * @brief Set the Flow Control object 设置流控制
+     *
+     * @param flowControl [in]
+     */
+    virtual void setFlowControl(itas109::FlowControl flowControl) = 0;
+    /**
+     * @brief Get the Flow Control object 获取流控制
+     *
+     * @return itas109::FlowControl
+     */
+    virtual itas109::FlowControl getFlowControl() const = 0;
+
+    /**
+     * @brief Set the Read Buffer Size object 设置读取缓冲区大小
+     *
+     * @param size [in] read buffer size 读取缓冲区大小
+     */
+    virtual void setReadBufferSize(int64 size) = 0;
+    /**
+     * @brief Get the Read Buffer Size object 获取读取缓冲区大小
+     *
+     * @return return read buffer size 返回读取缓冲区大小
+     */
+    virtual int64 getReadBufferSize() const = 0;
+
+    /**
+     * @brief Set the Dtr object 设置DTR
+     *
+     * @param set [in]
+     */
+    virtual void setDtr(bool set = true) = 0;
+    /**
+     * @brief Set the Rts object 设置RTS
+     *
+     * @param set [in]
+     */
+    virtual void setRts(bool set = true) = 0;
+
+    /**
+     * @brief Get the Version object 获取版本信息
+     *
+     * @return return version 返回版本信息
+     */
+    std::string getVersion();
+
+protected:
+    /**
+     * @brief lock 锁
+     *
+     */
+    void lock();
+    /**
+     * @brief unlock 解锁
+     *
+     */
+    void unlock();
+
+protected:
+    int lastError;                      ///< last error code 最后的错误代码
+    itas109::OperateMode m_operateMode; ///< operate mode 串口操作类型
+    unsigned int m_minByteReadNotify;   ///< minimum byte of read notify 读取通知触发最小字节数
+private:
+};
+#endif //__CSERIALPORTBASE_H__

+ 50 - 0
StartAPPbyCOM/StartAPPbyCOM/CSerialPort/include/CSerialPort/SerialPortInfo.h

@@ -0,0 +1,50 @@
+/**
+ * @file SerialPortInfo.h
+ * @author itas109 (itas109@qq.com) \n\n
+ * Blog : https://blog.csdn.net/itas109 \n
+ * Github : https://github.com/itas109 \n
+ * QQ Group : 12951803
+ * @brief the CSerialPortInfo class 串口信息辅助类
+ * @date 2020-04-29
+ * @copyright The CSerialPort is Copyright (C) 2021 itas109. \n
+ * Contact: itas109@qq.com \n\n
+ *  You may use, distribute and copy the CSerialPort under the terms of \n
+ *  GNU Lesser General Public License version 3, which is displayed below.
+ */
+#ifndef __CSERIALPORTINFO_H__
+#define __CSERIALPORTINFO_H__
+
+#include "SerialPortInfoBase.h"
+#include "SerialPort_global.h"
+
+#include <list>
+#include <string>
+
+namespace itas109
+{
+/**
+ * @brief the CSerialPortInfo class 串口信息辅助类
+ *
+ */
+class DLL_EXPORT CSerialPortInfo
+{
+public:
+    /**
+     * @brief Construct a new CSerialPortInfo object 构造函数
+     *
+     */
+    CSerialPortInfo();
+    /**
+     * @brief Destroy the CSerialPortInfo object 析构函数
+     *
+     */
+    ~CSerialPortInfo();
+
+    /**
+     * @brief availablePortInfos 获取串口信息列表
+     * @return return available port infolist 返回可用串口名称列表
+     */
+    static vector<SerialPortInfo> availablePortInfos();
+};
+} // namespace itas109
+#endif //__CSERIALPORTINFO_H__

+ 54 - 0
StartAPPbyCOM/StartAPPbyCOM/CSerialPort/include/CSerialPort/SerialPortInfoBase.h

@@ -0,0 +1,54 @@
+/**
+ * @file SerialPortInfoBase.h
+ * @author itas109 (itas109@qq.com) \n\n
+ * Blog : https://blog.csdn.net/itas109 \n
+ * Github : https://github.com/itas109 \n
+ * QQ Group : 12951803
+ * @brief the CSerialPortInfo Base class 串口信息辅助类基类
+ * @date 2020-04-29
+ * @copyright The CSerialPort is Copyright (C) 2021 itas109. \n
+ * Contact: itas109@qq.com \n\n
+ *  You may use, distribute and copy the CSerialPort under the terms of \n
+ *  GNU Lesser General Public License version 3, which is displayed below.
+ */
+#ifndef __CSERIALPORTINFOBASE_H__
+#define __CSERIALPORTINFOBASE_H__
+
+#include <string>
+#include <vector>
+
+#include <list>
+
+using namespace std;
+
+struct SerialPortInfo
+{
+    std::string portName;
+    std::string description;
+};
+
+/**
+ * @brief the CSerialPortInfo Base class 串口信息辅助类基类
+ *
+ */
+class CSerialPortInfoBase
+{
+public:
+    /**
+     * @brief Construct a new CSerialPortInfoBase object 构造函数
+     *
+     */
+    CSerialPortInfoBase();
+    /**
+     * @brief Destroy the CSerialPortInfoBase object 析构函数
+     *
+     */
+    ~CSerialPortInfoBase();
+
+    /**
+     * @brief availablePortInfos 获取串口信息列表
+     * @return return available port infolist 返回可用串口名称列表
+     */
+    static std::vector<SerialPortInfo> availablePortInfos(void);
+};
+#endif //__CSERIALPORTINFOBASE_H__

+ 36 - 0
StartAPPbyCOM/StartAPPbyCOM/CSerialPort/include/CSerialPort/SerialPortInfoUnixBase.h

@@ -0,0 +1,36 @@
+/**
+ * @file SerialPortInfoUnixBase.h
+ * @author itas109 (itas109@qq.com) \n\n
+ * Blog : https://blog.csdn.net/itas109 \n
+ * Github : https://github.com/itas109 \n
+ * QQ Group : 12951803
+ * @brief the CSerialPortInfo unix class unix串口信息辅助类基类
+ * @todo Not implemented 未实现
+ * @date 2020-04-29
+ * @copyright The CSerialPort is Copyright (C) 2021 itas109. \n
+ * Contact: itas109@qq.com \n\n
+ *  You may use, distribute and copy the CSerialPort under the terms of \n
+ *  GNU Lesser General Public License version 3, which is displayed below.
+ */
+#ifndef __CSERIALPORTINFOUNIXBASE_H__
+#define __CSERIALPORTINFOUNIXBASE_H__
+
+#include "SerialPortInfoBase.h"
+
+/**
+ * @brief the CSerialPortInfo unix class unix串口信息辅助类基类
+ *
+ */
+class CSerialPortInfoUnixBase : public CSerialPortInfoBase
+{
+public:
+    CSerialPortInfoUnixBase();
+    ~CSerialPortInfoUnixBase();
+
+    /**
+     * @brief availablePortInfos 获取串口信息列表
+     * @return return available port infolist 返回可用串口名称列表
+     */
+    static std::vector<SerialPortInfo> availablePortInfos();
+};
+#endif //__CSERIALPORTINFOUNIXBASE_H__

+ 44 - 0
StartAPPbyCOM/StartAPPbyCOM/CSerialPort/include/CSerialPort/SerialPortInfoWinBase.h

@@ -0,0 +1,44 @@
+/**
+ * @file SerialPortInfoWinBase.h
+ * @author itas109 (itas109@qq.com) \n\n
+ * Blog : https://blog.csdn.net/itas109 \n
+ * Github : https://github.com/itas109 \n
+ * QQ Group : 12951803
+ * @brief the CSerialPortInfo windows class windows串口信息辅助类基类
+ * @date 2020-04-29
+ * @copyright The CSerialPort is Copyright (C) 2021 itas109. \n
+ * Contact: itas109@qq.com \n\n
+ *  You may use, distribute and copy the CSerialPort under the terms of \n
+ *  GNU Lesser General Public License version 3, which is displayed below.
+ */
+#ifndef __CSERIALPORTINFOWINBASE_H__
+#define __CSERIALPORTINFOWINBASE_H__
+
+#include "SerialPortInfoBase.h"
+
+/**
+ * @brief the CSerialPortInfoBase windows class windows串口信息辅助类基类
+ * @see inherit 继承 CSerialPortInfoBase
+ *
+ */
+class CSerialPortInfoWinBase : public CSerialPortInfoBase
+{
+public:
+    /**
+     * @brief Construct a new CSerialPortInfoWinBase object 构造函数
+     *
+     */
+    CSerialPortInfoWinBase();
+    /**
+     * @brief Destroy the CSerialPortInfoWinBase object 析构函数
+     *
+     */
+    ~CSerialPortInfoWinBase();
+
+    /**
+     * @brief availablePortInfos 获取串口信息列表
+     * @return return available port infolist 返回可用串口名称列表
+     */
+    static std::vector<SerialPortInfo> availablePortInfos();
+};
+#endif //__CSERIALPORTINFOWINBASE_H__

+ 421 - 0
StartAPPbyCOM/StartAPPbyCOM/CSerialPort/include/CSerialPort/SerialPortUnixBase.h

@@ -0,0 +1,421 @@
+/**
+ * @file SerialPortUnixBase.h
+ * @author itas109 (itas109@qq.com) \n\n
+ * Blog : https://blog.csdn.net/itas109 \n
+ * Github : https://github.com/itas109 \n
+ * QQ Group : 12951803
+ * @brief the CSerialPort unix Base class unix串口基类
+ * @date 2020-04-29
+ * @copyright The CSerialPort is Copyright (C) 2021 itas109. \n
+ * Contact: itas109@qq.com \n\n
+ *  You may use, distribute and copy the CSerialPort under the terms of \n
+ *  GNU Lesser General Public License version 3, which is displayed below.
+ */
+#ifndef __CSERIALPORTUNIXBASE_H__
+#define __CSERIALPORTUNIXBASE_H__
+
+#include "SerialPortBase.h"
+
+#include <errno.h>   /* Error number definitions */
+#include <fcntl.h>   /* File control definitions */
+#include <stdio.h>   /* Standard input/output definitions */
+#include <string.h>  /* String function definitions */
+#include <termios.h> /* POSIX terminal control definitions */
+#include <unistd.h>  /* UNIX standard function definitions */
+
+#include <sys/ioctl.h> //ioctl
+
+// Serial Programming Guide for POSIX Operating Systems
+// https://digilander.libero.it/robang/rubrica/serial.htm
+// https://blog.csdn.net/u014650722/article/details/51610587
+
+// sigslot
+// https://sourceforge.net/p/sigslot/bugs/8/
+#include "sigslot.h"
+
+// https://blog.csdn.net/u010317005/article/details/52384890
+
+// Linux compile 1
+// g++ SerialPort.cpp SerialPortBase.cpp SerialPortUnixBase.cpp -fPIC -lpthread -shared -o libsp.so
+// g++ t.cpp -o sp -L. -lsp
+// export LD_LIBRARY_PATH=./
+// ./sp
+
+// Linux compile 2
+// g++ sp.cpp SerialPort.cpp SerialPortBase.cpp SerialPortUnixBase.cpp -lpthread -o sp
+// ./sp
+
+// sp.cpp
+/*
+#include <iostream>
+
+#include "SerialPort.h"
+#include "sigslot.h"
+
+using namespace itas109;
+using namespace std;
+
+int main()
+{
+    CSerialPort sp;
+    sp.init("/dev/ttyS0");
+    sp.open();
+    cout << sp.isOpened() <<endl;
+
+    while (1);
+    return 0;
+}
+*/
+
+/**
+ * @brief the CSerialPort unix Base class unix串口基类
+ * @see inherit 继承 CSerialPortBase
+ *
+ */
+class CSerialPortUnixBase : public CSerialPortBase
+{
+public:
+    /**
+     * @brief Construct a new CSerialPortUnixBase object 构造函数
+     *
+     */
+    CSerialPortUnixBase();
+    /**
+     * @brief Construct a new CSerialPortUnixBase object 通过串口名称构造函数
+     *
+     * @param portName [in] the port name 串口名称 Windows:COM1 Linux:/dev/ttyS0
+     */
+    CSerialPortUnixBase(const std::string &portName);
+    /**
+     * @brief Destroy the CSerialPortUnixBase object 析构函数
+     *
+     */
+    virtual ~CSerialPortUnixBase();
+
+    /**
+     * @brief parameter init 参数初始化
+     *
+     */
+    virtual void construct();
+
+    /**
+     * @brief init 初始化函数
+     *
+     * @param portName [in] the port name串口名称 Windows:COM1 Linux:/dev/ttyS0
+     * @param baudRate [in] the baudRate 波特率
+     * @param parity [in] the parity 校验位
+     * @param dataBits [in] the dataBits 数据位
+     * @param stopbits [in] the stopbits 停止位
+     * @param flowControl [in] flowControl type 流控制
+     * @param readBufferSize [in] the read buffer size 读取缓冲区大小
+     */
+    virtual void init(std::string portName,
+                      int baudRate = itas109::BaudRate9600,
+                      itas109::Parity parity = itas109::ParityNone,
+                      itas109::DataBits dataBits = itas109::DataBits8,
+                      itas109::StopBits stopbits = itas109::StopOne,
+                      itas109::FlowControl flowControl = itas109::FlowNone,
+                      int64 readBufferSize = 512);
+
+    /**
+     * @brief open serial port 打开串口
+     *
+     * @return
+     * @retval true open success 打开成功
+     * @retval false open failed 打开失败
+     */
+    virtual bool openPort();
+    /**
+     * @brief close 关闭串口
+     *
+     */
+    virtual void closePort();
+
+    /**
+     * @brief if serial port is open success 串口是否打开成功
+     *
+     * @return
+     * @retval true serial port open success 串口打开成功
+     * @retval false serial port open failed 串口打开失败
+     */
+    virtual bool isOpened();
+
+    /**
+     * @brief read specified length data 读取指定长度数据
+     *
+     * @param data [out] read data result 读取结果
+     * @param maxSize [in] read length 读取长度
+     * @return return number Of bytes read 返回读取字节数
+     * @retval -1 read error 读取错误
+     * @retval [other] return number Of bytes read 返回读取字节数
+     */
+    virtual int readData(char *data, int maxSize);
+    /**
+     * @brief read all data 读取所有数据
+     *
+     * @param data [out] read data result 读取结果
+     * @return return number Of bytes read 返回读取字节数
+     * @retval -1 read error 读取错误
+     * @retval [other] return number Of bytes read 返回读取字节数
+     */
+    virtual int readAllData(char *data);
+    /**
+     * @brief read line data 读取一行字符串
+     * @todo Not implemented 未实现
+     *
+     * @param data
+     * @param maxSize
+     * @return int
+     */
+    virtual int readLineData(char *data, int maxSize);
+    /**
+     * @brief write specified lenfth data 写入指定长度数据
+     *
+     * @param data [in] write data 待写入数据
+     * @param maxSize [in] wtite length 写入长度
+     * @return return number Of bytes write 返回写入字节数
+     * @retval -1 read error 写入错误
+     * @retval [other] return number Of bytes write 返回写入字节数
+     */
+    virtual int writeData(const char *data, int maxSize);
+
+    /**
+     * @brief Set Debug Model 设置调试模式
+     * @details output serial port read and write details info 输出串口读写的详细信息
+     * @todo  Not implemented 未实现
+     *
+     * @param isDebug true if enable true为启用
+     */
+    virtual void setDebugModel(bool isDebug);
+
+    /**
+     * @brief Set the Read Time Interval object
+     * @details use timer import effectiveness 使用定时器提高效率
+     * @todo  Not implemented 未实现
+     *
+     * @param msecs read time micro second 读取间隔时间,单位:毫秒
+     */
+    virtual void setReadTimeInterval(int msecs);
+
+    /**
+     * @brief setMinByteReadNotify set minimum byte of read notify 设置读取通知触发最小字节数
+     * @param minByteReadNotify minimum byte of read notify 读取通知触发最小字节数
+     */
+    virtual void setMinByteReadNotify(unsigned int minByteReadNotify = 2);
+
+    /**
+     * @brief Get the Last Error object 获取最后的错误代码
+     *
+     * @return return last error code, refrence {@link itas109::SerialPortError} 错误代码
+     */
+    virtual int getLastError() const;
+    /**
+     * @brief clear error 清除错误信息
+     *
+     */
+    virtual void clearError();
+
+    /**
+     * @brief Set the Port Name object 设置串口名称
+     *
+     * @param portName [in] the port name 串口名称 Windows:COM1 Linux:/dev/ttyS0
+     */
+    virtual void setPortName(std::string portName);
+    /**
+     * @brief Get the Port Name object 获取串口名称
+     *
+     * @return return port name 返回串口名称
+     */
+    virtual std::string getPortName() const;
+
+    /**
+     * @brief Set the Baud Rate object 设置波特率
+     *
+     * @param baudRate [in] the baudRate 波特率
+     */
+    virtual void setBaudRate(int baudRate);
+    /**
+     * @brief Get the Baud Rate object 获取波特率
+     *
+     * @return return baudRate 返回波特率
+     */
+    virtual int getBaudRate() const;
+
+    /**
+     * @brief Set the Parity object 设置校验位
+     *
+     * @param parity [in] the parity 校验位 {@link itas109::Parity}
+     */
+    virtual void setParity(itas109::Parity parity);
+    /**
+     * @brief Get the Parity object 获取校验位
+     *
+     * @return return parity 返回校验位 {@link itas109::Parity}
+     */
+    virtual itas109::Parity getParity() const;
+    /**
+     * @brief Set the Data Bits object 设置数据位
+     *
+     * @param dataBits [in] the dataBits 数据位 {@link itas109::DataBits}
+     */
+    virtual void setDataBits(itas109::DataBits dataBits);
+    /**
+     * @brief Get the Data Bits object 获取数据位
+     *
+     * @return return dataBits 返回数据位 {@link itas109::DataBits}
+     */
+    virtual itas109::DataBits getDataBits() const;
+
+    /**
+     * @brief Set the Stop Bits object 设置停止位
+     *
+     * @param stopbits [in] the stopbits 停止位 {@link itas109::StopBits}
+     */
+    virtual void setStopBits(itas109::StopBits stopbits);
+    /**
+     * @brief Get the Stop Bits object 获取停止位
+     *
+     * @return return stopbits 返回停止位 {@link itas109::StopBits}
+     */
+    virtual itas109::StopBits getStopBits() const;
+
+    /**
+     * @brief Set the Flow Control object 设置流控制
+     * @todo Not implemented 未实现
+     *
+     * @param flowControl [in]
+     */
+    virtual void setFlowControl(itas109::FlowControl flowControl);
+    /**
+     * @brief Get the Flow Control object 获取流控制
+     * @todo Not implemented 未实现
+     *
+     * @return itas109::FlowControl
+     */
+    virtual itas109::FlowControl getFlowControl() const;
+
+    /**
+     * @brief Set the Read Buffer Size object 设置读取缓冲区大小
+     *
+     * @param size [in] read buffer size 读取缓冲区大小
+     */
+    virtual void setReadBufferSize(int64 size);
+    /**
+     * @brief Get the Read Buffer Size object 获取读取缓冲区大小
+     *
+     * @return return read buffer size 返回读取缓冲区大小
+     */
+    virtual int64 getReadBufferSize() const;
+
+    /**
+     * @brief Set the Dtr object 设置DTR
+     * @todo Not implemented 未实现
+     *
+     * @param set [in]
+     */
+    virtual void setDtr(bool set = true);
+    /**
+     * @brief Set the Rts object 设置RTS
+     * @todo Not implemented 未实现
+     *
+     * @param set [in]
+     */
+    virtual void setRts(bool set = true);
+
+    /**
+     * @brief Get the Version object 获取版本信息
+     *
+     * @return return version 返回版本信息
+     */
+    std::string getVersion();
+
+public:
+    /**
+     * @brief isThreadRunning 是否启动多线程
+     * @return
+     * @retval true thread running 多线程已启动
+     * @retval false thread not running 多线程未启动
+     */
+    bool isThreadRunning();
+
+private:
+    /**
+     * @brief lock 锁
+     *
+     */
+    void lock();
+    /**
+     * @brief unlock 解锁
+     *
+     */
+    void unlock();
+
+    /**
+     * @brief rate2Constant baudrate to constant 波特率转为unix常量
+     * @param baudrate 波特率
+     * @return constant unix常量
+     */
+    int rate2Constant(int baudrate);
+
+    /**
+     * @brief uart_set
+     * @param fd
+     * @param baude
+     * @param c_flow
+     * @param bits
+     * @param parity
+     * @param stop
+     * @return 0 success -1 error
+     */
+    int uart_set(int fd,
+                 int baudRate = itas109::BaudRate9600,
+                 itas109::Parity parity = itas109::ParityNone,
+                 itas109::DataBits dataBits = itas109::DataBits8,
+                 itas109::StopBits stopbits = itas109::StopOne,
+                 itas109::FlowControl flowControl = itas109::FlowNone);
+
+    /**
+     * @brief thread monitor 多线程监视器
+     *
+     */
+    static void *commThreadMonitor(void *pParam);
+
+    /**
+     * @brief start thread monitor 启动多线程监视器
+     *
+     * @return
+     * @retval true start success 启动成功
+     * @retval false start failed 启动失败
+     */
+    bool startThreadMonitor();
+    /**
+     * @brief stop thread monitor 停止多线程监视器
+     *
+     * @return
+     * @retval true stop success 停止成功
+     * @retval false stop failed 停止失败
+     */
+    bool stopThreadMonitor();
+
+public:
+    sigslot::signal0<> readReady; ///< sigslot for read 读数据信号
+
+private:
+    std::string m_portName;
+    int m_baudRate;
+    itas109::Parity m_parity;
+    itas109::DataBits m_dataBits;
+    itas109::StopBits m_stopbits;
+    itas109::FlowControl m_flowControl;
+    int64 m_readBufferSize;
+
+    int fd; /* File descriptor for the port */
+
+private:
+    pthread_t m_monitorThread; /**< read thread */
+
+    bool m_isThreadRunning;
+
+    pthread_mutex_t m_communicationMutex; ///< mutex
+};
+#endif //__CSERIALPORTUNIXBASE_H__

+ 384 - 0
StartAPPbyCOM/StartAPPbyCOM/CSerialPort/include/CSerialPort/SerialPortWinBase.h

@@ -0,0 +1,384 @@
+/**
+ * @file SerialPortWinBase.h
+ * @author itas109 (itas109@qq.com) \n\n
+ * Blog : https://blog.csdn.net/itas109 \n
+ * Github : https://github.com/itas109 \n
+ * QQ Group : 12951803
+ * @brief the CSerialPort Windows Base class windows串口基类
+ * @date 2020-04-29
+ * @license GNU Lesser General Public License version 3
+ * @copyright The CSerialPort is Copyright (C) 2021 itas109. \n
+ * Contact: itas109@qq.com \n\n
+ *  You may use, distribute and copy the CSerialPort under the terms of \n
+ *  GNU Lesser General Public License version 3, which is displayed below.
+ */
+#ifndef __CSERIALPORTWINBASE_H__
+#define __CSERIALPORTWINBASE_H__
+
+#include "SerialPortBase.h"
+
+// windows need
+#include <process.h> //_beginthreadex
+#include <tchar.h>   //tchar
+#include <windows.h>
+
+// sigslot
+#include "sigslot.h"
+
+/**
+ * @brief the CSerialPort Windows Base class windows串口基类
+ * @see inherit 继承 CSerialPortBase
+ * @todo
+ * 1. 多线程内部接管,无需开发者关心 \n
+ * 2. 使用自动锁处理多线程互斥访问问题 \n
+ * 3. 设计为虚函数,开发者可以继承修改 \n
+ * 4. 支持热插拔 \n
+ * 5. 支持通用通信协议:帧头 + 数据 + 校验 + 帧尾 \n
+ * 6. 支持基于时间片的数据组装 \n
+ * 7. 基于时间戳的数据缓存队列 - 数据存到缓冲区,并标记时间戳 开发者按照一定策略获取及组装数据 \n
+ * 8. 重写windows下ReadFile、WriteFile \n
+ * @warning More than one character can trigger read event 注意:只有超过一个字符才能出发接收事件
+ */
+class CSerialPortWinBase : public CSerialPortBase
+{
+public:
+    /**
+     * @brief Construct a new CSerialPortWinBase object 构造函数
+     *
+     */
+    CSerialPortWinBase();
+    /**
+     * @brief Construct a new CSerialPortWinBase object 通过串口名称构造函数
+     *
+     * @param portName  [in] the port name 串口名称 Windows:COM1 Linux:/dev/ttyS0
+     */
+    CSerialPortWinBase(const std::string &portName);
+    /**
+     * @brief Destroy the CSerialPortWinBase object 析构函数
+     *
+     */
+    virtual ~CSerialPortWinBase();
+
+    /**
+     * @brief parameter init 参数初始化
+     *
+     */
+    virtual void construct();
+
+    /**
+     * @brief init 初始化函数
+     *
+     * @param portName [in] the port name串口名称 Windows:COM1 Linux:/dev/ttyS0
+     * @param baudRate [in] the baudRate 波特率
+     * @param parity [in] the parity 校验位
+     * @param dataBits [in] the dataBits 数据位
+     * @param stopbits [in] the stopbits 停止位
+     * @param flowControl [in] flowControl type 流控制
+     * @param readBufferSize [in] the read buffer size 读取缓冲区大小
+     */
+    virtual void init(std::string portName,
+                      int baudRate = itas109::BaudRate9600,
+                      itas109::Parity parity = itas109::ParityNone,
+                      itas109::DataBits dataBits = itas109::DataBits8,
+                      itas109::StopBits stopbits = itas109::StopOne,
+                      itas109::FlowControl flowControl = itas109::FlowNone,
+                      int64 readBufferSize = 512);
+
+    /**
+     * @brief open serial port 打开串口
+     *
+     * @return
+     * @retval true open success 打开成功
+     * @retval false open failed 打开失败
+     */
+    virtual bool openPort();
+    /**
+     * @brief close 关闭串口
+     *
+     */
+    virtual void closePort();
+
+    /**
+     * @brief if serial port is open success 串口是否打开成功
+     *
+     * @return
+     * @retval true serial port open success 串口打开成功
+     * @retval false serial port open failed 串口打开失败
+     */
+    virtual bool isOpened();
+
+    /**
+     * @brief read specified length data 读取指定长度数据
+     *
+     * @param data [out] read data result 读取结果
+     * @param maxSize [in] read length 读取长度
+     * @return return number Of bytes read 返回读取字节数
+     * @retval -1 read error 读取错误
+     * @retval [other] return number Of bytes read 返回读取字节数
+     */
+    virtual int readData(char *data, int maxSize);
+    /**
+     * @brief read all data 读取所有数据
+     *
+     * @param data [out] read data result 读取结果
+     * @return return number Of bytes read 返回读取字节数
+     * @retval -1 read error 读取错误
+     * @retval [other] return number Of bytes read 返回读取字节数
+     */
+    virtual int readAllData(char *data);
+    /**
+     * @brief read line data 读取一行字符串
+     * @todo Not implemented 未实现
+     *
+     * @param data
+     * @param maxSize
+     * @return int
+     */
+    virtual int readLineData(char *data, int maxSize);
+    /**
+     * @brief write specified lenfth data 写入指定长度数据
+     *
+     * @param data [in] write data 待写入数据
+     * @param maxSize [in] wtite length 写入长度
+     * @return return number Of bytes write 返回写入字节数
+     * @retval -1 read error 写入错误
+     * @retval [other] return number Of bytes write 返回写入字节数
+     */
+    virtual int writeData(const char *data, int maxSize);
+
+    /**
+     * @brief Set Debug Model 设置调试模式
+     * @details output serial port read and write details info 输出串口读写的详细信息
+     * @todo  Not implemented 未实现
+     *
+     * @param isDebug true if enable true为启用
+     */
+    virtual void setDebugModel(bool isDebug);
+
+    /**
+     * @brief Set the Read Time Interval object
+     * @details use timer import effectiveness 使用定时器提高效率
+     * @todo  Not implemented 未实现
+     *
+     * @param msecs read time micro second 读取间隔时间,单位:毫秒
+     */
+    virtual void setReadTimeInterval(int msecs);
+
+    /**
+     * @brief setMinByteReadNotify set minimum byte of read notify 设置读取通知触发最小字节数
+     * @param minByteReadNotify minimum byte of read notify 读取通知触发最小字节数
+     */
+    virtual void setMinByteReadNotify(unsigned int minByteReadNotify = 2);
+
+    /**
+     * @brief Get the Last Error object 获取最后的错误代码
+     *
+     * @return return last error code, refrence {@link itas109::SerialPortError} 错误代码
+     */
+    virtual int getLastError() const;
+    /**
+     * @brief clear error 清除错误信息
+     *
+     */
+    virtual void clearError();
+
+    /**
+     * @brief Set the Port Name object 设置串口名称
+     *
+     * @param portName [in] the port name 串口名称 Windows:COM1 Linux:/dev/ttyS0
+     */
+    virtual void setPortName(std::string portName);
+    /**
+     * @brief Get the Port Name object 获取串口名称
+     *
+     * @return return port name 返回串口名称
+     */
+    virtual std::string getPortName() const;
+
+    /**
+     * @brief Set the Baud Rate object 设置波特率
+     *
+     * @param baudRate [in] the baudRate 波特率
+     */
+    virtual void setBaudRate(int baudRate);
+    /**
+     * @brief Get the Baud Rate object 获取波特率
+     *
+     * @return return baudRate 返回波特率
+     */
+    virtual int getBaudRate() const;
+
+    /**
+     * @brief Set the Parity object 设置校验位
+     *
+     * @param parity [in] the parity 校验位 {@link itas109::Parity}
+     */
+    virtual void setParity(itas109::Parity parity);
+    /**
+     * @brief Get the Parity object 获取校验位
+     *
+     * @return return parity 返回校验位 {@link itas109::Parity}
+     */
+    virtual itas109::Parity getParity() const;
+    /**
+     * @brief Set the Data Bits object 设置数据位
+     *
+     * @param dataBits [in] the dataBits 数据位 {@link itas109::DataBits}
+     */
+    virtual void setDataBits(itas109::DataBits dataBits);
+    /**
+     * @brief Get the Data Bits object 获取数据位
+     *
+     * @return return dataBits 返回数据位 {@link itas109::DataBits}
+     */
+    virtual itas109::DataBits getDataBits() const;
+
+    /**
+     * @brief Set the Stop Bits object 设置停止位
+     *
+     * @param stopbits [in] the stopbits 停止位 {@link itas109::StopBits}
+     */
+    virtual void setStopBits(itas109::StopBits stopbits);
+    /**
+     * @brief Get the Stop Bits object 获取停止位
+     *
+     * @return return stopbits 返回停止位 {@link itas109::StopBits}
+     */
+    virtual itas109::StopBits getStopBits() const;
+
+    /**
+     * @brief Set the Flow Control object 设置流控制
+     * @todo Not implemented 未实现
+     *
+     * @param flowControl [in]
+     */
+    virtual void setFlowControl(itas109::FlowControl flowControl);
+    /**
+     * @brief Get the Flow Control object 获取流控制
+     * @todo Not implemented 未实现
+     *
+     * @return itas109::FlowControl
+     */
+    virtual itas109::FlowControl getFlowControl() const;
+
+    /**
+     * @brief Set the Read Buffer Size object 设置读取缓冲区大小
+     *
+     * @param size [in] read buffer size 读取缓冲区大小
+     */
+    virtual void setReadBufferSize(int64 size);
+    /**
+     * @brief Get the Read Buffer Size object 获取读取缓冲区大小
+     *
+     * @return return read buffer size 返回读取缓冲区大小
+     */
+    virtual int64 getReadBufferSize() const;
+
+    /**
+     * @brief Set the Dtr object 设置DTR
+     * @todo Not implemented 未实现
+     *
+     * @param set [in]
+     */
+    virtual void setDtr(bool set = true);
+    /**
+     * @brief Set the Rts object 设置RTS
+     * @todo Not implemented 未实现
+     *
+     * @param set [in]
+     */
+    virtual void setRts(bool set = true);
+
+    /**
+     * @brief Get the Version object 获取版本信息
+     *
+     * @return return version 返回版本信息
+     */
+    std::string getVersion();
+
+public:
+    /**
+     * @brief Get the Overlap Monitor object 获取监视器的overlapped
+     *
+     * @return return monitor overlapped 返回监视器的overlapped
+     */
+    OVERLAPPED getOverlapMonitor();
+    /**
+     * @brief Get the Main Handle object 获取handle
+     *
+     * @return retrun handle 返回handle
+     */
+    HANDLE getMainHandle();
+
+    /**
+     * @brief isThreadRunning 是否启动多线程
+     * @return
+     * @retval true thread running 多线程已启动
+     * @retval false thread not running 多线程未启动
+     */
+    bool isThreadRunning();
+
+protected:
+    /**
+     * @brief lock 锁
+     *
+     */
+    void lock();
+    /**
+     * @brief unlock 解锁
+     *
+     */
+    void unlock();
+
+private:
+    /**
+     * @brief thread monitor 多线程监视器
+     *
+     */
+    static unsigned int __stdcall commThreadMonitor(LPVOID pParam);
+    /**
+     * @brief start thread monitor 启动多线程监视器
+     *
+     * @return
+     * @retval true start success 启动成功
+     * @retval false start failed 启动失败
+     */
+    bool startThreadMonitor();
+    /**
+     * @brief stop thread monitor 停止多线程监视器
+     *
+     * @return
+     * @retval true stop success 停止成功
+     * @retval false stop failed 停止失败
+     */
+    bool stopThreadMonitor();
+
+public:
+    sigslot::signal0<> readReady; ///< sigslot for read 读数据信号
+
+private:
+    std::string m_portName;
+    int m_baudRate;
+    itas109::Parity m_parity;
+    itas109::DataBits m_dataBits;
+    itas109::StopBits m_stopbits;
+    enum itas109::FlowControl m_flowControl;
+    int64 m_readBufferSize;
+
+private:
+    HANDLE m_handle;
+
+    HANDLE m_monitorThread;
+    OVERLAPPED overlapMonitor; ///< monitor overlapped
+
+    OVERLAPPED m_overlapRead;  ///< read overlapped
+    OVERLAPPED m_overlapWrite; ///< write overlapped
+
+    COMMCONFIG m_comConfigure;
+    COMMTIMEOUTS m_comTimeout;
+
+    CRITICAL_SECTION m_communicationMutex; ///< mutex
+
+    bool m_isThreadRunning;
+};
+#endif //__CSERIALPORTWINBASE_H__

+ 163 - 0
StartAPPbyCOM/StartAPPbyCOM/CSerialPort/include/CSerialPort/SerialPort_global.h

@@ -0,0 +1,163 @@
+/**
+ * @file SerialPort_global.h
+ * @author itas109 (itas109@qq.com) \n\n
+ * Blog : https://blog.csdn.net/itas109 \n
+ * Github : https://github.com/itas109 \n
+ * QQ Group : 129518033
+ * @brief global difine of CSerialPort 串口全局定义
+ * @date 2020-04-29
+ * @copyright The CSerialPort is Copyright (C) 2021 itas109. \n
+ * Contact: itas109@qq.com \n\n
+ *  You may use, distribute and copy the CSerialPort under the terms of \n
+ *  GNU Lesser General Public License version 3, which is displayed below.
+ */
+#ifndef __CSERIALPORT_GLOBAL_H__
+#define __CSERIALPORT_GLOBAL_H__
+
+// enum is not a class or namespace error
+// https://stackoverflow.com/questions/5188554/my-enum-is-not-a-class-or-namespace
+
+#include "osplatformutil.h"
+
+#ifdef I_OS_WIN
+#if defined(__MINGW32__) || defined(__MINGW64__)
+typedef long long int64; ///< long long定义方式可以用于gcc/g++,不受平台限制,但不能用于VC6.0
+#else
+typedef __int64 int64; ///< __int64是Win32平台编译器64位长整型的定义方式,不能用于Linux
+#endif
+#define DLL_EXPORT __declspec(dllexport) ///< define DLL_EXPORT windows 定义windows导出函数
+#elif defined I_OS_UNIX
+typedef long long int64; ///< 64 bit signed unix 定义Unix int64
+#define DLL_EXPORT __attribute__((visibility("default"))) ///< define DLL_EXPORT unix 定义Unix导出函数
+#else
+// Not support
+#endif // I_OS_WIN
+
+#ifdef _UNICODE
+#ifndef UNICODE
+#define UNICODE
+#endif
+#endif
+#ifdef UNICODE
+#ifndef _UNICODE
+#define _UNICODE
+#endif
+#endif
+
+namespace itas109
+{
+/**
+ * @brief the read and write serial port mode enum 读写串口模式
+ *
+ */
+enum OperateMode
+{
+    AsynchronousOperate, ///< Asynchronous 异步
+    SynchronousOperate   ///< Synchronous 同步
+};
+
+/**
+ * @brief the BaudRate enum 波特率
+ * @warning because baudrate is number, so it can be any value(includr follow definitions).
+ * 因为波特率为数值类型,所以理论上可以为任意值(包括下列定义)
+ */
+enum BaudRate
+{
+    BaudRate110 = 110,       ///< 110
+    BaudRate300 = 300,       ///< 300
+    BaudRate600 = 600,       ///< 600
+    BaudRate1200 = 1200,     ///< 1200
+    BaudRate2400 = 2400,     ///< 2400
+    BaudRate4800 = 4800,     ///< 4800
+    BaudRate9600 = 9600,     ///< 9600 recommend 推荐
+    BaudRate14400 = 14400,   ///< 14400
+    BaudRate19200 = 19200,   ///< 19200
+    BaudRate38400 = 38400,   ///< 38400
+    BaudRate56000 = 56000,   ///< 56000
+    BaudRate57600 = 57600,   ///< 57600
+    BaudRate115200 = 115200, ///< 115200
+    BaudRate921600 = 921600  ///< 921600
+};
+
+/**
+ * @brief the DataBits enum 数据位
+ * @warning
+ * by QextSerialPort:\n
+ * 5 data bits cannot be used with 2 stop bits 5位数据位不能使用2位停止位\n
+ * 1.5 stop bits can only be used with 5 data bits 1.5位停止位不能使用5位数据位\n
+ * 8 data bits cannot be used with space parity on POSIX systems POSIX系统8位数据位不能使用0校验
+ * @warning windows Number of bits/byte, 4-8 windows数据位范围为4 - 8
+ *
+ */
+enum DataBits
+{
+    DataBits5 = 5, ///< 5 data bits 5位数据位
+    DataBits6 = 6, ///< 6 data bits 6位数据位
+    DataBits7 = 7, ///< 7 data bits 7位数据位
+    DataBits8 = 8  ///< 8 data bits 8位数据位
+};
+
+/**
+ * @brief the Parity enum 校验位
+ * @warning windows 0-4=None,Odd,Even,Mark,Space
+ *
+ */
+enum Parity
+{
+    ParityNone = 0,  ///< No Parity 无校验
+    ParityOdd = 1,   ///< Odd Parity 奇校验
+    ParityEven = 2,  ///< Even Parity 偶校验
+    ParityMark = 3,  ///< Mark Parity 1校验
+    ParitySpace = 4, ///< Space Parity 0校验
+};
+
+/**
+ * @brief the StopBits enum 停止位
+ * @warning 1.5 stop bit only for the Windows platform 1.5位停止位仅对windows有效
+ * @warning windows 0,1,2 = 1, 1.5, 2
+ *
+ */
+enum StopBits
+{
+    StopOne = 0,        ///< 1 stop bit 1位停止位
+    StopOneAndHalf = 1, ///< 1.5 stop bit 1.5位停止位 - This is only for the Windows platform
+    StopTwo = 2         ///< 2 stop bit 2位停止位
+};
+
+/**
+ * @brief the FlowControl enum 流控制
+ *
+ */
+enum FlowControl
+{
+    FlowNone = 0,     ///< No flow control 无流控制
+    FlowHardware = 1, ///< Hardware(RTS / CTS) flow control 硬件流控制
+    FlowSoftware = 2  ///< Software(XON / XOFF) flow control 软件流控制
+};
+
+/**
+ * @brief the SerialPort error code 串口错误代码
+ *
+ */
+enum SerialPortError
+{
+    SystemError = -1,          ///< system error 系统错误(如空指针、内存访问异常等)
+    NoError = 0,               ///< No error occurred 没有错误
+    DeviceNotFoundError,       ///< device not found 未找到设备
+    PermissionError,           ///< permission error 权限错误
+    OpenError,                 ///< open error 打开串口错误
+    ParityError,               ///< parity error 校验位错误
+    FramingError,              ///<
+    BreakConditionError,       ///<
+    WriteError,                ///< write error 写数据错误
+    ReadError,                 ///< read error 读数据错误
+    ResourceError,             ///<
+    UnsupportedOperationError, ///<
+    UnknownError,              ///< unknown error 未知错误
+    TimeoutError,              ///< time out error 超时
+    NotOpenError,              ///< not open serial port error 串口未打开
+    InvalidParameterError      ///< invalid parameter error 无效的参数
+};
+} // namespace itas109
+
+#endif //__CSERIALPORT_GLOBAL_H__

+ 72 - 0
StartAPPbyCOM/StartAPPbyCOM/CSerialPort/include/CSerialPort/osplatformutil.h

@@ -0,0 +1,72 @@
+/**
+ * @file osplatformutil.h
+ * @author itas109 (itas109@qq.com) \n\n
+ * Blog : https://blog.csdn.net/itas109 \n
+ * Github : https://github.com/itas109 \n
+ * QQ Group : 12951803
+ * @brief os platform util 操作系统平台工具
+ * @copyright The CSerialPort is Copyright (C) 2021 itas109. \n
+ * Contact: itas109@qq.com \n\n
+ *  You may use, distribute and copy the CSerialPort under the terms of \n
+ *  GNU Lesser General Public License version 3, which is displayed below.
+ */
+#ifndef OSPLATFORMUTIL_H
+#define OSPLATFORMUTIL_H
+
+/*
+   The operating system, must be one of: (I_OS_x)
+
+     WIN      - Win (Windows 2000/XP/Vista/7 and Windows Server 2003/2008)
+     LINUX    - Linux
+     MAC      - macOS, iOS, watchOS, tvOS
+     ANDROID  - Android
+     FREEBSD  - FreeBSD
+     OPENBSD  - OpenBSD
+     SOLARIS  - Sun Solaris
+     AIX      - AIX
+     UNIX     - Any UNIX BSD/SYSV system
+*/
+
+#define OS_PLATFORM_UTIL_VERSION 1.0.1.200418
+
+// os platform
+// Windows
+#if (defined(WIN32) || defined(_WIN32) || defined(__WIN32__) || defined(WIN64) || defined(_WIN64) || \
+     defined(__WIN64__) || defined(__NT__))
+#define I_OS_WIN
+// LINUX
+#elif defined(__linux__) || defined(__linux)
+#define I_OS_LINUX
+// MAC
+#elif defined(__APPLE__)
+#define I_OS_MAC
+// ANDROID
+#elif defined(__ANDROID__) || defined(ANDROID)
+#define I_OS_ANDROID
+#define I_OS_LINUX
+// sun os
+#elif defined(__sun) || defined(sun)
+#define I_OS_SOLARIS
+// FREEBSD
+#elif defined(__FreeBSD__) || defined(__DragonFly__) || defined(__FreeBSD_kernel__)
+#ifndef __FreeBSD_kernel__
+#define I_OS_FREEBSD
+#endif
+#define I_OS_FREEBSD_KERNEL
+// OPENBSD
+#elif defined(__OpenBSD__)
+#define I_OS_OPENBSD
+// IBM AIX
+#elif defined(_AIX)
+#define I_OS_AIX
+#else
+#error "not support this OS"
+#endif
+
+#if defined(I_OS_WIN)
+#undef I_OS_UNIX
+#elif !defined(I_OS_UNIX)
+#define I_OS_UNIX
+#endif
+
+#endif // OSPLATFORMUTIL_H

+ 527 - 0
StartAPPbyCOM/StartAPPbyCOM/CSerialPort/include/CSerialPort/sigslot.h

@@ -0,0 +1,527 @@
+// sigslot.h: Signal/Slot classes
+// Written by Sarah Thompson (sarah@telergy.com) 2002
+// more info : http://sigslot.sourceforge.net/
+// ** only reserve no paramete function for CSerialPort 4.0 2019-07-21 itas109 **
+
+#ifndef SIGSLOT_H__
+#define SIGSLOT_H__
+
+#include <set>
+#include <list>
+
+#if defined(SIGSLOT_PURE_ISO) || (!defined(_WIN32) && !defined(__GNUG__) && !defined(SIGSLOT_USE_POSIX_THREADS))
+#	define _SIGSLOT_SINGLE_THREADED
+#elif defined(_WIN32)
+#	define _SIGSLOT_HAS_WIN32_THREADS
+#	include <windows.h>
+#elif defined(__GNUG__) || defined(SIGSLOT_USE_POSIX_THREADS)
+#	define _SIGSLOT_HAS_POSIX_THREADS
+#	include <pthread.h>
+#else
+#	define _SIGSLOT_SINGLE_THREADED
+#endif
+
+#ifndef SIGSLOT_DEFAULT_MT_POLICY
+#	ifdef _SIGSLOT_SINGLE_THREADED
+#		define SIGSLOT_DEFAULT_MT_POLICY single_threaded
+#	else
+#		define SIGSLOT_DEFAULT_MT_POLICY multi_threaded_local
+#	endif
+#endif
+
+
+namespace sigslot {
+
+	class single_threaded
+	{
+	public:
+		single_threaded()
+		{
+			;
+		}
+
+		virtual ~single_threaded()
+		{
+			;
+		}
+
+		virtual void lock()
+		{
+			;
+		}
+
+		virtual void unlock()
+		{
+			;
+		}
+	};
+
+#ifdef _SIGSLOT_HAS_WIN32_THREADS
+	// The multi threading policies only get compiled in if they are enabled.
+	class multi_threaded_global
+	{
+	public:
+		multi_threaded_global()
+		{
+			static bool isinitialised = false;
+
+			if(!isinitialised)
+			{
+				InitializeCriticalSection(get_critsec());
+				isinitialised = true;
+			}
+		}
+
+		multi_threaded_global(const multi_threaded_global&)
+		{
+			;
+		}
+
+		virtual ~multi_threaded_global()
+		{
+			;
+		}
+
+		virtual void lock()
+		{
+			EnterCriticalSection(get_critsec());
+		}
+
+		virtual void unlock()
+		{
+			LeaveCriticalSection(get_critsec());
+		}
+
+	private:
+		CRITICAL_SECTION* get_critsec()
+		{
+			static CRITICAL_SECTION g_critsec;
+			return &g_critsec;
+		}
+	};
+
+	class multi_threaded_local
+	{
+	public:
+		multi_threaded_local()
+		{
+			InitializeCriticalSection(&m_critsec);
+		}
+
+		multi_threaded_local(const multi_threaded_local&)
+		{
+			InitializeCriticalSection(&m_critsec);
+		}
+
+		virtual ~multi_threaded_local()
+		{
+			DeleteCriticalSection(&m_critsec);
+		}
+
+		virtual void lock()
+		{
+			EnterCriticalSection(&m_critsec);
+		}
+
+		virtual void unlock()
+		{
+			LeaveCriticalSection(&m_critsec);
+		}
+
+	private:
+		CRITICAL_SECTION m_critsec;
+	};
+#endif // _SIGSLOT_HAS_WIN32_THREADS
+
+#ifdef _SIGSLOT_HAS_POSIX_THREADS
+	// The multi threading policies only get compiled in if they are enabled.
+	class multi_threaded_global
+	{
+	public:
+		multi_threaded_global()
+		{
+			pthread_mutex_init(get_mutex(), NULL);
+		}
+
+		multi_threaded_global(const multi_threaded_global&)
+		{
+			;
+		}
+
+		virtual ~multi_threaded_global()
+		{
+			;
+		}
+
+		virtual void lock()
+		{
+			pthread_mutex_lock(get_mutex());
+		}
+
+		virtual void unlock()
+		{
+			pthread_mutex_unlock(get_mutex());
+		}
+
+	private:
+		pthread_mutex_t* get_mutex()
+		{
+			static pthread_mutex_t g_mutex;
+			return &g_mutex;
+		}
+	};
+
+	class multi_threaded_local
+	{
+	public:
+		multi_threaded_local()
+		{
+			pthread_mutex_init(&m_mutex, NULL);
+		}
+
+		multi_threaded_local(const multi_threaded_local&)
+		{
+			pthread_mutex_init(&m_mutex, NULL);
+		}
+
+		virtual ~multi_threaded_local()
+		{
+			pthread_mutex_destroy(&m_mutex);
+		}
+
+		virtual void lock()
+		{
+			pthread_mutex_lock(&m_mutex);
+		}
+
+		virtual void unlock()
+		{
+			pthread_mutex_unlock(&m_mutex);
+		}
+
+	private:
+		pthread_mutex_t m_mutex;
+	};
+#endif // _SIGSLOT_HAS_POSIX_THREADS
+
+	template<class mt_policy>
+	class lock_block
+	{
+	public:
+		mt_policy *m_mutex;
+
+		lock_block(mt_policy *mtx)
+			: m_mutex(mtx)
+		{
+			m_mutex->lock();
+		}
+
+		~lock_block()
+		{
+			m_mutex->unlock();
+		}
+	};
+
+	template<class mt_policy>
+	class has_slots;
+
+	template<class mt_policy>
+	class _connection_base0
+	{
+	public:
+		virtual has_slots<mt_policy>* getdest() const = 0;
+        virtual void _emit() = 0;
+		virtual _connection_base0* clone() = 0;
+		virtual _connection_base0* duplicate(has_slots<mt_policy>* pnewdest) = 0;
+	};
+	
+	template<class mt_policy>
+	class _signal_base : public mt_policy
+	{
+	public:
+		virtual void slot_disconnect(has_slots<mt_policy>* pslot) = 0;
+		virtual void slot_duplicate(const has_slots<mt_policy>* poldslot, has_slots<mt_policy>* pnewslot) = 0;
+	};
+
+	template<class  mt_policy = SIGSLOT_DEFAULT_MT_POLICY>
+	class has_slots : public mt_policy 
+	{
+	private:
+		typedef typename std::set<_signal_base<mt_policy> *> sender_set;
+		typedef typename sender_set::const_iterator const_iterator;
+
+	public:
+		has_slots()
+		{
+			;
+		}
+
+		has_slots(const has_slots& hs)
+			: mt_policy(hs)
+		{
+			lock_block<mt_policy> lock(this);
+			const_iterator it = hs.m_senders.begin();
+			const_iterator itEnd = hs.m_senders.end();
+
+			while(it != itEnd)
+			{
+				(*it)->slot_duplicate(&hs, this);
+				m_senders.insert(*it);
+				++it;
+			}
+		} 
+
+		void signal_connect(_signal_base<mt_policy>* sender)
+		{
+			lock_block<mt_policy> lock(this);
+			m_senders.insert(sender);
+		}
+
+		void signal_disconnect(_signal_base<mt_policy>* sender)
+		{
+			lock_block<mt_policy> lock(this);
+			m_senders.erase(sender);
+		}
+
+		virtual ~has_slots()
+		{
+			disconnect_all();
+		}
+
+		void disconnect_all()
+		{
+			lock_block<mt_policy> lock(this);
+			const_iterator it = m_senders.begin();
+			const_iterator itEnd = m_senders.end();
+
+			while(it != itEnd)
+			{
+				(*it)->slot_disconnect(this);
+				++it;
+			}
+
+			m_senders.erase(m_senders.begin(), m_senders.end());
+		}
+    
+	private:
+		sender_set m_senders;
+	};
+
+	template<class mt_policy>
+	class _signal_base0 : public _signal_base<mt_policy>
+	{
+	public:
+		typedef typename std::list<_connection_base0<mt_policy> *>  connections_list;
+		typedef typename connections_list::const_iterator const_iterator;
+		typedef typename connections_list::iterator iterator;
+
+		_signal_base0()
+		{
+			;
+		}
+
+		_signal_base0(const _signal_base0& s)
+			: _signal_base<mt_policy>(s)
+		{
+			lock_block<mt_policy> lock(this);
+			const_iterator  it = s.m_connected_slots.begin();
+			const_iterator itEnd = s.m_connected_slots.end();
+
+			while(it != itEnd)
+			{
+				(*it)->getdest()->signal_connect(this);
+				m_connected_slots.push_back((*it)->clone());
+
+				++it;
+			}
+		}
+
+		~_signal_base0()
+		{
+			disconnect_all();
+		}
+
+		void disconnect_all()
+		{
+			lock_block<mt_policy> lock(this);
+			const_iterator it  = m_connected_slots.begin();
+			const_iterator itEnd = m_connected_slots.end();
+
+			while(it != itEnd)
+			{
+				(*it)->getdest()->signal_disconnect(this);
+				delete *it;
+
+				++it;
+			}
+
+			m_connected_slots.erase(m_connected_slots.begin(), m_connected_slots.end());
+		}
+
+		void disconnect(has_slots<mt_policy>* pclass)
+		{
+			lock_block<mt_policy> lock(this);
+			iterator it = m_connected_slots.begin();
+			iterator itEnd = m_connected_slots.end();
+
+			while(it != itEnd)
+			{
+				if((*it)->getdest() == pclass)
+				{
+					delete *it;
+					m_connected_slots.erase(it);
+					pclass->signal_disconnect(this);
+					return;
+				}
+
+				++it;
+			}
+		}
+
+		void slot_disconnect(has_slots<mt_policy>* pslot)
+		{
+			lock_block<mt_policy> lock(this);
+			iterator it = m_connected_slots.begin();
+			iterator itEnd = m_connected_slots.end();
+
+			while(it != itEnd)
+			{
+				iterator itNext = it;
+				++itNext;
+
+				if((*it)->getdest() == pslot)
+				{
+					m_connected_slots.erase(it);
+					//			delete *it;
+				}
+
+				it = itNext;
+			}
+		}
+
+		void slot_duplicate(const has_slots<mt_policy>* oldtarget, has_slots<mt_policy>* newtarget)
+		{
+			lock_block<mt_policy> lock(this);
+			iterator it = m_connected_slots.begin();
+			iterator itEnd = m_connected_slots.end();
+
+			while(it != itEnd)
+			{
+				if((*it)->getdest() == oldtarget)
+				{
+					m_connected_slots.push_back((*it)->duplicate(newtarget));
+				}
+
+				++it;
+			}
+		}
+
+	protected:
+		connections_list m_connected_slots;   
+	};
+
+	template<class dest_type, class mt_policy>
+	class _connection0 : public _connection_base0<mt_policy>
+	{
+	public:
+		_connection0()
+		{
+			this->pobject = NULL;
+			this->pmemfun = NULL;
+		}
+
+		_connection0(dest_type* pobject, void (dest_type::*pmemfun)())
+		{
+			m_pobject = pobject;
+			m_pmemfun = pmemfun;
+		}
+
+		virtual _connection_base0<mt_policy>* clone()
+		{
+			return new _connection0<dest_type, mt_policy>(*this);
+		}
+
+		virtual _connection_base0<mt_policy>* duplicate(has_slots<mt_policy>* pnewdest)
+		{
+			return new _connection0<dest_type, mt_policy>((dest_type *)pnewdest, m_pmemfun);
+		}
+
+        virtual void _emit()
+		{
+			(m_pobject->*m_pmemfun)();
+		}
+
+		virtual has_slots<mt_policy>* getdest() const
+		{
+			return m_pobject;
+		}
+
+	private:
+		dest_type* m_pobject;
+		void (dest_type::* m_pmemfun)();
+	};
+	
+	template<class mt_policy = SIGSLOT_DEFAULT_MT_POLICY>
+	class signal0 : public _signal_base0<mt_policy>
+	{
+	public:
+    	typedef typename _signal_base0<mt_policy>::connections_list::const_iterator const_iterator;
+		signal0()
+		{
+			;
+		}
+
+		signal0(const signal0<mt_policy>& s)
+			: _signal_base0<mt_policy>(s)
+		{
+			;
+		}
+
+		template<class desttype>
+			void connect(desttype* pclass, void (desttype::*pmemfun)())
+		{
+			lock_block<mt_policy> lock(this);
+			_connection0<desttype, mt_policy>* conn = 
+				new _connection0<desttype, mt_policy>(pclass, pmemfun);
+			this->m_connected_slots.push_back(conn);
+			pclass->signal_connect(this);
+		}
+
+        void _emit()
+		{
+			lock_block<mt_policy> lock(this);
+			const_iterator itNext, it = this->m_connected_slots.begin();
+			const_iterator itEnd = this->m_connected_slots.end();
+
+			while(it != itEnd)
+			{
+				itNext = it;
+				++itNext;
+
+                (*it)->_emit();
+
+				it = itNext;
+			}
+		}
+
+		void operator()()
+		{
+			lock_block<mt_policy> lock(this);
+			const_iterator itNext, it = this->m_connected_slots.begin();
+			const_iterator itEnd = this->m_connected_slots.end();
+
+			while(it != itEnd)
+			{
+				itNext = it;
+				++itNext;
+
+                (*it)->_emit();
+
+				it = itNext;
+			}
+		}
+	};
+
+}; // namespace sigslot
+
+#endif // SIGSLOT_H__

+ 362 - 0
StartAPPbyCOM/StartAPPbyCOM/CSerialPort/src/SerialPort.cpp

@@ -0,0 +1,362 @@
+#include "CSerialPort/SerialPort.h"
+
+#ifdef I_OS_WIN
+#include "CSerialPort/SerialPortWinBase.h"
+#define CSERIALPORTBASE CSerialPortWinBase
+#elif defined I_OS_UNIX
+#include "CSerialPort/SerialPortUnixBase.h"
+#define CSERIALPORTBASE CSerialPortUnixBase
+#else
+// Not support
+#define CSERIALPORTBASE
+#endif // I_OS_WIN
+
+#include <iostream>
+
+using namespace itas109;
+
+CSerialPort::CSerialPort()
+{
+    p_serialPortBase = new CSERIALPORTBASE();
+
+    p_serialPortBase->setMinByteReadNotify(1);
+
+    ((CSERIALPORTBASE *)p_serialPortBase)->readReady.connect(this, &CSerialPort::onReadReady);
+}
+
+itas109::CSerialPort::CSerialPort(const std::string &portName)
+{
+    p_serialPortBase = new CSERIALPORTBASE(portName);
+
+    p_serialPortBase->setMinByteReadNotify(1);
+
+    ((CSERIALPORTBASE *)p_serialPortBase)->readReady.connect(this, &CSerialPort::onReadReady);
+}
+
+CSerialPort::~CSerialPort()
+{
+    ((CSERIALPORTBASE *)p_serialPortBase)->readReady.disconnect_all();
+
+    if (p_serialPortBase)
+    {
+        delete p_serialPortBase;
+        p_serialPortBase = NULL;
+    }
+}
+
+void itas109::CSerialPort::init(std::string portName,
+                                int baudRate /*= itas109::BaudRate::BaudRate9600*/,
+                                itas109::Parity parity /*= itas109::Parity::ParityNone*/,
+                                itas109::DataBits dataBits /*= itas109::DataBits::DataBits8*/,
+                                itas109::StopBits stopbits /*= itas109::StopBits::StopOne*/,
+                                itas109::FlowControl flowControl /*= itas109::FlowControl::FlowNone*/,
+                                int64 readBufferSize /*= 512*/)
+{
+    if (p_serialPortBase)
+    {
+        p_serialPortBase->init(portName, baudRate, parity, dataBits, stopbits, flowControl, readBufferSize);
+    }
+}
+
+void CSerialPort::setOperateMode(OperateMode operateMode)
+{
+    if (p_serialPortBase)
+    {
+        p_serialPortBase->setOperateMode(operateMode);
+    }
+}
+
+bool itas109::CSerialPort::open()
+{
+    if (p_serialPortBase)
+    {
+        return p_serialPortBase->openPort();
+    }
+    else
+    {
+        return false;
+    }
+}
+
+void itas109::CSerialPort::close()
+{
+    if (p_serialPortBase)
+    {
+        p_serialPortBase->closePort();
+    }
+}
+
+bool itas109::CSerialPort::isOpened()
+{
+    if (p_serialPortBase)
+    {
+        return p_serialPortBase->isOpened();
+    }
+    else
+    {
+        return false;
+    }
+}
+
+int itas109::CSerialPort::readData(char *data, int maxSize)
+{
+    if (p_serialPortBase)
+    {
+        return p_serialPortBase->readData(data, maxSize);
+    }
+    else
+    {
+        return -1;
+    }
+}
+
+int itas109::CSerialPort::readAllData(char *data)
+{
+    if (p_serialPortBase)
+    {
+        return p_serialPortBase->readAllData(data);
+    }
+    else
+    {
+        return -1;
+    }
+}
+
+int itas109::CSerialPort::readLineData(char *data, int maxSize)
+{
+    if (p_serialPortBase)
+    {
+        return p_serialPortBase->readLineData(data, maxSize);
+    }
+    else
+    {
+        return -1;
+    }
+}
+
+int itas109::CSerialPort::writeData(const char *data, int maxSize)
+{
+    if (p_serialPortBase)
+    {
+        return p_serialPortBase->writeData(data, maxSize);
+    }
+    else
+    {
+        return -1;
+    }
+}
+
+void itas109::CSerialPort::setDebugModel(bool isDebug)
+{
+    if (p_serialPortBase)
+    {
+        p_serialPortBase->setDebugModel(isDebug);
+    }
+}
+
+void itas109::CSerialPort::setReadTimeInterval(int msecs)
+{
+    if (p_serialPortBase)
+    {
+        p_serialPortBase->setReadTimeInterval(msecs);
+    }
+}
+
+void CSerialPort::setMinByteReadNotify(unsigned int minByteReadNotify)
+{
+    if (p_serialPortBase)
+    {
+        p_serialPortBase->setMinByteReadNotify(minByteReadNotify);
+    }
+}
+
+int itas109::CSerialPort::getLastError() const
+{
+    if (p_serialPortBase)
+    {
+        return p_serialPortBase->getLastError();
+    }
+    else
+    {
+        // null error
+        return itas109::/*SerialPortError::*/ SystemError;
+    }
+}
+
+void itas109::CSerialPort::clearError()
+{
+    if (p_serialPortBase)
+    {
+        p_serialPortBase->clearError();
+    }
+}
+
+void itas109::CSerialPort::setPortName(std::string portName)
+{
+    if (p_serialPortBase)
+    {
+        p_serialPortBase->setPortName(portName);
+    }
+}
+
+std::string itas109::CSerialPort::getPortName() const
+{
+    if (p_serialPortBase)
+    {
+        return p_serialPortBase->getPortName();
+    }
+    else
+    {
+        return "";
+    }
+}
+
+void itas109::CSerialPort::setBaudRate(int baudRate)
+{
+    if (p_serialPortBase)
+    {
+        p_serialPortBase->setBaudRate(baudRate);
+    }
+}
+
+int itas109::CSerialPort::getBaudRate() const
+{
+    if (p_serialPortBase)
+    {
+        return p_serialPortBase->getBaudRate();
+    }
+    else
+    {
+        return -1;
+    }
+}
+
+void itas109::CSerialPort::setParity(itas109::Parity parity)
+{
+    if (p_serialPortBase)
+    {
+        p_serialPortBase->setParity(parity);
+    }
+}
+
+itas109::Parity itas109::CSerialPort::getParity() const
+{
+    if (p_serialPortBase)
+    {
+        return p_serialPortBase->getParity();
+    }
+    else
+    {
+        // should retrun error
+        return itas109::/*Parity::*/ ParityNone;
+    }
+}
+
+void itas109::CSerialPort::setDataBits(itas109::DataBits dataBits)
+{
+    if (p_serialPortBase)
+    {
+        p_serialPortBase->setDataBits(dataBits);
+    }
+}
+
+itas109::DataBits itas109::CSerialPort::getDataBits() const
+{
+    if (p_serialPortBase)
+    {
+        return p_serialPortBase->getDataBits();
+    }
+    else
+    {
+        // should retrun error
+        return itas109::/*DataBits::*/ DataBits8;
+    }
+}
+
+void itas109::CSerialPort::setStopBits(itas109::StopBits stopbits)
+{
+    if (p_serialPortBase)
+    {
+        p_serialPortBase->setStopBits(stopbits);
+    }
+}
+
+itas109::StopBits itas109::CSerialPort::getStopBits() const
+{
+    if (p_serialPortBase)
+    {
+        return p_serialPortBase->getStopBits();
+    }
+    else
+    {
+        // should retrun error
+        return itas109::/*StopBits::*/ StopOne;
+    }
+}
+
+void itas109::CSerialPort::setFlowControl(itas109::FlowControl flowControl)
+{
+    if (p_serialPortBase)
+    {
+        p_serialPortBase->setFlowControl(flowControl);
+    }
+}
+
+itas109::FlowControl itas109::CSerialPort::getFlowControl() const
+{
+    if (p_serialPortBase)
+    {
+        return p_serialPortBase->getFlowControl();
+    }
+    else
+    {
+        // should retrun error
+        return itas109::/*FlowControl::*/ FlowNone;
+    }
+}
+
+void itas109::CSerialPort::setReadBufferSize(int64 size)
+{
+    if (p_serialPortBase)
+    {
+        p_serialPortBase->setReadBufferSize(size);
+    }
+}
+
+int64 itas109::CSerialPort::getReadBufferSize() const
+{
+    if (p_serialPortBase)
+    {
+        return p_serialPortBase->getReadBufferSize();
+    }
+    else
+    {
+        return -1;
+    }
+}
+
+void itas109::CSerialPort::setDtr(bool set /*= true*/)
+{
+    if (p_serialPortBase)
+    {
+        p_serialPortBase->setDtr(set);
+    }
+}
+
+void itas109::CSerialPort::setRts(bool set /*= true*/)
+{
+    if (p_serialPortBase)
+    {
+        p_serialPortBase->setRts(set);
+    }
+}
+
+std::string itas109::CSerialPort::getVersion()
+{
+    return "https://github.com/itas109/CSerialPort - V4.1.0.201010";
+}
+
+void itas109::CSerialPort::onReadReady()
+{
+    readReady._emit();
+}

+ 38 - 0
StartAPPbyCOM/StartAPPbyCOM/CSerialPort/src/SerialPortBase.cpp

@@ -0,0 +1,38 @@
+#include "CSerialPort/SerialPortBase.h"
+
+CSerialPortBase::CSerialPortBase()
+{
+    lastError = 0;
+
+    m_minByteReadNotify = 1;
+
+    m_operateMode = itas109::AsynchronousOperate;
+}
+
+CSerialPortBase::CSerialPortBase(const std::string &portName)
+{
+    lastError = 0;
+
+    m_minByteReadNotify = 1;
+
+    m_operateMode = itas109::AsynchronousOperate;
+}
+
+CSerialPortBase::~CSerialPortBase() {}
+
+void CSerialPortBase::setOperateMode(itas109::OperateMode operateMode)
+{
+    m_operateMode = operateMode;
+}
+
+unsigned int CSerialPortBase::getMinByteReadNotify()
+{
+    return m_minByteReadNotify;
+}
+
+int CSerialPortBase::getLastError() const
+{
+    return lastError;
+}
+
+void CSerialPortBase::clearError() {}

+ 23 - 0
StartAPPbyCOM/StartAPPbyCOM/CSerialPort/src/SerialPortInfo.cpp

@@ -0,0 +1,23 @@
+#include "CSerialPort/SerialPortInfo.h"
+
+#ifdef I_OS_WIN
+#include "CSerialPort/SerialPortInfoWinBase.h"
+#define CSERIALPORTINFOBASE CSerialPortInfoWinBase
+#elif defined I_OS_UNIX
+#include "CSerialPort/SerialPortInfoUnixBase.h"
+#define CSERIALPORTINFOBASE CSerialPortInfoUnixBase
+#else
+// Not support
+#define CSERIALPORTBASE
+#endif // I_OS_WIN
+
+using namespace itas109;
+
+CSerialPortInfo::CSerialPortInfo() {}
+
+CSerialPortInfo::~CSerialPortInfo() {}
+
+vector<SerialPortInfo> CSerialPortInfo::availablePortInfos()
+{
+    return CSERIALPORTINFOBASE::availablePortInfos();
+}

+ 5 - 0
StartAPPbyCOM/StartAPPbyCOM/CSerialPort/src/SerialPortInfoBase.cpp

@@ -0,0 +1,5 @@
+#include "CSerialPort/SerialPortInfoBase.h"
+
+CSerialPortInfoBase::CSerialPortInfoBase() {}
+
+CSerialPortInfoBase::~CSerialPortInfoBase() {}

+ 282 - 0
StartAPPbyCOM/StartAPPbyCOM/CSerialPort/src/SerialPortInfoUnixBase.cpp

@@ -0,0 +1,282 @@
+#include "CSerialPort/SerialPortInfoUnixBase.h"
+
+#include "CSerialPort/osplatformutil.h"
+
+#ifdef I_OS_LINUX
+#include <dirent.h> //scandir
+#include <stdlib.h> // free
+                    //    #include <stdio.h> // perror
+//#include <sys/types.h>
+#include <sys/stat.h> //S_ISLNK
+#include <unistd.h>   // readlink close
+
+#include <string.h> //basename memset strcmp
+
+#include <fcntl.h>
+#include <linux/serial.h> //struct serial_struct
+#include <sys/ioctl.h>    //ioctl
+#include <termios.h>
+#elif defined I_OS_MAC
+#include <sys/param.h>
+
+#include <CoreFoundation/CoreFoundation.h>
+#include <IOKit/IOKitLib.h>
+#include <IOKit/serial/IOSerialKeys.h>
+#endif
+
+#ifdef I_OS_LINUX
+std::string get_driver(const std::string &tty)
+{
+    struct stat st;
+    std::string devicedir = tty;
+
+    // Append '/device' to the tty-path
+    /// sys/class/tty/ttyS0/device
+    devicedir += "/device";
+
+    // Stat the devicedir and handle it if it is a symlink
+    if (lstat(devicedir.c_str(), &st) == 0 && S_ISLNK(st.st_mode))
+    {
+        char buffer[1024];
+        memset(buffer, 0, sizeof(buffer));
+
+        // Append '/driver' and return basename of the target
+        // VCs, ptys, etc don't have /sys/class/tty/<tty>/device/driver's
+        // /sys/class/tty/ttyS0/device/driver
+        devicedir += "/driver";
+
+        if (readlink(devicedir.c_str(), buffer, sizeof(buffer)) > 0)
+        {
+            // std::cout << "readlink " << devicedir << ", baseName " << basename(buffer) << std::endl;
+
+            return basename(buffer);
+        }
+        else
+        {
+            // std::cout << "readlink error " << devicedir << std::endl;
+        }
+    }
+    else
+    {
+        // std::cout << "lstat error " << devicedir << std::endl;
+    }
+    return "";
+}
+
+void register_comport(vector<std::string> &comList, vector<std::string> &comList8250, const std::string &dir)
+{
+    // Get the driver the device is using
+    std::string driver = get_driver(dir);
+
+    // Skip devices without a driver
+    if (driver.size() > 0)
+    {
+        std::string devfile = std::string("/dev/") + basename(dir.c_str());
+
+        // std::cout << "driver : " << driver << ", devfile : " << devfile << std::endl;
+
+        // Put serial8250-devices in a seperate list
+        if (driver == "serial8250")
+        {
+            comList8250.push_back(devfile);
+        }
+        else
+        {
+            comList.push_back(devfile);
+        }
+    }
+}
+
+void probe_serial8250_comports(vector<std::string> &comList, vector<std::string> comList8250)
+{
+    struct serial_struct serinfo;
+    vector<std::string>::iterator it = comList8250.begin();
+
+    // Iterate over all serial8250-devices
+    while (it != comList8250.end())
+    {
+
+        // Try to open the device
+        int fd = open((*it).c_str(), O_RDWR | O_NONBLOCK | O_NOCTTY);
+
+        if (fd >= 0)
+        {
+            // Get serial_info
+            if (ioctl(fd, TIOCGSERIAL, &serinfo) == 0)
+            {
+                // If device type is no PORT_UNKNOWN we accept the port
+                if (serinfo.type != PORT_UNKNOWN)
+                {
+                    comList.push_back(*it);
+                    // std::cout << "+++  " << *it << std::endl;
+                }
+                else
+                {
+                    // std::cout << "PORT_UNKNOWN " << *it << std::endl;
+                }
+            }
+            close(fd);
+        }
+        ++it;
+    }
+}
+
+vector<std::string> getPortInfoListLinux()
+{
+    // https://stackoverflow.com/questions/2530096/how-to-find-all-serial-devices-ttys-ttyusb-on-linux-without-opening-them
+    int n = -1;
+    struct dirent **namelist;
+    vector<std::string> comList;
+    vector<std::string> comList8250;
+    const char *sysDir = "/sys/class/tty/";
+    const char *ptsDir = "/dev/pts/";
+
+    // 1.Scan through /sys/class/tty - it contains all tty-devices in the system
+    n = scandir(sysDir, &namelist, NULL, NULL);
+    if (n >= 0)
+    {
+        while (n--)
+        {
+            if (strcmp(namelist[n]->d_name, "..") && strcmp(namelist[n]->d_name, "."))
+            {
+                // Construct full absolute file path
+                std::string devicedir = sysDir;
+                devicedir += namelist[n]->d_name;
+
+                // Register the device
+                register_comport(comList, comList8250, devicedir);
+            }
+            free(namelist[n]);
+        }
+        free(namelist);
+    }
+
+    // Only non-serial8250 has been added to comList without any further testing
+    // serial8250-devices must be probe to check for validity
+    probe_serial8250_comports(comList, comList8250);
+
+    // 2.Scan through /dev/pts/- it contains all pseudo terminal(such as telnet, ssh etc.) in the system
+    n = scandir(ptsDir, &namelist, NULL, NULL);
+    if (n >= 0)
+    {
+        while (n--)
+        {
+            if (strcmp(namelist[n]->d_name, "..") && strcmp(namelist[n]->d_name, ".") &&
+                strcmp(namelist[n]->d_name, "ptmx"))
+            {
+                // Construct full absolute file path
+                std::string ptsName = ptsDir;
+                ptsName += namelist[n]->d_name;
+
+                comList.push_back(ptsName);
+            }
+            free(namelist[n]);
+        }
+        free(namelist);
+    }
+
+    // Return the lsit of detected comports
+    return comList;
+}
+
+#endif
+
+#ifdef I_OS_MAC
+std::string getSerialPath(io_object_t &serialPort)
+{
+    char str[MAXPATHLEN];
+    std::string result;
+    CFTypeRef calloutCFString;
+
+    calloutCFString = IORegistryEntryCreateCFProperty(serialPort, CFSTR(kIOCalloutDeviceKey), kCFAllocatorDefault, 0);
+
+    if (calloutCFString)
+    {
+        if (CFStringGetCString(static_cast<CFStringRef>(calloutCFString), str, sizeof(str), kCFStringEncodingUTF8))
+        {
+            result = str;
+        }
+
+        CFRelease(calloutCFString);
+    }
+
+    return result;
+}
+
+vector<SerialPortInfo> getPortInfoListMac()
+{
+    // https://developer.apple.com/documentation/iokit/communicating_with_a_modem_on_a_serial_port
+    SerialPortInfo m_serialPortInfo;
+    vector<SerialPortInfo> portInfoList;
+
+    // mach_port_t master_port;
+
+    kern_return_t kernResult;
+    CFMutableDictionaryRef classesToMatch;
+    io_iterator_t serialPortIterator;
+
+    io_object_t serialPort;
+
+    classesToMatch = IOServiceMatching(kIOSerialBSDServiceValue);
+
+    if (classesToMatch == NULL)
+        return portInfoList;
+
+    CFDictionarySetValue(classesToMatch, CFSTR(kIOSerialBSDTypeKey), CFSTR(kIOSerialBSDAllTypes));
+
+    kernResult = IOServiceGetMatchingServices(kIOMasterPortDefault, classesToMatch, &serialPortIterator);
+
+    if (KERN_SUCCESS != kernResult)
+    {
+        return portInfoList;
+    }
+
+    while (serialPort = IOIteratorNext(serialPortIterator))
+    {
+        string device_path = getSerialPath(serialPort);
+        IOObjectRelease(serialPort);
+
+        if (device_path.empty())
+            continue;
+
+        m_serialPortInfo.portName = device_path;
+
+        portInfoList.push_back(m_serialPortInfo);
+    }
+
+    IOObjectRelease(serialPortIterator);
+    return portInfoList;
+}
+#endif
+
+vector<SerialPortInfo> getPortInfoList()
+{
+    vector<SerialPortInfo> portInfoList;
+#ifdef I_OS_LINUX
+    // TODO: need to optimize
+    SerialPortInfo m_serialPort;
+    vector<std::string> portList = getPortInfoListLinux();
+
+    int count = portList.size();
+
+    for (int i = 0; i < count; i++)
+    {
+        m_serialPort.portName = portList[i];
+        portInfoList.push_back(m_serialPort);
+    }
+#elif defined I_OS_MAC
+    // ls /dev/{tty,cu}.*
+    portInfoList = getPortInfoListMac();
+#endif
+
+    return portInfoList;
+}
+
+CSerialPortInfoUnixBase::CSerialPortInfoUnixBase() {}
+
+CSerialPortInfoUnixBase::~CSerialPortInfoUnixBase() {}
+
+vector<SerialPortInfo> CSerialPortInfoUnixBase::availablePortInfos()
+{
+    return getPortInfoList();
+}

+ 117 - 0
StartAPPbyCOM/StartAPPbyCOM/CSerialPort/src/SerialPortInfoWinBase.cpp

@@ -0,0 +1,117 @@
+#include "CSerialPort/SerialPortInfoWinBase.h"
+
+#include "Windows.h"
+
+/********************* EnumDetailsSerialPorts ****************************************/
+#undef PHYSICAL_ADDRESS
+#define PHYSICAL_ADDRESS LARGE_INTEGER
+
+#include <Setupapi.h> //SetupDiGetClassDevs Setup*
+#include <initguid.h> //GUID
+#include <tchar.h>    //_T
+
+//#include <ntddser.h>  //GUID_DEVINTERFACE_COMPORT
+#ifndef GUID_DEVINTERFACE_COMPORT
+DEFINE_GUID(GUID_DEVINTERFACE_COMPORT, 0x86E0D1E0L, 0x8089, 0x11D0, 0x9C, 0xE4, 0x08, 0x00, 0x3E, 0x30, 0x1F, 0x73);
+#endif
+
+std::string wstringToString(const std::wstring &wstr)
+{
+    // https://stackoverflow.com/questions/4804298/how-to-convert-wstring-into-string
+    if (wstr.empty())
+    {
+        return std::string();
+    }
+
+    int size = WideCharToMultiByte(CP_ACP, 0, &wstr[0], (int)wstr.size(), NULL, 0, NULL, NULL);
+    std::string ret = std::string(size, 0);
+    WideCharToMultiByte(CP_ACP, 0, &wstr[0], (int)wstr.size(), &ret[0], size, NULL, NULL); // CP_UTF8
+
+    return ret;
+}
+
+/**
+ * @brief enumDetailsSerialPorts 通过setapi.lib枚举串口详细信息
+ * @param portInfoList [out] port info list 串口信息列表
+ * @return
+ * @retval true true if excute success 执行成功返回true
+ * @retval false false if excute failed 执行失败返回false
+ */
+bool enumDetailsSerialPorts(vector<SerialPortInfo> &portInfoList)
+{
+    // https://docs.microsoft.com/en-us/windows/win32/api/setupapi/nf-setupapi-setupdienumdeviceinfo
+
+    bool bRet = false;
+    SerialPortInfo m_serialPortInfo;
+
+    std::string strFriendlyName;
+    std::string strPortName;
+
+    HDEVINFO hDevInfo = INVALID_HANDLE_VALUE;
+
+    // Return only devices that are currently present in a system
+    // The GUID_DEVINTERFACE_COMPORT device interface class is defined for COM ports. GUID
+    // {86E0D1E0-8089-11D0-9CE4-08003E301F73}
+    hDevInfo = SetupDiGetClassDevs(&GUID_DEVINTERFACE_COMPORT, NULL, NULL, DIGCF_PRESENT | DIGCF_DEVICEINTERFACE);
+
+    if (INVALID_HANDLE_VALUE != hDevInfo)
+    {
+        SP_DEVINFO_DATA devInfoData;
+        // The caller must set DeviceInfoData.cbSize to sizeof(SP_DEVINFO_DATA)
+        devInfoData.cbSize = sizeof(SP_DEVINFO_DATA);
+
+        for (DWORD i = 0; SetupDiEnumDeviceInfo(hDevInfo, i, &devInfoData); i++)
+        {
+            // get port name
+            TCHAR portName[256];
+            HKEY hDevKey = SetupDiOpenDevRegKey(hDevInfo, &devInfoData, DICS_FLAG_GLOBAL, 0, DIREG_DEV, KEY_READ);
+            if (INVALID_HANDLE_VALUE != hDevKey)
+            {
+                DWORD dwCount = 255; // DEV_NAME_MAX_LEN
+                RegQueryValueEx(hDevKey, _T("PortName"), NULL, NULL, (BYTE *)portName, &dwCount);
+                RegCloseKey(hDevKey);
+            }
+
+            // get friendly name
+            TCHAR fname[256];
+            SetupDiGetDeviceRegistryProperty(hDevInfo, &devInfoData, SPDRP_FRIENDLYNAME, NULL, (PBYTE)fname,
+                                             sizeof(fname), NULL);
+
+#ifdef UNICODE
+            strPortName = wstringToString(portName);
+            strFriendlyName = wstringToString(fname);
+#else
+            strPortName = std::string(portName);
+            strFriendlyName = std::string(fname);
+#endif
+            // remove (COMxx)
+            strFriendlyName = strFriendlyName.substr(0, strFriendlyName.find(("(COM")));
+
+            m_serialPortInfo.portName = strPortName;
+            m_serialPortInfo.description = strFriendlyName;
+            portInfoList.push_back(m_serialPortInfo);
+        }
+
+        if (ERROR_NO_MORE_ITEMS == GetLastError())
+        {
+            bRet = true; // no more item
+        }
+    }
+
+    SetupDiDestroyDeviceInfoList(hDevInfo);
+
+    return bRet;
+}
+/********************* EnumDetailsSerialPorts ****************************************/
+
+CSerialPortInfoWinBase::CSerialPortInfoWinBase() {}
+
+CSerialPortInfoWinBase::~CSerialPortInfoWinBase() {}
+
+vector<SerialPortInfo> CSerialPortInfoWinBase::availablePortInfos()
+{
+    vector<SerialPortInfo> portInfoList;
+    enumDetailsSerialPorts(portInfoList);
+
+    return portInfoList;
+}

+ 652 - 0
StartAPPbyCOM/StartAPPbyCOM/CSerialPort/src/SerialPortUnixBase.cpp

@@ -0,0 +1,652 @@
+#include "CSerialPort/SerialPortUnixBase.h"
+#include <unistd.h> // usleep
+
+CSerialPortUnixBase::CSerialPortUnixBase()
+{
+    construct();
+}
+
+CSerialPortUnixBase::CSerialPortUnixBase(const std::string &portName)
+{
+    construct();
+}
+
+CSerialPortUnixBase::~CSerialPortUnixBase()
+{
+    pthread_mutex_destroy(&m_communicationMutex);
+}
+
+void CSerialPortUnixBase::construct()
+{
+    fd = -1;
+
+    m_baudRate = itas109::BaudRate9600;
+    m_parity = itas109::ParityNone;
+    m_dataBits = itas109::DataBits8;
+    m_stopbits = itas109::StopOne;
+    m_flowControl = itas109::FlowNone;
+    m_readBufferSize = 512;
+
+    m_isThreadRunning = false;
+
+    m_operateMode = itas109::AsynchronousOperate;
+
+    pthread_mutex_init(&m_communicationMutex, NULL);
+}
+
+void CSerialPortUnixBase::init(std::string portName,
+                               int baudRate /*= itas109::BaudRate::BaudRate9600*/,
+                               itas109::Parity parity /*= itas109::Parity::ParityNone*/,
+                               itas109::DataBits dataBits /*= itas109::DataBits::DataBits8*/,
+                               itas109::StopBits stopbits /*= itas109::StopBits::StopOne*/,
+                               itas109::FlowControl flowControl /*= itas109::FlowControl::FlowNone*/,
+                               int64 readBufferSize /*= 512*/)
+{
+    m_portName = portName; // portName;//串口 /dev/ttySn, USB /dev/ttyUSBn
+    m_baudRate = baudRate;
+    m_parity = parity;
+    m_dataBits = dataBits;
+    m_stopbits = stopbits;
+    m_flowControl = flowControl;
+    m_readBufferSize = readBufferSize;
+}
+
+int CSerialPortUnixBase::uart_set(int fd,
+                                  int baudRate,
+                                  itas109::Parity parity,
+                                  itas109::DataBits dataBits,
+                                  itas109::StopBits stopbits,
+                                  itas109::FlowControl flowControl)
+{
+    struct termios options;
+
+    //获取终端属性
+    if (tcgetattr(fd, &options) < 0)
+    {
+        perror("tcgetattr error");
+        return -1;
+    }
+
+    //设置输入输出波特率
+    int baudRateConstant = 0;
+    baudRateConstant = rate2Constant(baudRate);
+
+    if (0 != baudRateConstant)
+    {
+        cfsetispeed(&options, baudRateConstant);
+        cfsetospeed(&options, baudRateConstant);
+    }
+    else
+    {
+        // TODO: custom baudrate
+        fprintf(stderr, "Unkown baudrate!\n");
+        return -1;
+    }
+
+    //设置校验位
+    switch (parity)
+    {
+        /*无奇偶校验位*/
+        case itas109::ParityNone:
+        case 'N':
+            options.c_cflag &= ~PARENB; // PARENB:产生奇偶位,执行奇偶校验
+            options.c_cflag &= ~INPCK;  // INPCK:使奇偶校验起作用
+            break;
+        /*设置奇校验*/
+        case itas109::ParityOdd:
+            options.c_cflag |= PARENB; // PARENB:产生奇偶位,执行奇偶校验
+            options.c_cflag |= PARODD; // PARODD:若设置则为奇校验,否则为偶校验
+            options.c_cflag |= INPCK;  // INPCK:使奇偶校验起作用
+            options.c_cflag |= ISTRIP; // ISTRIP:若设置则有效输入数字被剥离7个字节,否则保留全部8位
+            break;
+        /*设置偶校验*/
+        case itas109::ParityEven:
+            options.c_cflag |= PARENB;  // PARENB:产生奇偶位,执行奇偶校验
+            options.c_cflag &= ~PARODD; // PARODD:若设置则为奇校验,否则为偶校验
+            options.c_cflag |= INPCK;   // INPCK:使奇偶校验起作用
+            options.c_cflag |= ISTRIP; // ISTRIP:若设置则有效输入数字被剥离7个字节,否则保留全部8位
+            break;
+            /*设为空格,即停止位为2位*/
+        case itas109::ParitySpace:
+            options.c_cflag &= ~PARENB; // PARENB:产生奇偶位,执行奇偶校验
+            options.c_cflag &= ~CSTOPB; // CSTOPB:使用两位停止位
+            break;
+        default:
+            fprintf(stderr, "Unkown parity!\n");
+            return -1;
+    }
+
+    //设置数据位
+    switch (dataBits)
+    {
+        case itas109::DataBits5:
+            options.c_cflag &= ~CSIZE; //屏蔽其它标志位
+            options.c_cflag |= CS5;
+            break;
+        case itas109::DataBits6:
+            options.c_cflag &= ~CSIZE; //屏蔽其它标志位
+            options.c_cflag |= CS6;
+            break;
+        case itas109::DataBits7:
+            options.c_cflag &= ~CSIZE; //屏蔽其它标志位
+            options.c_cflag |= CS7;
+            break;
+        case itas109::DataBits8:
+            options.c_cflag &= ~CSIZE; //屏蔽其它标志位
+            options.c_cflag |= CS8;
+            break;
+        default:
+            fprintf(stderr, "Unkown bits!\n");
+            return -1;
+    }
+
+    //停止位
+    switch (stopbits)
+    {
+        case itas109::StopOne:
+            options.c_cflag &= ~CSTOPB; // CSTOPB:使用两位停止位
+            break;
+        case itas109::StopOneAndHalf:
+            fprintf(stderr, "POSIX does not support 1.5 stop bits!\n");
+            return -1;
+        case itas109::StopTwo:
+            options.c_cflag |= CSTOPB; // CSTOPB:使用两位停止位
+            break;
+        default:
+            fprintf(stderr, "Unkown stop!\n");
+            return -1;
+    }
+
+    //控制模式
+    options.c_cflag |= CLOCAL; //保证程序不占用串口
+    options.c_cflag |= CREAD;  //保证程序可以从串口中读取数据
+
+    //流控制
+    switch (flowControl)
+    {
+        case itas109::FlowNone: ///< No flow control 无流控制
+            options.c_cflag &= ~CRTSCTS;
+            break;
+        case itas109::FlowHardware: ///< Hardware(RTS / CTS) flow control 硬件流控制
+            options.c_cflag |= CRTSCTS;
+            break;
+        case itas109::FlowSoftware: ///< Software(XON / XOFF) flow control 软件流控制
+            options.c_cflag |= IXON | IXOFF | IXANY;
+            break;
+        default:
+            fprintf(stderr, "Unkown c_flow!\n");
+            return -1;
+    }
+
+    //设置输出模式为原始输出
+    options.c_oflag &= ~OPOST; // OPOST:若设置则按定义的输出处理,否则所有c_oflag失效
+
+    //设置本地模式为原始模式
+    options.c_lflag &= ~(ICANON | ECHO | ECHOE | ISIG);
+    /*
+     *ICANON:允许规范模式进行输入处理
+     *ECHO:允许输入字符的本地回显
+     *ECHOE:在接收EPASE时执行Backspace,Space,Backspace组合
+     *ISIG:允许信号
+     */
+
+    options.c_iflag &= ~(BRKINT | ICRNL | INPCK | ISTRIP | IXON);
+    /*
+     *BRKINT:如果设置了IGNBRK,BREAK键输入将被忽略
+     *ICRNL:将输入的回车转化成换行(如果IGNCR未设置的情况下)(0x0d => 0x0a)
+     *INPCK:允许输入奇偶校验
+     *ISTRIP:去除字符的第8个比特
+     *IXON:允许输出时对XON/XOFF流进行控制 (0x11 0x13)
+     */
+
+    //设置等待时间和最小接受字符
+    options.c_cc[VTIME] = 0; //可以在select中设置
+    options.c_cc[VMIN] = 1;  //最少读取一个字符
+
+    //如果发生数据溢出,只接受数据,但是不进行读操作
+    tcflush(fd, TCIFLUSH);
+
+    //激活配置
+    if (tcsetattr(fd, TCSANOW, &options) < 0)
+    {
+        perror("tcsetattr failed");
+        return -1;
+    }
+
+    return 0;
+}
+
+void *CSerialPortUnixBase::commThreadMonitor(void *pParam)
+{
+    // Cast the void pointer passed to the thread back to
+    // a pointer of CSerialPortWinBase class
+    CSerialPortUnixBase *p_base = (CSerialPortUnixBase *)pParam;
+
+    if (p_base)
+    {
+        for (; p_base->isThreadRunning();)
+        {
+            int readbytes = 0;
+
+            // read前获取可读的字节数,不区分阻塞和非阻塞
+            ioctl(p_base->fd, FIONREAD, &readbytes);
+            if (readbytes >= p_base->getMinByteReadNotify()) //设定字符数,默认为2
+            {
+                p_base->readReady._emit();
+            }
+            else
+            {
+                usleep(1); // fix high cpu usage on unix
+            }
+        }
+    }
+    else
+    {
+        // point null
+    }
+
+    pthread_exit(NULL);
+}
+
+bool CSerialPortUnixBase::startThreadMonitor()
+{
+    bool bRet = true;
+
+    // start read thread
+    int ret = pthread_create(&m_monitorThread, NULL, commThreadMonitor, (void *)this);
+    if (ret < 0)
+    {
+        bRet = false;
+
+        printf("Create read thread error.");
+    }
+
+    return bRet;
+}
+
+bool CSerialPortUnixBase::stopThreadMonitor()
+{
+    m_isThreadRunning = false;
+
+    pthread_join(m_monitorThread, NULL);
+
+    return true;
+}
+
+bool CSerialPortUnixBase::openPort()
+{
+    bool bRet = false;
+
+    lock();
+
+    // fd = open(m_portName.c_str(),O_RDWR | O_NOCTTY);//阻塞
+
+    fd = open(m_portName.c_str(), O_RDWR | O_NOCTTY | O_NDELAY); //非阻塞
+
+    if (fd != -1)
+    {
+        // if(fcntl(fd,F_SETFL,FNDELAY) >= 0)//非阻塞,覆盖前面open的属性
+        if (fcntl(fd, F_SETFL, 0) >= 0) // 阻塞,即使前面在open串口设备时设置的是非阻塞的,这里设为阻塞后,以此为准
+        {
+            // set param
+            if (uart_set(fd, m_baudRate, m_parity, m_dataBits, m_stopbits, m_flowControl) == -1)
+            {
+                fprintf(stderr, "uart set failed!\n");
+                // exit(EXIT_FAILURE);
+
+                bRet = false;
+                lastError = itas109::/*SerialPortError::*/ InvalidParameterError;
+            }
+            else
+            {
+                m_isThreadRunning = true;
+                bRet = startThreadMonitor();
+
+                if (!bRet)
+                {
+                    m_isThreadRunning = false;
+                    lastError = itas109::/*SerialPortError::*/ SystemError;
+                }
+            }
+        }
+        else
+        {
+            bRet = false;
+            lastError = itas109::/*SerialPortError::*/ SystemError;
+        }
+    }
+    else
+    {
+        // Could not open the port
+        char str[256];
+        snprintf(str, sizeof(str), "open port error: Unable to open %s", m_portName.c_str());
+        perror(str);
+
+        bRet = false;
+        lastError = itas109::/*SerialPortError::*/ OpenError;
+    }
+
+    if (!bRet)
+    {
+        closePort();
+    }
+
+    unlock();
+
+    return bRet;
+}
+
+void CSerialPortUnixBase::closePort()
+{
+    if (isOpened())
+    {
+        stopThreadMonitor();
+
+        close(fd);
+
+        fd = -1;
+    }
+}
+
+bool CSerialPortUnixBase::isOpened()
+{
+    return fd != -1;
+}
+
+int CSerialPortUnixBase::readData(char *data, int maxSize)
+{
+    int iRet = -1;
+    lock();
+
+    if (isOpened())
+    {
+        iRet = read(fd, data, maxSize);
+    }
+    else
+    {
+        lastError = itas109::/*SerialPortError::*/ NotOpenError;
+        iRet = -1;
+    }
+
+    unlock();
+
+    return iRet;
+}
+
+int CSerialPortUnixBase::readAllData(char *data)
+{
+    int readbytes = 0;
+
+    // read前获取可读的字节数,不区分阻塞和非阻塞
+    ioctl(fd, FIONREAD, &readbytes);
+
+    return readData(data, readbytes);
+}
+
+int CSerialPortUnixBase::readLineData(char *data, int maxSize)
+{
+    int iRet = -1;
+    lock();
+
+    if (isOpened())
+    {
+    }
+    else
+    {
+        lastError = itas109::/*SerialPortError::*/ NotOpenError;
+        iRet = -1;
+    }
+
+    unlock();
+
+    return iRet;
+}
+
+int CSerialPortUnixBase::writeData(const char *data, int maxSize)
+{
+    int iRet = -1;
+    lock();
+
+    if (isOpened())
+    {
+        // Write N bytes of BUF to FD.  Return the number written, or -1
+        iRet = write(fd, data, maxSize);
+    }
+    else
+    {
+        lastError = itas109::/*SerialPortError::*/ NotOpenError;
+        iRet = -1;
+    }
+
+    unlock();
+
+    return iRet;
+}
+
+void CSerialPortUnixBase::setDebugModel(bool isDebug)
+{
+    //@todo
+}
+
+void CSerialPortUnixBase::setReadTimeInterval(int msecs)
+{
+    //@todo
+}
+
+void CSerialPortUnixBase::setMinByteReadNotify(unsigned int minByteReadNotify)
+{
+    m_minByteReadNotify = minByteReadNotify;
+}
+
+int CSerialPortUnixBase::getLastError() const
+{
+    return lastError;
+}
+
+void CSerialPortUnixBase::clearError()
+{
+    lastError = itas109::NoError;
+}
+
+void CSerialPortUnixBase::setPortName(std::string portName)
+{
+    m_portName = portName;
+}
+
+std::string CSerialPortUnixBase::getPortName() const
+{
+    return m_portName;
+}
+
+void CSerialPortUnixBase::setBaudRate(int baudRate)
+{
+    m_baudRate = baudRate;
+}
+
+int CSerialPortUnixBase::getBaudRate() const
+{
+    return m_baudRate;
+}
+
+void CSerialPortUnixBase::setParity(itas109::Parity parity)
+{
+    m_parity = parity;
+}
+
+itas109::Parity CSerialPortUnixBase::getParity() const
+{
+    return m_parity;
+}
+
+void CSerialPortUnixBase::setDataBits(itas109::DataBits dataBits)
+{
+    m_dataBits = dataBits;
+}
+
+itas109::DataBits CSerialPortUnixBase::getDataBits() const
+{
+    return m_dataBits;
+}
+
+void CSerialPortUnixBase::setStopBits(itas109::StopBits stopbits)
+{
+    m_stopbits = stopbits;
+}
+
+itas109::StopBits CSerialPortUnixBase::getStopBits() const
+{
+    return m_stopbits;
+}
+
+void CSerialPortUnixBase::setFlowControl(itas109::FlowControl flowControl)
+{
+    m_flowControl = flowControl;
+}
+
+itas109::FlowControl CSerialPortUnixBase::getFlowControl() const
+{
+    return m_flowControl;
+}
+
+void CSerialPortUnixBase::setReadBufferSize(int64 size)
+{
+    m_readBufferSize = size;
+}
+
+int64 CSerialPortUnixBase::getReadBufferSize() const
+{
+    return m_readBufferSize;
+}
+
+void CSerialPortUnixBase::setDtr(bool set /*= true*/) {}
+
+void CSerialPortUnixBase::setRts(bool set /*= true*/) {}
+
+std::string CSerialPortUnixBase::getVersion()
+{
+    std::string m_version = "CSerialPortUnixBase V1.0.1.190728";
+    return m_version;
+}
+
+bool CSerialPortUnixBase::isThreadRunning()
+{
+    return m_isThreadRunning;
+}
+
+void CSerialPortUnixBase::lock()
+{
+    pthread_mutex_lock(&m_communicationMutex);
+}
+
+void CSerialPortUnixBase::unlock()
+{
+    pthread_mutex_unlock(&m_communicationMutex);
+}
+
+int CSerialPortUnixBase::rate2Constant(int baudrate)
+{
+    // https://jim.sh/ftx/files/linux-custom-baudrate.c
+
+#define B(x) \
+    case x:  \
+        return B##x
+
+    switch (baudrate)
+    {
+#ifdef B50
+        B(50);
+#endif
+#ifdef B75
+        B(75);
+#endif
+#ifdef B110
+        B(110);
+#endif
+#ifdef B134
+        B(134);
+#endif
+#ifdef B150
+        B(150);
+#endif
+#ifdef B200
+        B(200);
+#endif
+#ifdef B300
+        B(300);
+#endif
+#ifdef B600
+        B(600);
+#endif
+#ifdef B1200
+        B(1200);
+#endif
+#ifdef B1800
+        B(1800);
+#endif
+#ifdef B2400
+        B(2400);
+#endif
+#ifdef B4800
+        B(4800);
+#endif
+#ifdef B9600
+        B(9600);
+#endif
+#ifdef B19200
+        B(19200);
+#endif
+#ifdef B38400
+        B(38400);
+#endif
+#ifdef B57600
+        B(57600);
+#endif
+#ifdef B115200
+        B(115200);
+#endif
+#ifdef B230400
+        B(230400);
+#endif
+#ifdef B460800
+        B(460800);
+#endif
+#ifdef B500000
+        B(500000);
+#endif
+#ifdef B576000
+        B(576000);
+#endif
+#ifdef B921600
+        B(921600);
+#endif
+#ifdef B1000000
+        B(1000000);
+#endif
+#ifdef B1152000
+        B(1152000);
+#endif
+#ifdef B1500000
+        B(1500000);
+#endif
+#ifdef B2000000
+        B(2000000);
+#endif
+#ifdef B2500000
+        B(2500000);
+#endif
+#ifdef B3000000
+        B(3000000);
+#endif
+#ifdef B3500000
+        B(3500000);
+#endif
+#ifdef B4000000
+        B(4000000);
+#endif
+
+        default:
+            return 0;
+    }
+
+#undef B
+}

+ 961 - 0
StartAPPbyCOM/StartAPPbyCOM/CSerialPort/src/SerialPortWinBase.cpp

@@ -0,0 +1,961 @@
+#include "CSerialPort/SerialPortWinBase.h"
+
+#include <iostream>
+
+std::wstring stringToWString(const std::string &str)
+{
+    if (str.empty())
+    {
+        return std::wstring();
+    }
+
+    int size = MultiByteToWideChar(CP_ACP, 0, &str[0], (int)str.size(), NULL, 0);
+    std::wstring ret = std::wstring(size, 0);
+    MultiByteToWideChar(CP_ACP, 0, &str[0], (int)str.size(), &ret[0], size);
+
+    return ret;
+}
+
+CSerialPortWinBase::CSerialPortWinBase()
+{
+    construct();
+}
+
+CSerialPortWinBase::CSerialPortWinBase(const std::string &portName)
+{
+    construct();
+}
+
+CSerialPortWinBase::~CSerialPortWinBase()
+{
+    if (isOpened())
+    {
+        closePort();
+    }
+
+    DeleteCriticalSection(&m_communicationMutex);
+}
+
+void CSerialPortWinBase::construct()
+{
+    m_handle = INVALID_HANDLE_VALUE;
+    m_monitorThread = INVALID_HANDLE_VALUE;
+
+    m_baudRate = itas109::BaudRate9600;
+    m_parity = itas109::ParityNone;
+    m_dataBits = itas109::DataBits8;
+    m_stopbits = itas109::StopOne;
+    m_flowControl = itas109::FlowNone;
+    m_readBufferSize = 512;
+
+    m_operateMode = itas109::AsynchronousOperate;
+
+    overlapMonitor.Internal = 0;
+    overlapMonitor.InternalHigh = 0;
+    overlapMonitor.Offset = 0;
+    overlapMonitor.OffsetHigh = 0;
+    overlapMonitor.hEvent = CreateEvent(NULL, true, false, NULL);
+
+    m_isThreadRunning = false;
+
+    InitializeCriticalSection(&m_communicationMutex);
+}
+
+void CSerialPortWinBase::init(std::string portName,
+                              int baudRate /*= itas109::BaudRate::BaudRate9600*/,
+                              itas109::Parity parity /*= itas109::Parity::ParityNone*/,
+                              itas109::DataBits dataBits /*= itas109::DataBits::DataBits8*/,
+                              itas109::StopBits stopbits /*= itas109::StopBits::StopOne*/,
+                              itas109::FlowControl flowControl /*= itas109::FlowControl::FlowNone*/,
+                              int64 readBufferSize /*= 512*/)
+{
+    m_portName = "\\\\.\\" + portName; // support COM10 above \\\\.\\COM10
+    m_baudRate = baudRate;
+    m_parity = parity;
+    m_dataBits = dataBits;
+    m_stopbits = stopbits;
+    m_flowControl = flowControl;
+    m_readBufferSize = readBufferSize;
+}
+
+bool CSerialPortWinBase::openPort()
+{
+    lock();
+
+    bool bRet = false;
+
+    TCHAR *tcPortName = NULL;
+#ifdef UNICODE
+    std::wstring wstr = stringToWString(m_portName);
+    tcPortName = const_cast<TCHAR *>(wstr.c_str());
+#else
+    tcPortName = const_cast<TCHAR *>(m_portName.c_str());
+#endif
+    unsigned long configSize = sizeof(COMMCONFIG);
+    m_comConfigure.dwSize = configSize;
+
+    DWORD dwFlagsAndAttributes = 0;
+    if (m_operateMode == itas109::/*OperateMode::*/ AsynchronousOperate)
+    {
+        dwFlagsAndAttributes += FILE_FLAG_OVERLAPPED;
+    }
+
+    if (!isOpened())
+    {
+        // get a handle to the port
+        m_handle = CreateFile(tcPortName,                   // communication port string (COMX)
+                              GENERIC_READ | GENERIC_WRITE, // read/write types
+                              0,                            // comm devices must be opened with exclusive access
+                              NULL,                         // no security attributes
+                              OPEN_EXISTING,                // comm devices must use OPEN_EXISTING
+                              dwFlagsAndAttributes,         // Async I/O or sync I/O
+                              NULL);
+
+        if (m_handle != INVALID_HANDLE_VALUE)
+        {
+            // get default parameter
+            GetCommConfig(m_handle, &m_comConfigure, &configSize);
+            GetCommState(m_handle, &(m_comConfigure.dcb));
+
+            // set parameter
+            m_comConfigure.dcb.BaudRate = m_baudRate;
+            m_comConfigure.dcb.ByteSize = m_dataBits;
+            m_comConfigure.dcb.Parity = m_parity;
+            m_comConfigure.dcb.StopBits = m_stopbits;
+            // m_comConfigure.dcb.fDtrControl;
+            // m_comConfigure.dcb.fRtsControl;
+
+            m_comConfigure.dcb.fBinary = true;
+            m_comConfigure.dcb.fInX = false;
+            m_comConfigure.dcb.fOutX = false;
+            m_comConfigure.dcb.fAbortOnError = false;
+            m_comConfigure.dcb.fNull = false;
+
+            // setBaudRate(m_baudRate);
+            // setDataBits(m_dataBits);
+            // setStopBits(m_stopbits);
+            // setParity(m_parity);
+
+            setFlowControl(m_flowControl); // @todo
+
+            //            COMMTIMEOUTS m_commTimeouts;
+            //            //set read timeout
+            //            m_commTimeouts.ReadIntervalTimeout = MAXWORD;
+            //            m_commTimeouts.ReadTotalTimeoutMultiplier = 0;
+            //            m_commTimeouts.ReadTotalTimeoutConstant = 0;
+            //            //set write timeout
+            //            m_commTimeouts.WriteTotalTimeoutConstant = 500;
+            //            m_commTimeouts.WriteTotalTimeoutMultiplier = 100;
+            //            SetCommTimeouts(m_handle,&m_commTimeouts); // @todo for test
+
+            if (SetCommConfig(m_handle, &m_comConfigure, configSize))
+            {
+                // @todo
+                // Discards all characters from the output or input buffer of a specified communications resource. It
+                // can also terminate pending read or write operations on the resource.
+                PurgeComm(m_handle, PURGE_TXABORT | PURGE_TXCLEAR | PURGE_RXCLEAR | PURGE_RXABORT);
+
+                // init event driven approach
+                if (m_operateMode == itas109::/*OperateMode::*/ AsynchronousOperate)
+                {
+                    m_comTimeout.ReadIntervalTimeout = MAXDWORD;
+                    m_comTimeout.ReadTotalTimeoutMultiplier = 0;
+                    m_comTimeout.ReadTotalTimeoutConstant = 0;
+                    m_comTimeout.WriteTotalTimeoutMultiplier = 0;
+                    m_comTimeout.WriteTotalTimeoutConstant = 0;
+                    SetCommTimeouts(m_handle, &m_comTimeout);
+
+                    // set comm event
+                    if (SetCommMask(m_handle, EV_TXEMPTY | EV_RXCHAR | EV_DSR)) // @todo mask need modify
+                    {
+                        m_isThreadRunning = true;
+                        bRet = startThreadMonitor();
+
+                        if (!bRet)
+                        {
+                            m_isThreadRunning = false;
+                            lastError = itas109::/*SerialPortError::*/ SystemError;
+                        }
+                    }
+                    else
+                    {
+                        // Failed to set Comm Mask
+                        bRet = false;
+                        lastError = itas109::/*SerialPortError::*/ InvalidParameterError;
+                    }
+                }
+                else
+                {
+                    m_comTimeout.ReadIntervalTimeout = MAXDWORD;
+                    m_comTimeout.ReadTotalTimeoutMultiplier = 0;
+                    m_comTimeout.ReadTotalTimeoutConstant = 0;
+                    m_comTimeout.WriteTotalTimeoutMultiplier = 100;
+                    m_comTimeout.WriteTotalTimeoutConstant = 500;
+                    SetCommTimeouts(m_handle, &m_comTimeout);
+
+                    bRet = true;
+                }
+            }
+            else
+            {
+                // set com configure error
+                bRet = false;
+                lastError = itas109::/*SerialPortError::*/ InvalidParameterError;
+            }
+        }
+        else
+        {
+            //串口打开失败,增加提示信息
+            switch (GetLastError())
+            {
+                //串口不存在
+                case ERROR_FILE_NOT_FOUND:
+                {
+                    lastError = itas109::/*SerialPortError::*/ DeviceNotFoundError;
+
+                    break;
+                }
+                    //串口拒绝访问
+                case ERROR_ACCESS_DENIED:
+                {
+                    lastError = itas109::/*SerialPortError::*/ PermissionError;
+
+                    break;
+                }
+                default:
+                    lastError = itas109::/*SerialPortError::*/ UnknownError;
+                    break;
+            }
+        }
+    }
+    else
+    {
+        bRet = false;
+        lastError = itas109::/*SerialPortError::*/ OpenError;
+    }
+
+    if (!bRet)
+    {
+        closePort();
+    }
+
+    unlock();
+
+    return bRet;
+}
+
+void CSerialPortWinBase::closePort()
+{
+    // Finished
+    if (isOpened())
+    {
+        stopThreadMonitor();
+
+        if (m_handle != INVALID_HANDLE_VALUE)
+        {
+            // stop all event
+            SetCommMask(m_handle, 0); // SetCommMask(m_handle,0) stop WaitCommEvent()
+
+            // Discards all characters from the output or input buffer of a specified communications resource. It can
+            // also terminate pending read or write operations on the resource.
+            PurgeComm(m_handle, PURGE_TXABORT | PURGE_TXCLEAR | PURGE_RXCLEAR | PURGE_RXABORT);
+
+            CloseHandle(m_handle);
+            m_handle = INVALID_HANDLE_VALUE;
+        }
+
+        ResetEvent(overlapMonitor.hEvent);
+    }
+}
+
+unsigned int __stdcall CSerialPortWinBase::commThreadMonitor(LPVOID pParam)
+{
+    // Cast the void pointer passed to the thread back to
+    // a pointer of CSerialPortWinBase class
+    CSerialPortWinBase *p_base = (CSerialPortWinBase *)pParam;
+
+    int iRet = 0;
+
+    DWORD dwError = 0;
+    COMSTAT comstat;
+
+    if (p_base)
+    {
+        DWORD eventMask = 0;
+
+        HANDLE m_mainHandle = p_base->getMainHandle();
+        OVERLAPPED m_overlapMonitor = p_base->getOverlapMonitor();
+
+        ResetEvent(m_mainHandle);
+
+        for (; p_base->isThreadRunning();)
+        {
+            if (!WaitCommEvent(m_mainHandle, &eventMask, &m_overlapMonitor))
+            {
+                switch (GetLastError())
+                {
+                    case ERROR_IO_PENDING: // normal, because no bytes. error code:997
+                    {
+                        // This is a normal return value if there are no bytes to read at the port.
+                        break;
+                    }
+                    case ERROR_INVALID_PARAMETER: // system error. error code:87
+                    {
+                        // Under Windows NT, this value is returned for some reason.
+                        // I have not investigated why, but it is also a valid reply
+                        // Also do nothing and continue.
+                        break;
+                    }
+                    case ERROR_ACCESS_DENIED: // Access denied. error code:5
+                    {
+                        // std::cout << "comm acess denied" << std::endl;
+                        break;
+                    }
+                    case ERROR_INVALID_HANDLE: // handle invalid. error code:6
+                    {
+                        // std::cout << "comm handle invalid" << std::endl;
+                        break;
+                    }
+                    case ERROR_BAD_COMMAND: // illegal disconnect. error code:22
+                    {
+                        // std::cout << "comm illegal disconnect" << std::endl;
+                        break;
+                    }
+                    default:
+                    {
+                        // All other error codes indicate a serious error has occured.  Process this error.
+                        p_base->m_handle = INVALID_HANDLE_VALUE;
+                        break;
+                    }
+                }
+            }
+            else
+            {
+                // If WaitCommEvent() returns TRUE, check to be sure there are actually bytes in the buffer to read
+                ClearCommError(m_mainHandle, &dwError, &comstat);
+                if (comstat.cbInQue == 0)
+                {
+                    continue;
+                }
+            }
+
+            if (WaitForSingleObject(m_overlapMonitor.hEvent, INFINITE) == WAIT_OBJECT_0)
+            {
+                // overlap event occured
+                DWORD undefined;
+                if (!GetOverlappedResult(m_mainHandle, &m_overlapMonitor, &undefined, false))
+                {
+                    // Comm event overlapped error
+                    return 1; //@ todo
+                }
+
+                if (eventMask & EV_RXCHAR)
+                {
+
+                    // std::cout << "EV_RXCHAR" << std::endl;
+
+                    // solve 线程中循环的低效率问题
+                    ClearCommError(m_mainHandle, &dwError, &comstat);
+                    if (comstat.cbInQue >= p_base->getMinByteReadNotify()) //设定字符数,默认为2
+                    {
+                        p_base->readReady._emit();
+                    }
+                }
+
+                if (eventMask & EV_TXEMPTY)
+                {
+                    DWORD numBytes;
+                    GetOverlappedResult(m_mainHandle, &m_overlapMonitor, &numBytes, true);
+                    // std::cout << "EV_TXEMPTY" << std::endl;
+                }
+
+                if (eventMask & EV_DSR)
+                {
+                    // std::cout << "EV_DSR" << std::endl;
+                }
+            }
+        }
+    }
+    else
+    {
+        // point null
+        iRet = 0;
+    }
+
+    return iRet;
+}
+
+bool CSerialPortWinBase::isOpened()
+{
+    // Finished
+    return m_handle != INVALID_HANDLE_VALUE;
+}
+
+int CSerialPortWinBase::readData(char *data, int maxSize)
+{
+    DWORD dRet = 0;
+
+    lock();
+
+    if (isOpened())
+    {
+        if (m_operateMode == itas109::/*OperateMode::*/ AsynchronousOperate)
+        {
+            m_overlapRead.Internal = 0;
+            m_overlapRead.InternalHigh = 0;
+            m_overlapRead.Offset = 0;
+            m_overlapRead.OffsetHigh = 0;
+            m_overlapRead.hEvent = CreateEvent(NULL, true, false, NULL);
+            if (ReadFile(m_handle, (void *)data, (DWORD)maxSize, &dRet, &m_overlapRead))
+            {
+                // data[dRet] = '\0';
+            }
+            else
+            {
+                if (GetLastError() == ERROR_IO_PENDING) // Normal, No data read - error code:997
+                {
+                    GetOverlappedResult(m_handle, &m_overlapRead, &dRet, true);
+                }
+                else
+                {
+                    lastError = itas109::/*SerialPortError::*/ ReadError;
+                    dRet = (DWORD)-1;
+                }
+            }
+            CloseHandle(m_overlapRead.hEvent);
+        }
+        else
+        {
+            if (ReadFile(m_handle, (void *)data, (DWORD)maxSize, &dRet, NULL))
+            {
+            }
+            else
+            {
+                lastError = itas109::/*SerialPortError::*/ ReadError;
+                dRet = (DWORD)-1;
+            }
+        }
+    }
+    else
+    {
+        lastError = itas109::/*SerialPortError::*/ NotOpenError;
+        dRet = (DWORD)-1;
+    }
+
+    unlock();
+
+    return dRet;
+}
+
+int CSerialPortWinBase::readAllData(char *data)
+{
+    int maxSize = 0;
+
+    if (m_operateMode == itas109::/*OperateMode::*/ AsynchronousOperate)
+    {
+        DWORD dwError = 0;
+        COMSTAT comstat;
+        ClearCommError(m_handle, &dwError, &comstat);
+        maxSize = comstat.cbInQue;
+    }
+    else
+    {
+        maxSize = 1024; // Synchronous ClearCommError not work
+    }
+
+    return readData(data, maxSize);
+}
+
+int CSerialPortWinBase::readLineData(char *data, int maxSize)
+{
+    DWORD dRet = 0;
+    lock();
+
+    if (isOpened())
+    {
+    }
+    else
+    {
+        lastError = itas109::/*SerialPortError::*/ NotOpenError;
+        dRet = (DWORD)-1;
+    }
+
+    unlock();
+
+    return dRet;
+}
+
+int CSerialPortWinBase::writeData(const char *data, int maxSize)
+{
+    DWORD dRet = 0;
+
+    lock();
+
+    if (isOpened())
+    {
+        // @todo maybe mutile thread not need this
+        // Discards all characters from the output or input buffer of a specified communications resource. It can also
+        // terminate pending read or write operations on the resource.
+        //::PurgeComm(m_handle, PURGE_TXABORT | PURGE_TXCLEAR | PURGE_RXCLEAR | PURGE_RXABORT);
+
+        if (m_operateMode == itas109::/*OperateMode::*/ AsynchronousOperate)
+        {
+            BOOL bWrite = TRUE;
+            BOOL bResult = TRUE;
+
+            if (bWrite)
+            {
+                m_overlapWrite.Internal = 0;
+                m_overlapWrite.InternalHigh = 0;
+                m_overlapWrite.Offset = 0;
+                m_overlapWrite.OffsetHigh = 0;
+                m_overlapWrite.hEvent = CreateEvent(NULL, true, false, NULL);
+
+                // The GetLastError code ERROR_IO_PENDING is not a failure; it designates the write operation is pending
+                // completion asynchronously.
+                bResult = WriteFile(m_handle, (void *)data, (DWORD)maxSize, &dRet, &m_overlapWrite);
+
+                // deal with any error codes
+                if (!bResult)
+                {
+                    DWORD dwError = GetLastError();
+                    switch (dwError)
+                    {
+                        case ERROR_IO_PENDING:
+                        {
+                            // continue to GetOverlappedResults()
+                            bWrite = FALSE;
+                            dRet = (DWORD)-1;
+                            break;
+                        }
+                        case ERROR_ACCESS_DENIED: ///拒绝访问 erroe code:5
+                        {
+                            break;
+                        }
+                        case ERROR_INVALID_HANDLE: ///打开串口失败 erroe code:6
+                        {
+                            break;
+                        }
+                        case ERROR_BAD_COMMAND: ///连接过程中非法断开 erroe code:22
+                        {
+                            break;
+                        }
+                        default:
+                        {
+                            // all other error codes
+                            break;
+                        }
+                    }
+                }
+                else
+                {
+                    // write ok
+                }
+            }
+
+            if (!bWrite)
+            {
+                // bWrite = TRUE;
+
+                bResult = GetOverlappedResult(m_handle, &m_overlapWrite, &dRet, TRUE);
+            }
+
+            if (bResult)
+            {
+                // write ok
+            }
+            else
+            {
+                lastError = itas109::/*SerialPortError::*/ WriteError;
+                dRet = (DWORD)-1;
+            }
+
+            CloseHandle(m_overlapWrite.hEvent);
+        }
+        else
+        {
+            if (WriteFile(m_handle, (void *)data, (DWORD)maxSize, &dRet, NULL))
+            {
+            }
+            else
+            {
+                lastError = itas109::/*SerialPortError::*/ WriteError;
+                dRet = (DWORD)-1;
+            }
+        }
+    }
+    else
+    {
+        lastError = itas109::/*SerialPortError::*/ NotOpenError;
+        dRet = (DWORD)-1;
+    }
+
+    unlock();
+
+    return dRet;
+}
+
+void CSerialPortWinBase::setDebugModel(bool isDebug)
+{
+    //@todo
+}
+
+void CSerialPortWinBase::setReadTimeInterval(int msecs)
+{
+    //@todo
+}
+
+void CSerialPortWinBase::setMinByteReadNotify(unsigned int minByteReadNotify)
+{
+    m_minByteReadNotify = minByteReadNotify;
+}
+
+int CSerialPortWinBase::getLastError() const
+{
+    return lastError;
+}
+
+void CSerialPortWinBase::clearError()
+{
+    lastError = itas109::/*SerialPortError::*/ NoError;
+}
+
+void CSerialPortWinBase::setPortName(std::string portName)
+{
+    // Windows : COM1
+    // Linux : /dev/ttyS0
+    m_portName = "\\\\.\\" + portName; // support COM10 above \\\\.\\COM10
+}
+
+std::string CSerialPortWinBase::getPortName() const
+{
+    return m_portName;
+}
+
+void CSerialPortWinBase::setBaudRate(int baudRate)
+{
+    lock();
+    m_baudRate = baudRate;
+    m_comConfigure.dcb.BaudRate = m_baudRate;
+    SetCommConfig(m_handle, &m_comConfigure, sizeof(COMMCONFIG));
+
+    unlock();
+}
+
+int CSerialPortWinBase::getBaudRate() const
+{
+    return m_baudRate;
+}
+
+void CSerialPortWinBase::setParity(itas109::Parity parity)
+{
+    lock();
+    m_parity = parity;
+
+    if (isOpened())
+    {
+        m_comConfigure.dcb.Parity = (unsigned char)parity;
+        switch (parity)
+        {
+            case itas109::/*Parity::*/ ParityNone:
+                m_comConfigure.dcb.fParity = FALSE;
+                break;
+            case itas109::/*Parity::*/ ParityOdd:
+                m_comConfigure.dcb.fParity = TRUE;
+                break;
+            case itas109::/*Parity::*/ ParityEven:
+                m_comConfigure.dcb.fParity = TRUE;
+                break;
+            case itas109::/*Parity::*/ ParitySpace:
+                if (m_dataBits == itas109::/*DataBits::*/ DataBits8)
+                {
+                    // Space parity with 8 data bits is not supported by POSIX systems
+                }
+                m_comConfigure.dcb.fParity = TRUE;
+                break;
+            case itas109::/*Parity::*/ ParityMark:
+                // Mark parity is not supported by POSIX systems
+                m_comConfigure.dcb.fParity = TRUE;
+                break;
+        }
+        SetCommConfig(m_handle, &m_comConfigure, sizeof(COMMCONFIG));
+    }
+
+    unlock();
+}
+
+itas109::Parity CSerialPortWinBase::getParity() const
+{
+    return m_parity;
+}
+
+void CSerialPortWinBase::setDataBits(itas109::DataBits dataBits)
+{
+    lock();
+    m_dataBits = dataBits;
+
+    if (isOpened())
+    {
+        switch (dataBits)
+        {
+            case itas109::/*DataBits::*/ DataBits5: // 5 data bits
+                if (m_stopbits == itas109::/*StopBits::*/ StopTwo)
+                {
+                    // 5 Data bits cannot be used with 2 stop bits
+                }
+                else
+                {
+                    m_comConfigure.dcb.ByteSize = 5;
+                    SetCommConfig(m_handle, &m_comConfigure, sizeof(COMMCONFIG));
+                }
+                break;
+            case itas109::/*DataBits::*/ DataBits6: // 6 data bits
+                if (m_stopbits == itas109::/*StopBits::*/ StopOneAndHalf)
+                {
+                    // 6 Data bits cannot be used with 1.5 stop bits
+                }
+                else
+                {
+                    m_comConfigure.dcb.ByteSize = 6;
+                    SetCommConfig(m_handle, &m_comConfigure, sizeof(COMMCONFIG));
+                }
+                break;
+            case itas109::/*DataBits::*/ DataBits7: // 7 data bits
+                if (m_stopbits == itas109::/*StopBits::*/ StopOneAndHalf)
+                {
+                    // 7 Data bits cannot be used with 1.5 stop bits
+                }
+                else
+                {
+                    m_comConfigure.dcb.ByteSize = 7;
+                    SetCommConfig(m_handle, &m_comConfigure, sizeof(COMMCONFIG));
+                }
+                break;
+            case itas109::/*DataBits::*/ DataBits8: // 8 data bits
+                if (m_stopbits == itas109::/*StopBits::*/ StopOneAndHalf)
+                {
+                    // 8 Data bits cannot be used with 1.5 stop bits
+                }
+                else
+                {
+                    m_comConfigure.dcb.ByteSize = 8;
+                    SetCommConfig(m_handle, &m_comConfigure, sizeof(COMMCONFIG));
+                }
+                break;
+        }
+    }
+    unlock();
+}
+
+itas109::DataBits CSerialPortWinBase::getDataBits() const
+{
+    return m_dataBits;
+}
+
+void CSerialPortWinBase::setStopBits(itas109::StopBits stopbits)
+{
+    lock();
+    m_stopbits = stopbits;
+
+    if (isOpened())
+    {
+        switch (m_stopbits)
+        {
+            case itas109::/*StopBits::*/ StopOne: // 1 stop bit
+                m_comConfigure.dcb.StopBits = ONESTOPBIT;
+                SetCommConfig(m_handle, &m_comConfigure, sizeof(COMMCONFIG));
+                break;
+            case itas109::/*StopBits::*/ StopOneAndHalf: // 1.5 stop bit - This is only for the Windows platform
+                if (m_dataBits == itas109::/*DataBits::*/ DataBits5)
+                {
+                    //	1.5 stop bits can only be used with 5 data bits
+                }
+                else
+                {
+                    m_comConfigure.dcb.StopBits = ONE5STOPBITS;
+                    SetCommConfig(m_handle, &m_comConfigure, sizeof(COMMCONFIG));
+                }
+                break;
+
+                /*two stop bits*/
+            case itas109::/*StopBits::*/ StopTwo: // 2 stop bit
+                if (m_dataBits == itas109::/*DataBits::*/ DataBits5)
+                {
+                    // 2 stop bits cannot be used with 5 data bits
+                }
+                else
+                {
+                    m_comConfigure.dcb.StopBits = TWOSTOPBITS;
+                    SetCommConfig(m_handle, &m_comConfigure, sizeof(COMMCONFIG));
+                }
+                break;
+        }
+    }
+    unlock();
+}
+
+itas109::StopBits CSerialPortWinBase::getStopBits() const
+{
+    return m_stopbits;
+}
+
+void CSerialPortWinBase::setFlowControl(itas109::FlowControl flowControl)
+{
+    lock();
+
+    m_flowControl = flowControl;
+
+    if (isOpened())
+    {
+        switch (m_flowControl)
+        {
+            case itas109::/*FlowControl::*/ FlowNone: // No flow control
+
+                m_comConfigure.dcb.fOutxCtsFlow = FALSE;
+                m_comConfigure.dcb.fRtsControl = RTS_CONTROL_DISABLE;
+                m_comConfigure.dcb.fInX = FALSE;
+                m_comConfigure.dcb.fOutX = FALSE;
+                SetCommConfig(m_handle, &m_comConfigure, sizeof(COMMCONFIG));
+                break;
+
+            case itas109::/*FlowControl::*/ FlowSoftware: // Software(XON / XOFF) flow control
+                m_comConfigure.dcb.fOutxCtsFlow = FALSE;
+                m_comConfigure.dcb.fRtsControl = RTS_CONTROL_DISABLE;
+                m_comConfigure.dcb.fInX = TRUE;
+                m_comConfigure.dcb.fOutX = TRUE;
+                SetCommConfig(m_handle, &m_comConfigure, sizeof(COMMCONFIG));
+                break;
+
+            case itas109::/*FlowControl::*/ FlowHardware: // Hardware(RTS / CTS) flow control
+                m_comConfigure.dcb.fOutxCtsFlow = TRUE;
+                m_comConfigure.dcb.fRtsControl = RTS_CONTROL_HANDSHAKE;
+                m_comConfigure.dcb.fInX = FALSE;
+                m_comConfigure.dcb.fOutX = FALSE;
+                SetCommConfig(m_handle, &m_comConfigure, sizeof(COMMCONFIG));
+                break;
+        }
+    }
+
+    unlock();
+}
+
+itas109::FlowControl CSerialPortWinBase::getFlowControl() const
+{
+    return m_flowControl;
+}
+
+void CSerialPortWinBase::setReadBufferSize(int64 size)
+{
+    lock();
+    if (isOpened())
+    {
+        m_readBufferSize = size;
+    }
+    unlock();
+}
+
+int64 CSerialPortWinBase::getReadBufferSize() const
+{
+    return m_readBufferSize;
+}
+
+void CSerialPortWinBase::setDtr(bool set /*= true*/)
+{
+    lock();
+    if (isOpened())
+    {
+        if (set)
+        {
+            EscapeCommFunction(m_handle, SETDTR);
+        }
+        else
+        {
+            EscapeCommFunction(m_handle, CLRDTR);
+        }
+    }
+    unlock();
+}
+
+void CSerialPortWinBase::setRts(bool set /*= true*/)
+{
+    lock();
+    if (isOpened())
+    {
+        if (set)
+        {
+            EscapeCommFunction(m_handle, SETRTS);
+        }
+        else
+        {
+            EscapeCommFunction(m_handle, CLRRTS);
+        }
+    }
+    unlock();
+}
+
+std::string CSerialPortWinBase::getVersion()
+{
+    // Finished
+    std::string m_version = "CSerialPortWinBase V1.0.0.181117";
+    return m_version;
+}
+
+OVERLAPPED CSerialPortWinBase::getOverlapMonitor()
+{
+    // Finished
+    return overlapMonitor;
+}
+
+HANDLE CSerialPortWinBase::getMainHandle()
+{
+    // Finished
+    return m_handle;
+}
+
+bool CSerialPortWinBase::isThreadRunning()
+{
+    return m_isThreadRunning;
+}
+
+void CSerialPortWinBase::lock()
+{
+    // Finished
+    EnterCriticalSection(&m_communicationMutex);
+}
+
+void CSerialPortWinBase::unlock()
+{
+    // Finished
+    LeaveCriticalSection(&m_communicationMutex);
+}
+
+bool CSerialPortWinBase::startThreadMonitor()
+{
+    // Finished
+
+    // start event thread monitor
+    bool bRet = false;
+    m_monitorThread = (HANDLE)_beginthreadex(NULL, 0, commThreadMonitor, (LPVOID)this, 0, NULL);
+    // closeHandle(m_monitorThread);
+    if (m_monitorThread != INVALID_HANDLE_VALUE)
+    {
+        bRet = true;
+    }
+    else
+    {
+        bRet = false;
+    }
+
+    return bRet;
+}
+
+bool CSerialPortWinBase::stopThreadMonitor()
+{
+    // Finished
+
+    SetCommMask(m_monitorThread, 0);
+    m_isThreadRunning = false;
+    //_endthreadex(0);//not recommend
+
+    return true;
+}

+ 1 - 0
StartAPPbyCOM/StartAPPbyCOM/CSerialPort/src/directory_comment.txt

@@ -0,0 +1 @@
+source Ô´´úÂë

+ 205 - 0
StartAPPbyCOM/StartAPPbyCOM/CmdHelper.h

@@ -0,0 +1,205 @@
+#pragma once
+
+#include <vector>
+#include <map>
+#include <string>
+#include <algorithm>
+
+
+template <typename char_t>
+class CmdHelper
+{
+	typedef std::vector<std::basic_string<char_t>> MODE_VEC;
+
+	typedef std::pair<std::basic_string<char_t>, std::basic_string<char_t>> CMD_PAIR;
+	typedef std::map<std::basic_string<char_t>, std::basic_string<char_t>> CMD_MAP;
+public:
+	CmdHelper();
+	virtual ~CmdHelper();
+
+	virtual int initialize(int argc, char_t* argv[]);
+
+	virtual void setModeTag(char_t tag);
+	virtual void setCmdTag(char_t tag);
+	virtual void setCaseSensitive(bool sensitive);
+
+	virtual bool hasMode(const char_t* szMode);
+	virtual bool hasCmd(const char_t* szCmd);
+	virtual int getCmdValue(const char_t* szCmd, std::basic_string<char_t>& tcsValue);
+
+protected:
+	virtual bool isModeKey(const char_t* szMode);
+	virtual bool isCmdKey(const char_t* szCmd);
+
+	virtual typename CmdHelper<char_t>::MODE_VEC::iterator getMode(const char_t* szCmd);
+	virtual typename CmdHelper<char_t>::CMD_MAP::iterator getCmd(const char_t* szCmd);
+
+protected:
+	MODE_VEC m_modeVec;
+	CMD_MAP m_cmdMap;
+
+	char_t m_modeTag;
+	char_t m_cmdTag;
+
+	bool m_caseSensitive;
+};
+
+template <typename char_t>
+CmdHelper<char_t>::CmdHelper()
+	: m_modeTag('/')
+	, m_cmdTag('-')
+	, m_caseSensitive(false)
+{
+}
+
+template <typename char_t>
+CmdHelper<char_t>::~CmdHelper()
+{
+}
+
+template <typename char_t>
+int CmdHelper<char_t>::initialize(int argc, char_t* argv[])
+{
+	int ret = 0;
+
+	m_modeVec.clear();
+	m_cmdMap.clear();
+
+	for (int i = 1; i < argc; i++)
+	{
+		if (isModeKey(argv[i]))
+		{
+			m_modeVec.push_back(argv[i]);
+		}
+		else if (isCmdKey(argv[i]))
+		{
+			if ((i + 1 < argc) && !isCmdKey(argv[i + 1]))
+			{
+				m_cmdMap.insert(CMD_PAIR(argv[i], argv[i + 1]));
+				i++;
+			}
+			else
+			{
+				std::basic_string<char_t> strEmpty;
+				m_cmdMap.insert(CMD_PAIR(argv[i], strEmpty));
+			}
+				
+		}
+	}
+
+	return ret;
+}
+
+template <typename char_t>
+void CmdHelper<char_t>::setModeTag(char_t tag)
+{
+	m_modeTag = tag;
+}
+
+template <typename char_t>
+void CmdHelper<char_t>::setCmdTag(char_t tag)
+{
+	m_cmdTag = tag;
+}
+
+template <typename char_t>
+void CmdHelper<char_t>::setCaseSensitive(bool sensitive)
+{
+	m_caseSensitive = sensitive;
+}
+
+template <typename char_t>
+bool CmdHelper<char_t>::hasMode(const char_t* szMode)
+{
+	typename MODE_VEC::iterator iter = getMode(szMode);
+
+	return iter != m_modeVec.end();
+}
+
+template <typename char_t>
+bool CmdHelper<char_t>::hasCmd(const char_t* szCmd)
+{
+	typename CMD_MAP::iterator iter = getCmd(szCmd);
+
+	return iter != m_cmdMap.end();
+}
+
+template <typename char_t>
+int CmdHelper<char_t>::getCmdValue(const char_t* szCmd, std::basic_string<char_t>& tcsValue)
+{
+	typename CMD_MAP::iterator iter = getCmd(szCmd);
+
+	if (iter == m_cmdMap.end())
+		return -1;
+
+	tcsValue = iter->second;
+
+	return 0;
+}
+
+template <typename char_t>
+bool CmdHelper<char_t>::isModeKey(const char_t* szMode)
+{
+	std::basic_string<char_t> tcsMode = szMode;
+
+	return tcsMode.find(m_modeTag) != std::basic_string<char_t>::npos;
+}
+
+template <typename char_t>
+bool CmdHelper<char_t>::isCmdKey(const char_t* szCmd)
+{
+	std::basic_string<char_t> tcsCmd = szCmd;
+
+	if (tcsCmd.empty())
+		return false;
+	else
+		return tcsCmd[0] == m_cmdTag;
+
+	//return tcsCmd.find(m_cmdTag) != std::basic_string<char_t>::npos;
+}
+
+template <typename char_t>
+typename CmdHelper<char_t>::MODE_VEC::iterator CmdHelper<char_t>::getMode(const char_t* szMode)
+{
+	typename CmdHelper<char_t>::MODE_VEC::iterator iter = m_modeVec.begin();
+
+	for (; iter != m_modeVec.end(); iter++)
+	{
+		std::basic_string<char_t> tcsMode(*iter);
+		std::basic_string<char_t> tcsTargetMode(szMode);
+
+		if (!m_caseSensitive)
+		{
+			transform(tcsMode.begin(), tcsMode.end(), tcsMode.begin(), ::tolower);
+			transform(tcsTargetMode.begin(), tcsTargetMode.end(), tcsTargetMode.begin(), ::tolower);
+		}
+
+		if (tcsMode.compare(tcsTargetMode) == 0)
+			break;
+	}
+
+	return iter;
+}
+
+template <typename char_t>
+typename CmdHelper<char_t>::CMD_MAP::iterator CmdHelper<char_t>::getCmd(const char_t* szCmd)
+{
+	typename CmdHelper<char_t>::CMD_MAP::iterator iter = m_cmdMap.begin();
+
+	for (; iter != m_cmdMap.end(); iter++)
+	{
+		std::basic_string<char_t> tcsCmd(iter->first);
+		std::basic_string<char_t> tcsTargetCmd(szCmd);
+
+		if (!m_caseSensitive)
+		{
+			transform(tcsCmd.begin(), tcsCmd.end(), tcsCmd.begin(), ::tolower);
+			transform(tcsTargetCmd.begin(), tcsTargetCmd.end(), tcsTargetCmd.begin(), ::tolower);
+		}
+
+		if (tcsCmd.compare(tcsTargetCmd) == 0)
+			break;
+	}
+
+	return iter;
+}

+ 245 - 0
StartAPPbyCOM/StartAPPbyCOM/SerialPortManager.cpp

@@ -0,0 +1,245 @@
+#include "SerialPortManager.h"
+
+#include <Shlwapi.h>
+#pragma comment(lib, "Shlwapi.lib")
+
+
+#define CMD_SIZE					6
+
+#define START_APP_EVENT_NAME		_T("DSD_EVENT_START_APP")
+
+
+char cmd_receive_start_app[6]{ 0xAA, 0x06, 0x11, 0x01, 0x94, 0xDE };
+char cmd_send_started_app[5]{ 0xAB, 0x05, 0x0A, 0xDF, 0x4E };
+
+
+
+SerialPortSlot::SerialPortSlot(CSerialPort& serialPort, HANDLE startAPPEvent)
+	: has_slots<>()
+	, m_hStartAPPEvent(startAPPEvent)
+{
+	m_serialPort = serialPort;
+}
+
+void SerialPortSlot::onMessage()
+{
+	char szBuf[CMD_SIZE] = { 0 };
+
+	int nRecv = m_serialPort.readData(szBuf, sizeof(szBuf));
+
+	printf("Receive %d bytes message from client:\n", nRecv);
+	printMessage(szBuf, nRecv);
+
+	handleMessage(szBuf, nRecv);
+}
+
+int SerialPortSlot::handleMessage(const char* szContent, int nRecv)
+{
+	int ret = 1;
+
+	if (nRecv != CMD_SIZE)
+	{
+		printf("Receive message size:%d is not a command size.\n", nRecv);
+		return 1;
+	}
+
+	if (strncmp(cmd_receive_start_app, szContent, sizeof(cmd_receive_start_app)) == 0)
+	{
+		printf("Received start app command.\n");
+		ret = onStartAPP();
+	}
+	
+	return ret;
+}
+
+int SerialPortSlot::onStartAPP()
+{
+	SetEvent(m_hStartAPPEvent);
+
+	return 0;
+}
+
+void SerialPortSlot::printMessage(const char* szData, int size)
+{
+	for (int i = 0; i < size; i++)
+		printf("%02X ", (unsigned char)szData[i]);
+	printf("\n");
+}
+
+//------------------------------------------------------------------------------------
+
+SerialPortManager::SerialPortManager()
+	: m_serialPort(nullptr)
+	, m_serialPortSlot(nullptr)
+	, m_hStartEvent(NULL)
+{
+}
+
+SerialPortManager::~SerialPortManager()
+{
+	release();
+}
+
+int SerialPortManager::initialize()
+{
+	int ret = 0;
+
+	if (m_serialPort)
+		delete m_serialPort;
+	m_serialPort = nullptr;
+
+	/*
+	std::list<std::string> listAvailablePorts;
+
+	listAvailablePorts = CSerialPortInfo::availablePorts();
+
+	for (auto port : listAvailablePorts)
+	{
+		m_serialPort = new CSerialPort();
+
+		m_serialPort->init(port.c_str(), 9600);
+
+		if (!m_serialPort->open())
+		{
+			delete m_serialPort;
+			continue;
+		}
+		else
+			break;
+	}
+	*/
+
+	std::vector<SerialPortInfo> vecAvailablePorts;
+	vecAvailablePorts = CSerialPortInfo::availablePortInfos();
+
+	for (auto port : vecAvailablePorts)
+	{
+		m_serialPort = new CSerialPort();
+
+		m_serialPort->init(port.portName.c_str(), 9600);
+
+		if (!m_serialPort->open())
+		{
+			delete m_serialPort;
+			continue;
+		}
+		else
+			break;
+	}
+
+	if (m_serialPort == nullptr || !m_serialPort->isOpened())
+		return -1;
+
+	if (m_serialPortSlot)
+		delete m_serialPortSlot;
+
+	if ((ret = initEvent()) != 0)
+	{
+		printf("Init event failed! ret=%d\n", ret);
+		return ret;
+	}
+
+	m_serialPortSlot = new SerialPortSlot(*m_serialPort, m_hStartEvent);
+
+	m_serialPort->readReady.connect(m_serialPortSlot, &SerialPortSlot::onMessage);
+
+	return ret;
+}
+
+void SerialPortManager::release()
+{
+	if (m_serialPort)
+		delete m_serialPort;
+	m_serialPort = nullptr;
+
+	CloseHandle(m_hStartEvent);
+	m_hStartEvent = NULL;
+}
+
+int SerialPortManager::listenCOMandStartApp(const TCHAR* szAppPath, const TCHAR* szAppArgs)
+{
+	int ret = 0;
+
+	while (true)
+	{
+		DWORD dwRet = WaitForSingleObject(m_hStartEvent, INFINITE);
+
+		if (dwRet == WAIT_OBJECT_0)
+		{
+			ResetEvent(m_hStartEvent);
+
+			if ((ret = startAPP(szAppPath, szAppArgs)) != 0)
+				printf("Error, startAPP failed! ret=%d\n", ret);
+			else
+				printf("Success, startAPP finished!\n");
+
+			if ((ret = writeData(cmd_send_started_app, sizeof(cmd_send_started_app))) != 0)
+				printf("Error, Respond failed! ret=%d\n", ret);
+			else
+				printf("Respond success!\n");
+		}
+		else
+		{
+			printf("Wait for start app event error! dwRet=%ld\n", dwRet);
+		}
+	}
+
+	return ret;
+}
+
+int SerialPortManager::writeData(const char* szBuf, int size)
+{
+	int ret = 0;
+
+	int nWrite = m_serialPort->writeData(szBuf, size);
+
+	if (nWrite == -1)
+		ret = -1;
+	else if (nWrite != size)
+		ret = -2;
+
+	return ret;
+}
+
+int SerialPortManager::initEvent()
+{
+	if(m_hStartEvent)
+		CloseHandle(m_hStartEvent);
+	m_hStartEvent = NULL;
+
+	m_hStartEvent = CreateEvent(NULL, FALSE, FALSE, START_APP_EVENT_NAME);
+
+	if (m_hStartEvent || GetLastError() == ERROR_ALREADY_EXISTS)
+		return 0;
+	else
+		return -1;
+}
+
+int SerialPortManager::startAPP(const TCHAR* szAppPath, const TCHAR* szAppArgs)
+{
+	if (!PathFileExists(szAppPath))
+	{
+		printf("Error, %ls path not exists!\n", szAppPath);
+		return -1;
+	}
+
+	SHELLEXECUTEINFO ShExecInfo;
+	ShExecInfo.cbSize = sizeof(SHELLEXECUTEINFO);
+	ShExecInfo.fMask = SEE_MASK_NOCLOSEPROCESS;
+	ShExecInfo.hwnd = NULL;
+	ShExecInfo.lpVerb = _T("open");
+	ShExecInfo.lpFile = szAppPath;
+	ShExecInfo.lpParameters = szAppArgs;
+	ShExecInfo.lpDirectory = NULL;
+	ShExecInfo.nShow = SW_SHOW;
+	ShExecInfo.hInstApp = NULL;
+
+	if (ShellExecuteEx(&ShExecInfo))
+	{
+		CloseHandle(ShExecInfo.hProcess);
+		return 0;
+	}
+		
+	return -2;
+}
+

+ 59 - 0
StartAPPbyCOM/StartAPPbyCOM/SerialPortManager.h

@@ -0,0 +1,59 @@
+#pragma once
+
+#include <tchar.h>
+#include <Windows.h>
+
+#include "CSerialPort/sigslot.h"
+#include "CSerialPort/SerialPort.h"
+#include "CSerialPort/SerialPortInfo.h"
+
+
+using namespace itas109;
+
+
+class SerialPortSlot : public has_slots<>
+{
+public:
+	SerialPortSlot(CSerialPort& serialPort, HANDLE startAPPEvent);
+
+	virtual void onMessage();
+
+protected:
+	virtual int handleMessage(const char* szContent, int nRecv);
+
+	virtual int onStartAPP();
+
+	virtual void printMessage(const char* szData, int size);
+
+private:
+	CSerialPort m_serialPort;
+	HANDLE m_hStartAPPEvent;
+};
+
+
+class SerialPortManager
+{
+public:
+	SerialPortManager();
+	virtual ~SerialPortManager();
+
+	virtual int initialize();
+
+	virtual int listenCOMandStartApp(const TCHAR* szAppPath, const TCHAR* szAppArgs);
+
+protected:
+	virtual void release();
+
+	virtual int writeData(const char* szBuf, int size);
+
+	virtual int initEvent();
+
+	virtual int startAPP(const TCHAR* szAppPath, const TCHAR* szAppArgs);
+
+protected:
+	CSerialPort* m_serialPort;
+	SerialPortSlot* m_serialPortSlot;
+
+	HANDLE m_hStartEvent;
+};
+

+ 71 - 0
StartAPPbyCOM/StartAPPbyCOM/StartAPPbyCOM.cpp

@@ -0,0 +1,71 @@
+// StartAPPbyCOM.cpp : This file contains the 'main' function. Program execution begins and ends there.
+//
+
+#include <iostream>
+#include <tchar.h>
+
+#include "CmdHelper.h"
+#include "SerialPortManager.h"
+
+
+#ifdef _UNICODE
+#pragma comment(linker, "/subsystem:\"windows\" /entry:\"wmainCRTStartup\"")
+#else
+#pragma comment(linker, "/subsystem:\"windows\" /entry:\"mainCRTStartup\"")
+#endif
+
+
+#define     TAG_CMD_START_APP   _T("-startApp")
+#define     TAG_ARG_START_APP   _T("-startAppArg")
+
+
+int _tmain(int argc, TCHAR* argv[])
+{
+    int ret = 0;
+
+    CmdHelper<TCHAR> cmdHelper;
+    if ((ret = cmdHelper.initialize(argc, argv)) != 0)
+    {
+        printf("Initialize command failed! ret=%d\n", ret);
+        return ret;
+    }
+
+    std::basic_string<TCHAR> tcsAppPath = _T("");
+    std::basic_string<TCHAR> tcsAppArgs = _T("");
+
+    if ((ret = cmdHelper.getCmdValue(TAG_CMD_START_APP, tcsAppPath)) != 0 || tcsAppPath.empty())
+    {
+        printf("Please specific your app path!\n");
+        return ret;
+    }
+
+    cmdHelper.getCmdValue(TAG_ARG_START_APP, tcsAppArgs);
+
+
+    SerialPortManager spManager;
+
+    if ((ret = spManager.initialize()) != 0)
+    {
+        printf("Initialize SerialPortManager failed! ret=%d\n", ret);
+        return ret;
+    }
+
+    if ((ret = spManager.listenCOMandStartApp(tcsAppPath.c_str(), tcsAppArgs.c_str())) != 0)
+    {
+        printf("listenCOMandStartApp failed ret=%d\n", ret);
+        return ret;
+    }
+
+    return ret;
+}
+
+// Run program: Ctrl + F5 or Debug > Start Without Debugging menu
+// Debug program: F5 or Debug > Start Debugging menu
+
+// Tips for Getting Started: 
+//   1. Use the Solution Explorer window to add/manage files
+//   2. Use the Team Explorer window to connect to source control
+//   3. Use the Output window to see build output and other messages
+//   4. Use the Error List window to view errors
+//   5. Go to Project > Add New Item to create new code files, or Project > Add Existing Item to add existing code files to the project
+//   6. In the future, to open this project again, go to File > Open > Project and select the .sln file

+ 100 - 0
StartAPPbyCOM/StartAPPbyCOM/StartAPPbyCOM.rc

@@ -0,0 +1,100 @@
+// Microsoft Visual C++ generated resource script.
+//
+#include "resource.h"
+
+#define APSTUDIO_READONLY_SYMBOLS
+/////////////////////////////////////////////////////////////////////////////
+//
+// Generated from the TEXTINCLUDE 2 resource.
+//
+#include "winres.h"
+
+/////////////////////////////////////////////////////////////////////////////
+#undef APSTUDIO_READONLY_SYMBOLS
+
+/////////////////////////////////////////////////////////////////////////////
+// English (United States) resources
+
+#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)
+LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
+#pragma code_page(1252)
+
+#ifdef APSTUDIO_INVOKED
+/////////////////////////////////////////////////////////////////////////////
+//
+// TEXTINCLUDE
+//
+
+1 TEXTINCLUDE 
+BEGIN
+    "resource.h\0"
+END
+
+2 TEXTINCLUDE 
+BEGIN
+    "#include ""winres.h""\r\n"
+    "\0"
+END
+
+3 TEXTINCLUDE 
+BEGIN
+    "\r\n"
+    "\0"
+END
+
+#endif    // APSTUDIO_INVOKED
+
+
+/////////////////////////////////////////////////////////////////////////////
+//
+// Version
+//
+
+VS_VERSION_INFO VERSIONINFO
+ FILEVERSION 1,0,0,2
+ PRODUCTVERSION 1,0,0,2
+ FILEFLAGSMASK 0x3fL
+#ifdef _DEBUG
+ FILEFLAGS 0x1L
+#else
+ FILEFLAGS 0x0L
+#endif
+ FILEOS 0x40004L
+ FILETYPE 0x1L
+ FILESUBTYPE 0x0L
+BEGIN
+    BLOCK "StringFileInfo"
+    BEGIN
+        BLOCK "040904b0"
+        BEGIN
+            VALUE "CompanyName", "DECENTA"
+            VALUE "FileDescription", "DECENTA START APP BY COM"
+            VALUE "FileVersion", "1.0.0.2"
+            VALUE "InternalName", "StartAPP.exe"
+            VALUE "LegalCopyright", "Copyright (C) 2021"
+            VALUE "OriginalFilename", "StartAPP.exe"
+            VALUE "ProductName", "DECENTA START APP"
+            VALUE "ProductVersion", "1.0.0.2"
+        END
+    END
+    BLOCK "VarFileInfo"
+    BEGIN
+        VALUE "Translation", 0x409, 1200
+    END
+END
+
+#endif    // English (United States) resources
+/////////////////////////////////////////////////////////////////////////////
+
+
+
+#ifndef APSTUDIO_INVOKED
+/////////////////////////////////////////////////////////////////////////////
+//
+// Generated from the TEXTINCLUDE 3 resource.
+//
+
+
+/////////////////////////////////////////////////////////////////////////////
+#endif    // not APSTUDIO_INVOKED
+

+ 187 - 0
StartAPPbyCOM/StartAPPbyCOM/StartAPPbyCOM.vcxproj

@@ -0,0 +1,187 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+  <ItemGroup Label="ProjectConfigurations">
+    <ProjectConfiguration Include="Debug|Win32">
+      <Configuration>Debug</Configuration>
+      <Platform>Win32</Platform>
+    </ProjectConfiguration>
+    <ProjectConfiguration Include="Release|Win32">
+      <Configuration>Release</Configuration>
+      <Platform>Win32</Platform>
+    </ProjectConfiguration>
+    <ProjectConfiguration Include="Debug|x64">
+      <Configuration>Debug</Configuration>
+      <Platform>x64</Platform>
+    </ProjectConfiguration>
+    <ProjectConfiguration Include="Release|x64">
+      <Configuration>Release</Configuration>
+      <Platform>x64</Platform>
+    </ProjectConfiguration>
+  </ItemGroup>
+  <PropertyGroup Label="Globals">
+    <VCProjectVersion>16.0</VCProjectVersion>
+    <Keyword>Win32Proj</Keyword>
+    <ProjectGuid>{34af4db2-8e55-4f33-b78a-f6c8c3a68391}</ProjectGuid>
+    <RootNamespace>StartAPPbyCOM</RootNamespace>
+    <WindowsTargetPlatformVersion>10.0</WindowsTargetPlatformVersion>
+  </PropertyGroup>
+  <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
+    <ConfigurationType>Application</ConfigurationType>
+    <UseDebugLibraries>true</UseDebugLibraries>
+    <PlatformToolset>v142</PlatformToolset>
+    <CharacterSet>Unicode</CharacterSet>
+  </PropertyGroup>
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
+    <ConfigurationType>Application</ConfigurationType>
+    <UseDebugLibraries>false</UseDebugLibraries>
+    <PlatformToolset>v142</PlatformToolset>
+    <WholeProgramOptimization>true</WholeProgramOptimization>
+    <CharacterSet>Unicode</CharacterSet>
+  </PropertyGroup>
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
+    <ConfigurationType>Application</ConfigurationType>
+    <UseDebugLibraries>true</UseDebugLibraries>
+    <PlatformToolset>v142</PlatformToolset>
+    <CharacterSet>Unicode</CharacterSet>
+  </PropertyGroup>
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
+    <ConfigurationType>Application</ConfigurationType>
+    <UseDebugLibraries>false</UseDebugLibraries>
+    <PlatformToolset>v142</PlatformToolset>
+    <WholeProgramOptimization>true</WholeProgramOptimization>
+    <CharacterSet>Unicode</CharacterSet>
+  </PropertyGroup>
+  <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
+  <ImportGroup Label="ExtensionSettings">
+  </ImportGroup>
+  <ImportGroup Label="Shared">
+  </ImportGroup>
+  <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
+    <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+  </ImportGroup>
+  <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
+    <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+  </ImportGroup>
+  <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
+    <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+  </ImportGroup>
+  <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
+    <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+  </ImportGroup>
+  <PropertyGroup Label="UserMacros" />
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
+    <LinkIncremental>true</LinkIncremental>
+    <OutDir>..\..\..\..\bin\$(ProjectName)\</OutDir>
+    <IntDir>$(OutDir)$(Configuration)\</IntDir>
+  </PropertyGroup>
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
+    <LinkIncremental>false</LinkIncremental>
+    <OutDir>..\..\..\..\bin\$(ProjectName)\</OutDir>
+    <IntDir>$(OutDir)$(Configuration)\</IntDir>
+  </PropertyGroup>
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
+    <LinkIncremental>true</LinkIncremental>
+  </PropertyGroup>
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
+    <LinkIncremental>false</LinkIncremental>
+  </PropertyGroup>
+  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
+    <ClCompile>
+      <WarningLevel>Level3</WarningLevel>
+      <SDLCheck>true</SDLCheck>
+      <PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <ConformanceMode>true</ConformanceMode>
+      <RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
+      <AdditionalIncludeDirectories>$(ProjectDir)CSerialPort\include;$(ProjectDir)CSerialPort\src</AdditionalIncludeDirectories>
+    </ClCompile>
+    <Link>
+      <SubSystem>Console</SubSystem>
+      <GenerateDebugInformation>true</GenerateDebugInformation>
+      <AdditionalDependencies>setupapi.lib;%(AdditionalDependencies)</AdditionalDependencies>
+    </Link>
+  </ItemDefinitionGroup>
+  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
+    <ClCompile>
+      <WarningLevel>Level3</WarningLevel>
+      <FunctionLevelLinking>true</FunctionLevelLinking>
+      <IntrinsicFunctions>true</IntrinsicFunctions>
+      <SDLCheck>true</SDLCheck>
+      <PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <ConformanceMode>true</ConformanceMode>
+      <AdditionalIncludeDirectories>$(ProjectDir)CSerialPort\include;$(ProjectDir)CSerialPort\src</AdditionalIncludeDirectories>
+      <RuntimeLibrary>MultiThreaded</RuntimeLibrary>
+    </ClCompile>
+    <Link>
+      <SubSystem>Console</SubSystem>
+      <EnableCOMDATFolding>true</EnableCOMDATFolding>
+      <OptimizeReferences>true</OptimizeReferences>
+      <GenerateDebugInformation>true</GenerateDebugInformation>
+      <AdditionalDependencies>setupapi.lib;%(AdditionalDependencies)</AdditionalDependencies>
+    </Link>
+  </ItemDefinitionGroup>
+  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
+    <ClCompile>
+      <WarningLevel>Level3</WarningLevel>
+      <SDLCheck>true</SDLCheck>
+      <PreprocessorDefinitions>_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <ConformanceMode>true</ConformanceMode>
+      <AdditionalIncludeDirectories>$(ProjectDir)CSerialPort\include;$(ProjectDir)CSerialPort\src</AdditionalIncludeDirectories>
+      <RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
+    </ClCompile>
+    <Link>
+      <SubSystem>Console</SubSystem>
+      <GenerateDebugInformation>true</GenerateDebugInformation>
+      <AdditionalDependencies>setupapi.lib;%(AdditionalDependencies)</AdditionalDependencies>
+    </Link>
+  </ItemDefinitionGroup>
+  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
+    <ClCompile>
+      <WarningLevel>Level3</WarningLevel>
+      <FunctionLevelLinking>true</FunctionLevelLinking>
+      <IntrinsicFunctions>true</IntrinsicFunctions>
+      <SDLCheck>true</SDLCheck>
+      <PreprocessorDefinitions>NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <ConformanceMode>true</ConformanceMode>
+      <AdditionalIncludeDirectories>$(ProjectDir)CSerialPort\include;$(ProjectDir)CSerialPort\src</AdditionalIncludeDirectories>
+      <RuntimeLibrary>MultiThreaded</RuntimeLibrary>
+    </ClCompile>
+    <Link>
+      <SubSystem>Console</SubSystem>
+      <EnableCOMDATFolding>true</EnableCOMDATFolding>
+      <OptimizeReferences>true</OptimizeReferences>
+      <GenerateDebugInformation>true</GenerateDebugInformation>
+      <AdditionalDependencies>setupapi.lib;%(AdditionalDependencies)</AdditionalDependencies>
+    </Link>
+  </ItemDefinitionGroup>
+  <ItemGroup>
+    <ClCompile Include="CSerialPort\src\SerialPort.cpp" />
+    <ClCompile Include="CSerialPort\src\SerialPortBase.cpp" />
+    <ClCompile Include="CSerialPort\src\SerialPortInfo.cpp" />
+    <ClCompile Include="CSerialPort\src\SerialPortInfoBase.cpp" />
+    <ClCompile Include="CSerialPort\src\SerialPortInfoWinBase.cpp" />
+    <ClCompile Include="CSerialPort\src\SerialPortWinBase.cpp" />
+    <ClCompile Include="SerialPortManager.cpp" />
+    <ClCompile Include="StartAPPbyCOM.cpp" />
+  </ItemGroup>
+  <ItemGroup>
+    <ClInclude Include="CmdHelper.h" />
+    <ClInclude Include="CSerialPort\include\CSerialPort\osplatformutil.h" />
+    <ClInclude Include="CSerialPort\include\CSerialPort\SerialPort.h" />
+    <ClInclude Include="CSerialPort\include\CSerialPort\SerialPortBase.h" />
+    <ClInclude Include="CSerialPort\include\CSerialPort\SerialPortInfo.h" />
+    <ClInclude Include="CSerialPort\include\CSerialPort\SerialPortInfoBase.h" />
+    <ClInclude Include="CSerialPort\include\CSerialPort\SerialPortInfoWinBase.h" />
+    <ClInclude Include="CSerialPort\include\CSerialPort\SerialPortWinBase.h" />
+    <ClInclude Include="CSerialPort\include\CSerialPort\SerialPort_global.h" />
+    <ClInclude Include="CSerialPort\include\CSerialPort\sigslot.h" />
+    <ClInclude Include="resource.h" />
+    <ClInclude Include="SerialPortManager.h" />
+  </ItemGroup>
+  <ItemGroup>
+    <ResourceCompile Include="StartAPPbyCOM.rc" />
+  </ItemGroup>
+  <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
+  <ImportGroup Label="ExtensionTargets">
+  </ImportGroup>
+</Project>

+ 89 - 0
StartAPPbyCOM/StartAPPbyCOM/StartAPPbyCOM.vcxproj.filters

@@ -0,0 +1,89 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+  <ItemGroup>
+    <Filter Include="Source Files">
+      <UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
+      <Extensions>cpp;c;cc;cxx;c++;cppm;ixx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
+    </Filter>
+    <Filter Include="Header Files">
+      <UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
+      <Extensions>h;hh;hpp;hxx;h++;hm;inl;inc;ipp;xsd</Extensions>
+    </Filter>
+    <Filter Include="Resource Files">
+      <UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier>
+      <Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms</Extensions>
+    </Filter>
+    <Filter Include="CSerialPort">
+      <UniqueIdentifier>{6e92ce88-149d-404b-bca4-84cbf363d1a5}</UniqueIdentifier>
+    </Filter>
+  </ItemGroup>
+  <ItemGroup>
+    <ClCompile Include="StartAPPbyCOM.cpp">
+      <Filter>Source Files</Filter>
+    </ClCompile>
+    <ClCompile Include="SerialPortManager.cpp">
+      <Filter>Source Files</Filter>
+    </ClCompile>
+    <ClCompile Include="CSerialPort\src\SerialPort.cpp">
+      <Filter>CSerialPort</Filter>
+    </ClCompile>
+    <ClCompile Include="CSerialPort\src\SerialPortBase.cpp">
+      <Filter>CSerialPort</Filter>
+    </ClCompile>
+    <ClCompile Include="CSerialPort\src\SerialPortInfo.cpp">
+      <Filter>CSerialPort</Filter>
+    </ClCompile>
+    <ClCompile Include="CSerialPort\src\SerialPortInfoBase.cpp">
+      <Filter>CSerialPort</Filter>
+    </ClCompile>
+    <ClCompile Include="CSerialPort\src\SerialPortInfoWinBase.cpp">
+      <Filter>CSerialPort</Filter>
+    </ClCompile>
+    <ClCompile Include="CSerialPort\src\SerialPortWinBase.cpp">
+      <Filter>CSerialPort</Filter>
+    </ClCompile>
+  </ItemGroup>
+  <ItemGroup>
+    <ClInclude Include="CmdHelper.h">
+      <Filter>Header Files</Filter>
+    </ClInclude>
+    <ClInclude Include="SerialPortManager.h">
+      <Filter>Header Files</Filter>
+    </ClInclude>
+    <ClInclude Include="resource.h">
+      <Filter>Header Files</Filter>
+    </ClInclude>
+    <ClInclude Include="CSerialPort\include\CSerialPort\osplatformutil.h">
+      <Filter>CSerialPort</Filter>
+    </ClInclude>
+    <ClInclude Include="CSerialPort\include\CSerialPort\SerialPort.h">
+      <Filter>CSerialPort</Filter>
+    </ClInclude>
+    <ClInclude Include="CSerialPort\include\CSerialPort\SerialPort_global.h">
+      <Filter>CSerialPort</Filter>
+    </ClInclude>
+    <ClInclude Include="CSerialPort\include\CSerialPort\SerialPortBase.h">
+      <Filter>CSerialPort</Filter>
+    </ClInclude>
+    <ClInclude Include="CSerialPort\include\CSerialPort\SerialPortInfo.h">
+      <Filter>CSerialPort</Filter>
+    </ClInclude>
+    <ClInclude Include="CSerialPort\include\CSerialPort\SerialPortInfoBase.h">
+      <Filter>CSerialPort</Filter>
+    </ClInclude>
+    <ClInclude Include="CSerialPort\include\CSerialPort\SerialPortInfoWinBase.h">
+      <Filter>CSerialPort</Filter>
+    </ClInclude>
+    <ClInclude Include="CSerialPort\include\CSerialPort\SerialPortWinBase.h">
+      <Filter>CSerialPort</Filter>
+    </ClInclude>
+    <ClInclude Include="CSerialPort\include\CSerialPort\sigslot.h">
+      <Filter>CSerialPort</Filter>
+    </ClInclude>
+  </ItemGroup>
+  <ItemGroup>
+    <ResourceCompile Include="StartAPPbyCOM.rc">
+      <Filter>Resource Files</Filter>
+    </ResourceCompile>
+  </ItemGroup>
+</Project>

+ 14 - 0
StartAPPbyCOM/StartAPPbyCOM/resource.h

@@ -0,0 +1,14 @@
+//{{NO_DEPENDENCIES}}
+// Microsoft Visual C++ generated include file.
+// Used by StartAPPbyCOM.rc
+
+// Next default values for new objects
+// 
+#ifdef APSTUDIO_INVOKED
+#ifndef APSTUDIO_READONLY_SYMBOLS
+#define _APS_NEXT_RESOURCE_VALUE        101
+#define _APS_NEXT_COMMAND_VALUE         40001
+#define _APS_NEXT_CONTROL_VALUE         1001
+#define _APS_NEXT_SYMED_VALUE           101
+#endif
+#endif