Commit 17fddcc7 authored by captainwong's avatar captainwong

gen_event_md

parent 3e9c39a8
......@@ -27,6 +27,8 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "server_demo_libevent", "ser
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "bench_client", "bench_client\bench_client.vcxproj", "{4C31BDDD-3959-443D-AD05-3757C6456EE8}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "gen_event_md", "gen_event_md\gen_event_md.vcxproj", "{FED919A9-19E0-4D4A-972F-DDF537F5DEFE}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
......@@ -173,6 +175,20 @@ Global
{4C31BDDD-3959-443D-AD05-3757C6456EE8}.Release|x64.Build.0 = Release|x64
{4C31BDDD-3959-443D-AD05-3757C6456EE8}.Release|x86.ActiveCfg = Release|Win32
{4C31BDDD-3959-443D-AD05-3757C6456EE8}.Release|x86.Build.0 = Release|Win32
{FED919A9-19E0-4D4A-972F-DDF537F5DEFE}.Debug|Any CPU.ActiveCfg = Debug|Win32
{FED919A9-19E0-4D4A-972F-DDF537F5DEFE}.Debug|ARM.ActiveCfg = Debug|Win32
{FED919A9-19E0-4D4A-972F-DDF537F5DEFE}.Debug|ARM64.ActiveCfg = Debug|Win32
{FED919A9-19E0-4D4A-972F-DDF537F5DEFE}.Debug|x64.ActiveCfg = Debug|x64
{FED919A9-19E0-4D4A-972F-DDF537F5DEFE}.Debug|x64.Build.0 = Debug|x64
{FED919A9-19E0-4D4A-972F-DDF537F5DEFE}.Debug|x86.ActiveCfg = Debug|Win32
{FED919A9-19E0-4D4A-972F-DDF537F5DEFE}.Debug|x86.Build.0 = Debug|Win32
{FED919A9-19E0-4D4A-972F-DDF537F5DEFE}.Release|Any CPU.ActiveCfg = Release|Win32
{FED919A9-19E0-4D4A-972F-DDF537F5DEFE}.Release|ARM.ActiveCfg = Release|Win32
{FED919A9-19E0-4D4A-972F-DDF537F5DEFE}.Release|ARM64.ActiveCfg = Release|Win32
{FED919A9-19E0-4D4A-972F-DDF537F5DEFE}.Release|x64.ActiveCfg = Release|x64
{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
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
......
#define ENABLE_ADEMCO_EVENT_TO_STRING
#include "../../include/ademco_event.h"
#include <jlib/win32/UnicodeTool.h>
using namespace ademco;
ADEMCO_EVENT statusEvents[] = {
// 主机或分机状态报告
EVENT_ARM,
EVENT_DISARM,
EVENT_HALFARM_1456,
EVENT_HALFARM,
EVENT_EMERGENCY,
};
ADEMCO_EVENT alarmEvents[] = {
// 防区报警
EVENT_BURGLAR,
EVENT_DOORRINGING,
EVENT_FIRE,
EVENT_DURESS,
EVENT_GAS,
EVENT_WATER,
EVENT_TEMPER,
EVENT_ZONE_TEMPER,
EVENT_BY_PASS,
EVENT_BY_PASS_RESUME,
};
ADEMCO_EVENT excepEvents[] = {
// 防区异常
EVENT_AC_BROKE,
EVENT_AC_RECOVER,
EVENT_LOWBATTERY,
EVENT_BATTERY_RECOVER,
EVENT_BADBATTERY,
EVENT_SOLARDISTURB,
EVENT_DISCONNECT,
EVENT_RECONNECT,
EVENT_BATTERY_EXCEPTION,
EVENT_BATTERY_EXCEPTION_RECOVER,
EVENT_OTHER_EXCEPTION,
EVENT_OTHER_EXCEPTION_RECOVER,
EVENT_LOST,
EVENT_LOST_RECOVER,
// 标准事件,但不做处理
EVENT_3100,
};
ADEMCO_EVENT privateEvents[] = {
// ------------------私有事件-----------------------------------------
EVENT_SERIAL485DIS,
EVENT_SERIAL485CONN,
EVENT_CONN_HANGUP,
EVENT_CONN_RESUME,
EVENT_DISARM_PWD_ERR,
EVENT_SUB_MACHINE_SENSOR_EXCEPTION ,
EVENT_SUB_MACHINE_SENSOR_RESUME,
EVENT_SUB_MACHINE_POWER_EXCEPTION,
EVENT_SUB_MACHINE_POWER_RESUME,
EVENT_RETRIEVE_ZONE_OR_SUB_MACHINE,
EVENT_ENTER_SET_MODE,
EVENT_STOP_RETRIEVE,
EVENT_QUERY_SUB_MACHINE,
EVENT_WRITE_TO_MACHINE,
EVENT_I_AM_NET_MODULE,
EVENT_I_AM_GPRS,
EVENT_I_AM_LCD_MACHINE,
EVENT_I_AM_WIRE_MACHINE,
EVENT_I_AM_WIFI_MACHINE,
EVENT_I_AM_3_SECTION_MACHINE,
EVENT_PHONE_USER_SOS,
EVENT_PHONE_USER_CANCLE_ALARM,
EVENT_ENTER_SETTING_MODE,
EVENT_EXIT_SETTING_MODE,
EVENT_RESTORE_FACTORY_SETTINGS_710,
EVENT_RESTORE_FACTORY_SETTINGS,
EVENT_SIM_IS_IOT_CARD,
EVENT_SIM_IS_NOT_IOT_CARD,
EVENT_WHAT_IS_YOUR_TYPE,
EVENT_SIGNAL_STRENGTH_CHANGED,
};
void printEvents(const ADEMCO_EVENT* events, size_t len)
{
printf("|事件码|含义|en|\n|-----|----|--|\n");
for (size_t i = 0; i < len; i++) {
auto e = events[i];
printf("|%04d|%s|%s|\n", e,
jlib::win32::utf16_to_mbcs(ademcoEventToStringChinese(e, false)).data(),
ademcoEventToStringEnglish(e, false).data());
}
printf("\n");
}
int main()
{
printf("### 主机状态\n\n");
printEvents(statusEvents, _countof(statusEvents));
printf("### 防区报警\n\n");
printEvents(alarmEvents, _countof(alarmEvents));
printf("### 防区异常\n\n");
printEvents(excepEvents, _countof(excepEvents));
printf("### *恒博私有事件码*\n\n");
printEvents(privateEvents, _countof(privateEvents));
}
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup Label="ProjectConfigurations">
<ProjectConfiguration Include="Debug|Win32">
<Configuration>Debug</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|Win32">
<Configuration>Release</Configuration>
<Platform>Win32</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">
<VCProjectVersion>16.0</VCProjectVersion>
<Keyword>Win32Proj</Keyword>
<ProjectGuid>{fed919a9-19e0-4d4a-972f-ddf537f5defe}</ProjectGuid>
<RootNamespace>geneventmd</RootNamespace>
<WindowsTargetPlatformVersion>10.0</WindowsTargetPlatformVersion>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<PlatformToolset>v142</PlatformToolset>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<PlatformToolset>v142</PlatformToolset>
<WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<PlatformToolset>v142</PlatformToolset>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<PlatformToolset>v142</PlatformToolset>
<WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>Unicode</CharacterSet>
</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|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 Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<LinkIncremental>true</LinkIncremental>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<LinkIncremental>false</LinkIncremental>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<LinkIncremental>true</LinkIncremental>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<LinkIncremental>false</LinkIncremental>
</PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<SDLCheck>true</SDLCheck>
<PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<ConformanceMode>true</ConformanceMode>
<AdditionalIncludeDirectories>$(DEVLIBS)\jlib;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
</ClCompile>
<Link>
<SubSystem>Console</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions>
<SDLCheck>true</SDLCheck>
<PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<ConformanceMode>true</ConformanceMode>
</ClCompile>
<Link>
<SubSystem>Console</SubSystem>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences>
<GenerateDebugInformation>true</GenerateDebugInformation>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<SDLCheck>true</SDLCheck>
<PreprocessorDefinitions>_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<ConformanceMode>true</ConformanceMode>
</ClCompile>
<Link>
<SubSystem>Console</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions>
<SDLCheck>true</SDLCheck>
<PreprocessorDefinitions>NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<ConformanceMode>true</ConformanceMode>
</ClCompile>
<Link>
<SubSystem>Console</SubSystem>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences>
<GenerateDebugInformation>true</GenerateDebugInformation>
</Link>
</ItemDefinitionGroup>
<ItemGroup>
<ClCompile Include="gen_event_md.cpp" />
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
</ImportGroup>
</Project>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup>
<Filter Include="Source Files">
<UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
<Extensions>cpp;c;cc;cxx;c++;cppm;ixx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
</Filter>
<Filter Include="Header Files">
<UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
<Extensions>h;hh;hpp;hxx;h++;hm;inl;inc;ipp;xsd</Extensions>
</Filter>
<Filter Include="Resource Files">
<UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier>
<Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms</Extensions>
</Filter>
</ItemGroup>
<ItemGroup>
<ClCompile Include="gen_event_md.cpp">
<Filter>Source Files</Filter>
</ClCompile>
</ItemGroup>
</Project>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="Current" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup />
</Project>
\ No newline at end of file
......@@ -377,7 +377,6 @@ inline EventLevel GetEventLevel(ADEMCO_EVENT ademco_event)
case EVENT_DISARM:
case EVENT_HALFARM:
return EVENT_LEVEL_STATUS;
break;
case EVENT_AC_RECOVER:
case EVENT_RECONNECT:
case EVENT_LOST_RECOVER:
......@@ -388,7 +387,6 @@ inline EventLevel GetEventLevel(ADEMCO_EVENT ademco_event)
case EVENT_BATTERY_EXCEPTION_RECOVER:
case EVENT_OTHER_EXCEPTION_RECOVER:
return EVENT_LEVEL_EXCEPTION_RESUME;
break;
case EVENT_AC_BROKE:
case EVENT_LOWBATTERY:
case EVENT_BADBATTERY:
......@@ -401,7 +399,6 @@ inline EventLevel GetEventLevel(ADEMCO_EVENT ademco_event)
case EVENT_BATTERY_EXCEPTION:
case EVENT_OTHER_EXCEPTION:
return EVENT_LEVEL_EXCEPTION;
break;
case EVENT_SERIAL485DIS:
case EVENT_BURGLAR:
case EVENT_DURESS:
......@@ -412,9 +409,9 @@ inline EventLevel GetEventLevel(ADEMCO_EVENT ademco_event)
case EVENT_ZONE_TEMPER:
case EVENT_WATER:
return EVENT_LEVEL_ALARM;
default: break;
default:
return EVENT_LEVEL_NULL;
}
return EVENT_LEVEL_NULL;
}
//! 获取异常恢复事件所对应的异常事件
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment