Adding WinRT implementation of OpenZWave stack

This commit is contained in:
John LaFontaine 2015-07-20 15:10:23 -07:00
parent 09a09211d9
commit 6a107fdfc3
33 changed files with 4974 additions and 1485 deletions

View file

@ -0,0 +1,34 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 14
VisualStudioVersion = 14.0.23103.0
MinimumVisualStudioVersion = 10.0.40219.1
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "OpenZWave", "OpenZWave.vcxproj", "{EB1C059F-55DA-420C-B59C-8BDB50B316DE}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|ARM = Debug|ARM
Debug|x64 = Debug|x64
Debug|x86 = Debug|x86
Release|ARM = Release|ARM
Release|x64 = Release|x64
Release|x86 = Release|x86
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{EB1C059F-55DA-420C-B59C-8BDB50B316DE}.Debug|ARM.ActiveCfg = Debug|ARM
{EB1C059F-55DA-420C-B59C-8BDB50B316DE}.Debug|ARM.Build.0 = Debug|ARM
{EB1C059F-55DA-420C-B59C-8BDB50B316DE}.Debug|x64.ActiveCfg = Debug|x64
{EB1C059F-55DA-420C-B59C-8BDB50B316DE}.Debug|x64.Build.0 = Debug|x64
{EB1C059F-55DA-420C-B59C-8BDB50B316DE}.Debug|x86.ActiveCfg = Debug|Win32
{EB1C059F-55DA-420C-B59C-8BDB50B316DE}.Debug|x86.Build.0 = Debug|Win32
{EB1C059F-55DA-420C-B59C-8BDB50B316DE}.Release|ARM.ActiveCfg = Release|ARM
{EB1C059F-55DA-420C-B59C-8BDB50B316DE}.Release|ARM.Build.0 = Release|ARM
{EB1C059F-55DA-420C-B59C-8BDB50B316DE}.Release|x64.ActiveCfg = Release|x64
{EB1C059F-55DA-420C-B59C-8BDB50B316DE}.Release|x64.Build.0 = Release|x64
{EB1C059F-55DA-420C-B59C-8BDB50B316DE}.Release|x86.ActiveCfg = Release|Win32
{EB1C059F-55DA-420C-B59C-8BDB50B316DE}.Release|x86.Build.0 = Release|Win32
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
EndGlobal

View file

