• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Java ServiceCommandError类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中com.connectsdk.service.command.ServiceCommandError的典型用法代码示例。如果您正苦于以下问题:Java ServiceCommandError类的具体用法?Java ServiceCommandError怎么用?Java ServiceCommandError使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



ServiceCommandError类属于com.connectsdk.service.command包,在下文中一共展示了ServiceCommandError类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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);
        }
    });
}
 
开发者ID:PTCE,项目名称:popcorn-android,代码行数:21,代码来源:WebOSTVService.java


示例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();
}
 
开发者ID:david-fenton,项目名称:Connect-SDK-Cordova-Plugin,代码行数:28,代码来源:WebOSTVService.java


示例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
}
 
开发者ID:PTCE,项目名称:popcorn-android,代码行数:19,代码来源:NetcastTVService.java


示例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);
}
 
开发者ID:david-fenton,项目名称:Connect-SDK-Cordova-Plugin,代码行数:27,代码来源:CastService.java


示例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));
    }
}
 
开发者ID:david-fenton,项目名称:Connect-SDK-Cordova-Plugin,代码行数:22,代码来源:CastService.java


示例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);
            }
        }
    });
}
 
开发者ID:PTCE,项目名称:popcorn-android,代码行数:23,代码来源:CastService.java


示例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);
}
 
开发者ID:PTCE,项目名称:popcorn-android,代码行数:27,代码来源:CastService.java


示例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();
}
 
开发者ID:david-fenton,项目名称:Connect-SDK-Cordova-Plugin,代码行数:27,代码来源:RokuService.java


示例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));
    }
}
 
开发者ID:david-fenton,项目名称:Connect-SDK-Cordova-Plugin,代码行数:25,代码来源:WebOSTVService.java


示例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");
            }
        });
    }
}
 
开发者ID:david-fenton,项目名称:Connect-SDK-Cordova-Plugin,代码行数:20,代码来源:DIALService.java


示例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();
        }
    });
}
 
开发者ID:david-fenton,项目名称:Connect-SDK-Cordova-Plugin,代码行数:24,代码来源:AirPlayServiceTest.java


示例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;
}
 
开发者ID:david-fenton,项目名称:Connect-SDK-Cordova-Plugin,代码行数:27,代码来源:WebOSWebAppSession.java


示例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);
        }
    });

}
 
开发者ID:PTCE,项目名称:popcorn-android,代码行数:18,代码来源:NetcastTVService.java


示例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();
}
 
开发者ID:PTCE,项目名称:popcorn-android,代码行数:27,代码来源:NetcastTVService.java


示例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);
        }
    });
}
 
开发者ID:david-fenton,项目名称:Connect-SDK-Cordova-Plugin,代码行数:20,代码来源:WebOSTVService.java


示例16: launchBrowser

import com.connectsdk.service.command.ServiceCommandError; //导入依赖的package包/类
@Override
public void launchBrowser(String url, final Launcher.AppLaunchListener listener) {
    if (!(url == null || url.length() == 0)) 
        Log.w(Util.T, "Netcast TV does not support deeplink for Browser");

    final String appName = "Internet";

    getApplication(appName, new AppInfoListener() {

        @Override
        public void onSuccess(AppInfo appInfo) {
            String contentId = null;
            launchApplication(appName, appInfo.getId(), contentId, listener);
        }

        @Override
        public void onError(ServiceCommandError error) {
            Util.postError(listener, error);
        }
    });
}
 
开发者ID:david-fenton,项目名称:Connect-SDK-Cordova-Plugin,代码行数:22,代码来源:NetcastTVService.java


示例17: getPositionInfo

import com.connectsdk.service.command.ServiceCommandError; //导入依赖的package包/类
private void getPositionInfo(final PositionInfoListener listener) {
    String method = "GetPositionInfo";
    String instanceId = "0";

    String payload = getMessageXml(AV_TRANSPORT_URN, method, instanceId, null);
    ResponseListener<Object> responseListener = new ResponseListener<Object>() {

        @Override
        public void onSuccess(Object response) {
            if (listener != null) {
                listener.onGetPositionInfoSuccess((String)response);
            }
        }

        @Override
        public void onError(ServiceCommandError error) {
            if (listener != null) {
                listener.onGetPositionInfoFailed(error);
            }
        }
    };

    ServiceCommand<ResponseListener<Object>> request = new ServiceCommand<ResponseListener<Object>>(this, method, payload, responseListener);
    request.send();
}
 
开发者ID:PTCE,项目名称:popcorn-android,代码行数:26,代码来源:DLNAService.java


示例18: getPosition

import com.connectsdk.service.command.ServiceCommandError; //导入依赖的package包/类
@Override
public void getPosition(final PositionListener listener) {
    getPositionInfo(new PositionInfoListener() {

        @Override
        public void onGetPositionInfoSuccess(String positionInfoXml) {
            String strDuration = parseData(positionInfoXml, "RelTime");

            long milliTimes = convertStrTimeFormatToLong(strDuration);

            Util.postSuccess(listener, milliTimes);
        }

        @Override
        public void onGetPositionInfoFailed(ServiceCommandError error) {
            Util.postError(listener, error);
        }
    });
}
 
开发者ID:PTCE,项目名称:popcorn-android,代码行数:20,代码来源:DLNAService.java


示例19: getPosition

import com.connectsdk.service.command.ServiceCommandError; //导入依赖的package包/类
@Override
public void getPosition(PositionListener listener) {
    MediaControl mediaControl = null;

    if (service != null)
        mediaControl = service.getAPI(MediaControl.class);

    if (mediaControl != null)
        mediaControl.getPosition(listener);
    else if (listener != null)
        listener.onError(ServiceCommandError.notSupported());
}
 
开发者ID:PTCE,项目名称:popcorn-android,代码行数:13,代码来源:WebAppSession.java


示例20: sendErrorEvent

import com.connectsdk.service.command.ServiceCommandError; //导入依赖的package包/类
public void sendErrorEvent(CallbackContext callbackContext, ServiceCommandError error) {
    if (callbackContext != null) {
        JSONObject errorObj = new JSONObject();

        try {
            errorObj.put("message", error.getMessage());
        } catch (JSONException e) {
            e.printStackTrace();
        }

        PluginResult result = new PluginResult(PluginResult.Status.ERROR, errorObj);
        result.setKeepCallback(true);
        callbackContext.sendPluginResult(result);
    }
}
 
开发者ID:david-fenton,项目名称:Connect-SDK-Cordova-Plugin,代码行数:16,代码来源:ConnectSDKCordova.java



注:本文中的com.connectsdk.service.command.ServiceCommandError类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java READDIR3Response类代码示例发布时间:2022-05-22
下一篇:
Java Base64类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap