From d145a7b8de58019391657248963bc163e7b05f32 Mon Sep 17 00:00:00 2001 From: Jay Beavers Date: Tue, 9 Feb 2021 14:24:01 -0800 Subject: [PATCH] Update for changes to QLFrameData Byte Alignment for Version 2019.1 --- QuickLink2DotNet.sln | 31 ++++++++ QuickLink2DotNet/QuickLink2DotNet/QLTypes.cs | 76 ++++++++++--------- .../QuickLink2DotNet/QuickLink2DotNet.csproj | 32 +++++++- 3 files changed, 99 insertions(+), 40 deletions(-) create mode 100644 QuickLink2DotNet.sln diff --git a/QuickLink2DotNet.sln b/QuickLink2DotNet.sln new file mode 100644 index 0000000..083d55d --- /dev/null +++ b/QuickLink2DotNet.sln @@ -0,0 +1,31 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 16 +VisualStudioVersion = 16.0.31005.135 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "QuickLink2DotNet", "QuickLink2DotNet\QuickLink2DotNet\QuickLink2DotNet.csproj", "{95D15B06-7319-4839-850B-C35F63B4FCCF}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Debug|x86 = Debug|x86 + Release|Any CPU = Release|Any CPU + Release|x86 = Release|x86 + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {95D15B06-7319-4839-850B-C35F63B4FCCF}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {95D15B06-7319-4839-850B-C35F63B4FCCF}.Debug|Any CPU.Build.0 = Debug|Any CPU + {95D15B06-7319-4839-850B-C35F63B4FCCF}.Debug|x86.ActiveCfg = Debug|x86 + {95D15B06-7319-4839-850B-C35F63B4FCCF}.Debug|x86.Build.0 = Debug|x86 + {95D15B06-7319-4839-850B-C35F63B4FCCF}.Release|Any CPU.ActiveCfg = Release|Any CPU + {95D15B06-7319-4839-850B-C35F63B4FCCF}.Release|Any CPU.Build.0 = Release|Any CPU + {95D15B06-7319-4839-850B-C35F63B4FCCF}.Release|x86.ActiveCfg = Release|x86 + {95D15B06-7319-4839-850B-C35F63B4FCCF}.Release|x86.Build.0 = Release|x86 + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {A9CFC78E-65AF-41BE-B80B-1228584CA547} + EndGlobalSection +EndGlobal diff --git a/QuickLink2DotNet/QuickLink2DotNet/QLTypes.cs b/QuickLink2DotNet/QuickLink2DotNet/QLTypes.cs index 385466f..65afc30 100644 --- a/QuickLink2DotNet/QuickLink2DotNet/QLTypes.cs +++ b/QuickLink2DotNet/QuickLink2DotNet/QLTypes.cs @@ -1165,7 +1165,7 @@ public struct QLRectInt /// /// /// - [StructLayout(LayoutKind.Sequential)] + [StructLayout(LayoutKind.Explicit)] public struct QLImageData { /// @@ -1173,7 +1173,7 @@ public struct QLImageData /// The pixel data of the image. The data is single channel grey-scale with 8-bits per pixel. /// /// - public IntPtr PixelData; + [FieldOffset(0)] public Int32 PixelData; /// /// @@ -1181,7 +1181,7 @@ public struct QLImageData /// if binning is turned on. /// /// - public System.Int32 Width; + [FieldOffset(4)] public System.Int32 Width; /// /// @@ -1189,7 +1189,7 @@ public struct QLImageData /// if binning is turned on. /// /// - public System.Int32 Height; + [FieldOffset(8)] public System.Int32 Height; /// /// @@ -1197,14 +1197,14 @@ public struct QLImageData /// started. /// /// - public System.Double Timestamp; + [FieldOffset(16)] public System.Double Timestamp; /// /// /// The gain value of the image. /// /// - public System.Int32 Gain; + [FieldOffset(24)] public System.Int32 Gain; /// /// @@ -1212,7 +1212,7 @@ public struct QLImageData /// determine if a frame was lost. /// /// - public System.Int32 FrameNumber; + [FieldOffset(28)] public System.Int32 FrameNumber; /// /// @@ -1222,7 +1222,11 @@ public struct QLImageData /// /// /// - public QLRectInt ROI; + [FieldOffset(32)] public QLRectInt ROI; + + [FieldOffset(48)] public Int32 ScaleFactor; + + [FieldOffset(52)] public Int32 PixelFrameNumber; #if (ISX64) @@ -1245,9 +1249,9 @@ public struct QLImageData /// Note: Void pointers are 4-bytes on x86, and 8-bytes on x64. /// /// - [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 48)] + [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 40)] #endif - public System.String Reserved; + [FieldOffset(56)] public System.String Reserved; } /// @@ -1256,7 +1260,7 @@ public struct QLImageData /// /// /// - [StructLayout(LayoutKind.Sequential)] + [StructLayout(LayoutKind.Explicit)] public struct QLEyeData { /// @@ -1266,7 +1270,7 @@ public struct QLEyeData /// /// [MarshalAs(UnmanagedType.U1)] - public System.Boolean Found; + [FieldOffset(0)] public System.Boolean Found; /// /// @@ -1275,7 +1279,7 @@ public struct QLEyeData /// /// [MarshalAs(UnmanagedType.U1)] - public System.Boolean Calibrated; + [FieldOffset(1)] public System.Boolean Calibrated; /// /// @@ -1284,7 +1288,7 @@ public struct QLEyeData /// determined and it's value should not be used for that frame. /// /// - public System.Single PupilDiameter; + [FieldOffset(4)] public System.Single PupilDiameter; /// /// @@ -1292,7 +1296,7 @@ public struct QLEyeData /// /// /// - public QLXYPairFloat Pupil; + [FieldOffset(8)] public QLXYPairFloat Pupil; /// /// @@ -1301,7 +1305,7 @@ public struct QLEyeData /// /// /// - public QLXYPairFloat Glint0; + [FieldOffset(16)] public QLXYPairFloat Glint0; /// /// @@ -1310,7 +1314,7 @@ public struct QLEyeData /// /// /// - public QLXYPairFloat Glint1; + [FieldOffset(24)] public QLXYPairFloat Glint1; /// /// @@ -1319,7 +1323,7 @@ public struct QLEyeData /// /// /// - public QLXYPairFloat GazePoint; + [FieldOffset(32)] public QLXYPairFloat GazePoint; /// /// @@ -1334,7 +1338,7 @@ public struct QLEyeData [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 64)] #endif - public System.String Reserved; + [FieldOffset(40)] public System.String Reserved; } /// @@ -1343,7 +1347,7 @@ public struct QLEyeData /// based on which eyes were found and previous data depending on filtering settings. /// /// - [StructLayout(LayoutKind.Sequential)] + [StructLayout(LayoutKind.Explicit)] public struct QLWeightedGazePoint { /// @@ -1353,35 +1357,35 @@ public struct QLWeightedGazePoint /// /// [MarshalAs(UnmanagedType.U1)] - public System.Boolean Valid; + [FieldOffset(0)] public System.Boolean Valid; /// /// /// The x position of the gaze point in percentage of the calibrated area. /// /// - public System.Single x; + [FieldOffset(4)] public System.Single x; /// /// /// The y position of the gaze point in percentage of the calibrated area. /// /// - public System.Single y; + [FieldOffset(8)] public System.Single y; /// /// /// The amount the left eye affected the weighted gaze point. /// /// - public System.Single LeftWeight; + [FieldOffset(12)] public System.Single LeftWeight; /// /// /// The amount the right eye affected the weighted gaze point. /// /// - public System.Single RightWeight; + [FieldOffset(16)] public System.Single RightWeight; /// /// @@ -1396,7 +1400,7 @@ public struct QLWeightedGazePoint [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 64)] #endif - public System.String Reserved; + [FieldOffset(20)] public System.String Reserved; } /// @@ -1408,7 +1412,7 @@ public struct QLWeightedGazePoint /// /// /// - [StructLayout(LayoutKind.Sequential)] + [StructLayout(LayoutKind.Explicit)] public struct QLFrameData { /// @@ -1417,7 +1421,7 @@ public struct QLFrameData /// /// /// - public QLImageData ImageData; + [FieldOffset(0)] public QLImageData ImageData; /// /// @@ -1425,7 +1429,7 @@ public struct QLFrameData /// /// /// - public QLEyeData LeftEye; + [FieldOffset(96)] public QLEyeData LeftEye; /// /// @@ -1433,7 +1437,7 @@ public struct QLFrameData /// /// /// - public QLEyeData RightEye; + [FieldOffset(200)] public QLEyeData RightEye; /// /// @@ -1442,7 +1446,7 @@ public struct QLFrameData /// /// /// - public QLWeightedGazePoint WeightedGazePoint; + [FieldOffset(304)] public QLWeightedGazePoint WeightedGazePoint; /// /// @@ -1450,28 +1454,28 @@ public struct QLFrameData /// values range between 15 and 19. /// /// - public System.Single Focus; + [FieldOffset(388)] public System.Single Focus; /// /// /// The distance from the device to the user in centimeters. /// /// - public System.Single Distance; + [FieldOffset(392)] public System.Single Distance; /// /// /// The current bandwidth of the device. /// /// - public System.Int32 Bandwidth; + [FieldOffset(396)] public System.Int32 Bandwidth; /// /// /// The ID of the device that is the source for the current frame. /// /// - public System.Int32 DeviceId; + [FieldOffset(400)] public System.Int32 DeviceId; /// /// @@ -1486,7 +1490,7 @@ public struct QLFrameData [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 56)] #endif - public System.String Reserved; + [FieldOffset(404)] public System.String Reserved; } #endregion Structures diff --git a/QuickLink2DotNet/QuickLink2DotNet/QuickLink2DotNet.csproj b/QuickLink2DotNet/QuickLink2DotNet/QuickLink2DotNet.csproj index 1288d00..cf4b513 100644 --- a/QuickLink2DotNet/QuickLink2DotNet/QuickLink2DotNet.csproj +++ b/QuickLink2DotNet/QuickLink2DotNet/QuickLink2DotNet.csproj @@ -1,5 +1,5 @@  - + Debug AnyCPU @@ -10,16 +10,17 @@ Properties QuickLink2DotNet QuickLink2DotNet - v4.0 + v4.7.2 512 - Client + + true bin\Debug\ TRACE;DEBUG full - AnyCPU + x86 bin\Debug\QuickLinkDotNet.dll.CodeAnalysisLog.xml true GlobalSuppressions.cs @@ -30,6 +31,7 @@ ;C:\Program Files (x86)\Microsoft Visual Studio 10.0\Team Tools\Static Analysis Tools\FxCop\\Rules true bin\Debug\QuickLink2DotNet.XML + false bin\Release\ @@ -47,6 +49,28 @@ ;C:\Program Files (x86)\Microsoft Visual Studio 10.0\Team Tools\Static Analysis Tools\FxCop\\Rules true false + false + + + true + bin\x86\Debug\ + TRACE;DEBUG + bin\Debug\QuickLink2DotNet.XML + full + x86 + 7.3 + prompt + MinimumRecommendedRules.ruleset + + + bin\x86\Release\ + TRACE + true + pdbonly + x86 + 7.3 + prompt + MinimumRecommendedRules.ruleset