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


Java DiscoveryException类代码示例

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


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

示例1: startDiscovery

import com.orbotix.common.DiscoveryException; //导入依赖的package包/类
public void startDiscovery(@NonNull Context context)
{
    //If the DiscoveryAgent is not already looking for robots, start discovery.
    if(!DualStackDiscoveryAgent.getInstance().isDiscovering()) {
        try {
            DualStackDiscoveryAgent.getInstance().startDiscovery(context);
            Log.d(TAG, "Start discovery");
        } catch (DiscoveryException e) {
            Log.e(TAG, "DiscoveryException: " + e.getMessage());
        }
    }
}
 
开发者ID:neuralcubes,项目名称:musephero,代码行数:13,代码来源:SpheroManager.java

示例2: startDiscovery

import com.orbotix.common.DiscoveryException; //导入依赖的package包/类
private void startDiscovery() {
    try {
        _discoveryAgent = DiscoveryAgentLE.getInstance();

        // You first need to set up so that the discovery agent will notify you when it finds robots.
        // To do this, you need to implement the DiscoveryAgentEventListener interface (or declare
        // it anonymously) and then register it on the discovery agent with DiscoveryAgent#addDiscoveryListener()
        _discoveryAgent.addDiscoveryListener(_discoveryAgentEventListener);

        // Second, you need to make sure that you are notified when a robot changes state. To do this,
        // implement RobotChangedStateListener (or declare it anonymously) and use
        // DiscoveryAgent#addRobotStateListener()
        _discoveryAgent.addRobotStateListener(_robotStateListener);

        // Creating a new radio descriptor to be able to connect to the BB8 robots
        RobotRadioDescriptor robotRadioDescriptor = new RobotRadioDescriptor();
        robotRadioDescriptor.setNamePrefixes(new String[]{"BB-"});
        _discoveryAgent.setRadioDescriptor(robotRadioDescriptor);

        // Then to start looking for a BB8, you use DiscoveryAgent#startDiscovery()
        // You do need to handle the discovery exception. This can occur in cases where the user has
        // Bluetooth off, or when the discovery cannot be started for some other reason.
        _discoveryAgent.startDiscovery(this);
    } catch (DiscoveryException e) {
        Log.e("Sphero", "Discovery Error: " + e);
        e.printStackTrace();
    }
}
 
开发者ID:mpvillafranca,项目名称:BB8,代码行数:29,代码来源:BB8ConnectionActivity.java

示例3: startDiscovery

import com.orbotix.common.DiscoveryException; //导入依赖的package包/类
/**
 * 検知を開始する.
 *
 * @param context コンテキストオブジェクト.
 */
public synchronized void startDiscovery(final Context context) {
    try {
        if (!discoveryAgent.isDiscovering()) {
            discoveryAgent.startDiscovery(context);
        }
    } catch (DiscoveryException e) {
        e.printStackTrace();
    }
}
 
开发者ID:DeviceConnect,项目名称:DeviceConnect-Android,代码行数:15,代码来源:SpheroManager.java


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