Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
I
ioc_sixiang_license
Project
Project
Details
Activity
Releases
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
zengtianlai3
ioc_sixiang_license
Commits
c7da8afc
Commit
c7da8afc
authored
Jul 17, 2022
by
zengtianlai3
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
解决jni问题
parent
13c073fd
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
36 additions
and
30 deletions
+36
-30
DeviceServerHandler.java
.../java/iot/sixiang/license/device/DeviceServerHandler.java
+3
-4
Safety.java
...se/src/main/java/iot/sixiang/license/idreader/Safety.java
+0
-13
LibHelper.java
...rc/main/java/iot/sixiang/license/third_lib/LibHelper.java
+32
-0
CommonUtil.java
...se/src/main/java/iot/sixiang/license/util/CommonUtil.java
+1
-13
No files found.
license/src/main/java/iot/sixiang/license/device/DeviceServerHandler.java
View file @
c7da8afc
...
...
@@ -12,8 +12,8 @@ import iot.sixiang.license.event.CreateForwarClientEvent;
import
iot.sixiang.license.event.DeviceClientInactiveEvent
;
import
iot.sixiang.license.event.EventPublisher
;
import
iot.sixiang.license.event.ForwardClientRequestEvent
;
import
iot.sixiang.license.idreader.Safety
;
import
iot.sixiang.license.model.SessionContext
;
import
iot.sixiang.license.third_lib.LibHelper
;
import
iot.sixiang.license.util.CommonUtil
;
import
iot.sixiang.license.util.HexUtil
;
import
iot.sixiang.license.util.SpringUtil
;
...
...
@@ -30,8 +30,6 @@ public class DeviceServerHandler extends SimpleChannelInboundHandler<Object> {
@Autowired
EventPublisher
eventPublisher
;
@Autowired
Safety
safety
;
public
DeviceServerHandler
()
{
super
();
...
...
@@ -122,7 +120,8 @@ public class DeviceServerHandler extends SimpleChannelInboundHandler<Object> {
//TODO 正式代码要放开
byte
[]
bytes
=
safety
.
decodeExtendedPayload
(
protocol
.
getContent
(),
0
,
protocol
.
getContent
().
length
);
LibHelper
libHelper
=
SpringUtil
.
getBean
(
LibHelper
.
class
);
byte
[]
bytes
=
libHelper
.
decodeExtendedPayload
(
protocol
.
getContent
(),
0
,
protocol
.
getContent
().
length
);
if
(
bytes
==
null
)
{
return
false
;
}
...
...
license/src/main/java/iot/sixiang/license/idreader/Safety.java
deleted
100644 → 0
View file @
13c073fd
package
iot
.
sixiang
.
license
.
idreader
;
import
iot.sixiang.license.util.CommonUtil
;
import
org.springframework.stereotype.Component
;
@Component
public
class
Safety
{
static
{
System
.
load
(
CommonUtil
.
getLibFilePathByFileName
(
"IdReaderSafetyLib"
));
}
public
native
byte
[]
decodeExtendedPayload
(
byte
[]
data
,
int
offset
,
int
length
);
}
\ No newline at end of file
license/src/main/java/iot/sixiang/license/third_lib/LibHelper.java
0 → 100644
View file @
c7da8afc
package
iot
.
sixiang
.
license
.
third_lib
;
import
iot.sixiang.license.idreader.LibPathUtil
;
import
iot.sixiang.license.idreader.Safety
;
import
iot.sixiang.license.util.CommonUtil
;
import
org.springframework.stereotype.Component
;
import
javax.annotation.PostConstruct
;
/**
* Title: LibHelper
* Description: TODO
*
* @author tianlai3
* @date 2022-07-17 19:03:09
*/
@Component
public
class
LibHelper
{
private
Safety
safety
;
@PostConstruct
public
void
init
()
{
LibPathUtil
.
libDir
=
CommonUtil
.
getServerParentDirectory
();
safety
=
new
Safety
();
}
public
byte
[]
decodeExtendedPayload
(
byte
[]
data
,
int
offset
,
int
length
)
{
return
safety
.
decodeExtendedPayload
(
data
,
offset
,
length
);
}
}
\ No newline at end of file
license/src/main/java/iot/sixiang/license/util/CommonUtil.java
View file @
c7da8afc
...
...
@@ -82,21 +82,9 @@ public class CommonUtil {
}
public
static
String
getServerParentDirectory
()
{
return
new
File
(
new
ApplicationHome
(
Consts
.
class
).
getSource
().
getParentFile
().
getPath
()).
getParent
();
return
new
File
(
new
ApplicationHome
(
Consts
.
class
).
getSource
().
getParentFile
().
getPath
()).
getParent
()
+
File
.
separator
+
"lib"
;
}
public
static
String
getLibFilePathByFileName
(
String
fileName
)
{
String
os
=
System
.
getProperty
(
"os.name"
);
String
serverParentDirectory
=
getServerParentDirectory
();
if
(
os
!=
null
)
{
if
(
os
.
toLowerCase
(
Locale
.
ENGLISH
).
startsWith
(
"win"
))
{
return
serverParentDirectory
+
File
.
separator
+
"lib"
+
File
.
separator
+
fileName
+
".dll"
;
}
else
{
return
serverParentDirectory
+
File
.
separator
+
"lib"
+
File
.
separator
+
fileName
+
".so"
;
}
}
return
""
;
}
/**
* 名字脱敏
* 规则,张三丰,脱敏为:张*丰
...
...
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