12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667 |
- // // ******************************************************************
- // // /\ /| @File RS232Decode.h
- // // \ V/ @Brief
- // // | "") @Author lijinwen, ghz005@uni-trend.com.cn
- // // / | @Creation 2024-5-7
- // // / \\ @Modified 2024-5-13
- // // *(__\_\
- // // ******************************************************************
- #pragma once
- #include <cstdint>
- #include <future>
- //#include <mutex>
- #include "../BaseHelper/CommonHelper.h"
- // #include "../CommonBase/EnumTypeInfo.h"
- #include "../EdgePulseData.h"
- // #include "Constants.h"
- #include "ProtocolRS232Enums.h"
- #include "RS232Params.h"
- #include "RS232DecodeResult.h"
- //#include "RS232Packet.h"
- #include "../ProtocolDecodeBase.h"
- #include "../BaseHelper/Logger.h"
- namespace Protocol::ProtocolRS232
- {
- class RS232Decode : public ProtocolDecodeBase
- {
- private:
- static bool GetRS232Bit(TwoLevelEdgePulse*& edgePulse,
- int32_t targetIndex, TwoLevelEdgePulseStatusType& status);
- std::vector<const char*> EventInfoTitles_ = {
- "Index", "Start Time", "Data", "Parity", "Error"
- };
- std::vector<const char*> GetEventInfoTitles();
- static int32_t GetStartIndex(const RS232DecodeParams& options, TwoLevelEdgePulse*& node,
- double count,
- double& realCount,
- int32_t startIndex,
- TwoLevelEdgePulseStatusType& startStatus);
- bool ParseData(const RS232DecodeParams& options);
- //与对象生命周期一样长的数据存储
- RS232DecodeResult RS232DecodeResult_ = {};
- DecodeResult DecodeResultBase_ = {};
- std::vector<RS232DecodeResultUnit> DecodeResultUnits_;
- std::vector<RS232DecodeEventUnit> DecodeEventUnitsStorage_;
- std::vector<RS232DecodeEvent> DecodeEvents_;
- std::vector<RS232Packet> RS232Packets_;
- protected:
- void Decode(const DecodeParams* decodeParams) override;
- void QuantizeDecode(const QuantizeParams& decodeParams) override;
- public:
- DecodeResult* GetResult() override;
- ~RS232Decode() override;
- };
- //
- // //外部调用
- // extern "C" {
- // inline __declspec(dllexport) bool DecodeRS232Export(RS232Decode* decoder, const RS232DecodeParams& options);
- // }
- }
|