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


Java Drone.isConnected方法代码示例

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


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

示例1: onApiConnected

import com.o3dr.android.client.Drone; //导入方法依赖的package包/类
@Override
public void onApiConnected() {
    Drone drone = getDrone();
    State droneState = drone.getState();
    if (drone.isConnected() && !droneState.isFlying()) {
        btnStep.setEnabled(true);
        if (droneState.isCalibrating()) {
            processMAVMessage(droneState.getCalibrationStatus(), false);
        }
        else{
            resetCalibration();
        }
    } else {
        btnStep.setEnabled(false);
        resetCalibration();
    }

    getBroadcastManager().registerReceiver(broadcastReceiver, intentFilter);
}
 
开发者ID:jiaminghan,项目名称:droidplanner-master,代码行数:20,代码来源:FragmentSetupIMU.java

示例2: goToDroneLocation

import com.o3dr.android.client.Drone; //导入方法依赖的package包/类
@Override
public void goToDroneLocation() {
    Drone dpApi = getDroneApi();
    if (!dpApi.isConnected())
        return;

    Gps gps = dpApi.getGps();
    if (!gps.isValid()) {
        Toast.makeText(getActivity().getApplicationContext(), R.string.drone_no_location, Toast.LENGTH_SHORT).show();
        return;
    }

    final float currentZoomLevel = getBaiduMap().getMapStatus().zoom;
    final LatLong droneLocation = gps.getPosition();
    updateCamera(droneLocation, (int) currentZoomLevel);
}
 
开发者ID:jiaminghan,项目名称:droidplanner-master,代码行数:17,代码来源:BaiduMapFragment.java

示例3: updateDroneState

import com.o3dr.android.client.Drone; //导入方法依赖的package包/类
private void updateDroneState(Drone drone) {
    if (mInboxBuilder == null)
        return;

    mHandler.removeCallbacks(mFlightTimeUpdater);
    if (drone != null && drone.isConnected()) {
        mFlightTimeUpdater.run();
    }
}
 
开发者ID:mxiao6,项目名称:Tower-develop,代码行数:10,代码来源:StatusBarNotificationProvider.java

示例4: updateDroneState

import com.o3dr.android.client.Drone; //导入方法依赖的package包/类
private void updateDroneState(Drone drone) {
	if (mInboxBuilder == null)
		return;

       mHandler.removeCallbacks(mFlightTimeUpdater);
       if (drone != null && drone.isConnected()) {
           mFlightTimeUpdater.run();
       }
}
 
开发者ID:jiaminghan,项目名称:droidplanner-master,代码行数:10,代码来源:StatusBarNotificationProvider.java

示例5: toggleDroneConnection

import com.o3dr.android.client.Drone; //导入方法依赖的package包/类
public void toggleDroneConnection() {
    final Drone drone = dpApp.getDrone();
    if (drone != null && drone.isConnected())
        dpApp.disconnectFromDrone();
    else
        dpApp.connectToDrone();
}
 
开发者ID:mxiao6,项目名称:Tower-develop,代码行数:8,代码来源:SuperUI.java

示例6: startCalibration

import com.o3dr.android.client.Drone; //导入方法依赖的package包/类
private void startCalibration() {
       Drone dpApi = getDrone();
	if (dpApi.isConnected()) {
           CalibrationApi.getApi(dpApi).startIMUCalibration(new SimpleCommandListener(){
               @Override
               public void onError(int error){
                   Toast.makeText(getActivity(), R.string.imu_calibration_start_error, Toast.LENGTH_LONG).show();
               }
           });
	}
}
 
开发者ID:mxiao6,项目名称:Tower-develop,代码行数:12,代码来源:FragmentSetupIMU.java

示例7: onApiConnected

