本文整理汇总了Java中com.connectsdk.service.command.ServiceCommandError类的典型用法代码示例。如果您正苦于以下问题:Java ServiceCommandError类的具体用法?Java ServiceCommandError怎么用?Java ServiceCommandError使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ServiceCommandError类属于com.connectsdk.service.command包,在下文中一共展示了ServiceCommandError类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: launchInputPicker
import com.connectsdk.service.command.ServiceCommandError; //导入依赖的package包/类
@Override
public void launchInputPicker(final AppLaunchListener listener) {
final AppInfo appInfo = new AppInfo() {{
setId("com.webos.app.inputpicker");
setName("InputPicker");
}};
launchAppWithInfo(appInfo, null, new AppLaunchListener() {
@Override
public void onSuccess(LaunchSession object) {
listener.onSuccess(object);
}
@Override
public void onError(ServiceCommandError error) {
appInfo.setId("com.webos.app.inputmgr");
launchAppWithInfo(appInfo, null, listener);
}
});
}
示例2: getServiceInfo
import com.connectsdk.service.command.ServiceCommandError; //导入依赖的package包/类
/**************
SYSTEM CONTROL
**************/
public void getServiceInfo(final ServiceInfoListener listener) {
String uri = "ssap://api/getServiceList";
ServiceCommand<ResponseListener<Object>> request = new ServiceCommand<ResponseListener<Object>>(this, uri, null, true, new ResponseListener<Object>() {
@Override
public void onSuccess(Object response) {
try {
JSONObject jsonObj = (JSONObject)response;
JSONArray services = (JSONArray) jsonObj.get("services");
Util.postSuccess(listener, services);
} catch (JSONException e) {
e.printStackTrace();
}
}
@Override
public void onError(ServiceCommandError error) {
Util.postError(listener, error);
}
});
request.send();
}
示例3: sendEnter
import com.connectsdk.service.command.ServiceCommandError; //导入依赖的package包/类
@Override
public void sendEnter() {
ResponseListener<Object> responseListener = new ResponseListener<Object>() {
@Override
public void onSuccess(Object response) {
}
@Override
public void onError(ServiceCommandError error) {
Log.w(Util.T, "Netcast TV's enter key has been failed");
}
};
handleKeyboardInput("EditEnd", keyboardString.toString());
sendVirtualKeyCode(NetcastVirtualKeycodes.RED.getCode(), responseListener); // Send RED Key to enter the "ENTER" button
}
示例4: closeMedia
import com.connectsdk.service.command.ServiceCommandError; //导入依赖的package包/类
@Override
public void closeMedia(final LaunchSession launchSession, final ResponseListener<Object> listener) {
ConnectionListener connectionListener = new ConnectionListener() {
@Override
public void onConnected() {
try {
mCastClient.stopApplication(mApiClient, launchSession.getSessionId()).setResultCallback(new ResultCallback<Status>() {
@Override
public void onResult(Status result) {
if (result.isSuccess()) {
Util.postSuccess(listener, result);
} else {
Util.postError(listener, new ServiceCommandError(result.getStatusCode(), result.getStatusMessage(), result));
}
}
});
} catch (Exception e) {
Util.postError(listener, new ServiceCommandError(0, "Unable to stop", null));
}
}
};
runCommand(connectionListener);
}
示例5: requestStatus
import com.connectsdk.service.command.ServiceCommandError; //导入依赖的package包/类
public void requestStatus(final ResponseListener<Object> listener) {
try {
mMediaPlayer
.requestStatus(mApiClient)
.setResultCallback(
new ResultCallback<RemoteMediaPlayer.MediaChannelResult>() {
@Override
public void onResult(MediaChannelResult result) {
if (result.getStatus().isSuccess()) {
Util.postSuccess(listener, result);
}
else {
Util.postError(listener, new ServiceCommandError(0, "Failed to request status", result));
}
}
});
} catch (Exception e) {
Util.postError(listener, new ServiceCommandError(0, "There is no media currently available", null));
}
}
示例6: onConnectionFailed
import com.connectsdk.service.command.ServiceCommandError; //导入依赖的package包/类
@Override
public void onConnectionFailed(final ConnectionResult result) {
Log.d(Util.T, "ConnectionFailedListener.onConnectionFailed " + (result != null ? result: ""));
detachMediaPlayer();
connected = false;
mWaitingForReconnect = false;
mApiClient = null;
Util.runOnUI(new Runnable() {
@Override
public void run() {
if (listener != null) {
ServiceCommandError error = new ServiceCommandError(result.getErrorCode(), "Failed to connect to Google Cast device", result);
listener.onConnectionFailure(CastService.this, error);
}
}
});
}
示例7: closeMedia
import com.connectsdk.service.command.ServiceCommandError; //导入依赖的package包/类
@Override
public void closeMedia(final LaunchSession launchSession, final ResponseListener<Object> listener) {
ConnectionListener connectionListener = new ConnectionListener() {
@Override
public void onConnected() {
try {
Cast.CastApi.stopApplication(mApiClient, launchSession.getSessionId()).setResultCallback(new ResultCallback<Status>() {
@Override
public void onResult(Status result) {
if (result.isSuccess()) {
Util.postSuccess(listener, result);
} else {
Util.postError(listener, new ServiceCommandError(result.getStatusCode(), result.getStatusMessage(), result));
}
}
});
} catch (Exception e) {
Util.postError(listener, new ServiceCommandError(0, "Unable to stop", null));
}
}
};
runCommand(connectionListener);
}
示例8: sendDelete
import com.connectsdk.service.command.ServiceCommandError; //导入依赖的package包/类
@Override
public void sendDelete() {
ResponseListener<Object> listener = new ResponseListener<Object>() {
@Override
public void onSuccess(Object response) {
// TODO Auto-generated method stub
}
@Override
public void onError(ServiceCommandError error) {
// TODO Auto-generated method stub
}
};
String action = "keypress";
String param = "Backspace";
String uri = requestURL(action, param);
ServiceCommand<ResponseListener<Object>> request = new ServiceCommand<ResponseListener<Object>>(
this, uri, null, listener);
request.send();
}
示例9: sendKeyCode
import com.connectsdk.service.command.ServiceCommandError; //导入依赖的package包/类
@Override
public void sendKeyCode(KeyCode keycode, ResponseListener<Object> listener) {
switch (keycode) {
case NUM_0:
case NUM_1:
case NUM_2:
case NUM_3:
case NUM_4:
case NUM_5:
case NUM_6:
case NUM_7:
case NUM_8:
case NUM_9:
sendSpecialKey(String.valueOf(keycode.getCode()), listener);
break;
case DASH:
sendSpecialKey("DASH", listener);
break;
case ENTER:
sendSpecialKey("ENTER", listener);
default:
Util.postError(listener, new ServiceCommandError(0, "The keycode is not available", null));
}
}
示例10: probeForAppSupport
import com.connectsdk.service.command.ServiceCommandError; //导入依赖的package包/类
private void probeForAppSupport() {
if (serviceDescription.getApplicationURL() == null) {
Log.d(Util.T, "unable to check for installed app; no service application url");
return;
}
for (final String appID : registeredApps) {
hasApplication(appID, new ResponseListener<Object>() {
@Override public void onError(ServiceCommandError error) { }
@Override
public void onSuccess(Object object) {
addCapability("Launcher." + appID);
addCapability("Launcher." + appID + ".Params");
}
});
}
}
示例11: testGetPlayStatePlaying
import com.connectsdk.service.command.ServiceCommandError; //导入依赖的package包/类
@Test
public void testGetPlayStatePlaying() throws InterruptedException {
service.setResponse(
"<!DOCTYPE plist PUBLIC \"-//Apple//DTD PLIST 1.0//EN\" \"http://www.apple.com/DTDs/PropertyList-1.0.dtd\">" +
"<plist version=\"1.0\">" +
"<dict>" +
"<key>rate</key>" +
"<real>1</real>" +
"</dict>" +
"</plist>"
);
service.getPlayState(new MediaControl.PlayStateListener() {
@Override
public void onSuccess(MediaControl.PlayStateStatus object) {
Assert.assertEquals(MediaControl.PlayStateStatus.Playing, object);
}
@Override
public void onError(ServiceCommandError error) {
Assert.fail();
}
});
}
示例12: subscribePlayState
import com.connectsdk.service.command.ServiceCommandError; //导入依赖的package包/类
@Override
public ServiceSubscription<PlayStateListener> subscribePlayState(
final PlayStateListener listener) {
if (mPlayStateSubscription == null)
mPlayStateSubscription = new URLServiceSubscription<MediaControl.PlayStateListener>(
null, null, null, null);
if (!connected) {
connect(new ResponseListener<Object>() {
@Override
public void onError(ServiceCommandError error) {
Util.postError(listener, error);
}
@Override
public void onSuccess(Object response) {
}
});
}
if (!mPlayStateSubscription.getListeners().contains(listener))
mPlayStateSubscription.addListener(listener);
return mPlayStateSubscription;
}
示例13: getMute
import com.connectsdk.service.command.ServiceCommandError; //导入依赖的package包/类
@Override
public void getMute(final MuteListener listener) {
getVolumeStatus(new VolumeStatusListener() {
@Override
public void onSuccess(VolumeStatus status) {
Util.postSuccess(listener, status.isMute);
}
@Override
public void onError(ServiceCommandError error) {
Util.postError(listener, error);
}
});
}
示例14: handleKeyboardInput
import com.connectsdk.service.command.ServiceCommandError; //导入依赖的package包/类
private void handleKeyboardInput(final String state, final String buffer) {
ResponseListener<Object> responseListener = new ResponseListener<Object>() {
@Override
public void onSuccess(Object response) {
}
@Override
public void onError(ServiceCommandError error) {
Log.w(Util.T, "Netcast TV's keyboard input has been failed");
}
};
String requestURL = getUDAPRequestURL(UDAP_PATH_EVENT);
Map <String,String> params = new HashMap<String,String>();
params.put("name", "TextEdited");
params.put("state", state);
params.put("value", buffer);
String httpMessage = getUDAPMessageBody(UDAP_API_EVENT, params);
ServiceCommand<ResponseListener<Object>> request = new ServiceCommand<ResponseListener<Object>>(this, requestURL, httpMessage, responseListener);
request.send();
}
示例15: connectToApp
import com.connectsdk.service.command.ServiceCommandError; //导入依赖的package包/类
public void connectToApp(String appId, final WebAppSession.LaunchListener listener) {
LaunchSession launchSession = LaunchSession.launchSessionForAppId(appId);
launchSession.setSessionType(LaunchSessionType.App);
launchSession.setService(this);
final WebOSWebAppSession webAppSession = webAppSessionForLaunchSession(launchSession);
connectToWebApp(webAppSession, false, new ResponseListener<Object>() {
@Override
public void onError(ServiceCommandError error) {
Util.postError(listener, error);
}
@Override
public void onSuccess(Object object) {
Util.postSuccess(listener, webAppSession);
}
});
}