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

Java ConnectionParameter类代码示例

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

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



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

示例1: connectToDrone

import com.o3dr.services.android.lib.drone.connection.ConnectionParameter; //导入依赖的package包/类
public void connectToDrone() {
    final ConnectionParameter connParams = retrieveConnectionParameters();
    if (connParams == null)
        return;

    boolean isDroneConnected = drone.isConnected();
    if (!connParams.equals(drone.getConnectionParameter()) && isDroneConnected) {
        Timber.d("Drone disconnection before reconnect attempt with different parameters.");
        drone.disconnect();
        isDroneConnected = false;
    }

    if (!isDroneConnected) {
        Timber.d("Connecting to drone using parameter %s", connParams);
        drone.connect(connParams, this);
    }
}
 
开发者ID:mxiao6,项目名称:Tower-develop,代码行数:18,代码来源:DroidPlannerApp.java


示例2: connect

import com.o3dr.services.android.lib.drone.connection.ConnectionParameter; //导入依赖的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


示例3: setConnectionParameter

import com.o3dr.services.android.lib.drone.connection.ConnectionParameter; //导入依赖的package包/类
public void setConnectionParameter(ConnectionParameter connParams) {
    this.connectionParams = connParams;

    if (connParams != null) {
        StreamRates connRates = connParams.getStreamRates();
        Rates droneRates = new Rates();
        droneRates.extendedStatus = connRates.getExtendedStatus();
        droneRates.extra1 = connRates.getExtra1();
        droneRates.extra2 = connRates.getExtra2();
        droneRates.extra3 = connRates.getExtra3();
        droneRates.position = connRates.getPosition();
        droneRates.rcChannels = connRates.getRcChannels();
        droneRates.rawSensors = connRates.getRawSensors();
        droneRates.rawController = connRates.getRawController();

        drone.getStreamRates().setRates(droneRates);
    }

    ((MAVLinkClient) drone.getMavClient()).setConnectionParameter(connParams);
}
 
开发者ID:jiaminghan,项目名称:droidplanner-master,代码行数:21,代码来源:DroneManager.java


示例4: disconnectMAVConnection

import com.o3dr.services.android.lib.drone.connection.ConnectionParameter; //导入依赖的package包/类
void disconnectMAVConnection(ConnectionParameter connParams, String listenerTag) {
    final AndroidMavLinkConnection conn = mavConnections.get(connParams);
    if (conn == null)
        return;

    conn.removeMavLinkConnectionListener(listenerTag);

    if (conn.getMavLinkConnectionListenersCount() == 0 && conn.getConnectionStatus() !=
            MavLinkConnection.MAVLINK_DISCONNECTED) {
        Log.d(TAG, "Disconnecting...");
        conn.disconnect();

        GAUtils.sendEvent(new HitBuilders.EventBuilder()
                .setCategory(GAUtils.Category.MAVLINK_CONNECTION)
                .setAction("MavLink disconnect")
                .setLabel(connParams.toString()));
    }
}
 
开发者ID:jiaminghan,项目名称:droidplanner-master,代码行数:19,代码来源:DroidPlannerService.java


示例5: onStartCommand

import com.o3dr.services.android.lib.drone.connection.ConnectionParameter; //导入依赖的package包/类
@Override
public int onStartCommand(Intent intent, int flags, int startId) {
    if (intent != null) {
        final String action = intent.getAction();
        if (ACTION_KICK_START_DRONESHARE_UPLOADS.equals(action)) {
            List<DroneSharePrefs> droneSharePrefsList = new ArrayList<DroneSharePrefs>
                    (mavConnections.size());
            for (ConnectionParameter connParam : mavConnections.keySet()) {
                DroneSharePrefs sharePrefs = connParam.getDroneSharePrefs();
                if (sharePrefs != null)
                    droneSharePrefsList.add(sharePrefs);
            }

            kickStartDroneShareUploader(droneSharePrefsList.toArray(new
                    DroneSharePrefs[droneSharePrefsList.size()]));
        }
    }

    return START_REDELIVER_INTENT;
}
 
开发者ID:jiaminghan,项目名称:droidplanner-master,代码行数:21,代码来源:DroidPlannerService.java


示例6: connect

