Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
黄嘉阳
/
iot-platform-server
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
11e45e0c
authored
Sep 12, 2023
by
huangjy
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
feat,设备信息推送
parent
11d07b81
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
13 additions
and
13 deletions
server-common/src/main/java/com/makeit/module/iot/enums/DeviceState.java
server-common/src/main/java/com/makeit/module/iot/enums/DeviceType.java
server-web/src/main/java/com/makeit/mqtt/MqttConfig.java
server-web/src/main/java/com/makeit/mqtt/PushCallback.java
server-web/src/main/resources/application-dev.yml
server-web/src/main/resources/application-test.yml
server-common/src/main/java/com/makeit/module/iot/enums/DeviceState.java
View file @
11e45e0c
...
...
@@ -7,11 +7,12 @@ import lombok.Getter;
@AllArgsConstructor
@Getter
public
enum
DeviceState
{
notActive
(
"禁用"
),
offline
(
"离线"
),
online
(
"在线"
);
notActive
(
"
notActive"
,
"
禁用"
),
offline
(
"
offline"
,
"
离线"
),
online
(
"
online"
,
"
在线"
);
private
final
String
text
;
private
final
String
value
;
private
final
String
name
;
}
server-common/src/main/java/com/makeit/module/iot/enums/DeviceType.java
View file @
11e45e0c
...
...
@@ -7,10 +7,11 @@ import lombok.Getter;
@AllArgsConstructor
@Getter
public
enum
DeviceType
{
device
(
"直连设备"
),
childrenDevice
(
"网关子设备"
),
gateway
(
"网关设备"
);
device
(
"
device"
,
"
直连设备"
),
childrenDevice
(
"
device"
,
"
网关子设备"
),
gateway
(
"网关设备"
,
"网关设备"
);
private
final
String
value
;
private
final
String
text
;
...
...
server-web/src/main/java/com/makeit/mqtt/MqttConfig.java
View file @
11e45e0c
...
...
@@ -44,9 +44,7 @@ public class MqttConfig {
@Bean
public
MqttPushClient
getMqttPushClient
()
{
String
iotToken
=
iotTokenService
.
getIotToken
();
clientId
=
StringUtils
.
isNotEmpty
(
iotToken
)
?
iotToken
:
clientId
;
clientId
=
StringUtils
.
isNotEmpty
(
clientId
)
?
clientId
:
iotTokenService
.
getIotToken
();
mqttPushClient
.
connect
(
hostUrl
,
clientId
,
username
,
password
,
timeout
,
keepalive
);
// 订阅主题
mqttPushClient
.
subscribe
(
defaultTopic
,
0
);
...
...
server-web/src/main/java/com/makeit/mqtt/PushCallback.java
View file @
11e45e0c
...
...
@@ -84,7 +84,7 @@ public class PushCallback implements MqttCallback {
DeviceInfo
device
=
JSON
.
parseObject
(
payload
,
DeviceInfo
.
class
);
// todo
checkAlarm
(
device
);
//
checkAlarm(device);
}
@Override
...
...
server-web/src/main/resources/application-dev.yml
View file @
11e45e0c
...
...
@@ -115,7 +115,7 @@ mqtt:
username
:
admin|1693982115969
password
:
8e3795ef7b5e95869fa8c323b865b3a9
hostUrl
:
tcp://124.71.33.17:11883
clientId
:
ab3a2fd694c8c838aba2686df3a80e7b
clientId
:
defaultTopic
:
/device/*/*/**
timeout
:
10
keepalive
:
60
...
...
server-web/src/main/resources/application-test.yml
View file @
11e45e0c
...
...
@@ -112,7 +112,7 @@ mqtt:
username
:
admin|1693982115969
password
:
8e3795ef7b5e95869fa8c323b865b3a9
hostUrl
:
tcp://124.71.33.17:11883
clientId
:
ab3a2fd694c8c838aba2686df3a80e7b
clientId
:
defaultTopic
:
/device/*/*/**
timeout
:
10
keepalive
:
60
...
...
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