@ -0,0 +1,508 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup Label="ProjectConfigurations">
<ProjectConfiguration Include="Debug|ARM">
<Configuration>Debug</Configuration>
<Platform>ARM</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Debug|Win32">
<Configuration>Debug</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Debug|x64">
<Configuration>Debug</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|ARM">
<Configuration>Release</Configuration>
<Platform>ARM</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|Win32">
<Configuration>Release</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|x64">
<Configuration>Release</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
</ItemGroup>
<ItemGroup>
<ClInclude Include="..\..\..\src\aes\aes.h" />
<ClInclude Include="..\..\..\src\aes\aescpp.h" />
<ClInclude Include="..\..\..\src\aes\aesopt.h" />
<ClInclude Include="..\..\..\src\aes\aestab.h" />
<ClInclude Include="..\..\..\src\aes\brg_endian.h" />
<ClInclude Include="..\..\..\src\aes\brg_types.h" />
<ClInclude Include="..\..\..\src\Bitfield.h" />
<ClInclude Include="..\..\..\src\command_classes\Alarm.h" />
<ClInclude Include="..\..\..\src\command_classes\ApplicationStatus.h" />
<ClInclude Include="..\..\..\src\command_classes\Association.h" />
<ClInclude Include="..\..\..\src\command_classes\AssociationCommandConfiguration.h" />
<ClInclude Include="..\..\..\src\command_classes\Basic.h" />
<ClInclude Include="..\..\..\src\command_classes\BasicWindowCovering.h" />
<ClInclude Include="..\..\..\src\command_classes\Battery.h" />
<ClInclude Include="..\..\..\src\command_classes\CentralScene.h" />
<ClInclude Include="..\..\..\src\command_classes\ClimateControlSchedule.h" />
<ClInclude Include="..\..\..\src\command_classes\Clock.h" />
<ClInclude Include="..\..\..\src\command_classes\CommandClass.h" />
<ClInclude Include="..\..\..\src\command_classes\CommandClasses.h" />
<ClInclude Include="..\..\..\src\command_classes\Configuration.h" />
<ClInclude Include="..\..\..\src\command_classes\ControllerReplication.h" />
<ClInclude Include="..\..\..\src\command_classes\CRC16Encap.h" />
<ClInclude Include="..\..\..\src\command_classes\DoorLock.h" />
<ClInclude Include="..\..\..\src\command_classes\DoorLockLogging.h" />
<ClInclude Include="..\..\..\src\command_classes\EnergyProduction.h" />
<ClInclude Include="..\..\..\src\command_classes\Hail.h" />
<ClInclude Include="..\..\..\src\command_classes\Indicator.h" />
<ClInclude Include="..\..\..\src\command_classes\Language.h" />
<ClInclude Include="..\..\..\src\command_classes\Lock.h" />
<ClInclude Include="..\..\..\src\command_classes\ManufacturerSpecific.h" />
<ClInclude Include="..\..\..\src\command_classes\Meter.h" />
<ClInclude Include="..\..\..\src\command_classes\MeterPulse.h" />
<ClInclude Include="..\..\..\src\command_classes\MultiCmd.h" />
<ClInclude Include="..\..\..\src\command_classes\MultiInstance.h" />
<ClInclude Include="..\..\..\src\command_classes\MultiInstanceAssociation.h" />
<ClInclude Include="..\..\..\src\command_classes\NodeNaming.h" />
<ClInclude Include="..\..\..\src\command_classes\NoOperation.h" />
<ClInclude Include="..\..\..\src\command_classes\Powerlevel.h" />
<ClInclude Include="..\..\..\src\command_classes\Proprietary.h" />
<ClInclude Include="..\..\..\src\command_classes\Protection.h" />
<ClInclude Include="..\..\..\src\command_classes\SceneActivation.h" />
<ClInclude Include="..\..\..\src\command_classes\Security.h" />
<ClInclude Include="..\..\..\src\command_classes\SensorAlarm.h" />
<ClInclude Include="..\..\..\src\command_classes\SensorBinary.h" />
<ClInclude Include="..\..\..\src\command_classes\SensorMultilevel.h" />
<ClInclude Include="..\..\..\src\command_classes\SwitchAll.h" />
<ClInclude Include="..\..\..\src\command_classes\SwitchBinary.h" />
<ClInclude Include="..\..\..\src\command_classes\SwitchMultilevel.h" />
<ClInclude Include="..\..\..\src\command_classes\SwitchToggleBinary.h" />
<ClInclude Include="..\..\..\src\command_classes\SwitchToggleMultilevel.h" />
<ClInclude Include="..\..\..\src\command_classes\ThermostatFanMode.h" />
<ClInclude Include="..\..\..\src\command_classes\ThermostatFanState.h" />
<ClInclude Include="..\..\..\src\command_classes\ThermostatMode.h" />
<ClInclude Include="..\..\..\src\command_classes\ThermostatOperatingState.h" />
<ClInclude Include="..\..\..\src\command_classes\ThermostatSetpoint.h" />
<ClInclude Include="..\..\..\src\command_classes\TimeParameters.h" />
<ClInclude Include="..\..\..\src\command_classes\UserCode.h" />
<ClInclude Include="..\..\..\src\command_classes\Version.h" />
<ClInclude Include="..\..\..\src\command_classes\WakeUp.h" />
<ClInclude Include="..\..\..\src\Defs.h" />
<ClInclude Include="..\..\..\src\DoxygenMain.h" />
<ClInclude Include="..\..\..\src\Driver.h" />
<ClInclude Include="..\..\..\src\Group.h" />
<ClInclude Include="..\..\..\src\Manager.h" />
<ClInclude Include="..\..\..\src\Msg.h" />
<ClInclude Include="..\..\..\src\Node.h" />
<ClInclude Include="..\..\..\src\Notification.h" />
<ClInclude Include="..\..\..\src\Options.h" />
<ClInclude Include="..\..\..\src\OZWException.h" />
<ClInclude Include="..\..\..\src\platform\Controller.h" />
<ClInclude Include="..\..\..\src\platform\Event.h" />
<ClInclude Include="..\..\..\src\platform\FileOps.h" />
<ClInclude Include="..\..\..\src\platform\Log.h" />
<ClInclude Include="..\..\..\src\platform\Mutex.h" />
<ClInclude Include="..\..\..\src\platform\Ref.h" />
<ClInclude Include="..\..\..\src\platform\SerialController.h" />
<ClInclude Include="..\..\..\src\platform\Stream.h" />
<ClInclude Include="..\..\..\src\platform\Thread.h" />
<ClInclude Include="..\..\..\src\platform\TimeStamp.h" />
<ClInclude Include="..\..\..\src\platform\Wait.h" />
<ClInclude Include="..\..\..\src\platform\winRT\EventImpl.h" />
<ClInclude Include="..\..\..\src\platform\winRT\FileOpsImpl.h" />
<ClInclude Include="..\..\..\src\platform\winRT\HidControllerWinRT.h" />
<ClInclude Include="..\..\..\src\platform\winRT\LogImpl.h" />
<ClInclude Include="..\..\..\src\platform\winRT\MutexImpl.h" />
<ClInclude Include="..\..\..\src\platform\winRT\SerialControllerImpl.h" />
<ClInclude Include="..\..\..\src\platform\winRT\ThreadImpl.h" />
<ClInclude Include="..\..\..\src\platform\winRT\TimeStampImpl.h" />
<ClInclude Include="..\..\..\src\platform\winRT\WaitImpl.h" />
<ClInclude Include="..\..\..\src\Scene.h" />
<ClInclude Include="..\..\..\src\Utils.h" />
<ClInclude Include="..\..\..\src\value_classes\Value.h" />
<ClInclude Include="..\..\..\src\value_classes\ValueBool.h" />
<ClInclude Include="..\..\..\src\value_classes\ValueButton.h" />
<ClInclude Include="..\..\..\src\value_classes\ValueByte.h" />
<ClInclude Include="..\..\..\src\value_classes\ValueDecimal.h" />
<ClInclude Include="..\..\..\src\value_classes\ValueID.h" />
<ClInclude Include="..\..\..\src\value_classes\ValueInt.h" />
<ClInclude Include="..\..\..\src\value_classes\ValueList.h" />
<ClInclude Include="..\..\..\src\value_classes\ValueRaw.h" />
<ClInclude Include="..\..\..\src\value_classes\ValueSchedule.h" />
<ClInclude Include="..\..\..\src\value_classes\ValueShort.h" />
<ClInclude Include="..\..\..\src\value_classes\ValueStore.h" />
<ClInclude Include="..\..\..\src\value_classes\ValueString.h" />
<ClInclude Include="..\..\..\src\ZWSecurity.h" />
<ClInclude Include="..\..\..\tinyxml\tinystr.h" />
<ClInclude Include="..\..\..\tinyxml\tinyxml.h" />
</ItemGroup>
<ItemGroup>
<ClCompile Include="..\..\..\src\aes\aescrypt.c">
<CompileAsWinRT Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">false</CompileAsWinRT>
<CompileAsWinRT Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">false</CompileAsWinRT>
<CompileAsWinRT Condition="'$(Configuration)|$(Platform)'=='Debug|ARM'">false</CompileAsWinRT>
<CompileAsWinRT Condition="'$(Configuration)|$(Platform)'=='Release|ARM'">false</CompileAsWinRT>
<CompileAsWinRT Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">false</CompileAsWinRT>
<CompileAsWinRT Condition="'$(Configuration)|$(Platform)'=='Release|x64'">false</CompileAsWinRT>
</ClCompile>
<ClCompile Include="..\..\..\src\aes\aeskey.c">
<CompileAsWinRT Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">false</CompileAsWinRT>
<CompileAsWinRT Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">false</CompileAsWinRT>
<CompileAsWinRT Condition="'$(Configuration)|$(Platform)'=='Debug|ARM'">false</CompileAsWinRT>
<CompileAsWinRT Condition="'$(Configuration)|$(Platform)'=='Release|ARM'">false</CompileAsWinRT>
<CompileAsWinRT Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">false</CompileAsWinRT>
<CompileAsWinRT Condition="'$(Configuration)|$(Platform)'=='Release|x64'">false</CompileAsWinRT>
</ClCompile>
<ClCompile Include="..\..\..\src\aes\aestab.c">
<CompileAsWinRT Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">false</CompileAsWinRT>
<CompileAsWinRT Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">false</CompileAsWinRT>
<CompileAsWinRT Condition="'$(Configuration)|$(Platform)'=='Debug|ARM'">false</CompileAsWinRT>
<CompileAsWinRT Condition="'$(Configuration)|$(Platform)'=='Release|ARM'">false</CompileAsWinRT>
<CompileAsWinRT Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">false</CompileAsWinRT>
<CompileAsWinRT Condition="'$(Configuration)|$(Platform)'=='Release|x64'">false</CompileAsWinRT>
</ClCompile>
<ClCompile Include="..\..\..\src\aes\aes_modes.c">
<CompileAsWinRT Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">false</CompileAsWinRT>
<CompileAsWinRT Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">false</CompileAsWinRT>
<CompileAsWinRT Condition="'$(Configuration)|$(Platform)'=='Debug|ARM'">false</CompileAsWinRT>
<CompileAsWinRT Condition="'$(Configuration)|$(Platform)'=='Release|ARM'">false</CompileAsWinRT>
<CompileAsWinRT Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">false</CompileAsWinRT>
<CompileAsWinRT Condition="'$(Configuration)|$(Platform)'=='Release|x64'">false</CompileAsWinRT>
</ClCompile>
<ClCompile Include="..\..\..\src\command_classes\Alarm.cpp" />
<ClCompile Include="..\..\..\src\command_classes\ApplicationStatus.cpp" />
<ClCompile Include="..\..\..\src\command_classes\Association.cpp" />
<ClCompile Include="..\..\..\src\command_classes\AssociationCommandConfiguration.cpp" />
<ClCompile Include="..\..\..\src\command_classes\Basic.cpp" />
<ClCompile Include="..\..\..\src\command_classes\BasicWindowCovering.cpp" />
<ClCompile Include="..\..\..\src\command_classes\Battery.cpp" />
<ClCompile Include="..\..\..\src\command_classes\CentralScene.cpp" />
<ClCompile Include="..\..\..\src\command_classes\ClimateControlSchedule.cpp" />
<ClCompile Include="..\..\..\src\command_classes\Clock.cpp" />
<ClCompile Include="..\..\..\src\command_classes\CommandClass.cpp" />
<ClCompile Include="..\..\..\src\command_classes\CommandClasses.cpp" />
<ClCompile Include="..\..\..\src\command_classes\Configuration.cpp" />
<ClCompile Include="..\..\..\src\command_classes\ControllerReplication.cpp" />
<ClCompile Include="..\..\..\src\command_classes\CRC16Encap.cpp" />
<ClCompile Include="..\..\..\src\command_classes\DoorLock.cpp" />
<ClCompile Include="..\..\..\src\command_classes\DoorLockLogging.cpp" />
<ClCompile Include="..\..\..\src\command_classes\EnergyProduction.cpp" />
<ClCompile Include="..\..\..\src\command_classes\Hail.cpp" />
<ClCompile Include="..\..\..\src\command_classes\Indicator.cpp" />
<ClCompile Include="..\..\..\src\command_classes\Language.cpp" />
<ClCompile Include="..\..\..\src\command_classes\Lock.cpp" />
<ClCompile Include="..\..\..\src\command_classes\ManufacturerSpecific.cpp" />
<ClCompile Include="..\..\..\src\command_classes\Meter.cpp" />
<ClCompile Include="..\..\..\src\command_classes\MeterPulse.cpp" />
<ClCompile Include="..\..\..\src\command_classes\MultiCmd.cpp" />
<ClCompile Include="..\..\..\src\command_classes\MultiInstance.cpp" />
<ClCompile Include="..\..\..\src\command_classes\MultiInstanceAssociation.cpp" />
<ClCompile Include="..\..\..\src\command_classes\NodeNaming.cpp" />
<ClCompile Include="..\..\..\src\command_classes\NoOperation.cpp" />
<ClCompile Include="..\..\..\src\command_classes\Powerlevel.cpp" />
<ClCompile Include="..\..\..\src\command_classes\Proprietary.cpp" />
<ClCompile Include="..\..\..\src\command_classes\Protection.cpp" />
<ClCompile Include="..\..\..\src\command_classes\SceneActivation.cpp" />
<ClCompile Include="..\..\..\src\command_classes\Security.cpp" />
<ClCompile Include="..\..\..\src\command_classes\SensorAlarm.cpp" />
<ClCompile Include="..\..\..\src\command_classes\SensorBinary.cpp" />
<ClCompile Include="..\..\..\src\command_classes\SensorMultilevel.cpp" />
<ClCompile Include="..\..\..\src\command_classes\SwitchAll.cpp" />
<ClCompile Include="..\..\..\src\command_classes\SwitchBinary.cpp" />
<ClCompile Include="..\..\..\src\command_classes\SwitchMultilevel.cpp" />
<ClCompile Include="..\..\..\src\command_classes\SwitchToggleBinary.cpp" />
<ClCompile Include="..\..\..\src\command_classes\SwitchToggleMultilevel.cpp" />
<ClCompile Include="..\..\..\src\command_classes\ThermostatFanMode.cpp" />
<ClCompile Include="..\..\..\src\command_classes\ThermostatFanState.cpp" />
<ClCompile Include="..\..\..\src\command_classes\ThermostatMode.cpp" />
<ClCompile Include="..\..\..\src\command_classes\ThermostatOperatingState.cpp" />
<ClCompile Include="..\..\..\src\command_classes\ThermostatSetpoint.cpp" />
<ClCompile Include="..\..\..\src\command_classes\TimeParameters.cpp" />
<ClCompile Include="..\..\..\src\command_classes\UserCode.cpp" />
<ClCompile Include="..\..\..\src\command_classes\Version.cpp" />
<ClCompile Include="..\..\..\src\command_classes\WakeUp.cpp" />
<ClCompile Include="..\..\..\src\Driver.cpp" />
<ClCompile Include="..\..\..\src\Group.cpp" />
<ClCompile Include="..\..\..\src\Manager.cpp" />
<ClCompile Include="..\..\..\src\Msg.cpp" />
<ClCompile Include="..\..\..\src\Node.cpp" />
<ClCompile Include="..\..\..\src\Notification.cpp" />
<ClCompile Include="..\..\..\src\Options.cpp" />
<ClCompile Include="..\..\..\src\platform\Controller.cpp" />
<ClCompile Include="..\..\..\src\platform\Event.cpp" />
<ClCompile Include="..\..\..\src\platform\FileOps.cpp" />
<ClCompile Include="..\..\..\src\platform\Log.cpp" />
<ClCompile Include="..\..\..\src\platform\Mutex.cpp" />
<ClCompile Include="..\..\..\src\platform\SerialController.cpp" />
<ClCompile Include="..\..\..\src\platform\Stream.cpp" />
<ClCompile Include="..\..\..\src\platform\Thread.cpp" />
<ClCompile Include="..\..\..\src\platform\TimeStamp.cpp" />
<ClCompile Include="..\..\..\src\platform\Wait.cpp" />
<ClCompile Include="..\..\..\src\platform\winRT\EventImpl.cpp" />
<ClCompile Include="..\..\..\src\platform\winRT\FileOpsImpl.cpp" />
<ClCompile Include="..\..\..\src\platform\winRT\HidControllerWinRT.cpp" />
<ClCompile Include="..\..\..\src\platform\winRT\LogImpl.cpp" />
<ClCompile Include="..\..\..\src\platform\winRT\MutexImpl.cpp" />
<ClCompile Include="..\..\..\src\platform\winRT\SerialControllerImpl.cpp" />
<ClCompile Include="..\..\..\src\platform\winRT\ThreadImpl.cpp" />
<ClCompile Include="..\..\..\src\platform\winRT\TimeStampImpl.cpp" />
<ClCompile Include="..\..\..\src\platform\winRT\WaitImpl.cpp" />
<ClCompile Include="..\..\..\src\Scene.cpp" />
<ClCompile Include="..\..\..\src\Utils.cpp" />
<ClCompile Include="..\..\..\src\value_classes\Value.cpp" />
<ClCompile Include="..\..\..\src\value_classes\ValueBool.cpp" />
<ClCompile Include="..\..\..\src\value_classes\ValueButton.cpp" />
<ClCompile Include="..\..\..\src\value_classes\ValueByte.cpp" />
<ClCompile Include="..\..\..\src\value_classes\ValueDecimal.cpp" />
<ClCompile Include="..\..\..\src\value_classes\ValueInt.cpp" />
<ClCompile Include="..\..\..\src\value_classes\ValueList.cpp" />
<ClCompile Include="..\..\..\src\value_classes\ValueRaw.cpp" />
<ClCompile Include="..\..\..\src\value_classes\ValueSchedule.cpp" />
<ClCompile Include="..\..\..\src\value_classes\ValueShort.cpp" />
<ClCompile Include="..\..\..\src\value_classes\ValueStore.cpp" />
<ClCompile Include="..\..\..\src\value_classes\ValueString.cpp" />
<ClCompile Include="..\..\..\src\ZWSecurity.cpp" />
<ClCompile Include="..\..\..\tinyxml\tinystr.cpp" />
<ClCompile Include="..\..\..\tinyxml\tinyxml.cpp" />
<ClCompile Include="..\..\..\tinyxml\tinyxmlerror.cpp" />
<ClCompile Include="..\..\..\tinyxml\tinyxmlparser.cpp" />
<ClCompile Include="..\..\windows\winversion.cpp">
<CompileAsWinRT Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">false</CompileAsWinRT>
<CompileAsWinRT Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">false</CompileAsWinRT>
<CompileAsWinRT Condition="'$(Configuration)|$(Platform)'=='Debug|ARM'">false</CompileAsWinRT>
<CompileAsWinRT Condition="'$(Configuration)|$(Platform)'=='Release|ARM'">false</CompileAsWinRT>
<CompileAsWinRT Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">false</CompileAsWinRT>
<CompileAsWinRT Condition="'$(Configuration)|$(Platform)'=='Release|x64'">false</CompileAsWinRT>
</ClCompile>
</ItemGroup>
<PropertyGroup Label="Globals">
<ProjectGuid>{eb1c059f-55da-420c-b59c-8bdb50b316de}</ProjectGuid>
<Keyword>WindowsRuntimeComponent</Keyword>
<ProjectName>OpenZWave</ProjectName>
<RootNamespace>OpenZWave</RootNamespace>
<DefaultLanguage>en-US</DefaultLanguage>
<MinimumVisualStudioVersion>14.0</MinimumVisualStudioVersion>
<AppContainerApplication>true</AppContainerApplication>
<ApplicationType>Windows Store</ApplicationType>
<WindowsTargetPlatformVersion>10.0.10158.0</WindowsTargetPlatformVersion>
<WindowsTargetPlatformMinVersion>10.0.10158.0</WindowsTargetPlatformMinVersion>
<ApplicationTypeRevision>10.0</ApplicationTypeRevision>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<PlatformToolset>v140</PlatformToolset>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|ARM'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<PlatformToolset>v140</PlatformToolset>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<PlatformToolset>v140</PlatformToolset>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<WholeProgramOptimization>true</WholeProgramOptimization>
<PlatformToolset>v140</PlatformToolset>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|ARM'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<WholeProgramOptimization>true</WholeProgramOptimization>
<PlatformToolset>v140</PlatformToolset>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<WholeProgramOptimization>true</WholeProgramOptimization>
<PlatformToolset>v140</PlatformToolset>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<ImportGroup Label="ExtensionSettings">
</ImportGroup>
<ImportGroup Label="Shared">
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</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')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|ARM'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</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')" Label="LocalAppDataPlatform" />
</ImportGroup>
<PropertyGroup Label="UserMacros" />
<PropertyGroup />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<GenerateManifest>false</GenerateManifest>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<GenerateManifest>false</GenerateManifest>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|ARM'">
<GenerateManifest>false</GenerateManifest>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|ARM'">
<GenerateManifest>false</GenerateManifest>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<GenerateManifest>false</GenerateManifest>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<GenerateManifest>false</GenerateManifest>
</PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<ClCompile>
<PrecompiledHeader>NotUsing</PrecompiledHeader>
<PreprocessorDefinitions>_WINRT_DLL;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PrecompiledHeaderFile>pch.h</PrecompiledHeaderFile>
<PrecompiledHeaderOutputFile>$(IntDir)pch.pch</PrecompiledHeaderOutputFile>
<AdditionalUsingDirectories>$(WindowsSDK_WindowsMetadata);$(AdditionalUsingDirectories)</AdditionalUsingDirectories>
<AdditionalOptions>/bigobj %(AdditionalOptions)</AdditionalOptions>
<DisableSpecificWarnings>28204</DisableSpecificWarnings>
<AdditionalIncludeDirectories>..\..\..\tinyxml;..\..\..\src;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
</ClCompile>
<Link>
<SubSystem>Console</SubSystem>
<IgnoreAllDefaultLibraries>false</IgnoreAllDefaultLibraries>
<IgnoreSpecificDefaultLibraries>/nodefaultlib:vccorlibd;/nodefaultlib:msvcrtd;%(IgnoreSpecificDefaultLibraries)</IgnoreSpecificDefaultLibraries>
<AdditionalDependencies>vccorlibd.lib;msvcrtd.lib;%(AdditionalDependencies)</AdditionalDependencies>
</Link>
<PreBuildEvent>
<Command>del ..\winversion.cpp
CALL $(ProjectDir)\..\..\windows\GIT-VS-VERSION-GEN.bat "$(ProjectDir)\" "..\..\windows\winversion.cpp"
exit 0</Command>
</PreBuildEvent>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<ClCompile>
<PrecompiledHeader>NotUsing</PrecompiledHeader>
<PreprocessorDefinitions>_WINRT_DLL;NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PrecompiledHeaderFile>pch.h</PrecompiledHeaderFile>
<PrecompiledHeaderOutputFile>$(IntDir)pch.pch</PrecompiledHeaderOutputFile>
<AdditionalUsingDirectories>$(WindowsSDK_WindowsMetadata);$(AdditionalUsingDirectories)</AdditionalUsingDirectories>
<AdditionalOptions>/bigobj %(AdditionalOptions)</AdditionalOptions>
<DisableSpecificWarnings>28204</DisableSpecificWarnings>
<AdditionalIncludeDirectories>..\..\..\tinyxml;..\..\..\src;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
</ClCompile>
<Link>
<SubSystem>Console</SubSystem>
<IgnoreAllDefaultLibraries>false</IgnoreAllDefaultLibraries>
<IgnoreSpecificDefaultLibraries>/nodefaultlib:vccorlib;/nodefaultlib:msvcrt;%(IgnoreSpecificDefaultLibraries)</IgnoreSpecificDefaultLibraries>
<AdditionalDependencies>vccorlib.lib;msvcrt.lib;%(AdditionalDependencies)</AdditionalDependencies>
</Link>
<PreBuildEvent>
<Command>del ..\winversion.cpp
CALL $(ProjectDir)\..\..\windows\GIT-VS-VERSION-GEN.bat "$(ProjectDir)\" "..\..\windows\winversion.cpp"
exit 0</Command>
</PreBuildEvent>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|ARM'">
<ClCompile>
<PrecompiledHeader>NotUsing</PrecompiledHeader>
<PreprocessorDefinitions>_WINRT_DLL;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PrecompiledHeaderFile>pch.h</PrecompiledHeaderFile>
<PrecompiledHeaderOutputFile>$(IntDir)pch.pch</PrecompiledHeaderOutputFile>
<AdditionalUsingDirectories>$(WindowsSDK_WindowsMetadata);$(AdditionalUsingDirectories)</AdditionalUsingDirectories>
<AdditionalOptions>/bigobj %(AdditionalOptions)</AdditionalOptions>
<DisableSpecificWarnings>28204</DisableSpecificWarnings>
<AdditionalIncludeDirectories>..\..\..\tinyxml;..\..\..\src;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
</ClCompile>
<Link>
<SubSystem>Console</SubSystem>
<IgnoreAllDefaultLibraries>false</IgnoreAllDefaultLibraries>
<IgnoreSpecificDefaultLibraries>/nodefaultlib:vccorlibd;/nodefaultlib:msvcrtd;%(IgnoreSpecificDefaultLibraries)</IgnoreSpecificDefaultLibraries>
<AdditionalDependencies>vccorlibd.lib;msvcrtd.lib;%(AdditionalDependencies)</AdditionalDependencies>
</Link>
<PreBuildEvent>
<Command>del ..\winversion.cpp
CALL $(ProjectDir)\..\..\windows\GIT-VS-VERSION-GEN.bat "$(ProjectDir)\" "..\..\windows\winversion.cpp"
exit 0</Command>
</PreBuildEvent>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|ARM'">
<ClCompile>
<PrecompiledHeader>NotUsing</PrecompiledHeader>
<PreprocessorDefinitions>_WINRT_DLL;NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PrecompiledHeaderFile>pch.h</PrecompiledHeaderFile>
<PrecompiledHeaderOutputFile>$(IntDir)pch.pch</PrecompiledHeaderOutputFile>
<AdditionalUsingDirectories>$(WindowsSDK_WindowsMetadata);$(AdditionalUsingDirectories)</AdditionalUsingDirectories>
<AdditionalOptions>/bigobj %(AdditionalOptions)</AdditionalOptions>
<DisableSpecificWarnings>28204</DisableSpecificWarnings>
<AdditionalIncludeDirectories>..\..\..\tinyxml;..\..\..\src;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
</ClCompile>
<Link>
<SubSystem>Console</SubSystem>
<IgnoreAllDefaultLibraries>false</IgnoreAllDefaultLibraries>
<IgnoreSpecificDefaultLibraries>/nodefaultlib:vccorlib;/nodefaultlib:msvcrt;%(IgnoreSpecificDefaultLibraries)</IgnoreSpecificDefaultLibraries>
<AdditionalDependencies>vccorlib.lib;msvcrt.lib;%(AdditionalDependencies)</AdditionalDependencies>
</Link>
<PreBuildEvent>
<Command>del ..\winversion.cpp
CALL $(ProjectDir)\..\..\windows\GIT-VS-VERSION-GEN.bat "$(ProjectDir)\" "..\..\windows\winversion.cpp"
exit 0</Command>
</PreBuildEvent>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<ClCompile>
<PrecompiledHeader>NotUsing</PrecompiledHeader>
<PreprocessorDefinitions>_WINRT_DLL;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PrecompiledHeaderFile>pch.h</PrecompiledHeaderFile>
<PrecompiledHeaderOutputFile>$(IntDir)pch.pch</PrecompiledHeaderOutputFile>
<AdditionalUsingDirectories>$(WindowsSDK_WindowsMetadata);$(AdditionalUsingDirectories)</AdditionalUsingDirectories>
<AdditionalOptions>/bigobj %(AdditionalOptions)</AdditionalOptions>
<DisableSpecificWarnings>28204</DisableSpecificWarnings>
<AdditionalIncludeDirectories>..\..\..\tinyxml;..\..\..\src;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
</ClCompile>
<Link>
<SubSystem>Console</SubSystem>
<IgnoreAllDefaultLibraries>false</IgnoreAllDefaultLibraries>
<IgnoreSpecificDefaultLibraries>/nodefaultlib:vccorlibd;/nodefaultlib:msvcrtd;%(IgnoreSpecificDefaultLibraries)</IgnoreSpecificDefaultLibraries>
<AdditionalDependencies>vccorlibd.lib;msvcrtd.lib;%(AdditionalDependencies)</AdditionalDependencies>
</Link>
<PreBuildEvent>
<Command>del ..\winversion.cpp
CALL $(ProjectDir)\..\..\windows\GIT-VS-VERSION-GEN.bat "$(ProjectDir)\" "..\..\windows\winversion.cpp"
exit 0</Command>
</PreBuildEvent>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<ClCompile>
<PrecompiledHeader>NotUsing</PrecompiledHeader>
<PreprocessorDefinitions>_WINRT_DLL;NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PrecompiledHeaderFile>pch.h</PrecompiledHeaderFile>
<PrecompiledHeaderOutputFile>$(IntDir)pch.pch</PrecompiledHeaderOutputFile>
<AdditionalUsingDirectories>$(WindowsSDK_WindowsMetadata);$(AdditionalUsingDirectories)</AdditionalUsingDirectories>
<AdditionalOptions>/bigobj %(AdditionalOptions)</AdditionalOptions>
<DisableSpecificWarnings>28204</DisableSpecificWarnings>
<AdditionalIncludeDirectories>..\..\..\tinyxml;..\..\..\src;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
</ClCompile>
<Link>
<SubSystem>Console</SubSystem>
<IgnoreAllDefaultLibraries>false</IgnoreAllDefaultLibraries>
<IgnoreSpecificDefaultLibraries>/nodefaultlib:vccorlib;/nodefaultlib:msvcrt;%(IgnoreSpecificDefaultLibraries)</IgnoreSpecificDefaultLibraries>
<AdditionalDependencies>vccorlib.lib;msvcrt.lib;%(AdditionalDependencies)</AdditionalDependencies>
</Link>
<PreBuildEvent>
<Command>del ..\winversion.cpp
CALL $(ProjectDir)\..\..\windows\GIT-VS-VERSION-GEN.bat "$(ProjectDir)\" "..\..\windows\winversion.cpp"
exit 0</Command>
</PreBuildEvent>
</ItemDefinitionGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
</ImportGroup>
</Project>

