本文整理汇总了Java中com.connectsdk.core.Util.postSuccess方法的典型用法代码示例。如果您正苦于以下问题:Java Util.postSuccess方法的具体用法?Java Util.postSuccess怎么用?Java Util.postSuccess使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.connectsdk.core.Util
的用法示例。
在下文中一共展示了Util.postSuccess方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: play
import com.connectsdk.core.Util; //导入方法依赖的package包/类
@Override
public void play(final ResponseListener<Object> listener) {
ConnectionListener connectionListener = new ConnectionListener() {
@Override
public void onConnected() {
try {
mMediaPlayer.play(mApiClient);
Util.postSuccess(listener, null);
} catch (Exception e) {
Util.postError(listener, new ServiceCommandError(0, "Unable to play", null));
}
}
};
runCommand(connectionListener);
}
示例2: connect
import com.connectsdk.core.Util; //导入方法依赖的package包/类
@Override
public void connect(final ResponseListener<Object> listener) {
if (castServiceChannel != null) {
disconnectFromWebApp();
}
castServiceChannel = new CastServiceChannel(launchSession.getAppId(), this);
try {
Cast.CastApi.setMessageReceivedCallbacks(service.getApiClient(),
castServiceChannel.getNamespace(),
castServiceChannel);
Util.postSuccess(listener, null);
} catch (IOException e) {
castServiceChannel = null;
Util.postError(listener, new ServiceCommandError(0, "Failed to create channel", null));
}
}
示例3: displayMedia
import com.connectsdk.core.Util; //导入方法依赖的package包/类
private void displayMedia(JSONObject params, final MediaPlayer.LaunchListener listener) {
String uri = "ssap://media.viewer/open";
ResponseListener<Object> responseListener = new ResponseListener<Object>() {
@Override
public void onSuccess(Object response) {
JSONObject obj = (JSONObject) response;
LaunchSession launchSession = LaunchSession.launchSessionForAppId(obj.optString("id"));
launchSession.setService(WebOSTVService.this);
launchSession.setSessionId(obj.optString("sessionId"));
launchSession.setSessionType(LaunchSessionType.Media);
Util.postSuccess(listener, new MediaLaunchObject(launchSession, WebOSTVService.this));
}
@Override
public void onError(ServiceCommandError error) {
Util.postError(listener, error);
}
};
ServiceCommand<ResponseListener<Object>> request = new ServiceCommand<ResponseListener<Object>>(this, uri, params, true, responseListener);
request.send();
}
示例4: getSystemInfo
import com.connectsdk.core.Util; //导入方法依赖的package包/类
public void getSystemInfo(final SystemInfoListener listener) {
String uri = "ssap://system/getSystemInfo";
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;
JSONObject features = (JSONObject) jsonObj.get("features");
Util.postSuccess(listener, features);
} catch (JSONException e) {
e.printStackTrace();
}
}
@Override
public void onError(ServiceCommandError error) {
Util.postError(listener, error);
}
});
request.send();
}
示例5: launchAppWithInfo
import com.connectsdk.core.Util; //导入方法依赖的package包/类
@Override
public void launchAppWithInfo(final AppInfo appInfo, Object params, final AppLaunchListener listener) {
ServiceCommand<ResponseListener<Object>> command = new ServiceCommand<ResponseListener<Object>>(this, requestURL(appInfo.getName()), params, new ResponseListener<Object>() {
@Override
public void onError(ServiceCommandError error) {
Util.postError(listener, new ServiceCommandError(0, "Problem Launching app", null));
}
@Override
public void onSuccess(Object object) {
LaunchSession launchSession = LaunchSession.launchSessionForAppId(appInfo.getId());
launchSession.setAppName(appInfo.getName());
launchSession.setSessionId((String)object);
launchSession.setService(DIALService.this);
launchSession.setSessionType(LaunchSessionType.App);
Util.postSuccess(listener, launchSession);
}
});
command.send();
}
示例6: getLaunchPoints
import com.connectsdk.core.Util; //导入方法依赖的package包/类
public void getLaunchPoints(final LaunchPointsListener listener) {
String uri = "ssap://com.webos.applicationManager/listLaunchPoints";
ResponseListener<Object> responseListener = new ResponseListener<Object>() {
@Override
public void onSuccess(Object response) {
try {
JSONObject jsonObj = (JSONObject) response;
JSONArray launchPoints = (JSONArray) jsonObj.get("launchPoints");
Util.postSuccess(listener, launchPoints);
} catch (JSONException e) {
e.printStackTrace();
}
}
@Override
public void onError(ServiceCommandError error) {
Util.postError(listener, error);
}
};
ServiceCommand<ResponseListener<Object>> request = new ServiceCommand<ResponseListener<Object>>(this, uri, null, true, responseListener);
request.send();
}
示例7: handleMediaCommandResponse
import com.connectsdk.core.Util; //导入方法依赖的package包/类
@SuppressWarnings("unchecked")
public void handleMediaCommandResponse(final JSONObject payload) {
String requestID = payload.optString("requestId");
if (requestID.length() == 0)
return;
final ServiceCommand<ResponseListener<Object>> command =
(ServiceCommand<ResponseListener<Object>>) mActiveCommands.get(requestID);
if (command == null)
return;
String mError = payload.optString("error");
if (mError.length() != 0) {
Util.postError(command.getResponseListener(), new ServiceCommandError(0, mError, null));
} else {
Util.postSuccess(command.getResponseListener(), payload);
}
mActiveCommands.remove(requestID);
}
示例8: getMediaInfo
import com.connectsdk.core.Util; //导入方法依赖的package包/类
@Override
public void getMediaInfo(MediaInfoListener listener) {
if (mMediaPlayer == null)
return;
if (mMediaPlayer.getMediaInfo() != null) {
String url = mMediaPlayer.getMediaInfo().getContentId();
String mimeType = mMediaPlayer.getMediaInfo().getContentType();
MediaMetadata metadata = mMediaPlayer.getMediaInfo().getMetadata();
String title = null;
String description = null;
ArrayList<ImageInfo> list = null;
if (metadata != null) {
title = metadata.getString(MediaMetadata.KEY_TITLE);
description = metadata.getString(MediaMetadata.KEY_SUBTITLE);
if (metadata.getImages() != null && metadata.getImages().size() > 0) {
String iconUrl = metadata.getImages().get(0).getUrl().toString();
list = new ArrayList<ImageInfo>();
list.add(new ImageInfo(iconUrl));
}
}
MediaInfo info = new MediaInfo(url, mimeType, title, description, list);
Util.postSuccess(listener, info);
}
else {
Util.postError(listener, new ServiceCommandError(0, "Media Info is null", null));
}
}
示例9: getChannelList
import com.connectsdk.core.Util; //导入方法依赖的package包/类
private ServiceCommand<ResponseListener<Object>> getChannelList(boolean isSubscription, final ChannelListListener listener) {
ServiceCommand<ResponseListener<Object>> request;
ResponseListener<Object> responseListener = new ResponseListener<Object>() {
@Override
public void onSuccess(Object response) {
try {
JSONObject jsonObj = (JSONObject)response;
ArrayList<ChannelInfo> list = new ArrayList<ChannelInfo>();
JSONArray array = (JSONArray) jsonObj.get("channelList");
for (int i = 0; i < array.length(); i++) {
JSONObject object = (JSONObject) array.get(i);
ChannelInfo channel = parseRawChannelData(object);
list.add(channel);
}
Util.postSuccess(listener, list);
} catch (JSONException e) {
e.printStackTrace();
}
}
@Override
public void onError(ServiceCommandError error) {
Util.postError(listener, error);
}
};
if (isSubscription)
request = new URLServiceSubscription<ResponseListener<Object>>(this, CHANNEL_LIST, null, true, responseListener);
else
request = new ServiceCommand<ResponseListener<Object>>(this, CHANNEL_LIST, null, true, responseListener);
request.send();
return request;
}
示例10: playMedia
import com.connectsdk.core.Util; //导入方法依赖的package包/类
@Override
public void playMedia(MediaInfo mediaInfo, boolean shouldLoop, final MediaPlayer.LaunchListener listener) {
if (getDLNAService() != null) {
final MediaPlayer.LaunchListener launchListener = new LaunchListener() {
@Override
public void onError(ServiceCommandError error) {
if (listener != null)
Util.postError(listener, error);
}
@Override
public void onSuccess(MediaLaunchObject object) {
object.launchSession.setAppId(SMART_SHARE);
object.launchSession.setAppName(SMART_SHARE);
object.mediaControl = NetcastTVService.this.getMediaControl();
if (listener != null)
Util.postSuccess(listener, object);
}
};
getDLNAService().playMedia(mediaInfo, shouldLoop, launchListener);
}
else {
System.err.println("DLNA Service is not ready yet");
}
}
示例11: getVolume
import com.connectsdk.core.Util; //导入方法依赖的package包/类
private ServiceCommand<VolumeListener> getVolume(boolean isSubscription, final VolumeListener listener) {
ServiceCommand<VolumeListener> request;
ResponseListener<Object> responseListener = new ResponseListener<Object>() {
@Override
public void onSuccess(Object response) {
try {
JSONObject jsonObj = (JSONObject)response;
int iVolume = (Integer) jsonObj.get("volume");
float fVolume = (float) (iVolume / 100.0);
Util.postSuccess(listener, fVolume);
} catch (JSONException e) {
e.printStackTrace();
}
}
@Override
public void onError(ServiceCommandError error) {
Util.postError(listener, error);
}
};
if (isSubscription)
request = new URLServiceSubscription<VolumeListener>(this, VOLUME, null, true, responseListener);
else
request = new ServiceCommand<VolumeListener>(this, VOLUME, null, true, responseListener);
request.send();
return request;
}
示例12: sendP2PMessage
import com.connectsdk.core.Util; //导入方法依赖的package包/类
private void sendP2PMessage(final Object message,
final ResponseListener<Object> listener) {
JSONObject _payload = new JSONObject();
try {
_payload.put("type", "p2p");
_payload.put("to", getFullAppId());
_payload.put("payload", message);
} catch (JSONException ex) {
// do nothing
}
if (isConnected()) {
socket.sendMessage(_payload, null);
Util.postSuccess(listener, null);
} else {
ResponseListener<Object> connectListener = new ResponseListener<Object>() {
@Override
public void onError(ServiceCommandError error) {
Util.postError(listener, error);
}
@Override
public void onSuccess(Object object) {
sendP2PMessage(message, listener);
}
};
connect(connectListener);
}
}
示例13: getMute
import com.connectsdk.core.Util; //导入方法依赖的package包/类
@Override
public void getMute(final MuteListener listener) {
String method = "GetMute";
String instanceId = "0";
String channel = "Master";
Map<String, String> params = new LinkedHashMap<String, String>();
params.put("Channel", channel);
String payload = getMessageXml(RENDERING_CONTROL_URN, method, instanceId, params);
ResponseListener<Object> responseListener = new ResponseListener<Object>() {
@Override
public void onSuccess(Object response) {
String currentMute = parseData((String) response, "CurrentMute");
boolean isMute = Boolean.parseBoolean(currentMute);
Util.postSuccess(listener, isMute);
}
@Override
public void onError(ServiceCommandError error) {
Util.postError(listener, error);
}
};
ServiceCommand<ResponseListener<Object>> request = new ServiceCommand<ResponseListener<Object>>(this, method, payload, responseListener);
request.send();
}
示例14: playVideo
import com.connectsdk.core.Util; //导入方法依赖的package包/类
public void playVideo(final String url, String mimeType, String title,
String description, String iconSrc, boolean shouldLoop,
final LaunchListener listener) {
ResponseListener<Object> responseListener = new ResponseListener<Object>() {
@Override
public void onSuccess(Object response) {
LaunchSession launchSession = new LaunchSession();
launchSession.setService(AirPlayService.this);
launchSession.setSessionType(LaunchSessionType.Media);
Util.postSuccess(listener, new MediaLaunchObject(launchSession, AirPlayService.this));
startTimer();
}
@Override
public void onError(ServiceCommandError error) {
Util.postError(listener, error);
}
};
String uri = getRequestURL("play");
String payload = null;
PListBuilder builder = new PListBuilder();
builder.putString("Content-Location", url);
builder.putReal("Start-Position", 0);
payload = builder.toString();
ServiceCommand<ResponseListener<Object>> request = new ServiceCommand<ResponseListener<Object>>(this, uri, payload, responseListener);
request.send();
}
示例15: getMute
import com.connectsdk.core.Util; //导入方法依赖的package包/类
@Override
public void getMute(final MuteListener listener) {
Util.postSuccess(listener, currentMuteStatus);
}