Skip to content

Commit

Permalink
#37 Onkyo TX-NR414: added default selectors
Browse files Browse the repository at this point in the history
  • Loading branch information
mkulesh committed Apr 27, 2019
1 parent c691ea9 commit 8ee84ce
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 0 deletions.
6 changes: 6 additions & 0 deletions app/src/main/java/com/mkulesh/onpc/MainActivity.java
Expand Up @@ -263,6 +263,12 @@ public boolean connectToDevice(final String device, final int port)
try
{
stateHolder.setStateManager(new StateManager(connectionState, this, device, port, zone));
// By default, add all possible device selectors
{
final State s = stateHolder.getState();
s.createDefaultSelectors(this);
configuration.setReceiverInformation(s);
}
if (autoPower)
{
// Auto power-on once at application startup
Expand Down
15 changes: 15 additions & 0 deletions app/src/main/java/com/mkulesh/onpc/iscp/State.java
Expand Up @@ -227,6 +227,21 @@ public String getDeviceName(boolean useFriendlyName)
return "";
}

public void createDefaultSelectors(final Context context)
{
deviceSelectors.clear();
for (InputSelectorMsg.InputType it : InputSelectorMsg.InputType.values())
{
if (it != InputSelectorMsg.InputType.NONE)
{
final ReceiverInformationMsg.Selector s = new ReceiverInformationMsg.Selector(
it.getCode(), context.getString(it.getDescriptionId()),
ReceiverInformationMsg.ALL_ZONE, it.getCode(), false);
deviceSelectors.add(s);
}
}
}

private void clearTrackInfo()
{
cover = null;
Expand Down
Expand Up @@ -45,6 +45,7 @@ public class ReceiverInformationMsg extends ISCPMessage
{
public final static String CODE = "NRI";
public final static int DEFAULT_ACTIVE_ZONE = 0;
public final static int ALL_ZONE = 0xFF;

public static class Zone
{
Expand Down

0 comments on commit 8ee84ce

Please sign in to comment.