View file

@ -0,0 +1,661 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup>
<Filter Include="Resources">
<UniqueIdentifier>e956b6cc-8fce-4fea-9862-30a92e4c457f</UniqueIdentifier>
<Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tga;tiff;tif;png;wav;mfcribbon-ms</Extensions>
</Filter>
<Filter Include="AES">
<UniqueIdentifier>{145f7034-a6f4-4a79-a798-ec5e16cd924a}</UniqueIdentifier>
</Filter>
<Filter Include="Command Classes">
<UniqueIdentifier>{e4999648-71a8-4ac9-97eb-1a198cfc37b1}</UniqueIdentifier>
</Filter>
<Filter Include="Main">
<UniqueIdentifier>{04041ba9-0609-4b13-88e8-16fef5a26dc2}</UniqueIdentifier>
</Filter>
<Filter Include="Platform">
<UniqueIdentifier>{f6b7ce9f-9ded-49ba-a823-3f655b53b2a9}</UniqueIdentifier>
</Filter>
<Filter Include="TinyXML">
<UniqueIdentifier>{8548f516-7114-410f-991d-5e2ca865b687}</UniqueIdentifier>
</Filter>
<Filter Include="Value Classes">
<UniqueIdentifier>{6fe8adf3-4f69-45b0-964d-731edd44b3b4}</UniqueIdentifier>
</Filter>
<Filter Include="Platform\WinRT">
<UniqueIdentifier>{5c9fb2dd-7c7f-4a12-9760-bca3a3d36675}</UniqueIdentifier>
</Filter>
</ItemGroup>
<ItemGroup>
<ClInclude Include="..\..\..\src\aes\aes.h">
<Filter>AES</Filter>
</ClInclude>
<ClInclude Include="..\..\..\src\aes\aescpp.h">
<Filter>AES</Filter>
</ClInclude>
<ClInclude Include="..\..\..\src\aes\aesopt.h">
<Filter>AES</Filter>
</ClInclude>
<ClInclude Include="..\..\..\src\aes\aestab.h">
<Filter>AES</Filter>
</ClInclude>
<ClInclude Include="..\..\..\src\aes\brg_endian.h">
<Filter>AES</Filter>
</ClInclude>
<ClInclude Include="..\..\..\src\aes\brg_types.h">
<Filter>AES</Filter>
</ClInclude>
<ClInclude Include="..\..\..\src\command_classes\Alarm.h">
<Filter>Command Classes</Filter>
</ClInclude>
<ClInclude Include="..\..\..\src\command_classes\ApplicationStatus.h">
<Filter>Command Classes</Filter>
</ClInclude>
<ClInclude Include="..\..\..\src\command_classes\Association.h">
<Filter>Command Classes</Filter>
</ClInclude>
<ClInclude Include="..\..\..\src\command_classes\AssociationCommandConfiguration.h">
<Filter>Command Classes</Filter>
</ClInclude>
<ClInclude Include="..\..\..\src\command_classes\Basic.h">
<Filter>Command Classes</Filter>
</ClInclude>
<ClInclude Include="..\..\..\src\command_classes\BasicWindowCovering.h">
<Filter>Command Classes</Filter>
</ClInclude>
<ClInclude Include="..\..\..\src\command_classes\Battery.h">
<Filter>Command Classes</Filter>
</ClInclude>
<ClInclude Include="..\..\..\src\command_classes\CentralScene.h">
<Filter>Command Classes</Filter>
</ClInclude>
<ClInclude Include="..\..\..\src\command_classes\ClimateControlSchedule.h">
<Filter>Command Classes</Filter>
</ClInclude>
<ClInclude Include="..\..\..\src\command_classes\Clock.h">
<Filter>Command Classes</Filter>
</ClInclude>
<ClInclude Include="..\..\..\src\command_classes\CommandClass.h">
<Filter>Command Classes</Filter>
</ClInclude>
<ClInclude Include="..\..\..\src\command_classes\CommandClasses.h">
<Filter>Command Classes</Filter>
</ClInclude>
<ClInclude Include="..\..\..\src\command_classes\Configuration.h">
<Filter>Command Classes</Filter>
</ClInclude>
<ClInclude Include="..\..\..\src\command_classes\ControllerReplication.h">
<Filter>Command Classes</Filter>
</ClInclude>
<ClInclude Include="..\..\..\src\command_classes\CRC16Encap.h">
<Filter>Command Classes</Filter>
</ClInclude>
<ClInclude Include="..\..\..\src\command_classes\DoorLock.h">
<Filter>Command Classes</Filter>
</ClInclude>
<ClInclude Include="..\..\..\src\command_classes\DoorLockLogging.h">
<Filter>Command Classes</Filter>
</ClInclude>
<ClInclude Include="..\..\..\src\command_classes\EnergyProduction.h">
<Filter>Command Classes</Filter>
</ClInclude>
<ClInclude Include="..\..\..\src\command_classes\Hail.h">
<Filter>Command Classes</Filter>
</ClInclude>
<ClInclude Include="..\..\..\src\command_classes\Indicator.h">
<Filter>Command Classes</Filter>
</ClInclude>
<ClInclude Include="..\..\..\src\command_classes\Language.h">
<Filter>Command Classes</Filter>
</ClInclude>
<ClInclude Include="..\..\..\src\command_classes\Lock.h">
<Filter>Command Classes</Filter>
</ClInclude>
<ClInclude Include="..\..\..\src\command_classes\ManufacturerSpecific.h">
<Filter>Command Classes</Filter>
</ClInclude>
<ClInclude Include="..\..\..\src\command_classes\Meter.h">
<Filter>Command Classes</Filter>
</ClInclude>
<ClInclude Include="..\..\..\src\command_classes\MeterPulse.h">
<Filter>Command Classes</Filter>
</ClInclude>
<ClInclude Include="..\..\..\src\command_classes\MultiCmd.h">
<Filter>Command Classes</Filter>
</ClInclude>
<ClInclude Include="..\..\..\src\command_classes\MultiInstance.h">
<Filter>Command Classes</Filter>
</ClInclude>
<ClInclude Include="..\..\..\src\command_classes\MultiInstanceAssociation.h">
<Filter>Command Classes</Filter>
</ClInclude>
<ClInclude Include="..\..\..\src\command_classes\NodeNaming.h">
<Filter>Command Classes</Filter>
</ClInclude>
<ClInclude Include="..\..\..\src\command_classes\NoOperation.h">
<Filter>Command Classes</Filter>
</ClInclude>
<ClInclude Include="..\..\..\src\command_classes\Powerlevel.h">
<Filter>Command Classes</Filter>
</ClInclude>
<ClInclude Include="..\..\..\src\command_classes\Proprietary.h">
<Filter>Command Classes</Filter>
</ClInclude>
<ClInclude Include="..\..\..\src\command_classes\Protection.h">
<Filter>Command Classes</Filter>
</ClInclude>
<ClInclude Include="..\..\..\src\command_classes\SceneActivation.h">
<Filter>Command Classes</Filter>
</ClInclude>
<ClInclude Include="..\..\..\src\command_classes\Security.h">
<Filter>Command Classes</Filter>
</ClInclude>
<ClInclude Include="..\..\..\src\command_classes\SensorAlarm.h">
<Filter>Command Classes</Filter>
</ClInclude>
<ClInclude Include="..\..\..\src\command_classes\SensorBinary.h">
<Filter>Command Classes</Filter>
</ClInclude>
<ClInclude Include="..\..\..\src\command_classes\SensorMultilevel.h">
<Filter>Command Classes</Filter>
</ClInclude>
<ClInclude Include="..\..\..\src\command_classes\SwitchAll.h">
<Filter>Command Classes</Filter>
</ClInclude>
<ClInclude Include="..\..\..\src\command_classes\SwitchBinary.h">
<Filter>Command Classes</Filter>
</ClInclude>
<ClInclude Include="..\..\..\src\command_classes\SwitchMultilevel.h">
<Filter>Command Classes</Filter>
</ClInclude>
<ClInclude Include="..\..\..\src\command_classes\SwitchToggleBinary.h">
<Filter>Command Classes</Filter>
</ClInclude>
<ClInclude Include="..\..\..\src\command_classes\SwitchToggleMultilevel.h">
<Filter>Command Classes</Filter>
</ClInclude>
<ClInclude Include="..\..\..\src\command_classes\ThermostatFanMode.h">
<Filter>Command Classes</Filter>
</ClInclude>
<ClInclude Include="..\..\..\src\command_classes\ThermostatFanState.h">
<Filter>Command Classes</Filter>
</ClInclude>
<ClInclude Include="..\..\..\src\command_classes\ThermostatMode.h">
<Filter>Command Classes</Filter>
</ClInclude>
<ClInclude Include="..\..\..\src\command_classes\ThermostatOperatingState.h">
<Filter>Command Classes</Filter>
</ClInclude>
<ClInclude Include="..\..\..\src\command_classes\ThermostatSetpoint.h">
<Filter>Command Classes</Filter>
</ClInclude>
<ClInclude Include="..\..\..\src\command_classes\TimeParameters.h">
<Filter>Command Classes</Filter>
</ClInclude>
<ClInclude Include="..\..\..\src\command_classes\UserCode.h">
<Filter>Command Classes</Filter>
</ClInclude>
<ClInclude Include="..\..\..\src\command_classes\Version.h">
<Filter>Command Classes</Filter>
</ClInclude>
<ClInclude Include="..\..\..\src\command_classes\WakeUp.h">
<Filter>Command Classes</Filter>
</ClInclude>
<ClInclude Include="..\..\..\src\Bitfield.h">
<Filter>Main</Filter>
</ClInclude>
<ClInclude Include="..\..\..\src\Defs.h">
<Filter>Main</Filter>
</ClInclude>
<ClInclude Include="..\..\..\src\DoxygenMain.h">
<Filter>Main</Filter>
</ClInclude>
<ClInclude Include="..\..\..\src\Driver.h">
<Filter>Main</Filter>
</ClInclude>
<ClInclude Include="..\..\..\src\Group.h">
<Filter>Main</Filter>
</ClInclude>
<ClInclude Include="..\..\..\src\Manager.h">
<Filter>Main</Filter>
</ClInclude>
<ClInclude Include="..\..\..\src\Msg.h">
<Filter>Main</Filter>
</ClInclude>
<ClInclude Include="..\..\..\src\Node.h">
<Filter>Main</Filter>
</ClInclude>
<ClInclude Include="..\..\..\src\Notification.h">
<Filter>Main</Filter>
</ClInclude>
<ClInclude Include="..\..\..\src\Options.h">
<Filter>Main</Filter>
</ClInclude>
<ClInclude Include="..\..\..\src\OZWException.h">
<Filter>Main</Filter>
</ClInclude>
<ClInclude Include="..\..\..\src\Scene.h">
<Filter>Main</Filter>
</ClInclude>
<ClInclude Include="..\..\..\src\Utils.h">
<Filter>Main</Filter>
</ClInclude>
<ClInclude Include="..\..\..\src\ZWSecurity.h">
<Filter>Main</Filter>
</ClInclude>
<ClInclude Include="..\..\..\src\value_classes\Value.h">
<Filter>Value Classes</Filter>
</ClInclude>
<ClInclude Include="..\..\..\src\value_classes\ValueBool.h">
<Filter>Value Classes</Filter>
</ClInclude>
<ClInclude Include="..\..\..\src\value_classes\ValueButton.h">
<Filter>Value Classes</Filter>
</ClInclude>
<ClInclude Include="..\..\..\src\value_classes\ValueByte.h">
<Filter>Value Classes</Filter>
</ClInclude>
<ClInclude Include="..\..\..\src\value_classes\ValueDecimal.h">
<Filter>Value Classes</Filter>
</ClInclude>
<ClInclude Include="..\..\..\src\value_classes\ValueID.h">
<Filter>Value Classes</Filter>
</ClInclude>
<ClInclude Include="..\..\..\src\value_classes\ValueInt.h">
<Filter>Value Classes</Filter>
</ClInclude>
<ClInclude Include="..\..\..\src\value_classes\ValueList.h">
<Filter>Value Classes</Filter>
</ClInclude>
<ClInclude Include="..\..\..\src\value_classes\ValueRaw.h">
<Filter>Value Classes</Filter>
</ClInclude>
<ClInclude Include="..\..\..\src\value_classes\ValueSchedule.h">
<Filter>Value Classes</Filter>
</ClInclude>
<ClInclude Include="..\..\..\src\value_classes\ValueShort.h">
<Filter>Value Classes</Filter>
</ClInclude>
<ClInclude Include="..\..\..\src\value_classes\ValueStore.h">
<Filter>Value Classes</Filter>
</ClInclude>
<ClInclude Include="..\..\..\src\value_classes\ValueString.h">
<Filter>Value Classes</Filter>
</ClInclude>
<ClInclude Include="..\..\..\tinyxml\tinystr.h">
<Filter>TinyXML</Filter>
</ClInclude>
<ClInclude Include="..\..\..\tinyxml\tinyxml.h">
<Filter>TinyXML</Filter>
</ClInclude>
<ClInclude Include="..\..\..\src\platform\Controller.h">
<Filter>Platform</Filter>
</ClInclude>
<ClInclude Include="..\..\..\src\platform\Event.h">
<Filter>Platform</Filter>
</ClInclude>
<ClInclude Include="..\..\..\src\platform\FileOps.h">
<Filter>Platform</Filter>
</ClInclude>
<ClInclude Include="..\..\..\src\platform\Log.h">
<Filter>Platform</Filter>
</ClInclude>
<ClInclude Include="..\..\..\src\platform\Mutex.h">
<Filter>Platform</Filter>
</ClInclude>
<ClInclude Include="..\..\..\src\platform\Ref.h">
<Filter>Platform</Filter>
</ClInclude>
<ClInclude Include="..\..\..\src\platform\SerialController.h">
<Filter>Platform</Filter>
</ClInclude>
<ClInclude Include="..\..\..\src\platform\Stream.h">
<Filter>Platform</Filter>
</ClInclude>
<ClInclude Include="..\..\..\src\platform\Thread.h">
<Filter>Platform</Filter>
</ClInclude>
<ClInclude Include="..\..\..\src\platform\TimeStamp.h">
<Filter>Platform</Filter>
</ClInclude>
<ClInclude Include="..\..\..\src\platform\Wait.h">
<Filter>Platform</Filter>
</ClInclude>
<ClInclude Include="..\..\..\src\platform\winRT\EventImpl.h">
<Filter>Platform\WinRT</Filter>
</ClInclude>
<ClInclude Include="..\..\..\src\platform\winRT\FileOpsImpl.h">
<Filter>Platform\WinRT</Filter>
</ClInclude>
<ClInclude Include="..\..\..\src\platform\winRT\HidControllerWinRT.h">
<Filter>Platform\WinRT</Filter>
</ClInclude>
<ClInclude Include="..\..\..\src\platform\winRT\LogImpl.h">
<Filter>Platform\WinRT</Filter>
</ClInclude>
<ClInclude Include="..\..\..\src\platform\winRT\MutexImpl.h">
<Filter>Platform\WinRT</Filter>
</ClInclude>
<ClInclude Include="..\..\..\src\platform\winRT\SerialControllerImpl.h">
<Filter>Platform\WinRT</Filter>
</ClInclude>
<ClInclude Include="..\..\..\src\platform\winRT\ThreadImpl.h">
<Filter>Platform\WinRT</Filter>
</ClInclude>
<ClInclude Include="..\..\..\src\platform\winRT\TimeStampImpl.h">
<Filter>Platform\WinRT</Filter>
</ClInclude>
<ClInclude Include="..\..\..\src\platform\winRT\WaitImpl.h">
<Filter>Platform\WinRT</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<ClCompile Include="..\..\..\src\aes\aes_modes.c">
<Filter>AES</Filter>
</ClCompile>
<ClCompile Include="..\..\..\src\aes\aescrypt.c">
<Filter>AES</Filter>
</ClCompile>
<ClCompile Include="..\..\..\src\aes\aeskey.c">
<Filter>AES</Filter>
</ClCompile>
<ClCompile Include="..\..\..\src\aes\aestab.c">
<Filter>AES</Filter>
</ClCompile>
<ClCompile Include="..\..\..\src\command_classes\Alarm.cpp">
<Filter>Command Classes</Filter>
</ClCompile>
<ClCompile Include="..\..\..\src\command_classes\ApplicationStatus.cpp">
<Filter>Command Classes</Filter>
</ClCompile>
<ClCompile Include="..\..\..\src\command_classes\Association.cpp">
<Filter>Command Classes</Filter>
</ClCompile>
<ClCompile Include="..\..\..\src\command_classes\AssociationCommandConfiguration.cpp">
<Filter>Command Classes</Filter>
</ClCompile>
<ClCompile Include="..\..\..\src\command_classes\Basic.cpp">
<Filter>Command Classes</Filter>
</ClCompile>
<ClCompile Include="..\..\..\src\command_classes\BasicWindowCovering.cpp">
<Filter>Command Classes</Filter>
</ClCompile>
<ClCompile Include="..\..\..\src\command_classes\Battery.cpp">
<Filter>Command Classes</Filter>
</ClCompile>
<ClCompile Include="..\..\..\src\command_classes\CentralScene.cpp">
<Filter>Command Classes</Filter>
</ClCompile>
<ClCompile Include="..\..\..\src\command_classes\ClimateControlSchedule.cpp">
<Filter>Command Classes</Filter>
</ClCompile>
<ClCompile Include="..\..\..\src\command_classes\Clock.cpp">
<Filter>Command Classes</Filter>
</ClCompile>
<ClCompile Include="..\..\..\src\command_classes\CommandClass.cpp">
<Filter>Command Classes</Filter>
</ClCompile>
<ClCompile Include="..\..\..\src\command_classes\CommandClasses.cpp">
<Filter>Command Classes</Filter>
</ClCompile>
<ClCompile Include="..\..\..\src\command_classes\Configuration.cpp">
<Filter>Command Classes</Filter>
</ClCompile>
<ClCompile Include="..\..\..\src\command_classes\ControllerReplication.cpp">
<Filter>Command Classes</Filter>
</ClCompile>
<ClCompile Include="..\..\..\src\command_classes\CRC16Encap.cpp">
<Filter>Command Classes</Filter>
</ClCompile>
<ClCompile Include="..\..\..\src\command_classes\DoorLock.cpp">
<Filter>Command Classes</Filter>
</ClCompile>
<ClCompile Include="..\..\..\src\command_classes\DoorLockLogging.cpp">
<Filter>Command Classes</Filter>
</ClCompile>
<ClCompile Include="..\..\..\src\command_classes\EnergyProduction.cpp">
<Filter>Command Classes</Filter>
</ClCompile>
<ClCompile Include="..\..\..\src\command_classes\Hail.cpp">
<Filter>Command Classes</Filter>
</ClCompile>
<ClCompile Include="..\..\..\src\command_classes\Indicator.cpp">
<Filter>Command Classes</Filter>
</ClCompile>
<ClCompile Include="..\..\..\src\command_classes\Language.cpp">
<Filter>Command Classes</Filter>
</ClCompile>
<ClCompile Include="..\..\..\src\command_classes\Lock.cpp">
<Filter>Command Classes</Filter>
</ClCompile>
<ClCompile Include="..\..\..\src\command_classes\ManufacturerSpecific.cpp">
<Filter>Command Classes</Filter>
</ClCompile>
<ClCompile Include="..\..\..\src\command_classes\Meter.cpp">
<Filter>Command Classes</Filter>
</ClCompile>
<ClCompile Include="..\..\..\src\command_classes\MeterPulse.cpp">
<Filter>Command Classes</Filter>
</ClCompile>
<ClCompile Include="..\..\..\src\command_classes\MultiCmd.cpp">
<Filter>Command Classes</Filter>
</ClCompile>
<ClCompile Include="..\..\..\src\command_classes\MultiInstance.cpp">
<Filter>Command Classes</Filter>
</ClCompile>
<ClCompile Include="..\..\..\src\command_classes\MultiInstanceAssociation.cpp">
<Filter>Command Classes</Filter>
</ClCompile>
<ClCompile Include="..\..\..\src\command_classes\NodeNaming.cpp">
<Filter>Command Classes</Filter>
</ClCompile>
<ClCompile Include="..\..\..\src\command_classes\NoOperation.cpp">
<Filter>Command Classes</Filter>
</ClCompile>
<ClCompile Include="..\..\..\src\command_classes\Powerlevel.cpp">
<Filter>Command Classes</Filter>
</ClCompile>
<ClCompile Include="..\..\..\src\command_classes\Proprietary.cpp">
<Filter>Command Classes</Filter>
</ClCompile>
<ClCompile Include="..\..\..\src\command_classes\Protection.cpp">
<Filter>Command Classes</Filter>
</ClCompile>
<ClCompile Include="..\..\..\src\command_classes\SceneActivation.cpp">
<Filter>Command Classes</Filter>
</ClCompile>
<ClCompile Include="..\..\..\src\command_classes\Security.cpp">
<Filter>Command Classes</Filter>
</ClCompile>
<ClCompile Include="..\..\..\src\command_classes\SensorAlarm.cpp">
<Filter>Command Classes</Filter>
</ClCompile>
<ClCompile Include="..\..\..\src\command_classes\SensorBinary.cpp">
<Filter>Command Classes</Filter>
</ClCompile>
<ClCompile Include="..\..\..\src\command_classes\SensorMultilevel.cpp">
<Filter>Command Classes</Filter>
</ClCompile>
<ClCompile Include="..\..\..\src\command_classes\SwitchAll.cpp">
<Filter>Command Classes</Filter>
</ClCompile>
<ClCompile Include="..\..\..\src\command_classes\SwitchBinary.cpp">
<Filter>Command Classes</Filter>
</ClCompile>
<ClCompile Include="..\..\..\src\command_classes\SwitchMultilevel.cpp">
<Filter>Command Classes</Filter>
</ClCompile>
<ClCompile Include="..\..\..\src\command_classes\SwitchToggleBinary.cpp">
<Filter>Command Classes</Filter>
</ClCompile>
<ClCompile Include="..\..\..\src\command_classes\SwitchToggleMultilevel.cpp">
<Filter>Command Classes</Filter>
</ClCompile>
<ClCompile Include="..\..\..\src\command_classes\ThermostatFanMode.cpp">
<Filter>Command Classes</Filter>
</ClCompile>
<ClCompile Include="..\..\..\src\command_classes\ThermostatFanState.cpp">
<Filter>Command Classes</Filter>
</ClCompile>
<ClCompile Include="..\..\..\src\command_classes\ThermostatMode.cpp">
<Filter>Command Classes</Filter>
</ClCompile>
<ClCompile Include="..\..\..\src\command_classes\ThermostatOperatingState.cpp">
<Filter>Command Classes</Filter>
</ClCompile>
<ClCompile Include="..\..\..\src\command_classes\ThermostatSetpoint.cpp">
<Filter>Command Classes</Filter>
</ClCompile>
<ClCompile Include="..\..\..\src\command_classes\TimeParameters.cpp">
<Filter>Command Classes</Filter>
</ClCompile>
<ClCompile Include="..\..\..\src\command_classes\UserCode.cpp">
<Filter>Command Classes</Filter>
</ClCompile>
<ClCompile Include="..\..\..\src\command_classes\Version.cpp">
<Filter>Command Classes</Filter>
</ClCompile>
<ClCompile Include="..\..\..\src\command_classes\WakeUp.cpp">
<Filter>Command Classes</Filter>
</ClCompile>
<ClCompile Include="..\..\..\src\Driver.cpp">
<Filter>Main</Filter>
</ClCompile>
<ClCompile Include="..\..\..\src\Group.cpp">
<Filter>Main</Filter>
</ClCompile>
<ClCompile Include="..\..\..\src\Manager.cpp">
<Filter>Main</Filter>
</ClCompile>
<ClCompile Include="..\..\..\src\Msg.cpp">
<Filter>Main</Filter>
</ClCompile>
<ClCompile Include="..\..\..\src\Node.cpp">
<Filter>Main</Filter>
</ClCompile>
<ClCompile Include="..\..\..\src\Notification.cpp">
<Filter>Main</Filter>
</ClCompile>
<ClCompile Include="..\..\..\src\Options.cpp">
<Filter>Main</Filter>
</ClCompile>
<ClCompile Include="..\..\..\src\Scene.cpp">
<Filter>Main</Filter>
</ClCompile>
<ClCompile Include="..\..\..\src\Utils.cpp">
<Filter>Main</Filter>
</ClCompile>
<ClCompile Include="..\..\..\src\ZWSecurity.cpp">
<Filter>Main</Filter>
</ClCompile>
<ClCompile Include="..\..\..\src\value_classes\Value.cpp">
<Filter>Value Classes</Filter>
</ClCompile>
<ClCompile Include="..\..\..\src\value_classes\ValueBool.cpp">
<Filter>Value Classes</Filter>
</ClCompile>
<ClCompile Include="..\..\..\src\value_classes\ValueButton.cpp">
<Filter>Value Classes</Filter>
</ClCompile>
<ClCompile Include="..\..\..\src\value_classes\ValueByte.cpp">
<Filter>Value Classes</Filter>
</ClCompile>
<ClCompile Include="..\..\..\src\value_classes\ValueDecimal.cpp">
<Filter>Value Classes</Filter>
</ClCompile>
<ClCompile Include="..\..\..\src\value_classes\ValueInt.cpp">
<Filter>Value Classes</Filter>
</ClCompile>
<ClCompile Include="..\..\..\src\value_classes\ValueList.cpp">
<Filter>Value Classes</Filter>
</ClCompile>
<ClCompile Include="..\..\..\src\value_classes\ValueRaw.cpp">
<Filter>Value Classes</Filter>
</ClCompile>
<ClCompile Include="..\..\..\src\value_classes\ValueSchedule.cpp">
<Filter>Value Classes</Filter>
</ClCompile>
<ClCompile Include="..\..\..\src\value_classes\ValueShort.cpp">
<Filter>Value Classes</Filter>
</ClCompile>
<ClCompile Include="..\..\..\src\value_classes\ValueStore.cpp">
<Filter>Value Classes</Filter>
</ClCompile>
<ClCompile Include="..\..\..\src\value_classes\ValueString.cpp">
<Filter>Value Classes</Filter>
</ClCompile>
<ClCompile Include="..\..\..\tinyxml\tinystr.cpp">
<Filter>TinyXML</Filter>
</ClCompile>
<ClCompile Include="..\..\..\tinyxml\tinyxml.cpp">
<Filter>TinyXML</Filter>
</ClCompile>
<ClCompile Include="..\..\..\tinyxml\tinyxmlerror.cpp">
<Filter>TinyXML</Filter>
</ClCompile>
<ClCompile Include="..\..\..\tinyxml\tinyxmlparser.cpp">
<Filter>TinyXML</Filter>
</ClCompile>
<ClCompile Include="..\..\..\src\platform\Controller.cpp">
<Filter>Platform</Filter>
</ClCompile>
<ClCompile Include="..\..\..\src\platform\Event.cpp">
<Filter>Platform</Filter>
</ClCompile>
<ClCompile Include="..\..\..\src\platform\FileOps.cpp">
<Filter>Platform</Filter>
</ClCompile>
<ClCompile Include="..\..\..\src\platform\Log.cpp">
<Filter>Platform</Filter>
</ClCompile>
<ClCompile Include="..\..\..\src\platform\Mutex.cpp">
<Filter>Platform</Filter>
</ClCompile>
<ClCompile Include="..\..\..\src\platform\SerialController.cpp">
<Filter>Platform</Filter>
</ClCompile>
<ClCompile Include="..\..\..\src\platform\Stream.cpp">
<Filter>Platform</Filter>
</ClCompile>
<ClCompile Include="..\..\..\src\platform\Thread.cpp">
<Filter>Platform</Filter>
</ClCompile>
<ClCompile Include="..\..\..\src\platform\TimeStamp.cpp">
<Filter>Platform</Filter>
</ClCompile>
<ClCompile Include="..\..\..\src\platform\Wait.cpp">
<Filter>Platform</Filter>
</ClCompile>
<ClCompile Include="..\..\..\src\platform\winRT\EventImpl.cpp">
<Filter>Platform\WinRT</Filter>
</ClCompile>
<ClCompile Include="..\..\..\src\platform\winRT\FileOpsImpl.cpp">
<Filter>Platform\WinRT</Filter>
</ClCompile>
<ClCompile Include="..\..\..\src\platform\winRT\HidControllerWinRT.cpp">
<Filter>Platform\WinRT</Filter>
</ClCompile>
<ClCompile Include="..\..\..\src\platform\winRT\LogImpl.cpp">
<Filter>Platform\WinRT</Filter>
</ClCompile>
<ClCompile Include="..\..\..\src\platform\winRT\MutexImpl.cpp">
<Filter>Platform\WinRT</Filter>
</ClCompile>
<ClCompile Include="..\..\..\src\platform\winRT\SerialControllerImpl.cpp">
<Filter>Platform\WinRT</Filter>
</ClCompile>
<ClCompile Include="..\..\..\src\platform\winRT\ThreadImpl.cpp">
<Filter>Platform\WinRT</Filter>
</ClCompile>
<ClCompile Include="..\..\..\src\platform\winRT\TimeStampImpl.cpp">
<Filter>Platform\WinRT</Filter>
</ClCompile>
<ClCompile Include="..\..\..\src\platform\winRT\WaitImpl.cpp">
<Filter>Platform\WinRT</Filter>
</ClCompile>
<ClCompile Include="..\..\windows\winversion.cpp">
<Filter>Main</Filter>
</ClCompile>
</ItemGroup>
</Project>

