Commit 1dedea13 authored by captainwong's avatar captainwong

2.5.0

parent 84638c06
# Ademco Change Log # Ademco Change Log
## 2.5.0 2024-4-19 18:07:08
- `ARM` to `ARM_AWAY`
- `HALF_ARM` to `ARM_STAY`
- `resume` to `recover`
- add several recover events
- fix some typo
## 2.4.0 2024-4-18 04:28:43 ## 2.4.0 2024-4-18 04:28:43
- split some features from `hb_com` to `hb_core` - split some features from `hb_com` to `hb_core`
...@@ -44,7 +53,7 @@ ...@@ -44,7 +53,7 @@
## 2.1.3 ## 2.1.3
- fix `hb_com_resp_a2_p1_t` typo - fix `uint8_t` typo
## 2.1.2 ## 2.1.2
...@@ -64,7 +73,7 @@ ...@@ -64,7 +73,7 @@
## 2.0.0 ## 2.0.0
- add `hb_com_resp_ad_iter_t`, `hb_com_resp_ad_iter_init` and `hb_com_resp_ad_iter_next` - add `hb_com_zone_lost_data_iter_t`, `hb_com_zone_lost_data_iter_init` and `hb_com_zone_lost_data_iter_next`
- add `ADEMCO_PACKET_PWD_MIN_LEN`, `ADEMCO_PACKET_PWD_MAX_LEN` - add `ADEMCO_PACKET_PWD_MIN_LEN`, `ADEMCO_PACKET_PWD_MAX_LEN`
- code styles changed - code styles changed
- when parse returns `ADEMCO_PARSE_RESULT_ERROR`, `*ate` will contains length to ignore, caller must drop `*ate` bytes of data - when parse returns `ADEMCO_PARSE_RESULT_ERROR`, `*ate` will contains length to ignore, caller must drop `*ate` bytes of data
...@@ -78,7 +87,7 @@ ...@@ -78,7 +87,7 @@
## 1.5.0 ## 1.5.0
- `hb_com_resp_a2_iter_t.com` changed to pointer - `hb_com_zone_data_iter_t.com` changed to pointer
- update parser for `timestamp` - update parser for `timestamp`
- add `AdemcoControlSource` defs - add `AdemcoControlSource` defs
......
...@@ -93,61 +93,61 @@ int ademco_is_valid_account(const char* acct) { ...@@ -93,61 +93,61 @@ int ademco_is_valid_account(const char* acct) {
} }
int ademco_is_machine_status_event(ademco_event_t ademco_event) { int ademco_is_machine_status_event(ademco_event_t ademco_event) {
return ademco_event == EVENT_ARM || return ademco_event == EVENT_ARM_AWAY ||
ademco_event == EVENT_HALFARM || ademco_event == EVENT_ARM_STAY ||
ademco_event == EVENT_HALFARM_1456 || ademco_event == EVENT_ARM_STAY_1456 ||
ademco_event == EVENT_DISARM; ademco_event == EVENT_DISARM;
} }
int ademco_is_machine_type_event(ademco_event_t ademco_event) { int ademco_is_machine_type_event(ademco_event_t ademco_event) {
return ademco_event == EVENT_I_AM_NET_MODULE || return ademco_event == EVENT_I_AM_NET_MODULE ||
ademco_event == EVENT_I_AM_GPRS || ademco_event == EVENT_I_AM_GPRS ||
ademco_event == EVENT_I_AM_LCD_MACHINE || ademco_event == EVENT_I_AM_LCD ||
ademco_event == EVENT_I_AM_WIRE_MACHINE || ademco_event == EVENT_I_AM_WIRE ||
ademco_event == EVENT_I_AM_WIFI_MACHINE || ademco_event == EVENT_I_AM_WIFI ||
ademco_event == EVENT_I_AM_3_SECTION_MACHINE || ademco_event == EVENT_I_AM_3_SECTION ||
ademco_event == EVENT_I_AM_IOT_MACHINE || ademco_event == EVENT_I_AM_IOT ||
ademco_event == EVENT_I_AM_TRUE_COLOR || ademco_event == EVENT_I_AM_TRUE_COLOR ||
ademco_event == EVENT_I_AM_GPRS_IOT || ademco_event == EVENT_I_AM_GPRS_IOT ||
ademco_event == EVENT_I_AM_GPRS_PHONE || ademco_event == EVENT_I_AM_GPRS_PHONE ||
ademco_event == EVENT_I_AM_NB_MACHINE || ademco_event == EVENT_I_AM_NB ||
ademco_event == EVENT_I_AM_WIFI2_MACHINE; ademco_event == EVENT_I_AM_WIFI2;
} }
int ademco_is_event_need_control_source(ademco_event_t ademco_event) { int ademco_is_event_need_control_source(ademco_event_t ademco_event) {
return ademco_event == EVENT_ARM || return ademco_event == EVENT_ARM_AWAY ||
ademco_event == EVENT_HALFARM || ademco_event == EVENT_ARM_STAY ||
ademco_event == EVENT_HALFARM_1456 || ademco_event == EVENT_ARM_STAY_1456 ||
ademco_event == EVENT_DISARM || ademco_event == EVENT_DISARM ||
ademco_event == EVENT_EMERGENCY || ademco_event == EVENT_EMERGENCY ||
ademco_event == EVENT_DURESS || ademco_event == EVENT_DURESS ||
ademco_event == EVENT_PHONE_USER_CANCLE_ALARM; ademco_event == EVENT_PHONE_USER_CANCLE_ALARM;
} }
ademco_event_t ademco_get_exception_event_by_resume_event(ademco_event_t resumeEvent) { ademco_event_t ademco_get_exception_event_by_recover_event(ademco_event_t recover_event) {
switch (resumeEvent) { switch (recover_event) {
case EVENT_RECONNECT: case EVENT_DISCONNECT_RECOVER:
return EVENT_DISCONNECT; return EVENT_DISCONNECT;
case EVENT_LOST_RECOVER: case EVENT_LOST_RECOVER:
return EVENT_LOST; return EVENT_LOST;
case EVENT_SERIAL485CONN: case EVENT_SERIAL_485_RECOVER:
return EVENT_SERIAL485DIS; return EVENT_SERIAL_485_DIS;
case EVENT_SUB_MACHINE_SENSOR_RESUME: case EVENT_SUB_MACHINE_SENSOR_RECOVER:
return EVENT_SUB_MACHINE_SENSOR_EXCEPTION; return EVENT_SUB_MACHINE_SENSOR_EXCEPTION;
case EVENT_SUB_MACHINE_POWER_RESUME: case EVENT_SUB_MACHINE_POWER_RECOVER:
return EVENT_SUB_MACHINE_POWER_EXCEPTION; return EVENT_SUB_MACHINE_POWER_EXCEPTION;
case EVENT_BATTERY_RECOVER: case EVENT_LOW_BATTERY_RECOVER:
return EVENT_LOWBATTERY; return EVENT_LOW_BATTERY;
case EVENT_BATTERY_EXCEPTION_RECOVER: case EVENT_BATTERY_EXCEPTION_RECOVER:
return EVENT_BATTERY_EXCEPTION; return EVENT_BATTERY_EXCEPTION;
case EVENT_OTHER_EXCEPTION_RECOVER: case EVENT_OTHER_EXCEPTION_RECOVER:
return EVENT_OTHER_EXCEPTION; return EVENT_OTHER_EXCEPTION;
case EVENT_AC_RECOVER: case EVENT_AC_RECOVER:
return EVENT_AC_BROKE; return EVENT_AC_BROKE;
case EVENT_SOLARDISTURB_RECOVER: case EVENT_SOLAR_DISTURB_RECOVER:
return EVENT_SOLARDISTURB; return EVENT_SOLAR_DISTURB;
case EVENT_BADBATTERY_RECOVER: case EVENT_BAD_BATTERY_RECOVER:
return EVENT_BADBATTERY; return EVENT_BAD_BATTERY;
default: default:
return EVENT_INVALID_EVENT; return EVENT_INVALID_EVENT;
} }
...@@ -155,39 +155,38 @@ ademco_event_t ademco_get_exception_event_by_resume_event(ademco_event_t resumeE ...@@ -155,39 +155,38 @@ ademco_event_t ademco_get_exception_event_by_resume_event(ademco_event_t resumeE
ademco_event_level_t ademco_get_event_level(ademco_event_t ademco_event) { ademco_event_level_t ademco_get_event_level(ademco_event_t ademco_event) {
switch (ademco_event) { switch (ademco_event) {
case EVENT_ARM: case EVENT_ARM_AWAY:
case EVENT_DISARM: case EVENT_DISARM:
case EVENT_HALFARM: case EVENT_ARM_STAY:
case EVENT_HALFARM_1456: case EVENT_ARM_STAY_1456:
return EVENT_LEVEL_STATUS; return EVENT_LEVEL_STATUS;
case EVENT_BADBATTERY_RECOVER: case EVENT_BAD_BATTERY_RECOVER:
case EVENT_AC_RECOVER: case EVENT_AC_RECOVER:
case EVENT_RECONNECT: case EVENT_DISCONNECT_RECOVER:
case EVENT_LOST_RECOVER: case EVENT_LOST_RECOVER:
case EVENT_SERIAL485CONN: case EVENT_SERIAL_485_RECOVER:
case EVENT_SUB_MACHINE_SENSOR_RESUME: case EVENT_SUB_MACHINE_SENSOR_RECOVER:
case EVENT_SUB_MACHINE_POWER_RESUME: case EVENT_SUB_MACHINE_POWER_RECOVER:
case EVENT_BATTERY_RECOVER: case EVENT_LOW_BATTERY_RECOVER:
case EVENT_BATTERY_EXCEPTION_RECOVER: case EVENT_BATTERY_EXCEPTION_RECOVER:
case EVENT_OTHER_EXCEPTION_RECOVER: case EVENT_OTHER_EXCEPTION_RECOVER:
case EVENT_SOLARDISTURB_RECOVER: case EVENT_SOLAR_DISTURB_RECOVER:
return EVENT_LEVEL_EXCEPTION_RESUME; return EVENT_LEVEL_EXCEPTION_RECOVER;
case EVENT_AC_BROKE: case EVENT_AC_BROKE:
case EVENT_LOWBATTERY: case EVENT_LOW_BATTERY:
case EVENT_BADBATTERY: case EVENT_BAD_BATTERY:
case EVENT_SOLARDISTURB: case EVENT_SOLAR_DISTURB:
case EVENT_DISCONNECT: case EVENT_DISCONNECT:
case EVENT_LOST: case EVENT_LOST:
// case EVENT_DOORRINGING: //case EVENT_CONN_HANGUP: //case EVENT_CONN_RESUME:
case EVENT_SUB_MACHINE_SENSOR_EXCEPTION: case EVENT_SUB_MACHINE_SENSOR_EXCEPTION:
case EVENT_SUB_MACHINE_POWER_EXCEPTION: case EVENT_SUB_MACHINE_POWER_EXCEPTION:
case EVENT_BATTERY_EXCEPTION: case EVENT_BATTERY_EXCEPTION:
case EVENT_OTHER_EXCEPTION: case EVENT_OTHER_EXCEPTION:
return EVENT_LEVEL_EXCEPTION; return EVENT_LEVEL_EXCEPTION;
case EVENT_SERIAL485DIS: case EVENT_SERIAL_485_DIS:
case EVENT_BURGLAR: case EVENT_BURGLAR:
case EVENT_DURESS: case EVENT_DURESS:
case EVENT_EMERGENCY: case EVENT_EMERGENCY:
...@@ -212,8 +211,9 @@ const char* ademco_event_to_string(ademco_event_t ademco_event) { ...@@ -212,8 +211,9 @@ const char* ademco_event_to_string(ademco_event_t ademco_event) {
// ----标准安定宝协议事件---- // ----标准安定宝协议事件----
ADEMCO_STATUS_EVENTS_MAP(XX) ADEMCO_STATUS_EVENTS_MAP(XX)
ADEMCO_ALARM_EVENTS_MAP(XX) ADEMCO_ALARM_EVENTS_MAP(XX)
ADEMCO_ALARM_RECOVER_EVENTS_MAP(XX)
ADEMCO_EXEPTION_EVENTS_MAP(XX) ADEMCO_EXEPTION_EVENTS_MAP(XX)
ADEMCO_RESUME_EVENTS_MAP(XX) ADEMCO_EXEPTION_RECOVER_EVENTS_MAP(XX)
// ---私有事件--------- // ---私有事件---------
ADEMCO_HB_EVENTS_MAP(XX) ADEMCO_HB_EVENTS_MAP(XX)
...@@ -233,8 +233,9 @@ const char* ademco_event_to_string_chinese(ademco_event_t ademco_event) { ...@@ -233,8 +233,9 @@ const char* ademco_event_to_string_chinese(ademco_event_t ademco_event) {
// ----标准安定宝协议事件---- // ----标准安定宝协议事件----
ADEMCO_STATUS_EVENTS_MAP(XX) ADEMCO_STATUS_EVENTS_MAP(XX)
ADEMCO_ALARM_EVENTS_MAP(XX) ADEMCO_ALARM_EVENTS_MAP(XX)
ADEMCO_ALARM_RECOVER_EVENTS_MAP(XX)
ADEMCO_EXEPTION_EVENTS_MAP(XX) ADEMCO_EXEPTION_EVENTS_MAP(XX)
ADEMCO_RESUME_EVENTS_MAP(XX) ADEMCO_EXEPTION_RECOVER_EVENTS_MAP(XX)
// ---私有事件--------- // ---私有事件---------
ADEMCO_HB_EVENTS_MAP(XX) ADEMCO_HB_EVENTS_MAP(XX)
...@@ -451,7 +452,7 @@ size_t ademco_data_to_congwin_fe100(ademco_char_t* fe100, size_t fe100_len, ...@@ -451,7 +452,7 @@ size_t ademco_data_to_congwin_fe100(ademco_char_t* fe100, size_t fe100_len,
// E for open, R for close // E for open, R for close
if (ademco_data->ademco_event / 1000 == 1 || if (ademco_data->ademco_event / 1000 == 1 ||
ademco_data->ademco_event == EVENT_HALFARM) ademco_data->ademco_event == EVENT_ARM_STAY)
*p++ = 'E'; *p++ = 'E';
else else
*p++ = 'R'; *p++ = 'R';
......
...@@ -69,18 +69,18 @@ typedef uint16_t ademco_zone_t; ...@@ -69,18 +69,18 @@ typedef uint16_t ademco_zone_t;
#define ADEMCO_SIGNAL_STRENGTH_MIN 0 #define ADEMCO_SIGNAL_STRENGTH_MIN 0
#define ADEMCO_SIGNAL_STRENGTH_MAX 31 #define ADEMCO_SIGNAL_STRENGTH_MAX 31
// 主机或分机状态报告 // 主机状态
#define ADEMCO_STATUS_EVENTS_MAP(XX) \ #define ADEMCO_STATUS_EVENTS_MAP(XX) \
XX(ARM, 3400, "布防") \ XX(ARM_AWAY, 3400, "离家布防") \
XX(DISARM, 1400, "撤防") \ XX(DISARM, 1400, "撤防") \
XX(HALFARM, 3456, "半布防") \ XX(ARM_STAY, 3456, "留守布防") \
XX(HALFARM_1456, 1456, "半布防") \ XX(ARM_STAY_1456, 1456, "留守布防")
XX(EMERGENCY, 1120, "紧急报警")
// 防区报警 // 防区报警
#define ADEMCO_ALARM_EVENTS_MAP(XX) \ #define ADEMCO_ALARM_EVENTS_MAP(XX) \
XX(EMERGENCY, 1120, "紧急报警") \
XX(BURGLAR, 1130, "盗警") \ XX(BURGLAR, 1130, "盗警") \
XX(DOORRINGING, 1134, "门铃") \ XX(DOOR_RING, 1134, "门铃") \
XX(FIRE, 1110, "火警") \ XX(FIRE, 1110, "火警") \
XX(DURESS, 1121, "胁迫") \ XX(DURESS, 1121, "胁迫") \
XX(GAS, 1151, "煤气") \ XX(GAS, 1151, "煤气") \
...@@ -89,25 +89,37 @@ typedef uint16_t ademco_zone_t; ...@@ -89,25 +89,37 @@ typedef uint16_t ademco_zone_t;
XX(ZONE_TAMPER, 1383, "防区防拆") \ XX(ZONE_TAMPER, 1383, "防区防拆") \
XX(BYPASS, 1570, "旁路") XX(BYPASS, 1570, "旁路")
// 防区报警恢复
#define ADEMCO_ALARM_RECOVER_EVENTS_MAP(XX) \
XX(EMERGENCY_RECOVER, 3120, "紧急恢复") \
XX(BURGLAR_RECOVER, 3130, "盗警恢复") \
XX(DOOR_RING_RECOVER, 3134, "门铃恢复") \
XX(FIRE_RECOVER, 3110, "火警恢复") \
XX(DURESS_RECOVER, 3121, "胁迫恢复") \
XX(GAS_RECOVER, 3151, "煤气恢复") \
XX(WATER_RECOVER, 3113, "水警恢复") \
XX(TAMPER_RECOVER, 3137, "主机防拆恢复") \
XX(ZONE_TAMPER_RECOVER, 3383, "防区防拆恢复") \
XX(BYPASS_RECOVER, 3570, "解除旁路")
// 防区异常 // 防区异常
#define ADEMCO_EXEPTION_EVENTS_MAP(XX) \ #define ADEMCO_EXEPTION_EVENTS_MAP(XX) \
XX(AC_BROKE, 1301, "主机AC掉电") \ XX(AC_BROKE, 1301, "主机AC掉电") \
XX(LOWBATTERY, 1302, "低电") \ XX(LOW_BATTERY, 1302, "低电") \
XX(BADBATTERY, 1311, "坏电") \ XX(BAD_BATTERY, 1311, "坏电") \
XX(SOLARDISTURB, 1387, "光扰") \ XX(SOLAR_DISTURB, 1387, "光扰") \
XX(DISCONNECT, 1381, "失效") \ XX(DISCONNECT, 1381, "失效") \
XX(LOST, 1393, "失联") \ XX(LOST, 1393, "失联") \
XX(BATTERY_EXCEPTION, 1384, "电源故障") \ XX(BATTERY_EXCEPTION, 1384, "电源故障") \
XX(OTHER_EXCEPTION, 1380, "其他故障") XX(OTHER_EXCEPTION, 1380, "其他故障")
// 防区异常恢复 // 防区异常恢复
#define ADEMCO_RESUME_EVENTS_MAP(XX) \ #define ADEMCO_EXEPTION_RECOVER_EVENTS_MAP(XX) \
XX(BYPASS_RESUME, 3570, "解除旁路") \
XX(AC_RECOVER, 3301, "主机AC复电") \ XX(AC_RECOVER, 3301, "主机AC复电") \
XX(BATTERY_RECOVER, 3302, "低电恢复") \ XX(LOW_BATTERY_RECOVER, 3302, "低电恢复") \
XX(BADBATTERY_RECOVER, 3311, "坏电恢复") \ XX(BAD_BATTERY_RECOVER, 3311, "坏电恢复") \
XX(SOLARDISTURB_RECOVER, 3387, "光扰恢复") \ XX(SOLAR_DISTURB_RECOVER, 3387, "光扰恢复") \
XX(RECONNECT, 3381, "失效恢复") \ XX(DISCONNECT_RECOVER, 3381, "失效恢复") \
XX(LOST_RECOVER, 3393, "失联恢复") \ XX(LOST_RECOVER, 3393, "失联恢复") \
XX(BATTERY_EXCEPTION_RECOVER, 3384, "电源故障恢复") \ XX(BATTERY_EXCEPTION_RECOVER, 3384, "电源故障恢复") \
XX(OTHER_EXCEPTION_RECOVER, 3380, "其他故障恢复") \ XX(OTHER_EXCEPTION_RECOVER, 3380, "其他故障恢复") \
...@@ -115,15 +127,15 @@ typedef uint16_t ademco_zone_t; ...@@ -115,15 +127,15 @@ typedef uint16_t ademco_zone_t;
// 恒博自定义安定宝事件码 // 恒博自定义安定宝事件码
#define ADEMCO_HB_EVENTS_MAP(XX) \ #define ADEMCO_HB_EVENTS_MAP(XX) \
XX(SERIAL485DIS, 1485, "485断开") \ XX(SERIAL_485_DIS, 1485, "485断开") \
XX(SERIAL485CONN, 3485, "485连接") \ XX(SERIAL_485_RECOVER, 3485, "485连接") \
XX(CONN_HANGUP, 1700, "链路挂起") \ XX(CONN_HANGUP, 1700, "链路挂起") \
XX(CONN_RESUME, 3700, "链路恢复") \ XX(CONN_RECOVER, 3700, "链路恢复") \
XX(DISARM_PWD_ERR, 1701, "撤防密码错误") \ XX(DISARM_PWD_ERR, 1701, "撤防密码错误") \
XX(SUB_MACHINE_SENSOR_EXCEPTION, 1702, "分机探头异常") \ XX(SUB_MACHINE_SENSOR_EXCEPTION, 1702, "分机探头异常") \
XX(SUB_MACHINE_SENSOR_RESUME, 3702, "分机探头恢复") \ XX(SUB_MACHINE_SENSOR_RECOVER, 3702, "分机探头恢复") \
XX(SUB_MACHINE_POWER_EXCEPTION, 1703, "分机电源异常") \ XX(SUB_MACHINE_POWER_EXCEPTION, 1703, "分机电源异常") \
XX(SUB_MACHINE_POWER_RESUME, 3703, "分机电源恢复") \ XX(SUB_MACHINE_POWER_RECOVER, 3703, "分机电源恢复") \
XX(COM_PASSTHROUGH, 1704, "串口透传") \ XX(COM_PASSTHROUGH, 1704, "串口透传") \
XX(ENTER_SET_MODE, 2704, "进入设置状态") \ XX(ENTER_SET_MODE, 2704, "进入设置状态") \
XX(EXIT_SET_MODE, 3704, "退出设置状态") \ XX(EXIT_SET_MODE, 3704, "退出设置状态") \
...@@ -131,16 +143,16 @@ typedef uint16_t ademco_zone_t; ...@@ -131,16 +143,16 @@ typedef uint16_t ademco_zone_t;
XX(WRITE_TO_MACHINE, 1706, "写入主机信息") \ XX(WRITE_TO_MACHINE, 1706, "写入主机信息") \
XX(I_AM_NET_MODULE, 1707, "主机类型--网络模块") \ XX(I_AM_NET_MODULE, 1707, "主机类型--网络模块") \
XX(I_AM_GPRS, 1717, "主机类型--GPRS主机") \ XX(I_AM_GPRS, 1717, "主机类型--GPRS主机") \
XX(I_AM_LCD_MACHINE, 1727, "主机类型--液晶主机") \ XX(I_AM_LCD, 1727, "主机类型--液晶主机") \
XX(I_AM_WIRE_MACHINE, 1737, "主机类型--网线主机") \ XX(I_AM_WIRE, 1737, "主机类型--网线主机") \
XX(I_AM_WIFI_MACHINE, 1747, "主机类型--WiFi主机(停用)") \ XX(I_AM_WIFI, 1747, "主机类型--WiFi主机(停用)") \
XX(I_AM_3_SECTION_MACHINE, 1757, "主机类型--三区段主机") \ XX(I_AM_3_SECTION, 1757, "主机类型--三区段主机") \
XX(I_AM_IOT_MACHINE, 1767, "主机类型--物联卡主机") \ XX(I_AM_IOT, 1767, "主机类型--物联卡主机") \
XX(I_AM_TRUE_COLOR, 1777, "主机类型--真彩主机") \ XX(I_AM_TRUE_COLOR, 1777, "主机类型--真彩主机") \
XX(I_AM_GPRS_IOT, 1787, "主机类型--物联卡主机") \ XX(I_AM_GPRS_IOT, 1787, "主机类型--物联卡主机") \
XX(I_AM_GPRS_PHONE, 1797, "主机类型--GRPS主机带电话功能") \ XX(I_AM_GPRS_PHONE, 1797, "主机类型--GRPS主机带电话功能") \
XX(I_AM_NB_MACHINE, 1807, "主机类型--NB报警接收主机") \ XX(I_AM_NB, 1807, "主机类型--NB报警接收主机") \
XX(I_AM_WIFI2_MACHINE, 1817, "主机类型--WiFi主机(新版)") \ XX(I_AM_WIFI2, 1817, "主机类型--WiFi主机(新版)") \
XX(PHONE_USER_SOS, 1709, "手机用户SOS") \ XX(PHONE_USER_SOS, 1709, "手机用户SOS") \
XX(PHONE_USER_CANCLE_ALARM, 1711, "手机用户消警") \ XX(PHONE_USER_CANCLE_ALARM, 1711, "手机用户消警") \
XX(ENTER_SETTING_MODE, 1712, "主机进入设置状态") \ XX(ENTER_SETTING_MODE, 1712, "主机进入设置状态") \
...@@ -166,10 +178,12 @@ typedef enum ademco_event_t { ...@@ -166,10 +178,12 @@ typedef enum ademco_event_t {
ADEMCO_STATUS_EVENTS_MAP(XX) ADEMCO_STATUS_EVENTS_MAP(XX)
// 防区报警 // 防区报警
ADEMCO_ALARM_EVENTS_MAP(XX) ADEMCO_ALARM_EVENTS_MAP(XX)
// 防区报警恢复
ADEMCO_ALARM_RECOVER_EVENTS_MAP(XX)
// 防区异常 // 防区异常
ADEMCO_EXEPTION_EVENTS_MAP(XX) ADEMCO_EXEPTION_EVENTS_MAP(XX)
// 防区异常恢复 // 防区异常恢复
ADEMCO_RESUME_EVENTS_MAP(XX) ADEMCO_EXEPTION_RECOVER_EVENTS_MAP(XX)
// ---私有事件--------- // ---私有事件---------
ADEMCO_HB_EVENTS_MAP(XX) ADEMCO_HB_EVENTS_MAP(XX)
...@@ -183,7 +197,7 @@ typedef enum ademco_event_t { ...@@ -183,7 +197,7 @@ typedef enum ademco_event_t {
typedef enum ademco_event_level_t { typedef enum ademco_event_level_t {
EVENT_LEVEL_NULL, EVENT_LEVEL_NULL,
EVENT_LEVEL_STATUS, // 主机状态 EVENT_LEVEL_STATUS, // 主机状态
EVENT_LEVEL_EXCEPTION_RESUME, // 黄色报警 EVENT_LEVEL_EXCEPTION_RECOVER, // 黄色报警
EVENT_LEVEL_EXCEPTION, // 橙色报警 EVENT_LEVEL_EXCEPTION, // 橙色报警
EVENT_LEVEL_ALARM, // 红色报警 EVENT_LEVEL_ALARM, // 红色报警
} ademco_event_level_t; } ademco_event_level_t;
...@@ -351,7 +365,7 @@ ademco_event_level_t ademco_get_event_level(ademco_event_t ademco_event); ...@@ -351,7 +365,7 @@ ademco_event_level_t ademco_get_event_level(ademco_event_t ademco_event);
// 获取异常恢复事件所对应的异常事件 // 获取异常恢复事件所对应的异常事件
ADEMCO_EXPORT_SYMBOL ADEMCO_EXPORT_SYMBOL
ademco_event_t ademco_get_exception_event_by_resume_event(ademco_event_t resumeEvent); ademco_event_t ademco_get_exception_event_by_recover_event(ademco_event_t recover_event);
ADEMCO_EXPORT_SYMBOL ADEMCO_EXPORT_SYMBOL
const char* ademco_event_to_string(ademco_event_t ademco_event); const char* ademco_event_to_string(ademco_event_t ademco_event);
......
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
*/ */
#define ADEMCO_VERSION_MAJOR 2 #define ADEMCO_VERSION_MAJOR 2
#define ADEMCO_VERSION_MINOR 4 #define ADEMCO_VERSION_MINOR 5
#define ADEMCO_VERSION_PATCH 0 #define ADEMCO_VERSION_PATCH 0
#define ADEMCO_VERSION_IS_RELEASE 1 #define ADEMCO_VERSION_IS_RELEASE 1
#define ADEMCO_VERSION_SUFFIX "" #define ADEMCO_VERSION_SUFFIX ""
......
...@@ -39,7 +39,7 @@ ademco_event_t alarmEvents[] = { ...@@ -39,7 +39,7 @@ ademco_event_t alarmEvents[] = {
ademco_event_t excepEvents[] = { ademco_event_t excepEvents[] = {
#define XX(name, code, zh) EVENT_##name, #define XX(name, code, zh) EVENT_##name,
ADEMCO_EXEPTION_EVENTS_MAP(XX) ADEMCO_EXEPTION_EVENTS_MAP(XX)
ADEMCO_RESUME_EVENTS_MAP(XX) ADEMCO_EXEPTION_RECOVER_EVENTS_MAP(XX)
#undef XX #undef XX
}; };
...@@ -53,8 +53,9 @@ ademco_event_t allEvents[] = { ...@@ -53,8 +53,9 @@ ademco_event_t allEvents[] = {
#define XX(name, code, zh) EVENT_##name, #define XX(name, code, zh) EVENT_##name,
ADEMCO_STATUS_EVENTS_MAP(XX) ADEMCO_STATUS_EVENTS_MAP(XX)
ADEMCO_ALARM_EVENTS_MAP(XX) ADEMCO_ALARM_EVENTS_MAP(XX)
ADEMCO_ALARM_RECOVER_EVENTS_MAP(XX)
ADEMCO_EXEPTION_EVENTS_MAP(XX) ADEMCO_EXEPTION_EVENTS_MAP(XX)
ADEMCO_RESUME_EVENTS_MAP(XX) ADEMCO_EXEPTION_RECOVER_EVENTS_MAP(XX)
ADEMCO_HB_EVENTS_MAP(XX) ADEMCO_HB_EVENTS_MAP(XX)
#undef XX #undef XX
}; };
......
...@@ -290,7 +290,7 @@ int main(int argc, char** argv) { ...@@ -290,7 +290,7 @@ int main(int argc, char** argv) {
if (cmd == 'a' || cmd == 'A') { if (cmd == 'a' || cmd == 'A') {
std::lock_guard<std::mutex> lg(mutex); std::lock_guard<std::mutex> lg(mutex);
evntsWaiting4Send.push_back(EVENT_ARM); evntsWaiting4Send.push_back(EVENT_ARM_AWAY);
} else if (cmd == 'd' || cmd == 'D') { } else if (cmd == 'd' || cmd == 'D') {
int ret = 0; int ret = 0;
do { do {
......
...@@ -333,8 +333,8 @@ hb_machine_status_t hb_machine_status_from_ademco_event(ademco_event_t ademco_ev ...@@ -333,8 +333,8 @@ hb_machine_status_t hb_machine_status_from_ademco_event(ademco_event_t ademco_ev
HMS_EVENT_MAP(XX) HMS_EVENT_MAP(XX)
#undef XX #undef XX
case EVENT_HALFARM_1456: case EVENT_ARM_STAY_1456:
return HMS_HALF_ARM; return HMS_ARM_STAY;
case EVENT_ENTER_SET_MODE: case EVENT_ENTER_SET_MODE:
return HMS_SETTING; return HMS_SETTING;
default: default:
......
...@@ -9,7 +9,6 @@ ...@@ -9,7 +9,6 @@
extern "C" { extern "C" {
#endif #endif
// 三防区主机状态GG范围 1~3 // 三防区主机状态GG范围 1~3
#define HB_3SECTION_MACHINE_GG_MIN 1 #define HB_3SECTION_MACHINE_GG_MIN 1
#define HB_3SECTION_MACHINE_GG_MAX 3 #define HB_3SECTION_MACHINE_GG_MAX 3
...@@ -21,15 +20,15 @@ extern "C" { ...@@ -21,15 +20,15 @@ extern "C" {
// 主机状态表 // 主机状态表
#define HB_MACHINE_STATUS_MAP(XX) \ #define HB_MACHINE_STATUS_MAP(XX) \
XX(ARM, 0, "布防") \ XX(ARM_AWAY, 0, "离家布防") \
XX(HALF_ARM, 1, "半布防") \ XX(ARM_STAY, 1, "留守布防") \
XX(DISARM, 2, "撤防") \ XX(DISARM, 2, "撤防") \
XX(SETTING, 3, "设置") XX(SETTING, 3, "设置")
// 主机状态与安定宝事件码对照表 // 主机状态与安定宝事件码对照表
#define HMS_EVENT_MAP(XX) \ #define HMS_EVENT_MAP(XX) \
XX(HMS_ARM, EVENT_ARM) \ XX(HMS_ARM_AWAY, EVENT_ARM_AWAY) \
XX(HMS_HALF_ARM, EVENT_HALFARM) \ XX(HMS_ARM_STAY, EVENT_ARM_STAY) \
XX(HMS_DISARM, EVENT_DISARM) \ XX(HMS_DISARM, EVENT_DISARM) \
XX(HMS_SETTING, EVENT_ENTER_SETTING_MODE) XX(HMS_SETTING, EVENT_ENTER_SETTING_MODE)
...@@ -62,18 +61,18 @@ typedef enum hb_machine_status_t { ...@@ -62,18 +61,18 @@ typedef enum hb_machine_status_t {
// 主机类型与安定宝事件码对照表 // 主机类型与安定宝事件码对照表
#define HMT_EVENT_MAP(XX) \ #define HMT_EVENT_MAP(XX) \
XX(HMT_WIFI, EVENT_I_AM_WIFI_MACHINE) \ XX(HMT_WIFI, EVENT_I_AM_WIFI) \
XX(HMT_GPRS_IOT, EVENT_I_AM_GPRS_IOT) \ XX(HMT_GPRS_IOT, EVENT_I_AM_GPRS_IOT) \
XX(HMT_NETMOD, EVENT_I_AM_NET_MODULE) \ XX(HMT_NETMOD, EVENT_I_AM_NET_MODULE) \
XX(HMT_GPRS, EVENT_I_AM_GPRS) \ XX(HMT_GPRS, EVENT_I_AM_GPRS) \
XX(HMT_LCD, EVENT_I_AM_LCD_MACHINE) \ XX(HMT_LCD, EVENT_I_AM_LCD) \
XX(HMT_WIRED, EVENT_I_AM_WIRE_MACHINE) \ XX(HMT_WIRED, EVENT_I_AM_WIRE) \
XX(HMT_TRUE_COLOR, EVENT_I_AM_TRUE_COLOR) \ XX(HMT_TRUE_COLOR, EVENT_I_AM_TRUE_COLOR) \
XX(HMT_THREE_SECTION, EVENT_I_AM_3_SECTION_MACHINE) \ XX(HMT_THREE_SECTION, EVENT_I_AM_3_SECTION) \
XX(HMT_IOT, EVENT_I_AM_IOT_MACHINE) \ XX(HMT_IOT, EVENT_I_AM_IOT) \
XX(HMT_GPRS_PHONE, EVENT_I_AM_GPRS_PHONE) \ XX(HMT_GPRS_PHONE, EVENT_I_AM_GPRS_PHONE) \
XX(HMT_NB, EVENT_I_AM_NB_MACHINE) \ XX(HMT_NB, EVENT_I_AM_NB) \
XX(HMT_WIFI2, EVENT_I_AM_WIFI2_MACHINE) XX(HMT_WIFI2, EVENT_I_AM_WIFI2)
// 主机类型 // 主机类型
typedef enum hb_machine_type_t { typedef enum hb_machine_type_t {
...@@ -110,7 +109,7 @@ typedef enum hb_machine_type_t { ...@@ -110,7 +109,7 @@ typedef enum hb_machine_type_t {
XX(HZP_DURESS, EVENT_DURESS) \ XX(HZP_DURESS, EVENT_DURESS) \
XX(HZP_GAS, EVENT_GAS) \ XX(HZP_GAS, EVENT_GAS) \
XX(HZP_WATER, EVENT_WATER) \ XX(HZP_WATER, EVENT_WATER) \
XX(HZP_DOOR_RING, EVENT_DOORRINGING) XX(HZP_DOOR_RING, EVENT_DOOR_RING)
// 防区属性 // 防区属性
typedef enum hb_zone_property_t { typedef enum hb_zone_property_t {
......
...@@ -43,7 +43,7 @@ namespace CSharpDemo ...@@ -43,7 +43,7 @@ namespace CSharpDemo
{ {
Console.WriteLine("test pack"); Console.WriteLine("test pack");
byte[] buff = new byte[1024]; byte[] buff = new byte[1024];
uint len = libademco.ademco_make_hb_packet(buff, 1024, 1, "861234567890", 666666, ademco_event_t.EVENT_ARM, 0, 0, null); uint len = libademco.ademco_make_hb_packet(buff, 1024, 1, "861234567890", 666666, ademco_event_t.EVENT_ARM_AWAY, 0, 0, null);
Debug.Assert(len > 0); Debug.Assert(len > 0);
Console.WriteLine("len={0:D}", len); Console.WriteLine("len={0:D}", len);
libademco.ademco_print(buff, len); libademco.ademco_print(buff, len);
...@@ -58,7 +58,7 @@ namespace CSharpDemo ...@@ -58,7 +58,7 @@ namespace CSharpDemo
Debug.Assert(pkt.seq == 1); Debug.Assert(pkt.seq == 1);
Debug.Assert(pkt.acct == "861234567890"); Debug.Assert(pkt.acct == "861234567890");
Debug.Assert(pkt.data.ademco_id == 666666); Debug.Assert(pkt.data.ademco_id == 666666);
Debug.Assert(pkt.data.ademco_event == ademco_event_t.EVENT_ARM); Debug.Assert(pkt.data.ademco_event == ademco_event_t.EVENT_ARM_AWAY);
Debug.Assert(pkt.data.gg == 0); Debug.Assert(pkt.data.gg == 0);
Debug.Assert(pkt.data.zone == 0); Debug.Assert(pkt.data.zone == 0);
} }
...@@ -68,7 +68,7 @@ namespace CSharpDemo ...@@ -68,7 +68,7 @@ namespace CSharpDemo
{ {
Console.WriteLine("test pack, buff not enough"); Console.WriteLine("test pack, buff not enough");
Byte[] buff = new Byte[10]; Byte[] buff = new Byte[10];
uint len = libademco.ademco_make_hb_packet(buff, 10, 1, "861234567890", 666666, ademco_event_t.EVENT_ARM, 0, 0, null); uint len = libademco.ademco_make_hb_packet(buff, 10, 1, "861234567890", 666666, ademco_event_t.EVENT_ARM_AWAY, 0, 0, null);
Debug.Assert(len == 0); Debug.Assert(len == 0);
} }
...@@ -215,7 +215,7 @@ namespace CSharpDemo ...@@ -215,7 +215,7 @@ namespace CSharpDemo
static void sendArm(NetworkStream stream, ushort seq, string acct, uint ademco_id) static void sendArm(NetworkStream stream, ushort seq, string acct, uint ademco_id)
{ {
byte[] buff = new byte[1024]; byte[] buff = new byte[1024];
uint len = libademco.ademco_make_hb_packet(buff, 1024, seq, acct, ademco_id, ademco_event_t.EVENT_ARM, 0, 0, null); uint len = libademco.ademco_make_hb_packet(buff, 1024, seq, acct, ademco_id, ademco_event_t.EVENT_ARM_AWAY, 0, 0, null);
Console.Write("S:"); Console.Write("S:");
libademco.ademco_print(buff, len); libademco.ademco_print(buff, len);
stream.Write(buff, 0, (int)len); stream.Write(buff, 0, (int)len);
......
...@@ -103,7 +103,7 @@ public class JavaDemo { ...@@ -103,7 +103,7 @@ public class JavaDemo {
System.out.println("testing pack..."); System.out.println("testing pack...");
System.out.println("using seq=1234, acct=861234567890, ademco_id=666666, event=3400, zone=0, gg=0"); System.out.println("using seq=1234, acct=861234567890, ademco_id=666666, event=3400, zone=0, gg=0");
ademco_packet_t pkt = new ademco_packet_t(); ademco_packet_t pkt = new ademco_packet_t();
libademco.ademco_make_hb_packet2(pkt, 1234, "861234567890", 666666l, ademco_event_t.EVENT_ARM, (short)0, 0, null); libademco.ademco_make_hb_packet2(pkt, 1234, "861234567890", 666666l, ademco_event_t.EVENT_ARM_AWAY, (short)0, 0, null);
System.out.println("data=" + printable_bytes(pkt.getRaw(), pkt.getRaw_len())); System.out.println("data=" + printable_bytes(pkt.getRaw(), pkt.getRaw_len()));
} }
...@@ -116,7 +116,7 @@ public class JavaDemo { ...@@ -116,7 +116,7 @@ public class JavaDemo {
libademco.ademco_make_xdata(xdata, ademco_xdata_length_format_t.ADEMCO_XDATA_LENGTH_FMT_TWO_HEX, libademco.ademco_make_xdata(xdata, ademco_xdata_length_format_t.ADEMCO_XDATA_LENGTH_FMT_TWO_HEX,
ademco_xdata_transform_t.ADEMCO_XDATA_TRANSFORM_AS_IS, "123456".getBytes(), 6); ademco_xdata_transform_t.ADEMCO_XDATA_TRANSFORM_AS_IS, "123456".getBytes(), 6);
ademco_packet_t pkt = new ademco_packet_t(); ademco_packet_t pkt = new ademco_packet_t();
libademco.ademco_make_hb_packet2(pkt, 1234, "861234567890", 666666l, ademco_event_t.EVENT_ARM, (short)0, 0, xdata); libademco.ademco_make_hb_packet2(pkt, 1234, "861234567890", 666666l, ademco_event_t.EVENT_ARM_AWAY, (short)0, 0, xdata);
System.out.println("data=" + printable_bytes(pkt.getRaw(), pkt.getRaw_len())); System.out.println("data=" + printable_bytes(pkt.getRaw(), pkt.getRaw_len()));
} }
...@@ -135,7 +135,7 @@ public class JavaDemo { ...@@ -135,7 +135,7 @@ public class JavaDemo {
libademco.ademco_make_xdata(xdata, ademco_xdata_length_format_t.ADEMCO_XDATA_LENGTH_FMT_TWO_HEX, libademco.ademco_make_xdata(xdata, ademco_xdata_length_format_t.ADEMCO_XDATA_LENGTH_FMT_TWO_HEX,
ademco_xdata_transform_t.ADEMCO_XDATA_TRANSFORM_AS_IS, xdatacontent, 5); ademco_xdata_transform_t.ADEMCO_XDATA_TRANSFORM_AS_IS, xdatacontent, 5);
ademco_packet_t pkt = new ademco_packet_t(); ademco_packet_t pkt = new ademco_packet_t();
libademco.ademco_make_hb_packet2(pkt, 1234, "861234567890", 666666l, ademco_event_t.EVENT_ARM, (short)0, 0, xdata); libademco.ademco_make_hb_packet2(pkt, 1234, "861234567890", 666666l, ademco_event_t.EVENT_ARM_AWAY, (short)0, 0, xdata);
System.out.println("data=" + printable_bytes(pkt.getRaw(), pkt.getRaw_len())); System.out.println("data=" + printable_bytes(pkt.getRaw(), pkt.getRaw_len()));
} }
...@@ -291,7 +291,7 @@ public class JavaDemo { ...@@ -291,7 +291,7 @@ public class JavaDemo {
} }
private void arm() throws IOException { private void arm() throws IOException {
libademco.ademco_make_hb_packet2(pkt, nextSeq(), acct, ademco_id, ademco_event_t.EVENT_ARM, (short)0, 0, null); libademco.ademco_make_hb_packet2(pkt, nextSeq(), acct, ademco_id, ademco_event_t.EVENT_ARM_AWAY, (short)0, 0, null);
channel.write(ByteBuffer.wrap(getRawWithLen())); channel.write(ByteBuffer.wrap(getRawWithLen()));
System.out.println(id() + " S:" + printable_bytes(pkt.getRaw(), pkt.getRaw_len())); System.out.println(id() + " S:" + printable_bytes(pkt.getRaw(), pkt.getRaw_len()));
} }
......
...@@ -30,7 +30,7 @@ function test_parse() { ...@@ -30,7 +30,7 @@ function test_parse() {
function test_pack() { function test_pack() {
console.log("test pack"); console.log("test pack");
var pkt = new libademco.ademco_packet_t(); var pkt = new libademco.ademco_packet_t();
libademco.ademco_make_hb_packet2(pkt, 1, "861234567890", 666666, libademco.EVENT_ARM, 0, 0, null); libademco.ademco_make_hb_packet2(pkt, 1, "861234567890", 666666, libademco.EVENT_ARM_AWAY, 0, 0, null);
console.log("len=%d", pkt.raw_len); console.log("len=%d", pkt.raw_len);
libademco.ademco_print(pkt.raw, pkt.raw_len); libademco.ademco_print(pkt.raw, pkt.raw_len);
...@@ -44,7 +44,7 @@ function test_pack() { ...@@ -44,7 +44,7 @@ function test_pack() {
assert.strictEqual(pkt2.seq, 1); assert.strictEqual(pkt2.seq, 1);
assert.strictEqual(pkt2.acct, "861234567890"); assert.strictEqual(pkt2.acct, "861234567890");
assert.strictEqual(pkt2.data.ademco_id, 666666); assert.strictEqual(pkt2.data.ademco_id, 666666);
assert.strictEqual(pkt2.data.ademco_event, libademco.EVENT_ARM); assert.strictEqual(pkt2.data.ademco_event, libademco.EVENT_ARM_AWAY);
assert.strictEqual(pkt2.data.gg, 0); assert.strictEqual(pkt2.data.gg, 0);
assert.strictEqual(pkt2.data.zone, 0); assert.strictEqual(pkt2.data.zone, 0);
} }
......
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