Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in / Register
Toggle navigation
A
ademco_hb
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
captainwong
ademco_hb
Commits
7a53b981
Commit
7a53b981
authored
Oct 09, 2021
by
captainwong
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
工程主机串口通信协议.md working...
parent
e237ecd8
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
115 additions
and
15 deletions
+115
-15
工程主机串口通信协议.md
docs/工程主机串口通信协议.md
+42
-1
gen_event_md.cpp
examples/gen_event_md/gen_event_md.cpp
+49
-14
hb_detail.h
include/hb_detail.h
+24
-0
No files found.
docs/工程主机串口通信协议.md
View file @
7a53b981
# 工程主机串口通信协议
## EB B1 命令内报警码与安定宝事件码对照表
9600, N, 8, 1
SUM = DATA(N) = DATA(0) + DATA(1) + ... + DATA(N-1)
## EB AB addr data sum
*
PC到主机,按键
*
addr: PC模拟键盘地址,1~4,暂时固定为3
*
data: 按键码
|按键码|按键|
|-----|----|
|00|无按键动作|
|01|1|
|02|2|
|03|3|
|04|4|
|05|5|
|06|6|
|07|7|
|08|8|
|09|9|
|0A|0|
|0B|
*
|
|0C|#|
|0D|布防|
|0E|半布防|
|0F|撤防|
|10|紧急报警|
|11|录音|
|12|放音|
|13|停止|
## EB B1 data0 data1 data2 code data4 sum
*
data0: 命令字总字长,固定为8
*
data1: 防区号高位
*
data2: 防区号低位
*
data4: 00 表示data1与data2为主机直属防区号,01~F0 表示data1与data2为分机防区号(已废弃),EE 表示分机自身状态(已废弃 )
*
code: 报警码
*
报警码与安定宝事件码对照表
|报警码|安定宝事件码|含义|
|------|----------|----|
...
...
examples/gen_event_md/gen_event_md.cpp
View file @
7a53b981
...
...
@@ -3,6 +3,7 @@
#include "../../include/ademco_event.h"
#define ENABLE_COMMON_MACHINE_TYPE_TO_STRING
#define ENABLE_COMMON_ZONE_PROPERTY_TO_STRING
#define ENABLE_G250_KEY_TO_STRING
#include "../../include/hb_detail.h"
#include "../../include/hb_helper.h"
#include <jlib/win32/UnicodeTool.h>
...
...
@@ -371,12 +372,39 @@ void print_available_zone_props()
void
print_g250_alarm_codes
()
{
printf
(
"## EB B1 命令内报警码与安定宝事件码对照表
\n\n
"
);
using
namespace
g250
;
printf
(
"# 工程主机串口通信协议
\n\n
"
);
printf
(
"9600, N, 8, 1
\n\n
"
);
printf
(
"SUM = DATA(N) = DATA(0) + DATA(1) + ... + DATA(N-1)
\n\n
"
);
// 按键码
printf
(
"
\n\n
## EB AB addr data sum
\n
"
);
printf
(
"* PC到主机,按键
\n
"
);
printf
(
"* addr: PC模拟键盘地址,1~4,暂时固定为3
\n
"
);
printf
(
"* data: 按键码
\n\n
"
);
printf
(
"|按键码|按键|
\n
"
);
printf
(
"|-----|----|
\n
"
);
for
(
Key
k
=
Key
::
Key_NULL
;
k
<=
Key
::
Key_STOP_ALARM
;
k
=
Key
(
k
+
1
))
{
auto
s
=
keyToString
(
k
);
if
(
s
)
{
printf
(
"|%02X|%s|
\n
"
,
k
,
jlib
::
win32
::
utf16_to_mbcs
(
s
).
c_str
());
}
}
// EB B1 报警码
printf
(
"
\n\n
## EB B1 data0 data1 data2 code data4 sum
\n
"
);
printf
(
"* data0: 命令字总字长,固定为8
\n
"
);
printf
(
"* data1: 防区号高位
\n
"
);
printf
(
"* data2: 防区号低位
\n
"
);
printf
(
"* data4: 00 表示data1与data2为主机直属防区号,01~F0 表示data1与data2为分机防区号(已废弃),EE 表示分机自身状态(已废弃)
\n
"
);
printf
(
"* code: 报警码
\n
"
);
printf
(
"* 报警码与安定宝事件码对照表
\n\n
"
);
printf
(
"|报警码|安定宝事件码|含义|
\n
"
);
printf
(
"|------|----------|----|
\n
"
);
using
namespace
g250
;
static
Char
codes
[]
=
{
g250
::
MachineStatus
::
Arm
,
...
...
@@ -415,22 +443,29 @@ void print_g250_alarm_codes()
int
main
()
{
printf
(
"### 主机状态
\n\n
"
);
printEvents
(
statusEvents
,
_countof
(
statusEvents
));
if
(
0
)
{
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
(
alarmEvents
,
_countof
(
alarm
Events
));
printf
(
"### *恒博私有事件码*
\n\n
"
);
printEvents
(
privateEvents
,
_countof
(
private
Events
));
printf
(
"### 防区异常
\n\n
"
);
printEvents
(
excepEvents
,
_countof
(
excepEvents
)
);
print_machineTypes
(
);
print_imgs
(
);
printf
(
"### *恒博私有事件码*
\n\n
"
);
printEvents
(
privateEvents
,
_countof
(
privateEvents
));
print_available_zone_props
();
print_machineTypes
();
print_imgs
();
print_available_zone_props
();
}
else
{
print_g250_alarm_codes
();
}
print_g250_alarm_codes
();
}
\ No newline at end of file
include/hb_detail.h
View file @
7a53b981
...
...
@@ -1283,6 +1283,30 @@ inline char keyToPrintableChar(Key key) {
}
}
#ifdef ENABLE_G250_KEY_TO_STRING
inline
const
wchar_t
*
keyToString
(
Key
key
)
{
static
wchar_t
s
[
2
]
=
{
L'\0'
};
switch
(
key
)
{
case
Key_1
:
case
Key_2
:
case
Key_3
:
case
Key_4
:
case
Key_5
:
case
Key_6
:
case
Key_7
:
case
Key_8
:
case
Key_9
:
s
[
0
]
=
static_cast
<
wchar_t
>
(
key
+
L'0'
);
return
s
;
case
Key_0
:
return
L"0"
;
case
Key_ASTERISK
:
return
L"*"
;
case
Key_SHARP
:
return
L"#"
;
case
Key_ARM
:
return
L"布防"
;
case
Key_HALF_ARM
:
return
L"半布防"
;
case
Key_DISARM
:
return
L"撤防"
;
case
Key_EMERGENCY
:
return
L"紧急报警"
;
case
Key_RECORD_SOUND
:
return
L"录音"
;
case
Key_PLAY_SOUND
:
return
L"放音"
;
case
Key_STOP_SOUND
:
return
L"停止"
;
case
Key_NULL
:
return
L"无按键动作"
;
default:
return
nullptr
;
}
}
#endif
//! PC的模拟键盘序号为3
static
constexpr
Char
PC_KEYBOARD_IDX
=
3
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment