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


Java ConnectionParameter类代码示例

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


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


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