From 1faef439676cbdd80aeb60ab0d10dba02d2fe63d Mon Sep 17 00:00:00 2001 From: i7-8700 <1281261856@qq.com> Date: Thu, 27 Aug 2020 20:07:53 +0800 Subject: [PATCH] update --- examples/examples.sln | 28 +++++ .../server_demo_libevent.cpp | 1 - .../server_demo_libevent_linux.vcxproj | 105 ++++++++++++++++++ ...server_demo_libevent_linux.vcxproj.filters | 25 +++++ .../server_demo_libevent_linux.vcxproj.user | 9 ++ include/hb_helper.h | 4 +- 6 files changed, 170 insertions(+), 2 deletions(-) create mode 100644 examples/server_demo_libevent_linux/server_demo_libevent_linux.vcxproj create mode 100644 examples/server_demo_libevent_linux/server_demo_libevent_linux.vcxproj.filters create mode 100644 examples/server_demo_libevent_linux/server_demo_libevent_linux.vcxproj.user diff --git a/examples/examples.sln b/examples/examples.sln index faeb07f..c024cf7 100644 --- a/examples/examples.sln +++ b/examples/examples.sln @@ -38,6 +38,8 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "include", "include", "{332E ..\include\hb_helper.h = ..\include\hb_helper.h EndProjectSection EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "server_demo_libevent_linux", "server_demo_libevent_linux\server_demo_libevent_linux.vcxproj", "{7657FAE6-1ABF-45C3-AA89-ACAC1110C228}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -198,6 +200,32 @@ Global {FED919A9-19E0-4D4A-972F-DDF537F5DEFE}.Release|x64.Build.0 = Release|x64 {FED919A9-19E0-4D4A-972F-DDF537F5DEFE}.Release|x86.ActiveCfg = Release|Win32 {FED919A9-19E0-4D4A-972F-DDF537F5DEFE}.Release|x86.Build.0 = Release|Win32 + {7657FAE6-1ABF-45C3-AA89-ACAC1110C228}.Debug|Any CPU.ActiveCfg = Debug|x86 + {7657FAE6-1ABF-45C3-AA89-ACAC1110C228}.Debug|ARM.ActiveCfg = Debug|ARM + {7657FAE6-1ABF-45C3-AA89-ACAC1110C228}.Debug|ARM.Build.0 = Debug|ARM + {7657FAE6-1ABF-45C3-AA89-ACAC1110C228}.Debug|ARM.Deploy.0 = Debug|ARM + {7657FAE6-1ABF-45C3-AA89-ACAC1110C228}.Debug|ARM64.ActiveCfg = Debug|ARM64 + {7657FAE6-1ABF-45C3-AA89-ACAC1110C228}.Debug|ARM64.Build.0 = Debug|ARM64 + {7657FAE6-1ABF-45C3-AA89-ACAC1110C228}.Debug|ARM64.Deploy.0 = Debug|ARM64 + {7657FAE6-1ABF-45C3-AA89-ACAC1110C228}.Debug|x64.ActiveCfg = Debug|x64 + {7657FAE6-1ABF-45C3-AA89-ACAC1110C228}.Debug|x64.Build.0 = Debug|x64 + {7657FAE6-1ABF-45C3-AA89-ACAC1110C228}.Debug|x64.Deploy.0 = Debug|x64 + {7657FAE6-1ABF-45C3-AA89-ACAC1110C228}.Debug|x86.ActiveCfg = Debug|x86 + {7657FAE6-1ABF-45C3-AA89-ACAC1110C228}.Debug|x86.Build.0 = Debug|x86 + {7657FAE6-1ABF-45C3-AA89-ACAC1110C228}.Debug|x86.Deploy.0 = Debug|x86 + {7657FAE6-1ABF-45C3-AA89-ACAC1110C228}.Release|Any CPU.ActiveCfg = Release|x86 + {7657FAE6-1ABF-45C3-AA89-ACAC1110C228}.Release|ARM.ActiveCfg = Release|ARM + {7657FAE6-1ABF-45C3-AA89-ACAC1110C228}.Release|ARM.Build.0 = Release|ARM + {7657FAE6-1ABF-45C3-AA89-ACAC1110C228}.Release|ARM.Deploy.0 = Release|ARM + {7657FAE6-1ABF-45C3-AA89-ACAC1110C228}.Release|ARM64.ActiveCfg = Release|ARM64 + {7657FAE6-1ABF-45C3-AA89-ACAC1110C228}.Release|ARM64.Build.0 = Release|ARM64 + {7657FAE6-1ABF-45C3-AA89-ACAC1110C228}.Release|ARM64.Deploy.0 = Release|ARM64 + {7657FAE6-1ABF-45C3-AA89-ACAC1110C228}.Release|x64.ActiveCfg = Release|x64 + {7657FAE6-1ABF-45C3-AA89-ACAC1110C228}.Release|x64.Build.0 = Release|x64 + {7657FAE6-1ABF-45C3-AA89-ACAC1110C228}.Release|x64.Deploy.0 = Release|x64 + {7657FAE6-1ABF-45C3-AA89-ACAC1110C228}.Release|x86.ActiveCfg = Release|x86 + {7657FAE6-1ABF-45C3-AA89-ACAC1110C228}.Release|x86.Build.0 = Release|x86 + {7657FAE6-1ABF-45C3-AA89-ACAC1110C228}.Release|x86.Deploy.0 = Release|x86 EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/examples/server_demo_libevent/server_demo_libevent.cpp b/examples/server_demo_libevent/server_demo_libevent.cpp index 48f245e..e4f3dcd 100644 --- a/examples/server_demo_libevent/server_demo_libevent.cpp +++ b/examples/server_demo_libevent/server_demo_libevent.cpp @@ -283,7 +283,6 @@ void handle_com_passthrough(ThreadContext* context, Client& client, evbuffer* ou std::vector<size_t> zones; if (client.queryStage == QueryStage::QueryingLostConfig && resp.parse(zones, hasMore)) { for (const auto& zone : zones) { - auto& z = client.zones[zone]; client.zones[zone].tamper_enabled = true; snprintf(buf, sizeof(buf), getZoneFormatString(machineTypeFromAdemcoEvent((ADEMCO_EVENT)client.type)), zone); printf("\t\tZone:"); diff --git a/examples/server_demo_libevent_linux/server_demo_libevent_linux.vcxproj b/examples/server_demo_libevent_linux/server_demo_libevent_linux.vcxproj new file mode 100644 index 0000000..a7aaf03 --- /dev/null +++ b/examples/server_demo_libevent_linux/server_demo_libevent_linux.vcxproj @@ -0,0 +1,105 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project DefaultTargets="Build" ToolsVersion="15.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="Release|ARM"> + <Configuration>Release</Configuration> + <Platform>ARM</Platform> + </ProjectConfiguration> + <ProjectConfiguration Include="Debug|ARM64"> + <Configuration>Debug</Configuration> + <Platform>ARM64</Platform> + </ProjectConfiguration> + <ProjectConfiguration Include="Release|ARM64"> + <Configuration>Release</Configuration> + <Platform>ARM64</Platform> + </ProjectConfiguration> + <ProjectConfiguration Include="Debug|x86"> + <Configuration>Debug</Configuration> + <Platform>x86</Platform> + </ProjectConfiguration> + <ProjectConfiguration Include="Release|x86"> + <Configuration>Release</Configuration> + <Platform>x86</Platform> + </ProjectConfiguration> + <ProjectConfiguration Include="Debug|x64"> + <Configuration>Debug</Configuration> + <Platform>x64</Platform> + </ProjectConfiguration> + <ProjectConfiguration Include="Release|x64"> + <Configuration>Release</Configuration> + <Platform>x64</Platform> + </ProjectConfiguration> + </ItemGroup> + <PropertyGroup Label="Globals"> + <ProjectGuid>{7657fae6-1abf-45c3-aa89-acac1110c228}</ProjectGuid> + <Keyword>Linux</Keyword> + <RootNamespace>server_demo_libevent_linux</RootNamespace> + <MinimumVisualStudioVersion>15.0</MinimumVisualStudioVersion> + <ApplicationType>Linux</ApplicationType> + <ApplicationTypeRevision>1.0</ApplicationTypeRevision> + <TargetLinuxPlatform>Generic</TargetLinuxPlatform> + <LinuxProjectType>{2238F9CD-F817-4ECC-BD14-2524D2669B35}</LinuxProjectType> + </PropertyGroup> + <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" /> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|ARM'" Label="Configuration"> + <UseDebugLibraries>true</UseDebugLibraries> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|ARM'" Label="Configuration"> + <UseDebugLibraries>false</UseDebugLibraries> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x86'" Label="Configuration"> + <UseDebugLibraries>true</UseDebugLibraries> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x86'" Label="Configuration"> + <UseDebugLibraries>false</UseDebugLibraries> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration"> + <UseDebugLibraries>true</UseDebugLibraries> + <RemoteRootDir>~/vsprojects</RemoteRootDir> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration"> + <UseDebugLibraries>false</UseDebugLibraries> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|ARM64'" Label="Configuration"> + <UseDebugLibraries>false</UseDebugLibraries> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|ARM64'" Label="Configuration"> + <UseDebugLibraries>true</UseDebugLibraries> + </PropertyGroup> + <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" /> + <ImportGroup Label="ExtensionSettings" /> + <ImportGroup Label="Shared" /> + <ImportGroup Label="PropertySheets" /> + <PropertyGroup Label="UserMacros" /> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'"> + <OutDir>$(ProjectDir)bin\$(Platform)\$(Configuration)\</OutDir> + </PropertyGroup> + <ItemGroup> + <ClCompile Include="..\server_demo_libevent\server_demo_libevent.cpp" /> + </ItemGroup> + <ItemGroup> + <ClInclude Include="..\..\include\ademco_detail.h" /> + <ClInclude Include="..\..\include\ademco_event.h" /> + <ClInclude Include="..\..\include\ademco_packet.h" /> + <ClInclude Include="..\..\include\hb_detail.h" /> + <ClInclude Include="..\..\include\hb_helper.h" /> + </ItemGroup> + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'"> + <ClCompile> + <AdditionalIncludeDirectories>/usr/local/libevent/include;../../include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> + <CppLanguageStandard>c++17</CppLanguageStandard> + <CppAdditionalWarning>no-unused-function;%(CppAdditionalWarning)</CppAdditionalWarning> + </ClCompile> + <Link> + <AdditionalLibraryDirectories>/usr/local/libevent/lib;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories> + <AdditionalDependencies>%(AdditionalDependencies)</AdditionalDependencies> + <LibraryDependencies>event_core;event_pthreads;pthread;rt;%(LibraryDependencies)</LibraryDependencies> + </Link> + </ItemDefinitionGroup> + <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" /> + <ImportGroup Label="ExtensionTargets" /> +</Project> \ No newline at end of file diff --git a/examples/server_demo_libevent_linux/server_demo_libevent_linux.vcxproj.filters b/examples/server_demo_libevent_linux/server_demo_libevent_linux.vcxproj.filters new file mode 100644 index 0000000..d96f689 --- /dev/null +++ b/examples/server_demo_libevent_linux/server_demo_libevent_linux.vcxproj.filters @@ -0,0 +1,25 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <ItemGroup> + <Filter Include="include"> + <UniqueIdentifier>{51502e2c-64a1-4ab6-8e46-369710d54aa5}</UniqueIdentifier> + </Filter> + </ItemGroup> + <ItemGroup> + <ClInclude Include="..\..\include\ademco_detail.h"> + <Filter>include</Filter> + </ClInclude> + <ClInclude Include="..\..\include\ademco_event.h"> + <Filter>include</Filter> + </ClInclude> + <ClInclude Include="..\..\include\ademco_packet.h"> + <Filter>include</Filter> + </ClInclude> + <ClInclude Include="..\..\include\hb_detail.h"> + <Filter>include</Filter> + </ClInclude> + <ClInclude Include="..\..\include\hb_helper.h"> + <Filter>include</Filter> + </ClInclude> + </ItemGroup> +</Project> \ No newline at end of file diff --git a/examples/server_demo_libevent_linux/server_demo_libevent_linux.vcxproj.user b/examples/server_demo_libevent_linux/server_demo_libevent_linux.vcxproj.user new file mode 100644 index 0000000..54fb827 --- /dev/null +++ b/examples/server_demo_libevent_linux/server_demo_libevent_linux.vcxproj.user @@ -0,0 +1,9 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project ToolsVersion="Current" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'"> + <RemoteTarget>1735438401;www.hbwechatserver.com (username=, port=22, authentication=Password)</RemoteTarget> + <RemoteDebuggerCommand>server_demo_libevent_linux</RemoteDebuggerCommand> + <RemoteDebuggerWorkingDirectory>/root/vsprojects/server_demo_libevent_linux/examples/server_demo_libevent_linux/bin/x64/Debug</RemoteDebuggerWorkingDirectory> + <DebuggerFlavor>LinuxDebugger</DebuggerFlavor> + </PropertyGroup> +</Project> \ No newline at end of file diff --git a/include/hb_helper.h b/include/hb_helper.h index 8c30ecd..d4ea053 100644 --- a/include/hb_helper.h +++ b/include/hb_helper.h @@ -31,12 +31,14 @@ static common::MachineType machineTypeFromAdemcoEvent(ademco::ADEMCO_EVENT e) { static ademco::ADEMCO_EVENT ademcoEventFromMachineType(common::MachineType type) { switch (type) { + case common::MachineType::WiFi: return ademco::EVENT_I_AM_WIFI_MACHINE; case common::MachineType::NetMod: return ademco::EVENT_I_AM_NET_MODULE; + case common::MachineType::TrueColor: case common::MachineType::Gprs: return ademco::EVENT_I_AM_GPRS; case common::MachineType::Lcd: return ademco::EVENT_I_AM_LCD_MACHINE; case common::MachineType::Wired: return ademco::EVENT_I_AM_WIRE_MACHINE; - case common::MachineType::WiFi: return ademco::EVENT_I_AM_WIFI_MACHINE; case common::MachineType::ThreeSection: return ademco::EVENT_I_AM_3_SECTION_MACHINE; + case common::MachineType::IoT: return ademco::EVENT_I_AM_IOT_MACHINE; default: return ademco::EVENT_INVALID_EVENT; } } -- 2.18.1