Add support for selecting sops on or off

This commit is contained in:
Cameron Gutman 2014-07-21 22:49:57 -07:00
parent 378fbedfa4
commit 9e385215ce
3 changed files with 12 additions and 4 deletions

View File

@ -169,7 +169,7 @@ public class NvConnection {
throws IOException, XmlPullParserException {
// Launch the app since it's not running
int gameSessionId = h.launchApp(app.getAppId(), config.getWidth(),
config.getHeight(), config.getRefreshRate(), riKey);
config.getHeight(), config.getRefreshRate(), riKey, config.getSops());
if (gameSessionId == 0) {
listener.displayMessage("Failed to launch application");
return false;

View File

@ -6,6 +6,7 @@ public class StreamConfiguration {
private int refreshRate;
private int bitrate;
private int maxPacketSize;
private boolean sops;
public StreamConfiguration(String app, int width, int height, int refreshRate, int bitrate) {
this.app = app;
@ -14,15 +15,17 @@ public class StreamConfiguration {
this.refreshRate = refreshRate;
this.bitrate = bitrate;
this.maxPacketSize = 1024;
this.sops = true;
}
public StreamConfiguration(String app, int width, int height, int refreshRate, int bitrate, int maxPacketSize) {
public StreamConfiguration(String app, int width, int height, int refreshRate, int bitrate, int maxPacketSize, boolean sops) {
this.app = app;
this.width = width;
this.height = height;
this.refreshRate = refreshRate;
this.bitrate = bitrate;
this.maxPacketSize = maxPacketSize;
this.sops = sops;
}
public int getWidth() {
@ -48,4 +51,8 @@ public class StreamConfiguration {
public String getApp() {
return app;
}
public boolean getSops() {
return sops;
}
}

View File

@ -252,12 +252,13 @@ public class NvHTTP {
openHttpConnection(baseUrl + "/unpair?uniqueid=" + uniqueId);
}
public int launchApp(int appId, int width, int height, int refreshRate, SecretKey inputKey) throws IOException, XmlPullParserException {
public int launchApp(int appId, int width, int height, int refreshRate, SecretKey inputKey, boolean sops) throws IOException, XmlPullParserException {
InputStream in = openHttpConnection(baseUrl +
"/launch?uniqueid=" + uniqueId +
"&appid=" + appId +
"&mode=" + width + "x" + height + "x" + refreshRate +
"&additionalStates=1&sops=0&rikey="+cryptoProvider.encodeBase64String(inputKey.getEncoded()));
"&additionalStates=1&sops=" + (sops ? 1 : 0) +
"&rikey="+cryptoProvider.encodeBase64String(inputKey.getEncoded()));
String gameSession = getXmlString(in, "gamesession");
return Integer.parseInt(gameSession);
}