View file

@ -37,7 +37,11 @@
#include "platform/Event.h"
#include "platform/Mutex.h"
#include "platform/SerialController.h"
#ifdef _WINRT_DLL
#include "platform/winRT/HidControllerWinRT.h"
#else
#include "platform/HidController.h"
#endif
#include "platform/Thread.h"
#include "platform/Log.h"
#include "platform/TimeStamp.h"
@ -137,6 +141,7 @@ Driver::Driver
ControllerInterface const& _interface
):
m_driverThread( new Thread( "driver" ) ),
m_initMutex(new Mutex()),
m_exit( false ),
m_init( false ),
m_awakeNodesQueried( false ),
@ -266,7 +271,9 @@ Driver::~Driver
// The order of the statements below has been achieved by mitigating freed memory
//references using a memory allocator checker. Do not rearrange unless you are
//certain memory won't be referenced out of order. --Greg Satz, April 2010
m_initMutex->Lock();
m_exit = true;
m_initMutex->Unlock();
m_pollThread->Stop();
m_pollThread->Release();
@ -279,6 +286,8 @@ Driver::~Driver
m_controller->Close();
m_controller->Release();
m_initMutex->Release();
if( m_currentMsg != NULL )
{
RemoveCurrentMsg();
@ -526,6 +535,14 @@ bool Driver::Init
uint32 _attempts
)
{
m_initMutex->Lock();
if (m_exit)
{
m_initMutex->Unlock();
return false;
}
m_Controller_nodeId = -1;
m_waitingForAck = false;
@ -535,6 +552,7 @@ bool Driver::Init
if( !m_controller->Open( m_controllerPath ) )
{
Log::Write( LogLevel_Warning, "WARNING: Failed to init the controller (attempt %d)", _attempts );
m_initMutex->Unlock();
return false;
}
@ -553,6 +571,8 @@ bool Driver::Init
//msg->Append( 0xff );
//SendMsg( msg );
m_initMutex->Unlock();
// Init successful
return true;
}
@ -1214,7 +1234,20 @@ bool Driver::WriteMsg
}
} else {
Log::Write( LogLevel_Info, nodeId, "Sending (%s) message (%sCallback ID=0x%.2x, Expected Reply=0x%.2x) - %s", c_sendQueueNames[m_currentMsgQueueSource], attemptsstr.c_str(), m_expectedCallbackId, m_expectedReply, m_currentMsg->GetAsString().c_str() );
m_controller->Write( m_currentMsg->GetBuffer(), m_currentMsg->GetLength() );
uint32 bytesWritten = m_controller->Write(m_currentMsg->GetBuffer(), m_currentMsg->GetLength());
if (bytesWritten == 0)
{
//0 will be returned when the port is closed or something bad happened
//so send notification
Notification* notification = new Notification(Notification::Type_DriverFailed);
notification->SetHomeAndNodeIds(m_homeId, m_currentMsg->GetTargetNodeId());
QueueNotification(notification);
NotifyWatchers();
m_driverThread->Stop();
return false;
}
}
m_writeCnt++;

