Skip to content

Commit

Permalink
fix: fix some unuse yml params, see https://sonic-cloud.wiki/d/3268-2…
Browse files Browse the repository at this point in the history
  • Loading branch information
ZhouYixun committed Jun 9, 2023
1 parent 42b0746 commit e874187
Showing 1 changed file with 14 additions and 20 deletions.
34 changes: 14 additions & 20 deletions src/main/java/org/cloud/sonic/agent/transport/TransportClient.java
Original file line number Diff line number Diff line change
Expand Up @@ -63,8 +63,6 @@ public class TransportClient extends WebSocketClient {
String host = String.valueOf(SpringTool.getPropertiesValue("sonic.agent.host"));
String version = String.valueOf(SpringTool.getPropertiesValue("spring.version"));
Integer port = Integer.valueOf(SpringTool.getPropertiesValue("sonic.agent.port"));
Boolean isEnableAndroid = Boolean.valueOf(SpringTool.getPropertiesValue("modules.android.enable"));
Boolean isEnableIOS = Boolean.valueOf(SpringTool.getPropertiesValue("modules.ios.enable"));

public TransportClient(URI serverUri) {
super(serverUri);
Expand Down Expand Up @@ -256,26 +254,22 @@ public void onMessage(String s) {
agentInfo.put("host", host);
agentInfo.put("hasHub", PHCTool.isSupport() ? 1 : 0);
TransportWorker.client.send(agentInfo.toJSONString());
if (isEnableAndroid) {
IDevice[] iDevices = AndroidDeviceBridgeTool.getRealOnLineDevices();
for (IDevice d : iDevices) {
String status = AndroidDeviceManagerMap.getStatusMap().get(d.getSerialNumber());
if (status != null) {
AndroidDeviceLocalStatus.send(d.getSerialNumber(), status);
} else {
AndroidDeviceLocalStatus.send(d.getSerialNumber(), d.getState() == null ? null : d.getState().toString());
}
IDevice[] iDevices = AndroidDeviceBridgeTool.getRealOnLineDevices();
for (IDevice d : iDevices) {
String status = AndroidDeviceManagerMap.getStatusMap().get(d.getSerialNumber());
if (status != null) {
AndroidDeviceLocalStatus.send(d.getSerialNumber(), status);
} else {
AndroidDeviceLocalStatus.send(d.getSerialNumber(), d.getState() == null ? null : d.getState().toString());
}
}
if (isEnableIOS) {
List<String> udIds = SibTool.getDeviceList();
for (String u : udIds) {
String status = IOSDeviceManagerMap.getMap().get(u);
if (status != null) {
IOSDeviceLocalStatus.send(u, status);
} else {
IOSDeviceLocalStatus.send(u, DeviceStatus.ONLINE);
}
List<String> udIds = SibTool.getDeviceList();
for (String u : udIds) {
String status = IOSDeviceManagerMap.getMap().get(u);
if (status != null) {
IOSDeviceLocalStatus.send(u, status);
} else {
IOSDeviceLocalStatus.send(u, DeviceStatus.ONLINE);
}
}
} else {
Expand Down

0 comments on commit e874187

Please sign in to comment.