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
158ce1b3
Commit
158ce1b3
authored
Mar 22, 2022
by
captainwong
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix 2
parent
bbf06a30
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
3 additions
and
2 deletions
+3
-2
dllmain.cpp
examples/javademo/cpp/dllmain.cpp
+2
-1
SimpleServer.java
examples/javademo/jni/SimpleServer.java
+1
-1
No files found.
examples/javademo/cpp/dllmain.cpp
View file @
158ce1b3
...
@@ -86,7 +86,7 @@ JNIEXPORT jstring JNICALL Java_javademo_jni_AdemcoHbLibrary_pack2
...
@@ -86,7 +86,7 @@ JNIEXPORT jstring JNICALL Java_javademo_jni_AdemcoHbLibrary_pack2
std
::
string
s
=
env
->
GetStringUTFChars
(
xdata
,
&
iscopy
);
std
::
string
s
=
env
->
GetStringUTFChars
(
xdata
,
&
iscopy
);
auto
xdata_
=
ademco
::
makeXData
(
s
.
data
(),
s
.
size
());
auto
xdata_
=
ademco
::
makeXData
(
s
.
data
(),
s
.
size
());
ademco
::
AdemcoPacket
ap
;
ademco
::
AdemcoPacket
ap
;
char
buff
[
1024
];
char
buff
[
1024
]
=
{
0
}
;
auto
res
=
ap
.
make_hb
(
buff
,
sizeof
(
buff
),
static_cast
<
uint16_t
>
(
seq
),
auto
res
=
ap
.
make_hb
(
buff
,
sizeof
(
buff
),
static_cast
<
uint16_t
>
(
seq
),
sacct
,
static_cast
<
size_t
>
(
ademco_id
),
static_cast
<
unsigned
char
>
(
gg
),
sacct
,
static_cast
<
size_t
>
(
ademco_id
),
static_cast
<
unsigned
char
>
(
gg
),
static_cast
<
ademco
::
ADEMCO_EVENT
>
(
ademco_event
),
static_cast
<
size_t
>
(
zone
),
xdata_
);
static_cast
<
ademco
::
ADEMCO_EVENT
>
(
ademco_event
),
static_cast
<
size_t
>
(
zone
),
xdata_
);
...
@@ -130,6 +130,7 @@ JNIEXPORT jcharArray JNICALL Java_javademo_jni_AdemcoHbLibrary_pack3
...
@@ -130,6 +130,7 @@ JNIEXPORT jcharArray JNICALL Java_javademo_jni_AdemcoHbLibrary_pack3
sacct
,
static_cast
<
size_t
>
(
ademco_id
),
static_cast
<
unsigned
char
>
(
gg
),
sacct
,
static_cast
<
size_t
>
(
ademco_id
),
static_cast
<
unsigned
char
>
(
gg
),
static_cast
<
ademco
::
ADEMCO_EVENT
>
(
ademco_event
),
static_cast
<
size_t
>
(
zone
),
xdata_
);
static_cast
<
ademco
::
ADEMCO_EVENT
>
(
ademco_event
),
static_cast
<
size_t
>
(
zone
),
xdata_
);
if
(
res
>
0
)
{
if
(
res
>
0
)
{
printf
(
"res=%d
\n
"
,
res
);
buff
[
res
]
=
0
;
buff
[
res
]
=
0
;
//auto ascii = ademco::detail::toString(buff, res, ademco::detail::ToStringOption::ALL_CHAR_AS_HEX, false, false);
//auto ascii = ademco::detail::toString(buff, res, ademco::detail::ToStringOption::ALL_CHAR_AS_HEX, false, false);
//memcpy(buff, ascii.data(), ascii.size());
//memcpy(buff, ascii.data(), ascii.size());
...
...
examples/javademo/jni/SimpleServer.java
View file @
158ce1b3
...
@@ -24,7 +24,7 @@ public class SimpleServer {
...
@@ -24,7 +24,7 @@ public class SimpleServer {
String
HEX_STRING
=
"0123456789ABCDEF"
;
String
HEX_STRING
=
"0123456789ABCDEF"
;
String
s
=
""
;
String
s
=
""
;
for
(
int
i
=
0
;
i
<
b
.
length
;
i
++){
for
(
int
i
=
0
;
i
<
b
.
length
;
i
++){
char
c
=
b
[
i
];
byte
c
=
b
[
i
];
if
(
32
<=
c
&&
c
<=
127
){
if
(
32
<=
c
&&
c
<=
127
){
s
+=
(
char
)
c
;
s
+=
(
char
)
c
;
}
else
{
}
else
{
...
...
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