diff --git a/.github/workflows/publish.yaml b/.github/workflows/publish.yaml
index 6fd02c1..def14a9 100644
--- a/.github/workflows/publish.yaml
+++ b/.github/workflows/publish.yaml
@@ -10,7 +10,7 @@ jobs:
- name: Set up Maven Central Repository
uses: actions/setup-java@v2
with:
- java-version: '11'
+ java-version: '17'
distribution: 'adopt'
server-id: ossrh
server-username: MAVEN_USERNAME
@@ -22,4 +22,4 @@ jobs:
env:
MAVEN_USERNAME: ${{ secrets.OSSRH_USERNAME }}
MAVEN_PASSWORD: ${{ secrets.OSSRH_TOKEN }}
- MAVEN_GPG_PASSPHRASE: ${{ secrets.MAVEN_GPG_PASSPHRASE }}
\ No newline at end of file
+ MAVEN_GPG_PASSPHRASE: ${{ secrets.MAVEN_GPG_PASSPHRASE }}
diff --git a/README.md b/README.md
index dcc2425..5d0c81c 100644
--- a/README.md
+++ b/README.md
@@ -4,7 +4,6 @@ Logitech Harmony WebSocket Client
License EPL v2.0
-[![TravisCI Build Status](https://travis-ci.org/digitaldan/harmony-client.svg?branch=master)](https://travis-ci.org/digitaldan/harmony-client)
# Running
`mvn clean compile assembly:single`
diff --git a/pom.xml b/pom.xml
index 535590e..95ba62f 100644
--- a/pom.xml
+++ b/pom.xml
@@ -4,13 +4,12 @@
com.github.digitaldan
harmony-client
jar
- 1.1.6
+ 1.1.7
Harmony Client
Logitech Harmony WebSocket Client
https://github.com/digitaldan/harmony-client
- 1.8
- 1.8
+ 17
@@ -42,7 +41,7 @@
org.apache.maven.plugins
maven-gpg-plugin
- 3.0.1
+ 3.2.3
@@ -63,7 +62,7 @@
org.sonatype.plugins
nexus-staging-maven-plugin
- 1.6.2
+ 1.6.6
true
ossrh
@@ -87,7 +86,7 @@
org.apache.maven.plugins
maven-gpg-plugin
- 3.0.1
+ 3.2.3
@@ -124,7 +123,7 @@
biz.aQute.bnd
bnd-maven-plugin
- 4.2.0
+ 7.0.0
@@ -135,7 +134,7 @@
maven-jar-plugin
- 2.6
+ 3.3.0
${project.build.outputDirectory}/META-INF/MANIFEST.MF
@@ -158,7 +157,7 @@
org.apache.maven.plugins
maven-source-plugin
- 2.2.1
+ 3.3.0
attach-sources
diff --git a/src/main/java/com/digitaldan/harmony/HarmonyClient.java b/src/main/java/com/digitaldan/harmony/HarmonyClient.java
index 37617cb..1f51160 100644
--- a/src/main/java/com/digitaldan/harmony/HarmonyClient.java
+++ b/src/main/java/com/digitaldan/harmony/HarmonyClient.java
@@ -206,7 +206,7 @@ public CompletableFuture getCurrentActivity() {
final CompletableFuture future = new CompletableFuture();
if (this.currentActivity == null) {
sendMessage(new GetCurrentActivityMessage.GetCurrentActivityRequestMessage()).thenAccept(m -> {
- int activityId = ((GetCurrentActivityMessage.GetCurrentActivityResponseMessage) m).getActivityId();
+ String activityId = ((GetCurrentActivityMessage.GetCurrentActivityResponseMessage) m).getActivityId();
this.currentActivity = this.cachedConfig.getActivityById(activityId);
future.complete(this.currentActivity);
});
@@ -223,10 +223,10 @@ public CompletableFuture getCurrentActivity() {
* @return {@link CompletableFuture}
* @throws IllegalArgumentException if activity does not exist
*/
- public CompletableFuture> startActivity(int activityId) throws IllegalArgumentException {
+ public CompletableFuture> startActivity(String activityId) throws IllegalArgumentException {
if (cachedConfig != null) {
if (cachedConfig.getActivityById(activityId) == null) {
- throw new IllegalArgumentException(String.format("Unknown activity '%d'", activityId));
+ throw new IllegalArgumentException(String.format("Unknown activity '%s'", activityId));
}
return sendMessage(new StartActivityMessage.StartActivityRequestMessage(activityId,
System.currentTimeMillis() - connectedTime));
diff --git a/src/main/java/com/digitaldan/harmony/config/Activity.java b/src/main/java/com/digitaldan/harmony/config/Activity.java
index a8a979f..71928f4 100644
--- a/src/main/java/com/digitaldan/harmony/config/Activity.java
+++ b/src/main/java/com/digitaldan/harmony/config/Activity.java
@@ -12,7 +12,7 @@
public class Activity {
private String label;
private String suggestedDisplay;
- private Integer id;
+ private String id;
private String activityTypeDisplayName;
private List controlGroup = new ArrayList<>();
private Integer activityOrder;
@@ -56,11 +56,11 @@ public void setSuggestedDisplay(String suggestedDisplay) {
this.suggestedDisplay = suggestedDisplay;
}
- public Integer getId() {
+ public String getId() {
return id;
}
- public void setId(Integer id) {
+ public void setId(String id) {
this.id = id;
}
@@ -130,6 +130,6 @@ public void setBaseImageUri(String baseImageUri) {
@Override
public String toString() {
- return format("Activity[%d]:%s", getId(), getLabel());
+ return format("Activity[%s]:%s", getId(), getLabel());
}
}
diff --git a/src/main/java/com/digitaldan/harmony/config/HarmonyConfig.java b/src/main/java/com/digitaldan/harmony/config/HarmonyConfig.java
index b74d8be..d6ba2a1 100644
--- a/src/main/java/com/digitaldan/harmony/config/HarmonyConfig.java
+++ b/src/main/java/com/digitaldan/harmony/config/HarmonyConfig.java
@@ -66,9 +66,9 @@ public void setGlobal(Global global) {
this.global = global;
}
- public Activity getActivityById(int result) {
+ public Activity getActivityById(String result) {
for (Activity activity : activities) {
- if (activity.getId() == result) {
+ if (activity.getId().equals(result)) {
return activity;
}
}
diff --git a/src/main/java/com/digitaldan/harmony/messages/ActivityFinishedMessage.java b/src/main/java/com/digitaldan/harmony/messages/ActivityFinishedMessage.java
index 16bde64..db12b6d 100644
--- a/src/main/java/com/digitaldan/harmony/messages/ActivityFinishedMessage.java
+++ b/src/main/java/com/digitaldan/harmony/messages/ActivityFinishedMessage.java
@@ -17,7 +17,7 @@ public ActivityFinished getActivityFinished() {
}
public static class ActivityFinished {
- Integer activityId;
+ String activityId;
Integer errorCode;
String errorString;
@@ -25,7 +25,7 @@ public ActivityFinished() {
}
- public Integer getActivityId() {
+ public String getActivityId() {
return activityId;
}
diff --git a/src/main/java/com/digitaldan/harmony/messages/DigestMessage.java b/src/main/java/com/digitaldan/harmony/messages/DigestMessage.java
index 63bddfa..e711499 100644
--- a/src/main/java/com/digitaldan/harmony/messages/DigestMessage.java
+++ b/src/main/java/com/digitaldan/harmony/messages/DigestMessage.java
@@ -50,14 +50,8 @@ public class Digest {
private Integer configVersion;
private String accountId;
- public Integer getActivityId() {
- if (activityId != null) {
- try {
- return Integer.parseInt(activityId);
- } catch (NumberFormatException ignored) {
- }
- }
- return null;
+ public String getActivityId() {
+ return activityId;
}
public Status getActivityStatus() {
diff --git a/src/main/java/com/digitaldan/harmony/messages/GetCurrentActivityMessage.java b/src/main/java/com/digitaldan/harmony/messages/GetCurrentActivityMessage.java
index 06e387a..b82ec5e 100644
--- a/src/main/java/com/digitaldan/harmony/messages/GetCurrentActivityMessage.java
+++ b/src/main/java/com/digitaldan/harmony/messages/GetCurrentActivityMessage.java
@@ -33,12 +33,8 @@ public GetCurrentActivityResponseMessage(int code, String id, String msg) {
super(code, id, msg);
}
- public int getActivityId() {
- try {
- return Integer.parseInt(currentActivityResult.result);
- } catch (Exception e) {
- return -1;
- }
+ public String getActivityId() {
+ return currentActivityResult.result;
}
private class CurrentActivityResult {
diff --git a/src/main/java/com/digitaldan/harmony/messages/StartActivityMessage.java b/src/main/java/com/digitaldan/harmony/messages/StartActivityMessage.java
index b51dc7f..295a1be 100644
--- a/src/main/java/com/digitaldan/harmony/messages/StartActivityMessage.java
+++ b/src/main/java/com/digitaldan/harmony/messages/StartActivityMessage.java
@@ -10,11 +10,11 @@ public static class StartActivityRequestMessage extends RequestMessage {
HashMap params = new HashMap<>();
- public StartActivityRequestMessage(int activityId, long timeStamp) {
+ public StartActivityRequestMessage(String activityId, long timeStamp) {
super(MIME_TYPE);
HashMap args = new HashMap<>();
args.put("rule", "start");
- params.put("activityId", String.valueOf(activityId));
+ params.put("activityId", activityId);
params.put("timeStamp", timeStamp);
params.put("args", args);
}
diff --git a/src/main/java/com/digitaldan/harmony/shell/StartActivityCommand.java b/src/main/java/com/digitaldan/harmony/shell/StartActivityCommand.java
index fc7c3d8..41ff15e 100644
--- a/src/main/java/com/digitaldan/harmony/shell/StartActivityCommand.java
+++ b/src/main/java/com/digitaldan/harmony/shell/StartActivityCommand.java
@@ -11,8 +11,8 @@ public class StartActivityCommand extends ShellCommand {
@Override
public void execute(HarmonyClient harmonyClient) {
try {
- harmonyClient.startActivity(Integer.parseInt(activity));
- } catch (NumberFormatException e) {
+ harmonyClient.startActivity(activity);
+ } catch (IllegalArgumentException e) {
harmonyClient.startActivityByName(activity);
}
println("Activity %s started", activity);