本文整理汇总了Java中com.o3dr.android.client.Drone.changeVehicleMode方法的典型用法代码示例。如果您正苦于以下问题:Java Drone.changeVehicleMode方法的具体用法?Java Drone.changeVehicleMode怎么用?Java Drone.changeVehicleMode使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.o3dr.android.client.Drone
的用法示例。
在下文中一共展示了Drone.changeVehicleMode方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: onClick
import com.o3dr.android.client.Drone; //导入方法依赖的package包/类
@Override
public void onClick(View v) {
final Drone drone = getDrone();
HitBuilders.EventBuilder eventBuilder = new HitBuilders.EventBuilder()
.setCategory(GAUtils.Category.FLIGHT);
switch (v.getId()) {
case R.id.mc_connectBtn:
((SuperUI) getActivity()).toggleDroneConnection();
break;
case R.id.mc_homeBtn:
drone.changeVehicleMode(VehicleMode.PLANE_RTL);
eventBuilder.setAction(ACTION_FLIGHT_ACTION_BUTTON)
.setLabel(VehicleMode.PLANE_RTL.getLabel());
break;
case R.id.mc_pause:
if (drone.getFollowState().isEnabled()) {
drone.disableFollowMe();
}
drone.pauseAtCurrentLocation();
eventBuilder.setAction(ACTION_FLIGHT_ACTION_BUTTON).setLabel("Pause");
break;
case R.id.mc_autoBtn:
drone.changeVehicleMode(VehicleMode.PLANE_AUTO);
eventBuilder.setAction(ACTION_FLIGHT_ACTION_BUTTON)
.setLabel(VehicleMode.PLANE_AUTO.getLabel());
break;
case R.id.mc_follow:
if(drone.getFollowState().isEnabled())
drone.disableFollowMe();
else
drone.enableFollowMe(FollowType.LEASH);
break;
default:
eventBuilder = null;
break;
}
if (eventBuilder != null) {
GAUtils.sendEvent(eventBuilder);
}
}