Skip to content

Commit

Permalink
zone props
Browse files Browse the repository at this point in the history
  • Loading branch information
captainwong committed Sep 15, 2020
1 parent 97e0811 commit 2738511
Show file tree
Hide file tree
Showing 3 changed files with 115 additions and 35 deletions.
59 changes: 37 additions & 22 deletions docs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -153,34 +153,49 @@
*SMS指主机自身是否可以拨打电话、发送短信,不是指通过阿里语音打电话*
|事件码类型|主机类型|半布防|信号强度|防区|有线防区|SMS|内核|网络|型号|
|---------|-------|------|-------|----|-------|---|---|---|----|
|1707 我是网络模块|3 网络模块+工程主机|Yes|No|1~999|1~8|No|jjf|wzq|<ul><li>HB-G250</li></ul>|
|1717 我是GPRS主机|4 GPRS主机|No|Yes|1~99|None|Yes|wzq|qfm|<ul><li>HB-4040G</li><li>HB-5050G</li><li>HB-5050G-4G</li></ul>|
|1727 我是液晶主机|5 液晶主机|Yes|Yes|1~249|None|Yes|jjf|qfm|<ul><li>HB-BJQ560</li><li>HB-BJQ560B</li></ul>|
|1737 我是网线主机|6 网线主机|No|No|1~99|None|No|wzq|wzq|<ul><li>HB-4040R</li><li>HB-5050R</li></ul>|
|1757 我是三区段主机|8 三区段主机|No|Yes|1~191|61~68|Yes|jjf|qfm|<ul><li>HB-G1000</li><li>HB-G1000-4G</li></ul>|
|1767 我是物联卡主机|9 物联卡主机|No|Yes|1~60|None|No|jjf|qfm|<ul><li>HB-2050-4GW</li></ul>|
|1777 我是真彩主机|7 真彩主机|No|Yes|1~68|1~8|Yes|jjf|qfm|<ul><li>HB-G1000</li><li>HB-G1000-4G</li></ul>|
|1787 我是简化版物联卡主机|2 简化的物联卡主机|No|Yes|1~99|None|No|wzq|qfm|<ul><li>HB-5050G-4GW</li></ul>|
|1797 我是GPRS主机能打电话|10 GPRS主机能打电话|No|Yes|1~60|None|Yes|jjf|qfm|<ul><li>HB-2050</li></ul>|
|1707 我是网络模块|3 网络模块+工程主机|| |1~999|1~8| |jjf|wzq|<ul><li>HB-G250</li></ul>|
|1717 我是GPRS主机|4 GPRS主机| ||1~99| ||wzq|qfm|<ul><li>HB-4040G</li><li>HB-5050G</li><li>HB-5050G-4G</li></ul>|
|1727 我是液晶主机|5 液晶主机|||1~249| ||jjf|qfm|<ul><li>HB-BJQ560</li><li>HB-BJQ560B</li></ul>|
|1737 我是网线主机|6 网线主机| | |1~99| | |wzq|wzq|<ul><li>HB-4040R</li><li>HB-5050R</li></ul>|
|1757 我是三区段主机|8 三区段主机| ||1~191|61~68||jjf|qfm|<ul><li>HB-G1000</li><li>HB-G1000-4G</li></ul>|
|1767 我是物联卡主机|9 物联卡主机| ||1~60| | |jjf|qfm|<ul><li>HB-2050-4GW</li></ul>|
|1777 我是真彩主机|7 真彩主机| ||1~68|1~8||jjf|qfm|<ul><li>HB-G1000</li><li>HB-G1000-4G</li></ul>|
|1787 我是简化版物联卡主机|2 简化的物联卡主机| ||1~99| | |wzq|qfm|<ul><li>HB-5050G-4GW</li></ul>|
|1797 我是GPRS主机能打电话|10 GPRS主机能打电话| ||1~60| ||jjf|qfm|<ul><li>HB-2050</li></ul>|


