lijinwen 3 mesi fa
parent
commit
4241df346b

+ 22 - 13
ExportMethod.h

@@ -26,25 +26,34 @@
 namespace Protocol
 {
     extern "C" {
-    LIBMATH_API bool Parse_USB(UsbDecodeOptions option, const EdgePulseDataTwoLevels& edge_pluses_data1,
-                               const EdgePulseDataTwoLevels& edge_pluses_data2, UsbDecodeResult& result);
+        LIBMATH_API bool Parse_USB(UsbDecodeOptions option, const EdgePulseDataTwoLevels& edge_pluses_data1,
+                                   const EdgePulseDataTwoLevels& edge_pluses_data2, UsbDecodeResult& result);
 
 
-    LIBMATH_API bool Parse_RS232(const ProtocolRS232Options& options,
-                                 const EdgePulseDataTwoLevels& edgePulseData,
-                                 RS232DecodeResult& decodeResult);
+        LIBMATH_API bool Parse_RS232(const ProtocolRS232Options& options,
+                                     const EdgePulseDataTwoLevels& edgePulseData,
+                                     RS232DecodeResult& decodeResult);
 
-    // LIBMATH_API bool quantizeParamsDecodeRS232(const QuantizeParams& quantizeParams,
-    //                                            const ProtocolRS232Options& options,
-    //                                            RS232DecodeResult& decodeResult);
+        // LIBMATH_API bool quantizeParamsDecodeRS232(const QuantizeParams& quantizeParams,
+        //                                            const ProtocolRS232Options& options,
+        //                                            RS232DecodeResult& decodeResult);
 
 
-    inline LIBMATH_API void SetCancellationSignal(bool value)
-    {
-        canceled = value;
-    }
+        inline LIBMATH_API void SetCancellationSignal(bool value)
+        {
+            canceled = value;
+        }
 
-    LIBMATH_API void GetVersionExport(uint8_t* version);
+        inline LIBMATH_API void GetVersionExport(uint8_t* version)
+        {
+            // 将字符串转换为字符数组
+            constexpr char version_string[] = DLL_VERSION;
 
+            // 遍历字符串,将其转换为字节数组
+            for (size_t i = 0; i < sizeof(version_string); ++i)
+            {
+                version[i] = static_cast<unsigned char>(version_string[i]);
+            }
+        }
     }
 }

+ 1 - 1
ProtocolDecodeBase.h

@@ -20,7 +20,7 @@
 #include "BaseEnums/ProtocolEnums.h"
 #include "BaseHelper/Logger.h"
 
-#define DLL_VERSION "0.1.0"
+#define DLL_VERSION "0.1.2"
 
 namespace Protocol
 {

+ 3 - 3
ProtocolUSB/USBDecoder.cpp

@@ -29,14 +29,14 @@ namespace Protocol
 	{
 		std::vector<Protocol::TwoLevelEdgePulse> edge_pulses1 = {};
 
-		if (&edge_pulses_dp != NULL && edge_pulses_dp.WaveformDataCount > 0)
+		if (&edge_pulses_dp != nullptr && edge_pulses_dp.WaveformDataCount > 0)
 		{
 			edge_pulses1 =
 				CommonHelper::ConvertPointerArrayToVector<Protocol::TwoLevelEdgePulse>(
 					edge_pulses_dp.GetDataAddrPtr(), edge_pulses_dp.EdgePulsesCount);
 		}
 		std::vector<Protocol::TwoLevelEdgePulse> edge_pulses2 = {};
-		if (&edge_pulses_dm != NULL && edge_pulses_dm.WaveformDataCount > 0)
+		if (&edge_pulses_dm != nullptr && edge_pulses_dm.WaveformDataCount > 0)
 		{
 			edge_pulses2 = CommonHelper::ConvertPointerArrayToVector<Protocol::TwoLevelEdgePulse>(
 				edge_pulses_dm.GetDataAddrPtr(), edge_pulses_dm.EdgePulsesCount);
@@ -359,7 +359,7 @@ namespace Protocol
 			if (eop_index <= 0)
 			{
 				//如果存在后续同步帧,用下个同步帧头-1的起始做可能结束 
-				if (static_cast<int32_t>(all_sync.size()) > (all_packet.size() + 2))
+				if (static_cast<int32_t>(all_sync.size()) > static_cast<int32_t>(all_packet.size() + 2))
 				{
 					eop_index = (all_sync[all_packet.size() + 2].NodePtr - 1)->StartIndex;
 				}

BIN
x64/Debug/ProtocolDecoder.dll


BIN
x64/Debug/ProtocolDecoder.pdb