import com.o3dr.android.client.Drone; //导入方法依赖的package包/类
@Override
public void onApiConnected() {
       Drone drone = getDrone();
	if (drone.isConnected() && !drone.getState().isFlying()) {
		buttonStep.setEnabled(true);
	} else {
		cancelCalibration();
		buttonStep.setEnabled(false);
	}

	getBroadcastManager().registerReceiver(broadcastReceiver, intentFilter);
	if (calibrationStatus == CALIBRATION_IN_PROGRESS) {
		startCalibration();
	}
}
 
开发者ID:jiaminghan,项目名称:droidplanner-master,代码行数:16,代码来源:FragmentSetupMAG.java

示例8: onApiConnected

import com.o3dr.android.client.Drone; //导入方法依赖的package包/类
@Override
public void onApiConnected() {
       Drone drone = getDrone();
       if(drone.isConnected())
	    selectActionsBar(drone.getType().getDroneType());
       else{
           selectActionsBar(-1);
       }
	getBroadcastManager().registerReceiver(eventReceiver, eventFilter);
}
 
开发者ID:jiaminghan,项目名称:droidplanner-master,代码行数:11,代码来源:FlightActionsFragment.java

示例9: onReceive

import com.o3dr.android.client.Drone; //导入方法依赖的package包/类
@Override
public void onReceive(Context context, Intent intent) {
    final String action = intent.getAction();
    switch (action) {
        case AttributeEvent.GPS_POSITION:
            if (mPanMode.get() == AutoPanMode.DRONE) {
                final Drone drone = getDroneApi();
                if (!drone.isConnected())
                    return;

                final Gps droneGps = drone.getAttribute(AttributeType.GPS);
                if (droneGps != null && droneGps.isValid()) {
                    final LatLong droneLocation = droneGps.getPosition();
                    updateCamera(droneLocation);
                }
            }
            break;
        case SettingsFragment.ACTION_MAP_ROTATION_PREFERENCE_UPDATED:
            setupMapUI(getBaiduMap());
            break;
        case com.baidu.mapapi.SDKInitializer.SDK_BROADTCAST_ACTION_STRING_PERMISSION_CHECK_ERROR:
            Toast.makeText(getActivity().getApplicationContext(),
                    R.string.baidu_map_sdk_initializer_permission_error_message, Toast.LENGTH_LONG).show();
            break;
        case com.baidu.mapapi.SDKInitializer.SDK_BROADCAST_ACTION_STRING_NETWORK_ERROR:
            Toast.makeText(getActivity().getApplicationContext(),
                    R.string.baidu_map_sdk_initializer_network_error_message, Toast.LENGTH_LONG).show();
            break;
    }
}
 
开发者ID:mxiao6,项目名称:Tower-develop,代码行数:31,代码来源:BaiduMapFragment.java

示例10: onScrollingEnded

import com.o3dr.android.client.Drone; //导入方法依赖的package包/类
@Override
public void onScrollingEnded(CardWheelHorizontalView cardWheel, LengthUnit startValue, LengthUnit endValue) {
    switch (cardWheel.getId()) {
        case R.id.altitude_spinner:
            final Drone drone = getDrone();
            if (drone.isConnected()) {
                ControlApi.getApi(drone).climbTo(endValue.toBase().getValue());
            }
            break;
    }
}
 
开发者ID:mxiao6,项目名称:Tower-develop,代码行数:12,代码来源:ModeGuidedFragment.java

示例11: updateItemView