### *恒博主机型号示例图片*

|型号|示例图片|
|---|--------|
|HB-2050|<img alt="HB-2050" src="./主机类型/smartresize/HB-2050-web.png" style="max-height:80px" />|
|HB-2050-4GW|<img alt="HB-2050-4GW" src="./主机类型/smartresize/HB-2050-4GW-web.png" style="max-height:80px" />|
|HB-4040G|<img alt="HB-4040G" src="./主机类型/smartresize/HB-4040G-web.png" style="max-height:80px" />|
|HB-4040R|<img alt="HB-4040R" src="./主机类型/smartresize/HB-4040R-web.png" style="max-height:80px" />|
|HB-5050G|<img alt="HB-5050G" src="./主机类型/smartresize/HB-5050G-web.png" style="max-height:80px" />|
|HB-5050G-4G|<img alt="HB-5050G-4G" src="./主机类型/smartresize/HB-5050G-4G-web.png" style="max-height:80px" />|
|HB-5050G-4GW|<img alt="HB-5050G-4GW" src="./主机类型/smartresize/HB-5050G-4GW-web.png" style="max-height:80px" />|
|HB-5050R|<img alt="HB-5050R" src="./主机类型/smartresize/HB-5050R-web.png" style="max-height:80px" />|
|HB-BJQ560|<img alt="HB-BJQ560" src="./主机类型/smartresize/HB-BJQ560-web.png" style="max-height:80px" />|
|HB-BJQ560B|<img alt="HB-BJQ560B" src="./主机类型/smartresize/HB-BJQ560B-web.png" style="max-height:80px" />|
|HB-G1000|<img alt="HB-G1000" src="./主机类型/smartresize/HB-G1000-web.png" style="max-height:80px" />|
|HB-G1000-4G|<img alt="HB-G1000-4G" src="./主机类型/smartresize/HB-G1000-4G-web.png" style="max-height:80px" />|
|HB-G250|<img alt="HB-G250" src="./主机类型/smartresize/HB-G250-web.png" style="max-height:80px" />|
|HB-2050|<img alt="HB-2050" src="./主机类型/smartresize/HB-2050-web.png" />|
|HB-2050-4GW|<img alt="HB-2050-4GW" src="./主机类型/smartresize/HB-2050-4GW-web.png" />|
|HB-4040G|<img alt="HB-4040G" src="./主机类型/smartresize/HB-4040G-web.png" />|
|HB-4040R|<img alt="HB-4040R" src="./主机类型/smartresize/HB-4040R-web.png" />|
|HB-5050G|<img alt="HB-5050G" src="./主机类型/smartresize/HB-5050G-web.png" />|
|HB-5050G-4G|<img alt="HB-5050G-4G" src="./主机类型/smartresize/HB-5050G-4G-web.png" />|
|HB-5050G-4GW|<img alt="HB-5050G-4GW" src="./主机类型/smartresize/HB-5050G-4GW-web.png" />|
|HB-5050R|<img alt="HB-5050R" src="./主机类型/smartresize/HB-5050R-web.png" />|
|HB-BJQ560|<img alt="HB-BJQ560" src="./主机类型/smartresize/HB-BJQ560-web.png" />|
|HB-BJQ560B|<img alt="HB-BJQ560B" src="./主机类型/smartresize/HB-BJQ560B-web.png" />|
|HB-G1000|<img alt="HB-G1000" src="./主机类型/smartresize/HB-G1000-web.png" />|
|HB-G1000-4G|<img alt="HB-G1000-4G" src="./主机类型/smartresize/HB-G1000-4G-web.png" />|
|HB-G250|<img alt="HB-G250" src="./主机类型/smartresize/HB-G250-web.png" />|


### *恒博主机类型与支持的防区属性对照表*

