当前位置: 首页>>代码示例>>Java>>正文


Java TVControl类代码示例

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


TVControl类属于com.connectsdk.service.capability包,在下文中一共展示了TVControl类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getSubscription

import com.connectsdk.service.capability.TVControl; //导入依赖的package包/类
@Override
protected Optional<ServiceSubscription<ChannelListener>> getSubscription(ConnectableDevice device, String channelId,
        LGWebOSHandler handler) {
    if (device.hasCapability(TVControl.Channel_Subscribe)) {
        return Optional.of(getControl(device).subscribeCurrentChannel(new ChannelListener() {

            @Override
            public void onError(ServiceCommandError error) {
                logger.debug("{} {} {}", error.getCode(), error.getPayload(), error.getMessage());
            }

            @Override
            public void onSuccess(ChannelInfo channelInfo) {
                handler.postUpdate(channelId, new StringType(channelInfo.getName()));
            }
        }));
    } else {
        return null;
    }
}
 
开发者ID:openhab,项目名称:openhab2-addons,代码行数:21,代码来源:TVControlChannelName.java

示例2: getSubscription

import com.connectsdk.service.capability.TVControl; //导入依赖的package包/类
@Override
protected Optional<ServiceSubscription<ChannelListener>> getSubscription(ConnectableDevice device, String channelId,
        LGWebOSHandler handler) {
    if (device.hasCapability(TVControl.Channel_Subscribe)) {
        return Optional.of(getControl(device).subscribeCurrentChannel(new ChannelListener() {

            @Override
            public void onError(ServiceCommandError error) {
                logger.debug("error: {} {} {}", error.getCode(), error.getPayload(), error.getMessage());
            }

            @Override
            public void onSuccess(ChannelInfo channelInfo) {
                handler.postUpdate(channelId, new DecimalType(channelInfo.getNumber()));
            }
        }));
    } else {
        return null;
    }
}
 
开发者ID:openhab,项目名称:openhab2-addons,代码行数:21,代码来源:TVControlChannel.java

示例3: getPriorityLevel

import com.connectsdk.service.capability.TVControl; //导入依赖的package包/类
@Override
public CapabilityPriorityLevel getPriorityLevel(Class<? extends CapabilityMethods> clazz) {
    if (clazz.equals(MediaPlayer.class)) {
        return getMediaPlayerCapabilityLevel();
    }
    else if (clazz.equals(MediaControl.class)) {
        return getMediaControlCapabilityLevel();
    }
    else if (clazz.equals(Launcher.class)) {
        return getLauncherCapabilityLevel();
    }
    else if (clazz.equals(TVControl.class)) {
        return getTVControlCapabilityLevel();
    }
    else if (clazz.equals(VolumeControl.class)) {
        return getVolumeControlCapabilityLevel();
    }
    else if (clazz.equals(ExternalInputControl.class)) {
        return getExternalInputControlPriorityLevel();
    }
    else if (clazz.equals(MouseControl.class)) {
        return getMouseControlCapabilityLevel();
    }
    else if (clazz.equals(TextInputControl.class)) {
        return getTextInputControlCapabilityLevel();
    }
    else if (clazz.equals(PowerControl.class)) {
        return getPowerControlCapabilityLevel();
    }
    else if (clazz.equals(KeyControl.class)) {
        return getKeyControlCapabilityLevel();
    }
    return CapabilityPriorityLevel.NOT_SUPPORTED;
}
 
开发者ID:david-fenton,项目名称:Connect-SDK-Cordova-Plugin,代码行数:35,代码来源:NetcastTVService.java

示例4: getChannelListListener

