Commit 11e45e0c by huangjy

feat,设备信息推送

parent 11d07b81
......@@ -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;
}
......@@ -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;
......
......@@ -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);
......
......@@ -84,7 +84,7 @@ public class PushCallback implements MqttCallback {
DeviceInfo device = JSON.parseObject(payload, DeviceInfo.class);
// todo
checkAlarm(device);
// checkAlarm(device);
}
@Override
......
......@@ -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
......
......@@ -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
......
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