|事件码类型|主机类型|00 匪警全局|01 匪警紧急|02 火警防区|03 胁迫防区|04 燃气防区|05 淹水防区|06 分机|07 遥控器|08 匪警半局|09 屏蔽防区|0A 门铃防区|0F 旁路防区|
|---------|-------|----|----|----|----|----|----|----|----|----|----|----|----|
|1707 我是网络模块|3 网络模块+工程主机|||||||||||| |
|1717 我是GPRS主机|4 GPRS主机||||||| || | | | |
|1727 我是液晶主机|5 液晶主机|||||||||||| |
|1737 我是网线主机|6 网线主机||||||| || | | | |
|1757 我是三区段主机|8 三区段主机||||||| || ||||
|1767 我是物联卡主机|9 物联卡主机||||||| || ||||
|1777 我是真彩主机|7 真彩主机||||||| || ||||
|1787 我是简化版物联卡主机|2 简化的物联卡主机||||||| || | | | |
|1797 我是GPRS主机能打电话|10 GPRS主机能打电话||||||| || | | | |

## 四、恒博扩展

Expand Down
56 changes: 51 additions & 5 deletions examples/gen_event_md/gen_event_md.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,22 @@
#define ENABLE_ADEMCO_EVENT_TO_STRING
#include "../../include/ademco_event.h"
#define ENABLE_COMMON_MACHINE_TYPE_TO_STRING
#define ENABLE_COMMON_ZONE_PROPERTY_TO_STRING
#include "../../include/hb_detail.h"
#include "../../include/hb_helper.h"
#include <jlib/win32/UnicodeTool.h>
#include <jlib/win32/path_op.h>
#include <jlib/util/std_util.h>
#include <map>

using namespace ademco;
using namespace hb;
using namespace hb::common;

const char* print_bool(bool b) {
return b ? "" : " "; // "×";
}

ADEMCO_EVENT statusEvents[] = {

// 主机或分机状态报告
Expand Down Expand Up @@ -236,15 +242,15 @@ void print_machineTypes()

printf("|%04d %s", (int)e, jlib::win32::utf16_to_mbcs(ademcoEventToStringChinese(e, false)).data());
printf("|%s", jlib::win32::utf16_to_mbcs(machineTypeToWString(t)).data());
printf("|%s", machineCanHalfArm(t) ? "Yes" : "No");
printf("|%s", machineCanReportSignalStrength(t) ? "Yes" : "No");
printf("|%s", print_bool(machineCanHalfArm(t)));
printf("|%s", print_bool(machineCanReportSignalStrength(t)));
printf("|1~%d", zoneMax(t));
if (machineHasWiredZone(t)) {
printf("|%d~%d", wiredZoneMin(t), wiredZoneMax(t));
} else {
printf("|None");
printf("| ");
}
printf("|%s", machineCanReportBySMS(t) ? "Yes" : "No");
printf("|%s", print_bool(machineCanReportBySMS(t)));
printf("|%s", get_core_author(t));
printf("|%s", get_net_author(t));
_print_machine_img(t);
Expand Down Expand Up @@ -277,11 +283,49 @@ void print_imgs()
}
}
for (auto i : imgs) {
printf(R"(|%s|<img alt="%s" src="%s" style="max-height:80px" />|)" "\n", i.first.data(), i.first.data(), i.second.data());
printf(R"(|%s|<img alt="%s" src="%s" />|)" "\n", i.first.data(), i.first.data(), i.second.data());
}
printf("\n\n");
}