View file

@ -149,6 +149,7 @@ namespace OpenZWave
void RemoveQueues( uint8 const _nodeId );
Thread* m_driverThread; /**< Thread for reading from the Z-Wave controller, and for creating and managing the other threads for sending, polling etc. */
Mutex* m_initMutex; /**< Mutex to ensure proper ordering of initialization/deinitialization */
bool m_exit; /**< Flag that is set when the application is exiting. */
bool m_init; /**< Set to true once the driver has been initialised */
bool m_awakeNodesQueried; /**< Set to true once the driver has polled all awake nodes */

View file

@ -129,6 +129,10 @@ Options* Options::Create
s_instance->AddOptionString( "SecurityStrategy", "SUPPORTED", false); // Should we encrypt CC's that are available via both clear text and Security CC?
s_instance->AddOptionString( "CustomSecuredCC", "0x62,0x4c,0x63", false); // What List of Custom CC should we always encrypt if SecurityStrategy is CUSTOM
s_instance->AddOptionBool( "EnforceSecureReception", true); // if we recieve a clear text message for a CC that is Secured, should we drop the message
#if defined _WINRT_DLL
s_instance->AddOptionInt( "ThreadTerminateTimeout", -1); // Since threads cannot be terminated in WinRT, Thread::Terminate will simply wait for them to exit on there own
#endif
}
return s_instance;

View file

@ -178,7 +178,14 @@ bool TimeParameters::SetValue
time_t rawtime;
struct tm *timeinfo;
time(&rawtime);
#ifdef WINAPI_FAMILY_APP
#pragma warning(push)
#pragma warning(disable:4996)
#endif
timeinfo = localtime(&rawtime);
#ifdef WINAPI_FAMILY_APP
#pragma warning(pop)
#endif
Msg* msg = new Msg( "TimeParametersCmd_Set", GetNodeId(), REQUEST, FUNC_ID_ZW_SEND_DATA, true, true, FUNC_ID_APPLICATION_COMMAND_HANDLER, GetCommandClassId() );
msg->SetInstance( this, instance );
msg->Append( GetNodeId() );

View file

@ -30,6 +30,8 @@
#ifdef WIN32
#include "platform/windows/EventImpl.h" // Platform-specific implementation of an event
#elif defined _WINRT_DLL
#include "platform/winRT/EventImpl.h" // Platform-specific implementation of an event
#else
#include "platform/unix/EventImpl.h" // Platform-specific implementation of an event
#endif

View file

@ -30,6 +30,8 @@
#ifdef WIN32
#include "platform/windows/FileOpsImpl.h" // Platform-specific implementation of a File Operations
#elif defined _WINRT_DLL
#include "platform/winRT/FileOpsImpl.h" // Platform-specific implementation of a File Operations
#else
#include "platform/unix/FileOpsImpl.h" // Platform-specific implementation of a File Operations
#endif

View file

@ -33,6 +33,8 @@
#ifdef WIN32
#include "platform/windows/LogImpl.h" // Platform-specific implementation of a log
#elif defined _WINRT_DLL
#include "platform/winRT/LogImpl.h" // Platform-specific implementation of a log
#else
#include "platform/unix/LogImpl.h" // Platform-specific implementation of a log
#endif

View file

@ -30,6 +30,8 @@
#ifdef WIN32
#include "platform/windows/MutexImpl.h" // Platform-specific implementation of a mutex
#elif defined _WINRT_DLL
#include "platform/winRT/MutexImpl.h" // Platform-specific implementation of a mutex
#else
#include "platform/unix/MutexImpl.h" // Platform-specific implementation of a mutex
#endif

View file

@ -33,6 +33,8 @@
#ifdef WIN32
#include "platform/windows/SerialControllerImpl.h" // Platform-specific implementation of a serial port
#elif defined _WINRT_DLL
#include "platform/winRT/SerialControllerImpl.h" // Platform-specific implementation of a serial port
#else
#include "platform/unix/SerialControllerImpl.h" // Platform-specific implementation of a serial port
#endif

View file

@ -31,6 +31,8 @@
#ifdef WIN32
#include "platform/windows/ThreadImpl.h" // Platform-specific implementation of a thread
#elif defined _WINRT_DLL
#include "platform/winRT/ThreadImpl.h" // Platform-specific implementation of a thread
#else
#include "platform/unix/ThreadImpl.h" // Platform-specific implementation of a thread
#endif

View file

@ -31,6 +31,8 @@
#ifdef WIN32
#include "platform/windows/TimeStampImpl.h" // Platform-specific implementation of a TimeStamp
#elif defined _WINRT_DLL
#include "platform/winRT/TimeStampImpl.h" // Platform-specific implementation of a TimeStamp
#else
#include "platform/unix/TimeStampImpl.h" // Platform-specific implementation of a TimeStamp
#endif

View file

@ -33,6 +33,8 @@
#ifdef WIN32
#include "platform/windows/WaitImpl.h" // Platform-specific implementation of a Wait object
#elif defined _WINRT_DLL
#include "platform/winRT/WaitImpl.h" // Platform-specific implementation of a Wait object
#else
#include "platform/unix/WaitImpl.h" // Platform-specific implementation of a Wait object
#endif

View file

@ -0,0 +1,102 @@
//-----------------------------------------------------------------------------
//
// EventImpl.cpp
//
// WinRT implementation of a cross-platform event
//
// Copyright (c) 2015 Microsoft Corporation
// All rights reserved.
//
// SOFTWARE NOTICE AND LICENSE
//
// This file is part of OpenZWave.
//
// OpenZWave is free software: you can redistribute it and/or modify
// it under the terms of the GNU Lesser General Public License as published
// by the Free Software Foundation, either version 3 of the License,
// or (at your option) any later version.
//
// OpenZWave is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public License
// along with OpenZWave. If not, see <http://www.gnu.org/licenses/>.
//
//-----------------------------------------------------------------------------
#include <windows.h>
#include "Defs.h"
#include "EventImpl.h"
using namespace OpenZWave;
//-----------------------------------------------------------------------------
// <EventImpl::EventImpl>
// Constructor
//-----------------------------------------------------------------------------
EventImpl::EventImpl
(
)
{
// Create a manual reset event
m_hEvent = ::CreateEventEx( NULL, NULL, CREATE_EVENT_MANUAL_RESET, SYNCHRONIZE | EVENT_MODIFY_STATE );
}
//-----------------------------------------------------------------------------
// <EventImpl::~EventImpl>
// Destructor
//-----------------------------------------------------------------------------
EventImpl::~EventImpl
(
)
{
::CloseHandle( m_hEvent );
}
//-----------------------------------------------------------------------------
// <EventImpl::Set>
// Set the event to signalled
//-----------------------------------------------------------------------------
void EventImpl::Set
(
)
{
::SetEvent( m_hEvent );
}
//-----------------------------------------------------------------------------
// <EventImpl::Reset>
// Set the event to not signalled
//-----------------------------------------------------------------------------
void EventImpl::Reset
(
)
{
::ResetEvent( m_hEvent );
}
//-----------------------------------------------------------------------------
// <EventImpl::IsSignalled>
// Test whether the event is set
//-----------------------------------------------------------------------------
bool EventImpl::IsSignalled
(
)
{
return( WAIT_OBJECT_0 == WaitForSingleObjectEx( m_hEvent, 0, FALSE) );
}
//-----------------------------------------------------------------------------
// <EventImpl::Wait>
// Wait for the event to become signalled
//-----------------------------------------------------------------------------
bool EventImpl::Wait
(
int32 const _timeout
)
{
return( WAIT_TIMEOUT != ::WaitForSingleObjectEx( m_hEvent, (DWORD)_timeout, FALSE ) );
}

View file

@ -0,0 +1,60 @@
//-----------------------------------------------------------------------------
//
// EventImpl.h
//
// WinRT implementation of a cross-platform event
//
// Copyright (c) 2015 Microsoft Corporation
// All rights reserved.
//
// SOFTWARE NOTICE AND LICENSE
//
// This file is part of OpenZWave.
//
// OpenZWave is free software: you can redistribute it and/or modify
// it under the terms of the GNU Lesser General Public License as published
// by the Free Software Foundation, either version 3 of the License,
// or (at your option) any later version.
//
// OpenZWave is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public License
// along with OpenZWave. If not, see <http://www.gnu.org/licenses/>.
//
//-----------------------------------------------------------------------------
#ifndef _EventImpl_H
#define _EventImpl_H
#include <Windows.h>
#include "Defs.h"
namespace OpenZWave
{
/** \brief Windows-specific implementation of the Event class.
*/
class EventImpl
{
private:
friend class Event;
friend class SocketImpl;
friend class Wait;
EventImpl();
~EventImpl();
void Set();
void Reset();
bool Wait( int32 _timeout ); // The wait method is to be used only by the Wait::Multiple method
bool IsSignalled();
HANDLE m_hEvent;
};
} // namespace OpenZWave
#endif //_EventImpl_H

View file

@ -0,0 +1,69 @@
//-----------------------------------------------------------------------------
//
// FileOpsImpl.cpp
//
// WinRT implementation of file operations
//
// Copyright (c) 2015 Microsoft Corporation
// All rights reserved.
//
// SOFTWARE NOTICE AND LICENSE
//
// This file is part of OpenZWave.
//
// OpenZWave is free software: you can redistribute it and/or modify
// it under the terms of the GNU Lesser General Public License as published
// by the Free Software Foundation, either version 3 of the License,
// or (at your option) any later version.
//
// OpenZWave is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public License
// along with OpenZWave. If not, see <http://www.gnu.org/licenses/>.
//
//-----------------------------------------------------------------------------
#include <windows.h>
#include "FileOpsImpl.h"
using namespace OpenZWave;
//-----------------------------------------------------------------------------
// <FileOpsImpl::FileOpsImpl>
// Constructor
//-----------------------------------------------------------------------------
FileOpsImpl::FileOpsImpl
(
)
{
}
//-----------------------------------------------------------------------------
// <FileOpsImpl::~FileOpsImpl>
// Destructor
//-----------------------------------------------------------------------------
FileOpsImpl::~FileOpsImpl
(
)
{
}
//-----------------------------------------------------------------------------
// <FileOpsImpl::FolderExists>
// Determine if a folder exists and is accessible by the calling App
//-----------------------------------------------------------------------------
bool FileOpsImpl::FolderExists(
const string &_folderName
)
{
WIN32_FILE_ATTRIBUTE_DATA fad = { 0 };
wstring wFolderName(_folderName.begin(), _folderName.end());
if (0 == GetFileAttributesEx(wFolderName.c_str(), GetFileExInfoStandard, &fad))
return false;
return (fad.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY)? true: false;
}

View file

@ -0,0 +1,52 @@
//-----------------------------------------------------------------------------
//
// FileOpsImpl.h
//
// WinRT implementation of file operations
//
// Copyright (c) 2015 Microsoft Corporation
// All rights reserved.
//
// SOFTWARE NOTICE AND LICENSE
//
// This file is part of OpenZWave.
//
// OpenZWave is free software: you can redistribute it and/or modify
// it under the terms of the GNU Lesser General Public License as published
// by the Free Software Foundation, either version 3 of the License,
// or (at your option) any later version.
//
// OpenZWave is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public License
// along with OpenZWave. If not, see <http://www.gnu.org/licenses/>.
//
//-----------------------------------------------------------------------------
#ifndef _FileOpsImpl_H
#define _FileOpsImpl_H
#include <stdarg.h>
#include <string>
#include "Defs.h"
#include "platform/FileOps.h"
namespace OpenZWave
{
class FileOpsImpl
{
friend class FileOps;
private:
FileOpsImpl();
~FileOpsImpl();
bool FolderExists( const string &_filename );
};
} // namespace OpenZWave
#endif //_FileOpsImpl_H

View file

