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


Java Drone.getState方法代码示例

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


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

示例1: onApiConnected

import com.o3dr.android.client.Drone; //导入方法依赖的package包/类
@Override
public void onApiConnected() {
    Drone drone = dpApp.getDrone();
    State droneState = drone.getState();
    Type droneType = drone.getType();
    final int mavlinkVersion = droneState == null
            ? State.INVALID_MAVLINK_VERSION
            : droneState.getMavlinkVersion();

    if (mavlinkVersion != State.INVALID_MAVLINK_VERSION) {
        updateMavlinkVersionPreference(String.valueOf(mavlinkVersion));
    } else {
        updateMavlinkVersionPreference(null);
    }

    String firmwareVersion = droneType == null ? null : droneType.getFirmwareVersion();
    updateFirmwareVersionPreference(firmwareVersion);

    LocalBroadcastManager.getInstance(getActivity().getApplicationContext()).registerReceiver(
            broadcastReceiver, intentFilter);
}
 
开发者ID:jiaminghan,项目名称:droidplanner-master,代码行数:22,代码来源:SettingsFragment.java

示例2: 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

示例3: updateFlightMode

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

       State droneState = drone.getState();
       VehicleMode mode = droneState == null ? null : droneState.getVehicleMode();
       String update = mode == null ? "--" : mode.getLabel();
	final CharSequence modeSummary = SpannableUtils.normal("Flight Mode:  ", SpannableUtils.bold(update));
	mNotificationBuilder.setContentTitle(modeSummary);
}
 
开发者ID:jiaminghan,项目名称:droidplanner-master,代码行数:11,代码来源:StatusBarNotificationProvider.java

示例4: isSlidingUpPanelEnabled

import com.o3dr.android.client.Drone; //导入方法依赖的package包/类
@Override
public boolean isSlidingUpPanelEnabled(Drone api) {
    if(!api.isConnected())
        return false;

    final State droneState = api.getState();
    return droneState.isArmed() && droneState.isFlying();
}
 
开发者ID:jiaminghan,项目名称:droidplanner-master,代码行数:9,代码来源:CopterFlightActionsFragment.java

示例5: sendDataToWatchNow

import com.o3dr.android.client.Drone; //导入方法依赖的package包/类
/**
 * Sends a full dictionary with updated information when called. If no
 * pebble is present, the watchapp isn't installed, or the watchapp isn't
 * running, nothing will happen.
 * 
 * @param drone
 */
public void sendDataToWatchNow(Drone drone) {
       final FollowState followState = drone.getFollowState();
       final State droneState = drone.getState();
       if(followState == null || droneState == null)
           return;

	PebbleDictionary data = new PebbleDictionary();

	VehicleMode mode = droneState.getVehicleMode();
       if(mode == null)
           return;

       String modeLabel = mode.getLabel();
	if (!droneState.isArmed())
		modeLabel = "Disarmed";
	else if (followState.isEnabled())
		modeLabel = "Follow";
	else if (drone.getGuidedState().isIdle())
		modeLabel = "Paused";

	data.addString(KEY_MODE, modeLabel);

	FollowType type = followState.getMode();
	if (type != null) {
		data.addString(KEY_FOLLOW_TYPE, type.getTypeLabel());
	} else
		data.addString(KEY_FOLLOW_TYPE, "none");

       Double battVoltage = drone.getBattery().getBatteryVoltage();
       if(battVoltage != null)
           battVoltage = 0.0;
	String bat = "Bat:" + Double.toString(roundToOneDecimal(battVoltage))	+ "V";
	String speed = "Speed: " + Double.toString(roundToOneDecimal(
               drone.getSpeed().getAirSpeed()));
	String altitude = "Alt: "
			+ Double.toString(roundToOneDecimal(drone.getAltitude().getAltitude()));
	String telem = bat + "\n" + altitude + "\n" + speed;
	data.addString(KEY_TELEM, telem);

	data.addString(KEY_APP_VERSION, EXPECTED_APP_VERSION);

	PebbleKit.sendDataToPebble(applicationContext, DP_UUID, data);
}
 
开发者ID:jiaminghan,项目名称:droidplanner-master,代码行数:51,代码来源:PebbleNotificationProvider.java


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