lijinwen hai 4 meses
pai
achega
1d1e77fa89

+ 8 - 31
ExportMethod.cpp

@@ -1,39 +1,16 @@
 #include "ExportMethod.h"
 
-#include <future>
-
-#include "ProtocolDecodeBase.h"
-#include "EdgePulseData.h"
-#include "QuantizeParams.h"
-#include "ProtocolRS232/Protocol.RS232.Options.h"
-#include "ProtocolRS232/RS232DecodeResult.h"
-#include "ProtocolUSB/UsbDecodeOptions.h"
-#include "ProtocolUSB/USBDecodeResult.h"
+//#include "ProtocolUSB/USBDecode.h"
 
 
 namespace Protocol
 {
-    extern "C" {
-
-    LIBMATH_API bool Parse_USB(UsbDecodeOptions option, std::vector<Protocol::TwoLevelEdgePulse> edgePluses1,
-                               std::vector<Protocol::TwoLevelEdgePulse> edgePluses2, UsbDecodeResult& result);
-
-
-    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);
-
-
-    inline LIBMATH_API void setCancellationSignal(bool value)
-    {
-        canceled = value;
-    }
-
-    LIBMATH_API void getVersionExport(uint8_t* version);
 
-    }
+    // bool Parse_USB(UsbDecodeOptions option, std::vector<Protocol::TwoLevelEdgePulse> edgePluses1,
+    //                std::vector<Protocol::TwoLevelEdgePulse> edgePluses2, UsbDecodeResult& result)
+    // {
+    //     //todo
+    //     //return USBDecode::DecodeUSB(option, edgePluses1, edgePluses2, result);
+    //     return false;
+    // }
 }

+ 35 - 0
ExportMethod.h

@@ -8,9 +8,44 @@
 // // ******************************************************************
 
 #pragma once
+#include <future>
+
+#include "ProtocolDecodeBase.h"
+#include "EdgePulseData.h"
+#include "QuantizeParams.h"
+#include "ProtocolRS232/Protocol.RS232.Options.h"
+#include "ProtocolRS232/RS232DecodeResult.h"
+//#include "ProtocolUSB/UsbDecodeOptions.h"
+//#include "ProtocolUSB/USBDecodeResult.h"
 
 #ifdef LIBMATH_EXPORTS
 #define LIBMATH_API __declspec(dllexport)
 #else
 #define LIBMATH_API __declspec(dllimport)
 #endif
+namespace Protocol
+{
+    extern "C" {
+
+    // LIBMATH_API bool Parse_USB(UsbDecodeOptions option, std::vector<Protocol::TwoLevelEdgePulse> edgePluses1,
+    //                            std::vector<Protocol::TwoLevelEdgePulse> edgePluses2, UsbDecodeResult& result);
+
+
+    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);
+
+
+    inline LIBMATH_API void setCancellationSignal(bool value)
+    {
+        canceled = value;
+    }
+
+    LIBMATH_API void getVersionExport(uint8_t* version);
+
+    }
+}

+ 3 - 13
ProtocolDecoder.vcxproj

@@ -317,11 +317,6 @@
         <ClCompile Include="ProtocolRS232\RS232DecodeEvent.cpp"/>
         <ClCompile Include="ProtocolRS232\RS232DecodeResult.cpp"/>
         <ClCompile Include="ProtocolRS232\RS232Packet.cpp"/>
-        <ClCompile Include="ProtocolUSB\Constants.cpp" />
-        <ClCompile Include="ProtocolUSB\UsbDecodeEvent.cpp" />
-        <ClCompile Include="ProtocolUSB\USBDecode.cpp" />
-        <ClCompile Include="ProtocolUSB\UsbDecodeResult.cpp" />
-        <ClCompile Include="ProtocolUSB\USBPacket.cpp" />
         <ClCompile Include="QuantizeParams.cpp"/>
     </ItemGroup>
     <ItemGroup>
@@ -349,16 +344,11 @@
         <ClInclude Include="ProtocolRS232\RS232DecodeEvent.h"/>
         <ClInclude Include="ProtocolRS232\RS232DecodeResult.h"/>
         <ClInclude Include="ProtocolRS232\RS232Packet.h"/>
-        <ClInclude Include="ProtocolUSB\Constants.h" />
-        <ClInclude Include="ProtocolUSB\ProtocolUSBEnums.h" />
-        <ClInclude Include="ProtocolUSB\SYNC.h" />
-        <ClInclude Include="ProtocolUSB\UsbDecodeEvent.h" />
-        <ClInclude Include="ProtocolUSB\USBDecode.h" />
-        <ClInclude Include="ProtocolUSB\UsbDecodeOptions.h" />
-        <ClInclude Include="ProtocolUSB\UsbDecodeResult.h" />
-        <ClInclude Include="ProtocolUSB\USBPacket.h" />
         <ClInclude Include="QuantizeParams.h"/>
     </ItemGroup>
+    <ItemGroup>
+      <Folder Include="ProtocolUSB\" />
+    </ItemGroup>
     <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets"/>
     <ImportGroup Label="ExtensionTargets">
     </ImportGroup>

+ 4 - 4
ProtocolUSB/ProtocolUSBEnums.h

@@ -58,7 +58,7 @@ namespace Protocol
             HighRate,
         };
 
-        enum class TokenPackageType : uint8_t
+        enum class TokenPackageType //: uint8_t
         {
             Out = 0b0001,
             SOF = 0b0101,
@@ -66,7 +66,7 @@ namespace Protocol
             SETUP = 0b1101,
         };
 
-        enum class SpecialPacketType : uint8_t
+        enum class SpecialPacketType //: uint8_t
         {
             // Pre = 0b1100,
             Err = 0b1100,
@@ -75,7 +75,7 @@ namespace Protocol
             Remain = 0b000,
         };
 
-        enum class HandshakePackageType : uint8_t
+        enum class HandshakePackageType //: uint8_t
         {
             ACK = 0b0010,
             NAK = 0b1010,
@@ -83,7 +83,7 @@ namespace Protocol
             Nyet = 0b0110,
         };
 
-        enum class DataPackageType : uint8_t
+        enum class DataPackageType //: uint8_t
         {
             Data0 = 0b0011,
             Data1 = 0b1011,

+ 8 - 0
ProtocolUSB/USBDecode.cpp

@@ -65,6 +65,14 @@ namespace Protocol
         return 0;
     }
 
+    bool USBDecode::DecodeUSB(UsbDecodeOptions option,std::vector<Protocol::TwoLevelEdgePulse> edgePluses1,
+                        std::vector<Protocol::TwoLevelEdgePulse> edgePluses2,UsbDecodeResult& result)
+    {
+        //todo
+        
+        return  true;
+    }
+
     bool USBDecode::ParseData(std::vector<Protocol::TwoLevelEdgePulse> edgePluses,
                                      std::promise<void>& cancellationSignal)
     {

+ 2 - 2
ProtocolUSB/USBDecode.h

@@ -50,8 +50,8 @@ namespace Protocol
 
         static uint16_t MinByteCount();
 
-        bool Parse_USB(UsbDecodeOptions option,std::vector<Protocol::TwoLevelEdgePulse> edgePluses1,
-                         std::vector<Protocol::TwoLevelEdgePulse> edgePluses2,std::promise<void>& cancellationSignal);
+        static bool DecodeUSB(UsbDecodeOptions option,std::vector<Protocol::TwoLevelEdgePulse> edgePluses1,
+                         std::vector<Protocol::TwoLevelEdgePulse> edgePluses2,UsbDecodeResult& result);
     private:
         UsbDecodeResult resultData;
         Enums::SignalRate signalRate;