@ -0,0 +1,276 @@
//-----------------------------------------------------------------------------
//
// HidControllerWinRT.cpp
//
// WinRT implementation of a HidController
//
// Copyright (c) 2015 Microsoft Corporation
// All rights reserved.
//
// SOFTWARE NOTICE AND LICENSE
//
// This file is part of OpenZWave.
//
// OpenZWave is free software: you can redistribute it and/or modify
// it under the terms of the GNU Lesser General Public License as published
// by the Free Software Foundation, either version 3 of the License,
// or (at your option) any later version.
//
// OpenZWave is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public License
// along with OpenZWave. If not, see <http://www.gnu.org/licenses/>.
//
//-----------------------------------------------------------------------------
#include "Defs.h"
#include "HidControllerWinRT.h"
#include "platform/Log.h"
#include <ppltasks.h>
#include <winstring.h>
using namespace Windows::Devices::Enumeration;
using namespace Windows::Devices::HumanInterfaceDevice;
using namespace Windows::Devices::Usb;
using namespace Windows::Foundation;
using namespace Windows::Storage::Streams;
using namespace Platform;
using namespace Concurrency;
using namespace OpenZWave;
#define AQS_FORMAT L"System.Devices.InterfaceClassGuid:=\"{4D1E55B2-F16F-11CF-88CB-001111000030}\" AND System.Devices.InterfaceEnabled:=System.StructuredQueryType.Boolean#True AND System.DeviceInterface.Hid.VendorId:=%04d AND System.DeviceInterface.Hid.ProductId:=%04d"
#define AQS_LENGTH 300
//-----------------------------------------------------------------------------
// <HidControllerImpl::HidControllerImpl>
// Constructor
//-----------------------------------------------------------------------------
HidController::HidController() :
m_vendorId(0x1b5f), // Wayne Dalton
m_productId(0x01), // ControlThink ThinkStick
m_serialNumber(""),
m_hidControllerName(""),
m_bOpen(false)
{
}
//-----------------------------------------------------------------------------
// <HidControllerImpl::~HidControllerImpl>
// Destructor
//-----------------------------------------------------------------------------
HidController::~HidController()
{
if (m_device != nullptr)
{
m_device->InputReportReceived -= m_inputReportEventToken;
}
}
//-----------------------------------------------------------------------------
// <HidController::SetVendorId>
// Set the USB vendor ID search value. The HID port must be closed for the setting to be accepted.
//-----------------------------------------------------------------------------
bool HidController::SetVendorId
(
uint32 const _vendorId
)
{
if (m_bOpen)
{
return false;
}
m_vendorId = _vendorId;
return true;
}
//-----------------------------------------------------------------------------
// <HidController::SetProductId>
// Set the USB product ID search value. The HID port must be closed for the setting to be accepted.
//-----------------------------------------------------------------------------
bool HidController::SetProductId (uint32 const _productId)
{
if (m_bOpen)
{
return false;
}
m_productId = _productId;
return true;
}
//-----------------------------------------------------------------------------
// <HidController::SetSerialNumber>
// Set the USB serial number search value. The HID port must be closed for the setting to be accepted.
//-----------------------------------------------------------------------------
bool HidController::SetSerialNumber (string const& _serialNumber)
{
if (m_bOpen)
{
return false;
}
m_serialNumber = _serialNumber;
return true;
}
//-----------------------------------------------------------------------------
// <HidControllerImpl::Open>
// Open and configure a HID port
//-----------------------------------------------------------------------------
bool HidController::Open(string const& _hidControllerName)
{
if (m_bOpen)
{
return false;
}
m_hidControllerName = _hidControllerName;
bool success = false;
try
{
create_task(Init()).then([&success, this](bool initResult)
{
success = initResult;
if (success && m_device != nullptr)
{
m_inputReportEventToken = m_device->InputReportReceived += ref new TypedEventHandler<HidDevice^, HidInputReportReceivedEventArgs^>
([this](HidDevice ^sender, HidInputReportReceivedEventArgs ^args)
{
auto reader = DataReader::FromBuffer(args->Report->Data);
uint32 bufferSize = reader->UnconsumedBufferLength;
std::vector<uint8> data(bufferSize);
if (!data.empty())
{
reader->ReadBytes(::Platform::ArrayReference<uint8>(&data[0], bufferSize));
Put(&data[0], bufferSize);
}
});
}
}).wait();
}
catch (Platform::Exception^ ex)
{
}
return success;
}
//-----------------------------------------------------------------------------
// <HidControllerImpl::Close>
// Close a HID port
//-----------------------------------------------------------------------------
bool HidController::Close()
{
if (m_device != nullptr)
{
m_device->InputReportReceived -= m_inputReportEventToken;
delete m_device;
m_device = nullptr;
}
return true;
}
//-----------------------------------------------------------------------------
// <HidControllerImpl::Init>
// Open the HID port
//-----------------------------------------------------------------------------
task<bool> HidController::Init()
{
// Yields the same as API above w/o the usage page and usage Id filters
wchar_t buffer[AQS_LENGTH];
swprintf_s(buffer, AQS_FORMAT, m_vendorId, m_productId);
auto selector = ref new String(buffer);
return create_task(Windows::Devices::Enumeration::DeviceInformation::FindAllAsync(selector))
.then([this](DeviceInformationCollection ^ devices) -> String ^
{
String ^deviceId = L"";
for (auto iterator = devices->First(); iterator->HasCurrent; iterator->MoveNext())
{
// Not sure how to differentiate when there are multiple things returned.
// Just return first matching ID for now
deviceId = iterator->Current->Id;
break;
}
return deviceId;
}).then([this](String ^deviceId) -> IAsyncOperation<HidDevice ^> ^
{
return HidDevice::FromIdAsync(deviceId, Windows::Storage::FileAccessMode::Read);
}).then([this](task<HidDevice ^> deviceTask) -> bool
{
try
{
m_device = deviceTask.get();
if (m_device == nullptr)
{
return false;
}
// Send Report ID 2 - 1 byte "0x04"
// Enables ZWave packet reports on ID 4 (tx) and ID 5 (rx)
uint8 data = 0x04;
SendFeatureReport(&data, 1, 2);
return true;
}
catch (Platform::Exception^ ex)
{
return false;
}
});
}
//-----------------------------------------------------------------------------
// <HidControllerImpl::Write>
// Send data to the HID port
//-----------------------------------------------------------------------------
uint32 HidController::Write
(
uint8* _buffer,
uint32 _length
)
{
// report Id 0x04 is tx feature report
return SendFeatureReport(_buffer, _length, 0x04);
}
//-----------------------------------------------------------------------------
// <HidController::SendFeatureReport>
// Send a feature report with the specified data and report ID
//-----------------------------------------------------------------------------
uint32 HidController::SendFeatureReport
(
uint8* _buffer,
uint32 _length,
unsigned short reportId
)
{
auto featureReport = m_device->CreateFeatureReport();
auto dataWriter = ref new DataWriter();
auto array = ref new Array<uint8>(_buffer, _length);
dataWriter->WriteBytes(ArrayReference<uint8>(_buffer, _length));
featureReport->Data = dataWriter->DetachBuffer();
uint32 bytesWritten = 0;
try
{
bytesWritten = create_task(m_device->SendFeatureReportAsync(featureReport)).get();
}
catch (Platform::Exception^)
{
}
return bytesWritten;
}

View file

@ -0,0 +1,125 @@
//-----------------------------------------------------------------------------
//
// HidControllerImpl.h
//
// WinRT implementation of a HidController
//
// Copyright (c) 2015 Microsoft Corporation
// All rights reserved.
//
// SOFTWARE NOTICE AND LICENSE
//
// This file is part of OpenZWave.
//
// OpenZWave is free software: you can redistribute it and/or modify
// it under the terms of the GNU Lesser General Public License as published
// by the Free Software Foundation, either version 3 of the License,
// or (at your option) any later version.
//
// OpenZWave is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public License
// along with OpenZWave. If not, see <http://www.gnu.org/licenses/>.
//
//-----------------------------------------------------------------------------
#ifndef _HidControllerImpl_H
#define _HidControllerImpl_H
#include <windows.h>
#include "Defs.h"
#include "platform/Controller.h"
#include <ppltasks.h>
namespace OpenZWave
{
class HidController : public Controller
{
public:
/**
* Constructor.
* Creates an object that represents a HID port.
*/
HidController();
/**
* Destructor.
* Destroys the HID port object.
*/
virtual ~HidController();
/**
* Set the USB vendor ID search value. The HID port must be closed for the setting to be accepted.
* @param _baud Vendor ID value to match when enumerating USB HID devices.
* @return True if the vendor ID value was accepted.
* @see Open, Close
*/
bool SetVendorId(uint32 const _vendorId);
/**
* Set the USB product ID search value. The HID port must be closed for the setting to be accepted.
* @param _parity Product ID value to match when enumerating USB HID devices.
* @return True if the product ID value was accepted.
* @see Open, Close
*/
bool SetProductId(uint32 const _productId);
/**
* Set the USB serial number search value. The HID port must be closed for the setting to be accepted.
* @param _parity Serial number string to match when enumerating USB HID devices. If empty, any serial number will be accepted.
* @return True if the serial number value was accepted.
* @see Open, Close
*/
bool SetSerialNumber(string const& _serialNumber);
/**
* Open a HID port.
* Attempts to open a HID port and initialize it with the specified paramters.
* @param _HidControllerName The name of the port to open. For example, ttyS1 on Linux, or \\.\COM2 in Windows.
* @return True if the port was opened and configured successfully.
* @see Close, Read, Write
*/
bool Open(string const& _hidControllerName);
/**
* Close a HID port.
* Closes the HID port.
* @return True if the port was closed successfully, or false if the port was already closed, or an error occurred.
* @see Open
*/
bool Close();
/**
* Write to a HID port.
* Attempts to write data to an open HID port.
* @param _buffer Pointer to a block of memory containing the data to be written.
* @param _length Length in bytes of the data.
* @return The number of bytes written.
* @see Read, Open, Close
*/
uint32 Write(uint8* _buffer, uint32 _length);
private:
uint32 SendFeatureReport( uint8* _buffer, uint32 _length, unsigned short reportId );
Concurrency::task<bool> Init();
Windows::Devices::HumanInterfaceDevice::HidDevice ^ m_device;
Windows::Foundation::EventRegistrationToken m_inputReportEventToken;
uint32 m_vendorId;
uint32 m_productId;
string m_serialNumber;
string m_hidControllerName;
bool m_bOpen;
};
} // namespace OpenZWave
#endif //_HidControllerImpl_H

View file

@ -0,0 +1,350 @@
//-----------------------------------------------------------------------------
//
// LogImpl.cpp
//
// WinRT implementation of message and error logging
//
// Copyright (c) 2015 Microsoft Corporation
// All rights reserved.
//
// SOFTWARE NOTICE AND LICENSE
//
// This file is part of OpenZWave.
//
// OpenZWave is free software: you can redistribute it and/or modify
// it under the terms of the GNU Lesser General Public License as published
// by the Free Software Foundation, either version 3 of the License,
// or (at your option) any later version.
//
// OpenZWave is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public License
// along with OpenZWave. If not, see <http://www.gnu.org/licenses/>.
//
//-----------------------------------------------------------------------------
#include <windows.h>
#include <list>
#include "Defs.h"
#include "LogImpl.h"
#ifdef MINGW
#define vsprintf_s vsnprintf
#define strcpy_s(DEST, NUM, SOURCE) strncpy(DEST, SOURCE, NUM)
errno_t fopen_s(FILE** pFile, const char *filename, const char *mode)
{
if (!pFile)
{
_set_errno(EINVAL);
return EINVAL;
}
*pFile = fopen(filename, mode);
if (!*pFile)
{
return errno;
}
return 0;
}
#endif
using namespace OpenZWave;
//-----------------------------------------------------------------------------
// <LogImpl::LogImpl>
// Constructor
//-----------------------------------------------------------------------------
LogImpl::LogImpl
(
string const& _filename,
bool const _bAppendLog,
bool const _bConsoleOutput,
LogLevel const _saveLevel,
LogLevel const _queueLevel,
LogLevel const _dumpTrigger
):
m_filename( _filename ), // name of log file
m_bAppendLog( _bAppendLog ), // true to append (and not overwrite) any existing log
m_bConsoleOutput( _bConsoleOutput ), // true to provide a copy of output to console
m_saveLevel( _saveLevel ), // level of messages to log to file
m_queueLevel( _queueLevel ), // level of messages to log to queue
m_dumpTrigger( _dumpTrigger ) // dump queued messages when this level is seen
{
string accessType;
// create an adjusted file name and timestamp string
string timeStr = GetTimeStampString();
if ( m_bAppendLog )
{
accessType = "a";
}
else
{
accessType = "w";
}
FILE* pFile;
if( !fopen_s( &pFile, m_filename.c_str(), accessType.c_str() ) )
{
fprintf( pFile, "\nLogging started %s\n\n", timeStr.c_str() );
fclose( pFile );
}
}
//-----------------------------------------------------------------------------
// <LogImpl::~LogImpl>
// Destructor
//-----------------------------------------------------------------------------
LogImpl::~LogImpl
(
)
{
}
//-----------------------------------------------------------------------------
// <LogImpl::Write>
// Write to the log
//-----------------------------------------------------------------------------
void LogImpl::Write
(
LogLevel _logLevel,
uint8 const _nodeId,
char const* _format,
va_list _args
)
{
// create a timestamp string
string timeStr = GetTimeStampString();
string nodeStr = GetNodeString( _nodeId );
string logLevelStr = GetLogLevelString(_logLevel);
// handle this message
if( (_logLevel <= m_queueLevel) || (_logLevel == LogLevel_Internal) ) // we're going to do something with this message...
{
char lineBuf[1024];
if( !_format || ( _format[0] == 0 ) )
{
strcpy_s( lineBuf, 1024, "" );
}
else
{
vsprintf_s( lineBuf, sizeof(lineBuf), _format, _args );
}
// should this message be saved to file (and possibly written to console?)
if( (_logLevel <= m_saveLevel) || (_logLevel == LogLevel_Internal) )
{
// save to file
FILE* pFile = NULL;
if( !fopen_s( &pFile, m_filename.c_str(), "a" ) || m_bConsoleOutput )
{
if( _logLevel != LogLevel_Internal ) // don't add a second timestamp to display of queued messages
{
if( pFile != NULL )
{
fprintf( pFile, "%s%s%s", timeStr.c_str(), logLevelStr.c_str(), nodeStr.c_str() );
}
if( m_bConsoleOutput )
{
printf( "%s%s%s", timeStr.c_str(), logLevelStr.c_str(), nodeStr.c_str() );
}
}
// print message to file (and possibly screen)
if( pFile != NULL )
{
fprintf( pFile, "%s", lineBuf );
fprintf( pFile, "\n" );
fclose( pFile );
}
if( m_bConsoleOutput )
{
printf( "%s", lineBuf );
printf( "\n" );
}
}
}
if( _logLevel != LogLevel_Internal )
{
char queueBuf[1024];
string threadStr = GetThreadId();
sprintf_s( queueBuf, sizeof(queueBuf), "%s%s%s", timeStr.c_str(), threadStr.c_str(), lineBuf );
Queue( queueBuf );
}
}
// now check to see if the _dumpTrigger has been hit
if( (_logLevel <= m_dumpTrigger) && (_logLevel != LogLevel_Internal) && (_logLevel != LogLevel_Always) )
{
QueueDump();
}
}
//-----------------------------------------------------------------------------
// <LogImpl::Queue>
// Write to the log queue
//-----------------------------------------------------------------------------
void LogImpl::Queue
(
char const* _buffer
)
{
string bufStr = _buffer;
m_logQueue.push_back( bufStr );
// rudimentary queue size management
if( m_logQueue.size() > 500 )
{
m_logQueue.pop_front();
}
}
//-----------------------------------------------------------------------------
// <LogImpl::QueueDump>
// Dump the LogQueue to output device
//-----------------------------------------------------------------------------
void LogImpl::QueueDump
(
)
{
Log::Write( LogLevel_Internal, "\n\nDumping queued log messages\n");
list<string>::iterator it = m_logQueue.begin();
while( it != m_logQueue.end() )
{
string strTemp = *it;
Log::Write( LogLevel_Internal, strTemp.c_str() );
++it;
}
m_logQueue.clear();
Log::Write( LogLevel_Internal, "\nEnd of queued log message dump\n\n");
}
//-----------------------------------------------------------------------------
// <LogImpl::Clear>
// Clear the LogQueue
//-----------------------------------------------------------------------------
void LogImpl::QueueClear
(
)
{
m_logQueue.clear();
}
//-----------------------------------------------------------------------------
// <LogImpl::SetLoggingState>
// Sets the various log state variables
//-----------------------------------------------------------------------------
void LogImpl::SetLoggingState
(
LogLevel _saveLevel,
LogLevel _queueLevel,
LogLevel _dumpTrigger
)
{
m_saveLevel = _saveLevel;
m_queueLevel = _queueLevel;
m_dumpTrigger = _dumpTrigger;
}
//-----------------------------------------------------------------------------
// <LogImpl::GetTimeStampAndThreadId>
// Generate a string with formatted current time
//-----------------------------------------------------------------------------
string LogImpl::GetTimeStampString
(
)
{
// Get a timestamp
SYSTEMTIME time;
::GetLocalTime( &time );
// create a time stamp string for the log message
char buf[100];
sprintf_s( buf, sizeof(buf), "%04d-%02d-%02d %02d:%02d:%02d.%03d ", time.wYear, time.wMonth, time.wDay, time.wHour, time.wMinute, time.wSecond, time.wMilliseconds );
string str = buf;
return str;
}
//-----------------------------------------------------------------------------
// <LogImpl::GetNodeString>
// Generate a string with formatted node id
//-----------------------------------------------------------------------------
string LogImpl::GetNodeString
(
uint8 const _nodeId
)
{
if( _nodeId == 0 )
{
return "";
}
else
if( _nodeId == 255 ) // should make distinction between broadcast and controller better for SwitchAll broadcast
{
return "contrlr, ";
}
else
{
char buf[20];
snprintf( buf, sizeof(buf), "Node%03d, ", _nodeId );
return buf;
}
}
//-----------------------------------------------------------------------------
// <LogImpl::GetThreadId>
// Generate a string with formatted thread id
//-----------------------------------------------------------------------------
string LogImpl::GetThreadId
(
)
{
char buf[20];
DWORD dwThread = ::GetCurrentThreadId();
sprintf_s( buf, sizeof(buf), "%04d ", dwThread );
string str = buf;
return str;
}
//-----------------------------------------------------------------------------
// <LogImpl::SetLogFileName>
// Provide a new log file name (applicable to future writes)
//-----------------------------------------------------------------------------
void LogImpl::SetLogFileName
(
const string &_filename
)
{
m_filename = _filename;
}
//-----------------------------------------------------------------------------
// <LogImpl::GetLogLevelString>
// Provide a new log file name (applicable to future writes)
//-----------------------------------------------------------------------------
string LogImpl::GetLogLevelString
(
LogLevel _level
)
{
if ((_level >= LogLevel_None) && (_level <= LogLevel_Internal)) {
char buf[20];
snprintf( buf, sizeof(buf), "%s, ", LogLevelString[_level] );
return buf;
}
else
return "Unknown, ";
}

