-
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.
Enable gateway password configuration Introduce pushing data to devices Improve update handling Add new statuses for XiaomiSwitchButton Add on/off functionality to XiaomiSocket Bump version to 0.2
- Loading branch information
Showing
18 changed files
with
200 additions
and
50 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.1' | ||
version '0.2' | ||
|
||
sourceCompatibility = 1.8 | ||
|
||
|
23 changes: 23 additions & 0 deletions
23
src/main/java/com/valashko/xaapi/command/WriteCommand.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.SlaveDevice; | ||
|
||
import java.nio.charset.StandardCharsets; | ||
|
||
public class WriteCommand implements ICommand { | ||
private SlaveDevice device; | ||
private JsonObject data; | ||
|
||
public WriteCommand(SlaveDevice device, JsonObject data, String key) { | ||
this.device = device; | ||
this.data = data; | ||
data.addProperty("key", key); | ||
} | ||
|
||
@Override | ||
public byte[] toBytes() { | ||
String what = "{{\"cmd\":\"write\", \"sid\":\""+ device.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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
package com.valashko.xaapi.device; | ||
|
||
public class Utility { | ||
|
||
public static String toHexString(byte[] bytes) { | ||
StringBuilder sb = new StringBuilder(); | ||
for (byte b : bytes) { | ||
sb.append(String.format("%02X", b)); | ||
} | ||
return sb.toString(); | ||
} | ||
} |
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
package com.valashko.xaapi.reply; | ||
|
||
public class GatewayHeartbeat extends Reply { | ||
public String model; | ||
public String short_id; // NB: sometimes it is a string and sometimes a number | ||
public String token; | ||
public String data; | ||
} |
Oops, something went wrong.