12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061 |
- // // ******************************************************************
- // // /\ /| @File rs232_decoder.h
- // // \ V/ @Brief
- // // | "") @Author lijinwen, ghz005@uni-trend.com.cn
- // // / | @Creation 2024-06-26
- // // / \\ @Modified 2024-07-16
- // // *(__\_\
- // // ******************************************************************
- #pragma once
- #include <cstdint>
- #include <future>
- #include "../BaseHelper/common_helper.h"
- // #include "../CommonBase/EnumTypeInfo.h"
- #include "../edge_pulse_data.h"
- // #include "Constants.h"
- #include "protocol_rs232_enums.h"
- #include "rs232_decode_result.h"
- //#include "rs232_packet.h"
- #include "../protocol_decode_base.h"
- #include "protocol_rs232_options.h"
- #include "../BaseHelper/loger.h"
- namespace Protocol
- {
- class Rs232Decoder
- {
- public:
-
- std::vector<const char*> GetEventInfoTitles();
- bool DecodeRs232(const ProtocolRs232Options& options, TwoLevelEdgePulse* edge_pulses,
- uint64_t edge_pulse_count,
- uint64_t waveform_data_count, double sample_rate,
- Rs232DecodeResult& decode_result);
- bool QuantizeParamsDecodeRs232(const QuantizeParams& quantize_params, const ProtocolRs232Options& options,
- Rs232DecodeResult& decode_result);
- private:
- bool* is_cancel_ptr_ = nullptr;
- std::vector<const char*> event_info_titles_ = {
- "Index", "Start Time", "Data", "Parity", "Error"
- };
- std::vector<Rs232DecodeResultCell> decode_result_units_;
- std::vector<Rs232DecodeEventUnit> decode_event_units_storage_;
- std::vector<Rs232DecodeEvent> decode_events_;
- static bool GetRs232Bit(TwoLevelEdgePulse*& edge_pulse,
- int32_t target_index, TwoLevelEdgePulseStatusType& status);
-
- static int32_t GetStartIndex(const ProtocolRs232Options& options, TwoLevelEdgePulse*& node,
- double count,
- double& real_count,
- int32_t start_index,
- TwoLevelEdgePulseStatusType& start_status);
- bool ParseRs232(const ProtocolRs232Options& options,
- const EdgePulseDataTwoLevels& edge_pulse_data,
- Rs232DecodeResult& decode_result);
- };
- }
|