View file

@ -0,0 +1,72 @@
//-----------------------------------------------------------------------------
//
// LogImpl.h
//
// WinRT implementation of message and error logging
//
// Copyright (c) 2015 Microsoft Corporation
// All rights reserved.
//
// SOFTWARE NOTICE AND LICENSE
//
// This file is part of OpenZWave.
//
// OpenZWave is free software: you can redistribute it and/or modify
// it under the terms of the GNU Lesser General Public License as published
// by the Free Software Foundation, either version 3 of the License,
// or (at your option) any later version.
//
// OpenZWave is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public License
// along with OpenZWave. If not, see <http://www.gnu.org/licenses/>.
//
//-----------------------------------------------------------------------------
#ifndef _LogImpl_H
#define _LogImpl_H
#include "Defs.h"
#include <string>
#include "platform/Log.h"
#include "Windows.h"
namespace OpenZWave
{
/** \brief Windows-specific implementation of the Log class.
*/
class LogImpl : public i_LogImpl
{
private:
friend class Log;
LogImpl( string const& _filename, bool const _bAppendLog, bool const _bConsoleOutput, LogLevel const _saveLevel, LogLevel const _queueLevel, LogLevel const _dumpTrigger );
~LogImpl();
void Write( LogLevel _level, uint8 const _nodeId, char const* _format, va_list _args );
void Queue( char const* _buffer );
void QueueDump();
void QueueClear();
void SetLoggingState( LogLevel _saveLevel, LogLevel _queueLevel, LogLevel _dumpTrigger );
void SetLogFileName( const string &_filename );
string GetTimeStampString();
string GetNodeString( uint8 const _nodeId );
string GetThreadId();
string GetLogLevelString(LogLevel _level);
string m_filename; /**< filename specified by user (default is ozw_log.txt) */
bool m_bConsoleOutput; /**< if true, send log output to console as well as to the file */
bool m_bAppendLog; /**< if true, the log file should be appended to any with the same name */
list<string> m_logQueue; /**< list of queued log messages */
LogLevel m_saveLevel;
LogLevel m_queueLevel;
LogLevel m_dumpTrigger;
};
} // namespace OpenZWave
#endif //_LogImpl_H

View file

@ -0,0 +1,114 @@
//-----------------------------------------------------------------------------
//
// MutexImpl.cpp
//
// WinRT implementation of the cross-platform mutex
//
// Copyright (c) 2015 Microsoft Corporation
// All rights reserved.
//
// SOFTWARE NOTICE AND LICENSE
//
// This file is part of OpenZWave.
//
// OpenZWave is free software: you can redistribute it and/or modify
// it under the terms of the GNU Lesser General Public License as published
// by the Free Software Foundation, either version 3 of the License,
// or (at your option) any later version.
//
// OpenZWave is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public License
// along with OpenZWave. If not, see <http://www.gnu.org/licenses/>.
//
//-----------------------------------------------------------------------------
#include "Defs.h"
#include "MutexImpl.h"
using namespace OpenZWave;
//-----------------------------------------------------------------------------
// <MutexImpl::MutexImpl>
// Constructor
//-----------------------------------------------------------------------------
MutexImpl::MutexImpl
(
):
m_lockCount( 0 )
{
InitializeCriticalSectionEx( &m_criticalSection, 0, 0 );
}
//-----------------------------------------------------------------------------
// <MutexImpl::~MutexImpl>
// Destructor
//-----------------------------------------------------------------------------
MutexImpl::~MutexImpl
(
)
{
DeleteCriticalSection( &m_criticalSection );
}
//-----------------------------------------------------------------------------
// <MutexImpl::Lock>
// Lock the mutex
//-----------------------------------------------------------------------------
bool MutexImpl::Lock
(
bool const _bWait // = true;
)
{
if( _bWait )
{
// We will wait for the lock
EnterCriticalSection( &m_criticalSection );
++m_lockCount;
return true;
}
// Returns immediately, even if the lock was not available.
if( TryEnterCriticalSection( &m_criticalSection ) )
{
++m_lockCount;
return true;
}
return false;
}
//-----------------------------------------------------------------------------
// <MutexImpl::Unlock>
// Release our lock on the mutex
//-----------------------------------------------------------------------------
void MutexImpl::Unlock
(
)
{
if( !m_lockCount )
{
// No locks - we have a mismatched lock/release pair
assert(0);
}
else
{
--m_lockCount;
LeaveCriticalSection( &m_criticalSection );
}
}
//-----------------------------------------------------------------------------
// <MutexImpl::IsSignalled>
// Test whether the mutex is free
//-----------------------------------------------------------------------------
bool MutexImpl::IsSignalled
(
)
{
return( 0 == m_lockCount );
}

View file

@ -0,0 +1,58 @@
//-----------------------------------------------------------------------------
//
// MutexImpl.h
//
// WinRT implementation of the cross-platform mutex
//
// Copyright (c) 2015 Microsoft Corporation
// All rights reserved.
//
// SOFTWARE NOTICE AND LICENSE
//
// This file is part of OpenZWave.
//
// OpenZWave is free software: you can redistribute it and/or modify
// it under the terms of the GNU Lesser General Public License as published
// by the Free Software Foundation, either version 3 of the License,
// or (at your option) any later version.
//
// OpenZWave is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public License
// along with OpenZWave. If not, see <http://www.gnu.org/licenses/>.
//
//-----------------------------------------------------------------------------
#ifndef _MutexImpl_H
#define _MutexImpl_H
#include <windows.h>
namespace OpenZWave
{
/** \brief Windows-specific implementation of the Mutex class.
*/
class MutexImpl
{
private:
friend class Mutex;
MutexImpl();
~MutexImpl();
bool Lock( bool const _bWait = true );
void Unlock();
bool IsSignalled();
CRITICAL_SECTION m_criticalSection;
uint32 m_lockCount; // Keep track of the locks (there can be more than one if they occur on the same thread.
};
} // namespace OpenZWave
#endif //_MutexIF_H

View file

@ -0,0 +1,254 @@
//-----------------------------------------------------------------------------
//
// SerialControllerImpl.cpp
//
// WinRT Implementation of the cross-platform serial port
//
// Copyright (c) 2015 Microsoft Corporation
// All rights reserved.
//
// SOFTWARE NOTICE AND LICENSE
//
// This file is part of OpenZWave.
//
// OpenZWave is free software: you can redistribute it and/or modify
// it under the terms of the GNU Lesser General Public License as published
// by the Free Software Foundation, either version 3 of the License,
// or (at your option) any later version.
//
// OpenZWave is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public License
// along with OpenZWave. If not, see <http://www.gnu.org/licenses/>.
//
//-----------------------------------------------------------------------------
#include "Defs.h"
#include "SerialControllerImpl.h"
#include "platform/Log.h"
#include <winstring.h>
#include <ppltasks.h>
using namespace OpenZWave;
using namespace Windows::Devices::SerialCommunication;
using namespace Windows::Devices::Enumeration;
using namespace Windows::Storage::Streams;
using namespace Windows::Foundation;
using namespace Concurrency;
using namespace Platform;
//-----------------------------------------------------------------------------
// <SerialControllerImpl::SerialControllerImpl>
// Constructor
//-----------------------------------------------------------------------------
SerialControllerImpl::SerialControllerImpl( SerialController* _owner)
: m_owner( _owner )
{
}
//-----------------------------------------------------------------------------
// <SerialControllerImpl::~SerialControllerImpl>
// Destructor
//-----------------------------------------------------------------------------
SerialControllerImpl::~SerialControllerImpl()
{
Close();
}
//-----------------------------------------------------------------------------
// <SerialControllerImpl::Close>
// Close the serial port
//-----------------------------------------------------------------------------
void SerialControllerImpl::Close()
{
// cancel read task
m_readTaskCancelationTokenSource.cancel();
}
//-----------------------------------------------------------------------------
// <SerialControllerImpl::Open>
// Open the serial port
//-----------------------------------------------------------------------------
bool SerialControllerImpl::Open()
{
Log::Write(LogLevel_Info, "Trying to open serial port %s", m_owner->m_serialControllerName.c_str());
try
{
auto selector = SerialDevice::GetDeviceSelectorFromUsbVidPid(0x10C4, 0xEA60);
return create_task(DeviceInformation::FindAllAsync(selector))
.then([this](DeviceInformationCollection ^ devices) -> IAsyncOperation<SerialDevice ^> ^
{
wstring ourId(m_owner->m_serialControllerName.begin(), m_owner->m_serialControllerName.end());
for (auto iterator = devices->First(); iterator->HasCurrent; iterator->MoveNext())
{
wstring currentId = iterator->Current->Id->Data();
if (currentId.find(ourId) != wstring::npos)
{
return SerialDevice::FromIdAsync(iterator->Current->Id);
}
}
return create_async([]() -> SerialDevice ^ { return nullptr; });
}).then([this](SerialDevice ^ device) -> bool
{
if (device == nullptr)
{
return false;
}
m_serialDevice = device;
m_serialDevice->BaudRate = m_owner->m_baud;
m_serialDevice->DataBits = 8;
switch (m_owner->m_stopBits)
{
case SerialController::StopBits::StopBits_One:
{
m_serialDevice->StopBits = SerialStopBitCount::One;
break;
}
case SerialController::StopBits::StopBits_OneAndAHalf:
{
m_serialDevice->StopBits = SerialStopBitCount::OnePointFive;
break;
}
case SerialController::StopBits::StopBits_Two:
{
m_serialDevice->StopBits = SerialStopBitCount::Two;
break;
}
}
switch (m_owner->m_parity)
{
case SerialController::Parity::Parity_Even:
{
m_serialDevice->Parity = SerialParity::Even;
break;
}
case SerialController::Parity::Parity_Mark:
{
m_serialDevice->Parity = SerialParity::Mark;
break;
}
case SerialController::Parity::Parity_None:
{
m_serialDevice->Parity = SerialParity::None;
break;
}
case SerialController::Parity::Parity_Odd:
{
m_serialDevice->Parity = SerialParity::Odd;
break;
}
case SerialController::Parity::Parity_Space:
{
m_serialDevice->Parity = SerialParity::Space;
break;
}
}
Windows::Foundation::TimeSpan timespan;
timespan.Duration = 1;
m_serialDevice->ReadTimeout = timespan;
StartReadTask();
return true;
}).get();
}
catch (...)
{
return false;
}
}
//-----------------------------------------------------------------------------
// <SerialControllerImpl::StartReadTask>
// Start a background task which reads available data and passes it along to SerialController
//-----------------------------------------------------------------------------
void SerialControllerImpl::StartReadTask()
{
// Read serial data on background task
cancellation_token token = m_readTaskCancelationTokenSource.get_token();
create_task([token, this]()
{
uint32 readBufferLength = 512;
Buffer ^ buffer = ref new Buffer(readBufferLength);
for (;;)
{
try
{
create_task(m_serialDevice->InputStream->ReadAsync(buffer, readBufferLength, InputStreamOptions::None))
.then([&, this](IBuffer ^ outBuffer)
{
auto reader = DataReader::FromBuffer(outBuffer);
auto bytesRead = reader->UnconsumedBufferLength;
std::vector<uint8> byteVector(bytesRead);
if (!byteVector.empty())
{
reader->ReadBytes(::Platform::ArrayReference<uint8>(byteVector.data(), bytesRead));
m_owner->Put(byteVector.data(), bytesRead);
}
}).wait();
}
catch (Platform::Exception^ ex)
{
if (ex->HResult == HRESULT_FROM_WIN32(ERROR_OPERATION_ABORTED))
{
m_owner->Close();
}
}
if (token.is_canceled())
{
cancel_current_task();
}
}
}, token);
}
//-----------------------------------------------------------------------------
// <SerialControllerImpl::Write>
// Send data to the serial port
//-----------------------------------------------------------------------------
uint32 SerialControllerImpl::Write
(
uint8* _buffer,
uint32 _length
)
{
uint32 retVal = 0;
if (m_serialDevice == nullptr)
{
//Error
Log::Write(LogLevel_Error, "ERROR: Serial port must be opened before writing\n");
return 0;
}
DataWriter ^ writer = ref new DataWriter();
writer->WriteBytes(ref new Platform::Array<uint8>(_buffer, _length));
try
{
auto writeTask = create_task(m_serialDevice->OutputStream->WriteAsync(writer->DetachBuffer()));
// since the consumer of this function expects this to be synchronous, just wait here.
retVal = writeTask.get();
}
catch (Platform::Exception^ )
{
//ignore - return 0
retVal = 0;
}
return retVal;
}

View file

@ -0,0 +1,63 @@
//-----------------------------------------------------------------------------
//
// SerialControllerImpl.h
//
// WinRT Implementation of the cross-platform serial port
//
// Copyright (c) 2015 Microsoft Corporation
// All rights reserved.
//
// SOFTWARE NOTICE AND LICENSE
//
// This file is part of OpenZWave.
//
// OpenZWave is free software: you can redistribute it and/or modify
// it under the terms of the GNU Lesser General Public License as published
// by the Free Software Foundation, either version 3 of the License,
// or (at your option) any later version.
//
// OpenZWave is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public License
// along with OpenZWave. If not, see <http://www.gnu.org/licenses/>.
//
//-----------------------------------------------------------------------------
#ifndef _SerialControllerImpl_H
#define _SerialControllerImpl_H
#include <Windows.h>
#include <ppltasks.h>
#include "Defs.h"
#include "platform/SerialController.h"
namespace OpenZWave
{
class SerialControllerImpl
{
private:
friend class SerialController;
SerialControllerImpl( SerialController* _owner );
~SerialControllerImpl();
bool Open();
void Close();
uint32 Write( uint8* _buffer, uint32 _length );
void StartReadTask();
Windows::Devices::SerialCommunication::SerialDevice ^ m_serialDevice;
Concurrency::cancellation_token_source m_readTaskCancelationTokenSource;
SerialController* m_owner;
};
} // namespace OpenZWave
#endif //_SerialControllerImpl_H

