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
75e3cbf5
Commit
75e3cbf5
authored
Mar 07, 2020
by
captainwong
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add c# manualy parse ademco_id/event etc. example
parent
cdf10bef
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
16 additions
and
3 deletions
+16
-3
README.md
README.md
+4
-2
Program.cs
csharp_dll_demo/Program.cs
+12
-1
No files found.
README.md
View file @
75e3cbf5
...
...
@@ -38,7 +38,7 @@
## demo
演示基本使用方法
演示基本使用方法
:正确性测试以及使用C++开发、直接引入头文件的示例
## server_demo
...
...
@@ -46,7 +46,9 @@
## ademco_hb
动态链接库,提供解包、打包等接口
动态链接库,仅提供对网络数据的解包、打包等接口。
调用者需要在解包后再次对数据包解析,以提取安定宝ID、事件码等信息,建议使用定址取值或正则取值。
## dll_demo
...
...
csharp_dll_demo/Program.cs
View file @
75e3cbf5
using
System
;
using
System.Runtime.InteropServices
;
using
System.Text.RegularExpressions
;
namespace
csharp_dll_demo
{
...
...
@@ -31,7 +32,17 @@ namespace csharp_dll_demo
string
raw
=
"\nC5C30053\"HENG-BO\"0000R000000L000000#90219125916578[#000000|1737 00 000]_09:11:19,08-05-2019\r"
;
Int32
commited
=
0
;
Int32
res
=
parse
(
raw
,
raw
.
Length
,
ref
commited
);
Console
.
WriteLine
(
"res={0:D}, commited={1:D}"
,
res
,
commited
);
Console
.
WriteLine
(
"res={0:D}, commited={1:D}"
,
res
,
commited
);
Console
.
WriteLine
(
"parse ademco_id/event, etc."
);
string
pattern
=
@"\[\#(?<ademco_id>\d{6})\|(?<ademco_event>\d{4})\s(?<gg>\d{2})\s(?<zone>\d{3})\]"
;
foreach
(
Match
match
in
Regex
.
Matches
(
raw
,
pattern
))
{
GroupCollection
groups
=
match
.
Groups
;
foreach
(
Group
group
in
groups
)
{
Console
.
WriteLine
(
group
.
Name
+
" "
+
group
.
Value
);
}
}
Console
.
WriteLine
(
""
);
}
...
...
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