-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add methods to set gateway light brightness and color
- Loading branch information
Showing
6 changed files
with
137 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,7 +3,7 @@ plugins { | |
} | ||
|
||
group 'com.valashko.xaapi' | ||
version '0.5' | ||
version '0.6' | ||
|
||
sourceCompatibility = 1.8 | ||
|
||
|
23 changes: 23 additions & 0 deletions
23
src/main/java/com/valashko/xaapi/command/WriteSelfCommand.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
package com.valashko.xaapi.command; | ||
|
||
import com.google.gson.JsonObject; | ||
import com.valashko.xaapi.device.XiaomiGateway; | ||
|
||
import java.nio.charset.StandardCharsets; | ||
|
||
public class WriteSelfCommand implements ICommand { | ||
private XiaomiGateway gateway; | ||
private JsonObject data; | ||
|
||
public WriteSelfCommand(XiaomiGateway gateway, JsonObject data, String key) { | ||
this.gateway = gateway; | ||
this.data = data; | ||
data.addProperty("key", key); | ||
} | ||
|
||
@Override | ||
public byte[] toBytes() { | ||
String what = "{{\"cmd\":\"write\", \"sid\":\""+ gateway.getSid() +"\", \"data\":" + data + "}}"; | ||
return what.getBytes(StandardCharsets.US_ASCII); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters