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
43ded144
Commit
43ded144
authored
Mar 22, 2022
by
captainwong
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix 2
parent
13fde13a
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
2 additions
and
3 deletions
+2
-3
dllmain.cpp
examples/javademo/cpp/dllmain.cpp
+1
-2
SimpleServer.java
examples/javademo/jni/SimpleServer.java
+1
-1
No files found.
examples/javademo/cpp/dllmain.cpp
View file @
43ded144
...
@@ -91,9 +91,8 @@ JNIEXPORT jstring JNICALL Java_javademo_jni_AdemcoHbLibrary_pack2
...
@@ -91,9 +91,8 @@ JNIEXPORT jstring JNICALL Java_javademo_jni_AdemcoHbLibrary_pack2
jboolean
*
buf
=
(
jboolean
*
)
calloc
(
xdata_len
,
sizeof
(
jboolean
));
//开辟jboolean类型的内存空间,jboolean对应的c++类型为unsigned char
jboolean
*
buf
=
(
jboolean
*
)
calloc
(
xdata_len
,
sizeof
(
jboolean
));
//开辟jboolean类型的内存空间,jboolean对应的c++类型为unsigned char
if
(
buf
==
nullptr
){
if
(
buf
==
nullptr
){
LOGE
(
"jni_radio_send: calloc error."
);
return
0
;
return
0
;
}
}
for
(
int
i
=
0
;
i
<
xdata_len
;
i
++
){
//把jcharArray的数据元素复制到buf所指的内存空间
for
(
int
i
=
0
;
i
<
xdata_len
;
i
++
){
//把jcharArray的数据元素复制到buf所指的内存空间
*
(
buf
+
i
)
=
(
jboolean
)(
*
(
array
+
i
));
*
(
buf
+
i
)
=
(
jboolean
)(
*
(
array
+
i
));
}
}
...
...
examples/javademo/jni/SimpleServer.java
View file @
43ded144
...
@@ -80,7 +80,7 @@ public class SimpleServer {
...
@@ -80,7 +80,7 @@ public class SimpleServer {
xdata
[
2
]
=
0x3F
;
xdata
[
2
]
=
0x3F
;
xdata
[
3
]
=
0xA1
;
xdata
[
3
]
=
0xA1
;
xdata
[
4
]
=
0x76
;
xdata
[
4
]
=
0x76
;
String
data
=
lib
.
pack2
(
1234
,
"861234567890"
,
666666
,
3400
,
0
,
0
,
xdata
);
String
data
=
lib
.
pack2
(
1234
,
"861234567890"
,
666666
,
3400
,
0
,
0
,
xdata
,
5
);
try
{
try
{
byte
[]
bytes
=
data
.
getBytes
(
data
);
byte
[]
bytes
=
data
.
getBytes
(
data
);
System
.
out
.
println
(
"data="
+
printable_bytes
(
bytes
));
System
.
out
.
println
(
"data="
+
printable_bytes
(
bytes
));
...
...
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