import com.o3dr.services.android.lib.drone.connection.ConnectionParameter; //导入依赖的package包/类
@Override
public void connect(ConnectionParameter connParams) throws RemoteException {
    if (connParams == null || !connParams.equals(droneMgr.getConnectionParameter()))
        droneMgr.setConnectionParameter(connParams);

    try {
        // Do a quick scan to see if we need any droneshare uploads
        if (connParams != null) {
            this.droneMgr.connect();
            getService().kickStartDroneShareUploader(connParams.getDroneSharePrefs());
        }
    } catch (ConnectionException e) {
        notifyConnectionFailed(new ConnectionResult(0, e.getMessage()));
        disconnect();
    }
}
 
开发者ID:jiaminghan,项目名称:droidplanner-master,代码行数:17,代码来源:DroneApi.java


示例7: checkConnectedApps

import com.o3dr.services.android.lib.drone.connection.ConnectionParameter; //导入依赖的package包/类
private void checkConnectedApps(){
    //Check if the Tower app connected behind our back.
    Bundle[] appsInfo = controlTower.getConnectedApps();
    if (appsInfo != null) {
        for (Bundle info : appsInfo) {
            final String appId = info.getString(GCSEvent.EXTRA_APP_ID);
            if (GCSEventsReceiver.TOWER_APP_ID.equals(appId)) {
                final ConnectionParameter connectionParams = info.getParcelable(GCSEvent
                        .EXTRA_VEHICLE_CONNECTION_PARAMETER);
                if(connectionParams != null){
                    connParams = connectionParams;
                    connectDrone();
                }
            }
        }
    }
}
 
开发者ID:DroidPlanner,项目名称:tower-pebble,代码行数:18,代码来源:PebbleCommunicatorService.java


示例8: onReceive

import com.o3dr.services.android.lib.drone.connection.ConnectionParameter; //导入依赖的package包/类
@Override
public void onReceive(Context context, Intent intent) {
    final String action = intent.getAction();

    String appId = intent.getStringExtra(GCSEvent.EXTRA_APP_ID);
    if (WearUtils.TOWER_APP_ID.equals(appId)) {
        switch (action) {
            case GCSEvent.ACTION_VEHICLE_CONNECTION:
                Log.d(TAG, "Received vehicle connection event.");

                ConnectionParameter connParams = intent.getParcelableExtra(GCSEvent
                        .EXTRA_VEHICLE_CONNECTION_PARAMETER);
                context.startService(new Intent(context, DroneService.class)
                        .setAction(WearUtils.ACTION_CONNECT)
                        .putExtra(DroneService.EXTRA_CONNECTION_PARAMETER, connParams));
                break;

            case GCSEvent.ACTION_VEHICLE_DISCONNECTION:
                Log.d(TAG, "Received vehicle disconnection event.");

                context.startService(new Intent(context, DroneService.class)
                        .setAction(WearUtils.ACTION_DISCONNECT));
                break;
        }
    }
}
 
开发者ID:DroidPlanner,项目名称:tower-wear,代码行数:27,代码来源:GCSEventsReceiver.java


示例9: onBtnConnectTap

import com.o3dr.services.android.lib.drone.connection.ConnectionParameter; //导入依赖的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


示例10: startDroneSession

import com.o3dr.services.android.lib.drone.connection.ConnectionParameter; //导入依赖的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


示例11: connectToDrone

import com.o3dr.services.android.lib.drone.connection.ConnectionParameter; //导入依赖的package包/类
public void connectToDrone(){
    final ConnectionParameter connParams = retrieveConnectionParameters();
    if(connParams == null)
        return;

    boolean isDroneConnected = drone.isConnected();
    if(!connParams.equals(drone.getConnectionParameter()) && isDroneConnected) {
        drone.disconnect();
        isDroneConnected = false;
    }

    if(!isDroneConnected)
        drone.connect(connParams);
}
 
开发者ID:jiaminghan,项目名称:droidplanner-master,代码行数:15,代码来源:DroidPlannerApp.java


示例12: setConnectionParameter

import com.o3dr.services.android.lib.drone.connection.ConnectionParameter; //导入依赖的package包/类
public void setConnectionParameter(ConnectionParameter connParams) {
    boolean isConnected = isConnected();
    if(isConnected)
        closeConnection();

    this.connParams = connParams;

    if(isConnected)
        openConnection();
}
 