import com.connectsdk.service.capability.TVControl; //导入依赖的package包/类
public TVControl.ChannelListListener getChannelListListener() {
    return new TVControl.ChannelListListener() {
        @Override
        public void onSuccess(List<ChannelInfo> object) {
            success(object);
        }

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

示例5: getChannelListener

import com.connectsdk.service.capability.TVControl; //导入依赖的package包/类
public TVControl.ChannelListener getChannelListener() {
    return new TVControl.ChannelListener() {
        @Override
        public void onSuccess(ChannelInfo object) {
            success(object);
        }

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

示例6: testGetPriorityLevel

import com.connectsdk.service.capability.TVControl; //导入依赖的package包/类
@Test
public void testGetPriorityLevel() {
    Assert.assertEquals(CapabilityMethods.CapabilityPriorityLevel.HIGH,
            service.getPriorityLevel(MediaPlayer.class));
    Assert.assertEquals(CapabilityMethods.CapabilityPriorityLevel.NOT_SUPPORTED,
            service.getPriorityLevel(ExternalInputControl.class));
    Assert.assertEquals(CapabilityMethods.CapabilityPriorityLevel.NOT_SUPPORTED,
            service.getPriorityLevel(KeyControl.class));
    Assert.assertEquals(CapabilityMethods.CapabilityPriorityLevel.NOT_SUPPORTED,
            service.getPriorityLevel(Launcher.class));
    Assert.assertEquals(CapabilityMethods.CapabilityPriorityLevel.HIGH,
            service.getPriorityLevel(MediaControl.class));
    Assert.assertEquals(CapabilityMethods.CapabilityPriorityLevel.NOT_SUPPORTED,
            service.getPriorityLevel(MouseControl.class));
    Assert.assertEquals(CapabilityMethods.CapabilityPriorityLevel.NOT_SUPPORTED,
            service.getPriorityLevel(PlaylistControl.class));
    Assert.assertEquals(CapabilityMethods.CapabilityPriorityLevel.NOT_SUPPORTED,
            service.getPriorityLevel(PowerControl.class));
    Assert.assertEquals(CapabilityMethods.CapabilityPriorityLevel.NOT_SUPPORTED,
            service.getPriorityLevel(TextInputControl.class));
    Assert.assertEquals(CapabilityMethods.CapabilityPriorityLevel.NOT_SUPPORTED,
            service.getPriorityLevel(ToastControl.class));
    Assert.assertEquals(CapabilityMethods.CapabilityPriorityLevel.NOT_SUPPORTED,
            service.getPriorityLevel(TVControl.class));
    Assert.assertEquals(CapabilityMethods.CapabilityPriorityLevel.NOT_SUPPORTED,
            service.getPriorityLevel(VolumeControl.class));
    Assert.assertEquals(CapabilityMethods.CapabilityPriorityLevel.NOT_SUPPORTED,
            service.getPriorityLevel(WebAppLauncher.class));
    Assert.assertEquals(CapabilityMethods.CapabilityPriorityLevel.NOT_SUPPORTED,
            service.getPriorityLevel(null));
}
 
开发者ID:ConnectSDK,项目名称:Connect-SDK-Android-FireTV,代码行数:32,代码来源:FireTVServiceTest.java

示例7: onReceiveCommand

import com.connectsdk.service.capability.TVControl; //导入依赖的package包/类
@Override
public void onReceiveCommand(ConnectableDevice device, String channelId, LGWebOSHandler handler, Command command) {
    if (device == null) {
        return;
    }

    if (IncreaseDecreaseType.INCREASE == command) {
        if (device.hasCapabilities(TVControl.Channel_Up)) {
            getControl(device).channelUp(createDefaultResponseListener());
        }
    } else if (IncreaseDecreaseType.DECREASE == command) {
        if (device.hasCapabilities(TVControl.Channel_Down)) {
            getControl(device).channelDown(createDefaultResponseListener());
        }
    } else if (device.hasCapabilities(TVControl.Channel_List, TVControl.Channel_Set)) {
        final String value = command.toString();
        final TVControl control = getControl(device);
        control.getChannelList(new TVControl.ChannelListListener() {
            @Override
            public void onError(ServiceCommandError error) {
                logger.warn("error requesting channel list: {}.", error.getMessage());
            }

            @Override
            public void onSuccess(List<ChannelInfo> channels) {
                if (logger.isDebugEnabled()) {
                    channels.forEach(c -> logger.debug("Channel {} - {}", c.getNumber(), c.getName()));
                }
                Optional<ChannelInfo> channelInfo = channels.stream().filter(c -> c.getNumber().equals(value))
                        .findFirst();
                if (channelInfo.isPresent()) {
                    control.setChannel(channelInfo.get(), createDefaultResponseListener());
                } else {
                    logger.warn("TV does not have a channel: {}.", value);
                }
            }
        });
    }
}
 
开发者ID:openhab,项目名称:openhab2-addons,代码行数:40,代码来源:TVControlChannel.java

示例8: setTv

import com.connectsdk.service.capability.TVControl; //导入依赖的package包/类
public void setTv(ConnectableDevice tv)
{
    mTv = tv;

    if (tv == null) {
        launcher = null;
        mediaPlayer = null;
        mediaControl = null;
        tvControl = null;
        volumeControl = null;
        toastControl = null;
        textInputControl = null;
        mouseControl = null;
        externalInputControl = null;
        powerControl = null;
        keyControl = null;
        webAppLauncher = null;

        disableButtons();
    }
    else {
        launcher = mTv.getCapability(Launcher.class);
        mediaPlayer = mTv.getCapability(MediaPlayer.class);
        mediaControl = mTv.getCapability(MediaControl.class);
        tvControl = mTv.getCapability(TVControl.class);
        volumeControl = mTv.getCapability(VolumeControl.class);
        toastControl = mTv.getCapability(ToastControl.class);
        textInputControl = mTv.getCapability(TextInputControl.class);
        mouseControl = mTv.getCapability(MouseControl.class);
        externalInputControl = mTv.getCapability(ExternalInputControl.class);
        powerControl = mTv.getCapability(PowerControl.class);
        keyControl = mTv.getCapability(KeyControl.class);
        webAppLauncher = mTv.getCapability(WebAppLauncher.class);

        enableButtons();
    }
}
 
开发者ID:ConnectSDK,项目名称:Connect-SDK-Android-API-Sampler,代码行数:38,代码来源:BaseFragment.java

示例9: getTVControl

import com.connectsdk.service.capability.TVControl; //导入依赖的package包/类
/******************
TV CONTROL
 *****************/
@Override
public TVControl getTVControl() {
    return this;
}
 
开发者ID:david-fenton,项目名称:Connect-SDK-Cordova-Plugin,代码行数:8,代码来源:NetcastTVService.java

示例10: getPriorityLevel

import com.connectsdk.service.capability.TVControl; //导入依赖的package包/类
@Override
public CapabilityPriorityLevel getPriorityLevel(Class<? extends CapabilityMethods> clazz) {
    if (clazz.equals(MediaPlayer.class)) {
        return getMediaPlayerCapabilityLevel();
    }
    else if (clazz.equals(MediaControl.class)) {
        return getMediaControlCapabilityLevel();
    }
    else if (clazz.equals(Launcher.class)) {
        return getLauncherCapabilityLevel();
    }
    else if (clazz.equals(TVControl.class)) {
        return getTVControlCapabilityLevel();
    }
    else if (clazz.equals(VolumeControl.class)) {
        return getVolumeControlCapabilityLevel();
    }
    else if (clazz.equals(ExternalInputControl.class)) {
        return getExternalInputControlPriorityLevel();
    }
    else if (clazz.equals(MouseControl.class)) {
        return getMouseControlCapabilityLevel();
    }
    else if (clazz.equals(TextInputControl.class)) {
        return getTextInputControlCapabilityLevel();
    }
    else if (clazz.equals(PowerControl.class)) {
        return getPowerControlCapabilityLevel();
    }
    else if (clazz.equals(KeyControl.class)) {
        return getKeyControlCapabilityLevel();
    }
    else if (clazz.equals(ToastControl.class)) {
        return getToastControlCapabilityLevel();
    }
    else if (clazz.equals(WebAppLauncher.class)) {
        return getWebAppLauncherCapabilityLevel();
    }
    else if (clazz.equals(PlaylistControl.class)) {
        return getPlaylistControlCapabilityLevel();
    }
    return CapabilityPriorityLevel.NOT_SUPPORTED;
}
 
开发者ID:david-fenton,项目名称:Connect-SDK-Cordova-Plugin,代码行数:44,代码来源:WebOSTVService.java

示例11: updateCapabilities

import com.connectsdk.service.capability.TVControl; //导入依赖的package包/类
@Override
protected void updateCapabilities() {
    List<String> capabilities = new ArrayList<String>();

    Collections.addAll(capabilities, VolumeControl.Capabilities);
    Collections.addAll(capabilities, MediaPlayer.Capabilities);

    if (DiscoveryManager.getInstance().getPairingLevel() == PairingLevel.ON) {
        Collections.addAll(capabilities, TextInputControl.Capabilities);
        Collections.addAll(capabilities, MouseControl.Capabilities);
        Collections.addAll(capabilities, KeyControl.Capabilities);
        Collections.addAll(capabilities, MediaPlayer.Capabilities);
        Collections.addAll(capabilities, Launcher.Capabilities);
        Collections.addAll(capabilities, TVControl.Capabilities);
        Collections.addAll(capabilities, ExternalInputControl.Capabilities);
        Collections.addAll(capabilities, ToastControl.Capabilities);
        capabilities.add(PowerControl.Off);
    } else {
        capabilities.add(Application);
        capabilities.add(Application_Params);
        capabilities.add(Application_Close);
        capabilities.add(Browser);
        capabilities.add(Browser_Params);
        capabilities.add(Hulu);
        capabilities.add(Netflix);
        capabilities.add(Netflix_Params);
        capabilities.add(YouTube);
        capabilities.add(YouTube_Params);
        capabilities.add(AppStore);
        capabilities.add(AppStore_Params);
        capabilities.add(AppState);
        capabilities.add(AppState_Subscribe);
    }

    if (serviceDescription != null) {
        if (serviceDescription.getVersion() != null
                && (serviceDescription.getVersion().contains("4.0.0")
                || serviceDescription.getVersion().contains("4.0.1"))) {
            capabilities.add(Launch);
            capabilities.add(Launch_Params);

            capabilities.add(Play);
            capabilities.add(Pause);
            capabilities.add(Stop);
            capabilities.add(Seek);
            capabilities.add(Position);
            capabilities.add(Duration);
            capabilities.add(PlayState);

            capabilities.add(WebAppLauncher.Close);

            if (getDLNAService() != null) {
                capabilities.add(MediaPlayer.Subtitle_SRT);
            }
        } else {
            Collections.addAll(capabilities, WebAppLauncher.Capabilities);
            Collections.addAll(capabilities, MediaControl.Capabilities);

            capabilities.add(MediaPlayer.Subtitle_WebVTT);

            capabilities.add(PlaylistControl.JumpToTrack);
            capabilities.add(PlaylistControl.Next);
            capabilities.add(PlaylistControl.Previous);

            capabilities.add(MediaPlayer.Loop);
        }

    }

    setCapabilities(capabilities);
}
 
开发者ID:david-fenton,项目名称:Connect-SDK-Cordova-Plugin,代码行数:72,代码来源:WebOSTVService.java

示例12: updateCapabilities

import com.connectsdk.service.capability.TVControl; //导入依赖的package包/类
@Override
protected void updateCapabilities() {
    List<String> capabilities = new ArrayList<String>();

    if (DiscoveryManager.getInstance().getPairingLevel() == PairingLevel.ON) {
        Collections.addAll(capabilities, TextInputControl.Capabilities);
        Collections.addAll(capabilities, MouseControl.Capabilities);
        Collections.addAll(capabilities, KeyControl.Capabilities);
        Collections.addAll(capabilities, MediaPlayer.Capabilities);
        Collections.addAll(capabilities, Launcher.Capabilities);
        Collections.addAll(capabilities, TVControl.Capabilities);
        Collections.addAll(capabilities, ExternalInputControl.Capabilities);
        Collections.addAll(capabilities, VolumeControl.Capabilities);
        Collections.addAll(capabilities, ToastControl.Capabilities);

        capabilities.add(PowerControl.Off);
    } else {
        Collections.addAll(capabilities, VolumeControl.Capabilities);
        Collections.addAll(capabilities, MediaPlayer.Capabilities);

        capabilities.add(Application);
        capabilities.add(Application_Params);
        capabilities.add(Application_Close);
        capabilities.add(Browser);
        capabilities.add(Browser_Params);
        capabilities.add(Hulu);
        capabilities.add(Netflix);
        capabilities.add(Netflix_Params);
        capabilities.add(YouTube);
        capabilities.add(YouTube_Params);
        capabilities.add(AppStore);
        capabilities.add(AppStore_Params);
        capabilities.add(AppState);
        capabilities.add(AppState_Subscribe);
    }

    if (serviceDescription != null && serviceDescription.getVersion() != null) {
        if (serviceDescription.getVersion().contains("4.0.0") || serviceDescription.getVersion().contains("4.0.1")) {
            capabilities.add(Launch);
            capabilities.add(Launch_Params);

            capabilities.add(Play);
            capabilities.add(Pause);
            capabilities.add(Stop);
            capabilities.add(Seek);
            capabilities.add(Position);
            capabilities.add(Duration);
            capabilities.add(PlayState);

            capabilities.add(WebAppLauncher.Close);
        } else {
            Collections.addAll(capabilities, WebAppLauncher.Capabilities);
            Collections.addAll(capabilities, MediaControl.Capabilities);

            capabilities.add(PlaylistControl.JumpToTrack);
            capabilities.add(PlaylistControl.Next);
            capabilities.add(PlaylistControl.Previous);

            capabilities.add(MediaPlayer.Loop);
        }
    }

    setCapabilities(capabilities);
}
 
开发者ID:PTCE,项目名称:popcorn-android,代码行数:65,代码来源:WebOSTVService.java

示例13: getControl

import com.connectsdk.service.capability.TVControl; //导入依赖的package包/类
private TVControl getControl(ConnectableDevice device) {
    return device.getCapability(TVControl.class);
}
 
开发者ID:openhab,项目名称:openhab2-addons,代码行数:4,代码来源:TVControlChannelName.java

示例14: getTVControl

import com.connectsdk.service.capability.TVControl; //导入依赖的package包/类
public TVControl getTVControl() 
{
    return tvControl;
}
 
开发者ID:ConnectSDK,项目名称:Connect-SDK-Android-API-Sampler,代码行数:5,代码来源:BaseFragment.java

示例15: getTVControl

import com.connectsdk.service.capability.TVControl; //导入依赖的package包/类
/**
 * Accessor for highest priority TVControl object
 * This method is deprecated. Use
 * `ConnectableDevice#getCapability(Class<T> controllerClass)` method instead
 */
@Deprecated
public TVControl getTVControl() {
    return getCapability(TVControl.class);
}
 
开发者ID:david-fenton,项目名称:Connect-SDK-Cordova-Plugin,代码行数:10,代码来源:ConnectableDevice.java


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