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
270875eb
Commit
270875eb
authored
Nov 03, 2020
by
captainwong
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
move defs to ademco_event.h
parent
1a8faf1d
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
38 additions
and
38 deletions
+38
-38
ademco_event.h
include/ademco_event.h
+38
-0
ademco_packet.h
include/ademco_packet.h
+0
-38
No files found.
include/ademco_event.h
View file @
270875eb
...
...
@@ -18,6 +18,44 @@
namespace
ademco
{
typedef
uint32_t
AdemcoId
;
typedef
uint8_t
AdemcoGG
;
typedef
uint32_t
AdemcoZone
;
//! 安定宝ID范围
constexpr
AdemcoId
AdemcoIdMin
=
1
;
constexpr
AdemcoId
AdemcoIdMax
=
999999
;
// 兼容性考虑,最大安定宝 ID 为 0x0F423F
constexpr
AdemcoId
AdemcoIdSentinel
=
AdemcoIdMax
+
1
;
inline
bool
isValidAdemcoId
(
AdemcoId
ademcoId
)
{
return
AdemcoIdMin
<=
ademcoId
&&
ademcoId
<=
AdemcoIdMax
;
}
//! 防区号为0时表示主机自身
constexpr
AdemcoZone
Zone4MachineSelf
=
0
;
//! 主机防区号范围
constexpr
AdemcoZone
ZoneMin
=
1
;
//! 对任何主机类型,最大的防区号
constexpr
AdemcoZone
ZoneMax
=
999
;
constexpr
AdemcoZone
ZoneSentinel
=
ZoneMax
+
1
;
//! 对任何主机类型,防区号是否合法(可以包含0防区)
inline
bool
isValidZone
(
AdemcoZone
zone
)
{
return
Zone4MachineSelf
<=
zone
&&
zone
<
ZoneSentinel
;
}
//! 对任何主机类型,防区号是否合法(不可以包含0防区)
inline
bool
isValidZoneStrict
(
AdemcoZone
zone
)
{
return
ZoneMin
<=
zone
&&
zone
<
ZoneSentinel
;
}
//! 三防区主机状态GG范围 1~3
constexpr
AdemcoGG
GGMin4ThreeSectionMachine
=
1
;
constexpr
AdemcoGG
GGMax4ThreeSectionMachine
=
3
;
//! 是否合法的三防区主机状态GG
inline
bool
isValidGG4ThreeSectionMachineStatus
(
AdemcoGG
gg
)
{
return
GGMin4ThreeSectionMachine
<=
gg
&&
gg
<=
GGMax4ThreeSectionMachine
;
}
//! 安定宝事件代码
enum
ADEMCO_EVENT
:
uint32_t
{
...
...
include/ademco_packet.h
View file @
270875eb
...
...
@@ -22,44 +22,6 @@ enum class ParseResult
RESULT_DATA_ERROR
,
};
typedef
uint32_t
AdemcoId
;
typedef
uint8_t
AdemcoGG
;
typedef
uint32_t
AdemcoZone
;
//! 安定宝ID范围
constexpr
AdemcoId
AdemcoIdMin
=
1
;
constexpr
AdemcoId
AdemcoIdMax
=
999999
;
// 兼容性考虑,最大安定宝 ID 为 0x0F423F
constexpr
AdemcoId
AdemcoIdSentinel
=
AdemcoIdMax
+
1
;
inline
bool
isValidAdemcoId
(
AdemcoId
ademcoId
)
{
return
AdemcoIdMin
<=
ademcoId
&&
ademcoId
<=
AdemcoIdMax
;
}
//! 防区号为0时表示主机自身
constexpr
AdemcoZone
Zone4MachineSelf
=
0
;
//! 主机防区号范围
constexpr
AdemcoZone
ZoneMin
=
1
;
//! 对任何主机类型,最大的防区号
constexpr
AdemcoZone
ZoneMax
=
999
;
constexpr
AdemcoZone
ZoneSentinel
=
ZoneMax
+
1
;
//! 对任何主机类型,防区号是否合法(可以包含0防区)
inline
bool
isValidZone
(
AdemcoZone
zone
)
{
return
Zone4MachineSelf
<=
zone
&&
zone
<
ZoneSentinel
;
}
//! 对任何主机类型,防区号是否合法(不可以包含0防区)
inline
bool
isValidZoneStrict
(
AdemcoZone
zone
)
{
return
ZoneMin
<=
zone
&&
zone
<
ZoneSentinel
;
}
//! 三防区主机状态GG范围 1~3
constexpr
AdemcoGG
GGMin4ThreeSectionMachine
=
1
;
constexpr
AdemcoGG
GGMax4ThreeSectionMachine
=
3
;
//! 是否合法的三防区主机状态GG
inline
bool
isValidGG4ThreeSectionMachineStatus
(
AdemcoGG
gg
)
{
return
GGMin4ThreeSectionMachine
<=
gg
&&
gg
<=
GGMax4ThreeSectionMachine
;
}
//! 安定宝数据包 data 段
struct
AdemcoData
{
...
...
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