开发者ID:jiaminghan,项目名称:droidplanner-master,代码行数:11,代码来源:MAVLinkClient.java


示例13: sendData

import com.o3dr.services.android.lib.drone.connection.ConnectionParameter; //导入依赖的package包/类
public void sendData(ConnectionParameter connParams, MAVLinkPacket packet) {
    final AndroidMavLinkConnection mavConnection = getService().mavConnections.get
            (connParams);
    if (mavConnection == null) return;

    if (mavConnection.getConnectionStatus() != MavLinkConnection.MAVLINK_DISCONNECTED) {
        mavConnection.sendMavPacket(packet);
    }
}
 
开发者ID:jiaminghan,项目名称:droidplanner-master,代码行数:10,代码来源:MavLinkServiceApi.java


示例14: getConnectionStatus

import com.o3dr.services.android.lib.drone.connection.ConnectionParameter; //导入依赖的package包/类
public int getConnectionStatus(ConnectionParameter connParams, String tag) {
    final AndroidMavLinkConnection mavConnection = getService().mavConnections.get
            (connParams);
    if (mavConnection == null || !mavConnection.hasMavLinkConnectionListener(tag)) {
        return MavLinkConnection.MAVLINK_DISCONNECTED;
    }

    return mavConnection.getConnectionStatus();
}
 
开发者ID:jiaminghan,项目名称:droidplanner-master,代码行数:10,代码来源:MavLinkServiceApi.java


示例15: connect

import com.o3dr.services.android.lib.drone.connection.ConnectionParameter; //导入依赖的package包/类
public void connect(final ConnectionParameter connParams) {
    if (isStarted()) {
        try {
            droneApi.connect(connParams);
            this.connectionParameter = connParams;
        } catch (RemoteException e) {
            handleRemoteException(e);
        }
    }
}
 
开发者ID:jiaminghan,项目名称:droidplanner-master,代码行数:11,代码来源:Drone.java


示例16: onTowerConnected

import com.o3dr.services.android.lib.drone.connection.ConnectionParameter; //导入依赖的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


示例17: onReceive

import com.o3dr.services.android.lib.drone.connection.ConnectionParameter; //导入依赖的package包/类
@Override
public void onReceive(Context context, Intent arg) {
    String appId = arg.getStringExtra(GCSEvent.EXTRA_APP_ID);
    if(!TOWER_APP_ID.equals(appId))
       return;

    ConnectionParameter connParams = arg.getParcelableExtra(GCSEvent
            .EXTRA_VEHICLE_CONNECTION_PARAMETER);
    Intent intent = new Intent(context, PebbleCommunicatorService.class);
    intent.setAction(arg.getAction());
    intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
    intent.putExtra("extra_connection_parameter", connParams);
    context.startService(intent);
}
 
开发者ID:DroidPlanner,项目名称:tower-pebble,代码行数:15,代码来源:GCSEventsReceiver.java


示例18: connectToDrone

import com.o3dr.services.android.lib.drone.connection.ConnectionParameter; //导入依赖的package包/类
public void connectToDrone() {
    final ConnectionParameter connParams = retrieveConnectionParameters();
    if (connParams == null)
        return;

    boolean isDroneConnected = drone.isConnected();
    if (!connParams.equals(drone.getConnectionParameter()) && isDroneConnected) {
        drone.disconnect();
        isDroneConnected = false;
    }

    if (!isDroneConnected)
        drone.connect(connParams);
}
 
开发者ID:sommishra,项目名称:DroidPlanner-Tower,代码行数:15,代码来源:DroidPlannerApp.java


示例19: retrieveConnectionParameters

import com.o3dr.services.android.lib.drone.connection.ConnectionParameter; //导入依赖的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


示例20: getConnectionParameter

import com.o3dr.services.android.lib.drone.connection.ConnectionParameter; //导入依赖的package包/类
public ConnectionParameter getConnectionParameter() {
    return this.connectionParams;
}
 
开发者ID:jiaminghan,项目名称:droidplanner-master,代码行数:4,代码来源:DroneManager.java



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

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

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

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

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

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