View file

@ -0,0 +1,148 @@
//-----------------------------------------------------------------------------
//
// ThreadImpl.cpp
//
// WinRT implementation of a cross-platform thread
//
// Copyright (c) 2015 Microsoft Corporation
// All rights reserved.
//
// SOFTWARE NOTICE AND LICENSE
//
// This file is part of OpenZWave.
//
// OpenZWave is free software: you can redistribute it and/or modify
// it under the terms of the GNU Lesser General Public License as published
// by the Free Software Foundation, either version 3 of the License,
// or (at your option) any later version.
//
// OpenZWave is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public License
// along with OpenZWave. If not, see <http://www.gnu.org/licenses/>.
//
//-----------------------------------------------------------------------------
#include "Defs.h"
#include "platform/Event.h"
#include "platform/Thread.h"
#include "ThreadImpl.h"
#include "Options.h"
using namespace OpenZWave;
using namespace Concurrency;
using namespace Windows::Foundation;
using namespace Windows::System::Threading;
int32 ThreadImpl::s_threadTerminateTimeout = -1;
//-----------------------------------------------------------------------------
// <ThreadImpl::ThreadImpl>
// Constructor
//-----------------------------------------------------------------------------
ThreadImpl::ThreadImpl
(
Thread* _owner,
string const& _name
):
m_owner( _owner ),
m_bIsRunning( false ),
m_name( _name )
{
static bool staticsInitialized = false;
if (!staticsInitialized)
{
if (Options::Get() != nullptr)
{
Options::Get()->GetOptionAsInt("ThreadTerminateTimeout", &s_threadTerminateTimeout);
}
staticsInitialized = true;
}
}
//-----------------------------------------------------------------------------
// <ThreadImpl::~ThreadImpl>
// Destructor
//-----------------------------------------------------------------------------
ThreadImpl::~ThreadImpl ()
{
}
//-----------------------------------------------------------------------------
// <ThreadImpl::Start>
// Start a function running on this thread
//-----------------------------------------------------------------------------
bool ThreadImpl::Start
(
Thread::pfnThreadProc_t _pfnThreadProc,
Event* _exitEvent,
void* _context
)
{
// Create a thread to run the specified function
m_pfnThreadProc = _pfnThreadProc;
m_context = _context;
m_exitEvent = _exitEvent;
m_exitEvent->Reset();
create_task([this]()
{
m_bIsRunning = true;
try
{
m_pfnThreadProc(m_exitEvent, m_context);
}
catch (Platform::Exception^)
{
}
m_bIsRunning = false;
// Let any watchers know that the thread has finished running.
m_owner->Notify();
});
return true;
}
//-----------------------------------------------------------------------------
// <ThreadImpl::Sleep>
// Cause thread to sleep for the specified number of milliseconds
//-----------------------------------------------------------------------------
void ThreadImpl::Sleep
(
uint32 _millisecs
)
{
::Sleep(_millisecs);
}
//-----------------------------------------------------------------------------
// <ThreadImpl::Terminate>
// Force the thread to stop
//-----------------------------------------------------------------------------
bool ThreadImpl::Terminate
(
)
{
// No way to do this on WinRT, so give the thread a bit of extra time to exit on its own
if( !m_bIsRunning )
{
return false;
}
if (Wait::Single(m_owner, s_threadTerminateTimeout) < 0)
{
return false;
}
return true;
}
//-----------------------------------------------------------------------------
// <ThreadImpl::IsSignalled>
// Test whether the thread has completed
//-----------------------------------------------------------------------------
bool ThreadImpl::IsSignalled()
{
return !m_bIsRunning;
}

View file

@ -0,0 +1,73 @@
//-----------------------------------------------------------------------------
//
// ThreadImpl.h
//
// WinRT implementation of a cross-platform thread
//
// Copyright (c) 2015 Microsoft Corporation
// All rights reserved.
//
// SOFTWARE NOTICE AND LICENSE
//
// This file is part of OpenZWave.
//
// OpenZWave is free software: you can redistribute it and/or modify
// it under the terms of the GNU Lesser General Public License as published
// by the Free Software Foundation, either version 3 of the License,
// or (at your option) any later version.
//
// OpenZWave is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public License
// along with OpenZWave. If not, see <http://www.gnu.org/licenses/>.
//
//-----------------------------------------------------------------------------
#ifndef _ThreadImpl_H
#define _ThreadImpl_H
#include <string>
#include <windows.h>
#include "platform/Thread.h"
#include <ppltasks.h>
namespace OpenZWave
{
class Thread;
class Event;
/** \brief Windows-specific implementation of the Thread class.
*/
class ThreadImpl
{
private:
friend class Thread;
ThreadImpl( Thread* _owner, string const& _name );
~ThreadImpl();
bool Start( Thread::pfnThreadProc_t _pfnThreadProc, Event* _exitEvent, void* _context );
void Sleep( uint32 _milliseconds );
bool Terminate();
bool IsSignalled();
void Run();
static DWORD WINAPI ThreadProc( void* _pArg );
Thread* m_owner;
Event* m_exitEvent;
Thread::pfnThreadProc_t m_pfnThreadProc;
void* m_context;
bool m_bIsRunning;
string m_name;
static int32 s_threadTerminateTimeout;
};
} // namespace OpenZWave
#endif //_ThreadImpl_H

View file

@ -0,0 +1,114 @@
//-----------------------------------------------------------------------------
//
// TimeStampImpl.cpp
//
// WinRT implementation of a TimeStamp
//
// Copyright (c) 2015 Microsoft Corporation
// All rights reserved.
//
// SOFTWARE NOTICE AND LICENSE
//
// This file is part of OpenZWave.
//
// OpenZWave is free software: you can redistribute it and/or modify
// it under the terms of the GNU Lesser General Public License as published
// by the Free Software Foundation, either version 3 of the License,
// or (at your option) any later version.
//
// OpenZWave is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public License
// along with OpenZWave. If not, see <http://www.gnu.org/licenses/>.
//
//-----------------------------------------------------------------------------
#include <string>
#include <Windows.h>
#include "Defs.h"
#include "TimeStampImpl.h"
using namespace OpenZWave;
//-----------------------------------------------------------------------------
// <TimeStampImpl::TimeStampImpl>
// Constructor
//-----------------------------------------------------------------------------
TimeStampImpl::TimeStampImpl
(
)
{
SetTime(0);
}
//-----------------------------------------------------------------------------
// <TimeStampImpl::~TimeStampImpl>
// Destructor
//-----------------------------------------------------------------------------
TimeStampImpl::~TimeStampImpl
(
)
{
}
//-----------------------------------------------------------------------------
// <TimeStampImpl::SetTime>
// Sets the timestamp to now, plus an offset in milliseconds
//-----------------------------------------------------------------------------
void TimeStampImpl::SetTime
(
int32 _milliseconds // = 0
)
{
int64 offset = ((int64)_milliseconds) * 10000LL; // Timestamp is stored in 100ns steps.
GetSystemTimeAsFileTime( (FILETIME*)&m_stamp );
m_stamp += offset;
}
//-----------------------------------------------------------------------------
// <TimeStampImpl::TimeRemaining>
// Gets the difference between now and the timestamp time in milliseconds
//-----------------------------------------------------------------------------
int32 TimeStampImpl::TimeRemaining
(
)
{
int64 now;
GetSystemTimeAsFileTime( (FILETIME*)&now );
return (int32)( ( m_stamp - now ) / 10000LL );
}
//-----------------------------------------------------------------------------
// <TimeStampImpl::GetAsString>
// Return a string representation
//-----------------------------------------------------------------------------
string TimeStampImpl::GetAsString
(
)
{
// Convert m_stamp (FILETIME) to SYSTEMTIME for ease of use
SYSTEMTIME time;
::FileTimeToSystemTime( (FILETIME*)&m_stamp, &time );
char buf[100];
sprintf_s( buf, sizeof(buf), "%04d-%02d-%02d %02d:%02d:%02d:%03d ", time.wYear, time.wMonth, time.wDay, time.wHour, time.wMinute, time.wSecond, time.wMilliseconds );
string str = buf;
return str;
}
//-----------------------------------------------------------------------------
// <TimeStampImpl::operator->
// Overload the subtract operator to get the difference between two
// timestamps in milliseconds
//-----------------------------------------------------------------------------
int32 TimeStampImpl::operator-
(
TimeStampImpl const& _other
)
{
return (int32)( ( m_stamp - _other.m_stamp ) / 10000LL );
}

View file

@ -0,0 +1,88 @@
//-----------------------------------------------------------------------------
//
// TimeStampImpl.h
//
// WinRT implementation of a TimeStamp
//
// Copyright (c) 2015 Microsoft Corporation
// All rights reserved.
//
// SOFTWARE NOTICE AND LICENSE
//
// This file is part of OpenZWave.
//
// OpenZWave is free software: you can redistribute it and/or modify
// it under the terms of the GNU Lesser General Public License as published
// by the Free Software Foundation, either version 3 of the License,
// or (at your option) any later version.
//
// OpenZWave is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public License
// along with OpenZWave. If not, see <http://www.gnu.org/licenses/>.
//
//-----------------------------------------------------------------------------
#ifndef _TimeStampImpl_H
#define _TimeStampImpl_H
#include "Defs.h"
namespace OpenZWave
{
/** \brief Windows implementation of a timestamp.
*/
class TimeStampImpl
{
public:
/**
* Constructor.
* Creates a TimeStampImpl object.
*/
TimeStampImpl();
/**
* Destructor.
* Destroys the TimeStampImpl object.
*/
~TimeStampImpl();
/**
* SetTime. Sets the timestamp to now, plus the offset in milliseconds.
* \param _milliseconds positive or negative offset from
* now in milliseconds.
*/
void SetTime( int32 _milliseconds );
/**
* TimeRemaining. Gets the difference between now and the timestamp
* time in milliseconds.
* \return milliseconds remaining until we reach the timestamp. The
* return value is negative if the timestamp is in the past.
*/
int32 TimeRemaining();
/**
* Return as as string
*/
string GetAsString();
/**
* Overload the subtract operator to get the difference between
* two timestamps in milliseconds.
*/
int32 operator- ( TimeStampImpl const& _other );
private:
TimeStampImpl( TimeStampImpl const& ); // prevent copy
TimeStampImpl& operator = ( TimeStampImpl const& ); // prevent assignment
int64 m_stamp;
};
} // namespace OpenZWave
#endif //_TimeStampImpl_H

View file

@ -0,0 +1,134 @@
//-----------------------------------------------------------------------------
//
// WaitImpl.cpp
//
// WinRT implementation of a base class for objects we
// want to be able to wait for.
//
// Copyright (c) 2015 Microsoft Corporation
// All rights reserved.
//
// SOFTWARE NOTICE AND LICENSE
//
// This file is part of OpenZWave.
//
// OpenZWave is free software: you can redistribute it and/or modify
// it under the terms of the GNU Lesser General Public License as published
// by the Free Software Foundation, either version 3 of the License,
// or (at your option) any later version.
//
// OpenZWave is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public License
// along with OpenZWave. If not, see <http://www.gnu.org/licenses/>.
//
//-----------------------------------------------------------------------------
#include "Defs.h"
#include "platform/Wait.h"
#include "WaitImpl.h"
#include "platform/Log.h"
using namespace OpenZWave;
//-----------------------------------------------------------------------------
// <WaitImpl::WaitImpl>
// Constructor
//-----------------------------------------------------------------------------
WaitImpl::WaitImpl
(
Wait* _owner
):
m_owner( _owner )
{
InitializeCriticalSectionEx( &m_criticalSection, 0, 0 );
}
//-----------------------------------------------------------------------------
// <WaitImpl::~WaitImpl>
// Destructor
//-----------------------------------------------------------------------------
WaitImpl::~WaitImpl
(
)
{
DeleteCriticalSection( &m_criticalSection );
}
//-----------------------------------------------------------------------------
// <WaitImpl::AddWatcher>
// Add a watcher to our object.
//-----------------------------------------------------------------------------
void WaitImpl::AddWatcher
(
Wait::pfnWaitNotification_t _callback,
void* _context
)
{
// Add the watcher to our list
Watcher watcher;
watcher.m_callback = _callback;
watcher.m_context = _context;
EnterCriticalSection( &m_criticalSection );
m_watchers.push_back( watcher );
LeaveCriticalSection( &m_criticalSection );
// If the object is already in a signalled state, notify the watcher immediately
if( m_owner->IsSignalled() )
{
_callback( _context );
}
}
//-----------------------------------------------------------------------------
// <WaitImpl::RemoveWatcher>
// Remove a watcher from our object.
//-----------------------------------------------------------------------------
bool WaitImpl::RemoveWatcher
(
Wait::pfnWaitNotification_t _callback,
void* _context
)
{
bool res = false;
EnterCriticalSection( &m_criticalSection );
for( list<Watcher>::iterator it=m_watchers.begin(); it!=m_watchers.end(); ++it )
{
Watcher const& watcher = *it;
if( ( watcher.m_callback == _callback ) && ( watcher.m_context == _context ) )
{
m_watchers.erase( it );
res = true;
break;
}
}
LeaveCriticalSection( &m_criticalSection );
return res;
}
//-----------------------------------------------------------------------------
// <WaitImpl::Notify>
// Notify all the watchers that the object has become signalled
//-----------------------------------------------------------------------------
void WaitImpl::Notify
(
)
{
EnterCriticalSection( &m_criticalSection );
for( list<Watcher>::iterator it=m_watchers.begin(); it!=m_watchers.end(); ++it )
{
Watcher const& watcher = *it;
watcher.m_callback( watcher.m_context );
}
LeaveCriticalSection( &m_criticalSection );
}

View file

@ -0,0 +1,73 @@
//-----------------------------------------------------------------------------
//
// WaitImpl.h
//
// WinRT implementation of a base class for objects we
// want to be able to wait for.
//
// Copyright (c) 2015 Microsoft Corporation
// All rights reserved.
//
// SOFTWARE NOTICE AND LICENSE
//
// This file is part of OpenZWave.
//
// OpenZWave is free software: you can redistribute it and/or modify
// it under the terms of the GNU Lesser General Public License as published
// by the Free Software Foundation, either version 3 of the License,
// or (at your option) any later version.
//
// OpenZWave is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public License
// along with OpenZWave. If not, see <http://www.gnu.org/licenses/>.
//
//-----------------------------------------------------------------------------
#ifndef _WaitImpl_H
#define _WaitImpl_H
#include <windows.h>
#include <list>
#include "Defs.h"
#include "platform/Ref.h"
#include "platform/Wait.h"
namespace OpenZWave
{
/** \brief Windows specific implementation of Wait objects.
*/
class WaitImpl
{
private:
friend class Wait;
WaitImpl( Wait* _owner );
virtual ~WaitImpl();
void AddWatcher( Wait::pfnWaitNotification_t _callback, void* _context );
bool RemoveWatcher( Wait::pfnWaitNotification_t _callback, void* _context );
void Notify();
static int32 Multiple( Wait** _objects, uint32 _numObjects, int32 _timeout = -1 );
WaitImpl( Wait const& ); // prevent copy
WaitImpl& operator = ( WaitImpl const& ); // prevent assignment
struct Watcher
{
Wait::pfnWaitNotification_t m_callback;
void* m_context;
};
list<Watcher> m_watchers;
Wait* m_owner;
CRITICAL_SECTION m_criticalSection;
};
} // namespace OpenZWave
#endif //_WaitImpl_H