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

Java ConnectionType类代码示例

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

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



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

示例1: connect

import com.o3dr.services.android.lib.drone.connection.ConnectionType; //导入依赖的package包/类
public void connect() {
    Bundle extraParams = new Bundle();

    if (connectionType == ConnectionType.TYPE_USB) {
        extraParams.putInt(ConnectionType.EXTRA_USB_BAUD_RATE, BAUD_RATE_FOR_USB);
    } else if (connectionType == ConnectionType.TYPE_TCP) {
        extraParams.putString(ConnectionType.EXTRA_TCP_SERVER_IP, LOCAL_IP);
        extraParams.putInt(ConnectionType.EXTRA_TCP_SERVER_PORT, TCP_PORT);
    } else if (connectionType == ConnectionType.TYPE_UDP) {
        extraParams.putString(ConnectionType.EXTRA_UDP_SERVER_PORT, LOCAL_IP);
        extraParams.putInt(ConnectionType.EXTRA_UDP_SERVER_PORT, UDP_PORT);
    }

    ConnectionParameter connectionParams = new ConnectionParameter(connectionType, extraParams, null);

    drone.connect(connectionParams);
}
 
开发者ID:Project-Helin,项目名称:drone-onboard-app,代码行数:18,代码来源:DroneConnectionService.java


示例2: onBtnConnectTap

import com.o3dr.services.android.lib.drone.connection.ConnectionType; //导入依赖的package包/类
public void onBtnConnectTap(View view) {
    if (this.drone.isConnected()) {
        this.drone.disconnect();
    } else {
        Spinner connectionSelector = (Spinner) findViewById(R.id.selectConnectionType);
        int selectedConnectionType = connectionSelector.getSelectedItemPosition();

        Bundle extraParams = new Bundle();
        if (selectedConnectionType == ConnectionType.TYPE_USB) {
            extraParams.putInt(ConnectionType.EXTRA_USB_BAUD_RATE, DEFAULT_USB_BAUD_RATE); // Set default baud rate to 57600
        } else {
            extraParams.putInt(ConnectionType.EXTRA_UDP_SERVER_PORT, DEFAULT_UDP_PORT); // Set default baud rate to 14550
        }

        ConnectionParameter connectionParams = new ConnectionParameter(selectedConnectionType, extraParams, null);
        this.drone.connect(connectionParams);
    }

}
 
开发者ID:3drobotics,项目名称:DroneKit-Android-Starter,代码行数:20,代码来源:MainActivity.java


示例3: updateConnectionSettings

import com.o3dr.services.android.lib.drone.connection.ConnectionType; //导入依赖的package包/类
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,代码行数:29,代码来源:ModeDisconnectedFragment.java


示例4: startDroneSession

import com.o3dr.services.android.lib.drone.connection.ConnectionType; //导入依赖的package包/类
private void startDroneSession(long startTime) {
    ConnectionParameter connParams = drone.getConnectionParameter();
    @ConnectionType.Type int connectionType = connParams.getConnectionType();
    final String connectionTypeLabel = ConnectionType.getConnectionTypeLabel(connectionType);
    Uri tlogLoggingUri = connParams.getTLogLoggingUri();

    // Record the starting drone session
    currentSessionId = this.sessionDB.startSession(startTime, connectionTypeLabel, tlogLoggingUri);
    if(tlogLoggingUri != null && dpPrefs.isDroneshareEnabled()){
        //Create an entry in the droneshare upload queue
        droneShareDb.queueDataUploadEntry(dpPrefs.getDroneshareLogin(), currentSessionId);
    }
}
 
开发者ID:mxiao6,项目名称:Tower-develop,代码行数:14,代码来源:DroidPlannerApp.java


示例5: updateConnectionPreferenceSummary

import com.o3dr.services.android.lib.drone.connection.ConnectionType; //导入依赖的package包/类
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,代码行数:28,代码来源:SettingsFragment.java


示例6: onTowerConnected

import com.o3dr.services.android.lib.drone.connection.ConnectionType; //导入依赖的package包/类
@Override
public void onTowerConnected() {
    this.controlTower.registerDrone(this.drone, this.handler);
    this.drone.registerDroneListener(this);

    // Connect to drone
    Bundle extraParams = new Bundle();
    extraParams.putInt(ConnectionType.EXTRA_UDP_SERVER_PORT, 14550);
    ConnectionParameter connectionParams = new ConnectionParameter(ConnectionType.TYPE_UDP, extraParams, null);
    this.drone.connect(connectionParams);
}
 
开发者ID:dbaldwin,项目名称:DronePan-Solo,代码行数:12,代码来源:MainActivity.java


示例7: setConnectionParameterType

import com.o3dr.services.android.lib.drone.connection.ConnectionType; //导入依赖的package包/类
public void setConnectionParameterType(@ConnectionType.Type int connectionType) {
    prefs.edit().putString(PREF_CONNECTION_TYPE, String.valueOf(connectionType)).apply();
    lbm.sendBroadcast(new Intent(PREF_CONNECTION_TYPE));
}
 
开发者ID:mxiao6,项目名称:Tower-develop,代码行数:5,代码来源:DroidPlannerPrefs.java


示例8: getConnectionParameterType

import com.o3dr.services.android.lib.drone.connection.ConnectionType; //导入依赖的package包/类
/**
 * @return the selected mavlink connection type.
 */
public @ConnectionType.Type int getConnectionParameterType() {
    @ConnectionType.Type int connectionType = Integer.parseInt(prefs.getString(PREF_CONNECTION_TYPE, DEFAULT_CONNECTION_TYPE).trim());
    return connectionType;
}
 
开发者ID:mxiao6,项目名称:Tower-develop,代码行数:8,代码来源:DroidPlannerPrefs.java


示例9: retrieveConnectionParameters

import com.o3dr.services.android.lib.drone.connection.ConnectionType; //导入依赖的package包/类
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,代码行数:59,代码来源:DroidPlannerApp.java


示例10: getTLogLoggingUri

import com.o3dr.services.android.lib.drone.connection.ConnectionType; //导入依赖的package包/类
/**
 * Returns the uri where the tlog data should be logged.
 * @param context
 * @param connectionType
 * @param connectionTimestamp
 * @return
 */
public static Uri getTLogLoggingUri(Context context, @ConnectionType.Type int connectionType, long connectionTimestamp){
    File tlogLoggingFile = new File(getTLogsDirectory(context),
        getTLogFilename(ConnectionType.getConnectionTypeLabel(connectionType), connectionTimestamp));
    return Uri.fromFile(tlogLoggingFile);
}
 
开发者ID:mxiao6,项目名称:Tower-develop,代码行数:13,代码来源:TLogUtils.java



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

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

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

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

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

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