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
1e6316aa
Commit
1e6316aa
authored
Sep 16, 2020
by
captainwong
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix Tamper & Lost
parent
425624e1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
6 deletions
+6
-6
server_demo_libevent.cpp
examples/server_demo_libevent/server_demo_libevent.cpp
+6
-6
No files found.
examples/server_demo_libevent/server_demo_libevent.cpp
View file @
1e6316aa
...
...
@@ -87,7 +87,7 @@ enum class QueryStage {
struct
ZonePropertyAndLostConfig
{
ZoneProperty
prop
=
ZoneProperty
::
InvalidZoneProperty
;
bool
tamper
_enabled
=
false
;
// 失联开关
bool
lost_report
_enabled
=
false
;
// 失联开关
};
struct
Client
{
...
...
@@ -204,7 +204,7 @@ void handle_com_passthrough(ThreadContext* context, Client& client, evbuffer* ou
for
(
const
auto
&
zp
:
zps
)
{
ZonePropertyAndLostConfig
zplc
;
zplc
.
prop
=
zp
.
prop
;
zplc
.
tamper
_enabled
=
false
;
zplc
.
lost_report
_enabled
=
false
;
client
.
zones
[
zp
.
zone
]
=
zplc
;
snprintf
(
buf
,
sizeof
(
buf
),
getZoneFormatString
(
machineTypeFromAdemcoEvent
((
ADEMCO_EVENT
)
client
.
type
)),
zp
.
zone
);
printf
(
"
\t\t
Zone:"
);
...
...
@@ -286,11 +286,11 @@ 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
)
{
client
.
zones
[
zone
].
tamper
_enabled
=
true
;
client
.
zones
[
zone
].
lost_report
_enabled
=
true
;
snprintf
(
buf
,
sizeof
(
buf
),
getZoneFormatString
(
machineTypeFromAdemcoEvent
((
ADEMCO_EVENT
)
client
.
type
)),
zone
);
printf
(
"
\t\t
Zone:"
);
printf
(
"%s"
,
buf
);
printf
(
"
Tamper
Enabled: true
\n
"
);
printf
(
"
Lost Report
Enabled: true
\n
"
);
}
XDataPtr
xdata
;
if
(
hasMore
)
{
// 继续索要剩余防区
...
...
@@ -994,9 +994,9 @@ void Client::printInfo() const
snprintf
(
buf
,
sizeof
(
buf
),
getZoneFormatString
(
machineTypeFromAdemcoEvent
((
ADEMCO_EVENT
)
type
)),
zp
.
first
);
printf
(
" Zone:"
);
printf
(
"%s"
,
buf
);
printf
(
" Prop:0x%02X %s
\t
Tamper
Enabled:%s
\n
"
,
printf
(
" Prop:0x%02X %s
\t
Lost Report
Enabled:%s
\n
"
,
zp
.
second
.
prop
,
zonePropertyToStringEn
(
zp
.
second
.
prop
),
zp
.
second
.
tamper
_enabled
?
"true"
:
"false"
);
zp
.
second
.
lost_report
_enabled
?
"true"
:
"false"
);
}
for
(
int
i
=
0
;
i
<
2
;
i
++
)
{
if
(
com
::
isValidMachineTimer
(
timer
.
timer
[
i
]))
{
...
...
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