Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
H
haikang-client
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
杨立
haikang-client
Commits
8a854f28
提交
8a854f28
authored
9月 21, 2021
作者:
wangqiang
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
no qr
上级
478be0f6
全部展开
隐藏空白字符变更
内嵌
并排
正在显示
15 个修改的文件
包含
36 行增加
和
196 行删除
+36
-196
pom.xml
apq-pc-control/pom.xml
+20
-17
TestDemo.java
apq-pc-control/src/main/java/com/TestDemo.java
+5
-22
ApqControlApplication.java
...trol/src/main/java/com/priusis/ApqControlApplication.java
+1
-1
ICQrDecode.java
...c-control/src/main/java/com/priusis/utils/ICQrDecode.java
+0
-20
IHwPortController.java
...ol/src/main/java/com/priusis/utils/IHwPortController.java
+8
-0
QrCode.java
apq-pc-control/src/main/java/com/priusis/utils/QrCode.java
+0
-23
QrCodeUtils.java
...-control/src/main/java/com/priusis/utils/QrCodeUtils.java
+0
-34
CQrDecode.java
apq-pc-control/src/main/java/com/zy/QrDecode/CQrDecode.java
+0
-75
HwPortController.h
apq-pc-control/src/main/resources/HwPortController.h
+0
-0
QrDecode.dll
apq-pc-control/src/main/resources/QrDecode.dll
+0
-0
application.yml
apq-pc-control/src/main/resources/application.yml
+1
-1
0000000d.dat
apq-pc-control/src/main/resources/qr/dat/0000000d.dat
+0
-2
QrDecode.dll
apq-pc-control/src/main/resources/qr/dll/QrDecode.dll
+0
-0
libQrDecode.so
apq-pc-control/src/main/resources/qr/dll/libQrDecode.so
+0
-0
ApqRegisterApplication.java
...ter/src/main/java/com/priusis/ApqRegisterApplication.java
+1
-1
没有找到文件。
apq-pc-control/pom.xml
浏览文件 @
8a854f28
...
...
@@ -13,15 +13,14 @@
<artifactId>
apq-pc-control
</artifactId>
<version>
1.0-SNAPSHOT
</version>
<properties>
<project.build.sourceEncoding>
UTF-8
</project.build.sourceEncoding>
<maven.compiler.source>
1.8
</maven.compiler.source>
<maven.compiler.target>
1.8
</maven.compiler.target>
<junit.version>
4.12
</junit.version>
<lombok.version>
1.16.18
</lombok.version>
<jna.version>
3.0.9
</jna.version>
<spring-boot.version>
2.4.10
</spring-boot.version>
<jna.version>
3.0.9
</jna.version>
<winsw.version>
2.0.1
</winsw.version>
<pkg.name>
apq-pc-control
</pkg.name>
<pkg.user>
priusis-iot
</pkg.user>
...
...
@@ -37,6 +36,15 @@
<artifactId>
spring-boot-starter-web
</artifactId>
</dependency>
<dependency>
<groupId>
com.sun.winsw
</groupId>
<artifactId>
winsw
</artifactId>
<version>
${winsw.version}
</version>
<classifier>
bin
</classifier>
<type>
exe
</type>
<scope>
provided
</scope>
</dependency>
<dependency>
<groupId>
org.springframework.boot
</groupId>
<artifactId>
spring-boot-starter-test
</artifactId>
...
...
@@ -48,31 +56,26 @@
<scope>
test
</scope>
</dependency>
<dependency>
<groupId>
org.projectlombok
</groupId>
<artifactId>
lombok
</artifactId>
<optional>
true
</optional>
</dependency>
<dependency>
<groupId>
cn.hutool
</groupId>
<artifactId>
hutool-all
</artifactId>
<version>
5.7.11
</version>
</dependency>
<dependency>
<groupId>
com.sun.jna
</groupId>
<artifactId>
jna
</artifactId>
<version>
${jna.version}
</version>
</dependency>
<dependency>
<groupId>
com.github.oshi
</groupId>
<artifactId>
oshi-core
</artifactId>
<version>
3.5.0
</version>
</dependency>
<dependency>
<groupId>
com.sun.winsw
</groupId>
<artifactId>
winsw
</artifactId>
<version>
${winsw.version}
</version>
<classifier>
bin
</classifier>
<type>
exe
</type>
<scope>
provided
</scope>
<groupId>
org.projectlombok
</groupId>
<artifactId>
lombok
</artifactId>
<optional>
true
</optional>
</dependency>
</dependencies>
...
...
apq-pc-control/src/main/java/com/TestDemo.java
浏览文件 @
8a854f28
package
com
;
import
com.priusis.utils.ICQrDecode
;
import
com.priusis.utils.IHwPortController
;
import
com.zy.QrDecode.CQrDecode
;
import
lombok.extern.slf4j.Slf4j
;
@Slf4j
public
class
TestDemo
{
//static String qrString = "0000000D920A7111688CEDA9D7E27F2AE7C98D2E";
static
String
qrString
=
"0000000D9BBC6C567944AF514A1AD0A252491B99"
;
public
static
void
main2
(
String
[]
args
)
{
String
path
=
CQrDecode
.
parseAbsolutePath
(
"/qr/dat/"
,
"smart-property/0000000d.dat"
);
int
[]
result
=
new
int
[
4
];
CQrDecode
qrInstance
=
new
CQrDecode
();
int
ret
=
qrInstance
.
ZOOYAPI_GetCodeII
(
path
+
"0000000d.dat"
,
qrString
,
result
);
log
.
info
(
"ret:{}"
,
ret
);
log
.
info
(
"卡号 "
+
Integer
.
toHexString
(
result
[
0
]));
log
.
info
(
"校验码 "
+
Integer
.
toString
(
result
[
1
]));
log
.
info
(
"*********************************"
);
}
public
static
void
main
(
String
[]
args
)
{
/*String path = CQrDecode.parseAbsolutePath("/qr/dat/", "smart-property/0000000d.dat");
...
...
@@ -44,8 +27,8 @@ public class TestDemo {
int
result31
=
IHwPortController
.
instanceDll
.
APQ_HWPORT_get_normal_device_permit
(
4
);
log
.
info
(
"APQ_HWPORT_get_normal_device_permit ret:{}"
,
result31
);
// 设置普通设备权限
int
result32
=
IHwPortController
.
instanceDll
.
APQ_HWPORT_set_normal_device_permit
(
4
,
1
,
null
);
log
.
info
(
"APQ_HWPORT_set_normal_device_permit ret:{}"
,
result32
);
//
int result32 = IHwPortController.instanceDll.APQ_HWPORT_set_normal_device_permit(4, 1, null);
//
log.info("APQ_HWPORT_set_normal_device_permit ret:{}", result32);
// 应用硬件接口管理模块的配置内容
int
result5
=
IHwPortController
.
instanceDll
.
APQ_HWPORT_Apply
();
log
.
info
(
"APQ_HWPORT_Apply ret:{}"
,
result5
);
...
...
@@ -53,9 +36,9 @@ public class TestDemo {
int
result33
=
IHwPortController
.
instanceDll
.
APQ_HWPORT_get_normal_device_permit
(
4
);
log
.
info
(
"Check APQ_HWPORT_get_normal_device_permit ret:{}"
,
result33
);
// 获取网络设备权限
//
int speed = 0;
//int result4 = IHwPortController.instanceDll.APQ_HWPORT_get_net_device_permit(0, speed
);
//
log.info("APQ_HWPORT_get_net_device_permit ret:{}, speed:{}", result4, speed);
int
speed
=
0
;
int
result4
=
IHwPortController
.
instanceDll
.
APQ_HWPORT_get_net_device_permit
(
0
);
log
.
info
(
"APQ_HWPORT_get_net_device_permit ret:{}, speed:{}"
,
result4
,
speed
);
// 清理硬件接口管理模块
int
result2
=
IHwPortController
.
instanceDll
.
APQ_HWPORT_Uninitialize
();
log
.
info
(
"APQ_HWPORT_Uninitialize ret:{}"
,
result2
);
...
...
apq-pc-control/src/main/java/com/priusis/ApqControlApplication.java
浏览文件 @
8a854f28
...
...
@@ -37,7 +37,7 @@ public class ApqControlApplication {
SpringApplication
.
run
(
ApqControlApplication
.
class
,
args
);
}
@Scheduled
(
fixedDelay
=
FIXED_DELAY
)
@Scheduled
(
fixedDelay
=
60000L
)
protected
void
controlProgramTask
()
{
// 获取硬件监控配置 params == data
ResponseEntity
<
MqttRpcDataMessage
>
forEntity
=
restTemplate
.
getForEntity
(
"http://localhost:8765/rpc_cmd/controll"
,
MqttRpcDataMessage
.
class
);
...
...
apq-pc-control/src/main/java/com/priusis/utils/ICQrDecode.java
deleted
100644 → 0
浏览文件 @
478be0f6
package
com
.
priusis
.
utils
;
import
com.sun.jna.Library
;
import
com.sun.jna.Native
;
import
com.sun.jna.Platform
;
public
interface
ICQrDecode
extends
Library
{
ICQrDecode
INSTANCE
=
(
ICQrDecode
)
Native
.
loadLibrary
((
Platform
.
isWindows
()
?
"msvcrt"
:
"c"
),
ICQrDecode
.
class
);
void
printf
(
String
format
,
Object
...
args
);
ICQrDecode
instanceDll
=
(
ICQrDecode
)
Native
.
loadLibrary
(
"D:\\work\\priusis\\priusis-iot\\apq-iot\\apq-client\\apq-pc-control\\src\\main\\resources\\QrDecode.dll"
,
ICQrDecode
.
class
);
public
int
hello
(
String
str
);
public
int
ZOOYAPI_GetCode
(
String
path
,
String
qrString
,
int
[]
result
);
public
int
ZOOYAPI_GetCodeII
(
String
path
,
String
qrString
,
int
[]
result
);
}
apq-pc-control/src/main/java/com/priusis/utils/IHwPortController.java
浏览文件 @
8a854f28
...
...
@@ -118,6 +118,14 @@ public interface IHwPortController extends Library {
*/
int
APQ_HWPORT_get_net_device_permit
(
int
device_id
,
int
speed
);
/**
* 获取网络设备权限
*
* @param device_id 指定网络设备硬件接口类型 {@link HwportNetDevidEnum}
* @return 返回存放配置内的带宽限速值 {@link HwportNetPermEnum} 权限类型
*/
int
APQ_HWPORT_get_net_device_permit
(
int
device_id
);
/**
* 设置网络设备权限
* 设置限速选项会启动限速线程,退出程序时需要调用APQ_HWPORT_NET_PERM_NO_LIMIT或者其他不限速的权限清理限速线程
...
...
apq-pc-control/src/main/java/com/priusis/utils/QrCode.java
deleted
100644 → 0
浏览文件 @
478be0f6
package
com
.
priusis
.
utils
;
import
lombok.Data
;
/**
* @author yanghan
* @date 2020/11/27 16:15
*/
@Data
public
class
QrCode
{
/**设备卡号*/
private
String
card
;
/**校验码*/
private
String
checkCode
;
@Override
public
String
toString
()
{
return
"QrCode{"
+
"card='"
+
card
+
'\''
+
", checkCode='"
+
checkCode
+
'\''
+
'}'
;
}
}
apq-pc-control/src/main/java/com/priusis/utils/QrCodeUtils.java
deleted
100644 → 0
浏览文件 @
478be0f6
package
com
.
priusis
.
utils
;
import
com.priusis.exception.ServiceException
;
import
com.zy.QrDecode.CQrDecode
;
import
lombok.extern.slf4j.Slf4j
;
@Slf4j
public
class
QrCodeUtils
{
static
int
[]
result
=
new
int
[
4
];
public
static
QrCode
qrCodeUt
(
String
qrString
)
{
String
path
=
CQrDecode
.
parseAbsolutePath
(
"/qr/dat/0000000d.dat"
,
"smart-property/0000000d.dat"
);
CQrDecode
cQrDecode
=
new
CQrDecode
();
int
i
=
cQrDecode
.
ZOOYAPI_GetCodeII
(
path
,
qrString
,
result
);
log
.
info
(
"二维码解码状态:{}, datPath:{}"
,
i
,
path
);
switch
(
i
)
{
case
0
:
QrCode
qrCode
=
new
QrCode
();
qrCode
.
setCard
(
Integer
.
toHexString
(
result
[
0
]));
qrCode
.
setCheckCode
(
Integer
.
toString
(
result
[
1
]));
return
qrCode
;
case
4001
:
throw
new
ServiceException
(
"key file path error or not exist"
);
case
4003
:
throw
new
ServiceException
(
"key file open fail"
);
case
4005
:
throw
new
ServiceException
(
"qr-code is not match current key file"
);
default
:
return
null
;
}
}
}
apq-pc-control/src/main/java/com/zy/QrDecode/CQrDecode.java
deleted
100644 → 0
浏览文件 @
478be0f6
package
com
.
zy
.
QrDecode
;
import
com.sun.jna.Platform
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.boot.system.ApplicationHome
;
import
java.io.File
;
import
java.io.UnsupportedEncodingException
;
@Slf4j
public
class
CQrDecode
{
static
{
/*
dll 问题
IDEA中通过load加载
或者配置loadLibrary,都是要配置 -Djava.library.path=D:\work\priusis\projects\ower\QrDecode
*/
try
{
String
path
=
parseAbsolutePath
(
"/qr/dll"
,
"/qr/dll"
);
log
.
debug
(
"load加载path:{}"
,
path
);
if
(
Platform
.
isWindows
())
{
System
.
load
(
path
+
"/QrDecode.dll"
);
}
else
if
(
Platform
.
isLinux
())
{
String
lib
=
System
.
getProperty
(
"java.library.path"
);
lib
=
path
+
":"
+
lib
;
log
.
debug
(
"load加载 java.library.path:{}"
,
lib
);
System
.
setProperty
(
"java.library.path"
,
lib
);
System
.
loadLibrary
(
"QrDecode"
);
}
}
catch
(
Exception
e
)
{
log
.
error
(
"loadLibrary Exception"
);
}
}
public
native
int
hello
(
String
str
);
public
native
int
ZOOYAPI_GetCode
(
String
path
,
String
qrString
,
int
[]
result
);
public
native
int
ZOOYAPI_GetCodeII
(
String
path
,
String
qrString
,
int
[]
result
);
/**
* @param relatePath 相对路径 /qr/dat/
* @return
*/
public
static
String
parseAbsolutePath
(
String
relatePath
,
String
defaultPath
)
{
String
path
=
defaultPath
;
if
(
Platform
.
isWindows
())
{
path
=
CQrDecode
.
class
.
getResource
(
relatePath
).
getPath
();
path
=
path
.
replaceFirst
(
"/"
,
""
);
//排除中文空格
path
=
path
.
replaceAll
(
"%20"
,
" "
);
//排除中文空格
path
=
path
.
replaceAll
(
"/"
,
"\\\\"
);
//排除中文空格
try
{
path
=
java
.
net
.
URLDecoder
.
decode
(
path
,
"utf-8"
);
//解决路径包含中文的情况
}
catch
(
UnsupportedEncodingException
e
)
{
log
.
error
(
"巡检二维码异常"
,
e
);
}
}
if
(
Platform
.
isLinux
())
{
try
{
ApplicationHome
h
=
new
ApplicationHome
(
CQrDecode
.
class
);
File
jarF
=
h
.
getSource
();
log
.
debug
(
"load加载jarF:{}"
,
jarF
);
log
.
debug
(
"load加载jarF:{}"
,
jarF
.
getPath
());
path
=
jarF
.
getParentFile
().
toString
()
+
relatePath
;
}
catch
(
Exception
e
)
{
log
.
error
(
"巡检二维码获取path异常:{}"
,
e
);
path
=
"/app/smart-property/qr/dll"
;
}
}
return
path
;
}
}
apq-pc-control/src/main/resources/HwPortController.h
deleted
100644 → 0
浏览文件 @
478be0f6
差异被折叠。
点击展开。
apq-pc-control/src/main/resources/QrDecode.dll
deleted
100644 → 0
浏览文件 @
478be0f6
File deleted
apq-pc-control/src/main/resources/application.yml
浏览文件 @
8a854f28
server
:
# Server bind address
address
:
"
0.0.0.0"
port
:
${random.int[
20000,2
9999]}
port
:
${random.int[
10000,1
9999]}
apq-pc-control/src/main/resources/qr/dat/0000000d.dat
deleted
100644 → 0
浏览文件 @
478be0f6
}nsgm?!7G*X2pErfK0%XjStԮr{=^<Sa
\ No newline at end of file
apq-pc-control/src/main/resources/qr/dll/QrDecode.dll
deleted
100644 → 0
浏览文件 @
478be0f6
File deleted
apq-pc-control/src/main/resources/qr/dll/libQrDecode.so
deleted
100644 → 0
浏览文件 @
478be0f6
File deleted
apq-pc-register/src/main/java/com/priusis/ApqRegisterApplication.java
浏览文件 @
8a854f28
...
...
@@ -48,7 +48,7 @@ public class ApqRegisterApplication {
@Autowired
private
RestTemplate
restTemplate
;
@Scheduled
(
fixedDelay
=
FIXED_DELAY
)
@Scheduled
(
fixedDelay
=
60000L
)
protected
void
registerProgramTask
()
{
// 获取软件检测监控配置 params == data
ResponseEntity
<
MqttRpcDataMessage
>
forEntity
=
restTemplate
.
getForEntity
(
"http://localhost:8765/rpc_cmd/register"
,
MqttRpcDataMessage
.
class
);
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论