diff --git a/Analyser/ModuleCommunication.cpp b/Analyser/ModuleCommunication.cpp index 1bbb9e2..a2a2ed2 100644 --- a/Analyser/ModuleCommunication.cpp +++ b/Analyser/ModuleCommunication.cpp @@ -362,29 +362,31 @@ void ModuleCommunication::processPackage(const uint8_t *data, uint16_t size) { break; } case Note: { - uint8_t noteId = data[5]; + auto noteId = static_cast(data[5]); switch (noteId) { - case Ready: { + case NoteId::Ready: { LOG_CAT(info, GUI) << "模组: " << protocolDataFormatString(data, size); LOG_CAT(info, GUI) << "模组上电初始化成功。"; LOG_CAT(info, GUI) << Separator; break; } - case PalmState: { // 模组返回的数据为当前帧的手掌状态 + case NoteId::PalmState: { // 模组返回的数据为当前帧的手掌状态 + auto state = reinterpret_cast(data + 6); + LOG(info) << "palm state: " << (int)ntohs(state->state); break; } - case UnknownError: { + case NoteId::UnknownError: { LOG_CAT(info, GUI) << "模组: " << protocolDataFormatString(data, size); LOG_CAT(info, GUI) << "未知错误。"; LOG_CAT(info, GUI) << Separator; break; } - case DebugInfo: { + case NoteId::DebugInfo: { auto message = reinterpret_cast(data + 6); LOG_CAT(info, GUI) << "模组日志: " << message; break; } - case NoAliveImage: { + case NoteId::NoAliveImage: { LOG(info) << "no alive image"; emit newImageInfo(Note, 600 * 800, nullptr); break; diff --git a/Analyser/ModuleCommunication.h b/Analyser/ModuleCommunication.h index 1e84c87..7964c1c 100644 --- a/Analyser/ModuleCommunication.h +++ b/Analyser/ModuleCommunication.h @@ -42,13 +42,20 @@ public: }; Q_ENUM(MessageId) - enum NoteId : uint8_t { + enum class NoteId : uint8_t { Ready = 0x00, PalmState = 0x01, UnknownError = 0x02, DebugInfo = 0x55, NoAliveImage = 0x56, }; + + enum PalmState { + NoPalm = 1, + NeedMoveToCenter = 15, + NoAlive = 122, + }; + enum MessageStatus : uint8_t { Success = 0, Rejected = 1, @@ -75,17 +82,14 @@ public: uint8_t save_image; uint8_t timeout; // timeout, unit second, default 10s }; - struct VerifyNoteInfo { - int16_t state; // corresponding to PALM_STATE_* + + struct PalmStateNote { + uint16_t state; // position - int16_t left; // in pixel - int16_t top; - int16_t right; - int16_t bottom; - // pose - int16_t yaw; // up and down in vertical orientation - int16_t pitch; // right or left turned in horizontal orientation - int16_t roll; // slope + uint16_t left; // in pixel + uint16_t top; + uint16_t right; + uint16_t bottom; }; struct EnrollData { diff --git a/CMakeLists.txt b/CMakeLists.txt index 6a7af9b..bfc8497 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -27,6 +27,10 @@ endif() option(Boost_USE_STATIC_LIBS OFF) +set(OpenSSL_ROOT D:/Qt/Tools/OpenSSLv3/Win_x64) +set(OPENSSL_INCLUDE_DIR ${OpenSSL_ROOT}/include) +set(OpenSSL_LIBRARY_DIRS ${OpenSSL_ROOT}/lib) +set(OpenSSL_LIBRARIES libssl libcrypto) set(FFmpeg_ROOT ${Libraries_ROOT}/ffmpeg-7.0.1-full_build-shared) set(FFmpeg_INCLUDE_DIR ${FFmpeg_ROOT}/include) @@ -42,6 +46,7 @@ include(FetchContent) FetchContent_Declare(Kylin GIT_REPOSITORY https://gitea.amass.fun/amass/Kylin.git ) +set(KYLIN_WITH_FLUENT ON) FetchContent_MakeAvailable(Kylin) add_subdirectory(Peripheral)