void print_available_zone_props()
{
printf("### *恒博主机类型与支持的防区属性对照表*\n\n");

auto all_props = getAvailableZoneProperties();

auto print_prop = [](ZoneProperty zp) {
printf("%02X %s", (Char)zp, jlib::win32::utf16_to_mbcs(zonePropertyToStringChinese(zp)).data());
};

printf("|事件码类型|主机类型");
for (auto zp : all_props) {
printf("|"); print_prop(zp);
}
printf("|\n");

printf("|---------|-------");
for (size_t i = 0; i < all_props.size(); i++) {
printf("|----");
}
printf("|\n");

for (auto e : AdemcoEvents) {
if (isMachineTypeEvent(e)) {
auto t = hb::machineTypeFromAdemcoEvent(e);
if (!machineIsSelling(t)) continue;
printf("|%04d %s", (int)e, jlib::win32::utf16_to_mbcs(ademcoEventToStringChinese(e, false)).data());
printf("|%s", jlib::win32::utf16_to_mbcs(machineTypeToWString(t)).data());
auto avail_props = getAvailableZoneProperties(t);
for (auto zp : all_props) {
printf("|%s", print_bool(jlib::is_contain(avail_props, zp)));
}
printf("|\n");
}
}

}

int main()
{
printf("### 主机状态\n\n");
Expand All @@ -298,4 +342,6 @@ int main()

print_machineTypes();
print_imgs();

print_available_zone_props();
}
35 changes: 27 additions & 8 deletions include/hb_detail.h
Original file line number Diff line number Diff line change
Expand Up @@ -397,16 +397,35 @@ static ZoneProperty zonePropertyFromChar(Char zp) {
return ZoneProperty::InvalidZoneProperty;
}

static std::vector<ZoneProperty> getAvailableZoneProperties() {
return { Buglar, Emergency, Fire, Duress, Gas, Water, SubMachine, RemoteControl, BuglarHalf, Shield, DoorRing, Bypass };
}

static std::vector<ZoneProperty> getAvailableZoneProperties(MachineType type) {
switch (type) {
case NetMod: return { Buglar, Emergency, Fire, Duress, Gas, Water, SubMachine, RemoteControl, BuglarHalf, Shield, DoorRing };
case Gprs: return { Buglar, Emergency, Fire, Duress, Gas, Water, };
case Lcd: return { Buglar, Emergency, Fire, Duress, Gas, Water, SubMachine, RemoteControl, BuglarHalf, Shield, DoorRing };
case Wired: return { Buglar, Emergency, Fire, Duress, Gas, Water, };
case TrueColor: return { Buglar, Emergency, Fire, Duress, Gas, Water, RemoteControl, Shield, DoorRing, Bypass };
case ThreeSection:return { Buglar, Emergency, Fire, Duress, Gas, Water, RemoteControl, Shield, DoorRing, Bypass };
default: return {};
}
case hb::common::WiFi:
break;
case hb::common::Camera:
break;
case hb::common::Gprs_IoT:
case hb::common::Gprs:
return { Buglar, Emergency, Fire, Duress, Gas, Water, RemoteControl, };
case hb::common::NetMod:
return { Buglar, Emergency, Fire, Duress, Gas, Water, SubMachine, RemoteControl, BuglarHalf, Shield, DoorRing };
case hb::common::Lcd:
return { Buglar, Emergency, Fire, Duress, Gas, Water, SubMachine, RemoteControl, BuglarHalf, Shield, DoorRing };
case hb::common::Wired:
return { Buglar, Emergency, Fire, Duress, Gas, Water, RemoteControl, };
case hb::common::TrueColor:
return { Buglar, Emergency, Fire, Duress, Gas, Water, RemoteControl, Shield, DoorRing, Bypass };
case hb::common::ThreeSection:
return { Buglar, Emergency, Fire, Duress, Gas, Water, RemoteControl, Shield, DoorRing, Bypass };
case hb::common::IoT:
return { Buglar, Emergency, Fire, Duress, Gas, Water, RemoteControl, Shield, DoorRing, Bypass };
case hb::common::Gprs_Phone:
return { Buglar, Emergency, Fire, Duress, Gas, Water, RemoteControl, };
}
return {};
}

#ifdef ENABLE_COMMON_ZONE_PROPERTY_TO_STRING
Expand Down

0 comments on commit 2738511

Please sign in to comment.