[androidtv] Adds gtvEnabled Option (#15317)

* Adds gtvEnabled

---------

Signed-off-by: Ben Rosenblum <rosenblumb@gmail.com>
This commit is contained in:
morph166955 2023-07-31 16:37:56 -05:00 committed by GitHub
parent 27d784a4b1
commit 3e1686b1f7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 25 additions and 2 deletions

View File

@ -37,6 +37,7 @@ There are three required fields to connect successfully to a ShieldTV.
| ipAddress | text | IP address of the device | N/A | yes | no |
| keystore | text | Location of the Java Keystore | N/A | no | no |
| keystorePassword | text | Password of the Java Keystore | N/A | no | no |
| gtvEnabled | boolean | Enable/Disable the GoogleTV protocol | true | no | no |
```java
Thing androidtv:shieldtv:livingroom [ ipAddress="192.168.1.2" ]

View File

@ -50,6 +50,7 @@ public class AndroidTVBindingConstants {
// List of all config properties
public static final String PROPERTY_IP_ADDRESS = "ipAddress";
public static final String PROPERTY_GTV_ENABLED = "gtvEnabled";
// List of all static String literals
public static final String PIN_REQUEST = "REQUEST";

View File

@ -157,6 +157,7 @@ public class AndroidTVHandler extends BaseThingHandler {
GoogleTVConfiguration googletvConfig = getConfigAs(GoogleTVConfiguration.class);
String ipAddress = googletvConfig.ipAddress;
boolean gtvEnabled = googletvConfig.gtvEnabled;
if (ipAddress.isBlank()) {
updateStatus(ThingStatus.OFFLINE, ThingStatusDetail.CONFIGURATION_ERROR,
@ -164,7 +165,9 @@ public class AndroidTVHandler extends BaseThingHandler {
return;
}
googletvConnectionManager = new GoogleTVConnectionManager(this, googletvConfig);
if (THING_TYPE_GOOGLETV.equals(thingTypeUID) || gtvEnabled) {
googletvConnectionManager = new GoogleTVConnectionManager(this, googletvConfig);
}
if (THING_TYPE_SHIELDTV.equals(thingTypeUID)) {
ShieldTVConfiguration shieldtvConfig = getConfigAs(ShieldTVConfiguration.class);
@ -239,6 +242,9 @@ public class AndroidTVHandler extends BaseThingHandler {
shieldtvConnectionManager.handleCommand(channelUID, command);
return;
}
} else if (googletvConnectionManager == null) {
shieldtvConnectionManager.handleCommand(channelUID, command);
return;
}
}

View File

@ -32,4 +32,5 @@ public class GoogleTVConfiguration {
public boolean shim;
public boolean shimNewKeys;
public String mode = "";
public boolean gtvEnabled;
}

View File

@ -14,6 +14,8 @@ thing-type.androidtv.shieldtv.description = Nvidia ShieldTV
thing-type.config.androidtv.googletv.delay.label = Delay
thing-type.config.androidtv.googletv.delay.description = Delay between messages
thing-type.config.androidtv.googletv.gtvEnabled.label = Enable GoogleTV
thing-type.config.androidtv.googletv.gtvEnabled.description = Enable the GoogleTV Protocol
thing-type.config.androidtv.googletv.heartbeat.label = Heartbeat Frequency
thing-type.config.androidtv.googletv.heartbeat.description = Frequency of heartbeats
thing-type.config.androidtv.googletv.ipAddress.label = Hostname
@ -28,6 +30,8 @@ thing-type.config.androidtv.googletv.reconnect.label = Reconnect Delay
thing-type.config.androidtv.googletv.reconnect.description = Delay between reconnection attempts
thing-type.config.androidtv.shieldtv.delay.label = Delay
thing-type.config.androidtv.shieldtv.delay.description = Delay between messages
thing-type.config.androidtv.shieldtv.gtvEnabled.label = Enable GoogleTV
thing-type.config.androidtv.shieldtv.gtvEnabled.description = Enable the GoogleTV Protocol
thing-type.config.androidtv.shieldtv.heartbeat.label = Heartbeat Frequency
thing-type.config.androidtv.shieldtv.heartbeat.description = Frequency of heartbeats
thing-type.config.androidtv.shieldtv.ipAddress.label = Hostname
@ -63,6 +67,7 @@ channel-type.androidtv.player.label = Player
channel-type.androidtv.player.description = Player Control
# custom thing status
offline.protocols-starting = Protocols Starting
offline.googletv-address-not-specified = googletv address not specified
offline.shieldtv-address-not-specified = shieldtv address not specified
@ -81,4 +86,3 @@ offline.runtime-exception = Runtime exception
offline.user-forced-pin-process = User Forced PIN Process
offline.unknown = Unknown
online.online = Online

View File

@ -71,6 +71,11 @@
<description>Delay between messages</description>
<default>0</default>
</parameter>
<parameter name="gtvEnabled" type="boolean">
<label>Enable GoogleTV</label>
<description>Enable the GoogleTV Protocol</description>
<default>true</default>
</parameter>
</config-description>
</thing-type>
@ -137,6 +142,11 @@
<description>Delay between messages</description>
<default>0</default>
</parameter>
<parameter name="gtvEnabled" type="boolean">
<label>Enable GoogleTV</label>
<description>Enable the GoogleTV Protocol</description>
<default>true</default>
</parameter>
</config-description>
</thing-type>