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


Java ConnectionType.TYPE_BLUETOOTH属性代码示例

本文整理汇总了Java中com.o3dr.services.android.lib.drone.connection.ConnectionType.TYPE_BLUETOOTH属性的典型用法代码示例。如果您正苦于以下问题:Java ConnectionType.TYPE_BLUETOOTH属性的具体用法?Java ConnectionType.TYPE_BLUETOOTH怎么用?Java ConnectionType.TYPE_BLUETOOTH使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在com.o3dr.services.android.lib.drone.connection.ConnectionType的用法示例。


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

示例1: updateConnectionSettings

private void updateConnectionSettings() {
       if(this.rootPref == null)
           return;

	hideAllPrefs();

	final int connectionType = prefs.getConnectionParameterType();
	switch(connectionType){
		case ConnectionType.TYPE_USB:
			this.rootPref.addPreference(this.usbPrefs);
			break;

		case ConnectionType.TYPE_TCP:
			this.rootPref.addPreference(this.tcpPrefs);
			break;

		case ConnectionType.TYPE_UDP:
			this.rootPref.addPreference(this.udpPrefs);
			break;

		case ConnectionType.TYPE_BLUETOOTH:
			this.rootPref.addPreference(this.bluetoothPrefs);
			break;

		case ConnectionType.TYPE_SOLO:
			break;
	}
}
 
开发者ID:mxiao6,项目名称:Tower-develop,代码行数:28,代码来源:ModeDisconnectedFragment.java

示例2: updateConnectionPreferenceSummary

private void updateConnectionPreferenceSummary(Preference preference, int connectionType) {
    String connectionName;
    switch (connectionType) {
        case ConnectionType.TYPE_USB:
            connectionName = "USB";
            break;

        case ConnectionType.TYPE_UDP:
            connectionName = "UDP";
            break;

        case ConnectionType.TYPE_TCP:
            connectionName = "TCP";
            break;

        case ConnectionType.TYPE_BLUETOOTH:
            connectionName = "BLUETOOTH";
            break;

        default:
            connectionName = null;
            break;
    }

    if (connectionName != null)
        preference.setSummary(connectionName);
}
 
开发者ID:jiaminghan,项目名称:droidplanner-master,代码行数:27,代码来源:SettingsFragment.java

示例3: retrieveConnectionParameters

private ConnectionParameter retrieveConnectionParameters() {
    final @ConnectionType.Type int connectionType = dpPrefs.getConnectionParameterType();

    // Generate the uri for logging the tlog data for this session.
    Uri tlogLoggingUri = TLogUtils.getTLogLoggingUri(getApplicationContext(),
        connectionType, System.currentTimeMillis());

    ConnectionParameter connParams;
    switch (connectionType) {
        case ConnectionType.TYPE_USB:
            connParams = ConnectionParameter.newUsbConnection(dpPrefs.getUsbBaudRate(),
                tlogLoggingUri, EVENTS_DISPATCHING_PERIOD);
            break;

        case ConnectionType.TYPE_UDP:
            if (dpPrefs.isUdpPingEnabled()) {
                connParams = ConnectionParameter.newUdpWithPingConnection(
                    dpPrefs.getUdpServerPort(),
                    dpPrefs.getUdpPingReceiverIp(),
                    dpPrefs.getUdpPingReceiverPort(),
                    "Hello".getBytes(),
                    ConnectionType.DEFAULT_UDP_PING_PERIOD,
                    tlogLoggingUri,
                    EVENTS_DISPATCHING_PERIOD);
            }
            else{
                connParams = ConnectionParameter.newUdpConnection(dpPrefs.getUdpServerPort(),
                    tlogLoggingUri, EVENTS_DISPATCHING_PERIOD);
            }
            break;

        case ConnectionType.TYPE_TCP:
            connParams = ConnectionParameter.newTcpConnection(dpPrefs.getTcpServerIp(),
                dpPrefs.getTcpServerPort(), tlogLoggingUri, EVENTS_DISPATCHING_PERIOD);
            break;

        case ConnectionType.TYPE_BLUETOOTH:
            String btAddress = dpPrefs.getBluetoothDeviceAddress();
            if (TextUtils.isEmpty(btAddress)) {
                connParams = null;
                startActivity(new Intent(getApplicationContext(),
                        BluetoothDevicesActivity.class)
                        .addFlags(Intent.FLAG_ACTIVITY_NEW_TASK));

            } else {
                connParams = ConnectionParameter.newBluetoothConnection(btAddress,
                    tlogLoggingUri, EVENTS_DISPATCHING_PERIOD);
            }
            break;

        default:
            Log.e(TAG, "Unrecognized connection type: " + connectionType);
            connParams = null;
            break;
    }

    return connParams;
}
 
开发者ID:mxiao6,项目名称:Tower-develop,代码行数:58,代码来源:DroidPlannerApp.java


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