diff options
| author | Adam Shapiro <[email protected]> | 2015-12-04 14:34:54 -0800 |
|---|---|---|
| committer | Adam Shapiro <[email protected]> | 2015-12-04 14:34:54 -0800 |
| commit | 92ba1ee26ecd79412c91ffbb59aabd12a7c28e5a (patch) | |
| tree | 5065c6e86e13738c7080ad0eb97b8fd402c38662 | |
| parent | 381baa75544d677fd0dc3a26b30a435a7edde696 (diff) | |
Updates to Barcode Scanner Sample
Changes to BarcodeScanner.sln, PosEvents.cpp,
SampleBarcodeScannerDrv.vcxproj and .filters, and the sources file.
| -rw-r--r-- | pos/drivers/barcodescanner/BarcodeScanner.sln | 24 | ||||
| -rw-r--r-- | pos/drivers/barcodescanner/PosEvents.cpp | 15 | ||||
| -rw-r--r-- | pos/drivers/barcodescanner/SampleBarcodeScannerDrv.vcxproj | 100 | ||||
| -rw-r--r-- | pos/drivers/barcodescanner/SampleBarcodeScannerDrv.vcxproj.Filters | 8 | ||||
| -rw-r--r-- | pos/drivers/barcodescanner/sources | 38 |
5 files changed, 160 insertions, 25 deletions
diff --git a/pos/drivers/barcodescanner/BarcodeScanner.sln b/pos/drivers/barcodescanner/BarcodeScanner.sln index 1072df65..390805d5 100644 --- a/pos/drivers/barcodescanner/BarcodeScanner.sln +++ b/pos/drivers/barcodescanner/BarcodeScanner.sln @@ -3,7 +3,7 @@ Microsoft Visual Studio Solution File, Format Version 12.00 # Visual Studio 2013 VisualStudioVersion = 12.0 MinimumVisualStudioVersion = 12.0 -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "SampleBarcodeScannerDrv", "SampleBarcodeScannerDrv.vcxproj", "{30F6FA25-B31E-46B0-AFBB-2AC9BA3319F0}" +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "SampleBarcodeScannerDrv", "SampleBarcodeScannerDrv.vcxproj", "{6551F16A-3A12-4CDA-B585-2E2F813CF25E}" EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution @@ -11,16 +11,22 @@ Global Release|Win32 = Release|Win32 Debug|x64 = Debug|x64 Release|x64 = Release|x64 + Debug|Arm = Debug|Arm + Release|Arm = Release|Arm EndGlobalSection GlobalSection(ProjectConfigurationPlatforms) = postSolution - {30F6FA25-B31E-46B0-AFBB-2AC9BA3319F0}.Debug|Win32.ActiveCfg = Debug|Win32 - {30F6FA25-B31E-46B0-AFBB-2AC9BA3319F0}.Debug|Win32.Build.0 = Debug|Win32 - {30F6FA25-B31E-46B0-AFBB-2AC9BA3319F0}.Release|Win32.ActiveCfg = Release|Win32 - {30F6FA25-B31E-46B0-AFBB-2AC9BA3319F0}.Release|Win32.Build.0 = Release|Win32 - {30F6FA25-B31E-46B0-AFBB-2AC9BA3319F0}.Debug|x64.ActiveCfg = Debug|x64 - {30F6FA25-B31E-46B0-AFBB-2AC9BA3319F0}.Debug|x64.Build.0 = Debug|x64 - {30F6FA25-B31E-46B0-AFBB-2AC9BA3319F0}.Release|x64.ActiveCfg = Release|x64 - {30F6FA25-B31E-46B0-AFBB-2AC9BA3319F0}.Release|x64.Build.0 = Release|x64 + {6551F16A-3A12-4CDA-B585-2E2F813CF25E}.Debug|Win32.ActiveCfg = Debug|Win32 + {6551F16A-3A12-4CDA-B585-2E2F813CF25E}.Debug|Win32.Build.0 = Debug|Win32 + {6551F16A-3A12-4CDA-B585-2E2F813CF25E}.Release|Win32.ActiveCfg = Release|Win32 + {6551F16A-3A12-4CDA-B585-2E2F813CF25E}.Release|Win32.Build.0 = Release|Win32 + {6551F16A-3A12-4CDA-B585-2E2F813CF25E}.Debug|x64.ActiveCfg = Debug|x64 + {6551F16A-3A12-4CDA-B585-2E2F813CF25E}.Debug|x64.Build.0 = Debug|x64 + {6551F16A-3A12-4CDA-B585-2E2F813CF25E}.Release|x64.ActiveCfg = Release|x64 + {6551F16A-3A12-4CDA-B585-2E2F813CF25E}.Release|x64.Build.0 = Release|x64 + {6551F16A-3A12-4CDA-B585-2E2F813CF25E}.Debug|Arm.ActiveCfg = Debug|Arm + {6551F16A-3A12-4CDA-B585-2E2F813CF25E}.Debug|Arm.Build.0 = Debug|Arm + {6551F16A-3A12-4CDA-B585-2E2F813CF25E}.Release|Arm.ActiveCfg = Release|Arm + {6551F16A-3A12-4CDA-B585-2E2F813CF25E}.Release|Arm.Build.0 = Release|Arm EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/pos/drivers/barcodescanner/PosEvents.cpp b/pos/drivers/barcodescanner/PosEvents.cpp index 1d2443bb..e436099c 100644 --- a/pos/drivers/barcodescanner/PosEvents.cpp +++ b/pos/drivers/barcodescanner/PosEvents.cpp @@ -38,11 +38,11 @@ VOID EvtOnBarcodeScanDataRetrieved(_In_ WDFDEVICE Device) // PosEventType::ReleaseDeviceRequested // The following shows an example of sending barcode scan data - WCHAR exampleData[] = L"]0A12345"; - WCHAR exampleDataLabel[] = L"12345"; + CHAR exampleData[] = "]0A12345"; + CHAR exampleDataLabel[] = "12345"; // total size is the struct plus the size of the two strings (minus the null terminators which aren't transmitted). - size_t totalSize = sizeof(PosBarcodeScannerDataReceivedEventData) + sizeof(exampleData) - sizeof(WCHAR) + sizeof(exampleDataLabel) - sizeof(WCHAR); + size_t totalSize = sizeof(PosBarcodeScannerDataReceivedEventData) + sizeof(exampleData) - sizeof(CHAR) + sizeof(exampleDataLabel) - sizeof(CHAR); // PosCx supports two methods of pending the event data -- one where it takes the WDFMEMORY for the event, and the other where it creates it @@ -72,20 +72,23 @@ VOID EvtOnBarcodeScanDataRetrieved(_In_ WDFDEVICE Device) return; } + // Calculate data and label sizes + size_t exampleDataByteCount = sizeof(exampleData) - sizeof(CHAR); + size_t exampleLabelByteCount = sizeof(exampleDataLabel) - sizeof(CHAR); + PosBarcodeScannerDataReceivedEventData* eventHeader = (PosBarcodeScannerDataReceivedEventData*)eventData; eventHeader->Header.EventType = PosEventType::BarcodeScannerDataReceived; eventHeader->Header.DataLength = (UINT32)totalSize; eventHeader->DataType = BarcodeSymbology::Ean13; + eventHeader->ScanDataLength = (UINT32)exampleDataByteCount; + eventHeader->ScanDataLabelLength = (UINT32)exampleLabelByteCount; // These use memcpy because wcscpy would append the null terminator and the event data doesn't use it BYTE* eventScanData = eventData + sizeof(PosBarcodeScannerDataReceivedEventData); - size_t exampleDataByteCount = sizeof(exampleData) - sizeof(WCHAR); memcpy(eventScanData, exampleData, exampleDataByteCount); BYTE* eventLabelData = eventScanData + exampleDataByteCount; - size_t exampleLabelByteCount = sizeof(exampleDataLabel) - sizeof(WCHAR); memcpy(eventLabelData, exampleDataLabel, exampleLabelByteCount); - // This call actually pends the data to be send to the WinRT APIs. status = PosCxPutPendingEventMemory(Device, SCANNER_INTERFACE_TAG, eventMemory, POS_CX_EVENT_ATTR_DATA); diff --git a/pos/drivers/barcodescanner/SampleBarcodeScannerDrv.vcxproj b/pos/drivers/barcodescanner/SampleBarcodeScannerDrv.vcxproj index cf354ec3..555c9289 100644 --- a/pos/drivers/barcodescanner/SampleBarcodeScannerDrv.vcxproj +++ b/pos/drivers/barcodescanner/SampleBarcodeScannerDrv.vcxproj @@ -17,20 +17,44 @@ <Configuration>Release</Configuration> <Platform>x64</Platform> </ProjectConfiguration> + <ProjectConfiguration Include="Debug|Arm"> + <Configuration>Debug</Configuration> + <Platform>Arm</Platform> + </ProjectConfiguration> + <ProjectConfiguration Include="Release|Arm"> + <Configuration>Release</Configuration> + <Platform>Arm</Platform> + </ProjectConfiguration> </ItemGroup> <PropertyGroup Label="Globals"> - <ProjectGuid>{E08242CA-297F-4C12-A99F-EC78245117F5}</ProjectGuid> + <ProjectGuid>{6551F16A-3A12-4CDA-B585-2E2F813CF25E}</ProjectGuid> <RootNamespace>$(MSBuildProjectName)</RootNamespace> <UMDF_VERSION_MAJOR>2</UMDF_VERSION_MAJOR> <Configuration Condition="'$(Configuration)' == ''">Debug</Configuration> <Platform Condition="'$(Platform)' == ''">Win32</Platform> - <SampleGuid>{294BDD9E-A272-4E3A-804F-5C117FC85E08}</SampleGuid> + <SampleGuid>{ABA12C7E-CC0F-45F2-881E-9A2C7C7EFEFC}</SampleGuid> </PropertyGroup> <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" /> + <PropertyGroup Label="Configuration" Condition="'$(Configuration)|$(Platform)'=='Release|Arm'"> + <TargetVersion>Windows10</TargetVersion> + <UseDebugLibraries>False</UseDebugLibraries> + <DriverTargetPlatform>Universal</DriverTargetPlatform> + <DriverType>UMDF</DriverType> + <PlatformToolset>WindowsUserModeDriver10.0</PlatformToolset> + <ConfigurationType>DynamicLibrary</ConfigurationType> + </PropertyGroup> + <PropertyGroup Label="Configuration" Condition="'$(Configuration)|$(Platform)'=='Debug|Arm'"> + <TargetVersion>Windows10</TargetVersion> + <UseDebugLibraries>True</UseDebugLibraries> + <DriverTargetPlatform>Universal</DriverTargetPlatform> + <DriverType>UMDF</DriverType> + <PlatformToolset>WindowsUserModeDriver10.0</PlatformToolset> + <ConfigurationType>DynamicLibrary</ConfigurationType> + </PropertyGroup> <PropertyGroup Label="Configuration" Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> <TargetVersion>Windows10</TargetVersion> <UseDebugLibraries>False</UseDebugLibraries> - <DriverTargetPlatform>Desktop</DriverTargetPlatform> + <DriverTargetPlatform>Universal</DriverTargetPlatform> <DriverType>UMDF</DriverType> <PlatformToolset>WindowsUserModeDriver10.0</PlatformToolset> <ConfigurationType>DynamicLibrary</ConfigurationType> @@ -38,7 +62,7 @@ <PropertyGroup Label="Configuration" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'"> <TargetVersion>Windows10</TargetVersion> <UseDebugLibraries>True</UseDebugLibraries> - <DriverTargetPlatform>Desktop</DriverTargetPlatform> + <DriverTargetPlatform>Universal</DriverTargetPlatform> <DriverType>UMDF</DriverType> <PlatformToolset>WindowsUserModeDriver10.0</PlatformToolset> <ConfigurationType>DynamicLibrary</ConfigurationType> @@ -46,7 +70,7 @@ <PropertyGroup Label="Configuration" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> <TargetVersion>Windows10</TargetVersion> <UseDebugLibraries>False</UseDebugLibraries> - <DriverTargetPlatform>Desktop</DriverTargetPlatform> + <DriverTargetPlatform>Universal</DriverTargetPlatform> <DriverType>UMDF</DriverType> <PlatformToolset>WindowsUserModeDriver10.0</PlatformToolset> <ConfigurationType>DynamicLibrary</ConfigurationType> @@ -54,7 +78,7 @@ <PropertyGroup Label="Configuration" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> <TargetVersion>Windows10</TargetVersion> <UseDebugLibraries>True</UseDebugLibraries> - <DriverTargetPlatform>Desktop</DriverTargetPlatform> + <DriverTargetPlatform>Universal</DriverTargetPlatform> <DriverType>UMDF</DriverType> <PlatformToolset>WindowsUserModeDriver10.0</PlatformToolset> <ConfigurationType>DynamicLibrary</ConfigurationType> @@ -63,6 +87,12 @@ <PropertyGroup> <OutDir>$(IntDir)</OutDir> </PropertyGroup> + <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Arm'"> + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" /> + </ImportGroup> + <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Arm'"> + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" /> + </ImportGroup> <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" /> </ImportGroup> @@ -76,6 +106,12 @@ <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" /> </ImportGroup> <ItemGroup Label="WrappedTaskItems" /> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Arm'"> + <TargetName>SampleBarcodeScannerDrv</TargetName> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Arm'"> + <TargetName>SampleBarcodeScannerDrv</TargetName> + </PropertyGroup> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> <TargetName>SampleBarcodeScannerDrv</TargetName> </PropertyGroup> @@ -88,6 +124,18 @@ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> <TargetName>SampleBarcodeScannerDrv</TargetName> </PropertyGroup> + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Arm'"> + <Link> + <EntryPointSymbol Condition="'$(Platform)'=='win32'">_DllMainCRTStartup@12</EntryPointSymbol> + <EntryPointSymbol Condition="'$(Platform)'!='win32'">_DllMainCRTStartup</EntryPointSymbol> + </Link> + </ItemDefinitionGroup> + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Arm'"> + <Link> + <EntryPointSymbol Condition="'$(Platform)'=='win32'">_DllMainCRTStartup@12</EntryPointSymbol> + <EntryPointSymbol Condition="'$(Platform)'!='win32'">_DllMainCRTStartup</EntryPointSymbol> + </Link> + </ItemDefinitionGroup> <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> <Link> <EntryPointSymbol Condition="'$(Platform)'=='win32'">_DllMainCRTStartup@12</EntryPointSymbol> @@ -112,6 +160,34 @@ <EntryPointSymbol Condition="'$(Platform)'!='win32'">_DllMainCRTStartup</EntryPointSymbol> </Link> </ItemDefinitionGroup> + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Arm'"> + <ClCompile> + <ExceptionHandling>Sync</ExceptionHandling> + <TreatWarningAsError>true</TreatWarningAsError> + <WarningLevel>Level4</WarningLevel> + <AdditionalIncludeDirectories>%(AdditionalIncludeDirectories);$(DDK_INC_PATH);$(SDK_INC_PATH)\pos\1.1;..\inc</AdditionalIncludeDirectories> + </ClCompile> + <ResourceCompile> + <AdditionalIncludeDirectories>%(AdditionalIncludeDirectories);$(DDK_INC_PATH);$(SDK_INC_PATH)\pos\1.1;..\inc</AdditionalIncludeDirectories> + </ResourceCompile> + <Midl> + <AdditionalIncludeDirectories>%(AdditionalIncludeDirectories);$(DDK_INC_PATH);$(SDK_INC_PATH)\pos\1.1;..\inc</AdditionalIncludeDirectories> + </Midl> + </ItemDefinitionGroup> + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Arm'"> + <ClCompile> + <ExceptionHandling>Sync</ExceptionHandling> + <TreatWarningAsError>true</TreatWarningAsError> + <WarningLevel>Level4</WarningLevel> + <AdditionalIncludeDirectories>%(AdditionalIncludeDirectories);$(DDK_INC_PATH);$(SDK_INC_PATH)\pos\1.1;..\inc</AdditionalIncludeDirectories> + </ClCompile> + <ResourceCompile> + <AdditionalIncludeDirectories>%(AdditionalIncludeDirectories);$(DDK_INC_PATH);$(SDK_INC_PATH)\pos\1.1;..\inc</AdditionalIncludeDirectories> + </ResourceCompile> + <Midl> + <AdditionalIncludeDirectories>%(AdditionalIncludeDirectories);$(DDK_INC_PATH);$(SDK_INC_PATH)\pos\1.1;..\inc</AdditionalIncludeDirectories> + </Midl> + </ItemDefinitionGroup> <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> <ClCompile> <ExceptionHandling>Sync</ExceptionHandling> @@ -168,6 +244,18 @@ <AdditionalIncludeDirectories>%(AdditionalIncludeDirectories);$(DDK_INC_PATH);$(SDK_INC_PATH)\pos\1.1;..\inc</AdditionalIncludeDirectories> </Midl> </ItemDefinitionGroup> + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Arm'"> + <Link> + <AdditionalDependencies>%(AdditionalDependencies);$(SDK_LIB_PATH)\pos\1.1\poscxstub.lib</AdditionalDependencies> + <ModuleDefinitionFile>exports.def</ModuleDefinitionFile> + </Link> + </ItemDefinitionGroup> + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Arm'"> + <Link> + <AdditionalDependencies>%(AdditionalDependencies);$(SDK_LIB_PATH)\pos\1.1\poscxstub.lib</AdditionalDependencies> + <ModuleDefinitionFile>exports.def</ModuleDefinitionFile> + </Link> + </ItemDefinitionGroup> <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> <Link> <AdditionalDependencies>%(AdditionalDependencies);$(SDK_LIB_PATH)\pos\1.1\poscxstub.lib</AdditionalDependencies> diff --git a/pos/drivers/barcodescanner/SampleBarcodeScannerDrv.vcxproj.Filters b/pos/drivers/barcodescanner/SampleBarcodeScannerDrv.vcxproj.Filters index 4268199b..9b16c2dc 100644 --- a/pos/drivers/barcodescanner/SampleBarcodeScannerDrv.vcxproj.Filters +++ b/pos/drivers/barcodescanner/SampleBarcodeScannerDrv.vcxproj.Filters @@ -3,19 +3,19 @@ <ItemGroup> <Filter Include="Source Files"> <Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx;*</Extensions> - <UniqueIdentifier>{47F49773-F319-4591-B32D-BA38E9E75F22}</UniqueIdentifier> + <UniqueIdentifier>{A8857C1C-EE8A-44D9-8EB2-A78D510F4E43}</UniqueIdentifier> </Filter> <Filter Include="Header Files"> <Extensions>h;hpp;hxx;hm;inl;inc;xsd</Extensions> - <UniqueIdentifier>{74AA7E37-6BDE-408A-AF19-36CBA1A80849}</UniqueIdentifier> + <UniqueIdentifier>{04004AF3-4725-41BB-932B-DB734ACB684E}</UniqueIdentifier> </Filter> <Filter Include="Resource Files"> <Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms;man;xml</Extensions> - <UniqueIdentifier>{58E2BE2E-4AAA-48F9-95E8-65E24E014E15}</UniqueIdentifier> + <UniqueIdentifier>{9474798F-C7E3-4CC5-B3A4-D524A84DCD5F}</UniqueIdentifier> </Filter> <Filter Include="Driver Files"> <Extensions>inf;inv;inx;mof;mc;</Extensions> - <UniqueIdentifier>{E145DF39-11C3-4472-BDA5-35448FA78D69}</UniqueIdentifier> + <UniqueIdentifier>{E2A7C868-3D64-4BE3-9F17-CB286F80D354}</UniqueIdentifier> </Filter> </ItemGroup> <ItemGroup> diff --git a/pos/drivers/barcodescanner/sources b/pos/drivers/barcodescanner/sources new file mode 100644 index 00000000..11c406dc --- /dev/null +++ b/pos/drivers/barcodescanner/sources @@ -0,0 +1,38 @@ +TARGETNAME=SampleBarcodeScannerDrv +TARGETTYPE=DYNLINK + +TARGET_DESTINATION=NTTEST\drivers\pos\Samples +DLLENTRY=_DllMainCRTStartup +DLLDEF=exports.def + +DDK_TARGET_PLATFORM=Universal + +UMDF_VERSION_MAJOR=2 + +USE_MSVCRT=1 +USE_NATIVE_EH=1 + +USE_STL=1 +STL_VER=STL_VER_CURRENT + + +MSC_WARNING_LEVEL=/W4 /WX + +INCLUDES=$(INCLUDES);\ + $(DDK_INC_PATH); \ + $(SDK_INC_PATH)\pos\1.1; \ + ..\inc; \ + +PRECOMPILED_INCLUDE=pch.h +PRECOMPILED_CXX=1 + +SOURCES= \ + Driver.cpp \ + Device.cpp \ + File.cpp \ + Ioctl.cpp \ + IoRead.cpp \ + PosEvents.cpp \ + +TARGETLIBS= \ + $(SDK_LIB_PATH)\pos\1.1\poscxstub.lib |
