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
b047506b
Commit
b047506b
authored
Dec 13, 2023
by
captainwong
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
1.3.1
parent
4e780248
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
23 additions
and
19 deletions
+23
-19
CHANGELOG.md
CHANGELOG.md
+5
-0
ademco.c
ademco.c
+5
-3
ademco.h
ademco.h
+6
-9
ademco_version.h
ademco_version.h
+1
-1
hb_com.c
hb_com.c
+6
-6
No files found.
CHANGELOG.md
View file @
b047506b
# Ademco Change Log
## 1.3.1
-
compile with warning level 4
-
change
`static inline`
function to micro
## 1.3.0
-
add
`file`
for parse error
...
...
ademco.c
View file @
b047506b
...
...
@@ -616,7 +616,9 @@ int ademcoMakeXData(AdemcoXDataSegment* xdata,
}
int
isAdemcoPacketId
(
const
char
*
standard
,
const
char
*
id
,
size_t
len
)
{
return
strncmp
(
standard
,
id
,
strlen
(
standard
))
==
0
;
size_t
standard_len
=
strlen
(
standard
);
len
=
standard_len
<
len
?
standard_len
:
len
;
return
strncmp
(
standard
,
id
,
len
)
==
0
;
}
static
const
char
*
const
ids
[
AID_COUNT
]
=
{
...
...
@@ -1003,7 +1005,7 @@ AdemcoParseResult ademcoPacketParse(const ademco_char_t* buff, size_t len,
// crc
crc
=
0
;
for
(
const
char
*
q
=
p
;
p
-
q
<
4
;
p
++
)
{
for
(
q
=
p
;
p
-
q
<
4
;
p
++
)
{
uint8_t
h
=
char2hex
(
*
p
);
if
(
h
==
0xFF
)
{
ADEMCO_FILL_PARSE_ERROR
(
err
,
p
-
buff
,
"crc contains non-hex characters"
);
...
...
@@ -1014,7 +1016,7 @@ AdemcoParseResult ademcoPacketParse(const ademco_char_t* buff, size_t len,
// len
pkt
->
len
=
0
;
for
(
const
char
*
q
=
p
;
p
-
q
<
4
;
p
++
)
{
for
(
q
=
p
;
p
-
q
<
4
;
p
++
)
{
uint8_t
h
=
char2hex
(
*
p
);
if
(
h
==
0xFF
)
{
ADEMCO_FILL_PARSE_ERROR
(
err
,
p
-
buff
,
"len contains non-hex characters"
);
...
...
ademco.h
View file @
b047506b
...
...
@@ -36,9 +36,8 @@ typedef uint32_t AdemcoZone;
#define ADEMCO_ID_MIN 1
#define ADEMCO_ID_MAX 999999 // 兼容性考虑,最大安定宝 ID 为 0x0F423F
#define ADEMCO_ID_SENTINEL (ADEMCO_ID_MAX + 1)
static
inline
int
ademcoIsValidAdemcoId
(
AdemcoId
ademcoId
)
{
return
ADEMCO_ID_MIN
<=
ademcoId
&&
ademcoId
<=
ADEMCO_ID_MAX
;
}
#define ademcoIsValidAdemcoId(ademcoId) \
((ADEMCO_ID_MIN <= (ademcoId)) && ((ademcoId) <= ADEMCO_ID_MAX))
// 防区号为0时表示主机自身
#define ADEMCO_ZONE_FOR_MACHINE_SELF 0
...
...
@@ -49,14 +48,12 @@ static inline int ademcoIsValidAdemcoId(AdemcoId ademcoId) {
#define ADEMCO_ZONE_SENTINEL (ADEMCO_ZONE_MAX + 1)
// 对任何主机类型,防区号是否合法(可以包含0防区)
static
inline
int
ademcoIsValidZone
(
AdemcoZone
zone
)
{
return
ADEMCO_ZONE_FOR_MACHINE_SELF
<=
zone
&&
zone
<=
ADEMCO_ZONE_MAX
;
}
#define ademcoIsValidZone(zone) \
((ADEMCO_ZONE_FOR_MACHINE_SELF <= (zone)) && ((zone) <= ADEMCO_ZONE_MAX))
// 对任何主机类型,防区号是否合法(不可以包含0防区)
static
inline
int
ademcoIsValidZoneStrict
(
AdemcoZone
zone
)
{
return
ADEMCO_ZONE_MIN
<=
zone
&&
zone
<=
ADEMCO_ZONE_MAX
;
}
#define ademcoIsValidZoneStrict(zone) \
((ADEMCO_ZONE_MIN <= (zone)) && ((zone) <= ADEMCO_ZONE_MAX))
#define ADEMCO_GG_MIN 0
#define ADEMCO_GG_MAX 99
...
...
ademco_version.h
View file @
b047506b
...
...
@@ -8,7 +8,7 @@
#define ADEMCO_VERSION_MAJOR 1
#define ADEMCO_VERSION_MINOR 3
#define ADEMCO_VERSION_PATCH
0
#define ADEMCO_VERSION_PATCH
1
#define ADEMCO_VERSION_IS_RELEASE 1
#define ADEMCO_VERSION_SUFFIX ""
...
...
hb_com.c
View file @
b047506b
...
...
@@ -970,7 +970,7 @@ void hbComMakeRespA2_getMachineZones(HbComData* data,
*
p
++
=
zones
[
i
]
&
0xFF
;
*
p
++
=
props
[
i
];
}
*
p
++
=
(
count
>
0
)
?
p1
:
HbComResp_A2_p1_nomore
;
*
p
++
=
(
count
>
0
)
?
(
uint8_t
)
p1
:
(
uint8_t
)
HbComResp_A2_p1_nomore
;
data
->
len
=
(
++
p
-
data
->
data
)
&
0xFF
;
hbSum
(
data
->
data
,
data
->
len
);
}
...
...
@@ -1042,7 +1042,7 @@ void hbComMakeRespAD_getMachineZoneLostConfig(HbComData* data,
*
p
++
=
zones
[
i
]
&
0xFF
;
}
}
*
p
++
=
(
count
>
0
)
?
p2
:
HbComResp_AD_p2_nomore
;
*
p
++
=
(
count
>
0
)
?
(
uint8_t
)
p2
:
(
uint8_t
)
HbComResp_AD_p2_nomore
;
data
->
len
=
(
++
p
-
data
->
data
)
&
0xFF
;
hbSum
(
data
->
data
,
data
->
len
);
}
...
...
@@ -1063,10 +1063,10 @@ void hbComMakeRespB1_get3SectionMachineStatus(HbComData* data,
HbMachineStatus
statusSec2
,
HbMachineStatus
statusSec3
)
{
memcpy
(
data
->
data
,
HbComResp_B1_head
,
6
);
data
->
data
[
6
]
=
(
statusMachine
<<
6
)
|
(
statusSec1
<<
4
)
|
(
statusSec2
<<
2
)
|
(
statusSec3
);
data
->
data
[
6
]
=
(
(
uint8_t
)
statusMachine
<<
6
)
|
(
(
uint8_t
)
statusSec1
<<
4
)
|
(
(
uint8_t
)
statusSec2
<<
2
)
|
(
(
uint8_t
)
statusSec3
);
data
->
len
=
HbComResp_B1_len
;
hbSum
(
data
->
data
,
data
->
len
);
}
...
...
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