import com.o3dr.android.client.Drone; //导入方法依赖的package包/类
@Override
public void updateItemView(Context context, Drone drone) {

	if (mItemView == null)
		return;

	String infoUpdate;
          Battery droneBattery;
	if (drone == null || !drone.isConnected() || ((droneBattery = drone.getBattery()) ==
                  null)) {
		infoUpdate = sDefaultValue;
		currentView.setText(sDefaultValue);
		mAhView.setText(sDefaultValue);
	} else {

              Double discharge = droneBattery.getBatteryDischarge();
              String dischargeText;
              if (discharge == null) {
                  dischargeText = sDefaultValue;
              }else{
                  dischargeText = String.format(Locale.ENGLISH, "%2.0f mAh", discharge);
              }

              mAhView.setText(String.format(Locale.ENGLISH,"Remaining %2.0f%%", droneBattery.getBatteryRemain()));
              currentView.setText(String.format("Current %2.1f A", droneBattery.getBatteryCurrent()));

              infoUpdate = String.format(Locale.ENGLISH,"%2.1fv\n", droneBattery.getBatteryVoltage());
              infoUpdate = infoUpdate.concat(dischargeText);
	}

	mPopup.update();
	((TextView) mItemView).setText(infoUpdate);
}
 
开发者ID:jiaminghan,项目名称:droidplanner-master,代码行数:34,代码来源:InfoBarItem.java

示例12: onItemSelected

import com.o3dr.android.client.Drone; //导入方法依赖的package包/类
@Override
public void onItemSelected(AdapterView<?> parent, View view, int position, long id) {
    final FollowType type = adapter.getItem(position);

    getAppPrefs().setLastKnownFollowType(type);

    final Drone drone = getDrone();
    if (drone.isConnected()) {
        FollowApi.getApi(drone).enableFollowMe(type);
    }
}
 
开发者ID:mxiao6,项目名称:Tower-develop,代码行数:12,代码来源:ModeFollowFragment.java

示例13: onReceive

import com.o3dr.android.client.Drone; //导入方法依赖的package包/类
@Override
public void onReceive(Context context, Intent intent) {
    final String action = intent.getAction();
    switch (action) {
        case AttributeEvent.PARAMETERS_REFRESH_STARTED:
            startProgress();
            break;

        case AttributeEvent.PARAMETERS_REFRESH_COMPLETED:
            stopProgress();
            /*** FALL - THROUGH ***/
        case AttributeEvent.STATE_CONNECTED:
        case AttributeEvent.TYPE_UPDATED:
            final Drone drone = getDrone();
            if (drone != null && drone.isConnected()) {
                final Parameters droneParams = drone.getAttribute(AttributeType.PARAMETERS);
                loadAdapter(droneParams.getParameters(), false);
            }
            break;

        case AttributeEvent.PARAMETER_RECEIVED:
            final int defaultValue = -1;
            int index = intent.getIntExtra(AttributeEventExtra.EXTRA_PARAMETER_INDEX, defaultValue);
            int count = intent.getIntExtra(AttributeEventExtra.EXTRA_PARAMETERS_COUNT, defaultValue);

            if (index != defaultValue && count != defaultValue)
                updateProgress(index, count);
            break;

        case AttributeEvent.STATE_DISCONNECTED:
            stopProgress();
            break;
    }
}
 
开发者ID:mxiao6,项目名称:Tower-develop,代码行数:35,代码来源:ParamsFragment.java

示例14: onApiConnected

import com.o3dr.android.client.Drone; //导入方法依赖的package包/类
@Override
public void onApiConnected() {
    final Drone drone = getDrone();
    if (drone.isConnected())
        showTelemBar();
    else
        hideTelemBar();

    updateAllTelem();
    getBroadcastManager().registerReceiver(eventReceiver, eventFilter);
}
 
开发者ID:mxiao6,项目名称:Tower-develop,代码行数:12,代码来源:ActionBarTelemFragment.java

示例15: onChanged

import com.o3dr.android.client.Drone; //导入方法依赖的package包/类
@Override
public void onChanged(CardWheelHorizontalView cardWheel, int oldValue, int newValue) {
	switch (cardWheel.getId()) {
	case R.id.altitude_spinner:
		final Drone drone = getDrone();
		if (drone.isConnected())
			drone.setGuidedAltitude(newValue);
		break;
	}
}
 
开发者ID:jiaminghan,项目名称:droidplanner-master,代码行数:11,代码来源:ModeGuidedFragment.java


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