當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。