Commit 11e45e0c by huangjy

feat,设备信息推送

parent 11d07b81
...@@ -7,11 +7,12 @@ import lombok.Getter; ...@@ -7,11 +7,12 @@ import lombok.Getter;
@AllArgsConstructor @AllArgsConstructor
@Getter @Getter
public enum DeviceState { public enum DeviceState {
notActive("禁用"), notActive("notActive","禁用"),
offline("离线"), offline("offline","离线"),
online("在线"); online("online","在线");
private final String text; private final String value;
private final String name;
} }
...@@ -7,10 +7,11 @@ import lombok.Getter; ...@@ -7,10 +7,11 @@ import lombok.Getter;
@AllArgsConstructor @AllArgsConstructor
@Getter @Getter
public enum DeviceType { public enum DeviceType {
device("直连设备"), device("device","直连设备"),
childrenDevice("网关子设备"), childrenDevice("device","网关子设备"),
gateway("网关设备"); gateway("网关设备","网关设备");
private final String value;
private final String text; private final String text;
......
...@@ -44,9 +44,7 @@ public class MqttConfig { ...@@ -44,9 +44,7 @@ public class MqttConfig {
@Bean @Bean
public MqttPushClient getMqttPushClient() { public MqttPushClient getMqttPushClient() {
clientId = StringUtils.isNotEmpty(clientId) ? clientId : iotTokenService.getIotToken();
String iotToken = iotTokenService.getIotToken();
clientId = StringUtils.isNotEmpty(iotToken) ? iotToken : clientId;
mqttPushClient.connect(hostUrl, clientId, username, password, timeout, keepalive); mqttPushClient.connect(hostUrl, clientId, username, password, timeout, keepalive);
// 订阅主题 // 订阅主题
mqttPushClient.subscribe(defaultTopic, 0); mqttPushClient.subscribe(defaultTopic, 0);
......
...@@ -84,7 +84,7 @@ public class PushCallback implements MqttCallback { ...@@ -84,7 +84,7 @@ public class PushCallback implements MqttCallback {
DeviceInfo device = JSON.parseObject(payload, DeviceInfo.class); DeviceInfo device = JSON.parseObject(payload, DeviceInfo.class);
// todo // todo
checkAlarm(device); // checkAlarm(device);
} }
@Override @Override
......
...@@ -115,7 +115,7 @@ mqtt: ...@@ -115,7 +115,7 @@ mqtt:
username: admin|1693982115969 username: admin|1693982115969
password: 8e3795ef7b5e95869fa8c323b865b3a9 password: 8e3795ef7b5e95869fa8c323b865b3a9
hostUrl: tcp://124.71.33.17:11883 hostUrl: tcp://124.71.33.17:11883
clientId: ab3a2fd694c8c838aba2686df3a80e7b clientId:
defaultTopic: /device/*/*/** defaultTopic: /device/*/*/**
timeout: 10 timeout: 10
keepalive: 60 keepalive: 60
......
...@@ -112,7 +112,7 @@ mqtt: ...@@ -112,7 +112,7 @@ mqtt:
username: admin|1693982115969 username: admin|1693982115969
password: 8e3795ef7b5e95869fa8c323b865b3a9 password: 8e3795ef7b5e95869fa8c323b865b3a9
hostUrl: tcp://124.71.33.17:11883 hostUrl: tcp://124.71.33.17:11883
clientId: ab3a2fd694c8c838aba2686df3a80e7b clientId:
defaultTopic: /device/*/*/** defaultTopic: /device/*/*/**
timeout: 10 timeout: 10
keepalive: 60 keepalive: 60
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment