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
8770892b
Commit
8770892b
authored
Nov 17, 2023
by
captainwong
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
signal strength range
parent
2c06df2e
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
25 additions
and
16 deletions
+25
-16
ademco.c
ademco.c
+8
-3
ademco.h
ademco.h
+7
-3
clean.sh
tools/clean.sh
+10
-10
No files found.
ademco.c
View file @
8770892b
...
...
@@ -52,12 +52,17 @@ void ademcoPrint(const ademco_char_t* p, size_t len) {
printf
(
"
\n
"
);
}
uint8_t
ademcoEncodeSignalStrength
(
int
strength
)
{
uint8_t
ademcoEncodeSignalStrength
(
uint8_t
strength
)
{
if
(
strength
>
ADEMCO_SIGNAL_STRENGTH_MAX
)
strength
=
ADEMCO_SIGNAL_STRENGTH_MAX
;
return
((
strength
/
10
)
<<
4
)
|
(
strength
%
10
);
}
int
ademcoDecodeSignalStrength
(
uint8_t
code
)
{
return
((
code
>>
4
)
&
0x0F
)
*
10
+
(
code
&
0x0F
);
uint8_t
ademcoDecodeSignalStrength
(
uint8_t
code
)
{
uint8_t
strength
=
((
code
>>
4
)
&
0x0F
)
*
10
+
(
code
&
0x0F
);
if
(
strength
>
ADEMCO_SIGNAL_STRENGTH_MAX
)
strength
=
ADEMCO_SIGNAL_STRENGTH_MAX
;
return
strength
;
}
int
ademcoIsValidAccount
(
const
char
*
acct
)
{
...
...
ademco.h
View file @
8770892b
...
...
@@ -89,6 +89,10 @@ static inline int ademcoIsValidZoneStrict(AdemcoZone zone) {
#define ADEMCO_GG_MAX 99
#define ADEMCO_GG_SENTINEL 100
//! 信号强度范围 [0, 31]
#define ADEMCO_SIGNAL_STRENGTH_MIN 0
#define ADEMCO_SIGNAL_STRENGTH_MAX 31
// Ademco events
typedef
enum
AdemcoEvent
{
EVENT_INVALID_EVENT
=
0
,
...
...
@@ -182,7 +186,7 @@ typedef enum AdemcoEvent {
EVENT_SIM_IS_NOT_IOT_CARD
=
3756
,
// 主机SIM卡为非物联卡,启用主机侧电话设置
EVENT_WHAT_IS_YOUR_TYPE
=
1798
,
// 索要主机类型
EVENT_SIGNAL_STRENGTH_CHANGED
=
1799
,
// 主机信号强度变化
EVENT_SIGNAL_STRENGTH_CHANGED
=
1799
,
// 主机信号强度变化
,强度值编码后以 xdata 传输
// 2021年1月24日17:06:55修改,对标丛文3B0 3B2
EVENT_OFFLINE
=
1944
,
// 主机断线
...
...
@@ -361,8 +365,8 @@ typedef struct AdemcoPacket {
//! print as HEX
ADEMCO_EXPORT_SYMBOL
void
ademcoPrint
(
const
ademco_char_t
*
buff
,
size_t
len
);
ADEMCO_EXPORT_SYMBOL
uint8_t
ademcoEncodeSignalStrength
(
in
t
strength
);
ADEMCO_EXPORT_SYMBOL
in
t
ademcoDecodeSignalStrength
(
uint8_t
code
);
ADEMCO_EXPORT_SYMBOL
uint8_t
ademcoEncodeSignalStrength
(
uint8_
t
strength
);
ADEMCO_EXPORT_SYMBOL
uint8_
t
ademcoDecodeSignalStrength
(
uint8_t
code
);
//////////////////////// AdemcoEvent functions ////////////////////////
//! 是否合法主机账号
...
...
tools/clean.sh
View file @
8770892b
#/bin/bash
rm
-rf
linux_java
rm
-rf
mac_java
rm
-rf
win_csharp
rm
-rf
win_java
rm
-rf
server_demo
rm
-rf
win_node
cd
../swig
rm
-rf
*
.exp
*
.lib
*
.dll
*
.exe
*
.obj
*
.class com/
#/bin/bash
rm
-rf
linux_java
rm
-rf
mac_java
rm
-rf
win_csharp
rm
-rf
win_java
rm
-rf
server_demo
rm
-rf
win_node
cd
../swig
rm
-rf
*
.exp
*
.lib
*
.dll
*
.exe
*
.obj
*
.class com/
build/
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