Commit 431daf57 authored by captainwong's avatar captainwong

1.5.1

parent eb88a9fd
# Ademco Change Log
## 1.5.0
- `HbComResp_A2_Iter.com` changed to pointer
- update parser for `timestamp`
- add `AdemcoControlSource` defs
## 1.4.0
- `hb_com reqeust, response` update
## 1.3.1
- compile with warning level 4
- change `static inline` function to micro
## 1.3.0
- add `file` for parse error
- fix `struct tm not initilized` on parse
- fix parsing pointer on parse timestamp failed
## 1.2.0
- add config
- add `offset` for parse error
- refactor parser
## 1.1.0
- ADEMCO_PACKET_ACCT_MAX_LEN changed from 64 to 18
- add ADEMCO_PACKET_ACCT_MAX_LEN
- hb_com 读写主机账号命令
## 1.0.0
- initial version
# Ademco Change Log
## 1.5.1
- account minimum length is 6
- `ademcoIsValidAccount` check length
## 1.5.0
- `HbComResp_A2_Iter.com` changed to pointer
- update parser for `timestamp`
- add `AdemcoControlSource` defs
## 1.4.0
- `hb_com reqeust, response` update
## 1.3.1
- compile with warning level 4
- change `static inline` function to micro
## 1.3.0
- add `file` for parse error
- fix `struct tm not initilized` on parse
- fix parsing pointer on parse timestamp failed
## 1.2.0
- add config
- add `offset` for parse error
- refactor parser
## 1.1.0
- ADEMCO_PACKET_ACCT_MAX_LEN changed from 64 to 18
- add ADEMCO_PACKET_ACCT_MAX_LEN
- hb_com 读写主机账号命令
## 1.0.0
- initial version
......@@ -88,11 +88,21 @@ uint8_t ademcoDecodeSignalStrength(uint8_t code) {
}
int ademcoIsValidAccount(const char* acct) {
while (*acct) {
if (!isxdigit(*acct++))
size_t len = 0;
int ishex = 0;
while (*acct && len < ADEMCO_PACKET_ACCT_MAX_LEN) {
if (isdigit(*acct)) {
len++;
} else if (isxdigit(*acct) && len < ADEMCO_PACKET_ACCT_MAC_LEN) {
len++;
ishex = 1;
} else {
return 0;
}
acct++;
}
return 1;
return *acct == '\0' &&
(ishex ? len == ADEMCO_PACKET_ACCT_MAC_LEN : (len >= ADEMCO_PACKET_ACCT_MIN_LEN));
}
int ademcoIsMachineStatusEvent(AdemcoEvent ademcoEvent) {
......
......@@ -16,6 +16,7 @@ extern "C" {
#define ADEMCO_OK 0
#define ADEMCO_ERR -1
#define ADEMCO_PACKET_ACCT_MIN_LEN 6 // #acct之acct最小长度
#define ADEMCO_PACKET_ACCT_MAX_LEN 18 // #acct之acct最大长度
#define ADEMCO_PACKET_ACCT_MAC_LEN 12 // WiFi主机账号使用MAC地址
#define ADEMCO_PACKET_DATA_SEGMENT_EMPTY_LEN 2 // 空data段[]长度
......@@ -321,11 +322,12 @@ uint8_t ademcoEncodeSignalStrength(uint8_t strength);
ADEMCO_EXPORT_SYMBOL
uint8_t ademcoDecodeSignalStrength(uint8_t code);
//////////////////////// AdemcoEvent functions ////////////////////////
// 是否合法主机账号
ADEMCO_EXPORT_SYMBOL
int ademcoIsValidAccount(const char* acct);
//////////////////////// AdemcoEvent functions ////////////////////////
// 是否主机状态事件
ADEMCO_EXPORT_SYMBOL
int ademcoIsMachineStatusEvent(AdemcoEvent ademcoEvent);
......
......@@ -8,7 +8,7 @@
#define ADEMCO_VERSION_MAJOR 1
#define ADEMCO_VERSION_MINOR 5
#define ADEMCO_VERSION_PATCH 0
#define ADEMCO_VERSION_PATCH 1
#define ADEMCO_VERSION_IS_RELEASE 1
#define ADEMCO_VERSION_SUFFIX ""
......
......@@ -12,3 +12,4 @@ cp -f /g/dev_libs/ademco/hb/hb_com.c ../
cp -f /g/dev_libs/ademco/hb/ademco_version.h ../
cp -f /g/dev_libs/ademco/hb/ademco_config.h ../
cp -f /g/dev_libs/ademco/hb/CHANGELOG.md ../
sed -i '/\[hb\]/d' ../CHANGELOG.md
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment