[miio] sending device in MiIoSendCommand (#11475)

* [miio] sending device in MiIoSendCommand

Signed-off-by: Marcel Verpaalen <marcel@verpaalen.com>

* [miio] spotless reformatting

Signed-off-by: Marcel Verpaalen <marcel@verpaalen.com>
This commit is contained in:
Marcel 2021-10-31 12:41:40 +01:00 committed by GitHub
parent f9ee7399ba
commit 8b1eabe166
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 10 additions and 3 deletions

View File

@ -30,6 +30,7 @@ public class MiIoSendCommand {
private final int id; private final int id;
private final MiIoCommand command; private final MiIoCommand command;
private final JsonObject commandJson; private final JsonObject commandJson;
private final String sender;
private @Nullable JsonObject response; private @Nullable JsonObject response;
private String cloudServer = ""; private String cloudServer = "";
@ -37,17 +38,19 @@ public class MiIoSendCommand {
this.response = response; this.response = response;
} }
public MiIoSendCommand(int id, MiIoCommand command, JsonObject fullCommand) { public MiIoSendCommand(int id, MiIoCommand command, JsonObject fullCommand, String sender) {
this.id = id; this.id = id;
this.command = command; this.command = command;
this.commandJson = fullCommand; this.commandJson = fullCommand;
this.sender = sender;
} }
public MiIoSendCommand(int id, MiIoCommand command, JsonObject fullCommand, String cloudServer) { public MiIoSendCommand(int id, MiIoCommand command, JsonObject fullCommand, String cloudServer, String sender) {
this.id = id; this.id = id;
this.command = command; this.command = command;
this.commandJson = fullCommand; this.commandJson = fullCommand;
this.cloudServer = cloudServer; this.cloudServer = cloudServer;
this.sender = sender;
} }
public int getId() { public int getId() {
@ -102,4 +105,8 @@ public class MiIoSendCommand {
public void setCloudServer(String cloudServer) { public void setCloudServer(String cloudServer) {
this.cloudServer = cloudServer; this.cloudServer = cloudServer;
} }
public String getSender() {
return sender;
}
} }

View File

@ -148,7 +148,7 @@ public class MiIoAsyncCommunication {
fullCommand.add("params", JsonParser.parseString(params)); fullCommand.add("params", JsonParser.parseString(params));
} }
MiIoSendCommand sendCmd = new MiIoSendCommand(cmdId, MiIoCommand.getCommand(command), fullCommand, MiIoSendCommand sendCmd = new MiIoSendCommand(cmdId, MiIoCommand.getCommand(command), fullCommand,
cloudServer); cloudServer, sender);
concurrentLinkedQueue.add(sendCmd); concurrentLinkedQueue.add(sendCmd);
if (logger.isDebugEnabled()) { if (logger.isDebugEnabled()) {
// Obfuscate part of the token to allow sharing of the logfiles // Obfuscate part of the token to allow sharing of the logfiles