├── .gitignore ├── 12_4_qt_log4qt_demo ├── Log4QtDemo.pro ├── README.md └── src │ ├── loggerobject.cpp │ ├── loggerobject.h │ ├── loggerobjectprio.cpp │ ├── loggerobjectprio.h │ ├── loggerstatic.cpp │ ├── loggerstatic.h │ ├── main.cpp │ ├── third_libs │ └── log4qt │ │ ├── bin │ │ ├── log4qt.dll │ │ ├── log4qt.exp │ │ ├── log4qt.lib │ │ ├── log4qt.pdb │ │ └── win-mavc-release │ │ │ ├── log4qt.dll │ │ │ ├── log4qt.exp │ │ │ └── log4qt.lib │ │ ├── helper │ │ ├── log4qt_init_helper_by_coding.cpp │ │ ├── log4qt_init_helper_by_coding.h │ │ ├── log4qt_init_helper_by_config.cpp │ │ └── log4qt_init_helper_by_config.h │ │ ├── include │ │ └── log4qt │ │ │ ├── CMakeLists.txt │ │ │ ├── appender.cpp │ │ │ ├── appender.h │ │ │ ├── appenderskeleton.cpp │ │ │ ├── appenderskeleton.h │ │ │ ├── asyncappender.cpp │ │ │ ├── asyncappender.h │ │ │ ├── basicconfigurator.cpp │ │ │ ├── basicconfigurator.h │ │ │ ├── binaryfileappender.cpp │ │ │ ├── binaryfileappender.h │ │ │ ├── binarylayout.cpp │ │ │ ├── binarylayout.h │ │ │ ├── binarylogger.cpp │ │ │ ├── binarylogger.h │ │ │ ├── binaryloggingevent.cpp │ │ │ ├── binaryloggingevent.h │ │ │ ├── binarylogstream.cpp │ │ │ ├── binarylogstream.h │ │ │ ├── binarytotextlayout.cpp │ │ │ ├── binarytotextlayout.h │ │ │ ├── binarywriterappender.cpp │ │ │ ├── binarywriterappender.h │ │ │ ├── colorconsoleappender.cpp │ │ │ ├── colorconsoleappender.h │ │ │ ├── consoleappender.cpp │ │ │ ├── consoleappender.h │ │ │ ├── dailyfileappender.cpp │ │ │ ├── dailyfileappender.h │ │ │ ├── dailyrollingfileappender.cpp │ │ │ ├── dailyrollingfileappender.h │ │ │ ├── databaseappender.cpp │ │ │ ├── databaseappender.h │ │ │ ├── databaselayout.cpp │ │ │ ├── databaselayout.h │ │ │ ├── fileappender.cpp │ │ │ ├── fileappender.h │ │ │ ├── helpers │ │ │ ├── appenderattachable.cpp │ │ │ ├── appenderattachable.h │ │ │ ├── binaryclasslogger.cpp │ │ │ ├── binaryclasslogger.h │ │ │ ├── classlogger.cpp │ │ │ ├── classlogger.h │ │ │ ├── configuratorhelper.cpp │ │ │ ├── configuratorhelper.h │ │ │ ├── datetime.cpp │ │ │ ├── datetime.h │ │ │ ├── dispatcher.cpp │ │ │ ├── dispatcher.h │ │ │ ├── factory.cpp │ │ │ ├── factory.h │ │ │ ├── initialisationhelper.cpp │ │ │ ├── initialisationhelper.h │ │ │ ├── logerror.cpp │ │ │ ├── logerror.h │ │ │ ├── optionconverter.cpp │ │ │ ├── optionconverter.h │ │ │ ├── patternformatter.cpp │ │ │ ├── patternformatter.h │ │ │ ├── properties.cpp │ │ │ └── properties.h │ │ │ ├── hierarchy.cpp │ │ │ ├── hierarchy.h │ │ │ ├── layout.cpp │ │ │ ├── layout.h │ │ │ ├── level.cpp │ │ │ ├── level.h │ │ │ ├── log4qt.h │ │ │ ├── log4qt.pri │ │ │ ├── log4qt.pro │ │ │ ├── log4qt.qbs │ │ │ ├── log4qtshared.h │ │ │ ├── log4qtsharedptr.h │ │ │ ├── logger.cpp │ │ │ ├── logger.h │ │ │ ├── loggerrepository.cpp │ │ │ ├── loggerrepository.h │ │ │ ├── loggingevent.cpp │ │ │ ├── loggingevent.h │ │ │ ├── logmanager.cpp │ │ │ ├── logmanager.h │ │ │ ├── logstream.cpp │ │ │ ├── logstream.h │ │ │ ├── mainthreadappender.cpp │ │ │ ├── mainthreadappender.h │ │ │ ├── mdc.cpp │ │ │ ├── mdc.h │ │ │ ├── ndc.cpp │ │ │ ├── ndc.h │ │ │ ├── patternlayout.cpp │ │ │ ├── patternlayout.h │ │ │ ├── propertyconfigurator.cpp │ │ │ ├── propertyconfigurator.h │ │ │ ├── qmllogger.cpp │ │ │ ├── qmllogger.h │ │ │ ├── rollingbinaryfileappender.cpp │ │ │ ├── rollingbinaryfileappender.h │ │ │ ├── rollingfileappender.cpp │ │ │ ├── rollingfileappender.h │ │ │ ├── signalappender.cpp │ │ │ ├── signalappender.h │ │ │ ├── simplelayout.cpp │ │ │ ├── simplelayout.h │ │ │ ├── simpletimelayout.cpp │ │ │ ├── simpletimelayout.h │ │ │ ├── spi │ │ │ ├── filter.cpp │ │ │ └── filter.h │ │ │ ├── systemlogappender.cpp │ │ │ ├── systemlogappender.h │ │ │ ├── telnetappender.cpp │ │ │ ├── telnetappender.h │ │ │ ├── ttcclayout.cpp │ │ │ ├── ttcclayout.h │ │ │ ├── varia │ │ │ ├── binaryeventfilter.cpp │ │ │ ├── binaryeventfilter.h │ │ │ ├── debugappender.cpp │ │ │ ├── debugappender.h │ │ │ ├── denyallfilter.cpp │ │ │ ├── denyallfilter.h │ │ │ ├── levelmatchfilter.cpp │ │ │ ├── levelmatchfilter.h │ │ │ ├── levelrangefilter.cpp │ │ │ ├── levelrangefilter.h │ │ │ ├── listappender.cpp │ │ │ ├── listappender.h │ │ │ ├── nullappender.cpp │ │ │ ├── nullappender.h │ │ │ ├── stringmatchfilter.cpp │ │ │ └── stringmatchfilter.h │ │ │ ├── wdcappender.cpp │ │ │ ├── wdcappender.h │ │ │ ├── writerappender.cpp │ │ │ ├── writerappender.h │ │ │ ├── xmllayout.cpp │ │ │ └── xmllayout.h │ │ ├── log4qt.properties │ │ └── log4qtlib.pri │ ├── third_libs_src_code │ ├── Log4Qt-master │ │ ├── .astylerc │ │ ├── .gitattributes │ │ ├── .gitignore │ │ ├── .travis.yml │ │ ├── CMakeLists.txt │ │ ├── ChangeLog.md │ │ ├── LICENSE │ │ ├── Readme.md │ │ ├── appveyor.yml │ │ ├── build.pri │ │ ├── cmake │ │ │ ├── Log4QtConfig.cmake.in │ │ │ ├── MacroEnsureOutOfSourceBuild.cmake │ │ │ └── cmake_uninstall.cmake.in │ │ ├── doc │ │ │ └── Doxyfile.in │ │ ├── examples │ │ │ ├── CMakeLists.txt │ │ │ ├── basic │ │ │ │ ├── CMakeLists.txt │ │ │ │ ├── basic.pro │ │ │ │ ├── basic.qbs │ │ │ │ ├── loggerobject.cpp │ │ │ │ ├── loggerobject.h │ │ │ │ ├── loggerobjectprio.cpp │ │ │ │ ├── loggerobjectprio.h │ │ │ │ ├── loggerstatic.cpp │ │ │ │ ├── loggerstatic.h │ │ │ │ └── main.cpp │ │ │ ├── examples.pri │ │ │ ├── examples.pro │ │ │ ├── examples.qbs │ │ │ └── propertyconfigurator │ │ │ │ ├── CMakeLists.txt │ │ │ │ ├── loggerobject.cpp │ │ │ │ ├── loggerobject.h │ │ │ │ ├── loggerobjectprio.cpp │ │ │ │ ├── loggerobjectprio.h │ │ │ │ ├── loggerstatic.cpp │ │ │ │ ├── loggerstatic.h │ │ │ │ ├── main.cpp │ │ │ │ ├── propertyconfigurator.exe.log4qt.properties │ │ │ │ ├── propertyconfigurator.pro │ │ │ │ └── propertyconfigurator.qbs │ │ ├── g++.pri │ │ ├── include │ │ │ └── log4qt │ │ │ │ ├── Appender │ │ │ │ ├── Appenderskeleton │ │ │ │ ├── AsyncAppender │ │ │ │ ├── BasicConfigurator │ │ │ │ ├── BinaryFileAppender │ │ │ │ ├── BinaryLayout │ │ │ │ ├── BinaryLogStream │ │ │ │ ├── BinaryLogger │ │ │ │ ├── BinaryLoggingEvent │ │ │ │ ├── BinaryToTextLayout │ │ │ │ ├── BinaryWriterAppender │ │ │ │ ├── ColorConsoleAppender │ │ │ │ ├── ConsoleAppender │ │ │ │ ├── DailyFileAppender │ │ │ │ ├── DailyRollingFileAppender │ │ │ │ ├── DatabaseAppender │ │ │ │ ├── DatabaseLayout │ │ │ │ ├── FileAppender │ │ │ │ ├── Hierarchy │ │ │ │ ├── Layout │ │ │ │ ├── Level │ │ │ │ ├── Log4Qt │ │ │ │ ├── Log4QtShared │ │ │ │ ├── LogManager │ │ │ │ ├── LogStream │ │ │ │ ├── Logger │ │ │ │ ├── LoggerRepository │ │ │ │ ├── LoggingEvent │ │ │ │ ├── MDC │ │ │ │ ├── MainthreadAppender │ │ │ │ ├── NDC │ │ │ │ ├── PatternLayout │ │ │ │ ├── PropertyConfigurator │ │ │ │ ├── RollingBinaryFileAppender │ │ │ │ ├── RollingFileAppender │ │ │ │ ├── SignalAppender │ │ │ │ ├── SimpleLayout │ │ │ │ ├── SimpleTimeLayout │ │ │ │ ├── SystemlogAppender │ │ │ │ ├── TTCCLayout │ │ │ │ ├── TelnetAppender │ │ │ │ ├── WDCAppender │ │ │ │ └── WriterAppender │ │ ├── log4qt.pro │ │ ├── log4qt.qbs │ │ ├── log4qtlib.qbs │ │ ├── others.qbs │ │ ├── src │ │ │ ├── log4qt │ │ │ │ ├── CMakeLists.txt │ │ │ │ ├── appender.cpp │ │ │ │ ├── appender.h │ │ │ │ ├── appenderskeleton.cpp │ │ │ │ ├── appenderskeleton.h │ │ │ │ ├── asyncappender.cpp │ │ │ │ ├── asyncappender.h │ │ │ │ ├── basicconfigurator.cpp │ │ │ │ ├── basicconfigurator.h │ │ │ │ ├── binaryfileappender.cpp │ │ │ │ ├── binaryfileappender.h │ │ │ │ ├── binarylayout.cpp │ │ │ │ ├── binarylayout.h │ │ │ │ ├── binarylogger.cpp │ │ │ │ ├── binarylogger.h │ │ │ │ ├── binaryloggingevent.cpp │ │ │ │ ├── binaryloggingevent.h │ │ │ │ ├── binarylogstream.cpp │ │ │ │ ├── binarylogstream.h │ │ │ │ ├── binarytotextlayout.cpp │ │ │ │ ├── binarytotextlayout.h │ │ │ │ ├── binarywriterappender.cpp │ │ │ │ ├── binarywriterappender.h │ │ │ │ ├── colorconsoleappender.cpp │ │ │ │ ├── colorconsoleappender.h │ │ │ │ ├── consoleappender.cpp │ │ │ │ ├── consoleappender.h │ │ │ │ ├── dailyfileappender.cpp │ │ │ │ ├── dailyfileappender.h │ │ │ │ ├── dailyrollingfileappender.cpp │ │ │ │ ├── dailyrollingfileappender.h │ │ │ │ ├── databaseappender.cpp │ │ │ │ ├── databaseappender.h │ │ │ │ ├── databaselayout.cpp │ │ │ │ ├── databaselayout.h │ │ │ │ ├── fileappender.cpp │ │ │ │ ├── fileappender.h │ │ │ │ ├── helpers │ │ │ │ │ ├── appenderattachable.cpp │ │ │ │ │ ├── appenderattachable.h │ │ │ │ │ ├── binaryclasslogger.cpp │ │ │ │ │ ├── binaryclasslogger.h │ │ │ │ │ ├── classlogger.cpp │ │ │ │ │ ├── classlogger.h │ │ │ │ │ ├── configuratorhelper.cpp │ │ │ │ │ ├── configuratorhelper.h │ │ │ │ │ ├── datetime.cpp │ │ │ │ │ ├── datetime.h │ │ │ │ │ ├── dispatcher.cpp │ │ │ │ │ ├── dispatcher.h │ │ │ │ │ ├── factory.cpp │ │ │ │ │ ├── factory.h │ │ │ │ │ ├── initialisationhelper.cpp │ │ │ │ │ ├── initialisationhelper.h │ │ │ │ │ ├── logerror.cpp │ │ │ │ │ ├── logerror.h │ │ │ │ │ ├── optionconverter.cpp │ │ │ │ │ ├── optionconverter.h │ │ │ │ │ ├── patternformatter.cpp │ │ │ │ │ ├── patternformatter.h │ │ │ │ │ ├── properties.cpp │ │ │ │ │ └── properties.h │ │ │ │ ├── hierarchy.cpp │ │ │ │ ├── hierarchy.h │ │ │ │ ├── layout.cpp │ │ │ │ ├── layout.h │ │ │ │ ├── level.cpp │ │ │ │ ├── level.h │ │ │ │ ├── log4qt.h │ │ │ │ ├── log4qt.pri │ │ │ │ ├── log4qt.pro │ │ │ │ ├── log4qt.qbs │ │ │ │ ├── log4qtshared.h │ │ │ │ ├── log4qtsharedptr.h │ │ │ │ ├── logger.cpp │ │ │ │ ├── logger.h │ │ │ │ ├── loggerrepository.cpp │ │ │ │ ├── loggerrepository.h │ │ │ │ ├── loggingevent.cpp │ │ │ │ ├── loggingevent.h │ │ │ │ ├── logmanager.cpp │ │ │ │ ├── logmanager.h │ │ │ │ ├── logstream.cpp │ │ │ │ ├── logstream.h │ │ │ │ ├── mainthreadappender.cpp │ │ │ │ ├── mainthreadappender.h │ │ │ │ ├── mdc.cpp │ │ │ │ ├── mdc.h │ │ │ │ ├── ndc.cpp │ │ │ │ ├── ndc.h │ │ │ │ ├── patternlayout.cpp │ │ │ │ ├── patternlayout.h │ │ │ │ ├── propertyconfigurator.cpp │ │ │ │ ├── propertyconfigurator.h │ │ │ │ ├── qmllogger.cpp │ │ │ │ ├── qmllogger.h │ │ │ │ ├── rollingbinaryfileappender.cpp │ │ │ │ ├── rollingbinaryfileappender.h │ │ │ │ ├── rollingfileappender.cpp │ │ │ │ ├── rollingfileappender.h │ │ │ │ ├── signalappender.cpp │ │ │ │ ├── signalappender.h │ │ │ │ ├── simplelayout.cpp │ │ │ │ ├── simplelayout.h │ │ │ │ ├── simpletimelayout.cpp │ │ │ │ ├── simpletimelayout.h │ │ │ │ ├── spi │ │ │ │ │ ├── filter.cpp │ │ │ │ │ └── filter.h │ │ │ │ ├── systemlogappender.cpp │ │ │ │ ├── systemlogappender.h │ │ │ │ ├── telnetappender.cpp │ │ │ │ ├── telnetappender.h │ │ │ │ ├── ttcclayout.cpp │ │ │ │ ├── ttcclayout.h │ │ │ │ ├── varia │ │ │ │ │ ├── binaryeventfilter.cpp │ │ │ │ │ ├── binaryeventfilter.h │ │ │ │ │ ├── debugappender.cpp │ │ │ │ │ ├── debugappender.h │ │ │ │ │ ├── denyallfilter.cpp │ │ │ │ │ ├── denyallfilter.h │ │ │ │ │ ├── levelmatchfilter.cpp │ │ │ │ │ ├── levelmatchfilter.h │ │ │ │ │ ├── levelrangefilter.cpp │ │ │ │ │ ├── levelrangefilter.h │ │ │ │ │ ├── listappender.cpp │ │ │ │ │ ├── listappender.h │ │ │ │ │ ├── nullappender.cpp │ │ │ │ │ ├── nullappender.h │ │ │ │ │ ├── stringmatchfilter.cpp │ │ │ │ │ └── stringmatchfilter.h │ │ │ │ ├── wdcappender.cpp │ │ │ │ ├── wdcappender.h │ │ │ │ ├── writerappender.cpp │ │ │ │ ├── writerappender.h │ │ │ │ ├── xmllayout.cpp │ │ │ │ └── xmllayout.h │ │ │ └── src.pro │ │ └── tests │ │ │ ├── CMakeLists.txt │ │ │ ├── binaryloggertest │ │ │ ├── CMakeLists.txt │ │ │ ├── atscopeexit.h │ │ │ ├── binaryloggertest.cpp │ │ │ ├── binaryloggertest.pro │ │ │ ├── binaryloggertest.qbs │ │ │ ├── elementsinarray.h │ │ │ ├── logging.cpp │ │ │ ├── logging.h │ │ │ ├── testappender.cpp │ │ │ └── testappender.h │ │ │ ├── dailyfileappendertest │ │ │ ├── CMakeLists.txt │ │ │ ├── dailyfileappendertest.cpp │ │ │ ├── dailyfileappendertest.pro │ │ │ └── dailyfileappendertest.qbs │ │ │ ├── filewatcher │ │ │ ├── filewatcher.pro │ │ │ └── tst_filewatchertest.cpp │ │ │ ├── log4qttest │ │ │ ├── CMakeLists.txt │ │ │ ├── log4qttest.cpp │ │ │ ├── log4qttest.h │ │ │ ├── log4qttest.pro │ │ │ └── log4qttest.qbs │ │ │ ├── tests.pri │ │ │ ├── tests.pro │ │ │ └── tests.qbs │ └── readme.txt │ └── ui │ ├── demodialog.cpp │ ├── demodialog.h │ └── demodialog.ui ├── 12_5_qt_breakpad_demo ├── BreakpadDemo │ ├── BreakpadDemo.pro │ ├── src │ │ ├── main.cpp │ │ └── ui │ │ │ ├── crashreportdialog │ │ │ ├── crashreportdialog.cpp │ │ │ ├── crashreportdialog.h │ │ │ └── crashreportdialog.ui │ │ │ ├── demodialog.cpp │ │ │ ├── demodialog.h │ │ │ └── demodialog.ui │ └── third_libs │ │ └── breakpad │ │ ├── breakpadsrc.pri │ │ ├── src │ │ ├── BreakpadHandler.cpp │ │ ├── BreakpadHandler.h │ │ ├── BreakpadHttpUploader.cpp │ │ └── BreakpadHttpUploader.h │ │ └── thirdparty │ │ └── breakpad.pri ├── README.md ├── dump_tools_mac │ ├── 928703D7-EA7B-4050-8DF5-667958A502F0.dmp │ ├── BreakpadDemo │ ├── dump_syms │ ├── dump_tool_usage.txt │ ├── minidump_stackwalk │ └── process_dump.sh ├── dump_tools_win │ ├── BreakpadDemo.exe │ ├── BreakpadDemo.pdb │ ├── dump_syms.exe │ ├── ee4962a8-0bf4-419a-8830-8230e26488cc.dmp │ ├── minidump_stackwalk.exe │ ├── process_dump.sh │ └── usage.txt ├── msdia_dll_32_for_windows_compile_dump_syms │ ├── msdia100.dll │ ├── msdia140.dll │ └── msdia80.dll └── zip_of_this_folder │ └── 12_5_qt_breakpad_demo.zip ├── 13_3_stm32_iap_downloader_tool ├── src │ ├── core │ │ ├── core.cpp │ │ ├── core.h │ │ ├── hexfilereader.cpp │ │ └── hexfilereader.h │ ├── file │ │ ├── binaryfile.cpp │ │ ├── binaryfile.h │ │ ├── directoryutil.cpp │ │ └── directoryutil.h │ ├── finding_serial_device │ │ ├── findingserialdevice.cpp │ │ └── findingserialdevice.h │ ├── main.cpp │ ├── protocol │ │ ├── comm_interface.cpp │ │ ├── comm_interface.h │ │ ├── command.cpp │ │ ├── command.h │ │ ├── crc.cpp │ │ ├── crc.h │ │ ├── protocolmanager.cpp │ │ ├── protocolmanager.h │ │ ├── work.cpp │ │ ├── work.h │ │ ├── workmanager.cpp │ │ └── workmanager.h │ ├── res │ │ ├── qss │ │ │ └── theme.qss │ │ ├── res.qrc │ │ └── tr │ │ │ ├── app_zh_CN.qm │ │ │ └── app_zh_CN.ts │ ├── uart │ │ ├── myserialport.cpp │ │ └── myserialport.h │ ├── ui │ │ ├── iapdownloadertooldialog.cpp │ │ ├── iapdownloadertooldialog.h │ │ └── iapdownloadertooldialog.ui │ └── utils │ │ ├── byteutil.cpp │ │ ├── byteutil.h │ │ ├── stringutil.cpp │ │ └── stringutil.h └── stm32_iap_downloader_tool.pro ├── 13_5_stm32_iap_bootloader └── IAP_BL_STM32L072KBUx │ ├── .cproject │ ├── .mxproject │ ├── .project │ ├── .settings │ ├── com.atollic.truestudio.debug.hardware_device.prefs │ ├── language.settings.xml │ └── org.eclipse.cdt.managedbuilder.core.prefs │ ├── App │ ├── app.c │ ├── app.h │ ├── core │ │ ├── core.c │ │ └── core.h │ ├── program │ │ ├── program.c │ │ └── program.h │ └── protocol │ │ ├── command.c │ │ ├── command.h │ │ ├── crc.c │ │ ├── crc.h │ │ ├── protocol.c │ │ └── protocol.h │ ├── Bsp │ ├── bsp.c │ ├── bsp.h │ ├── flash │ │ ├── flash.c │ │ └── flash.h │ ├── io_and_clock │ │ ├── io_and_clock.c │ │ └── io_and_clock.h │ ├── irq_callback │ │ ├── irq_callback.c │ │ └── irq_callback.h │ ├── timer │ │ ├── timer.c │ │ └── timer.h │ └── uart │ │ ├── uart.c │ │ └── uart.h │ ├── Drivers │ ├── CMSIS │ │ ├── Device │ │ │ └── ST │ │ │ │ └── STM32L0xx │ │ │ │ └── Include │ │ │ │ ├── stm32l072xx.h │ │ │ │ ├── stm32l0xx.h │ │ │ │ └── system_stm32l0xx.h │ │ └── Include │ │ │ ├── arm_common_tables.h │ │ │ ├── arm_const_structs.h │ │ │ ├── arm_math.h │ │ │ ├── cmsis_armcc.h │ │ │ ├── cmsis_armcc_V6.h │ │ │ ├── cmsis_gcc.h │ │ │ ├── core_cm0.h │ │ │ ├── core_cm0plus.h │ │ │ ├── core_cm3.h │ │ │ ├── core_cm4.h │ │ │ ├── core_cm7.h │ │ │ ├── core_cmFunc.h │ │ │ ├── core_cmInstr.h │ │ │ ├── core_cmSimd.h │ │ │ ├── core_sc000.h │ │ │ └── core_sc300.h │ └── STM32L0xx_HAL_Driver │ │ ├── Inc │ │ ├── Legacy │ │ │ └── stm32_hal_legacy.h │ │ ├── stm32l0xx_hal.h │ │ ├── stm32l0xx_hal_cortex.h │ │ ├── stm32l0xx_hal_def.h │ │ ├── stm32l0xx_hal_dma.h │ │ ├── stm32l0xx_hal_flash.h │ │ ├── stm32l0xx_hal_flash_ex.h │ │ ├── stm32l0xx_hal_flash_ramfunc.h │ │ ├── stm32l0xx_hal_gpio.h │ │ ├── stm32l0xx_hal_gpio_ex.h │ │ ├── stm32l0xx_hal_i2c.h │ │ ├── stm32l0xx_hal_i2c_ex.h │ │ ├── stm32l0xx_hal_pwr.h │ │ ├── stm32l0xx_hal_pwr_ex.h │ │ ├── stm32l0xx_hal_rcc.h │ │ ├── stm32l0xx_hal_rcc_ex.h │ │ ├── stm32l0xx_hal_tim.h │ │ ├── stm32l0xx_hal_tim_ex.h │ │ ├── stm32l0xx_hal_uart.h │ │ └── stm32l0xx_hal_uart_ex.h │ │ └── Src │ │ ├── stm32l0xx_hal.c │ │ ├── stm32l0xx_hal_cortex.c │ │ ├── stm32l0xx_hal_dma.c │ │ ├── stm32l0xx_hal_flash.c │ │ ├── stm32l0xx_hal_flash_ex.c │ │ ├── stm32l0xx_hal_flash_ramfunc.c │ │ ├── stm32l0xx_hal_gpio.c │ │ ├── stm32l0xx_hal_i2c.c │ │ ├── stm32l0xx_hal_i2c_ex.c │ │ ├── stm32l0xx_hal_pwr.c │ │ ├── stm32l0xx_hal_pwr_ex.c │ │ ├── stm32l0xx_hal_rcc.c │ │ ├── stm32l0xx_hal_rcc_ex.c │ │ ├── stm32l0xx_hal_tim.c │ │ ├── stm32l0xx_hal_tim_ex.c │ │ ├── stm32l0xx_hal_uart.c │ │ └── stm32l0xx_hal_uart_ex.c │ ├── IAP_BL_STM32L072KBUx.elf.launch │ ├── IAP_BL_STM32L072KBUx.ioc │ ├── Inc │ ├── datatype.h │ ├── includes.h │ ├── main.h │ ├── stm32l0xx_hal_conf.h │ └── stm32l0xx_it.h │ ├── STM32L072KB_FLASH.ld │ ├── Src │ ├── main.c │ ├── stm32l0xx_hal_msp.c │ ├── stm32l0xx_it.c │ ├── syscalls.c │ ├── system_stm32l0xx.c │ └── tiny_printf.c │ └── startup │ └── startup_stm32l072xx.s ├── 2_2_qt_serial_port_gui_tool ├── 2_2_qt_serial_port_gui_tool.pro ├── main.cpp ├── myserialport.cpp ├── myserialport.h ├── serialdialog.cpp ├── serialdialog.h ├── serialdialog.ui ├── stringutil.cpp └── stringutil.h ├── 2_2_winform_serial_port_gui_tool ├── .vs │ └── winform_serial_port_gui_tool │ │ └── v16 │ │ └── .suo ├── winform_serial_port_gui_tool.sln └── winform_serial_port_gui_tool │ ├── App.config │ ├── Form1.Designer.cs │ ├── Form1.cs │ ├── Form1.resx │ ├── Program.cs │ ├── Properties │ ├── AssemblyInfo.cs │ ├── Resources.Designer.cs │ ├── Resources.resx │ ├── Settings.Designer.cs │ └── Settings.settings │ ├── SerialComm.cs │ └── winform_serial_port_gui_tool.csproj ├── 2_4_qt_net_tcp_udp_gui_tool ├── src │ ├── main.cpp │ ├── net │ │ ├── comm.cpp │ │ ├── comm.h │ │ ├── netmanager.cpp │ │ ├── netmanager.h │ │ ├── tcpcomm.cpp │ │ ├── tcpcomm.h │ │ ├── udpcomm.cpp │ │ └── udpcomm.h │ ├── thirdparty │ │ ├── readme.txt │ │ └── singleinstance │ │ │ ├── config.pri │ │ │ ├── singleinstance.pro │ │ │ ├── singleinstancelib.pri │ │ │ ├── singleinstancesrc.pri │ │ │ └── src │ │ │ ├── singleinstance.cpp │ │ │ ├── singleinstance.h │ │ │ └── singletone │ │ │ ├── call_once.h │ │ │ └── singleton.h │ ├── ui │ │ ├── dialog.ui │ │ ├── netdialog.cpp │ │ └── netdialog.h │ ├── utils │ │ ├── hexutils.cpp │ │ └── hexutils.h │ └── views │ │ └── toast │ │ ├── toast.cpp │ │ ├── toast.h │ │ └── toast.ui └── tcp_upd_tool.pro ├── 2_4_winform_net_tcp_udp_gui_tool ├── NetTcpUdpTool.sln └── NetTcpUdpTool │ ├── App.config │ ├── Form1.Designer.cs │ ├── Form1.cs │ ├── Form1.resx │ ├── Net │ ├── Comm.cs │ ├── CommNetType.cs │ ├── HexFormatUtils.cs │ ├── NetManager.cs │ ├── NetUtil.cs │ ├── TcpClientComm.cs │ ├── TcpServerComm.cs │ ├── UdpBroadCastComm.cs │ ├── UdpClientComm.cs │ └── UdpServerComm.cs │ ├── NetTcpUdpTool.csproj │ ├── Program.cs │ ├── Properties │ ├── AssemblyInfo.cs │ ├── Resources.Designer.cs │ ├── Resources.resx │ ├── Settings.Designer.cs │ └── Settings.settings │ └── obj │ └── Debug │ ├── DesignTimeResolveAssemblyReferences.cache │ ├── DesignTimeResolveAssemblyReferencesInput.cache │ ├── NetTcpUdpTool.Form1.resources │ ├── NetTcpUdpTool.Properties.Resources.resources │ ├── NetTcpUdpTool.csproj.CoreCompileInputs.cache │ ├── NetTcpUdpTool.csproj.FileListAbsolute.txt │ ├── NetTcpUdpTool.csproj.GenerateResource.cache │ ├── NetTcpUdpTool.csprojAssemblyReference.cache │ ├── NetTcpUdpTool.exe │ └── NetTcpUdpTool.pdb ├── 2_9_qt_net_finding_device ├── .gitignore ├── 2_9_qt_net_finding_device.pro ├── command │ ├── command.cpp │ ├── command.h │ ├── crc.cpp │ └── crc.h ├── device_finding │ ├── crc.cpp │ ├── crc.h │ ├── devicefinder.cpp │ ├── devicefinder.h │ ├── deviceinfo.cpp │ ├── deviceinfo.h │ ├── protocolfindingdevicemanager.cpp │ └── protocolfindingdevicemanager.h ├── main.cpp ├── net │ ├── comm.cpp │ ├── comm.h │ ├── netmanager.cpp │ ├── netmanager.h │ ├── tcpcomm.cpp │ ├── tcpcomm.h │ ├── udpcomm.cpp │ └── udpcomm.h ├── thirdparty │ ├── mylog │ │ ├── LICENSE │ │ ├── MyLog.pro │ │ ├── MyLogLib.pri │ │ ├── MyLogSrc.pri │ │ ├── README.md │ │ ├── README.zh-cn.md │ │ ├── config.pri │ │ ├── demo │ │ │ ├── demo.pro │ │ │ ├── main.cpp │ │ │ ├── mainwindow.cpp │ │ │ ├── mainwindow.h │ │ │ └── mainwindow.ui │ │ ├── doc │ │ │ └── out_put_example.png │ │ ├── src │ │ │ ├── console_logger.cpp │ │ │ ├── console_logger.h │ │ │ ├── file_logger.cpp │ │ │ ├── file_logger.h │ │ │ ├── log_level.cpp │ │ │ ├── log_level.h │ │ │ ├── logger_interface.cpp │ │ │ ├── logger_interface.h │ │ │ ├── my_log.h │ │ │ ├── my_log_export.cpp │ │ │ ├── my_log_export.h │ │ │ ├── my_log_export_global.h │ │ │ ├── printf_color.h │ │ │ └── singletone │ │ │ │ ├── call_once.h │ │ │ │ └── singleton.h │ │ ├── todo │ │ └── version_changes │ ├── readme.txt │ └── singleinstance │ │ ├── config.pri │ │ ├── singleinstance.pro │ │ ├── singleinstancelib.pri │ │ ├── singleinstancesrc.pri │ │ └── src │ │ ├── singleinstance.cpp │ │ ├── singleinstance.h │ │ └── singletone │ │ ├── call_once.h │ │ └── singleton.h ├── ui │ └── device_connect_dialog │ │ ├── deviceconnectdialog.cpp │ │ ├── deviceconnectdialog.h │ │ └── deviceconnectdialog.ui └── utils │ ├── byteutil.cpp │ └── byteutil.h ├── 2_9_winform_net_finding_device ├── NetFindingDevice.sln └── NetFindingDevice │ ├── App.config │ ├── DeviceConnectionManager │ ├── CRC16.cs │ ├── NetDeviceInfo.cs │ ├── NetSearchingDevice │ │ ├── Finder.cs │ │ ├── FoundNetDeviceList.cs │ │ └── NetSearchingDeviceManager.cs │ └── Protocol.cs │ ├── Form1.Designer.cs │ ├── Form1.cs │ ├── Form1.resx │ ├── NetFindingDevice.csproj │ ├── Program.cs │ ├── Properties │ ├── AssemblyInfo.cs │ ├── Resources.Designer.cs │ ├── Resources.resx │ ├── Settings.Designer.cs │ └── Settings.settings │ └── obj │ └── Debug │ ├── DesignTimeResolveAssemblyReferences.cache │ ├── DesignTimeResolveAssemblyReferencesInput.cache │ ├── NetFindingDevice.Form1.resources │ ├── NetFindingDevice.Properties.Resources.resources │ ├── NetFindingDevice.csproj.CoreCompileInputs.cache │ ├── NetFindingDevice.csproj.FileListAbsolute.txt │ ├── NetFindingDevice.csproj.GenerateResource.cache │ ├── NetFindingDevice.csprojAssemblyReference.cache │ ├── NetFindingDevice.exe │ └── NetFindingDevice.pdb ├── 3_2_qt_protocol_structure_demo ├── .gitignore ├── 3_2_qt_protocol_structure_demo.pro ├── device_finding │ ├── devicefinder.cpp │ ├── devicefinder.h │ ├── deviceinfo.cpp │ ├── deviceinfo.h │ ├── findingdevicemanager.cpp │ └── findingdevicemanager.h ├── main.cpp ├── net │ ├── comm.cpp │ ├── comm.h │ ├── netmanager.cpp │ ├── netmanager.h │ ├── tcpcomm.cpp │ ├── tcpcomm.h │ ├── udpcomm.cpp │ └── udpcomm.h ├── protocol │ ├── command.cpp │ ├── command.h │ ├── crc.cpp │ ├── crc.h │ ├── protocolmanager.cpp │ ├── protocolmanager.h │ ├── work.cpp │ ├── work.h │ ├── workmanager.cpp │ └── workmanager.h ├── ui │ ├── demodialog │ │ ├── demodialog.cpp │ │ ├── demodialog.h │ │ └── demodialog.ui │ └── device_connect_dialog │ │ ├── deviceconnectdialog.cpp │ │ ├── deviceconnectdialog.h │ │ └── deviceconnectdialog.ui └── utils │ ├── byteutil.cpp │ └── byteutil.h ├── 3_2_virtual_hardware ├── .gitignore ├── 3_2_virtual_hardware.pro ├── main.cpp ├── net │ ├── comm.cpp │ ├── comm.h │ ├── netmanager.cpp │ ├── netmanager.h │ ├── tcpcomm.cpp │ ├── tcpcomm.h │ ├── udpcomm.cpp │ └── udpcomm.h ├── protocol │ ├── command.cpp │ ├── command.h │ ├── crc.cpp │ └── crc.h ├── utils │ ├── byteutil.cpp │ └── byteutil.h ├── virtualhardwaredialog.cpp ├── virtualhardwaredialog.h └── virtualhardwaredialog.ui ├── 3_2_winform_protocol_structure_demo ├── .vs │ └── 3_2_winform_protocol_structure_demo │ │ └── v16 │ │ ├── .suo │ │ └── Server │ │ └── sqlite3 │ │ ├── db.lock │ │ └── storage.ide ├── 3_2_winform_protocol_structure_demo.sln └── 3_2_winform_protocol_structure_demo │ ├── 3_2_winform_protocol_structure_demo.csproj │ ├── App.config │ ├── DemoDialog.Designer.cs │ ├── DemoDialog.cs │ ├── DemoDialog.resx │ ├── DeviceFinding │ ├── DeviceInfo.cs │ ├── Finder.cs │ ├── FoundNetDeviceList.cs │ └── SearchingDeviceManager.cs │ ├── Form1.Designer.cs │ ├── Form1.cs │ ├── Form1.resx │ ├── Net │ ├── Comm.cs │ ├── CommNetType.cs │ ├── HexFormatUtils.cs │ ├── NetManager.cs │ ├── NetUtil.cs │ ├── TcpClientComm.cs │ ├── TcpServerComm.cs │ ├── UdpBroadCastComm.cs │ ├── UdpClientComm.cs │ └── UdpServerComm.cs │ ├── Program.cs │ ├── Properties │ ├── AssemblyInfo.cs │ ├── Resources.Designer.cs │ ├── Resources.resx │ ├── Settings.Designer.cs │ └── Settings.settings │ ├── Protocol │ ├── CRC16.cs │ ├── Command.cs │ ├── ProtocolManager.cs │ ├── Work.cs │ └── WorkManager.cs │ └── obj │ └── Debug │ ├── 3_2_winform_protocol_structure_demo.csproj.CoreCompileInputs.cache │ ├── 3_2_winform_protocol_structure_demo.csproj.FileListAbsolute.txt │ ├── 3_2_winform_protocol_structure_demo.csproj.GenerateResource.cache │ ├── 3_2_winform_protocol_structure_demo.csprojAssemblyReference.cache │ ├── 3_2_winform_protocol_structure_demo.exe │ ├── 3_2_winform_protocol_structure_demo.pdb │ ├── DesignTimeResolveAssemblyReferences.cache │ ├── DesignTimeResolveAssemblyReferencesInput.cache │ ├── _3_2_winform_protocol_structure_demo.DemoDialog.resources │ ├── _3_2_winform_protocol_structure_demo.Form1.resources │ └── _3_2_winform_protocol_structure_demo.Properties.Resources.resources ├── 4_3_prototype_drawing_demo ├── 原型图演示动画.mp4 └── 电子书阅读器的原型图.rp ├── 4_4_ui_design_doc ├── ui设计图 │ ├── 主界面图.png │ ├── 分享对话框.png │ ├── 删除确认对话框.png │ ├── 导入对话框.png │ └── 电子书阅读器UI设计图_交互.png ├── 尺寸标注图 │ ├── 尺寸标注总图.png │ ├── 电子书阅读器_主界面图_尺寸标注.png │ ├── 电子书阅读器_分享对话框_尺寸标注.png │ ├── 电子书阅读器_删除确认对话框_尺寸标注.png │ └── 电子书阅读器_导入对话框_尺寸标注.png └── 所有源psd文件 │ ├── 主界面图.psd │ ├── 分享对话框.psd │ ├── 删除确认对话框.psd │ ├── 导入对话框.psd │ ├── 尺寸标注总图.psd │ ├── 电子书阅读器.pxcp │ └── 电子书阅读器UI设计图_交互.psd ├── LICENSE └── README.md /.gitignore: -------------------------------------------------------------------------------- 1 | # C++ objects and libs 2 | *.slo 3 | *.lo 4 | *.o 5 | *.a 6 | *.la 7 | *.lai 8 | *.so 9 | #*.dll 10 | *.dylib 11 | 12 | # Qt-es 13 | object_script.*.Release 14 | object_script.*.Debug 15 | *_plugin_import.cpp 16 | /.qmake.cache 17 | /.qmake.stash 18 | *.pro.user 19 | *.pro.user.* 20 | *.qbs.user 21 | *.qbs.user.* 22 | *.moc 23 | moc_*.cpp 24 | moc_*.h 25 | qrc_*.cpp 26 | ui_*.h 27 | *.qmlc 28 | *.jsc 29 | Makefile* 30 | *build-* 31 | 32 | # Qt unit tests 33 | target_wrapper.* 34 | 35 | # QtCreator 36 | *.autosave 37 | 38 | # QtCreator Qml 39 | *.qmlproject.user 40 | *.qmlproject.user.* 41 | 42 | # QtCreator CMake 43 | CMakeLists.txt.user* 44 | -------------------------------------------------------------------------------- /12_4_qt_log4qt_demo/Log4QtDemo.pro: -------------------------------------------------------------------------------- 1 | QT += core gui 2 | 3 | greaterThan(QT_MAJOR_VERSION, 4): QT += widgets 4 | 5 | CONFIG += c++11 6 | 7 | DEFINES += QT_DEPRECATED_WARNINGS 8 | 9 | #log4qt 10 | include($$PWD/src/third_libs/log4qt/log4qtlib.pri) 11 | 12 | SOURCES += \ 13 | src/main.cpp \ 14 | src/loggerstatic.cpp \ 15 | src/loggerobject.cpp \ 16 | src/loggerobjectprio.cpp \ 17 | src/ui/demodialog.cpp 18 | 19 | HEADERS += \ 20 | src/loggerstatic.h \ 21 | src/loggerobject.h \ 22 | src/loggerobjectprio.h \ 23 | src/ui/demodialog.h 24 | 25 | FORMS += \ 26 | src/ui/demodialog.ui 27 | 28 | # Default rules for deployment. 29 | qnx: target.path = /tmp/$${TARGET}/bin 30 | else: unix:!android: target.path = /opt/$${TARGET}/bin 31 | !isEmpty(target.path): INSTALLS += target 32 | 33 | 34 | 35 | 36 | 37 | -------------------------------------------------------------------------------- /12_4_qt_log4qt_demo/README.md: -------------------------------------------------------------------------------- 1 | 源码目录包含的内容如下: 2 | - Log4qtDemo完整代码 3 | - log4qt跨平台模块,在src/third_libs目录中 4 | - log4qt开源库下载下来源代码,用于编译出各个系统平台下的log4qt动态库, 在src/third_libs_src_code目录中 -------------------------------------------------------------------------------- /12_4_qt_log4qt_demo/src/loggerobject.h: -------------------------------------------------------------------------------- 1 | /****************************************************************************** 2 | * 3 | * This file is part of Log4Qt library. 4 | * 5 | * Copyright (C) 2007 - 2020 Log4Qt contributors 6 | * 7 | * Licensed under the Apache License, Version 2.0 (the "License"); 8 | * you may not use this file except in compliance with the License. 9 | * You may obtain a copy of the License at 10 | * 11 | * http://www.apache.org/licenses/LICENSE-2.0 12 | * 13 | * Unless required by applicable law or agreed to in writing, software 14 | * distributed under the License is distributed on an "AS IS" BASIS, 15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | * See the License for the specific language governing permissions and 17 | * limitations under the License. 18 | * 19 | ******************************************************************************/ 20 | 21 | #ifndef LOGGEROBJECT_H 22 | #define LOGGEROBJECT_H 23 | 24 | 25 | 26 | #include 27 | 28 | class LoggerObject : public QObject 29 | { 30 | Q_OBJECT 31 | public: 32 | explicit LoggerObject(QObject *parent = nullptr); 33 | 34 | Q_SIGNALS: 35 | void exit(int code); 36 | 37 | private Q_SLOTS: 38 | void onTimeout(); 39 | 40 | private: 41 | int mCounter; 42 | }; 43 | 44 | #endif // LOGGEROBJECT_H 45 | -------------------------------------------------------------------------------- /12_4_qt_log4qt_demo/src/loggerobjectprio.cpp: -------------------------------------------------------------------------------- 1 | #include "loggerobjectprio.h" 2 | 3 | #include 4 | 5 | #include "log4qt/logger.h"//每个使用log4qt的类都需要包含此头文件 6 | 7 | //在类的cpp文件中,使用此静态方法声明logger(此方法比较通用) 8 | //第二个参数写类名字,因此,输出的log条目中包含其对应的类名 9 | LOG4QT_DECLARE_STATIC_LOGGER(logger, LoggerObjectPrio) 10 | 11 | LoggerObjectPrio::LoggerObjectPrio(QObject *parent) : QObject(parent) 12 | { 13 | auto *timer = new QTimer(this); 14 | connect(timer, &QTimer::timeout, this, &LoggerObjectPrio::onTimeout); 15 | timer->start(1); 16 | } 17 | 18 | void LoggerObjectPrio::onTimeout() 19 | { 20 | logger()->debug() << "Debug output"; 21 | logger()->error() << "Error output"; 22 | } 23 | 24 | -------------------------------------------------------------------------------- /12_4_qt_log4qt_demo/src/loggerobjectprio.h: -------------------------------------------------------------------------------- 1 | /****************************************************************************** 2 | * 3 | * This file is part of Log4Qt library. 4 | * 5 | * Copyright (C) 2007 - 2020 Log4Qt contributors 6 | * 7 | * Licensed under the Apache License, Version 2.0 (the "License"); 8 | * you may not use this file except in compliance with the License. 9 | * You may obtain a copy of the License at 10 | * 11 | * http://www.apache.org/licenses/LICENSE-2.0 12 | * 13 | * Unless required by applicable law or agreed to in writing, software 14 | * distributed under the License is distributed on an "AS IS" BASIS, 15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | * See the License for the specific language governing permissions and 17 | * limitations under the License. 18 | * 19 | ******************************************************************************/ 20 | 21 | #ifndef LOGGEROBJECTPRIO_H 22 | #define LOGGEROBJECTPRIO_H 23 | 24 | 25 | #include 26 | 27 | class LoggerObjectPrio : public QObject 28 | { 29 | Q_OBJECT 30 | 31 | public: 32 | explicit LoggerObjectPrio(QObject *parent = nullptr); 33 | 34 | private Q_SLOTS: 35 | void onTimeout(); 36 | 37 | }; 38 | 39 | #endif // LOGGEROBJECTPRIO_H 40 | -------------------------------------------------------------------------------- /12_4_qt_log4qt_demo/src/loggerstatic.h: -------------------------------------------------------------------------------- 1 | /****************************************************************************** 2 | * 3 | * This file is part of Log4Qt library. 4 | * 5 | * Copyright (C) 2007 - 2020 Log4Qt contributors 6 | * 7 | * Licensed under the Apache License, Version 2.0 (the "License"); 8 | * you may not use this file except in compliance with the License. 9 | * You may obtain a copy of the License at 10 | * 11 | * http://www.apache.org/licenses/LICENSE-2.0 12 | * 13 | * Unless required by applicable law or agreed to in writing, software 14 | * distributed under the License is distributed on an "AS IS" BASIS, 15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | * See the License for the specific language governing permissions and 17 | * limitations under the License. 18 | * 19 | ******************************************************************************/ 20 | 21 | #ifndef LOGGERSTATIC_H 22 | #define LOGGERSTATIC_H 23 | 24 | 25 | class LoggerStatic 26 | { 27 | public: 28 | LoggerStatic(); 29 | ~LoggerStatic(); 30 | 31 | LoggerStatic(const LoggerStatic &) = delete; 32 | LoggerStatic &operator=(const LoggerStatic &) = delete; 33 | }; 34 | 35 | #endif // LOGGERSTATIC_H 36 | -------------------------------------------------------------------------------- /12_4_qt_log4qt_demo/src/third_libs/log4qt/bin/log4qt.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/robert1207/UpperComputerProgramingGuideSrc/dd8afb9d94d21580f19863a21fa23378dafa96ee/12_4_qt_log4qt_demo/src/third_libs/log4qt/bin/log4qt.dll -------------------------------------------------------------------------------- /12_4_qt_log4qt_demo/src/third_libs/log4qt/bin/log4qt.exp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/robert1207/UpperComputerProgramingGuideSrc/dd8afb9d94d21580f19863a21fa23378dafa96ee/12_4_qt_log4qt_demo/src/third_libs/log4qt/bin/log4qt.exp -------------------------------------------------------------------------------- /12_4_qt_log4qt_demo/src/third_libs/log4qt/bin/log4qt.lib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/robert1207/UpperComputerProgramingGuideSrc/dd8afb9d94d21580f19863a21fa23378dafa96ee/12_4_qt_log4qt_demo/src/third_libs/log4qt/bin/log4qt.lib -------------------------------------------------------------------------------- /12_4_qt_log4qt_demo/src/third_libs/log4qt/bin/log4qt.pdb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/robert1207/UpperComputerProgramingGuideSrc/dd8afb9d94d21580f19863a21fa23378dafa96ee/12_4_qt_log4qt_demo/src/third_libs/log4qt/bin/log4qt.pdb -------------------------------------------------------------------------------- /12_4_qt_log4qt_demo/src/third_libs/log4qt/bin/win-mavc-release/log4qt.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/robert1207/UpperComputerProgramingGuideSrc/dd8afb9d94d21580f19863a21fa23378dafa96ee/12_4_qt_log4qt_demo/src/third_libs/log4qt/bin/win-mavc-release/log4qt.dll -------------------------------------------------------------------------------- /12_4_qt_log4qt_demo/src/third_libs/log4qt/bin/win-mavc-release/log4qt.exp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/robert1207/UpperComputerProgramingGuideSrc/dd8afb9d94d21580f19863a21fa23378dafa96ee/12_4_qt_log4qt_demo/src/third_libs/log4qt/bin/win-mavc-release/log4qt.exp -------------------------------------------------------------------------------- /12_4_qt_log4qt_demo/src/third_libs/log4qt/bin/win-mavc-release/log4qt.lib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/robert1207/UpperComputerProgramingGuideSrc/dd8afb9d94d21580f19863a21fa23378dafa96ee/12_4_qt_log4qt_demo/src/third_libs/log4qt/bin/win-mavc-release/log4qt.lib -------------------------------------------------------------------------------- /12_4_qt_log4qt_demo/src/third_libs/log4qt/helper/log4qt_init_helper_by_coding.h: -------------------------------------------------------------------------------- 1 | #ifndef LOG4QT_HELPER_BY_CODING_H 2 | #define LOG4QT_HELPER_BY_CODING_H 3 | 4 | #include "log4qt/logger.h" 5 | #include "log4qt/propertyconfigurator.h" 6 | #include "log4qt/loggerrepository.h" 7 | #include "log4qt/logmanager.h" 8 | 9 | //layouts 10 | #include "log4qt/ttcclayout.h" 11 | 12 | //appenders 13 | #include "log4qt/consoleappender.h" 14 | #include "log4qt/fileappender.h" 15 | #include "log4qt/rollingfileappender.h" 16 | 17 | #include 18 | 19 | 20 | extern void SetupLog4QtByCodingWithLogSavingDirAbsPath(QString log_saving_dir_abs_path); 21 | extern void ShutDownLog4QtByCoding(); 22 | 23 | 24 | #endif // LOG4QT_HELPER_H 25 | -------------------------------------------------------------------------------- /12_4_qt_log4qt_demo/src/third_libs/log4qt/helper/log4qt_init_helper_by_config.h: -------------------------------------------------------------------------------- 1 | #ifndef LOG4QT_HELPER_BY_CONFIG_H 2 | #define LOG4QT_HELPER_BY_CONFIG_H 3 | 4 | #include "log4qt/logger.h" 5 | #include "log4qt/propertyconfigurator.h" 6 | #include "log4qt/loggerrepository.h" 7 | #include "log4qt/consoleappender.h" 8 | #include "log4qt/ttcclayout.h" 9 | #include "log4qt/logmanager.h" 10 | #include "log4qt/fileappender.h" 11 | 12 | #include 13 | 14 | 15 | extern void SetupLog4QtByConfigWithConfigFileAbsPath(QString config_file_abs_path); 16 | extern void ShutDownLog4QtByConfig(); 17 | 18 | 19 | 20 | #endif // LOG4QT_HELPER_H 21 | -------------------------------------------------------------------------------- /12_4_qt_log4qt_demo/src/third_libs/log4qt/include/log4qt/appender.cpp: -------------------------------------------------------------------------------- 1 | /****************************************************************************** 2 | * 3 | * This file is part of Log4Qt library. 4 | * 5 | * Copyright (C) 2007 - 2020 Log4Qt contributors 6 | * 7 | * Licensed under the Apache License, Version 2.0 (the "License"); 8 | * you may not use this file except in compliance with the License. 9 | * You may obtain a copy of the License at 10 | * 11 | * http://www.apache.org/licenses/LICENSE-2.0 12 | * 13 | * Unless required by applicable law or agreed to in writing, software 14 | * distributed under the License is distributed on an "AS IS" BASIS, 15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | * See the License for the specific language governing permissions and 17 | * limitations under the License. 18 | * 19 | ******************************************************************************/ 20 | 21 | #include "appender.h" 22 | 23 | namespace Log4Qt 24 | { 25 | 26 | Appender::Appender(QObject *parent) : 27 | QObject(parent) 28 | { 29 | } 30 | 31 | Logger *Appender::logger() const 32 | { 33 | return mLog4QtClassLogger.logger(this); 34 | } 35 | 36 | } // namespace Log4Qt 37 | 38 | #include "moc_appender.cpp" 39 | -------------------------------------------------------------------------------- /12_4_qt_log4qt_demo/src/third_libs/log4qt/include/log4qt/loggerrepository.cpp: -------------------------------------------------------------------------------- 1 | /****************************************************************************** 2 | * 3 | * This file is part of Log4Qt library. 4 | * 5 | * Copyright (C) 2007 - 2020 Log4Qt contributors 6 | * 7 | * Licensed under the Apache License, Version 2.0 (the "License"); 8 | * you may not use this file except in compliance with the License. 9 | * You may obtain a copy of the License at 10 | * 11 | * http://www.apache.org/licenses/LICENSE-2.0 12 | * 13 | * Unless required by applicable law or agreed to in writing, software 14 | * distributed under the License is distributed on an "AS IS" BASIS, 15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | * See the License for the specific language governing permissions and 17 | * limitations under the License. 18 | * 19 | ******************************************************************************/ 20 | 21 | #include "loggerrepository.h" 22 | 23 | 24 | namespace Log4Qt 25 | { 26 | 27 | } // namespace Log4Qt 28 | -------------------------------------------------------------------------------- /12_4_qt_log4qt_demo/src/third_libs/log4qt/include/log4qt/varia/denyallfilter.cpp: -------------------------------------------------------------------------------- 1 | /****************************************************************************** 2 | * 3 | * This file is part of Log4Qt library. 4 | * 5 | * Copyright (C) 2007 - 2020 Log4Qt contributors 6 | * 7 | * Licensed under the Apache License, Version 2.0 (the "License"); 8 | * you may not use this file except in compliance with the License. 9 | * You may obtain a copy of the License at 10 | * 11 | * http://www.apache.org/licenses/LICENSE-2.0 12 | * 13 | * Unless required by applicable law or agreed to in writing, software 14 | * distributed under the License is distributed on an "AS IS" BASIS, 15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | * See the License for the specific language governing permissions and 17 | * limitations under the License. 18 | * 19 | ******************************************************************************/ 20 | 21 | #include "varia/denyallfilter.h" 22 | 23 | namespace Log4Qt 24 | { 25 | 26 | DenyAllFilter::DenyAllFilter(QObject *parent) : 27 | Filter(parent) 28 | {} 29 | 30 | } // namespace Log4Qt 31 | 32 | #include "moc_denyallfilter.cpp" 33 | -------------------------------------------------------------------------------- /12_4_qt_log4qt_demo/src/third_libs/log4qt/log4qtlib.pri: -------------------------------------------------------------------------------- 1 | message("log4qt_lib_been_attached") 2 | 3 | CONFIG += c++11 4 | 5 | INCLUDEPATH += $$PWD/helper 6 | INCLUDEPATH += $$PWD/include 7 | DEPENDPATH += $$PWD/include 8 | 9 | SOURCES += \ 10 | $$PWD/helper/log4qt_init_helper_by_coding.cpp \ 11 | $$PWD/helper/log4qt_init_helper_by_config.cpp 12 | 13 | HEADERS += \ 14 | $$PWD/helper/log4qt_init_helper_by_coding.h \ 15 | $$PWD/helper/log4qt_init_helper_by_config.h 16 | 17 | macx { 18 | macx: LIBS += -L$$PWD/bin/ -llog4qt.1 19 | } 20 | 21 | win32 { 22 | win32: LIBS += -L$$PWD/bin/ -llog4qt 23 | } 24 | 25 | DISTFILES += \ 26 | $$PWD/log4qt.properties 27 | 28 | 29 | 30 | -------------------------------------------------------------------------------- /12_4_qt_log4qt_demo/src/third_libs_src_code/Log4Qt-master/.astylerc: -------------------------------------------------------------------------------- 1 | # brace style 2 | --style=allman 3 | --remove-brackets 4 | 5 | # indent style 6 | --indent=spaces=4 7 | 8 | # padding options 9 | --align-pointer=name 10 | --align-reference=name 11 | --pad-header 12 | --pad-oper 13 | 14 | # formating options 15 | --keep-one-line-blocks 16 | --close-templates 17 | --convert-tabs 18 | 19 | 20 | -------------------------------------------------------------------------------- /12_4_qt_log4qt_demo/src/third_libs_src_code/Log4Qt-master/.gitattributes: -------------------------------------------------------------------------------- 1 | * text=auto 2 | -------------------------------------------------------------------------------- /12_4_qt_log4qt_demo/src/third_libs_src_code/Log4Qt-master/.gitignore: -------------------------------------------------------------------------------- 1 | # C++ objects and libs 2 | 3 | *.slo 4 | *.lo 5 | *.o 6 | *.a 7 | *.la 8 | *.lai 9 | *.so 10 | *.dll 11 | *.dylib 12 | 13 | # Qt-es 14 | 15 | /.qmake.cache 16 | /.qmake.stash 17 | *.pro.user 18 | *.pro.user.* 19 | *.qbs.user 20 | *.qbs.user.* 21 | CMakeLists.txt.user 22 | *.moc 23 | moc_*.cpp 24 | qrc_*.cpp 25 | ui_*.h 26 | Makefile* 27 | *-build-* 28 | 29 | # QtCreator 30 | 31 | *.autosave 32 | 33 | #QtCtreator Qml 34 | *.qmlproject.user 35 | *.qmlproject.user.* 36 | -------------------------------------------------------------------------------- /12_4_qt_log4qt_demo/src/third_libs_src_code/Log4Qt-master/.travis.yml: -------------------------------------------------------------------------------- 1 | language: cpp 2 | 3 | sudo: required 4 | 5 | dist: bionic 6 | 7 | compiler: 8 | - gcc 9 | 10 | os: 11 | - linux 12 | 13 | env: 14 | - QT_VERSION=qt512 QT_PPA=qt-5.12.7 15 | - QT_VERSION=qt513 QT_PPA=qt-5.13.2 16 | - QT_VERSION=qt514 QT_PPA=qt-5.14.1 17 | 18 | before_install: 19 | - sudo add-apt-repository --yes ppa:beineri/opt-$QT_PPA-bionic 20 | - sudo apt-get update -qq 21 | 22 | install: 23 | - sudo apt-get -y install $QT_VERSION-meta-minimal 24 | 25 | script: 26 | - . /opt/$QT_VERSION/bin/$QT_VERSION-env.sh 27 | - qmake 28 | - make 29 | - make check 30 | 31 | -------------------------------------------------------------------------------- /12_4_qt_log4qt_demo/src/third_libs_src_code/Log4Qt-master/appveyor.yml: -------------------------------------------------------------------------------- 1 | version: 1.6.{build} 2 | build: 3 | verbosity: minimal 4 | 5 | environment: 6 | matrix: 7 | # Qt 5.12 8 | - QTDIR: C:\Qt\5.12\msvc2017_64 9 | CMD_VCVARSALL: '"C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Auxiliary\Build\vcvarsall.bat" x64' 10 | APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2017 11 | # Qt 5.13 12 | - QTDIR: C:\Qt\5.13\msvc2017_64 13 | CMD_VCVARSALL: '"C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Auxiliary\Build\vcvarsall.bat" x64' 14 | APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2017 15 | # Qt 5.14 16 | - QTDIR: C:\Qt\5.14\msvc2017_64 17 | CMD_VCVARSALL: '"C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Auxiliary\Build\vcvarsall.bat" x64' 18 | APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2019 19 | 20 | branches: 21 | only: 22 | - master 23 | install: 24 | - call %CMD_VCVARSALL% 25 | - set PATH=%PATH%;%QTDIR%\bin 26 | build_script: 27 | - qmake 28 | - nmake 29 | - nmake check 30 | 31 | 32 | -------------------------------------------------------------------------------- /12_4_qt_log4qt_demo/src/third_libs_src_code/Log4Qt-master/build.pri: -------------------------------------------------------------------------------- 1 | # uncomment if you want to build a static log4qt library 2 | #DEFINES += LOG4QT_STATIC 3 | # uncomment if you want to log to a database via databaselogger 4 | # QT += sql 5 | 6 | LOG4QT_VERSION_MAJOR = 1 7 | LOG4QT_VERSION_MINOR = 6 8 | LOG4QT_VERSION_PATCH = 0 9 | 10 | DEFINES += LOG4QT_VERSION_MAJOR=$${LOG4QT_VERSION_MAJOR} 11 | DEFINES += LOG4QT_VERSION_MINOR=$${LOG4QT_VERSION_MINOR} 12 | DEFINES += LOG4QT_VERSION_PATCH=$${LOG4QT_VERSION_PATCH} 13 | DEFINES += LOG4QT_VERSION_STR='\\"$${LOG4QT_VERSION_MAJOR}.$${LOG4QT_VERSION_MINOR}.$${LOG4QT_VERSION_PATCH}\\"' 14 | 15 | DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x050F00 16 | DEFINES += QT_DEPRECATED_WARNINGS 17 | -------------------------------------------------------------------------------- /12_4_qt_log4qt_demo/src/third_libs_src_code/Log4Qt-master/cmake/Log4QtConfig.cmake.in: -------------------------------------------------------------------------------- 1 | include("${CMAKE_CURRENT_LIST_DIR}/Log4QtTargets.cmake") 2 | -------------------------------------------------------------------------------- /12_4_qt_log4qt_demo/src/third_libs_src_code/Log4Qt-master/cmake/MacroEnsureOutOfSourceBuild.cmake: -------------------------------------------------------------------------------- 1 | # - MACRO_ENSURE_OUT_OF_SOURCE_BUILD() 2 | # MACRO_ENSURE_OUT_OF_SOURCE_BUILD() 3 | # Call this macro in your project if you want to enforce out-of-source builds. 4 | # If an in-source build is detected, it will abort with the given error message. 5 | # This macro works in any of the CMakeLists.txt of your project, but the recommended 6 | # location to call this is close to the beginning of the top level CMakeLists.txt 7 | 8 | # Copyright (c) 2006, Alexander Neundorf, 9 | # 10 | # Redistribution and use is allowed according to the terms of the BSD license. 11 | # For details see the accompanying COPYING-CMAKE-SCRIPTS file. 12 | 13 | MACRO (MACRO_ENSURE_OUT_OF_SOURCE_BUILD _errorMessage) 14 | 15 | STRING(COMPARE EQUAL "${CMAKE_SOURCE_DIR}" "${CMAKE_BINARY_DIR}" insource) 16 | IF(insource) 17 | MESSAGE(FATAL_ERROR "${_errorMessage}") 18 | ENDIF(insource) 19 | 20 | ENDMACRO (MACRO_ENSURE_OUT_OF_SOURCE_BUILD) 21 | 22 | -------------------------------------------------------------------------------- /12_4_qt_log4qt_demo/src/third_libs_src_code/Log4Qt-master/cmake/cmake_uninstall.cmake.in: -------------------------------------------------------------------------------- 1 | if(NOT EXISTS "@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt") 2 | message(FATAL_ERROR "Cannot find install manifest: \"@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt\"") 3 | endif() 4 | 5 | file(READ "@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt" files) 6 | string(REGEX REPLACE "\n" ";" files "${files}") 7 | foreach(file ${files}) 8 | set(_file_to_remove "$ENV{DESTDIR}${file}") 9 | message(STATUS "Uninstalling \"${_file_to_remove}\"") 10 | if(EXISTS "${_file_to_remove}") 11 | execute_process(COMMAND ${CMAKE_COMMAND} -E remove ${_file_to_remove} 12 | OUTPUT_VARIABLE rm_out 13 | RESULT_VARIABLE rm_retval) 14 | if(NOT ${rm_retval} EQUAL 0) 15 | message(FATAL_ERROR "Problem when removing \"${_file_to_remove}\": ${rm_out}") 16 | endif() 17 | else() 18 | message(STATUS "File \"${_file_to_remove}\" does not exist.") 19 | endif() 20 | endforeach() 21 | -------------------------------------------------------------------------------- /12_4_qt_log4qt_demo/src/third_libs_src_code/Log4Qt-master/doc/Doxyfile.in: -------------------------------------------------------------------------------- 1 | RECURSIVE = YES 2 | OUTPUT_DIRECTORY = @CMAKE_CURRENT_BINARY_DIR@/doc_doxygen/ 3 | INPUT = @CMAKE_CURRENT_SOURCE_DIR@/src/ @CMAKE_CURRENT_SOURCE_DIR@/include/ @CMAKE_CURRENT_SOURCE_DIR@/docs 4 | WARN_IF_UNDOCUMENTED = NO 5 | GENERATE_LATEX = NO 6 | -------------------------------------------------------------------------------- /12_4_qt_log4qt_demo/src/third_libs_src_code/Log4Qt-master/examples/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | add_subdirectory(basic) 2 | add_subdirectory(propertyconfigurator) 3 | -------------------------------------------------------------------------------- /12_4_qt_log4qt_demo/src/third_libs_src_code/Log4Qt-master/examples/basic/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | set(basic_SOURCES 2 | loggerobject.cpp 3 | loggerobject.h 4 | loggerobjectprio.cpp 5 | loggerobjectprio.h 6 | loggerstatic.cpp 7 | loggerstatic.h 8 | main.cpp 9 | ) 10 | set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin) 11 | add_executable(basic ${basic_SOURCES}) 12 | target_link_libraries(basic log4qt) 13 | -------------------------------------------------------------------------------- /12_4_qt_log4qt_demo/src/third_libs_src_code/Log4Qt-master/examples/basic/basic.pro: -------------------------------------------------------------------------------- 1 | include(../examples.pri) 2 | include(../../build.pri) 3 | 4 | QT += core network 5 | QT -= gui 6 | 7 | TEMPLATE = app 8 | DESTDIR = ../../bin 9 | 10 | LIBS += -L../../bin \ 11 | -llog4qt 12 | 13 | SOURCES += \ 14 | main.cpp \ 15 | loggerobject.cpp \ 16 | loggerobjectprio.cpp \ 17 | loggerstatic.cpp 18 | 19 | HEADERS += \ 20 | loggerobject.h \ 21 | loggerobjectprio.h \ 22 | loggerstatic.h 23 | 24 | INCLUDEPATH += ../../src 25 | 26 | -------------------------------------------------------------------------------- /12_4_qt_log4qt_demo/src/third_libs_src_code/Log4Qt-master/examples/basic/basic.qbs: -------------------------------------------------------------------------------- 1 | import qbs 2 | 3 | Product { 4 | type: "application" 5 | consoleApplication: true 6 | name : "basic" 7 | files : 8 | [ "main.cpp", 9 | "loggerobject.cpp", 10 | "loggerobject.h", 11 | "loggerobjectprio.cpp", 12 | "loggerobjectprio.h", 13 | "loggerstatic.cpp", 14 | "loggerstatic.h" 15 | ] 16 | destinationDirectory: "../bin" 17 | Depends { name: "cpp" } 18 | Depends { name: "log4qt" } 19 | Depends { name: "Qt"; submodules: ["core", "xml", "network", "sql"] } 20 | 21 | cpp.includePaths: ["../../src"] 22 | cpp.cxxLanguageVersion: "c++11" 23 | 24 | Properties { 25 | condition: qbs.targetOS.contains("macos") 26 | cpp.sonamePrefix: "@rpath" 27 | cpp.useRPaths: true 28 | cpp.rpaths: ["@loader_path", "@executable_path"] 29 | } 30 | 31 | Properties { 32 | condition: qbs.targetOS.contains("linux") 33 | cpp.useRPaths: true 34 | cpp.rpaths: ["$ORIGIN"] 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /12_4_qt_log4qt_demo/src/third_libs_src_code/Log4Qt-master/examples/basic/loggerstatic.h: -------------------------------------------------------------------------------- 1 | /****************************************************************************** 2 | * 3 | * This file is part of Log4Qt library. 4 | * 5 | * Copyright (C) 2007 - 2020 Log4Qt contributors 6 | * 7 | * Licensed under the Apache License, Version 2.0 (the "License"); 8 | * you may not use this file except in compliance with the License. 9 | * You may obtain a copy of the License at 10 | * 11 | * http://www.apache.org/licenses/LICENSE-2.0 12 | * 13 | * Unless required by applicable law or agreed to in writing, software 14 | * distributed under the License is distributed on an "AS IS" BASIS, 15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | * See the License for the specific language governing permissions and 17 | * limitations under the License. 18 | * 19 | ******************************************************************************/ 20 | 21 | #ifndef LOGGERSTATIC_H 22 | #define LOGGERSTATIC_H 23 | 24 | 25 | class LoggerStatic 26 | { 27 | public: 28 | LoggerStatic(); 29 | ~LoggerStatic(); 30 | 31 | LoggerStatic(const LoggerStatic &) = delete; 32 | LoggerStatic &operator=(const LoggerStatic &) = delete; 33 | }; 34 | 35 | #endif // LOGGERSTATIC_H 36 | -------------------------------------------------------------------------------- /12_4_qt_log4qt_demo/src/third_libs_src_code/Log4Qt-master/examples/examples.pri: -------------------------------------------------------------------------------- 1 | include (../g++.pri) 2 | include (../build.pri) 3 | 4 | CONFIG += c++14 5 | 6 | msvc { 7 | QMAKE_CXXFLAGS += -wd4267 8 | } 9 | -------------------------------------------------------------------------------- /12_4_qt_log4qt_demo/src/third_libs_src_code/Log4Qt-master/examples/examples.pro: -------------------------------------------------------------------------------- 1 | include(../build.pri) 2 | TEMPLATE = subdirs 3 | CONFIG += ordered 4 | 5 | SUBDIRS += basic \ 6 | propertyconfigurator 7 | -------------------------------------------------------------------------------- /12_4_qt_log4qt_demo/src/third_libs_src_code/Log4Qt-master/examples/examples.qbs: -------------------------------------------------------------------------------- 1 | import qbs 2 | 3 | Project { 4 | references: [ 5 | "basic/basic.qbs", 6 | "propertyconfigurator/propertyconfigurator.qbs" 7 | ] 8 | } 9 | -------------------------------------------------------------------------------- /12_4_qt_log4qt_demo/src/third_libs_src_code/Log4Qt-master/examples/propertyconfigurator/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | set(basic_SOURCES 2 | loggerobject.cpp 3 | loggerobject.h 4 | loggerobjectprio.cpp 5 | loggerobjectprio.h 6 | loggerstatic.cpp 7 | loggerstatic.h 8 | main.cpp 9 | ) 10 | set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin) 11 | add_executable(propertyconfigurator ${basic_SOURCES}) 12 | target_link_libraries(propertyconfigurator log4qt) 13 | -------------------------------------------------------------------------------- /12_4_qt_log4qt_demo/src/third_libs_src_code/Log4Qt-master/examples/propertyconfigurator/loggerstatic.cpp: -------------------------------------------------------------------------------- 1 | /****************************************************************************** 2 | * 3 | * This file is part of Log4Qt library. 4 | * 5 | * Copyright (C) 2007 - 2020 Log4Qt contributors 6 | * 7 | * Licensed under the Apache License, Version 2.0 (the "License"); 8 | * you may not use this file except in compliance with the License. 9 | * You may obtain a copy of the License at 10 | * 11 | * http://www.apache.org/licenses/LICENSE-2.0 12 | * 13 | * Unless required by applicable law or agreed to in writing, software 14 | * distributed under the License is distributed on an "AS IS" BASIS, 15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | * See the License for the specific language governing permissions and 17 | * limitations under the License. 18 | * 19 | ******************************************************************************/ 20 | 21 | #include "loggerstatic.h" 22 | 23 | #include "log4qt/logger.h" 24 | 25 | LOG4QT_DECLARE_STATIC_LOGGER(logger, LoggerStatic) 26 | 27 | LoggerStatic::LoggerStatic() 28 | { 29 | logger()->trace() << "ctor Debug output"; 30 | } 31 | 32 | LoggerStatic::~LoggerStatic() 33 | { 34 | logger()->trace() << "dtor Debug output"; 35 | } 36 | -------------------------------------------------------------------------------- /12_4_qt_log4qt_demo/src/third_libs_src_code/Log4Qt-master/examples/propertyconfigurator/loggerstatic.h: -------------------------------------------------------------------------------- 1 | /****************************************************************************** 2 | * 3 | * This file is part of Log4Qt library. 4 | * 5 | * Copyright (C) 2007 - 2020 Log4Qt contributors 6 | * 7 | * Licensed under the Apache License, Version 2.0 (the "License"); 8 | * you may not use this file except in compliance with the License. 9 | * You may obtain a copy of the License at 10 | * 11 | * http://www.apache.org/licenses/LICENSE-2.0 12 | * 13 | * Unless required by applicable law or agreed to in writing, software 14 | * distributed under the License is distributed on an "AS IS" BASIS, 15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | * See the License for the specific language governing permissions and 17 | * limitations under the License. 18 | * 19 | ******************************************************************************/ 20 | 21 | #ifndef LOGGERSTATIC_H 22 | #define LOGGERSTATIC_H 23 | 24 | 25 | class LoggerStatic 26 | { 27 | public: 28 | LoggerStatic(); 29 | ~LoggerStatic(); 30 | 31 | LoggerStatic(const LoggerStatic &) = delete; 32 | LoggerStatic &operator=(const LoggerStatic &) = delete; 33 | }; 34 | 35 | #endif // LOGGERSTATIC_H 36 | -------------------------------------------------------------------------------- /12_4_qt_log4qt_demo/src/third_libs_src_code/Log4Qt-master/examples/propertyconfigurator/propertyconfigurator.exe.log4qt.properties: -------------------------------------------------------------------------------- 1 | logpath=. 2 | 3 | log4j.reset=true 4 | log4j.Debug=WARN 5 | log4j.threshold=NULL 6 | log4j.handleQtMessages=true 7 | log4j.watchThisFile=false 8 | 9 | log4j.rootLogger=ALL, console, daily 10 | 11 | log4j.appender.console=org.apache.log4j.ConsoleAppender 12 | log4j.appender.console.target=STDOUT_TARGET 13 | log4j.appender.console.layout=org.apache.log4j.TTCCLayout 14 | log4j.appender.console.layout.dateFormat=dd.MM.yyyy hh:mm:ss.zzz 15 | log4j.appender.console.layout.contextPrinting=true 16 | log4j.appender.console.threshold=ALL 17 | 18 | log4j.appender.daily=org.apache.log4j.DailyFileAppender 19 | log4j.appender.daily.file=${logpath}/propertyconfigurator.log 20 | log4j.appender.daily.appendFile=true 21 | log4j.appender.daily.datePattern=_yyyy_MM_dd 22 | log4j.appender.daily.keepDays=90 23 | log4j.appender.daily.layout=${log4j.appender.console.layout} 24 | log4j.appender.daily.layout.dateFormat=${log4j.appender.console.layout.dateFormat} 25 | log4j.appender.daily.layout.contextPrinting=${log4j.appender.console.layout.contextPrinting} 26 | 27 | log4j.logger.LoggerObjectPrio=ERROR, daily, console 28 | log4j.additivity.LoggerObjectPrio=false 29 | -------------------------------------------------------------------------------- /12_4_qt_log4qt_demo/src/third_libs_src_code/Log4Qt-master/examples/propertyconfigurator/propertyconfigurator.pro: -------------------------------------------------------------------------------- 1 | include(../examples.pri) 2 | include(../../build.pri) 3 | 4 | QT += core network 5 | QT -= gui 6 | 7 | TEMPLATE = app 8 | DESTDIR = ../../bin 9 | 10 | LIBS += -L../../bin \ 11 | -llog4qt 12 | 13 | SOURCES += \ 14 | main.cpp \ 15 | loggerobject.cpp \ 16 | loggerobjectprio.cpp \ 17 | loggerstatic.cpp 18 | 19 | HEADERS += \ 20 | loggerobject.h \ 21 | loggerobjectprio.h \ 22 | loggerstatic.h 23 | 24 | INCLUDEPATH += ../../src 25 | 26 | DISTFILES += \ 27 | propertyconfigurator.exe.log4qt.properties 28 | 29 | 30 | -------------------------------------------------------------------------------- /12_4_qt_log4qt_demo/src/third_libs_src_code/Log4Qt-master/examples/propertyconfigurator/propertyconfigurator.qbs: -------------------------------------------------------------------------------- 1 | import qbs 2 | 3 | Product { 4 | type: "application" 5 | consoleApplication: true 6 | name : "propertyconfigurator" 7 | files : 8 | [ "main.cpp", 9 | "loggerobject.cpp", 10 | "loggerobject.h", 11 | "loggerobjectprio.cpp", 12 | "loggerobjectprio.h", 13 | "loggerstatic.cpp", 14 | "loggerstatic.h" 15 | ] 16 | destinationDirectory: "../bin" 17 | Depends { name: "cpp" } 18 | Depends { name: "log4qt" } 19 | Depends { name: "Qt"; submodules: ["core", "xml", "network", "sql"] } 20 | 21 | cpp.includePaths: ["../../src"] 22 | cpp.cxxLanguageVersion: "c++11" 23 | 24 | Properties { 25 | condition: qbs.targetOS.contains("macos") 26 | cpp.sonamePrefix: "@rpath" 27 | cpp.useRPaths: true 28 | cpp.rpaths: ["@loader_path", "@executable_path"] 29 | } 30 | 31 | Properties { 32 | condition: qbs.targetOS.contains("linux") 33 | cpp.useRPaths: true 34 | cpp.rpaths: ["$ORIGIN"] 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /12_4_qt_log4qt_demo/src/third_libs_src_code/Log4Qt-master/include/log4qt/Appender: -------------------------------------------------------------------------------- 1 | #include "appender.h" 2 | -------------------------------------------------------------------------------- /12_4_qt_log4qt_demo/src/third_libs_src_code/Log4Qt-master/include/log4qt/Appenderskeleton: -------------------------------------------------------------------------------- 1 | #include "appenderskeleton.h" 2 | -------------------------------------------------------------------------------- /12_4_qt_log4qt_demo/src/third_libs_src_code/Log4Qt-master/include/log4qt/AsyncAppender: -------------------------------------------------------------------------------- 1 | #include "asyncappender.h" 2 | -------------------------------------------------------------------------------- /12_4_qt_log4qt_demo/src/third_libs_src_code/Log4Qt-master/include/log4qt/BasicConfigurator: -------------------------------------------------------------------------------- 1 | #include "basicconfigurator.h" 2 | -------------------------------------------------------------------------------- /12_4_qt_log4qt_demo/src/third_libs_src_code/Log4Qt-master/include/log4qt/BinaryFileAppender: -------------------------------------------------------------------------------- 1 | #include "binaryfileappender.h" 2 | -------------------------------------------------------------------------------- /12_4_qt_log4qt_demo/src/third_libs_src_code/Log4Qt-master/include/log4qt/BinaryLayout: -------------------------------------------------------------------------------- 1 | #include "binarylayout.h" 2 | -------------------------------------------------------------------------------- /12_4_qt_log4qt_demo/src/third_libs_src_code/Log4Qt-master/include/log4qt/BinaryLogStream: -------------------------------------------------------------------------------- 1 | #include "binarylogstream.h" 2 | -------------------------------------------------------------------------------- /12_4_qt_log4qt_demo/src/third_libs_src_code/Log4Qt-master/include/log4qt/BinaryLogger: -------------------------------------------------------------------------------- 1 | #include "binarylogger.h" 2 | -------------------------------------------------------------------------------- /12_4_qt_log4qt_demo/src/third_libs_src_code/Log4Qt-master/include/log4qt/BinaryLoggingEvent: -------------------------------------------------------------------------------- 1 | #include "binaryloggingevent.h" 2 | -------------------------------------------------------------------------------- /12_4_qt_log4qt_demo/src/third_libs_src_code/Log4Qt-master/include/log4qt/BinaryToTextLayout: -------------------------------------------------------------------------------- 1 | #include "binarytotextlayout.h" 2 | -------------------------------------------------------------------------------- /12_4_qt_log4qt_demo/src/third_libs_src_code/Log4Qt-master/include/log4qt/BinaryWriterAppender: -------------------------------------------------------------------------------- 1 | #include "binarywriterappender.h" 2 | -------------------------------------------------------------------------------- /12_4_qt_log4qt_demo/src/third_libs_src_code/Log4Qt-master/include/log4qt/ColorConsoleAppender: -------------------------------------------------------------------------------- 1 | #include "colorconsoleappender.h" 2 | -------------------------------------------------------------------------------- /12_4_qt_log4qt_demo/src/third_libs_src_code/Log4Qt-master/include/log4qt/ConsoleAppender: -------------------------------------------------------------------------------- 1 | #include "consoleappender.h" 2 | -------------------------------------------------------------------------------- /12_4_qt_log4qt_demo/src/third_libs_src_code/Log4Qt-master/include/log4qt/DailyFileAppender: -------------------------------------------------------------------------------- 1 | #include "dailyfileappender.h" 2 | -------------------------------------------------------------------------------- /12_4_qt_log4qt_demo/src/third_libs_src_code/Log4Qt-master/include/log4qt/DailyRollingFileAppender: -------------------------------------------------------------------------------- 1 | #include "dailyrollingfileappender.h" 2 | -------------------------------------------------------------------------------- /12_4_qt_log4qt_demo/src/third_libs_src_code/Log4Qt-master/include/log4qt/DatabaseAppender: -------------------------------------------------------------------------------- 1 | #include "databaseappender.h" 2 | -------------------------------------------------------------------------------- /12_4_qt_log4qt_demo/src/third_libs_src_code/Log4Qt-master/include/log4qt/DatabaseLayout: -------------------------------------------------------------------------------- 1 | #include "databaselayout.h" 2 | -------------------------------------------------------------------------------- /12_4_qt_log4qt_demo/src/third_libs_src_code/Log4Qt-master/include/log4qt/FileAppender: -------------------------------------------------------------------------------- 1 | #include "fileappender.h" 2 | -------------------------------------------------------------------------------- /12_4_qt_log4qt_demo/src/third_libs_src_code/Log4Qt-master/include/log4qt/Hierarchy: -------------------------------------------------------------------------------- 1 | #include "hierarchy.h" 2 | -------------------------------------------------------------------------------- /12_4_qt_log4qt_demo/src/third_libs_src_code/Log4Qt-master/include/log4qt/Layout: -------------------------------------------------------------------------------- 1 | #include "layout.h" 2 | -------------------------------------------------------------------------------- /12_4_qt_log4qt_demo/src/third_libs_src_code/Log4Qt-master/include/log4qt/Level: -------------------------------------------------------------------------------- 1 | #include "level.h" 2 | -------------------------------------------------------------------------------- /12_4_qt_log4qt_demo/src/third_libs_src_code/Log4Qt-master/include/log4qt/Log4Qt: -------------------------------------------------------------------------------- 1 | #include "log4qt.h" 2 | -------------------------------------------------------------------------------- /12_4_qt_log4qt_demo/src/third_libs_src_code/Log4Qt-master/include/log4qt/Log4QtShared: -------------------------------------------------------------------------------- 1 | #include "log4qtshared.h" 2 | -------------------------------------------------------------------------------- /12_4_qt_log4qt_demo/src/third_libs_src_code/Log4Qt-master/include/log4qt/LogManager: -------------------------------------------------------------------------------- 1 | #include "logmanager.h" 2 | -------------------------------------------------------------------------------- /12_4_qt_log4qt_demo/src/third_libs_src_code/Log4Qt-master/include/log4qt/LogStream: -------------------------------------------------------------------------------- 1 | #include "logstream.h" 2 | -------------------------------------------------------------------------------- /12_4_qt_log4qt_demo/src/third_libs_src_code/Log4Qt-master/include/log4qt/Logger: -------------------------------------------------------------------------------- 1 | #include "logger.h" 2 | -------------------------------------------------------------------------------- /12_4_qt_log4qt_demo/src/third_libs_src_code/Log4Qt-master/include/log4qt/LoggerRepository: -------------------------------------------------------------------------------- 1 | #include "loggerrepository.h" 2 | -------------------------------------------------------------------------------- /12_4_qt_log4qt_demo/src/third_libs_src_code/Log4Qt-master/include/log4qt/LoggingEvent: -------------------------------------------------------------------------------- 1 | #include "loggingevent.h" 2 | -------------------------------------------------------------------------------- /12_4_qt_log4qt_demo/src/third_libs_src_code/Log4Qt-master/include/log4qt/MDC: -------------------------------------------------------------------------------- 1 | #include "mdc.h" 2 | -------------------------------------------------------------------------------- /12_4_qt_log4qt_demo/src/third_libs_src_code/Log4Qt-master/include/log4qt/MainthreadAppender: -------------------------------------------------------------------------------- 1 | #include "mainthreadappender.h" 2 | -------------------------------------------------------------------------------- /12_4_qt_log4qt_demo/src/third_libs_src_code/Log4Qt-master/include/log4qt/NDC: -------------------------------------------------------------------------------- 1 | #include "ndc.h" 2 | -------------------------------------------------------------------------------- /12_4_qt_log4qt_demo/src/third_libs_src_code/Log4Qt-master/include/log4qt/PatternLayout: -------------------------------------------------------------------------------- 1 | #include "patternlayout.h" 2 | -------------------------------------------------------------------------------- /12_4_qt_log4qt_demo/src/third_libs_src_code/Log4Qt-master/include/log4qt/PropertyConfigurator: -------------------------------------------------------------------------------- 1 | #include "propertyconfigurator.h" 2 | -------------------------------------------------------------------------------- /12_4_qt_log4qt_demo/src/third_libs_src_code/Log4Qt-master/include/log4qt/RollingBinaryFileAppender: -------------------------------------------------------------------------------- 1 | #include "rollingbinaryfileappender.h" 2 | -------------------------------------------------------------------------------- /12_4_qt_log4qt_demo/src/third_libs_src_code/Log4Qt-master/include/log4qt/RollingFileAppender: -------------------------------------------------------------------------------- 1 | #include "rollingfileappender.h" 2 | -------------------------------------------------------------------------------- /12_4_qt_log4qt_demo/src/third_libs_src_code/Log4Qt-master/include/log4qt/SignalAppender: -------------------------------------------------------------------------------- 1 | #include "signalappender.h" 2 | -------------------------------------------------------------------------------- /12_4_qt_log4qt_demo/src/third_libs_src_code/Log4Qt-master/include/log4qt/SimpleLayout: -------------------------------------------------------------------------------- 1 | #include "simplelayout.h" 2 | -------------------------------------------------------------------------------- /12_4_qt_log4qt_demo/src/third_libs_src_code/Log4Qt-master/include/log4qt/SimpleTimeLayout: -------------------------------------------------------------------------------- 1 | #include "simpletimelayout.h" 2 | -------------------------------------------------------------------------------- /12_4_qt_log4qt_demo/src/third_libs_src_code/Log4Qt-master/include/log4qt/SystemlogAppender: -------------------------------------------------------------------------------- 1 | #include "systemlogappender.h" 2 | -------------------------------------------------------------------------------- /12_4_qt_log4qt_demo/src/third_libs_src_code/Log4Qt-master/include/log4qt/TTCCLayout: -------------------------------------------------------------------------------- 1 | #include "ttcclayout.h" 2 | -------------------------------------------------------------------------------- /12_4_qt_log4qt_demo/src/third_libs_src_code/Log4Qt-master/include/log4qt/TelnetAppender: -------------------------------------------------------------------------------- 1 | #include "telnetappender.h" 2 | -------------------------------------------------------------------------------- /12_4_qt_log4qt_demo/src/third_libs_src_code/Log4Qt-master/include/log4qt/WDCAppender: -------------------------------------------------------------------------------- 1 | #include "wdcappender.h" 2 | -------------------------------------------------------------------------------- /12_4_qt_log4qt_demo/src/third_libs_src_code/Log4Qt-master/include/log4qt/WriterAppender: -------------------------------------------------------------------------------- 1 | #include "writerappender.h" 2 | -------------------------------------------------------------------------------- /12_4_qt_log4qt_demo/src/third_libs_src_code/Log4Qt-master/log4qt.pro: -------------------------------------------------------------------------------- 1 | TEMPLATE = subdirs 2 | CONFIG += ordered 3 | 4 | SUBDIRS += src \ 5 | tests \ 6 | examples 7 | 8 | OTHER_FILES += LICENSE \ 9 | Readme.md \ 10 | .travis.yml \ 11 | appveyor.yml \ 12 | ChangeLog.md 13 | -------------------------------------------------------------------------------- /12_4_qt_log4qt_demo/src/third_libs_src_code/Log4Qt-master/log4qt.qbs: -------------------------------------------------------------------------------- 1 | import qbs 2 | 3 | Project { 4 | minimumQbsVersion: "1.9.0" 5 | references: [ 6 | "examples/examples.qbs", 7 | "others.qbs", 8 | "src/log4qt/log4qt.qbs", 9 | "tests/tests.qbs", 10 | ] 11 | 12 | Product { 13 | name: "qmake project files(log4qt)" 14 | Group { 15 | name: "files" 16 | files: ["**/*.pr[io]"] 17 | } 18 | } 19 | 20 | Product { 21 | name: "cmake project files(log4qt)" 22 | Group { 23 | name: "files" 24 | files: ["**/CMakeLists.txt", "cmake/*"] 25 | } 26 | } 27 | } 28 | 29 | -------------------------------------------------------------------------------- /12_4_qt_log4qt_demo/src/third_libs_src_code/Log4Qt-master/others.qbs: -------------------------------------------------------------------------------- 1 | import qbs 2 | 3 | Product 4 | { 5 | name: "log4qt others" 6 | Group { 7 | name: "log4qt other files" 8 | files: ["*.md", "LICENSE", "*.yml"] 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /12_4_qt_log4qt_demo/src/third_libs_src_code/Log4Qt-master/src/log4qt/appender.cpp: -------------------------------------------------------------------------------- 1 | /****************************************************************************** 2 | * 3 | * This file is part of Log4Qt library. 4 | * 5 | * Copyright (C) 2007 - 2020 Log4Qt contributors 6 | * 7 | * Licensed under the Apache License, Version 2.0 (the "License"); 8 | * you may not use this file except in compliance with the License. 9 | * You may obtain a copy of the License at 10 | * 11 | * http://www.apache.org/licenses/LICENSE-2.0 12 | * 13 | * Unless required by applicable law or agreed to in writing, software 14 | * distributed under the License is distributed on an "AS IS" BASIS, 15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | * See the License for the specific language governing permissions and 17 | * limitations under the License. 18 | * 19 | ******************************************************************************/ 20 | 21 | #include "appender.h" 22 | 23 | namespace Log4Qt 24 | { 25 | 26 | Appender::Appender(QObject *parent) : 27 | QObject(parent) 28 | { 29 | } 30 | 31 | Logger *Appender::logger() const 32 | { 33 | return mLog4QtClassLogger.logger(this); 34 | } 35 | 36 | } // namespace Log4Qt 37 | 38 | #include "moc_appender.cpp" 39 | -------------------------------------------------------------------------------- /12_4_qt_log4qt_demo/src/third_libs_src_code/Log4Qt-master/src/log4qt/loggerrepository.cpp: -------------------------------------------------------------------------------- 1 | /****************************************************************************** 2 | * 3 | * This file is part of Log4Qt library. 4 | * 5 | * Copyright (C) 2007 - 2020 Log4Qt contributors 6 | * 7 | * Licensed under the Apache License, Version 2.0 (the "License"); 8 | * you may not use this file except in compliance with the License. 9 | * You may obtain a copy of the License at 10 | * 11 | * http://www.apache.org/licenses/LICENSE-2.0 12 | * 13 | * Unless required by applicable law or agreed to in writing, software 14 | * distributed under the License is distributed on an "AS IS" BASIS, 15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | * See the License for the specific language governing permissions and 17 | * limitations under the License. 18 | * 19 | ******************************************************************************/ 20 | 21 | #include "loggerrepository.h" 22 | 23 | 24 | namespace Log4Qt 25 | { 26 | 27 | } // namespace Log4Qt 28 | -------------------------------------------------------------------------------- /12_4_qt_log4qt_demo/src/third_libs_src_code/Log4Qt-master/src/log4qt/varia/denyallfilter.cpp: -------------------------------------------------------------------------------- 1 | /****************************************************************************** 2 | * 3 | * This file is part of Log4Qt library. 4 | * 5 | * Copyright (C) 2007 - 2020 Log4Qt contributors 6 | * 7 | * Licensed under the Apache License, Version 2.0 (the "License"); 8 | * you may not use this file except in compliance with the License. 9 | * You may obtain a copy of the License at 10 | * 11 | * http://www.apache.org/licenses/LICENSE-2.0 12 | * 13 | * Unless required by applicable law or agreed to in writing, software 14 | * distributed under the License is distributed on an "AS IS" BASIS, 15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | * See the License for the specific language governing permissions and 17 | * limitations under the License. 18 | * 19 | ******************************************************************************/ 20 | 21 | #include "varia/denyallfilter.h" 22 | 23 | namespace Log4Qt 24 | { 25 | 26 | DenyAllFilter::DenyAllFilter(QObject *parent) : 27 | Filter(parent) 28 | {} 29 | 30 | } // namespace Log4Qt 31 | 32 | #include "moc_denyallfilter.cpp" 33 | -------------------------------------------------------------------------------- /12_4_qt_log4qt_demo/src/third_libs_src_code/Log4Qt-master/src/src.pro: -------------------------------------------------------------------------------- 1 | TEMPLATE = subdirs 2 | CONFIG += ordered 3 | 4 | SUBDIRS += log4qt 5 | -------------------------------------------------------------------------------- /12_4_qt_log4qt_demo/src/third_libs_src_code/Log4Qt-master/tests/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | add_subdirectory(binaryloggertest) 2 | add_subdirectory(dailyfileappendertest) 3 | add_subdirectory(log4qttest) 4 | -------------------------------------------------------------------------------- /12_4_qt_log4qt_demo/src/third_libs_src_code/Log4Qt-master/tests/binaryloggertest/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | set(blt_SOURCES 2 | atscopeexit.h 3 | binaryloggertest.cpp 4 | elementsinarray.h 5 | logging.cpp 6 | logging.h 7 | testappender.cpp 8 | testappender.h 9 | ) 10 | set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin) 11 | add_executable(binaryloggertest ${blt_SOURCES}) 12 | target_link_libraries(binaryloggertest log4qt Qt5::Test) 13 | add_test(NAME binaryloggertest COMMAND $) 14 | -------------------------------------------------------------------------------- /12_4_qt_log4qt_demo/src/third_libs_src_code/Log4Qt-master/tests/binaryloggertest/binaryloggertest.pro: -------------------------------------------------------------------------------- 1 | include(../tests.pri) 2 | 3 | QT += core testlib network 4 | QT -= gui 5 | 6 | TARGET = binaryloggertest 7 | TEMPLATE = app 8 | 9 | HEADERS += \ 10 | testappender.h \ 11 | elementsinarray.h \ 12 | atscopeexit.h \ 13 | 14 | SOURCES += binaryloggertest.cpp \ 15 | testappender.cpp 16 | 17 | DESTDIR=../../bin 18 | 19 | LIBS += -L../../bin/ \ 20 | -llog4qt 21 | 22 | INCLUDEPATH += ../../src 23 | -------------------------------------------------------------------------------- /12_4_qt_log4qt_demo/src/third_libs_src_code/Log4Qt-master/tests/binaryloggertest/binaryloggertest.qbs: -------------------------------------------------------------------------------- 1 | import qbs 2 | 3 | Product { 4 | type: ["application", "autotest"] 5 | consoleApplication: true 6 | name : "binaryloggertest" 7 | files: [ 8 | "binaryloggertest.cpp", 9 | "testappender.cpp", 10 | "testappender.h", 11 | "elementsinarray.h", 12 | "atscopeexit.h" 13 | ] 14 | 15 | Depends { name: "cpp" } 16 | Depends { name: "log4qt" } 17 | Depends { name: "Qt"; submodules: ["core", "xml", "network", "sql", "testlib"] } 18 | destinationDirectory: "../tests/bin" 19 | 20 | cpp.cxxLanguageVersion: "c++11" 21 | 22 | Properties { 23 | condition: qbs.targetOS.contains("macos") 24 | cpp.sonamePrefix: "@rpath" 25 | cpp.useRPaths: true 26 | cpp.rpaths: ["@loader_path", "@loader_path/../../bin", "@executable_path", "@executable_path/../../bin"] 27 | } 28 | 29 | Properties { 30 | condition: qbs.targetOS.contains("linux") 31 | cpp.useRPaths: true 32 | cpp.rpaths: ["$ORIGIN", "$ORIGIN/../../bin"] 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /12_4_qt_log4qt_demo/src/third_libs_src_code/Log4Qt-master/tests/binaryloggertest/elementsinarray.h: -------------------------------------------------------------------------------- 1 | #ifndef ELEMENTSINARRAY_H 2 | #define ELEMENTSINARRAY_H 3 | 4 | template 5 | size_t elementsInArray(T (&)[N] ) 6 | { 7 | return N; 8 | } 9 | 10 | #endif 11 | -------------------------------------------------------------------------------- /12_4_qt_log4qt_demo/src/third_libs_src_code/Log4Qt-master/tests/binaryloggertest/logging.h: -------------------------------------------------------------------------------- 1 | #ifndef LOGGING_H 2 | #define LOGGING_H 3 | 4 | #include 5 | 6 | class QByteArray; 7 | class QVariant; 8 | 9 | class Logging 10 | { 11 | public: 12 | static QString createDumpString(const QByteArray &data, const bool withCaption = true); 13 | static QString toString(const QVariant &value); 14 | static QString indentString(const QString &string, const QStringList &indentBrackets); 15 | }; 16 | 17 | #endif // LOGGING_H 18 | -------------------------------------------------------------------------------- /12_4_qt_log4qt_demo/src/third_libs_src_code/Log4Qt-master/tests/binaryloggertest/testappender.cpp: -------------------------------------------------------------------------------- 1 | #include "testappender.h" 2 | #include 3 | 4 | #include "log4qt/layout.h" 5 | 6 | TestAppender::TestAppender(QObject *parent) 7 | : Log4Qt::AppenderSkeleton(parent) 8 | { 9 | } 10 | 11 | QStringList TestAppender::list() const 12 | { 13 | QMutexLocker locker(&mObjectGuard); 14 | return mMessages; 15 | } 16 | 17 | QStringList TestAppender::clearList() 18 | { 19 | QMutexLocker locker(&mObjectGuard); 20 | QStringList copy(mMessages); 21 | mMessages.clear(); 22 | return copy; 23 | } 24 | 25 | bool TestAppender::requiresLayout() const 26 | { 27 | return true; 28 | } 29 | 30 | void TestAppender::append(const Log4Qt::LoggingEvent &event) 31 | { 32 | Q_ASSERT_X(layout(), "TestAppender::append()", "Layout must not be null"); 33 | mMessages << layout()->format(event); 34 | } 35 | 36 | #include "moc_testappender.cpp" 37 | -------------------------------------------------------------------------------- /12_4_qt_log4qt_demo/src/third_libs_src_code/Log4Qt-master/tests/binaryloggertest/testappender.h: -------------------------------------------------------------------------------- 1 | #ifndef TESTAPPENDER_H 2 | #define TESTAPPENDER_H 3 | 4 | #include "log4qt/appenderskeleton.h" 5 | 6 | #include 7 | 8 | class TestAppender : public Log4Qt::AppenderSkeleton 9 | { 10 | Q_OBJECT 11 | public: 12 | explicit TestAppender(QObject *parent = nullptr); 13 | TestAppender(const TestAppender &) = delete; 14 | TestAppender &operator=(const TestAppender &) = delete; 15 | 16 | QStringList list() const; 17 | QStringList clearList(); 18 | virtual bool requiresLayout() const override; 19 | 20 | protected: 21 | virtual void append(const Log4Qt::LoggingEvent &event) override; 22 | 23 | private: 24 | QStringList mMessages; 25 | }; 26 | 27 | #endif // TESTAPPENDER_H 28 | -------------------------------------------------------------------------------- /12_4_qt_log4qt_demo/src/third_libs_src_code/Log4Qt-master/tests/dailyfileappendertest/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | set(TEST_NAME dailyfileappendertest) 2 | 3 | set(dfa_SOURCES 4 | dailyfileappendertest.cpp 5 | ) 6 | set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin) 7 | add_executable(${TEST_NAME} ${dfa_SOURCES}) 8 | target_link_libraries(${TEST_NAME} log4qt Qt5::Test) 9 | add_test(NAME ${TEST_NAME} COMMAND $) 10 | -------------------------------------------------------------------------------- /12_4_qt_log4qt_demo/src/third_libs_src_code/Log4Qt-master/tests/dailyfileappendertest/dailyfileappendertest.pro: -------------------------------------------------------------------------------- 1 | include(../tests.pri) 2 | 3 | QT += core testlib 4 | QT -= gui 5 | 6 | TARGET = dailyfileappendertest 7 | TEMPLATE = app 8 | 9 | SOURCES += dailyfileappendertest.cpp 10 | 11 | DESTDIR=../../bin 12 | 13 | LIBS += -L../../bin/ \ 14 | -llog4qt 15 | 16 | INCLUDEPATH += ../../src 17 | -------------------------------------------------------------------------------- /12_4_qt_log4qt_demo/src/third_libs_src_code/Log4Qt-master/tests/dailyfileappendertest/dailyfileappendertest.qbs: -------------------------------------------------------------------------------- 1 | import qbs 2 | 3 | Product { 4 | type: ["application", "autotest"] 5 | consoleApplication: true 6 | name : "dailyfileappendertest" 7 | files: [ 8 | "dailyfileappendertest.cpp" 9 | ] 10 | 11 | Depends { name: "cpp" } 12 | Depends { name: "log4qt" } 13 | Depends { name: "Qt"; submodules: ["core", "testlib"] } 14 | destinationDirectory: "../tests/bin" 15 | 16 | cpp.cxxLanguageVersion: "c++11" 17 | 18 | Properties { 19 | condition: qbs.targetOS.contains("macos") 20 | cpp.sonamePrefix: "@rpath" 21 | cpp.useRPaths: true 22 | cpp.rpaths: ["@loader_path", "@loader_path/../../bin", "@executable_path", "@executable_path/../../bin"] 23 | } 24 | 25 | Properties { 26 | condition: qbs.targetOS.contains("linux") 27 | cpp.useRPaths: true 28 | cpp.rpaths: ["$ORIGIN", "$ORIGIN/../../bin"] 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /12_4_qt_log4qt_demo/src/third_libs_src_code/Log4Qt-master/tests/filewatcher/filewatcher.pro: -------------------------------------------------------------------------------- 1 | include(../tests.pri) 2 | 3 | QT += core testlib network 4 | QT -= gui 5 | 6 | TARGET = tst_filewatchertest 7 | CONFIG += console 8 | CONFIG -= app_bundle 9 | 10 | TEMPLATE = app 11 | DESTDIR=../../bin 12 | 13 | SOURCES += \ 14 | tst_filewatchertest.cpp 15 | 16 | DEFINES += SRCDIR=\\\"$$PWD/\\\" 17 | 18 | LIBS += -L../../bin/ \ 19 | -llog4qt 20 | 21 | INCLUDEPATH += ../../src 22 | -------------------------------------------------------------------------------- /12_4_qt_log4qt_demo/src/third_libs_src_code/Log4Qt-master/tests/log4qttest/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | set(l4qt_SOURCES 2 | log4qttest.cpp 3 | log4qttest.h 4 | ) 5 | set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin) 6 | add_executable(log4qttest ${l4qt_SOURCES}) 7 | target_link_libraries(log4qttest log4qt Qt5::Test) 8 | add_test(NAME log4qttest COMMAND $) 9 | -------------------------------------------------------------------------------- /12_4_qt_log4qt_demo/src/third_libs_src_code/Log4Qt-master/tests/log4qttest/log4qttest.pro: -------------------------------------------------------------------------------- 1 | include(../tests.pri) 2 | 3 | TEMPLATE = app 4 | CONFIG += testlib \ 5 | c++14 6 | 7 | QT += core testlib network 8 | QT -= gui 9 | 10 | INCLUDEPATH += ../../src 11 | 12 | HEADERS += log4qttest.h 13 | SOURCES += log4qttest.cpp 14 | 15 | LIBS += -L../../bin \ 16 | -llog4qt 17 | 18 | DESTDIR = ../../bin 19 | -------------------------------------------------------------------------------- /12_4_qt_log4qt_demo/src/third_libs_src_code/Log4Qt-master/tests/log4qttest/log4qttest.qbs: -------------------------------------------------------------------------------- 1 | import qbs 2 | 3 | Product { 4 | type: ["application", "autotest"] 5 | consoleApplication: true 6 | name : "log4qttest" 7 | files: [ 8 | "log4qttest.cpp", 9 | "log4qttest.h" 10 | ] 11 | 12 | Depends { name: "cpp" } 13 | Depends { name: "log4qt" } 14 | Depends { name: "Qt"; submodules: ["core", "xml", "network", "sql", "testlib"] } 15 | destinationDirectory: "../tests/bin" 16 | 17 | cpp.cxxLanguageVersion: "c++11" 18 | 19 | Properties { 20 | condition: qbs.targetOS.contains("macos") 21 | cpp.sonamePrefix: "@rpath" 22 | cpp.useRPaths: true 23 | cpp.rpaths: ["@loader_path", "@loader_path/../../bin", "@executable_path", "@executable_path/../../bin"] 24 | } 25 | 26 | Properties { 27 | condition: qbs.targetOS.contains("linux") 28 | cpp.useRPaths: true 29 | cpp.rpaths: ["$ORIGIN", "$ORIGIN/../../bin"] 30 | } 31 | 32 | } 33 | -------------------------------------------------------------------------------- /12_4_qt_log4qt_demo/src/third_libs_src_code/Log4Qt-master/tests/tests.pri: -------------------------------------------------------------------------------- 1 | include (../g++.pri) 2 | include (../build.pri) 3 | 4 | CONFIG += c++14 \ 5 | testcase \ 6 | no_testcase_installs 7 | 8 | mac { 9 | CONFIG -= app_bundle 10 | } 11 | 12 | win32 { 13 | CONFIG += console 14 | } 15 | 16 | DEFINES += QT_DEPRECATED_WARNINGS 17 | 18 | msvc { 19 | QMAKE_CXXFLAGS += -wd4267 20 | } 21 | -------------------------------------------------------------------------------- /12_4_qt_log4qt_demo/src/third_libs_src_code/Log4Qt-master/tests/tests.pro: -------------------------------------------------------------------------------- 1 | TEMPLATE = subdirs 2 | CONFIG += ordered 3 | 4 | SUBDIRS += log4qttest \ 5 | binaryloggertest \ 6 | dailyfileappendertest \ 7 | filewatcher 8 | -------------------------------------------------------------------------------- /12_4_qt_log4qt_demo/src/third_libs_src_code/Log4Qt-master/tests/tests.qbs: -------------------------------------------------------------------------------- 1 | import qbs 2 | 3 | Project { 4 | references: [ 5 | "log4qttest/log4qttest.qbs", 6 | "binaryloggertest/binaryloggertest.qbs", 7 | "dailyfileappendertest/dailyfileappendertest.qbs", 8 | ] 9 | } 10 | -------------------------------------------------------------------------------- /12_4_qt_log4qt_demo/src/third_libs_src_code/readme.txt: -------------------------------------------------------------------------------- 1 | use this source code for build a lib of release version. -------------------------------------------------------------------------------- /12_4_qt_log4qt_demo/src/ui/demodialog.cpp: -------------------------------------------------------------------------------- 1 | #include "demodialog.h" 2 | #include "ui_demodialog.h" 3 | 4 | DemoDialog::DemoDialog(QWidget *parent) 5 | : QDialog(parent) 6 | , ui(new Ui::DemoDialog) 7 | { 8 | ui->setupUi(this); 9 | } 10 | 11 | DemoDialog::~DemoDialog() 12 | { 13 | delete ui; 14 | } 15 | 16 | -------------------------------------------------------------------------------- /12_4_qt_log4qt_demo/src/ui/demodialog.h: -------------------------------------------------------------------------------- 1 | #ifndef DEMODIALOG_H 2 | #define DEMODIALOG_H 3 | 4 | #include 5 | 6 | QT_BEGIN_NAMESPACE 7 | namespace Ui { class DemoDialog; } 8 | QT_END_NAMESPACE 9 | 10 | class DemoDialog : public QDialog 11 | { 12 | Q_OBJECT 13 | 14 | public: 15 | DemoDialog(QWidget *parent = nullptr); 16 | ~DemoDialog(); 17 | 18 | private: 19 | Ui::DemoDialog *ui; 20 | }; 21 | #endif // DEMODIALOG_H 22 | -------------------------------------------------------------------------------- /12_4_qt_log4qt_demo/src/ui/demodialog.ui: -------------------------------------------------------------------------------- 1 | 2 | 3 | DemoDialog 4 | 5 | 6 | 7 | 0 8 | 0 9 | 400 10 | 300 11 | 12 | 13 | 14 | DemoDialog 15 | 16 | 17 | 18 | 19 | 140 20 | 130 21 | 121 22 | 16 23 | 24 | 25 | 26 | 请查看Log输出 27 | 28 | 29 | 30 | 31 | 32 | 33 | -------------------------------------------------------------------------------- /12_5_qt_breakpad_demo/BreakpadDemo/BreakpadDemo.pro: -------------------------------------------------------------------------------- 1 | QT += core gui network 2 | 3 | greaterThan(QT_MAJOR_VERSION, 4): QT += widgets 4 | 5 | 6 | TARGET = BreakpadDemo 7 | TEMPLATE = app 8 | 9 | CONFIG += c++11 10 | DEFINES += QT_DEPRECATED_WARNINGS 11 | 12 | # link qBreakpad library 13 | include($$PWD/third_libs/breakpad/breakpadsrc.pri) 14 | 15 | 16 | SOURCES += \ 17 | src/main.cpp \ 18 | src/ui/crashreportdialog/crashreportdialog.cpp \ 19 | src/ui/demodialog.cpp 20 | 21 | HEADERS += \ 22 | src/ui/crashreportdialog/crashreportdialog.h \ 23 | src/ui/demodialog.h 24 | 25 | FORMS += \ 26 | src/ui/crashreportdialog/crashreportdialog.ui \ 27 | src/ui/demodialog.ui 28 | 29 | # Default rules for deployment. 30 | qnx: target.path = /tmp/$${TARGET}/bin 31 | else: unix:!android: target.path = /opt/$${TARGET}/bin 32 | !isEmpty(target.path): INSTALLS += target 33 | -------------------------------------------------------------------------------- /12_5_qt_breakpad_demo/BreakpadDemo/src/ui/crashreportdialog/crashreportdialog.cpp: -------------------------------------------------------------------------------- 1 | #include "crashreportdialog.h" 2 | #include "ui_crashreportdialog.h" 3 | 4 | #include 5 | 6 | CrashReportDialog::CrashReportDialog(QWidget *parent) : 7 | QDialog(parent), 8 | ui(new Ui::CrashReportDialog) 9 | { 10 | ui->setupUi(this); 11 | //remove question mark 12 | Qt::WindowFlags flags= this->windowFlags(); 13 | setWindowFlags(flags&~Qt::WindowContextHelpButtonHint); 14 | 15 | } 16 | 17 | CrashReportDialog::~CrashReportDialog() 18 | { 19 | delete ui; 20 | } 21 | 22 | 23 | void CrashReportDialog::on_pushButtonOk_clicked() 24 | { 25 | this->accept(); 26 | } 27 | -------------------------------------------------------------------------------- /12_5_qt_breakpad_demo/BreakpadDemo/src/ui/crashreportdialog/crashreportdialog.h: -------------------------------------------------------------------------------- 1 | #ifndef CRASHREPORTDIALOG_H 2 | #define CRASHREPORTDIALOG_H 3 | 4 | #include 5 | 6 | namespace Ui { 7 | class CrashReportDialog; 8 | } 9 | 10 | class CrashReportDialog : public QDialog 11 | { 12 | Q_OBJECT 13 | 14 | public: 15 | explicit CrashReportDialog(QWidget *parent = nullptr); 16 | ~CrashReportDialog(); 17 | 18 | private slots: 19 | void on_pushButtonOk_clicked(); 20 | 21 | private: 22 | Ui::CrashReportDialog *ui; 23 | }; 24 | 25 | #endif // CRASHREPORTDIALOG_H 26 | -------------------------------------------------------------------------------- /12_5_qt_breakpad_demo/BreakpadDemo/src/ui/demodialog.cpp: -------------------------------------------------------------------------------- 1 | #include "demodialog.h" 2 | #include "ui_demodialog.h" 3 | 4 | DemoDialog::DemoDialog(QWidget *parent) 5 | : QDialog(parent) 6 | , ui(new Ui::DemoDialog) 7 | { 8 | ui->setupUi(this); 9 | } 10 | 11 | DemoDialog::~DemoDialog() 12 | { 13 | delete ui; 14 | } 15 | 16 | void crash() { volatile int* a = (int*)(NULL); *a = 1; } 17 | 18 | void DemoDialog::on_crashButton_clicked() 19 | { 20 | crash(); 21 | } 22 | 23 | 24 | -------------------------------------------------------------------------------- /12_5_qt_breakpad_demo/BreakpadDemo/src/ui/demodialog.h: -------------------------------------------------------------------------------- 1 | #ifndef DEMODIALOG_H 2 | #define DEMODIALOG_H 3 | 4 | #include 5 | 6 | QT_BEGIN_NAMESPACE 7 | namespace Ui { class DemoDialog; } 8 | QT_END_NAMESPACE 9 | 10 | class DemoDialog : public QDialog 11 | { 12 | Q_OBJECT 13 | 14 | public: 15 | DemoDialog(QWidget *parent = nullptr); 16 | ~DemoDialog(); 17 | 18 | 19 | private slots: 20 | void on_crashButton_clicked(); 21 | 22 | private: 23 | void MakeACrash(); 24 | 25 | 26 | private: 27 | Ui::DemoDialog *ui; 28 | }; 29 | #endif // DEMODIALOG_H 30 | -------------------------------------------------------------------------------- /12_5_qt_breakpad_demo/BreakpadDemo/src/ui/demodialog.ui: -------------------------------------------------------------------------------- 1 | 2 | 3 | DemoDialog 4 | 5 | 6 | 7 | 0 8 | 0 9 | 400 10 | 300 11 | 12 | 13 | 14 | DemoDialog 15 | 16 | 17 | 18 | 19 | 10 20 | 242 21 | 376 22 | 44 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 10 31 | 130 32 | 364 33 | 32 34 | 35 | 36 | 37 | Crash! 38 | 39 | 40 | 41 | 42 | 43 | 44 | -------------------------------------------------------------------------------- /12_5_qt_breakpad_demo/BreakpadDemo/third_libs/breakpad/breakpadsrc.pri: -------------------------------------------------------------------------------- 1 | message("Breakpad_src_been_attached") 2 | 3 | 4 | ## google-breakpad 5 | include($$PWD/thirdparty/breakpad.pri) 6 | 7 | 8 | INCLUDEPATH += $$PWD/src 9 | 10 | #CONFIG += debug_and_release 11 | #CONFIG += warn_on 12 | CONFIG += thread exceptions rtti stl 13 | 14 | SOURCES += \ 15 | $$PWD/src/BreakpadHandler.cpp \ 16 | $$PWD/src/BreakpadHttpUploader.cpp 17 | 18 | 19 | HEADERS += \ 20 | $$PWD/src/BreakpadHandler.h \ 21 | $$PWD/src/BreakpadHttpUploader.h 22 | 23 | 24 | CONFIG += warn_on 25 | CONFIG += thread exceptions rtti stl 26 | 27 | # for generate dpb files at windows 28 | win32-msvc* { 29 | QMAKE_LFLAGS_RELEASE += /MAP 30 | QMAKE_CFLAGS_RELEASE += /Zi 31 | QMAKE_LFLAGS_RELEASE += /debug /opt:ref 32 | } 33 | 34 | * { 35 | QMAKE_CFLAGS_RELEASE += -g 36 | QMAKE_CXXFLAGS_RELEASE += -g 37 | QMAKE_CFLAGS_RELEASE -= -O2 38 | QMAKE_CXXFLAGS_RELEASE -= -O2 39 | #QMAKE_LFLAGS_RELEASE = -mthreads -Wl 40 | } 41 | 42 | # without c++11 & AppKit library compiler can't solve address for symbols 43 | CONFIG += c++11 44 | macx: LIBS += -framework AppKit 45 | -------------------------------------------------------------------------------- /12_5_qt_breakpad_demo/README.md: -------------------------------------------------------------------------------- 1 | 源码中包含以下内容: 2 | - BreadpadDemo源码(在MacOS和Windows7下测试验证通过) 3 | - 用于MaxOS的“dump_syms”和“minidump_stackwalk”工具集合(包含脚本) 4 | - 用于Windows的“dump_syms”和“minidump_stackwalk”工具集合(包含脚本) 5 | - 用于在wiindows下编译“dump_syms”的msdia_dll 6 | - zip_of_this_folder 为本目录的完整源码,包含一份可正确编译的breakpad源码(避免因人家breakpad更新源码导致问题) -------------------------------------------------------------------------------- /12_5_qt_breakpad_demo/dump_tools_mac/928703D7-EA7B-4050-8DF5-667958A502F0.dmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/robert1207/UpperComputerProgramingGuideSrc/dd8afb9d94d21580f19863a21fa23378dafa96ee/12_5_qt_breakpad_demo/dump_tools_mac/928703D7-EA7B-4050-8DF5-667958A502F0.dmp -------------------------------------------------------------------------------- /12_5_qt_breakpad_demo/dump_tools_mac/BreakpadDemo: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/robert1207/UpperComputerProgramingGuideSrc/dd8afb9d94d21580f19863a21fa23378dafa96ee/12_5_qt_breakpad_demo/dump_tools_mac/BreakpadDemo -------------------------------------------------------------------------------- /12_5_qt_breakpad_demo/dump_tools_mac/dump_syms: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/robert1207/UpperComputerProgramingGuideSrc/dd8afb9d94d21580f19863a21fa23378dafa96ee/12_5_qt_breakpad_demo/dump_tools_mac/dump_syms -------------------------------------------------------------------------------- /12_5_qt_breakpad_demo/dump_tools_mac/dump_tool_usage.txt: -------------------------------------------------------------------------------- 1 | dump_tool_usage 2 | 3 | run command like below will be ok for getting result at stdout 4 | sh ./process_dump.sh LedStripEditor 462E9652-F7E0-4BFD-897E-87ABFC0C6193.dmp 5 | -------------------------------------------------------------------------------- /12_5_qt_breakpad_demo/dump_tools_mac/minidump_stackwalk: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/robert1207/UpperComputerProgramingGuideSrc/dd8afb9d94d21580f19863a21fa23378dafa96ee/12_5_qt_breakpad_demo/dump_tools_mac/minidump_stackwalk -------------------------------------------------------------------------------- /12_5_qt_breakpad_demo/dump_tools_win/BreakpadDemo.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/robert1207/UpperComputerProgramingGuideSrc/dd8afb9d94d21580f19863a21fa23378dafa96ee/12_5_qt_breakpad_demo/dump_tools_win/BreakpadDemo.exe -------------------------------------------------------------------------------- /12_5_qt_breakpad_demo/dump_tools_win/BreakpadDemo.pdb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/robert1207/UpperComputerProgramingGuideSrc/dd8afb9d94d21580f19863a21fa23378dafa96ee/12_5_qt_breakpad_demo/dump_tools_win/BreakpadDemo.pdb -------------------------------------------------------------------------------- /12_5_qt_breakpad_demo/dump_tools_win/dump_syms.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/robert1207/UpperComputerProgramingGuideSrc/dd8afb9d94d21580f19863a21fa23378dafa96ee/12_5_qt_breakpad_demo/dump_tools_win/dump_syms.exe -------------------------------------------------------------------------------- /12_5_qt_breakpad_demo/dump_tools_win/ee4962a8-0bf4-419a-8830-8230e26488cc.dmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/robert1207/UpperComputerProgramingGuideSrc/dd8afb9d94d21580f19863a21fa23378dafa96ee/12_5_qt_breakpad_demo/dump_tools_win/ee4962a8-0bf4-419a-8830-8230e26488cc.dmp -------------------------------------------------------------------------------- /12_5_qt_breakpad_demo/dump_tools_win/minidump_stackwalk.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/robert1207/UpperComputerProgramingGuideSrc/dd8afb9d94d21580f19863a21fa23378dafa96ee/12_5_qt_breakpad_demo/dump_tools_win/minidump_stackwalk.exe -------------------------------------------------------------------------------- /12_5_qt_breakpad_demo/dump_tools_win/usage.txt: -------------------------------------------------------------------------------- 1 | sh ./process_dump.sh BreakpadDemo.pdb ee4962a8-0bf4-419a-8830-8230e26488cc.dmp -------------------------------------------------------------------------------- /12_5_qt_breakpad_demo/msdia_dll_32_for_windows_compile_dump_syms/msdia100.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/robert1207/UpperComputerProgramingGuideSrc/dd8afb9d94d21580f19863a21fa23378dafa96ee/12_5_qt_breakpad_demo/msdia_dll_32_for_windows_compile_dump_syms/msdia100.dll -------------------------------------------------------------------------------- /12_5_qt_breakpad_demo/msdia_dll_32_for_windows_compile_dump_syms/msdia140.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/robert1207/UpperComputerProgramingGuideSrc/dd8afb9d94d21580f19863a21fa23378dafa96ee/12_5_qt_breakpad_demo/msdia_dll_32_for_windows_compile_dump_syms/msdia140.dll -------------------------------------------------------------------------------- /12_5_qt_breakpad_demo/msdia_dll_32_for_windows_compile_dump_syms/msdia80.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/robert1207/UpperComputerProgramingGuideSrc/dd8afb9d94d21580f19863a21fa23378dafa96ee/12_5_qt_breakpad_demo/msdia_dll_32_for_windows_compile_dump_syms/msdia80.dll -------------------------------------------------------------------------------- /12_5_qt_breakpad_demo/zip_of_this_folder/12_5_qt_breakpad_demo.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/robert1207/UpperComputerProgramingGuideSrc/dd8afb9d94d21580f19863a21fa23378dafa96ee/12_5_qt_breakpad_demo/zip_of_this_folder/12_5_qt_breakpad_demo.zip -------------------------------------------------------------------------------- /13_3_stm32_iap_downloader_tool/src/core/core.h: -------------------------------------------------------------------------------- 1 | #ifndef CORE_H 2 | #define CORE_H 3 | 4 | #include 5 | 6 | #include 7 | #include 8 | #include "../uart/myserialport.h" 9 | #include "../protocol/protocolmanager.h" 10 | #include "hexfilereader.h" 11 | 12 | class Core : public QThread 13 | { 14 | Q_OBJECT 15 | public: 16 | Core(); 17 | ~Core() override; 18 | 19 | void SetHexFileAbsPath(QString file_path); 20 | QString GetHexFileAbsPath(); 21 | 22 | void SetBaudRate(qint32 baudRate) { 23 | baudRate_ = baudRate; 24 | } 25 | void SetPortName(QString port_name); 26 | void StartWorkingThread(); 27 | 28 | signals: 29 | void onDownloadProgress(bool is_finish, bool is_successed, int percent, QString note); 30 | 31 | private slots: 32 | void OnProtocolError(int error_type, QString error_string); 33 | void OnDispatchPackage(quint8 *pkg, int len); 34 | void OnCommInitCallback(); 35 | 36 | private: 37 | void run() override; 38 | 39 | 40 | private: 41 | QString hex_file_abs_path_; 42 | // QSerialPortInfo serial_device_info_; 43 | 44 | ProtocolManager* protocol_manager_p; 45 | HexFileReader hex_reader_; 46 | 47 | qint32 baudRate_; 48 | 49 | QString port_name_; 50 | 51 | 52 | }; 53 | 54 | #endif // CORE_H 55 | -------------------------------------------------------------------------------- /13_3_stm32_iap_downloader_tool/src/core/hexfilereader.cpp: -------------------------------------------------------------------------------- 1 | #include "hexfilereader.h" 2 | 3 | HexFileReader::HexFileReader() 4 | { 5 | 6 | } 7 | 8 | HexFileReader::~HexFileReader() 9 | { 10 | 11 | } 12 | 13 | bool HexFileReader::Open(QString file_path) { 14 | return binary_file_.Open(file_path); 15 | } 16 | 17 | void HexFileReader::Close() { 18 | binary_file_.Close(); 19 | } 20 | 21 | quint16 HexFileReader::GetTotalPieceCount() { 22 | 23 | qint64 size = binary_file_.Size(); 24 | quint16 page_count = static_cast(size / piece_array_len); 25 | 26 | if((size % piece_array_len) > 0) { 27 | page_count += 1; 28 | } 29 | return page_count; 30 | } 31 | 32 | quint16 HexFileReader::GetPieceDataSize() { 33 | return piece_array_len; 34 | } 35 | 36 | char* HexFileReader::GetOnePieceDataAtIndex(quint32 page_index) { 37 | 38 | qint64 seek_pos = page_index * piece_array_len; 39 | binary_file_.Seek(seek_pos); 40 | 41 | memset(piece_array, 0, piece_array_len); 42 | binary_file_.Read(piece_array, piece_array_len); 43 | return piece_array; 44 | } 45 | 46 | char* HexFileReader::GetNextPieceData() { 47 | 48 | memset(piece_array, 0, piece_array_len); 49 | binary_file_.Read(piece_array, piece_array_len); 50 | return piece_array; 51 | } 52 | 53 | 54 | -------------------------------------------------------------------------------- /13_3_stm32_iap_downloader_tool/src/core/hexfilereader.h: -------------------------------------------------------------------------------- 1 | #ifndef HEXFILEREADER_H 2 | #define HEXFILEREADER_H 3 | 4 | #include 5 | 6 | #include "../file/binaryfile.h" 7 | 8 | class HexFileReader : public QObject 9 | { 10 | Q_OBJECT 11 | public: 12 | HexFileReader(); 13 | ~HexFileReader(); 14 | 15 | bool Open(QString file_path); 16 | void Close(); 17 | 18 | quint16 GetTotalPieceCount(); 19 | quint16 GetPieceDataSize(); 20 | char* GetOnePieceDataAtIndex(quint32 page_index); 21 | char* GetNextPieceData(); 22 | 23 | private: 24 | const static quint16 piece_array_len = 128; 25 | char piece_array[piece_array_len]; 26 | 27 | 28 | BinaryFile binary_file_; 29 | 30 | }; 31 | 32 | #endif // HEXFILEREADER_H 33 | -------------------------------------------------------------------------------- /13_3_stm32_iap_downloader_tool/src/file/binaryfile.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * @Name led_strip_editor 3 | * @Author Robert Zhang 4 | * @E-mail zhangzhiguo1207@163.com 5 | * @Date 2019-09-11 6 | */ 7 | 8 | #include "binaryfile.h" 9 | 10 | 11 | 12 | BinaryFile::BinaryFile() 13 | { 14 | 15 | } 16 | 17 | BinaryFile::~BinaryFile() 18 | { 19 | 20 | } 21 | 22 | bool BinaryFile::Open(QString full_path) { 23 | file_.setFileName(full_path); 24 | bool res = file_.open(QIODevice::ReadWrite); 25 | 26 | out_.setDevice(&file_); 27 | return res; 28 | } 29 | 30 | void BinaryFile::Close() { 31 | file_.flush(); 32 | file_.close(); 33 | } 34 | 35 | bool BinaryFile::IsOpen() { 36 | return file_.isOpen(); 37 | } 38 | 39 | int BinaryFile::Write(QByteArray &data) { 40 | return out_.writeRawData(data.data(), data.length()); 41 | } 42 | 43 | int BinaryFile::Write(const char *data, int len) { 44 | return out_.writeRawData(data, len); 45 | } 46 | 47 | int BinaryFile::Read(char *data, int len) { 48 | return out_.readRawData(data, len); 49 | } 50 | 51 | qint64 BinaryFile::Size() { 52 | return file_.size(); 53 | } 54 | 55 | bool BinaryFile::Seek(qint64 pos) { 56 | return file_.seek(pos); 57 | } 58 | 59 | void BinaryFile::Flush() { 60 | file_.flush(); 61 | } 62 | 63 | 64 | -------------------------------------------------------------------------------- /13_3_stm32_iap_downloader_tool/src/file/binaryfile.h: -------------------------------------------------------------------------------- 1 | /* 2 | * @Name led_strip_editor 3 | * @Author Robert Zhang 4 | * @E-mail zhangzhiguo1207@163.com 5 | * @Date 2019-09-11 6 | */ 7 | 8 | #ifndef BINARYFILE_H 9 | #define BINARYFILE_H 10 | 11 | #include 12 | #include 13 | #include 14 | #include 15 | 16 | 17 | class BinaryFile 18 | { 19 | public: 20 | BinaryFile(); 21 | ~BinaryFile(); 22 | 23 | bool Open(QString full_path); 24 | void Close(); 25 | bool IsOpen(); 26 | int Write(QByteArray &data); 27 | int Write(const char *data, int len); 28 | int Read(char *data, int len); 29 | qint64 Size(); 30 | bool Seek(qint64 pos); 31 | void Flush(); 32 | 33 | private: 34 | QFile file_; 35 | QDataStream out_; 36 | 37 | }; 38 | 39 | 40 | #endif // BINARYFILE_H 41 | -------------------------------------------------------------------------------- /13_3_stm32_iap_downloader_tool/src/file/directoryutil.h: -------------------------------------------------------------------------------- 1 | /* 2 | * @Name core 3 | * @Author Robert Zhang 4 | * @E-mail zhangzhiguo1207@163.com 5 | * @Date 2019-08-03 6 | */ 7 | 8 | #ifndef DIRECTORYUTIL_H 9 | #define DIRECTORYUTIL_H 10 | 11 | #include 12 | 13 | 14 | 15 | class DirectoryUtil 16 | { 17 | private: 18 | DirectoryUtil(); 19 | 20 | public: 21 | 22 | static bool IsDirExist(QString fullPath); 23 | static bool IsFileExist(QString fullFilePath); 24 | static bool CreatePath(QString dir); 25 | static bool RemoveFolderContent(const QString &folderDir); 26 | 27 | 28 | }; 29 | 30 | 31 | 32 | #endif // DIRECTORYUTIL_H 33 | -------------------------------------------------------------------------------- /13_3_stm32_iap_downloader_tool/src/finding_serial_device/findingserialdevice.h: -------------------------------------------------------------------------------- 1 | #ifndef FINDINGSERIALDEVICE_H 2 | #define FINDINGSERIALDEVICE_H 3 | 4 | #include 5 | #include 6 | #include "../uart/myserialport.h" 7 | 8 | 9 | class FindingSerialDevice : public QObject 10 | { 11 | Q_OBJECT 12 | public: 13 | FindingSerialDevice(); 14 | ~FindingSerialDevice() override; 15 | 16 | void SetBaudRate(qint32 baudRate) { 17 | baudRate_ = baudRate; 18 | } 19 | bool isBusyingOnFinding() { return is_busy_;} 20 | void StartFind(); 21 | void StopFind();//解除对串口设备资源的占用 22 | 23 | signals: 24 | void OnFoundDevice(QString found_device_port_name); 25 | 26 | 27 | private: 28 | void onRecv(QByteArray &data, void *extra_data); 29 | 30 | 31 | private: 32 | QList serial_device_list_; 33 | qint32 baudRate_; 34 | bool is_busy_; 35 | }; 36 | 37 | #endif // FINDINGSERIALDEVICE_H 38 | -------------------------------------------------------------------------------- /13_3_stm32_iap_downloader_tool/src/main.cpp: -------------------------------------------------------------------------------- 1 | #include "ui/iapdownloadertooldialog.h" 2 | 3 | #include 4 | #include 5 | 6 | int main(int argc, char *argv[]) 7 | { 8 | #if (QT_VERSION >= QT_VERSION_CHECK(5, 6, 0)) 9 | QCoreApplication::setAttribute(Qt::AA_EnableHighDpiScaling); 10 | #endif 11 | 12 | QApplication a(argc, argv); 13 | 14 | //translate for this application 15 | QTranslator* translator_zh_p; 16 | translator_zh_p = new QTranslator(); 17 | translator_zh_p->load(":/tr/tr/app_zh_CN.qm"); 18 | qApp->installTranslator(translator_zh_p); 19 | 20 | IapDownloaderToolDialog w; 21 | w.show(); 22 | 23 | 24 | //theme 25 | QFile qssFile; 26 | qssFile.setFileName(":/qss/qss/theme.qss"); 27 | 28 | QString qss = ""; 29 | qssFile.open(QFile::ReadOnly); 30 | if(qssFile.isOpen()) 31 | { 32 | // qss = QLatin1String(qssFile.readAll()); 33 | qss = QByteArray(qssFile.readAll()); 34 | // qDebug() << "qss = " << qss; 35 | qApp->setStyleSheet(qss); 36 | qssFile.close(); 37 | } 38 | 39 | return a.exec(); 40 | } 41 | -------------------------------------------------------------------------------- /13_3_stm32_iap_downloader_tool/src/protocol/comm_interface.cpp: -------------------------------------------------------------------------------- 1 |  2 | 3 | #include "comm_interface.h" 4 | 5 | CommInterface::CommInterface() 6 | { 7 | 8 | } 9 | 10 | CommInterface::~CommInterface() 11 | { 12 | 13 | } 14 | 15 | 16 | 17 | 18 | -------------------------------------------------------------------------------- /13_3_stm32_iap_downloader_tool/src/protocol/comm_interface.h: -------------------------------------------------------------------------------- 1 | #ifndef PROTOCOL_COMM_INTERFACE_H 2 | #define PROTOCOL_COMM_INTERFACE_H 3 | 4 | #include 5 | #include 6 | #include 7 | 8 | 9 | class CommInterface : public QObject 10 | { 11 | Q_OBJECT 12 | public: 13 | CommInterface(); 14 | virtual ~CommInterface(); 15 | 16 | virtual qint64 Send(const QByteArray &data) = 0; 17 | virtual bool Open() = 0; 18 | virtual void Close() = 0; 19 | virtual bool IsOpen() = 0; 20 | 21 | signals: 22 | void onRecv(QByteArray &data, void *extra_data); 23 | 24 | }; 25 | 26 | 27 | 28 | #endif // PROTOCOL_COMM_INTERFACE_H 29 | -------------------------------------------------------------------------------- /13_3_stm32_iap_downloader_tool/src/protocol/crc.cpp: -------------------------------------------------------------------------------- 1 |  2 | 3 | #include "crc.h" 4 | 5 | 6 | Crc::Crc() 7 | { 8 | 9 | } 10 | 11 | Crc::~Crc() 12 | { 13 | 14 | } 15 | 16 | void Crc::GetCRC(quint8 *data, int len, quint16 &crc) { 17 | quint16 i,j,carry_flag, temp; 18 | 19 | crc = 0xffff; 20 | 21 | for (i = 0; i < len; i++) { 22 | crc = crc ^ data[i]; 23 | for (j = 0; j < 8; j ++) { 24 | temp = crc; 25 | carry_flag = temp & 0x0001; 26 | crc = crc >> 1; 27 | 28 | if (carry_flag == 1) { 29 | crc = crc ^ 0xa001; 30 | } 31 | } 32 | } 33 | } 34 | 35 | 36 | bool Crc::CheckCRC(quint8 *data, int len) { 37 | if (len < 2) return false; 38 | 39 | /* 40 | printf("------------CheckCRC-----------------\n"); 41 | for(int a = 0; a < len; a ++) { 42 | printf("%d dst 333 hex=%02x \n", a, data[a]); 43 | }*/ 44 | 45 | quint16 crcLow = data[len - 1]; 46 | quint16 crcHigh = data[len - 2]; 47 | quint16 crc_received = static_cast(crcHigh << 8 | crcLow); 48 | quint16 crc_new; 49 | 50 | GetCRC(data, len - 2, crc_new); 51 | 52 | if (crc_new == crc_received) { 53 | return true; 54 | } 55 | 56 | return false; 57 | } 58 | -------------------------------------------------------------------------------- /13_3_stm32_iap_downloader_tool/src/protocol/crc.h: -------------------------------------------------------------------------------- 1 |  2 | 3 | #ifndef CRC_H 4 | #define CRC_H 5 | 6 | 7 | #include "qglobal.h" 8 | 9 | 10 | class Crc 11 | { 12 | private: 13 | Crc(); 14 | ~Crc(); 15 | public: 16 | static void GetCRC(quint8 *data, int len, quint16 &crc); 17 | static bool CheckCRC(quint8 *data, int len); 18 | }; 19 | 20 | #endif // CRC_H 21 | -------------------------------------------------------------------------------- /13_3_stm32_iap_downloader_tool/src/protocol/work.cpp: -------------------------------------------------------------------------------- 1 |  2 | 3 | #include "work.h" 4 | 5 | #include "../utils/byteutil.h" 6 | 7 | 8 | Work::Work() 9 | { 10 | failed_times = 0; 11 | } 12 | 13 | bool Work::CheckResponse(quint8 *return_pkg) { 14 | 15 | quint8 src_pkg_bit_1 = ByteUtil::Char2Byte(data.at(2));//command type 16 | quint8 src_pkg_bit_2 = ByteUtil::Char2Byte(data.at(3));//command code 17 | 18 | if (return_pkg[0] == src_pkg_bit_1 && return_pkg[1] == src_pkg_bit_2) { 19 | return true; 20 | } else { 21 | return false; 22 | } 23 | } 24 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /13_3_stm32_iap_downloader_tool/src/protocol/work.h: -------------------------------------------------------------------------------- 1 |  2 | #ifndef WORK_H 3 | #define WORK_H 4 | 5 | #include 6 | 7 | class Work 8 | { 9 | public: 10 | Work(); 11 | 12 | int failed_times; 13 | QByteArray data; 14 | 15 | bool CheckResponse(quint8 * return_pkg); 16 | 17 | }; 18 | 19 | #endif // WORK_H 20 | -------------------------------------------------------------------------------- /13_3_stm32_iap_downloader_tool/src/protocol/workmanager.h: -------------------------------------------------------------------------------- 1 |  2 | #ifndef WORKMANAGER_H 3 | #define WORKMANAGER_H 4 | 5 | #include 6 | #include "work.h" 7 | 8 | 9 | class WorkManager 10 | { 11 | public: 12 | WorkManager(); 13 | ~WorkManager(); 14 | 15 | void AddWork(QByteArray &pkg); 16 | void InsertWorkAtHead(QByteArray &pkg); 17 | void CleanWorkList(); 18 | void FinishAWork(); 19 | Work* GetCurrentWork(); 20 | bool IsHasWork(); 21 | int GetWorkCount(); 22 | 23 | 24 | private: 25 | QList work_list_; 26 | 27 | }; 28 | 29 | #endif // WORKMANAGER_H 30 | -------------------------------------------------------------------------------- /13_3_stm32_iap_downloader_tool/src/res/qss/theme.qss: -------------------------------------------------------------------------------- 1 | /******************************* QPushButton *****************************/ 2 | QPushButton[cancel_btn="true"] { 3 | color:rgb(33,33,33); 4 | background-color:rgb(200,200,200); 5 | border-width:0px; 6 | border-radius:5px; 7 | padding:3px; 8 | margin: 0px 5px 0px 5px; 9 | } 10 | 11 | QPushButton[cancel_btn="true"]:pressed { 12 | background-color: rgb(180,180,180); 13 | border-style:inset; 14 | padding-left:4px; 15 | padding-top:4px; 16 | } 17 | 18 | QPushButton[ok_btn="true"] { 19 | color:rgb(255,255,255); 20 | background-color: #3686fe; 21 | border-width:0px; 22 | border-radius:5px; 23 | border-style:outset; 24 | padding:3px; 25 | margin: 0px 5px 0px 5px; 26 | } 27 | 28 | QPushButton[ok_btn="true"]:pressed { 29 | background-color:#176ef2; 30 | border-style:inset; 31 | padding-left:4px; 32 | padding-top:4px; 33 | } 34 | -------------------------------------------------------------------------------- /13_3_stm32_iap_downloader_tool/src/res/res.qrc: -------------------------------------------------------------------------------- 1 | 2 | 3 | tr/app_zh_CN.qm 4 | 5 | 6 | qss/theme.qss 7 | 8 | 9 | -------------------------------------------------------------------------------- /13_3_stm32_iap_downloader_tool/src/res/tr/app_zh_CN.qm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/robert1207/UpperComputerProgramingGuideSrc/dd8afb9d94d21580f19863a21fa23378dafa96ee/13_3_stm32_iap_downloader_tool/src/res/tr/app_zh_CN.qm -------------------------------------------------------------------------------- /13_3_stm32_iap_downloader_tool/src/ui/iapdownloadertooldialog.h: -------------------------------------------------------------------------------- 1 | #ifndef IAPDOWNLOADERTOOLDIALOG_H 2 | #define IAPDOWNLOADERTOOLDIALOG_H 3 | 4 | #include 5 | #include "../core/core.h" 6 | #include "../uart/myserialport.h" 7 | #include "../finding_serial_device/findingserialdevice.h" 8 | 9 | QT_BEGIN_NAMESPACE 10 | namespace Ui { class IapDownloaderToolDialog; } 11 | QT_END_NAMESPACE 12 | 13 | class IapDownloaderToolDialog : public QDialog 14 | { 15 | Q_OBJECT 16 | 17 | public: 18 | IapDownloaderToolDialog(QWidget *parent = nullptr); 19 | ~IapDownloaderToolDialog(); 20 | 21 | private slots: 22 | void on_pushButtonChoseFile_clicked(); 23 | 24 | void on_pushButtonDownload_clicked(); 25 | 26 | private: 27 | void OnFoundDevice(QString found_device_port_name); 28 | void OnDownloadProgress(bool is_finish, bool is_successed, int percent, QString note); 29 | 30 | private: 31 | void SetUiDisable(bool disable); 32 | 33 | private: 34 | Ui::IapDownloaderToolDialog *ui; 35 | 36 | Core core_; 37 | FindingSerialDevice finding_serial_device_; 38 | 39 | 40 | }; 41 | #endif // IAPDOWNLOADERTOOLDIALOG_H 42 | -------------------------------------------------------------------------------- /13_3_stm32_iap_downloader_tool/src/utils/byteutil.cpp: -------------------------------------------------------------------------------- 1 | #include "byteutil.h" 2 | 3 | ByteUtil::ByteUtil() 4 | { 5 | 6 | } 7 | 8 | char ByteUtil::Byte2Char(const byte byte) { 9 | char ret = 0x00; 10 | ret = ret | byte; 11 | return ret; 12 | } 13 | 14 | byte ByteUtil::Char2Byte(const char ch) { 15 | byte by = 0x00; 16 | by = static_cast(by | ch); 17 | return by; 18 | } 19 | 20 | //only last 8bit of int is saved 21 | char ByteUtil::Int2Char(const int value) { 22 | return Byte2Char(static_cast(value)); 23 | } 24 | 25 | int ByteUtil::Char2Int(const char ch) { 26 | byte t = Char2Byte(ch); 27 | return static_cast(t); 28 | } 29 | 30 | 31 | void ByteUtil::ByteArray2CharArray(const byte * src, char *dst, int len) { 32 | for (int a = 0; a < len; a++) { 33 | dst[a] = Byte2Char(src[a]); 34 | } 35 | } 36 | 37 | void ByteUtil::CharArray2ByteArray(const char * src, byte *dst, int len) { 38 | for (int a = 0; a < len; a++) { 39 | dst[a] = Char2Byte(src[a]); 40 | } 41 | } 42 | 43 | -------------------------------------------------------------------------------- /13_3_stm32_iap_downloader_tool/src/utils/byteutil.h: -------------------------------------------------------------------------------- 1 |  2 | 3 | #ifndef BYTEUTIL_H 4 | #define BYTEUTIL_H 5 | 6 | typedef unsigned char byte; 7 | 8 | 9 | class ByteUtil 10 | { 11 | private: 12 | ByteUtil(); 13 | 14 | public: 15 | static char Byte2Char(const byte byte); 16 | static byte Char2Byte(const char ch); 17 | 18 | static char Int2Char(const int value);//only last 8bit of int is saved 19 | static int Char2Int(const char ch); 20 | 21 | static void ByteArray2CharArray(const byte * src, char *dst, int len); 22 | static void CharArray2ByteArray(const char * src, byte *dst, int len); 23 | }; 24 | 25 | #endif // BYTEUTIL_H 26 | -------------------------------------------------------------------------------- /13_3_stm32_iap_downloader_tool/src/utils/stringutil.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * @Name kcp_tool 3 | * @Author Robert Zhang 4 | * @E-mail zhangzhiguo1207@163.com 5 | * @Date 2019-08-02 6 | */ 7 | 8 | #include "stringutil.h" 9 | 10 | StringUtil::StringUtil() 11 | { 12 | 13 | } 14 | 15 | 16 | -------------------------------------------------------------------------------- /13_5_stm32_iap_bootloader/IAP_BL_STM32L072KBUx/.settings/com.atollic.truestudio.debug.hardware_device.prefs: -------------------------------------------------------------------------------- 1 | BOARD=None 2 | CODE_LOCATION=FLASH 3 | ENDIAN=Little-endian 4 | MCU=STM32L072KB 5 | MCU_VENDOR=STMicroelectronics 6 | MODEL=Lite 7 | PROBE=ST-LINK 8 | PROJECT_FORMAT_VERSION=2 9 | TARGET=ARM\u00AE 10 | VERSION=4.1.0 11 | eclipse.preferences.version=1 12 | -------------------------------------------------------------------------------- /13_5_stm32_iap_bootloader/IAP_BL_STM32L072KBUx/App/app.c: -------------------------------------------------------------------------------- 1 | #include "app.h" 2 | -------------------------------------------------------------------------------- /13_5_stm32_iap_bootloader/IAP_BL_STM32L072KBUx/App/app.h: -------------------------------------------------------------------------------- 1 | #ifndef APP_H_ 2 | #define APP_H_ 3 | 4 | #include "core/core.h" 5 | #include "protocol/protocol.h" 6 | #include "program/program.h" 7 | 8 | #endif //APP_H_ 9 | -------------------------------------------------------------------------------- /13_5_stm32_iap_bootloader/IAP_BL_STM32L072KBUx/App/core/core.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/robert1207/UpperComputerProgramingGuideSrc/dd8afb9d94d21580f19863a21fa23378dafa96ee/13_5_stm32_iap_bootloader/IAP_BL_STM32L072KBUx/App/core/core.c -------------------------------------------------------------------------------- /13_5_stm32_iap_bootloader/IAP_BL_STM32L072KBUx/App/core/core.h: -------------------------------------------------------------------------------- 1 | #ifndef APP_CORE_H_ 2 | #define APP_CORE_H_ 3 | 4 | #include "includes.h" 5 | 6 | 7 | extern void APP_ProcessMetaPkg(uint8_t *buf, uint16_t len); 8 | 9 | 10 | 11 | #endif //APP_CORE_H_ 12 | -------------------------------------------------------------------------------- /13_5_stm32_iap_bootloader/IAP_BL_STM32L072KBUx/App/program/program.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/robert1207/UpperComputerProgramingGuideSrc/dd8afb9d94d21580f19863a21fa23378dafa96ee/13_5_stm32_iap_bootloader/IAP_BL_STM32L072KBUx/App/program/program.c -------------------------------------------------------------------------------- /13_5_stm32_iap_bootloader/IAP_BL_STM32L072KBUx/App/program/program.h: -------------------------------------------------------------------------------- 1 | #ifndef APP_PROGRAM_H_ 2 | #define APP_PROGRAM_H_ 3 | 4 | #include "includes.h" 5 | 6 | 7 | 8 | 9 | extern void APP_RunApp(void); 10 | 11 | extern void APP_SetAppFlag(); 12 | extern bool APP_IsHadAppFlag(void); 13 | extern void APP_ClearAppFlag(); 14 | 15 | extern void APP_ProgramOnePageIntoFlash(uint8_t* pageBuf, uint16_t pageLen); 16 | extern void APP_EraseAppUsingPages(); 17 | extern uint32_t APP_CheckAppSum(uint16_t page_count); 18 | 19 | #endif //APP_PROGRAM_H_ 20 | -------------------------------------------------------------------------------- /13_5_stm32_iap_bootloader/IAP_BL_STM32L072KBUx/App/protocol/command.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/robert1207/UpperComputerProgramingGuideSrc/dd8afb9d94d21580f19863a21fa23378dafa96ee/13_5_stm32_iap_bootloader/IAP_BL_STM32L072KBUx/App/protocol/command.c -------------------------------------------------------------------------------- /13_5_stm32_iap_bootloader/IAP_BL_STM32L072KBUx/App/protocol/command.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/robert1207/UpperComputerProgramingGuideSrc/dd8afb9d94d21580f19863a21fa23378dafa96ee/13_5_stm32_iap_bootloader/IAP_BL_STM32L072KBUx/App/protocol/command.h -------------------------------------------------------------------------------- /13_5_stm32_iap_bootloader/IAP_BL_STM32L072KBUx/App/protocol/crc.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/robert1207/UpperComputerProgramingGuideSrc/dd8afb9d94d21580f19863a21fa23378dafa96ee/13_5_stm32_iap_bootloader/IAP_BL_STM32L072KBUx/App/protocol/crc.c -------------------------------------------------------------------------------- /13_5_stm32_iap_bootloader/IAP_BL_STM32L072KBUx/App/protocol/crc.h: -------------------------------------------------------------------------------- 1 | #ifndef APP_CRC_H_ 2 | #define APP_CRC_H_ 3 | 4 | #include "includes.h" 5 | 6 | extern void GetCRC(uint8_t *data, int16_t len, uint16_t *crc); 7 | extern bool CheckCRC(uint8_t *data, int16_t len); 8 | 9 | #endif //APP_CRC_H_ 10 | -------------------------------------------------------------------------------- /13_5_stm32_iap_bootloader/IAP_BL_STM32L072KBUx/App/protocol/protocol.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/robert1207/UpperComputerProgramingGuideSrc/dd8afb9d94d21580f19863a21fa23378dafa96ee/13_5_stm32_iap_bootloader/IAP_BL_STM32L072KBUx/App/protocol/protocol.c -------------------------------------------------------------------------------- /13_5_stm32_iap_bootloader/IAP_BL_STM32L072KBUx/App/protocol/protocol.h: -------------------------------------------------------------------------------- 1 | #ifndef APP_PROTOCOL_H_ 2 | #define APP_PROTOCOL_H_ 3 | 4 | #include "includes.h" 5 | 6 | 7 | 8 | 9 | extern void APP_UartProcess(uint8_t uart_data); 10 | extern void APP_ProcessProtocolReceivedPkgAtMain(void); 11 | 12 | 13 | #endif //APP_PROTOCOL_H_ 14 | 15 | -------------------------------------------------------------------------------- /13_5_stm32_iap_bootloader/IAP_BL_STM32L072KBUx/Bsp/bsp.c: -------------------------------------------------------------------------------- 1 | #include "bsp.h" 2 | 3 | TIM_HandleTypeDef htim7; 4 | 5 | UART_HandleTypeDef huart1; 6 | 7 | void BSP_Init() { 8 | SystemClock_Config(); 9 | BSP_IoInit(); 10 | 11 | BSP_TimeCounterInit(); 12 | BSP_Uart1Init(); 13 | BSP_UartRecvReset(); 14 | } 15 | 16 | void Error_Handler(void) 17 | { 18 | 19 | } 20 | -------------------------------------------------------------------------------- /13_5_stm32_iap_bootloader/IAP_BL_STM32L072KBUx/Bsp/bsp.h: -------------------------------------------------------------------------------- 1 | #ifndef BSP_H_ 2 | #define BSP_H_ 3 | 4 | 5 | #include "io_and_clock/io_and_clock.h" 6 | #include "./irq_callback/irq_callback.h" 7 | #include "./uart/uart.h" 8 | #include "./flash/flash.h" 9 | #include "./timer/timer.h" 10 | 11 | extern void BSP_Init(); 12 | extern void Error_Handler(void); 13 | 14 | #endif //BSP_H_ 15 | -------------------------------------------------------------------------------- /13_5_stm32_iap_bootloader/IAP_BL_STM32L072KBUx/Bsp/flash/flash.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/robert1207/UpperComputerProgramingGuideSrc/dd8afb9d94d21580f19863a21fa23378dafa96ee/13_5_stm32_iap_bootloader/IAP_BL_STM32L072KBUx/Bsp/flash/flash.c -------------------------------------------------------------------------------- /13_5_stm32_iap_bootloader/IAP_BL_STM32L072KBUx/Bsp/flash/flash.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/robert1207/UpperComputerProgramingGuideSrc/dd8afb9d94d21580f19863a21fa23378dafa96ee/13_5_stm32_iap_bootloader/IAP_BL_STM32L072KBUx/Bsp/flash/flash.h -------------------------------------------------------------------------------- /13_5_stm32_iap_bootloader/IAP_BL_STM32L072KBUx/Bsp/io_and_clock/io_and_clock.h: -------------------------------------------------------------------------------- 1 | #ifndef BSP_IO_AND_CLOCK_H_ 2 | #define BSP_IO_AND_CLOCK_H_ 3 | 4 | #include "includes.h" 5 | 6 | extern void SystemClock_Config(void); 7 | extern void BSP_IoInit(); 8 | 9 | #endif //BSP_IO_AND_CLOCK_H_ 10 | -------------------------------------------------------------------------------- /13_5_stm32_iap_bootloader/IAP_BL_STM32L072KBUx/Bsp/irq_callback/irq_callback.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/robert1207/UpperComputerProgramingGuideSrc/dd8afb9d94d21580f19863a21fa23378dafa96ee/13_5_stm32_iap_bootloader/IAP_BL_STM32L072KBUx/Bsp/irq_callback/irq_callback.c -------------------------------------------------------------------------------- /13_5_stm32_iap_bootloader/IAP_BL_STM32L072KBUx/Bsp/irq_callback/irq_callback.h: -------------------------------------------------------------------------------- 1 | #ifndef BSP_IRQ_CALLBACK_H_ 2 | #define BSP_IRQ_CALLBACK_H_ 3 | 4 | #include "includes.h" 5 | 6 | extern TIM_HandleTypeDef htim7; 7 | extern UART_HandleTypeDef huart1; 8 | 9 | extern void BSP_EnableIrq(); 10 | extern void BSP_DisableIrq(); 11 | 12 | 13 | #endif //BSP_IRQ_CALLBACK_H_ 14 | -------------------------------------------------------------------------------- /13_5_stm32_iap_bootloader/IAP_BL_STM32L072KBUx/Bsp/timer/timer.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/robert1207/UpperComputerProgramingGuideSrc/dd8afb9d94d21580f19863a21fa23378dafa96ee/13_5_stm32_iap_bootloader/IAP_BL_STM32L072KBUx/Bsp/timer/timer.c -------------------------------------------------------------------------------- /13_5_stm32_iap_bootloader/IAP_BL_STM32L072KBUx/Bsp/timer/timer.h: -------------------------------------------------------------------------------- 1 | #ifndef BSP_TIMER_H_ 2 | #define BSP_TIMER_H_ 3 | 4 | 5 | #include "includes.h" 6 | 7 | extern TIM_HandleTypeDef htim7; 8 | typedef void (*TimeUpCallback)(); 9 | 10 | extern void BSP_TimeCounterInit(); 11 | extern void BSP_SetTimeUpCallback(TimeUpCallback cb); 12 | extern void BSP_500msIRQ(); 13 | extern void BSP_TimeCounterStart(uint32_t period_ms); 14 | extern void BSP_TimeCounterStop(); 15 | 16 | 17 | 18 | #endif //BSP_TIMER_H_ 19 | -------------------------------------------------------------------------------- /13_5_stm32_iap_bootloader/IAP_BL_STM32L072KBUx/Bsp/uart/uart.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/robert1207/UpperComputerProgramingGuideSrc/dd8afb9d94d21580f19863a21fa23378dafa96ee/13_5_stm32_iap_bootloader/IAP_BL_STM32L072KBUx/Bsp/uart/uart.c -------------------------------------------------------------------------------- /13_5_stm32_iap_bootloader/IAP_BL_STM32L072KBUx/Bsp/uart/uart.h: -------------------------------------------------------------------------------- 1 | #ifndef BSP_UART_H_ 2 | #define BSP_UART_H_ 3 | 4 | #include "includes.h" 5 | 6 | extern UART_HandleTypeDef huart1; 7 | 8 | #define RX_BUF_LEN 1 9 | extern uint8_t RxBuf[1]; 10 | extern bool is_set_uart_irq_recv_failed; 11 | extern bool is_first_time_set_up_uart_it; 12 | 13 | 14 | #define GPIO_PORT_485_CTRL USART1_CTRL_GPIO_Port 15 | #define GPIO_PIN_485_CTRL USART1_CTRL_Pin 16 | 17 | extern int __io_putchar(int ch); 18 | 19 | extern void BSP_Uart1Init(); 20 | extern void BSP_UartRecvReset(); 21 | extern void BSP_Uart1SendData(uint8_t *data, uint16_t len); 22 | extern void BSP_ProcessUartRecvError(void); 23 | 24 | 25 | #endif //BSP_UART_H_ 26 | -------------------------------------------------------------------------------- /13_5_stm32_iap_bootloader/IAP_BL_STM32L072KBUx/Inc/datatype.h: -------------------------------------------------------------------------------- 1 | #ifndef _DATATYPE_H 2 | #define _DATATYPE_H 3 | 4 | 5 | 6 | typedef enum bool_t { false = 0, true = 1} bool; 7 | 8 | /* 9 | typedef unsigned char BOOL; 10 | 11 | #ifndef TRUE 12 | #define TRUE 1 13 | #endif 14 | 15 | #ifndef FALSE 16 | #define FALSE 0 17 | #endif 18 | 19 | #ifndef NULL 20 | #define NULL ((void *)0) 21 | #endif 22 | 23 | */ 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | #endif 33 | -------------------------------------------------------------------------------- /13_5_stm32_iap_bootloader/IAP_BL_STM32L072KBUx/Inc/includes.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/robert1207/UpperComputerProgramingGuideSrc/dd8afb9d94d21580f19863a21fa23378dafa96ee/13_5_stm32_iap_bootloader/IAP_BL_STM32L072KBUx/Inc/includes.h -------------------------------------------------------------------------------- /13_5_stm32_iap_bootloader/IAP_BL_STM32L072KBUx/Src/main.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/robert1207/UpperComputerProgramingGuideSrc/dd8afb9d94d21580f19863a21fa23378dafa96ee/13_5_stm32_iap_bootloader/IAP_BL_STM32L072KBUx/Src/main.c -------------------------------------------------------------------------------- /2_2_qt_serial_port_gui_tool/2_2_qt_serial_port_gui_tool.pro: -------------------------------------------------------------------------------- 1 | QT += core gui serialport 2 | 3 | greaterThan(QT_MAJOR_VERSION, 4): QT += widgets 4 | 5 | CONFIG += c++11 6 | 7 | # The following define makes your compiler emit warnings if you use 8 | # any Qt feature that has been marked deprecated (the exact warnings 9 | # depend on your compiler). Please consult the documentation of the 10 | # deprecated API in order to know how to port your code away from it. 11 | DEFINES += QT_DEPRECATED_WARNINGS 12 | 13 | # You can also make your code fail to compile if it uses deprecated APIs. 14 | # In order to do so, uncomment the following line. 15 | # You can also select to disable deprecated APIs only up to a certain version of Qt. 16 | #DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000 # disables all the APIs deprecated before Qt 6.0.0 17 | 18 | SOURCES += \ 19 | main.cpp \ 20 | myserialport.cpp \ 21 | serialdialog.cpp \ 22 | stringutil.cpp 23 | 24 | HEADERS += \ 25 | myserialport.h \ 26 | serialdialog.h \ 27 | stringutil.h 28 | 29 | FORMS += \ 30 | serialdialog.ui 31 | 32 | # Default rules for deployment. 33 | qnx: target.path = /tmp/$${TARGET}/bin 34 | else: unix:!android: target.path = /opt/$${TARGET}/bin 35 | !isEmpty(target.path): INSTALLS += target 36 | -------------------------------------------------------------------------------- /2_2_qt_serial_port_gui_tool/main.cpp: -------------------------------------------------------------------------------- 1 | #include "serialdialog.h" 2 | 3 | #include 4 | 5 | int main(int argc, char *argv[]) 6 | { 7 | 8 | #if (QT_VERSION >= QT_VERSION_CHECK(5, 6, 0)) 9 | QCoreApplication::setAttribute(Qt::AA_EnableHighDpiScaling); 10 | #endif 11 | 12 | 13 | QApplication a(argc, argv); 14 | SerialDialog w; 15 | w.show(); 16 | return a.exec(); 17 | } 18 | -------------------------------------------------------------------------------- /2_2_qt_serial_port_gui_tool/serialdialog.h: -------------------------------------------------------------------------------- 1 | #ifndef SERIALDIALOG_H 2 | #define SERIALDIALOG_H 3 | 4 | #include 5 | #include "myserialport.h" 6 | 7 | QT_BEGIN_NAMESPACE 8 | namespace Ui { class SerialDialog; } 9 | QT_END_NAMESPACE 10 | 11 | 12 | 13 | class SerialDialog : public QDialog 14 | { 15 | Q_OBJECT 16 | 17 | public: 18 | SerialDialog(QWidget *parent = nullptr); 19 | ~SerialDialog(); 20 | 21 | 22 | private slots: 23 | void on_pushButtonSerialOpen_clicked(); 24 | 25 | void on_pushButtonSerialSend_clicked(); 26 | 27 | void ReceivedData(const QByteArray &data); 28 | 29 | private: 30 | void InitUi(); 31 | void SetSerialSettings(); 32 | 33 | void DisableEditingUi(); 34 | void EnableEditingUi(); 35 | 36 | private: 37 | Ui::SerialDialog *ui; 38 | QList port_info_list_; 39 | 40 | MySerialPort *my_serial_port_p; 41 | }; 42 | #endif // SERIALDIALOG_H 43 | -------------------------------------------------------------------------------- /2_2_qt_serial_port_gui_tool/stringutil.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * @Name kcp_tool 3 | * @Author Robert Zhang 4 | * @E-mail zhangzhiguo1207@163.com 5 | * @Date 2019-08-02 6 | */ 7 | 8 | #include "stringutil.h" 9 | 10 | StringUtil::StringUtil() 11 | { 12 | 13 | } 14 | 15 | 16 | -------------------------------------------------------------------------------- /2_2_winform_serial_port_gui_tool/.vs/winform_serial_port_gui_tool/v16/.suo: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/robert1207/UpperComputerProgramingGuideSrc/dd8afb9d94d21580f19863a21fa23378dafa96ee/2_2_winform_serial_port_gui_tool/.vs/winform_serial_port_gui_tool/v16/.suo -------------------------------------------------------------------------------- /2_2_winform_serial_port_gui_tool/winform_serial_port_gui_tool.sln: -------------------------------------------------------------------------------- 1 |  2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio 15 4 | VisualStudioVersion = 15.0.28307.168 5 | MinimumVisualStudioVersion = 10.0.40219.1 6 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "winform_serial_port_gui_tool", "winform_serial_port_gui_tool\winform_serial_port_gui_tool.csproj", "{D5195719-2654-4DF8-845F-41E81B529E3B}" 7 | EndProject 8 | Global 9 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 10 | Debug|Any CPU = Debug|Any CPU 11 | Release|Any CPU = Release|Any CPU 12 | EndGlobalSection 13 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 14 | {D5195719-2654-4DF8-845F-41E81B529E3B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 15 | {D5195719-2654-4DF8-845F-41E81B529E3B}.Debug|Any CPU.Build.0 = Debug|Any CPU 16 | {D5195719-2654-4DF8-845F-41E81B529E3B}.Release|Any CPU.ActiveCfg = Release|Any CPU 17 | {D5195719-2654-4DF8-845F-41E81B529E3B}.Release|Any CPU.Build.0 = Release|Any CPU 18 | EndGlobalSection 19 | GlobalSection(SolutionProperties) = preSolution 20 | HideSolutionNode = FALSE 21 | EndGlobalSection 22 | GlobalSection(ExtensibilityGlobals) = postSolution 23 | SolutionGuid = {85339055-D53E-4FAF-9777-CC15C544A2C0} 24 | EndGlobalSection 25 | EndGlobal 26 | -------------------------------------------------------------------------------- /2_2_winform_serial_port_gui_tool/winform_serial_port_gui_tool/App.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /2_2_winform_serial_port_gui_tool/winform_serial_port_gui_tool/Program.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Threading.Tasks; 5 | using System.Windows.Forms; 6 | 7 | namespace winform_serial_port_gui_tool 8 | { 9 | static class Program 10 | { 11 | /// 12 | /// 应用程序的主入口点。 13 | /// 14 | [STAThread] 15 | static void Main() 16 | { 17 | Application.EnableVisualStyles(); 18 | Application.SetCompatibleTextRenderingDefault(false); 19 | Application.Run(new Form1()); 20 | } 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /2_2_winform_serial_port_gui_tool/winform_serial_port_gui_tool/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.CompilerServices; 3 | using System.Runtime.InteropServices; 4 | 5 | // 有关程序集的一般信息由以下 6 | // 控制。更改这些特性值可修改 7 | // 与程序集关联的信息。 8 | [assembly: AssemblyTitle("winform_serial_port_gui_tool")] 9 | [assembly: AssemblyDescription("")] 10 | [assembly: AssemblyConfiguration("")] 11 | [assembly: AssemblyCompany("")] 12 | [assembly: AssemblyProduct("winform_serial_port_gui_tool")] 13 | [assembly: AssemblyCopyright("Copyright © 2020")] 14 | [assembly: AssemblyTrademark("")] 15 | [assembly: AssemblyCulture("")] 16 | 17 | // 将 ComVisible 设置为 false 会使此程序集中的类型 18 | //对 COM 组件不可见。如果需要从 COM 访问此程序集中的类型 19 | //请将此类型的 ComVisible 特性设置为 true。 20 | [assembly: ComVisible(false)] 21 | 22 | // 如果此项目向 COM 公开,则下列 GUID 用于类型库的 ID 23 | [assembly: Guid("d5195719-2654-4df8-845f-41e81b529e3b")] 24 | 25 | // 程序集的版本信息由下列四个值组成: 26 | // 27 | // 主版本 28 | // 次版本 29 | // 生成号 30 | // 修订号 31 | // 32 | // 可以指定所有值,也可以使用以下所示的 "*" 预置版本号和修订号 33 | // 方法是按如下所示使用“*”: : 34 | // [assembly: AssemblyVersion("1.0.*")] 35 | [assembly: AssemblyVersion("1.0.0.0")] 36 | [assembly: AssemblyFileVersion("1.0.0.0")] 37 | -------------------------------------------------------------------------------- /2_2_winform_serial_port_gui_tool/winform_serial_port_gui_tool/Properties/Settings.Designer.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------------ 2 | // 3 | // This code was generated by a tool. 4 | // Runtime Version:4.0.30319.42000 5 | // 6 | // Changes to this file may cause incorrect behavior and will be lost if 7 | // the code is regenerated. 8 | // 9 | //------------------------------------------------------------------------------ 10 | 11 | namespace winform_serial_port_gui_tool.Properties 12 | { 13 | 14 | 15 | [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] 16 | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "11.0.0.0")] 17 | internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase 18 | { 19 | 20 | private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings()))); 21 | 22 | public static Settings Default 23 | { 24 | get 25 | { 26 | return defaultInstance; 27 | } 28 | } 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /2_2_winform_serial_port_gui_tool/winform_serial_port_gui_tool/Properties/Settings.settings: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /2_4_qt_net_tcp_udp_gui_tool/src/main.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * @Name kcp_tool 3 | * @Author Robert Zhang 4 | * @E-mail zhangzhiguo1207@163.com 5 | * @Date 2019-08-02 6 | */ 7 | 8 | #include "ui/netdialog.h" 9 | #include 10 | 11 | #include "my_log.h" 12 | 13 | int main(int argc, char *argv[]) 14 | { 15 | QApplication a(argc, argv); 16 | 17 | MyLogIns.installer_logger(new MyLogNS::ConsoleLogger()); 18 | MyLogIns.is_show_function_name = false; 19 | 20 | D << "log test"; 21 | 22 | KcpDialog w; 23 | w.show(); 24 | 25 | return a.exec(); 26 | } 27 | -------------------------------------------------------------------------------- /2_4_qt_net_tcp_udp_gui_tool/src/net/comm.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * @Name kcp_tool 3 | * @Author Robert Zhang 4 | * @E-mail zhangzhiguo1207@163.com 5 | * @Date 2019-08-02 6 | */ 7 | 8 | #include "comm.h" 9 | 10 | 11 | 12 | 13 | namespace HYKT { 14 | 15 | const QList Comm::net_type_str_list_ = { 16 | "UDP broadcase", "UDP client", "UDP server", "TCP client", "TCP server"}; 17 | 18 | Comm::Comm() 19 | { 20 | 21 | } 22 | 23 | Comm::~Comm() 24 | { 25 | 26 | } 27 | 28 | QList Comm::GetNetTypeStrList() { 29 | return net_type_str_list_; 30 | } 31 | 32 | } //namespace HYKT 33 | 34 | -------------------------------------------------------------------------------- /2_4_qt_net_tcp_udp_gui_tool/src/net/netmanager.h: -------------------------------------------------------------------------------- 1 | /* 2 | * @Name kcp_tool 3 | * @Author Robert Zhang 4 | * @E-mail zhangzhiguo1207@163.com 5 | * @Date 2019-08-02 6 | */ 7 | 8 | 9 | #ifndef NETMANAGER_H 10 | #define NETMANAGER_H 11 | 12 | 13 | #include "comm.h" 14 | #include "udpcomm.h" 15 | #include "tcpcomm.h" 16 | 17 | #include 18 | #include 19 | #include 20 | #include 21 | 22 | #include "singleinstance.h" 23 | 24 | namespace HYKT { 25 | class NetManager : public QObject 26 | { 27 | Q_OBJECT 28 | public: 29 | NetManager(); 30 | ~NetManager(); 31 | 32 | static inline NetManager* GetInstance() { 33 | return &Singleton::instance(); 34 | } 35 | 36 | static QList GetNetTypeStrList(); 37 | 38 | int Open(int net_type, QString des_ip, quint16 des_port); 39 | void Close(); 40 | int Send(char *data, int len); 41 | bool IsOpen(); 42 | 43 | signals: 44 | void onRecv(QByteArray *data, const QString ip, const quint16 port); 45 | void onError(int error_code, QString extra_error_info); 46 | 47 | private: 48 | void ConnectSignals(); 49 | void DisconnectSignals(); 50 | 51 | private: 52 | Comm *comm_p; 53 | 54 | }; 55 | } //namespace HYKT 56 | 57 | #endif // NETMANAGER_H 58 | -------------------------------------------------------------------------------- /2_4_qt_net_tcp_udp_gui_tool/src/net/udpcomm.h: -------------------------------------------------------------------------------- 1 | /* 2 | * @Name net 3 | * @Author Robert Zhang 4 | * @E-mail zhangzhiguo1207@163.com 5 | * @Date 2019-08-05 6 | */ 7 | 8 | 9 | #ifndef UDPCOMM_H 10 | #define UDPCOMM_H 11 | 12 | #include "comm.h" 13 | 14 | #include 15 | #include 16 | #include 17 | #include 18 | #include 19 | 20 | namespace HYKT { 21 | 22 | class UdpComm : public Comm 23 | { 24 | Q_OBJECT 25 | public: 26 | UdpComm(); 27 | ~UdpComm() override; 28 | 29 | virtual int Open(int net_type, QString des_ip, quint16 des_port) override; 30 | virtual void Close() override; 31 | virtual int Send(const char *data, int len) override; 32 | virtual int Send(const QByteArray &data) override; 33 | virtual bool IsOpen() override; 34 | 35 | private: 36 | virtual void DoRecv() override; 37 | virtual void DoError(QAbstractSocket::SocketError se) override; 38 | void DoOnDisconnected(); 39 | 40 | private: 41 | QUdpSocket *udp_p; 42 | int net_type_; 43 | 44 | QString des_ip_; 45 | quint16 des_port_; 46 | 47 | QString received_client_ip_; 48 | quint16 received_client_port_; 49 | 50 | }; 51 | 52 | } //namespace HYKT 53 | 54 | 55 | 56 | #endif // UDPCOMM_H 57 | -------------------------------------------------------------------------------- /2_4_qt_net_tcp_udp_gui_tool/src/thirdparty/readme.txt: -------------------------------------------------------------------------------- 1 | clone mylog-lib at here with command below; 2 | git clone https://github.com/robert1207/MyLog -------------------------------------------------------------------------------- /2_4_qt_net_tcp_udp_gui_tool/src/thirdparty/singleinstance/config.pri: -------------------------------------------------------------------------------- 1 | #Config 2 | #CONFIG += static 3 | CONFIG += release 4 | macx { 5 | CONFIG += c++11 6 | } 7 | win32 { 8 | CONFIG += c++11 9 | } 10 | CONFIG += warn_on thread exceptions rtti stl 11 | 12 | #output 13 | OBJECTS_DIR = _build/obj 14 | MOC_DIR = _build 15 | #move the lib file in to project folder 16 | macx { 17 | DESTDIR = $$PWD 18 | } 19 | win32 { 20 | DESTDIR = $$PWD 21 | } 22 | 23 | # test config 24 | LIST = thread exceptions rtti stl 25 | for(f, LIST) { 26 | !CONFIG($$f) { 27 | warning("Add '$$f' to CONFIG, or you will meet some problems.") 28 | } 29 | } 30 | 31 | -------------------------------------------------------------------------------- /2_4_qt_net_tcp_udp_gui_tool/src/thirdparty/singleinstance/singleinstance.pro: -------------------------------------------------------------------------------- 1 | #------------------------------------------------- 2 | # 3 | # Project created by QtCreator 2019-07-08T11:06:49 4 | # 5 | #------------------------------------------------- 6 | include($$PWD/config.pri) 7 | QT += core 8 | 9 | TARGET = singleinstance 10 | TEMPLATE = lib 11 | #VERSION = 1.0.0 12 | 13 | DEFINES += SINGLEINSTANCE_LIBRARY 14 | 15 | SOURCES += \ 16 | 17 | 18 | 19 | HEADERS += \ 20 | 21 | unix { 22 | target.path = /usr/lib 23 | INSTALLS += target 24 | } 25 | 26 | 27 | 28 | -------------------------------------------------------------------------------- /2_4_qt_net_tcp_udp_gui_tool/src/thirdparty/singleinstance/singleinstancelib.pri: -------------------------------------------------------------------------------- 1 | 2 | 3 | message("singleinstance_lib_been_attached") 4 | 5 | CONFIG += thread exceptions rtti stl 6 | 7 | INCLUDEPATH += $$PWD/src/ 8 | 9 | HEADERS += \ 10 | $$PWD/src/singleinstance.h 11 | 12 | 13 | LIBS += \ 14 | -L$$PWD -lsingleinstance 15 | 16 | 17 | -------------------------------------------------------------------------------- /2_4_qt_net_tcp_udp_gui_tool/src/thirdparty/singleinstance/singleinstancesrc.pri: -------------------------------------------------------------------------------- 1 | 2 | message("singleinstance_src_attached") 3 | 4 | CONFIG += thread exceptions rtti stl 5 | 6 | INCLUDEPATH += $$PWD/src/ 7 | 8 | 9 | SOURCES += \ 10 | $$PWD/src/singleinstance.cpp 11 | 12 | 13 | 14 | HEADERS += \ 15 | $$PWD/src/singleinstance.h \ 16 | $$PWD/src/singletone/singleton.h \ 17 | $$PWD/src/singletone/call_once.h 18 | 19 | 20 | -------------------------------------------------------------------------------- /2_4_qt_net_tcp_udp_gui_tool/src/thirdparty/singleinstance/src/singleinstance.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * @Name led_strip_editor 3 | * @Author Robert Zhang 4 | * @E-mail zhangzhiguo1207@163.com 5 | * @Date 2019-12-14 6 | */ 7 | #include "singleinstance.h" 8 | 9 | namespace HYKT { 10 | 11 | SingleInstance::SingleInstance() 12 | { 13 | 14 | } 15 | 16 | } //namespace HYKT { 17 | 18 | -------------------------------------------------------------------------------- /2_4_qt_net_tcp_udp_gui_tool/src/thirdparty/singleinstance/src/singleinstance.h: -------------------------------------------------------------------------------- 1 | /* 2 | * @Name led_strip_editor 3 | * @Author Robert Zhang 4 | * @E-mail zhangzhiguo1207@163.com 5 | * @Date 2019-12-14 6 | */ 7 | #ifndef SINGLEINSTANCE_H 8 | #define SINGLEINSTANCE_H 9 | 10 | #include "./singletone/singleton.h" 11 | 12 | namespace HYKT { 13 | 14 | class SingleInstance 15 | { 16 | public: 17 | SingleInstance(); 18 | }; 19 | 20 | } //namespace HYKT { 21 | 22 | #endif // SINGLEINSTANCE_H 23 | -------------------------------------------------------------------------------- /2_4_qt_net_tcp_udp_gui_tool/src/utils/hexutils.h: -------------------------------------------------------------------------------- 1 | #ifndef HEXUTILS_H 2 | #define HEXUTILS_H 3 | 4 | #include 5 | #include 6 | 7 | class HexUtils 8 | { 9 | private: 10 | HexUtils(); 11 | static char convertCharToHex(char ch); 12 | 13 | 14 | public: 15 | static void HexStringToByteArray(const QString &str, QByteArray &byteData); 16 | static QString ByteArrayToHexString(QByteArray data); 17 | 18 | 19 | }; 20 | 21 | #endif // HEXUTILS_H 22 | -------------------------------------------------------------------------------- /2_4_qt_net_tcp_udp_gui_tool/src/views/toast/toast.h: -------------------------------------------------------------------------------- 1 | #ifndef TOAST_H 2 | #define TOAST_H 3 | 4 | #include 5 | #include "ui_toast.h" 6 | 7 | class Toast : public QWidget 8 | { 9 | Q_OBJECT 10 | 11 | public: 12 | Toast(QWidget *parent = Q_NULLPTR); 13 | ~Toast(); 14 | 15 | void setText(const QString& text); 16 | 17 | void showAnimation(int timeout = 2000); 18 | 19 | public: 20 | static void showTip(const QString& text, QWidget* parent = nullptr); 21 | 22 | protected: 23 | virtual void paintEvent(QPaintEvent *event); 24 | 25 | private: 26 | Ui::ToastClass ui; 27 | }; 28 | 29 | #endif // TOAST_H 30 | -------------------------------------------------------------------------------- /2_4_winform_net_tcp_udp_gui_tool/NetTcpUdpTool.sln: -------------------------------------------------------------------------------- 1 |  2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio Version 16 4 | VisualStudioVersion = 16.0.29025.244 5 | MinimumVisualStudioVersion = 10.0.40219.1 6 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "NetTcpUdpTool", "NetTcpUdpTool\NetTcpUdpTool.csproj", "{64614CF3-1225-404B-8ECA-334FB34CE6B2}" 7 | EndProject 8 | Global 9 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 10 | Debug|Any CPU = Debug|Any CPU 11 | Release|Any CPU = Release|Any CPU 12 | EndGlobalSection 13 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 14 | {64614CF3-1225-404B-8ECA-334FB34CE6B2}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 15 | {64614CF3-1225-404B-8ECA-334FB34CE6B2}.Debug|Any CPU.Build.0 = Debug|Any CPU 16 | {64614CF3-1225-404B-8ECA-334FB34CE6B2}.Release|Any CPU.ActiveCfg = Release|Any CPU 17 | {64614CF3-1225-404B-8ECA-334FB34CE6B2}.Release|Any CPU.Build.0 = Release|Any CPU 18 | EndGlobalSection 19 | GlobalSection(SolutionProperties) = preSolution 20 | HideSolutionNode = FALSE 21 | EndGlobalSection 22 | GlobalSection(ExtensibilityGlobals) = postSolution 23 | SolutionGuid = {C3E6358A-74EE-47E3-9BDC-BA32D2F81FBF} 24 | EndGlobalSection 25 | EndGlobal 26 | -------------------------------------------------------------------------------- /2_4_winform_net_tcp_udp_gui_tool/NetTcpUdpTool/App.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /2_4_winform_net_tcp_udp_gui_tool/NetTcpUdpTool/Program.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Threading.Tasks; 5 | using System.Windows.Forms; 6 | 7 | namespace NetTcpUdpTool 8 | { 9 | static class Program 10 | { 11 | /// 12 | /// 应用程序的主入口点。 13 | /// 14 | [STAThread] 15 | static void Main() 16 | { 17 | Application.EnableVisualStyles(); 18 | Application.SetCompatibleTextRenderingDefault(false); 19 | Application.Run(new Form1()); 20 | 21 | System.Environment.Exit(0); 22 | } 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /2_4_winform_net_tcp_udp_gui_tool/NetTcpUdpTool/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.CompilerServices; 3 | using System.Runtime.InteropServices; 4 | 5 | // 有关程序集的一般信息由以下 6 | // 控制。更改这些特性值可修改 7 | // 与程序集关联的信息。 8 | [assembly: AssemblyTitle("NetTcpUdpTool")] 9 | [assembly: AssemblyDescription("")] 10 | [assembly: AssemblyConfiguration("")] 11 | [assembly: AssemblyCompany("")] 12 | [assembly: AssemblyProduct("NetTcpUdpTool")] 13 | [assembly: AssemblyCopyright("Copyright © 2020")] 14 | [assembly: AssemblyTrademark("")] 15 | [assembly: AssemblyCulture("")] 16 | 17 | // 将 ComVisible 设置为 false 会使此程序集中的类型 18 | //对 COM 组件不可见。如果需要从 COM 访问此程序集中的类型 19 | //请将此类型的 ComVisible 特性设置为 true。 20 | [assembly: ComVisible(false)] 21 | 22 | // 如果此项目向 COM 公开,则下列 GUID 用于类型库的 ID 23 | [assembly: Guid("64614cf3-1225-404b-8eca-334fb34ce6b2")] 24 | 25 | // 程序集的版本信息由下列四个值组成: 26 | // 27 | // 主版本 28 | // 次版本 29 | // 生成号 30 | // 修订号 31 | // 32 | //可以指定所有这些值,也可以使用“生成号”和“修订号”的默认值 33 | //通过使用 "*",如下所示: 34 | // [assembly: AssemblyVersion("1.0.*")] 35 | [assembly: AssemblyVersion("1.0.0.0")] 36 | [assembly: AssemblyFileVersion("1.0.0.0")] 37 | -------------------------------------------------------------------------------- /2_4_winform_net_tcp_udp_gui_tool/NetTcpUdpTool/Properties/Settings.Designer.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------------ 2 | // 3 | // This code was generated by a tool. 4 | // Runtime Version:4.0.30319.42000 5 | // 6 | // Changes to this file may cause incorrect behavior and will be lost if 7 | // the code is regenerated. 8 | // 9 | //------------------------------------------------------------------------------ 10 | 11 | namespace NetTcpUdpTool.Properties 12 | { 13 | 14 | 15 | [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] 16 | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "11.0.0.0")] 17 | internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase 18 | { 19 | 20 | private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings()))); 21 | 22 | public static Settings Default 23 | { 24 | get 25 | { 26 | return defaultInstance; 27 | } 28 | } 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /2_4_winform_net_tcp_udp_gui_tool/NetTcpUdpTool/Properties/Settings.settings: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /2_4_winform_net_tcp_udp_gui_tool/NetTcpUdpTool/obj/Debug/DesignTimeResolveAssemblyReferences.cache: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/robert1207/UpperComputerProgramingGuideSrc/dd8afb9d94d21580f19863a21fa23378dafa96ee/2_4_winform_net_tcp_udp_gui_tool/NetTcpUdpTool/obj/Debug/DesignTimeResolveAssemblyReferences.cache -------------------------------------------------------------------------------- /2_4_winform_net_tcp_udp_gui_tool/NetTcpUdpTool/obj/Debug/DesignTimeResolveAssemblyReferencesInput.cache: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/robert1207/UpperComputerProgramingGuideSrc/dd8afb9d94d21580f19863a21fa23378dafa96ee/2_4_winform_net_tcp_udp_gui_tool/NetTcpUdpTool/obj/Debug/DesignTimeResolveAssemblyReferencesInput.cache -------------------------------------------------------------------------------- /2_4_winform_net_tcp_udp_gui_tool/NetTcpUdpTool/obj/Debug/NetTcpUdpTool.Form1.resources: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/robert1207/UpperComputerProgramingGuideSrc/dd8afb9d94d21580f19863a21fa23378dafa96ee/2_4_winform_net_tcp_udp_gui_tool/NetTcpUdpTool/obj/Debug/NetTcpUdpTool.Form1.resources -------------------------------------------------------------------------------- /2_4_winform_net_tcp_udp_gui_tool/NetTcpUdpTool/obj/Debug/NetTcpUdpTool.Properties.Resources.resources: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/robert1207/UpperComputerProgramingGuideSrc/dd8afb9d94d21580f19863a21fa23378dafa96ee/2_4_winform_net_tcp_udp_gui_tool/NetTcpUdpTool/obj/Debug/NetTcpUdpTool.Properties.Resources.resources -------------------------------------------------------------------------------- /2_4_winform_net_tcp_udp_gui_tool/NetTcpUdpTool/obj/Debug/NetTcpUdpTool.csproj.CoreCompileInputs.cache: -------------------------------------------------------------------------------- 1 | 9bf5fbb163261b7cfcd09b5b978fece9ed0d5450 2 | -------------------------------------------------------------------------------- /2_4_winform_net_tcp_udp_gui_tool/NetTcpUdpTool/obj/Debug/NetTcpUdpTool.csproj.FileListAbsolute.txt: -------------------------------------------------------------------------------- 1 | C:\Users\robert\source\repos\NetTcpUdpTool\NetTcpUdpTool\bin\Debug\NetTcpUdpTool.exe.config 2 | C:\Users\robert\source\repos\NetTcpUdpTool\NetTcpUdpTool\bin\Debug\NetTcpUdpTool.exe 3 | C:\Users\robert\source\repos\NetTcpUdpTool\NetTcpUdpTool\bin\Debug\NetTcpUdpTool.pdb 4 | C:\Users\robert\source\repos\NetTcpUdpTool\NetTcpUdpTool\obj\Debug\NetTcpUdpTool.csprojAssemblyReference.cache 5 | C:\Users\robert\source\repos\NetTcpUdpTool\NetTcpUdpTool\obj\Debug\NetTcpUdpTool.Properties.Resources.resources 6 | C:\Users\robert\source\repos\NetTcpUdpTool\NetTcpUdpTool\obj\Debug\NetTcpUdpTool.csproj.GenerateResource.cache 7 | C:\Users\robert\source\repos\NetTcpUdpTool\NetTcpUdpTool\obj\Debug\NetTcpUdpTool.csproj.CoreCompileInputs.cache 8 | C:\Users\robert\source\repos\NetTcpUdpTool\NetTcpUdpTool\obj\Debug\NetTcpUdpTool.exe 9 | C:\Users\robert\source\repos\NetTcpUdpTool\NetTcpUdpTool\obj\Debug\NetTcpUdpTool.pdb 10 | C:\Users\robert\source\repos\NetTcpUdpTool\NetTcpUdpTool\obj\Debug\NetTcpUdpTool.Form1.resources 11 | -------------------------------------------------------------------------------- /2_4_winform_net_tcp_udp_gui_tool/NetTcpUdpTool/obj/Debug/NetTcpUdpTool.csproj.GenerateResource.cache: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/robert1207/UpperComputerProgramingGuideSrc/dd8afb9d94d21580f19863a21fa23378dafa96ee/2_4_winform_net_tcp_udp_gui_tool/NetTcpUdpTool/obj/Debug/NetTcpUdpTool.csproj.GenerateResource.cache -------------------------------------------------------------------------------- /2_4_winform_net_tcp_udp_gui_tool/NetTcpUdpTool/obj/Debug/NetTcpUdpTool.csprojAssemblyReference.cache: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/robert1207/UpperComputerProgramingGuideSrc/dd8afb9d94d21580f19863a21fa23378dafa96ee/2_4_winform_net_tcp_udp_gui_tool/NetTcpUdpTool/obj/Debug/NetTcpUdpTool.csprojAssemblyReference.cache -------------------------------------------------------------------------------- /2_4_winform_net_tcp_udp_gui_tool/NetTcpUdpTool/obj/Debug/NetTcpUdpTool.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/robert1207/UpperComputerProgramingGuideSrc/dd8afb9d94d21580f19863a21fa23378dafa96ee/2_4_winform_net_tcp_udp_gui_tool/NetTcpUdpTool/obj/Debug/NetTcpUdpTool.exe -------------------------------------------------------------------------------- /2_4_winform_net_tcp_udp_gui_tool/NetTcpUdpTool/obj/Debug/NetTcpUdpTool.pdb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/robert1207/UpperComputerProgramingGuideSrc/dd8afb9d94d21580f19863a21fa23378dafa96ee/2_4_winform_net_tcp_udp_gui_tool/NetTcpUdpTool/obj/Debug/NetTcpUdpTool.pdb -------------------------------------------------------------------------------- /2_9_qt_net_finding_device/.gitignore: -------------------------------------------------------------------------------- 1 | # This file is used to ignore files which are generated 2 | # ---------------------------------------------------------------------------- 3 | 4 | *~ 5 | *.autosave 6 | *.a 7 | *.core 8 | *.moc 9 | *.o 10 | *.obj 11 | *.orig 12 | *.rej 13 | *.so 14 | *.so.* 15 | *_pch.h.cpp 16 | *_resource.rc 17 | *.qm 18 | .#* 19 | *.*# 20 | core 21 | !core/ 22 | tags 23 | .DS_Store 24 | .directory 25 | *.debug 26 | Makefile* 27 | *.prl 28 | *.app 29 | moc_*.cpp 30 | ui_*.h 31 | qrc_*.cpp 32 | Thumbs.db 33 | *.res 34 | *.rc 35 | /.qmake.cache 36 | /.qmake.stash 37 | 38 | # qtcreator generated files 39 | *.pro.user* 40 | 41 | # xemacs temporary files 42 | *.flc 43 | 44 | # Vim temporary files 45 | .*.swp 46 | 47 | # Visual Studio generated files 48 | *.ib_pdb_index 49 | *.idb 50 | *.ilk 51 | *.pdb 52 | *.sln 53 | *.suo 54 | *.vcproj 55 | *vcproj.*.*.user 56 | *.ncb 57 | *.sdf 58 | *.opensdf 59 | *.vcxproj 60 | *vcxproj.* 61 | 62 | # MinGW generated files 63 | *.Debug 64 | *.Release 65 | 66 | # Python byte code 67 | *.pyc 68 | 69 | # Binaries 70 | # -------- 71 | *.dll 72 | *.exe 73 | 74 | -------------------------------------------------------------------------------- /2_9_qt_net_finding_device/command/command.h: -------------------------------------------------------------------------------- 1 | 2 | 3 | #ifndef COMMAND_H 4 | #define COMMAND_H 5 | 6 | #include "crc.h" 7 | 8 | #include 9 | #include "../utils/byteutil.h" 10 | 11 | namespace HYKT { 12 | 13 | const static quint8 head[] = {0xee}; 14 | const static quint8 tail[] = {0xbb}; 15 | 16 | 17 | class Command 18 | { 19 | private: 20 | Command(); 21 | ~Command(); 22 | 23 | public: 24 | 25 | static QByteArray* Pack(QByteArray &data); 26 | 27 | 28 | inline static QByteArray* SearchDevice() { 29 | QByteArray data; 30 | data.append(0x01); 31 | return Pack(data); 32 | } 33 | 34 | //put other command all at here at this class 35 | 36 | }; 37 | 38 | } //namespace HYKT 39 | 40 | #endif // COMMAND_H 41 | -------------------------------------------------------------------------------- /2_9_qt_net_finding_device/command/crc.h: -------------------------------------------------------------------------------- 1 | 2 | #ifndef CRC_H 3 | #define CRC_H 4 | 5 | 6 | #include "qglobal.h" 7 | 8 | namespace HYKT { 9 | 10 | class Crc 11 | { 12 | private: 13 | Crc(); 14 | ~Crc(); 15 | public: 16 | static void GetCRC(quint8 *data, int len, quint16 &crc); 17 | static bool CheckCRC(quint8 *data, int len); 18 | }; 19 | 20 | } //namespace HYKT 21 | 22 | #endif // CRC_H 23 | -------------------------------------------------------------------------------- /2_9_qt_net_finding_device/device_finding/crc.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * @Name protocol 3 | * @Author Robert Zhang 4 | * @E-mail zhangzhiguo1207@163.com 5 | * @Date 2019-08-06 6 | */ 7 | 8 | #include "crc.h" 9 | 10 | namespace HYKT { 11 | 12 | Crc::Crc() 13 | { 14 | 15 | } 16 | 17 | Crc::~Crc() 18 | { 19 | 20 | } 21 | 22 | void Crc::GetCRC(quint8 *data, int len, quint16 &crc) { 23 | quint16 i,j,carry_flag, temp; 24 | 25 | crc = 0xffff; 26 | 27 | for (i = 0; i < len; i++) { 28 | crc = crc ^ data[i]; 29 | for (j = 0; j < 8; j ++) { 30 | temp = crc; 31 | carry_flag = temp & 0x0001; 32 | crc = crc >> 1; 33 | 34 | if (carry_flag == 1) { 35 | crc = crc ^ 0xa001; 36 | } 37 | } 38 | } 39 | } 40 | 41 | 42 | bool Crc::CheckCRC(quint8 *data, int len) { 43 | if (len < 2) return false; 44 | 45 | quint16 crcLow = data[len - 1]; 46 | quint16 crcHigh = data[len - 2]; 47 | quint16 crc_received = static_cast(crcHigh << 8 | crcLow); 48 | quint16 crc_new; 49 | 50 | GetCRC(data, len - 2, crc_new); 51 | 52 | if (crc_new == crc_received) { 53 | return true; 54 | } 55 | 56 | return false; 57 | } 58 | 59 | } //namespace HYKT 60 | -------------------------------------------------------------------------------- /2_9_qt_net_finding_device/device_finding/crc.h: -------------------------------------------------------------------------------- 1 | /* 2 | * @Name protocol 3 | * @Author Robert Zhang 4 | * @E-mail zhangzhiguo1207@163.com 5 | * @Date 2019-08-06 6 | */ 7 | 8 | #ifndef CRC_H 9 | #define CRC_H 10 | 11 | 12 | #include "qglobal.h" 13 | 14 | namespace HYKT { 15 | 16 | class Crc 17 | { 18 | private: 19 | Crc(); 20 | ~Crc(); 21 | public: 22 | static void GetCRC(quint8 *data, int len, quint16 &crc); 23 | static bool CheckCRC(quint8 *data, int len); 24 | }; 25 | 26 | } //namespace HYKT 27 | 28 | #endif // CRC_H 29 | -------------------------------------------------------------------------------- /2_9_qt_net_finding_device/device_finding/deviceinfo.cpp: -------------------------------------------------------------------------------- 1 | 2 | 3 | #include "deviceinfo.h" 4 | 5 | 6 | namespace HYKT { 7 | 8 | DeviceInfo::DeviceInfo() 9 | { 10 | 11 | } 12 | 13 | } //namespace HYKT 14 | -------------------------------------------------------------------------------- /2_9_qt_net_finding_device/device_finding/deviceinfo.h: -------------------------------------------------------------------------------- 1 | 2 | 3 | #ifndef DEVICEINFO_H 4 | #define DEVICEINFO_H 5 | 6 | 7 | #include 8 | 9 | namespace HYKT { 10 | 11 | class DeviceInfo 12 | { 13 | public: 14 | 15 | DeviceInfo(); 16 | 17 | 18 | QString ip; 19 | QString name;//using this value to tell which kind of device it is 20 | QString sn; 21 | QString version; 22 | 23 | 24 | inline void operator=(DeviceInfo d) { 25 | this->ip = d.ip; 26 | this->sn = d.sn; 27 | this->name = d.name; 28 | this->version = d.version; 29 | } 30 | 31 | }; 32 | 33 | } //namespace HYKT 34 | 35 | #endif // DEVICEINFO_H 36 | -------------------------------------------------------------------------------- /2_9_qt_net_finding_device/device_finding/protocolfindingdevicemanager.h: -------------------------------------------------------------------------------- 1 | 2 | 3 | #ifndef FINDINGDEVICEMANAGER_H 4 | #define FINDINGDEVICEMANAGER_H 5 | 6 | #include 7 | #include 8 | #include 9 | 10 | #include "deviceinfo.h" 11 | #include "devicefinder.h" 12 | 13 | 14 | namespace HYKT { 15 | 16 | class ProtocolFindingDeviceManager : public QObject 17 | { 18 | Q_OBJECT 19 | public: 20 | ProtocolFindingDeviceManager(); 21 | ~ProtocolFindingDeviceManager(); 22 | 23 | void StartFindingDevice(); 24 | void StopFindingDevice(); 25 | 26 | signals: 27 | void onFoundDevice(QList device_list);//refresh and emit this signal every 10s 28 | void onFoundDeviceError(QString msg); 29 | 30 | private: 31 | void Update(); 32 | 33 | private: 34 | QTimer *timer_p; 35 | QList device_finder_list_; 36 | }; 37 | } //namespace HYKT 38 | 39 | #endif // FINDINGDEVICEMANAGER_H 40 | -------------------------------------------------------------------------------- /2_9_qt_net_finding_device/main.cpp: -------------------------------------------------------------------------------- 1 | 2 | #include 3 | 4 | #include "my_log.h" 5 | #include "ui/device_connect_dialog/deviceconnectdialog.h" 6 | 7 | int main(int argc, char *argv[]) 8 | { 9 | QApplication a(argc, argv); 10 | 11 | 12 | MyLogIns.installer_logger(new MyLogNS::ConsoleLogger()); 13 | MyLogIns.is_show_function_name = false; 14 | MyLogIns.is_show_timestamp = false; 15 | I << "log test"; 16 | 17 | DeviceConnectDialog d; 18 | d.show(); 19 | 20 | return a.exec(); 21 | } 22 | -------------------------------------------------------------------------------- /2_9_qt_net_finding_device/net/comm.cpp: -------------------------------------------------------------------------------- 1 | 2 | 3 | #include "comm.h" 4 | 5 | namespace HYKT { 6 | 7 | const QList Comm::net_type_str_list_ = { 8 | "UDP broadcase", "UDP client", "UDP server", "TCP client", "TCP server"}; 9 | 10 | Comm::Comm() 11 | { 12 | 13 | } 14 | 15 | Comm::~Comm() 16 | { 17 | 18 | } 19 | 20 | QList Comm::GetNetTypeStrList() { 21 | return net_type_str_list_; 22 | } 23 | 24 | } //namespace HYKT 25 | 26 | -------------------------------------------------------------------------------- /2_9_qt_net_finding_device/net/netmanager.h: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | #ifndef NETMANAGER_H 5 | #define NETMANAGER_H 6 | 7 | 8 | #include "comm.h" 9 | #include "udpcomm.h" 10 | #include "tcpcomm.h" 11 | 12 | #include 13 | #include 14 | #include 15 | #include 16 | 17 | #include "singleinstance.h" 18 | 19 | namespace HYKT { 20 | class NetManager : public QObject 21 | { 22 | Q_OBJECT 23 | public: 24 | NetManager(); 25 | ~NetManager(); 26 | 27 | /* 28 | static inline NetManager* GetInstance() { 29 | return &Singleton::instance(); 30 | }*/ 31 | 32 | static QList GetNetTypeStrList(); 33 | 34 | static QList GetIpListOfComputer(); 35 | 36 | int Open(int net_type, QString des_ip, quint16 des_port); 37 | void Close(); 38 | int Send(char *data, int len); 39 | int Send(const QByteArray &data); 40 | bool IsOpen(); 41 | 42 | signals: 43 | void onRecv(QByteArray *data, const QString ip, const quint16 port); 44 | void onError(int error_code, QString extra_error_info); 45 | 46 | private: 47 | void ConnectSignals(); 48 | void DisconnectSignals(); 49 | 50 | private: 51 | Comm *comm_p; 52 | 53 | }; 54 | } //namespace HYKT 55 | 56 | #endif // NETMANAGER_H 57 | -------------------------------------------------------------------------------- /2_9_qt_net_finding_device/net/tcpcomm.h: -------------------------------------------------------------------------------- 1 | 2 | 3 | #ifndef TCPCOMM_H 4 | #define TCPCOMM_H 5 | 6 | #include "comm.h" 7 | 8 | #include 9 | #include 10 | 11 | #include 12 | #include 13 | #include 14 | #include 15 | 16 | namespace HYKT { 17 | 18 | class TcpComm : public Comm 19 | { 20 | Q_OBJECT 21 | public: 22 | TcpComm(); 23 | ~TcpComm() override; 24 | 25 | virtual int Open(int net_type, QString des_ip, quint16 des_port) override; 26 | virtual void Close() override; 27 | virtual int Send(const char *data, int len) override; 28 | virtual int Send(const QByteArray &data) override; 29 | virtual bool IsOpen() override; 30 | 31 | private: 32 | virtual void DoRecv() override; 33 | virtual void DoError(QAbstractSocket::SocketError se) override; 34 | void DoOnDisconnected(); 35 | void DonewConnection(); 36 | 37 | private: 38 | QTcpSocket *tcp_p; 39 | QTcpServer *server_p; 40 | int net_type_; 41 | 42 | QString des_ip_; 43 | quint16 des_port_; 44 | 45 | QString received_client_ip_; 46 | quint16 received_client_port_; 47 | bool is_connected_; 48 | 49 | }; 50 | 51 | } //namespace HYKT 52 | 53 | #endif // TCPCOMM_H 54 | -------------------------------------------------------------------------------- /2_9_qt_net_finding_device/net/udpcomm.h: -------------------------------------------------------------------------------- 1 | 2 | 3 | #ifndef UDPCOMM_H 4 | #define UDPCOMM_H 5 | 6 | #include "comm.h" 7 | 8 | #include 9 | #include 10 | #include 11 | #include 12 | #include 13 | 14 | namespace HYKT { 15 | 16 | class UdpComm : public Comm 17 | { 18 | Q_OBJECT 19 | public: 20 | UdpComm(); 21 | ~UdpComm() override; 22 | 23 | virtual int Open(int net_type, QString des_ip, quint16 des_port) override; 24 | virtual void Close() override; 25 | virtual int Send(const char *data, int len) override; 26 | virtual int Send(const QByteArray &data) override; 27 | virtual bool IsOpen() override; 28 | 29 | private: 30 | virtual void DoRecv() override; 31 | virtual void DoError(QAbstractSocket::SocketError se) override; 32 | void DoOnDisconnected(); 33 | 34 | private: 35 | QUdpSocket *udp_p; 36 | int net_type_; 37 | 38 | QString des_ip_; 39 | quint16 des_port_; 40 | 41 | QString received_client_ip_; 42 | quint16 received_client_port_; 43 | 44 | }; 45 | 46 | } //namespace HYKT 47 | 48 | 49 | 50 | #endif // UDPCOMM_H 51 | -------------------------------------------------------------------------------- /2_9_qt_net_finding_device/thirdparty/mylog/config.pri: -------------------------------------------------------------------------------- 1 | #Config 2 | #CONFIG += static 3 | CONFIG += release 4 | macx { 5 | CONFIG += c++11 6 | } 7 | CONFIG += warn_on thread exceptions rtti stl 8 | 9 | #qt 10 | QT -= gui 11 | QT += core 12 | 13 | #output 14 | OBJECTS_DIR = _build/obj 15 | MOC_DIR = _build 16 | #mv built lib into *.pro's directory 17 | DESTDIR = $$PWD 18 | #DESTDIR = $$OUT_PWD 19 | 20 | 21 | # test config 22 | LIST = thread exceptions rtti stl 23 | for(f, LIST) { 24 | !CONFIG($$f) { 25 | warning("Add '$$f' to CONFIG, or you will meet some problems.") 26 | } 27 | } 28 | 29 | -------------------------------------------------------------------------------- /2_9_qt_net_finding_device/thirdparty/mylog/demo/main.cpp: -------------------------------------------------------------------------------- 1 | #include "mainwindow.h" 2 | #include 3 | 4 | #include "my_log.h" 5 | 6 | int main(int argc, char *argv[]) 7 | { 8 | QApplication a(argc, argv); 9 | 10 | //file logger 11 | MyLogNS::FileLogger *fileLog = new MyLogNS::FileLogger(); 12 | int result = fileLog->open_log_file_at_dir("log"); 13 | if(result != 0) { 14 | qDebug("error: %s", fileLog->get_error_str(result)); 15 | } 16 | qDebug("log file path=%s", fileLog->get_log_file_abs_path()); 17 | MyLogIns.installer_logger(fileLog); 18 | 19 | //console logger 20 | MyLogIns.installer_logger(new MyLogNS::ConsoleLogger()); 21 | 22 | //log settings 23 | MyLogIns.is_show_function_name = false; 24 | 25 | I << "app startup test" << QPoint(3,5); 26 | D << "app startup test" << QRect(1,2,3,4); 27 | E << "app startup test" << 5; 28 | 29 | MainWindow w; 30 | w.show(); 31 | 32 | return a.exec(); 33 | } 34 | -------------------------------------------------------------------------------- /2_9_qt_net_finding_device/thirdparty/mylog/demo/mainwindow.cpp: -------------------------------------------------------------------------------- 1 | #include "mainwindow.h" 2 | #include "ui_mainwindow.h" 3 | 4 | MainWindow::MainWindow(QWidget *parent) : 5 | QMainWindow(parent), 6 | ui(new Ui::MainWindow) 7 | { 8 | I << "MainWindow"; 9 | ui->setupUi(this); 10 | } 11 | 12 | MainWindow::~MainWindow() 13 | { 14 | I << "~MainWindow"; 15 | delete ui; 16 | } 17 | 18 | void MainWindow::on_pushButton_clicked() 19 | { 20 | I << "test button click"; 21 | } 22 | -------------------------------------------------------------------------------- /2_9_qt_net_finding_device/thirdparty/mylog/demo/mainwindow.h: -------------------------------------------------------------------------------- 1 | #ifndef MAINWINDOW_H 2 | #define MAINWINDOW_H 3 | 4 | #include 5 | 6 | #include "my_log.h" 7 | 8 | namespace Ui { 9 | class MainWindow; 10 | } 11 | 12 | class MainWindow : public QMainWindow 13 | { 14 | Q_OBJECT 15 | 16 | public: 17 | explicit MainWindow(QWidget *parent = nullptr); 18 | ~MainWindow(); 19 | 20 | private slots: 21 | void on_pushButton_clicked(); 22 | 23 | private: 24 | Ui::MainWindow *ui; 25 | }; 26 | 27 | #endif // MAINWINDOW_H 28 | -------------------------------------------------------------------------------- /2_9_qt_net_finding_device/thirdparty/mylog/doc/out_put_example.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/robert1207/UpperComputerProgramingGuideSrc/dd8afb9d94d21580f19863a21fa23378dafa96ee/2_9_qt_net_finding_device/thirdparty/mylog/doc/out_put_example.png -------------------------------------------------------------------------------- /2_9_qt_net_finding_device/thirdparty/mylog/src/log_level.cpp: -------------------------------------------------------------------------------- 1 | /* MyLog is a log-lib for Qt applications. 2 | * Copyright (C) <2019> e-mail:robert.cysy@gmail.com 3 | * 4 | * This program is free software: you can redistribute it and/or modify 5 | * it under the terms of the GNU Lesser General Public License as published by 6 | * the Free Software Foundation, either version 3 of the License, or 7 | * (at your option) any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU Lesser General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU Lesser General Public License 15 | * along with this program. If not, see . 16 | */ 17 | 18 | #include "log_level.h" 19 | 20 | namespace MyLogNS { 21 | 22 | const char* LevelToText(LogLevel level) 23 | { 24 | switch (level) { 25 | case Info: 26 | return level_info; 27 | case Debug: 28 | return level_debug; 29 | case Error: 30 | return level_error; 31 | } 32 | } 33 | 34 | } //namespace MyLogNS 35 | -------------------------------------------------------------------------------- /2_9_qt_net_finding_device/thirdparty/mylog/src/log_level.h: -------------------------------------------------------------------------------- 1 | /* MyLog is a log-lib for Qt applications. 2 | * Copyright (C) <2019> e-mail:robert.cysy@gmail.com 3 | * 4 | * This program is free software: you can redistribute it and/or modify 5 | * it under the terms of the GNU Lesser General Public License as published by 6 | * the Free Software Foundation, either version 3 of the License, or 7 | * (at your option) any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU Lesser General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU Lesser General Public License 15 | * along with this program. If not, see . 16 | */ 17 | 18 | #ifndef LOG_LEVEL_H 19 | #define LOG_LEVEL_H 20 | 21 | namespace MyLogNS { 22 | 23 | enum LogLevel { 24 | Info = 0, 25 | Debug, 26 | Error 27 | }; 28 | 29 | static const char level_info[] = "INFO "; 30 | static const char level_debug[] = "DEBUG"; 31 | static const char level_error[] = "ERROR"; 32 | 33 | extern const char* LevelToText(LogLevel level); 34 | 35 | } //namespace MyLogNS 36 | 37 | #endif // LOG_LEVEL_H 38 | -------------------------------------------------------------------------------- /2_9_qt_net_finding_device/thirdparty/mylog/src/logger_interface.cpp: -------------------------------------------------------------------------------- 1 | /* MyLog is a log-lib for Qt applications. 2 | * Copyright (C) <2019> e-mail:robert.cysy@gmail.com 3 | * 4 | * This program is free software: you can redistribute it and/or modify 5 | * it under the terms of the GNU Lesser General Public License as published by 6 | * the Free Software Foundation, either version 3 of the License, or 7 | * (at your option) any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU Lesser General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU Lesser General Public License 15 | * along with this program. If not, see . 16 | */ 17 | 18 | #include "logger_interface.h" 19 | 20 | namespace MyLogNS { 21 | 22 | LoggerInterface::LoggerInterface() 23 | { 24 | 25 | } 26 | 27 | LoggerInterface::~LoggerInterface() 28 | { 29 | 30 | } 31 | 32 | } //namespace MyLogNS 33 | -------------------------------------------------------------------------------- /2_9_qt_net_finding_device/thirdparty/mylog/src/my_log_export_global.h: -------------------------------------------------------------------------------- 1 | #ifndef MY_LOG_EXPORT_GLOBAL_H 2 | #define MY_LOG_EXPORT_GLOBAL_H 3 | 4 | #include 5 | 6 | #if defined(MY_LOG_LIBRARY) 7 | # define MY_LOG_SHARED_EXPORT Q_DECL_EXPORT 8 | #else 9 | # define MY_LOG_SHARED_EXPORT Q_DECL_IMPORT 10 | #endif 11 | 12 | #endif // MY_LOG_EXPORT_GLOBAL_H 13 | -------------------------------------------------------------------------------- /2_9_qt_net_finding_device/thirdparty/mylog/todo: -------------------------------------------------------------------------------- 1 | 1. log information about the user's computer; 2 | 2. set and check the size of the current logged file; 3 | 3. user can config timestamp format; 4 | 4. user can config out-put log file's string codec; 5 | 5. user can make a self-define log-string-formater; 6 | 6. add support of "void debug(const char *msg, ...)"; 7 | 7. support log the str into QSLite database; 8 | 8. support log the str into telnet server or interface of http(s); 9 | -------------------------------------------------------------------------------- /2_9_qt_net_finding_device/thirdparty/mylog/version_changes: -------------------------------------------------------------------------------- 1 | version 1.0.1: 2 | 1.init 3 | -------------------------------------------------------------------------------- /2_9_qt_net_finding_device/thirdparty/readme.txt: -------------------------------------------------------------------------------- 1 | clone mylog-lib at here with command below; 2 | git clone https://github.com/robert1207/MyLog -------------------------------------------------------------------------------- /2_9_qt_net_finding_device/thirdparty/singleinstance/config.pri: -------------------------------------------------------------------------------- 1 | #Config 2 | #CONFIG += static 3 | CONFIG += release 4 | macx { 5 | CONFIG += c++11 6 | } 7 | win32 { 8 | CONFIG += c++11 9 | } 10 | CONFIG += warn_on thread exceptions rtti stl 11 | 12 | #output 13 | OBJECTS_DIR = _build/obj 14 | MOC_DIR = _build 15 | #move the lib file in to project folder 16 | macx { 17 | DESTDIR = $$PWD 18 | } 19 | win32 { 20 | DESTDIR = $$PWD 21 | } 22 | 23 | # test config 24 | LIST = thread exceptions rtti stl 25 | for(f, LIST) { 26 | !CONFIG($$f) { 27 | warning("Add '$$f' to CONFIG, or you will meet some problems.") 28 | } 29 | } 30 | 31 | -------------------------------------------------------------------------------- /2_9_qt_net_finding_device/thirdparty/singleinstance/singleinstance.pro: -------------------------------------------------------------------------------- 1 | #------------------------------------------------- 2 | # 3 | # Project created by QtCreator 2019-07-08T11:06:49 4 | # 5 | #------------------------------------------------- 6 | include($$PWD/config.pri) 7 | QT += core 8 | 9 | TARGET = singleinstance 10 | TEMPLATE = lib 11 | #VERSION = 1.0.0 12 | 13 | DEFINES += SINGLEINSTANCE_LIBRARY 14 | 15 | SOURCES += \ 16 | 17 | 18 | 19 | HEADERS += \ 20 | 21 | unix { 22 | target.path = /usr/lib 23 | INSTALLS += target 24 | } 25 | 26 | 27 | 28 | -------------------------------------------------------------------------------- /2_9_qt_net_finding_device/thirdparty/singleinstance/singleinstancelib.pri: -------------------------------------------------------------------------------- 1 | 2 | 3 | message("singleinstance_lib_been_attached") 4 | 5 | CONFIG += thread exceptions rtti stl 6 | 7 | INCLUDEPATH += $$PWD/src/ 8 | 9 | HEADERS += \ 10 | $$PWD/src/singleinstance.h 11 | 12 | 13 | LIBS += \ 14 | -L$$PWD -lsingleinstance 15 | 16 | 17 | -------------------------------------------------------------------------------- /2_9_qt_net_finding_device/thirdparty/singleinstance/singleinstancesrc.pri: -------------------------------------------------------------------------------- 1 | 2 | message("singleinstance_src_attached") 3 | 4 | CONFIG += thread exceptions rtti stl 5 | 6 | INCLUDEPATH += $$PWD/src/ 7 | 8 | 9 | SOURCES += \ 10 | $$PWD/src/singleinstance.cpp 11 | 12 | 13 | 14 | HEADERS += \ 15 | $$PWD/src/singleinstance.h \ 16 | $$PWD/src/singletone/singleton.h \ 17 | $$PWD/src/singletone/call_once.h 18 | 19 | 20 | -------------------------------------------------------------------------------- /2_9_qt_net_finding_device/thirdparty/singleinstance/src/singleinstance.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * @Name led_strip_editor 3 | * @Author Robert Zhang 4 | * @E-mail zhangzhiguo1207@163.com 5 | * @Date 2019-12-14 6 | */ 7 | #include "singleinstance.h" 8 | 9 | namespace HYKT { 10 | 11 | SingleInstance::SingleInstance() 12 | { 13 | 14 | } 15 | 16 | } //namespace HYKT { 17 | 18 | -------------------------------------------------------------------------------- /2_9_qt_net_finding_device/thirdparty/singleinstance/src/singleinstance.h: -------------------------------------------------------------------------------- 1 | /* 2 | * @Name led_strip_editor 3 | * @Author Robert Zhang 4 | * @E-mail zhangzhiguo1207@163.com 5 | * @Date 2019-12-14 6 | */ 7 | #ifndef SINGLEINSTANCE_H 8 | #define SINGLEINSTANCE_H 9 | 10 | #include "./singletone/singleton.h" 11 | 12 | namespace HYKT { 13 | 14 | class SingleInstance 15 | { 16 | public: 17 | SingleInstance(); 18 | }; 19 | 20 | } //namespace HYKT { 21 | 22 | #endif // SINGLEINSTANCE_H 23 | -------------------------------------------------------------------------------- /2_9_qt_net_finding_device/utils/byteutil.cpp: -------------------------------------------------------------------------------- 1 | 2 | 3 | #include "byteutil.h" 4 | 5 | 6 | namespace HYKT { 7 | 8 | 9 | ByteUtil::ByteUtil() 10 | { 11 | 12 | } 13 | 14 | char ByteUtil::Byte2Char(const byte byte) { 15 | char ret = 0x00; 16 | ret = ret | byte; 17 | return ret; 18 | } 19 | 20 | byte ByteUtil::Char2Byte(const char ch) { 21 | byte by = 0x00; 22 | by = static_cast(by | ch); 23 | return by; 24 | } 25 | 26 | //only last 8bit of int is saved 27 | char ByteUtil::Int2Char(const int value) { 28 | return Byte2Char(static_cast(value)); 29 | } 30 | 31 | int ByteUtil::Char2Int(const char ch) { 32 | byte t = Char2Byte(ch); 33 | return static_cast(t); 34 | } 35 | 36 | 37 | void ByteUtil::ByteArray2CharArray(const byte * src, char *dst, int len) { 38 | for (int a = 0; a < len; a++) { 39 | dst[a] = Byte2Char(src[a]); 40 | } 41 | } 42 | 43 | void ByteUtil::CharArray2ByteArray(const char * src, byte *dst, int len) { 44 | for (int a = 0; a < len; a++) { 45 | dst[a] = Char2Byte(src[a]); 46 | } 47 | } 48 | 49 | } //namespace HYKT 50 | -------------------------------------------------------------------------------- /2_9_qt_net_finding_device/utils/byteutil.h: -------------------------------------------------------------------------------- 1 | 2 | 3 | #ifndef BYTEUTIL_H 4 | #define BYTEUTIL_H 5 | 6 | typedef unsigned char byte; 7 | 8 | namespace HYKT { 9 | 10 | class ByteUtil 11 | { 12 | private: 13 | ByteUtil(); 14 | 15 | public: 16 | static char Byte2Char(const byte byte); 17 | static byte Char2Byte(const char ch); 18 | 19 | static char Int2Char(const int value);//only last 8bit of int is saved 20 | static int Char2Int(const char ch); 21 | 22 | static void ByteArray2CharArray(const byte * src, char *dst, int len); 23 | static void CharArray2ByteArray(const char * src, byte *dst, int len); 24 | }; 25 | } //namespace HYKT 26 | 27 | #endif // BYTEUTIL_H 28 | -------------------------------------------------------------------------------- /2_9_winform_net_finding_device/NetFindingDevice.sln: -------------------------------------------------------------------------------- 1 |  2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio Version 16 4 | VisualStudioVersion = 16.0.29025.244 5 | MinimumVisualStudioVersion = 10.0.40219.1 6 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "NetFindingDevice", "NetFindingDevice\NetFindingDevice.csproj", "{CAE9A379-6C1E-424F-BABF-DC6AC64FD6F6}" 7 | EndProject 8 | Global 9 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 10 | Debug|Any CPU = Debug|Any CPU 11 | Release|Any CPU = Release|Any CPU 12 | EndGlobalSection 13 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 14 | {CAE9A379-6C1E-424F-BABF-DC6AC64FD6F6}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 15 | {CAE9A379-6C1E-424F-BABF-DC6AC64FD6F6}.Debug|Any CPU.Build.0 = Debug|Any CPU 16 | {CAE9A379-6C1E-424F-BABF-DC6AC64FD6F6}.Release|Any CPU.ActiveCfg = Release|Any CPU 17 | {CAE9A379-6C1E-424F-BABF-DC6AC64FD6F6}.Release|Any CPU.Build.0 = Release|Any CPU 18 | EndGlobalSection 19 | GlobalSection(SolutionProperties) = preSolution 20 | HideSolutionNode = FALSE 21 | EndGlobalSection 22 | GlobalSection(ExtensibilityGlobals) = postSolution 23 | SolutionGuid = {96D42A5C-B78B-4F7E-BD6E-D559267751B2} 24 | EndGlobalSection 25 | EndGlobal 26 | -------------------------------------------------------------------------------- /2_9_winform_net_finding_device/NetFindingDevice/App.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /2_9_winform_net_finding_device/NetFindingDevice/DeviceConnectionManager/NetDeviceInfo.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | 4 | namespace HYKT 5 | { 6 | class NetDeviceInfo 7 | { 8 | 9 | public String Ip { get; set; } 10 | public String SN { get; set; } 11 | public String Version { get; set; } 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /2_9_winform_net_finding_device/NetFindingDevice/DeviceConnectionManager/Protocol.cs: -------------------------------------------------------------------------------- 1 |  2 | using System; 3 | using System.Linq; 4 | 5 | namespace HYKT 6 | { 7 | class Protocol 8 | { 9 | public static readonly byte[] head = { 0xee }; 10 | public static readonly byte[] tail = { 0xbb }; 11 | 12 | 13 | private static byte[] ProtocolPack(byte[] data) { 14 | byte[] ret = { }; 15 | byte[] crc16 = { }; 16 | 17 | crc16 = CRC16.GetCRC(data); 18 | 19 | ret = ret.Concat(head).ToArray(); 20 | ret = ret.Concat(data).ToArray(); 21 | ret = ret.Concat(crc16).ToArray(); 22 | ret = ret.Concat(tail).ToArray(); 23 | 24 | return ret; 25 | } 26 | 27 | //需要没有包头,没有包尾的数据 28 | public static bool CrcCheck(byte[] data) { 29 | 30 | return CRC16.CheckCRC(data) ; 31 | } 32 | 33 | /******************************************** search net device *********************/ 34 | public static byte[] SearchNetDevice() 35 | { 36 | byte[] data = { 0x01 }; 37 | return ProtocolPack(data); 38 | } 39 | 40 | 41 | 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /2_9_winform_net_finding_device/NetFindingDevice/Program.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Threading.Tasks; 5 | using System.Windows.Forms; 6 | 7 | namespace NetFindingDevice 8 | { 9 | static class Program 10 | { 11 | /// 12 | /// 应用程序的主入口点。 13 | /// 14 | [STAThread] 15 | static void Main() 16 | { 17 | Application.EnableVisualStyles(); 18 | Application.SetCompatibleTextRenderingDefault(false); 19 | Application.Run(new Form1()); 20 | } 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /2_9_winform_net_finding_device/NetFindingDevice/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.CompilerServices; 3 | using System.Runtime.InteropServices; 4 | 5 | // 有关程序集的一般信息由以下 6 | // 控制。更改这些特性值可修改 7 | // 与程序集关联的信息。 8 | [assembly: AssemblyTitle("NetFindingDevice")] 9 | [assembly: AssemblyDescription("")] 10 | [assembly: AssemblyConfiguration("")] 11 | [assembly: AssemblyCompany("")] 12 | [assembly: AssemblyProduct("NetFindingDevice")] 13 | [assembly: AssemblyCopyright("Copyright © 2020")] 14 | [assembly: AssemblyTrademark("")] 15 | [assembly: AssemblyCulture("")] 16 | 17 | // 将 ComVisible 设置为 false 会使此程序集中的类型 18 | //对 COM 组件不可见。如果需要从 COM 访问此程序集中的类型 19 | //请将此类型的 ComVisible 特性设置为 true。 20 | [assembly: ComVisible(false)] 21 | 22 | // 如果此项目向 COM 公开,则下列 GUID 用于类型库的 ID 23 | [assembly: Guid("cae9a379-6c1e-424f-babf-dc6ac64fd6f6")] 24 | 25 | // 程序集的版本信息由下列四个值组成: 26 | // 27 | // 主版本 28 | // 次版本 29 | // 生成号 30 | // 修订号 31 | // 32 | //可以指定所有这些值,也可以使用“生成号”和“修订号”的默认值 33 | //通过使用 "*",如下所示: 34 | // [assembly: AssemblyVersion("1.0.*")] 35 | [assembly: AssemblyVersion("1.0.0.0")] 36 | [assembly: AssemblyFileVersion("1.0.0.0")] 37 | -------------------------------------------------------------------------------- /2_9_winform_net_finding_device/NetFindingDevice/Properties/Settings.Designer.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------------ 2 | // 3 | // This code was generated by a tool. 4 | // Runtime Version:4.0.30319.42000 5 | // 6 | // Changes to this file may cause incorrect behavior and will be lost if 7 | // the code is regenerated. 8 | // 9 | //------------------------------------------------------------------------------ 10 | 11 | namespace NetFindingDevice.Properties 12 | { 13 | 14 | 15 | [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] 16 | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "11.0.0.0")] 17 | internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase 18 | { 19 | 20 | private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings()))); 21 | 22 | public static Settings Default 23 | { 24 | get 25 | { 26 | return defaultInstance; 27 | } 28 | } 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /2_9_winform_net_finding_device/NetFindingDevice/Properties/Settings.settings: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /2_9_winform_net_finding_device/NetFindingDevice/obj/Debug/DesignTimeResolveAssemblyReferences.cache: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/robert1207/UpperComputerProgramingGuideSrc/dd8afb9d94d21580f19863a21fa23378dafa96ee/2_9_winform_net_finding_device/NetFindingDevice/obj/Debug/DesignTimeResolveAssemblyReferences.cache -------------------------------------------------------------------------------- /2_9_winform_net_finding_device/NetFindingDevice/obj/Debug/DesignTimeResolveAssemblyReferencesInput.cache: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/robert1207/UpperComputerProgramingGuideSrc/dd8afb9d94d21580f19863a21fa23378dafa96ee/2_9_winform_net_finding_device/NetFindingDevice/obj/Debug/DesignTimeResolveAssemblyReferencesInput.cache -------------------------------------------------------------------------------- /2_9_winform_net_finding_device/NetFindingDevice/obj/Debug/NetFindingDevice.Form1.resources: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/robert1207/UpperComputerProgramingGuideSrc/dd8afb9d94d21580f19863a21fa23378dafa96ee/2_9_winform_net_finding_device/NetFindingDevice/obj/Debug/NetFindingDevice.Form1.resources -------------------------------------------------------------------------------- /2_9_winform_net_finding_device/NetFindingDevice/obj/Debug/NetFindingDevice.Properties.Resources.resources: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/robert1207/UpperComputerProgramingGuideSrc/dd8afb9d94d21580f19863a21fa23378dafa96ee/2_9_winform_net_finding_device/NetFindingDevice/obj/Debug/NetFindingDevice.Properties.Resources.resources -------------------------------------------------------------------------------- /2_9_winform_net_finding_device/NetFindingDevice/obj/Debug/NetFindingDevice.csproj.CoreCompileInputs.cache: -------------------------------------------------------------------------------- 1 | 94cc904cb85a0ed04845053af499472660b48a11 2 | -------------------------------------------------------------------------------- /2_9_winform_net_finding_device/NetFindingDevice/obj/Debug/NetFindingDevice.csproj.FileListAbsolute.txt: -------------------------------------------------------------------------------- 1 | C:\Users\robert\source\repos\NetFindingDevice\NetFindingDevice\bin\Debug\NetFindingDevice.exe.config 2 | C:\Users\robert\source\repos\NetFindingDevice\NetFindingDevice\bin\Debug\NetFindingDevice.exe 3 | C:\Users\robert\source\repos\NetFindingDevice\NetFindingDevice\bin\Debug\NetFindingDevice.pdb 4 | C:\Users\robert\source\repos\NetFindingDevice\NetFindingDevice\obj\Debug\NetFindingDevice.csprojAssemblyReference.cache 5 | C:\Users\robert\source\repos\NetFindingDevice\NetFindingDevice\obj\Debug\NetFindingDevice.Form1.resources 6 | C:\Users\robert\source\repos\NetFindingDevice\NetFindingDevice\obj\Debug\NetFindingDevice.Properties.Resources.resources 7 | C:\Users\robert\source\repos\NetFindingDevice\NetFindingDevice\obj\Debug\NetFindingDevice.csproj.GenerateResource.cache 8 | C:\Users\robert\source\repos\NetFindingDevice\NetFindingDevice\obj\Debug\NetFindingDevice.csproj.CoreCompileInputs.cache 9 | C:\Users\robert\source\repos\NetFindingDevice\NetFindingDevice\obj\Debug\NetFindingDevice.exe 10 | C:\Users\robert\source\repos\NetFindingDevice\NetFindingDevice\obj\Debug\NetFindingDevice.pdb 11 | -------------------------------------------------------------------------------- /2_9_winform_net_finding_device/NetFindingDevice/obj/Debug/NetFindingDevice.csproj.GenerateResource.cache: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/robert1207/UpperComputerProgramingGuideSrc/dd8afb9d94d21580f19863a21fa23378dafa96ee/2_9_winform_net_finding_device/NetFindingDevice/obj/Debug/NetFindingDevice.csproj.GenerateResource.cache -------------------------------------------------------------------------------- /2_9_winform_net_finding_device/NetFindingDevice/obj/Debug/NetFindingDevice.csprojAssemblyReference.cache: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/robert1207/UpperComputerProgramingGuideSrc/dd8afb9d94d21580f19863a21fa23378dafa96ee/2_9_winform_net_finding_device/NetFindingDevice/obj/Debug/NetFindingDevice.csprojAssemblyReference.cache -------------------------------------------------------------------------------- /2_9_winform_net_finding_device/NetFindingDevice/obj/Debug/NetFindingDevice.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/robert1207/UpperComputerProgramingGuideSrc/dd8afb9d94d21580f19863a21fa23378dafa96ee/2_9_winform_net_finding_device/NetFindingDevice/obj/Debug/NetFindingDevice.exe -------------------------------------------------------------------------------- /2_9_winform_net_finding_device/NetFindingDevice/obj/Debug/NetFindingDevice.pdb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/robert1207/UpperComputerProgramingGuideSrc/dd8afb9d94d21580f19863a21fa23378dafa96ee/2_9_winform_net_finding_device/NetFindingDevice/obj/Debug/NetFindingDevice.pdb -------------------------------------------------------------------------------- /3_2_qt_protocol_structure_demo/.gitignore: -------------------------------------------------------------------------------- 1 | # This file is used to ignore files which are generated 2 | # ---------------------------------------------------------------------------- 3 | 4 | *~ 5 | *.autosave 6 | *.a 7 | *.core 8 | *.moc 9 | *.o 10 | *.obj 11 | *.orig 12 | *.rej 13 | *.so 14 | *.so.* 15 | *_pch.h.cpp 16 | *_resource.rc 17 | *.qm 18 | .#* 19 | *.*# 20 | core 21 | !core/ 22 | tags 23 | .DS_Store 24 | .directory 25 | *.debug 26 | Makefile* 27 | *.prl 28 | *.app 29 | moc_*.cpp 30 | ui_*.h 31 | qrc_*.cpp 32 | Thumbs.db 33 | *.res 34 | *.rc 35 | /.qmake.cache 36 | /.qmake.stash 37 | 38 | # qtcreator generated files 39 | *.pro.user* 40 | 41 | # xemacs temporary files 42 | *.flc 43 | 44 | # Vim temporary files 45 | .*.swp 46 | 47 | # Visual Studio generated files 48 | *.ib_pdb_index 49 | *.idb 50 | *.ilk 51 | *.pdb 52 | *.sln 53 | *.suo 54 | *.vcproj 55 | *vcproj.*.*.user 56 | *.ncb 57 | *.sdf 58 | *.opensdf 59 | *.vcxproj 60 | *vcxproj.* 61 | 62 | # MinGW generated files 63 | *.Debug 64 | *.Release 65 | 66 | # Python byte code 67 | *.pyc 68 | 69 | # Binaries 70 | # -------- 71 | *.dll 72 | *.exe 73 | 74 | -------------------------------------------------------------------------------- /3_2_qt_protocol_structure_demo/device_finding/deviceinfo.cpp: -------------------------------------------------------------------------------- 1 | 2 | 3 | #include "deviceinfo.h" 4 | 5 | 6 | namespace HYKT { 7 | 8 | DeviceInfo::DeviceInfo() 9 | { 10 | 11 | } 12 | 13 | } //namespace HYKT 14 | -------------------------------------------------------------------------------- /3_2_qt_protocol_structure_demo/device_finding/deviceinfo.h: -------------------------------------------------------------------------------- 1 | 2 | 3 | #ifndef DEVICEINFO_H 4 | #define DEVICEINFO_H 5 | 6 | 7 | #include 8 | 9 | namespace HYKT { 10 | 11 | class DeviceInfo 12 | { 13 | public: 14 | 15 | DeviceInfo(); 16 | 17 | 18 | QString ip; 19 | QString name;//using this value to tell which kind of device it is 20 | QString sn; 21 | QString version; 22 | 23 | 24 | inline void operator=(DeviceInfo d) { 25 | this->ip = d.ip; 26 | this->sn = d.sn; 27 | this->name = d.name; 28 | this->version = d.version; 29 | } 30 | 31 | }; 32 | 33 | } //namespace HYKT 34 | 35 | #endif // DEVICEINFO_H 36 | -------------------------------------------------------------------------------- /3_2_qt_protocol_structure_demo/device_finding/findingdevicemanager.h: -------------------------------------------------------------------------------- 1 | 2 | 3 | #ifndef FINDINGDEVICEMANAGER_H 4 | #define FINDINGDEVICEMANAGER_H 5 | 6 | #include 7 | #include 8 | #include 9 | 10 | #include "deviceinfo.h" 11 | #include "devicefinder.h" 12 | 13 | 14 | namespace HYKT { 15 | 16 | class FindingDeviceManager : public QObject 17 | { 18 | Q_OBJECT 19 | public: 20 | FindingDeviceManager(); 21 | ~FindingDeviceManager(); 22 | 23 | void StartFindingDevice(); 24 | void StopFindingDevice(); 25 | 26 | signals: 27 | void onFoundDevice(QList device_list);//refresh and emit this signal every 10s 28 | void onFoundDeviceError(QString msg); 29 | 30 | private: 31 | void Update(); 32 | 33 | private: 34 | QTimer *timer_p; 35 | QList device_finder_list_; 36 | }; 37 | } //namespace HYKT 38 | 39 | #endif // FINDINGDEVICEMANAGER_H 40 | -------------------------------------------------------------------------------- /3_2_qt_protocol_structure_demo/main.cpp: -------------------------------------------------------------------------------- 1 | #include "ui/demodialog/demodialog.h" 2 | 3 | #include 4 | 5 | int main(int argc, char *argv[]) 6 | { 7 | QApplication a(argc, argv); 8 | DemoDialog w; 9 | w.show(); 10 | return a.exec(); 11 | } 12 | -------------------------------------------------------------------------------- /3_2_qt_protocol_structure_demo/net/comm.cpp: -------------------------------------------------------------------------------- 1 | 2 | 3 | #include "comm.h" 4 | 5 | namespace HYKT { 6 | 7 | const QList Comm::net_type_str_list_ = { 8 | "UDP broadcase", "UDP client", "UDP server", "TCP client", "TCP server"}; 9 | 10 | Comm::Comm() 11 | { 12 | 13 | } 14 | 15 | Comm::~Comm() 16 | { 17 | 18 | } 19 | 20 | QList Comm::GetNetTypeStrList() { 21 | return net_type_str_list_; 22 | } 23 | 24 | } //namespace HYKT 25 | 26 | -------------------------------------------------------------------------------- /3_2_qt_protocol_structure_demo/net/netmanager.h: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | #ifndef NETMANAGER_H 5 | #define NETMANAGER_H 6 | 7 | 8 | #include "comm.h" 9 | #include "udpcomm.h" 10 | #include "tcpcomm.h" 11 | 12 | #include 13 | #include 14 | #include 15 | #include 16 | 17 | namespace HYKT { 18 | class NetManager : public QObject 19 | { 20 | Q_OBJECT 21 | public: 22 | NetManager(); 23 | ~NetManager(); 24 | 25 | static QList GetNetTypeStrList(); 26 | 27 | static QList GetIpListOfComputer(); 28 | 29 | int Open(int net_type, QString des_ip, quint16 des_port); 30 | void Close(); 31 | int Send(char *data, int len); 32 | int Send(const QByteArray &data); 33 | bool IsOpen(); 34 | 35 | signals: 36 | void onRecv(QByteArray *data, const QString ip, const quint16 port); 37 | void onError(int error_code, QString extra_error_info); 38 | 39 | private: 40 | void ConnectSignals(); 41 | void DisconnectSignals(); 42 | 43 | private: 44 | Comm *comm_p; 45 | 46 | }; 47 | } //namespace HYKT 48 | 49 | #endif // NETMANAGER_H 50 | -------------------------------------------------------------------------------- /3_2_qt_protocol_structure_demo/net/tcpcomm.h: -------------------------------------------------------------------------------- 1 | 2 | 3 | #ifndef TCPCOMM_H 4 | #define TCPCOMM_H 5 | 6 | #include "comm.h" 7 | 8 | #include 9 | #include 10 | 11 | #include 12 | #include 13 | #include 14 | #include 15 | 16 | namespace HYKT { 17 | 18 | class TcpComm : public Comm 19 | { 20 | Q_OBJECT 21 | public: 22 | TcpComm(); 23 | ~TcpComm() override; 24 | 25 | virtual int Open(int net_type, QString des_ip, quint16 des_port) override; 26 | virtual void Close() override; 27 | virtual int Send(const char *data, int len) override; 28 | virtual int Send(const QByteArray &data) override; 29 | virtual bool IsOpen() override; 30 | 31 | private: 32 | virtual void DoRecv() override; 33 | virtual void DoError(QAbstractSocket::SocketError se) override; 34 | void DoOnDisconnected(); 35 | void DonewConnection(); 36 | 37 | private: 38 | QTcpSocket *tcp_p; 39 | QTcpServer *server_p; 40 | int net_type_; 41 | 42 | QString des_ip_; 43 | quint16 des_port_; 44 | 45 | QString received_client_ip_; 46 | quint16 received_client_port_; 47 | bool is_connected_; 48 | 49 | }; 50 | 51 | } //namespace HYKT 52 | 53 | #endif // TCPCOMM_H 54 | -------------------------------------------------------------------------------- /3_2_qt_protocol_structure_demo/net/udpcomm.h: -------------------------------------------------------------------------------- 1 | 2 | 3 | #ifndef UDPCOMM_H 4 | #define UDPCOMM_H 5 | 6 | #include "comm.h" 7 | 8 | #include 9 | #include 10 | #include 11 | #include 12 | #include 13 | 14 | namespace HYKT { 15 | 16 | class UdpComm : public Comm 17 | { 18 | Q_OBJECT 19 | public: 20 | UdpComm(); 21 | ~UdpComm() override; 22 | 23 | virtual int Open(int net_type, QString des_ip, quint16 des_port) override; 24 | virtual void Close() override; 25 | virtual int Send(const char *data, int len) override; 26 | virtual int Send(const QByteArray &data) override; 27 | virtual bool IsOpen() override; 28 | 29 | private: 30 | virtual void DoRecv() override; 31 | virtual void DoError(QAbstractSocket::SocketError se) override; 32 | void DoOnDisconnected(); 33 | 34 | private: 35 | QUdpSocket *udp_p; 36 | int net_type_; 37 | 38 | QString des_ip_; 39 | quint16 des_port_; 40 | 41 | QString received_client_ip_; 42 | quint16 received_client_port_; 43 | 44 | }; 45 | 46 | } //namespace HYKT 47 | 48 | 49 | 50 | #endif // UDPCOMM_H 51 | -------------------------------------------------------------------------------- /3_2_qt_protocol_structure_demo/protocol/crc.cpp: -------------------------------------------------------------------------------- 1 | 2 | 3 | #include "crc.h" 4 | 5 | namespace HYKT { 6 | 7 | Crc::Crc() 8 | { 9 | 10 | } 11 | 12 | Crc::~Crc() 13 | { 14 | 15 | } 16 | 17 | void Crc::GetCRC(quint8 *data, int len, quint16 &crc) { 18 | quint16 i,j,carry_flag, temp; 19 | 20 | crc = 0xffff; 21 | 22 | for (i = 0; i < len; i++) { 23 | crc = crc ^ data[i]; 24 | for (j = 0; j < 8; j ++) { 25 | temp = crc; 26 | carry_flag = temp & 0x0001; 27 | crc = crc >> 1; 28 | 29 | if (carry_flag == 1) { 30 | crc = crc ^ 0xa001; 31 | } 32 | } 33 | } 34 | } 35 | 36 | 37 | bool Crc::CheckCRC(quint8 *data, int len) { 38 | if (len < 2) return false; 39 | 40 | printf("------------CheckCRC-----------------\n"); 41 | for(int a = 0; a < len; a ++) { 42 | printf("%d dst 333 hex=%02x \n", a, data[a]); 43 | } 44 | 45 | quint16 crcLow = data[len - 1]; 46 | quint16 crcHigh = data[len - 2]; 47 | quint16 crc_received = static_cast(crcHigh << 8 | crcLow); 48 | quint16 crc_new; 49 | 50 | GetCRC(data, len - 2, crc_new); 51 | 52 | if (crc_new == crc_received) { 53 | return true; 54 | } 55 | 56 | return false; 57 | } 58 | 59 | } //namespace HYKT 60 | -------------------------------------------------------------------------------- /3_2_qt_protocol_structure_demo/protocol/crc.h: -------------------------------------------------------------------------------- 1 | 2 | 3 | #ifndef CRC_H 4 | #define CRC_H 5 | 6 | 7 | #include "qglobal.h" 8 | 9 | namespace HYKT { 10 | 11 | class Crc 12 | { 13 | private: 14 | Crc(); 15 | ~Crc(); 16 | public: 17 | static void GetCRC(quint8 *data, int len, quint16 &crc); 18 | static bool CheckCRC(quint8 *data, int len); 19 | }; 20 | 21 | } //namespace HYKT 22 | 23 | #endif // CRC_H 24 | -------------------------------------------------------------------------------- /3_2_qt_protocol_structure_demo/protocol/work.cpp: -------------------------------------------------------------------------------- 1 | 2 | 3 | #include "work.h" 4 | 5 | #include "../utils/byteutil.h" 6 | 7 | namespace HYKT { 8 | 9 | Work::Work() 10 | { 11 | failed_times = 0; 12 | } 13 | 14 | bool Work::CheckResponse(quint8 *return_pkg) { 15 | 16 | quint8 src_pkg_bit_1 = ByteUtil::Char2Byte(data.at(2));//command type 17 | quint8 src_pkg_bit_2 = ByteUtil::Char2Byte(data.at(3));//command code 18 | 19 | if (return_pkg[0] == src_pkg_bit_1 && return_pkg[1] == src_pkg_bit_2) { 20 | return true; 21 | } else { 22 | return false; 23 | } 24 | } 25 | 26 | 27 | 28 | 29 | } //namespace HYKT 30 | 31 | -------------------------------------------------------------------------------- /3_2_qt_protocol_structure_demo/protocol/work.h: -------------------------------------------------------------------------------- 1 | 2 | #ifndef WORK_H 3 | #define WORK_H 4 | 5 | #include 6 | 7 | namespace HYKT { 8 | class Work 9 | { 10 | public: 11 | Work(); 12 | 13 | int failed_times; 14 | QByteArray data; 15 | 16 | bool CheckResponse(quint8 * return_pkg); 17 | 18 | }; 19 | } //namespace HYKT 20 | 21 | #endif // WORK_H 22 | -------------------------------------------------------------------------------- /3_2_qt_protocol_structure_demo/protocol/workmanager.h: -------------------------------------------------------------------------------- 1 | 2 | #ifndef WORKMANAGER_H 3 | #define WORKMANAGER_H 4 | 5 | #include 6 | #include "work.h" 7 | 8 | namespace HYKT { 9 | 10 | class WorkManager 11 | { 12 | public: 13 | WorkManager(); 14 | ~WorkManager(); 15 | 16 | void AddWork(QByteArray &pkg); 17 | void InsertWorkAtHead(QByteArray &pkg); 18 | void CleanWorkList(); 19 | void FinishAWork(); 20 | Work* GetCurrentWork(); 21 | bool IsHasWork(); 22 | 23 | 24 | private: 25 | QList work_list_; 26 | 27 | }; 28 | 29 | } //namespace HYKT 30 | #endif // WORKMANAGER_H 31 | -------------------------------------------------------------------------------- /3_2_qt_protocol_structure_demo/ui/demodialog/demodialog.h: -------------------------------------------------------------------------------- 1 | #ifndef DEMODIALOG_H 2 | #define DEMODIALOG_H 3 | 4 | #include 5 | 6 | #include "../../protocol/protocolmanager.h" 7 | using namespace HYKT; 8 | 9 | QT_BEGIN_NAMESPACE 10 | namespace Ui { class DemoDialog; } 11 | QT_END_NAMESPACE 12 | 13 | class DemoDialog : public QDialog 14 | { 15 | Q_OBJECT 16 | 17 | public: 18 | DemoDialog(QWidget *parent = nullptr); 19 | ~DemoDialog(); 20 | 21 | private: 22 | void onConnectionError(QString msg); 23 | void onDisconnect(); 24 | void onGetMachinetemperature(int value); 25 | void onReportValue(int value); 26 | 27 | private slots: 28 | void on_pushButtonGettemperature_clicked(); 29 | 30 | void on_pushButtonConnectDevice_clicked(); 31 | 32 | void on_pushButtonSetValue_clicked(); 33 | 34 | private: 35 | Ui::DemoDialog *ui; 36 | 37 | ProtocolManager *protocol_manager_p; 38 | }; 39 | #endif // DEMODIALOG_H 40 | -------------------------------------------------------------------------------- /3_2_qt_protocol_structure_demo/utils/byteutil.cpp: -------------------------------------------------------------------------------- 1 | #include "byteutil.h" 2 | 3 | namespace HYKT { 4 | 5 | ByteUtil::ByteUtil() 6 | { 7 | 8 | } 9 | 10 | char ByteUtil::Byte2Char(const byte byte) { 11 | char ret = 0x00; 12 | ret = ret | byte; 13 | return ret; 14 | } 15 | 16 | byte ByteUtil::Char2Byte(const char ch) { 17 | byte by = 0x00; 18 | by = static_cast(by | ch); 19 | return by; 20 | } 21 | 22 | //only last 8bit of int is saved 23 | char ByteUtil::Int2Char(const int value) { 24 | return Byte2Char(static_cast(value)); 25 | } 26 | 27 | int ByteUtil::Char2Int(const char ch) { 28 | byte t = Char2Byte(ch); 29 | return static_cast(t); 30 | } 31 | 32 | 33 | void ByteUtil::ByteArray2CharArray(const byte * src, char *dst, int len) { 34 | for (int a = 0; a < len; a++) { 35 | dst[a] = Byte2Char(src[a]); 36 | } 37 | } 38 | 39 | void ByteUtil::CharArray2ByteArray(const char * src, byte *dst, int len) { 40 | for (int a = 0; a < len; a++) { 41 | dst[a] = Char2Byte(src[a]); 42 | } 43 | } 44 | 45 | } //namespace HYKT 46 | -------------------------------------------------------------------------------- /3_2_qt_protocol_structure_demo/utils/byteutil.h: -------------------------------------------------------------------------------- 1 | 2 | 3 | #ifndef BYTEUTIL_H 4 | #define BYTEUTIL_H 5 | 6 | typedef unsigned char byte; 7 | 8 | namespace HYKT { 9 | 10 | class ByteUtil 11 | { 12 | private: 13 | ByteUtil(); 14 | 15 | public: 16 | static char Byte2Char(const byte byte); 17 | static byte Char2Byte(const char ch); 18 | 19 | static char Int2Char(const int value);//only last 8bit of int is saved 20 | static int Char2Int(const char ch); 21 | 22 | static void ByteArray2CharArray(const byte * src, char *dst, int len); 23 | static void CharArray2ByteArray(const char * src, byte *dst, int len); 24 | }; 25 | } //namespace HYKT 26 | 27 | #endif // BYTEUTIL_H 28 | -------------------------------------------------------------------------------- /3_2_virtual_hardware/.gitignore: -------------------------------------------------------------------------------- 1 | # This file is used to ignore files which are generated 2 | # ---------------------------------------------------------------------------- 3 | 4 | *~ 5 | *.autosave 6 | *.a 7 | *.core 8 | *.moc 9 | *.o 10 | *.obj 11 | *.orig 12 | *.rej 13 | *.so 14 | *.so.* 15 | *_pch.h.cpp 16 | *_resource.rc 17 | *.qm 18 | .#* 19 | *.*# 20 | core 21 | !core/ 22 | tags 23 | .DS_Store 24 | .directory 25 | *.debug 26 | Makefile* 27 | *.prl 28 | *.app 29 | moc_*.cpp 30 | ui_*.h 31 | qrc_*.cpp 32 | Thumbs.db 33 | *.res 34 | *.rc 35 | /.qmake.cache 36 | /.qmake.stash 37 | 38 | # qtcreator generated files 39 | *.pro.user* 40 | 41 | # xemacs temporary files 42 | *.flc 43 | 44 | # Vim temporary files 45 | .*.swp 46 | 47 | # Visual Studio generated files 48 | *.ib_pdb_index 49 | *.idb 50 | *.ilk 51 | *.pdb 52 | *.sln 53 | *.suo 54 | *.vcproj 55 | *vcproj.*.*.user 56 | *.ncb 57 | *.sdf 58 | *.opensdf 59 | *.vcxproj 60 | *vcxproj.* 61 | 62 | # MinGW generated files 63 | *.Debug 64 | *.Release 65 | 66 | # Python byte code 67 | *.pyc 68 | 69 | # Binaries 70 | # -------- 71 | *.dll 72 | *.exe 73 | 74 | -------------------------------------------------------------------------------- /3_2_virtual_hardware/main.cpp: -------------------------------------------------------------------------------- 1 | #include "virtualhardwaredialog.h" 2 | 3 | #include 4 | 5 | int main(int argc, char *argv[]) 6 | { 7 | QApplication a(argc, argv); 8 | VirtualHardwareDialog w; 9 | w.show(); 10 | return a.exec(); 11 | } 12 | -------------------------------------------------------------------------------- /3_2_virtual_hardware/net/comm.cpp: -------------------------------------------------------------------------------- 1 | 2 | 3 | #include "comm.h" 4 | 5 | namespace HYKT { 6 | 7 | const QList Comm::net_type_str_list_ = { 8 | "UDP broadcase", "UDP client", "UDP server", "TCP client", "TCP server"}; 9 | 10 | Comm::Comm() 11 | { 12 | 13 | } 14 | 15 | Comm::~Comm() 16 | { 17 | 18 | } 19 | 20 | QList Comm::GetNetTypeStrList() { 21 | return net_type_str_list_; 22 | } 23 | 24 | } //namespace HYKT 25 | 26 | -------------------------------------------------------------------------------- /3_2_virtual_hardware/net/netmanager.h: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | #ifndef NETMANAGER_H 5 | #define NETMANAGER_H 6 | 7 | 8 | #include "comm.h" 9 | #include "udpcomm.h" 10 | #include "tcpcomm.h" 11 | 12 | #include 13 | #include 14 | #include 15 | #include 16 | 17 | namespace HYKT { 18 | class NetManager : public QObject 19 | { 20 | Q_OBJECT 21 | public: 22 | NetManager(); 23 | ~NetManager(); 24 | 25 | static QList GetNetTypeStrList(); 26 | 27 | static QList GetIpListOfComputer(); 28 | 29 | int Open(int net_type, QString des_ip, quint16 des_port); 30 | void Close(); 31 | int Send(char *data, int len); 32 | int Send(const QByteArray &data); 33 | bool IsOpen(); 34 | 35 | signals: 36 | void onRecv(QByteArray *data, const QString ip, const quint16 port); 37 | void onError(int error_code, QString extra_error_info); 38 | 39 | private: 40 | void ConnectSignals(); 41 | void DisconnectSignals(); 42 | 43 | private: 44 | Comm *comm_p; 45 | 46 | }; 47 | } //namespace HYKT 48 | 49 | #endif // NETMANAGER_H 50 | -------------------------------------------------------------------------------- /3_2_virtual_hardware/net/tcpcomm.h: -------------------------------------------------------------------------------- 1 | 2 | 3 | #ifndef TCPCOMM_H 4 | #define TCPCOMM_H 5 | 6 | #include "comm.h" 7 | 8 | #include 9 | #include 10 | 11 | #include 12 | #include 13 | #include 14 | #include 15 | 16 | namespace HYKT { 17 | 18 | class TcpComm : public Comm 19 | { 20 | Q_OBJECT 21 | public: 22 | TcpComm(); 23 | ~TcpComm() override; 24 | 25 | virtual int Open(int net_type, QString des_ip, quint16 des_port) override; 26 | virtual void Close() override; 27 | virtual int Send(const char *data, int len) override; 28 | virtual int Send(const QByteArray &data) override; 29 | virtual bool IsOpen() override; 30 | 31 | private: 32 | virtual void DoRecv() override; 33 | virtual void DoError(QAbstractSocket::SocketError se) override; 34 | void DoOnDisconnected(); 35 | void DonewConnection(); 36 | 37 | private: 38 | QTcpSocket *tcp_p; 39 | QTcpServer *server_p; 40 | int net_type_; 41 | 42 | QString des_ip_; 43 | quint16 des_port_; 44 | 45 | QString received_client_ip_; 46 | quint16 received_client_port_; 47 | bool is_connected_; 48 | 49 | }; 50 | 51 | } //namespace HYKT 52 | 53 | #endif // TCPCOMM_H 54 | -------------------------------------------------------------------------------- /3_2_virtual_hardware/net/udpcomm.h: -------------------------------------------------------------------------------- 1 | 2 | 3 | #ifndef UDPCOMM_H 4 | #define UDPCOMM_H 5 | 6 | #include "comm.h" 7 | 8 | #include 9 | #include 10 | #include 11 | #include 12 | #include 13 | 14 | namespace HYKT { 15 | 16 | class UdpComm : public Comm 17 | { 18 | Q_OBJECT 19 | public: 20 | UdpComm(); 21 | ~UdpComm() override; 22 | 23 | virtual int Open(int net_type, QString des_ip, quint16 des_port) override; 24 | virtual void Close() override; 25 | virtual int Send(const char *data, int len) override; 26 | virtual int Send(const QByteArray &data) override; 27 | virtual bool IsOpen() override; 28 | 29 | private: 30 | virtual void DoRecv() override; 31 | virtual void DoError(QAbstractSocket::SocketError se) override; 32 | void DoOnDisconnected(); 33 | 34 | private: 35 | QUdpSocket *udp_p; 36 | int net_type_; 37 | 38 | QString des_ip_; 39 | quint16 des_port_; 40 | 41 | QString received_client_ip_; 42 | quint16 received_client_port_; 43 | 44 | }; 45 | 46 | } //namespace HYKT 47 | 48 | 49 | 50 | #endif // UDPCOMM_H 51 | -------------------------------------------------------------------------------- /3_2_virtual_hardware/protocol/crc.cpp: -------------------------------------------------------------------------------- 1 | 2 | 3 | #include "crc.h" 4 | 5 | namespace HYKT { 6 | 7 | Crc::Crc() 8 | { 9 | 10 | } 11 | 12 | Crc::~Crc() 13 | { 14 | 15 | } 16 | 17 | void Crc::GetCRC(quint8 *data, int len, quint16 &crc) { 18 | quint16 i,j,carry_flag, temp; 19 | 20 | crc = 0xffff; 21 | 22 | for (i = 0; i < len; i++) { 23 | crc = crc ^ data[i]; 24 | for (j = 0; j < 8; j ++) { 25 | temp = crc; 26 | carry_flag = temp & 0x0001; 27 | crc = crc >> 1; 28 | 29 | if (carry_flag == 1) { 30 | crc = crc ^ 0xa001; 31 | } 32 | } 33 | } 34 | } 35 | 36 | 37 | bool Crc::CheckCRC(quint8 *data, int len) { 38 | if (len < 2) return false; 39 | 40 | quint16 crcLow = data[len - 1]; 41 | quint16 crcHigh = data[len - 2]; 42 | quint16 crc_received = static_cast(crcHigh << 8 | crcLow); 43 | quint16 crc_new; 44 | 45 | GetCRC(data, len - 2, crc_new); 46 | 47 | if (crc_new == crc_received) { 48 | return true; 49 | } 50 | 51 | return false; 52 | } 53 | 54 | } //namespace HYKT 55 | -------------------------------------------------------------------------------- /3_2_virtual_hardware/protocol/crc.h: -------------------------------------------------------------------------------- 1 | 2 | 3 | #ifndef CRC_H 4 | #define CRC_H 5 | 6 | 7 | #include "qglobal.h" 8 | 9 | namespace HYKT { 10 | 11 | class Crc 12 | { 13 | private: 14 | Crc(); 15 | ~Crc(); 16 | public: 17 | static void GetCRC(quint8 *data, int len, quint16 &crc); 18 | static bool CheckCRC(quint8 *data, int len); 19 | }; 20 | 21 | } //namespace HYKT 22 | 23 | #endif // CRC_H 24 | -------------------------------------------------------------------------------- /3_2_virtual_hardware/utils/byteutil.cpp: -------------------------------------------------------------------------------- 1 | #include "byteutil.h" 2 | 3 | namespace HYKT { 4 | 5 | ByteUtil::ByteUtil() 6 | { 7 | 8 | } 9 | 10 | char ByteUtil::Byte2Char(const byte byte) { 11 | char ret = 0x00; 12 | ret = ret | byte; 13 | return ret; 14 | } 15 | 16 | byte ByteUtil::Char2Byte(const char ch) { 17 | byte by = 0x00; 18 | by = static_cast(by | ch); 19 | return by; 20 | } 21 | 22 | //only last 8bit of int is saved 23 | char ByteUtil::Int2Char(const int value) { 24 | return Byte2Char(static_cast(value)); 25 | } 26 | 27 | int ByteUtil::Char2Int(const char ch) { 28 | byte t = Char2Byte(ch); 29 | return static_cast(t); 30 | } 31 | 32 | 33 | void ByteUtil::ByteArray2CharArray(const byte * src, char *dst, int len) { 34 | for (int a = 0; a < len; a++) { 35 | dst[a] = Byte2Char(src[a]); 36 | } 37 | } 38 | 39 | void ByteUtil::CharArray2ByteArray(const char * src, byte *dst, int len) { 40 | for (int a = 0; a < len; a++) { 41 | dst[a] = Char2Byte(src[a]); 42 | } 43 | } 44 | 45 | } //namespace HYKT 46 | -------------------------------------------------------------------------------- /3_2_virtual_hardware/utils/byteutil.h: -------------------------------------------------------------------------------- 1 | 2 | 3 | #ifndef BYTEUTIL_H 4 | #define BYTEUTIL_H 5 | 6 | typedef unsigned char byte; 7 | 8 | namespace HYKT { 9 | 10 | class ByteUtil 11 | { 12 | private: 13 | ByteUtil(); 14 | 15 | public: 16 | static char Byte2Char(const byte byte); 17 | static byte Char2Byte(const char ch); 18 | 19 | static char Int2Char(const int value);//only last 8bit of int is saved 20 | static int Char2Int(const char ch); 21 | 22 | static void ByteArray2CharArray(const byte * src, char *dst, int len); 23 | static void CharArray2ByteArray(const char * src, byte *dst, int len); 24 | }; 25 | } //namespace HYKT 26 | 27 | #endif // BYTEUTIL_H 28 | -------------------------------------------------------------------------------- /3_2_virtual_hardware/virtualhardwaredialog.h: -------------------------------------------------------------------------------- 1 | #ifndef VIRTUALHARDWAREDIALOG_H 2 | #define VIRTUALHARDWAREDIALOG_H 3 | 4 | #include 5 | #include "./net/netmanager.h" 6 | using namespace HYKT; 7 | 8 | QT_BEGIN_NAMESPACE 9 | namespace Ui { class VirtualHardwareDialog; } 10 | QT_END_NAMESPACE 11 | 12 | class VirtualHardwareDialog : public QDialog 13 | { 14 | Q_OBJECT 15 | 16 | public: 17 | VirtualHardwareDialog(QWidget *parent = nullptr); 18 | ~VirtualHardwareDialog(); 19 | 20 | private slots: 21 | void on_pushButtonStartService_clicked(); 22 | 23 | void on_pushButtonReport_clicked(); 24 | 25 | private: 26 | void SearchingDeviceRecv(QByteArray *data, const QString ip, const quint16 port); 27 | void SearchingDeviceError(int error_code, QString extra_error_info); 28 | void CommunicationRecv(QByteArray *data, const QString ip, const quint16 port); 29 | void CommunicationError(int error_code, QString extra_error_info); 30 | 31 | 32 | private: 33 | Ui::VirtualHardwareDialog *ui; 34 | 35 | NetManager *net_udp_communication_service_p; 36 | NetManager *net_udp_searching_device_service_p; 37 | 38 | 39 | }; 40 | #endif // VIRTUALHARDWAREDIALOG_H 41 | -------------------------------------------------------------------------------- /3_2_winform_protocol_structure_demo/.vs/3_2_winform_protocol_structure_demo/v16/.suo: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/robert1207/UpperComputerProgramingGuideSrc/dd8afb9d94d21580f19863a21fa23378dafa96ee/3_2_winform_protocol_structure_demo/.vs/3_2_winform_protocol_structure_demo/v16/.suo -------------------------------------------------------------------------------- /3_2_winform_protocol_structure_demo/.vs/3_2_winform_protocol_structure_demo/v16/Server/sqlite3/db.lock: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/robert1207/UpperComputerProgramingGuideSrc/dd8afb9d94d21580f19863a21fa23378dafa96ee/3_2_winform_protocol_structure_demo/.vs/3_2_winform_protocol_structure_demo/v16/Server/sqlite3/db.lock -------------------------------------------------------------------------------- /3_2_winform_protocol_structure_demo/.vs/3_2_winform_protocol_structure_demo/v16/Server/sqlite3/storage.ide: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/robert1207/UpperComputerProgramingGuideSrc/dd8afb9d94d21580f19863a21fa23378dafa96ee/3_2_winform_protocol_structure_demo/.vs/3_2_winform_protocol_structure_demo/v16/Server/sqlite3/storage.ide -------------------------------------------------------------------------------- /3_2_winform_protocol_structure_demo/3_2_winform_protocol_structure_demo/App.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /3_2_winform_protocol_structure_demo/3_2_winform_protocol_structure_demo/DeviceFinding/DeviceInfo.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | 4 | namespace HYKT 5 | { 6 | class DeviceInfo 7 | { 8 | 9 | public String Ip { get; set; } 10 | public String SN { get; set; } 11 | public String Version { get; set; } 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /3_2_winform_protocol_structure_demo/3_2_winform_protocol_structure_demo/Program.cs: -------------------------------------------------------------------------------- 1 |  2 | using System; 3 | using System.Collections.Generic; 4 | using System.Linq; 5 | using System.Threading.Tasks; 6 | using System.Windows.Forms; 7 | 8 | namespace _3_2_winform_protocol_structure_demo 9 | { 10 | static class Program 11 | { 12 | /// 13 | /// 应用程序的主入口点。 14 | /// 15 | [STAThread] 16 | static void Main() 17 | { 18 | Application.EnableVisualStyles(); 19 | Application.SetCompatibleTextRenderingDefault(false); 20 | Application.Run(new DemoDialog()); 21 | } 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /3_2_winform_protocol_structure_demo/3_2_winform_protocol_structure_demo/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.CompilerServices; 3 | using System.Runtime.InteropServices; 4 | 5 | // 有关程序集的一般信息由以下 6 | // 控制。更改这些特性值可修改 7 | // 与程序集关联的信息。 8 | [assembly: AssemblyTitle("3_2_winform_protocol_structure_demo")] 9 | [assembly: AssemblyDescription("")] 10 | [assembly: AssemblyConfiguration("")] 11 | [assembly: AssemblyCompany("")] 12 | [assembly: AssemblyProduct("3_2_winform_protocol_structure_demo")] 13 | [assembly: AssemblyCopyright("Copyright © 2020")] 14 | [assembly: AssemblyTrademark("")] 15 | [assembly: AssemblyCulture("")] 16 | 17 | // 将 ComVisible 设置为 false 会使此程序集中的类型 18 | //对 COM 组件不可见。如果需要从 COM 访问此程序集中的类型 19 | //请将此类型的 ComVisible 特性设置为 true。 20 | [assembly: ComVisible(false)] 21 | 22 | // 如果此项目向 COM 公开,则下列 GUID 用于类型库的 ID 23 | [assembly: Guid("c3119de1-d1eb-48ab-b9cf-7d475fc9a71b")] 24 | 25 | // 程序集的版本信息由下列四个值组成: 26 | // 27 | // 主版本 28 | // 次版本 29 | // 生成号 30 | // 修订号 31 | // 32 | //可以指定所有这些值,也可以使用“生成号”和“修订号”的默认值 33 | //通过使用 "*",如下所示: 34 | // [assembly: AssemblyVersion("1.0.*")] 35 | [assembly: AssemblyVersion("1.0.0.0")] 36 | [assembly: AssemblyFileVersion("1.0.0.0")] 37 | -------------------------------------------------------------------------------- /3_2_winform_protocol_structure_demo/3_2_winform_protocol_structure_demo/Properties/Settings.Designer.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------------ 2 | // 3 | // This code was generated by a tool. 4 | // Runtime Version:4.0.30319.42000 5 | // 6 | // Changes to this file may cause incorrect behavior and will be lost if 7 | // the code is regenerated. 8 | // 9 | //------------------------------------------------------------------------------ 10 | 11 | namespace _3_2_winform_protocol_structure_demo.Properties 12 | { 13 | 14 | 15 | [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] 16 | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "11.0.0.0")] 17 | internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase 18 | { 19 | 20 | private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings()))); 21 | 22 | public static Settings Default 23 | { 24 | get 25 | { 26 | return defaultInstance; 27 | } 28 | } 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /3_2_winform_protocol_structure_demo/3_2_winform_protocol_structure_demo/Properties/Settings.settings: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /3_2_winform_protocol_structure_demo/3_2_winform_protocol_structure_demo/Protocol/Work.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | 6 | namespace HYKT 7 | { 8 | class Work 9 | { 10 | public Work() { 11 | FailedTimes = 0; 12 | } 13 | 14 | public int FailedTimes { get; set; } 15 | public byte[] Data { get; set; } 16 | 17 | public bool CheckResponse(byte[] returnData) { 18 | if (returnData[0] == Data[2] && returnData[1] == Data[3]) { return true; } 19 | return false; 20 | } 21 | 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /3_2_winform_protocol_structure_demo/3_2_winform_protocol_structure_demo/obj/Debug/3_2_winform_protocol_structure_demo.csproj.CoreCompileInputs.cache: -------------------------------------------------------------------------------- 1 | b4c67276991777a5a6f38babaf326ebf4e9d5d78 2 | -------------------------------------------------------------------------------- /3_2_winform_protocol_structure_demo/3_2_winform_protocol_structure_demo/obj/Debug/3_2_winform_protocol_structure_demo.csproj.GenerateResource.cache: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/robert1207/UpperComputerProgramingGuideSrc/dd8afb9d94d21580f19863a21fa23378dafa96ee/3_2_winform_protocol_structure_demo/3_2_winform_protocol_structure_demo/obj/Debug/3_2_winform_protocol_structure_demo.csproj.GenerateResource.cache -------------------------------------------------------------------------------- /3_2_winform_protocol_structure_demo/3_2_winform_protocol_structure_demo/obj/Debug/3_2_winform_protocol_structure_demo.csprojAssemblyReference.cache: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/robert1207/UpperComputerProgramingGuideSrc/dd8afb9d94d21580f19863a21fa23378dafa96ee/3_2_winform_protocol_structure_demo/3_2_winform_protocol_structure_demo/obj/Debug/3_2_winform_protocol_structure_demo.csprojAssemblyReference.cache -------------------------------------------------------------------------------- /3_2_winform_protocol_structure_demo/3_2_winform_protocol_structure_demo/obj/Debug/3_2_winform_protocol_structure_demo.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/robert1207/UpperComputerProgramingGuideSrc/dd8afb9d94d21580f19863a21fa23378dafa96ee/3_2_winform_protocol_structure_demo/3_2_winform_protocol_structure_demo/obj/Debug/3_2_winform_protocol_structure_demo.exe -------------------------------------------------------------------------------- /3_2_winform_protocol_structure_demo/3_2_winform_protocol_structure_demo/obj/Debug/3_2_winform_protocol_structure_demo.pdb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/robert1207/UpperComputerProgramingGuideSrc/dd8afb9d94d21580f19863a21fa23378dafa96ee/3_2_winform_protocol_structure_demo/3_2_winform_protocol_structure_demo/obj/Debug/3_2_winform_protocol_structure_demo.pdb -------------------------------------------------------------------------------- /3_2_winform_protocol_structure_demo/3_2_winform_protocol_structure_demo/obj/Debug/DesignTimeResolveAssemblyReferences.cache: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/robert1207/UpperComputerProgramingGuideSrc/dd8afb9d94d21580f19863a21fa23378dafa96ee/3_2_winform_protocol_structure_demo/3_2_winform_protocol_structure_demo/obj/Debug/DesignTimeResolveAssemblyReferences.cache -------------------------------------------------------------------------------- /3_2_winform_protocol_structure_demo/3_2_winform_protocol_structure_demo/obj/Debug/DesignTimeResolveAssemblyReferencesInput.cache: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/robert1207/UpperComputerProgramingGuideSrc/dd8afb9d94d21580f19863a21fa23378dafa96ee/3_2_winform_protocol_structure_demo/3_2_winform_protocol_structure_demo/obj/Debug/DesignTimeResolveAssemblyReferencesInput.cache -------------------------------------------------------------------------------- /3_2_winform_protocol_structure_demo/3_2_winform_protocol_structure_demo/obj/Debug/_3_2_winform_protocol_structure_demo.DemoDialog.resources: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/robert1207/UpperComputerProgramingGuideSrc/dd8afb9d94d21580f19863a21fa23378dafa96ee/3_2_winform_protocol_structure_demo/3_2_winform_protocol_structure_demo/obj/Debug/_3_2_winform_protocol_structure_demo.DemoDialog.resources -------------------------------------------------------------------------------- /3_2_winform_protocol_structure_demo/3_2_winform_protocol_structure_demo/obj/Debug/_3_2_winform_protocol_structure_demo.Form1.resources: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/robert1207/UpperComputerProgramingGuideSrc/dd8afb9d94d21580f19863a21fa23378dafa96ee/3_2_winform_protocol_structure_demo/3_2_winform_protocol_structure_demo/obj/Debug/_3_2_winform_protocol_structure_demo.Form1.resources -------------------------------------------------------------------------------- /3_2_winform_protocol_structure_demo/3_2_winform_protocol_structure_demo/obj/Debug/_3_2_winform_protocol_structure_demo.Properties.Resources.resources: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/robert1207/UpperComputerProgramingGuideSrc/dd8afb9d94d21580f19863a21fa23378dafa96ee/3_2_winform_protocol_structure_demo/3_2_winform_protocol_structure_demo/obj/Debug/_3_2_winform_protocol_structure_demo.Properties.Resources.resources -------------------------------------------------------------------------------- /4_3_prototype_drawing_demo/原型图演示动画.mp4: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/robert1207/UpperComputerProgramingGuideSrc/dd8afb9d94d21580f19863a21fa23378dafa96ee/4_3_prototype_drawing_demo/原型图演示动画.mp4 -------------------------------------------------------------------------------- /4_3_prototype_drawing_demo/电子书阅读器的原型图.rp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/robert1207/UpperComputerProgramingGuideSrc/dd8afb9d94d21580f19863a21fa23378dafa96ee/4_3_prototype_drawing_demo/电子书阅读器的原型图.rp -------------------------------------------------------------------------------- /4_4_ui_design_doc/ui设计图/主界面图.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/robert1207/UpperComputerProgramingGuideSrc/dd8afb9d94d21580f19863a21fa23378dafa96ee/4_4_ui_design_doc/ui设计图/主界面图.png -------------------------------------------------------------------------------- /4_4_ui_design_doc/ui设计图/分享对话框.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/robert1207/UpperComputerProgramingGuideSrc/dd8afb9d94d21580f19863a21fa23378dafa96ee/4_4_ui_design_doc/ui设计图/分享对话框.png -------------------------------------------------------------------------------- /4_4_ui_design_doc/ui设计图/删除确认对话框.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/robert1207/UpperComputerProgramingGuideSrc/dd8afb9d94d21580f19863a21fa23378dafa96ee/4_4_ui_design_doc/ui设计图/删除确认对话框.png -------------------------------------------------------------------------------- /4_4_ui_design_doc/ui设计图/导入对话框.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/robert1207/UpperComputerProgramingGuideSrc/dd8afb9d94d21580f19863a21fa23378dafa96ee/4_4_ui_design_doc/ui设计图/导入对话框.png -------------------------------------------------------------------------------- /4_4_ui_design_doc/ui设计图/电子书阅读器UI设计图_交互.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/robert1207/UpperComputerProgramingGuideSrc/dd8afb9d94d21580f19863a21fa23378dafa96ee/4_4_ui_design_doc/ui设计图/电子书阅读器UI设计图_交互.png -------------------------------------------------------------------------------- /4_4_ui_design_doc/尺寸标注图/尺寸标注总图.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/robert1207/UpperComputerProgramingGuideSrc/dd8afb9d94d21580f19863a21fa23378dafa96ee/4_4_ui_design_doc/尺寸标注图/尺寸标注总图.png -------------------------------------------------------------------------------- /4_4_ui_design_doc/尺寸标注图/电子书阅读器_主界面图_尺寸标注.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/robert1207/UpperComputerProgramingGuideSrc/dd8afb9d94d21580f19863a21fa23378dafa96ee/4_4_ui_design_doc/尺寸标注图/电子书阅读器_主界面图_尺寸标注.png -------------------------------------------------------------------------------- /4_4_ui_design_doc/尺寸标注图/电子书阅读器_分享对话框_尺寸标注.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/robert1207/UpperComputerProgramingGuideSrc/dd8afb9d94d21580f19863a21fa23378dafa96ee/4_4_ui_design_doc/尺寸标注图/电子书阅读器_分享对话框_尺寸标注.png -------------------------------------------------------------------------------- /4_4_ui_design_doc/尺寸标注图/电子书阅读器_删除确认对话框_尺寸标注.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/robert1207/UpperComputerProgramingGuideSrc/dd8afb9d94d21580f19863a21fa23378dafa96ee/4_4_ui_design_doc/尺寸标注图/电子书阅读器_删除确认对话框_尺寸标注.png -------------------------------------------------------------------------------- /4_4_ui_design_doc/尺寸标注图/电子书阅读器_导入对话框_尺寸标注.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/robert1207/UpperComputerProgramingGuideSrc/dd8afb9d94d21580f19863a21fa23378dafa96ee/4_4_ui_design_doc/尺寸标注图/电子书阅读器_导入对话框_尺寸标注.png -------------------------------------------------------------------------------- /4_4_ui_design_doc/所有源psd文件/主界面图.psd: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/robert1207/UpperComputerProgramingGuideSrc/dd8afb9d94d21580f19863a21fa23378dafa96ee/4_4_ui_design_doc/所有源psd文件/主界面图.psd -------------------------------------------------------------------------------- /4_4_ui_design_doc/所有源psd文件/分享对话框.psd: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/robert1207/UpperComputerProgramingGuideSrc/dd8afb9d94d21580f19863a21fa23378dafa96ee/4_4_ui_design_doc/所有源psd文件/分享对话框.psd -------------------------------------------------------------------------------- /4_4_ui_design_doc/所有源psd文件/删除确认对话框.psd: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/robert1207/UpperComputerProgramingGuideSrc/dd8afb9d94d21580f19863a21fa23378dafa96ee/4_4_ui_design_doc/所有源psd文件/删除确认对话框.psd -------------------------------------------------------------------------------- /4_4_ui_design_doc/所有源psd文件/导入对话框.psd: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/robert1207/UpperComputerProgramingGuideSrc/dd8afb9d94d21580f19863a21fa23378dafa96ee/4_4_ui_design_doc/所有源psd文件/导入对话框.psd -------------------------------------------------------------------------------- /4_4_ui_design_doc/所有源psd文件/尺寸标注总图.psd: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/robert1207/UpperComputerProgramingGuideSrc/dd8afb9d94d21580f19863a21fa23378dafa96ee/4_4_ui_design_doc/所有源psd文件/尺寸标注总图.psd -------------------------------------------------------------------------------- /4_4_ui_design_doc/所有源psd文件/电子书阅读器.pxcp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/robert1207/UpperComputerProgramingGuideSrc/dd8afb9d94d21580f19863a21fa23378dafa96ee/4_4_ui_design_doc/所有源psd文件/电子书阅读器.pxcp -------------------------------------------------------------------------------- /4_4_ui_design_doc/所有源psd文件/电子书阅读器UI设计图_交互.psd: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/robert1207/UpperComputerProgramingGuideSrc/dd8afb9d94d21580f19863a21fa23378dafa96ee/4_4_ui_design_doc/所有源psd文件/电子书阅读器UI设计图_交互.psd -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2020 Robert 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # UpperComputerProgramingGuideSrc 2 | 3 | Source code for upper computer programing guide. 4 | 5 | *注:本目录中所有使用Qt编写的工程,均支持在MacOS、Windows下正确运行。在Linux系统下理论上完全支持,但是没有实际测试过。* 6 | 7 | #### 目录说明 8 | | 编号 | 文件夹 | 描述 | 9 | | ------ | ------ | ------ | 10 | | 1 | 2_2_qt_serial_port_gui_tool | qt串口小助手 | 11 | | 2 | 2_2_winform_serial_port_gui_tool | winform串口小助手 | 12 | | 3 | 2_4_qt_net_tcp_udp_gui_tool | qt网络Tcp/Udp调试小助手 | 13 | | 4 | 2_4_winform_net_tcp_udp_gui_tool | winform网络Tcp/Udp调试小助手 | 14 | | 5 | 2_9_qt_net_finding_device | qt查找局域网网络设备 | 15 | | 6 | 2_9_winform_net_finding_device | winform查找局域网网络设备 | 16 | | 7 | 3_2_qt_protocol_structure_demo | qt上位机通信构架示例 | 17 | | 8 | 3_2_virtual_hardware | 下位机模拟器(仅用于测试本通信框架) | 18 | | 9 | 3_2_winform_protocol_structure_demo | winform上位机通信构架示例 | 19 | | 10 | 4_3_prototype_drawing_demo | 电子书阅读器原型图工程文件 | 20 | | 11 | 4_4_ui_design_doc | 电子书阅读器Ui设计图源文件 | 21 | | 12 | 12_4_qt_log4qt_demo | qt中使用log4qt的示例代码 | 22 | | 13 | 12_5_qt_breakpad_demo | qt中使用Breakpad的示例代码 | 23 | | 14 | 13_3_stm32_iap_downloader_tool | qt制作一款私有IAP串口下载小工具的上位机源码(串口实现3章的通信构架) | 24 | | 14 | 13_5_stm32_iap_bootloader | qt制作一款私有IAP串口下载小工具的STM32源码(串口实现3章的通信构架) | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | --------------------------------------------------------------------------------