本文整理汇总了Java中com.o3dr.services.android.lib.drone.property.GuidedState类的典型用法代码示例。如果您正苦于以下问题:Java GuidedState类的具体用法?Java GuidedState怎么用?Java GuidedState使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
GuidedState类属于com.o3dr.services.android.lib.drone.property包,在下文中一共展示了GuidedState类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: updateFlightModeButtons
import com.o3dr.services.android.lib.drone.property.GuidedState; //导入依赖的package包/类
private void updateFlightModeButtons() {
resetFlightModeButtons();
final Drone drone = getDrone();
final State droneState = drone.getAttribute(AttributeType.STATE);
final VehicleMode flightMode = droneState.getVehicleMode();
if (flightMode != null) {
switch (flightMode) {
case PLANE_AUTO:
autoBtn.setActivated(true);
break;
case PLANE_GUIDED:
final GuidedState guidedState = drone.getAttribute(AttributeType.GUIDED_STATE);
final FollowState followState = drone.getAttribute(AttributeType.FOLLOW_STATE);
if (guidedState.isInitialized() && !followState.isEnabled()) {
pauseBtn.setActivated(true);
}
break;
case PLANE_RTL:
homeBtn.setActivated(true);
break;
}
}
}
开发者ID:mxiao6,项目名称:Tower-develop,代码行数:27,代码来源:PlaneFlightControlFragment.java
示例2: onApiConnected
import com.o3dr.services.android.lib.drone.property.GuidedState; //导入依赖的package包/类
@Override
public void onApiConnected() {
final Drone drone = getDrone();
if (mAltitudeWheel != null) {
GuidedState guidedState = drone.getAttribute(AttributeType.GUIDED_STATE);
LatLongAlt coordinate = guidedState == null ? null : guidedState.getCoordinate();
final LengthUnit initialValue = getLengthUnitProvider().boxBaseValueToTarget(
Math.max(guidedState == null
? DEFAULT_ALTITUDE
: coordinate == null ? DEFAULT_ALTITUDE : coordinate.getAltitude(),
DEFAULT_ALTITUDE));
mAltitudeWheel.setCurrentValue(initialValue);
}
parentActivity.setGuidedClickListener(this);
Type droneType = drone.getAttribute(AttributeType.TYPE);
if(droneType.getDroneType() == Type.TYPE_ROVER){
mAltitudeWheel.setVisibility(View.GONE);
}
else{
mAltitudeWheel.setVisibility(View.VISIBLE);
}
}
开发者ID:sommishra,项目名称:DroidPlanner-Tower,代码行数:26,代码来源:ModeGuidedFragment.java
示例3: handleIntent
import com.o3dr.services.android.lib.drone.property.GuidedState; //导入依赖的package包/类
private void handleIntent(Intent intent){
if(intent == null)
return;
radiusType = intent.getIntExtra(FollowMeRadiusFragment.EXTRA_RADIUS_TYPE, FollowMeRadiusFragment.VERTICAL_RADIUS_TYPE);
final int currentRadius;
switch (radiusType) {
case FollowMeRadiusFragment.HORIZONTAL_RADIUS_TYPE:
WearFollowState followState = intent.getParcelableExtra(WearUIActivity.EXTRA_VEHICLE_FOLLOW_STATE);
currentRadius = (int) followState.getRadius();
break;
case FollowMeRadiusFragment.VERTICAL_RADIUS_TYPE:
default:
GuidedState guidedState = intent.getParcelableExtra(WearUIActivity.EXTRA_GUIDED_STATE);
currentRadius = (int) guidedState.getCoordinate().getAltitude();
break;
}
final int radiusPosition = Math.max(0, currentRadius - FollowMeRadiusAdapter.MIN_RADIUS);
updateSelectorPosition(UnitManager.getUnitSystem(appPrefs.getUnitSystemType()).getLengthUnitProvider(),
radiusPosition);
}
开发者ID:DroidPlanner,项目名称:tower-wear,代码行数:24,代码来源:FollowMeRadiusSelector.java
示例4: onApiConnected
import com.o3dr.services.android.lib.drone.property.GuidedState; //导入依赖的package包/类
@Override
public void onApiConnected() {
final Drone drone = getDrone();
if (mAltitudeWheel != null) {
final DroidPlannerPrefs dpPrefs = getAppPrefs();
final double maxAlt = dpPrefs.getMaxAltitude();
final double minAlt = dpPrefs.getMinAltitude();
final double defaultAlt = dpPrefs.getDefaultAltitude();
GuidedState guidedState = drone.getAttribute(AttributeType.GUIDED_STATE);
LatLongAlt coordinate = guidedState == null ? null : guidedState.getCoordinate();
final double baseValue = Math.min(maxAlt,
Math.max(minAlt, coordinate == null ? defaultAlt : coordinate.getAltitude()));
final LengthUnit initialValue = getLengthUnitProvider().boxBaseValueToTarget(baseValue);
mAltitudeWheel.setCurrentValue(initialValue);
}
parent.setGuidedClickListener(this);
Type droneType = drone.getAttribute(AttributeType.TYPE);
if (droneType.getDroneType() == Type.TYPE_ROVER) {
mAltitudeWheel.setVisibility(View.GONE);
} else {
mAltitudeWheel.setVisibility(View.VISIBLE);
}
}
开发者ID:mxiao6,项目名称:Tower-develop,代码行数:29,代码来源:ModeGuidedFragment.java
示例5: onMapLongClick
import com.o3dr.services.android.lib.drone.property.GuidedState; //导入依赖的package包/类
@Override
public void onMapLongClick(LatLong coord) {
if (drone != null && drone.isConnected()) {
final GuidedState guidedState = drone.getAttribute(AttributeType.GUIDED_STATE);
if (guidedState.isInitialized()) {
if(guidedClickListener != null)
guidedClickListener.onGuidedClick(coord);
} else {
GuidedDialog dialog = new GuidedDialog();
dialog.setCoord(MapUtils.coordToLatLng(coord));
dialog.setListener(this);
dialog.show(getChildFragmentManager(), "GUIDED dialog");
}
}
}
开发者ID:mxiao6,项目名称:Tower-develop,代码行数:16,代码来源:FlightMapFragment.java
示例6: getPathPoints
import com.o3dr.services.android.lib.drone.property.GuidedState; //导入依赖的package包/类
@Override
public List<LatLong> getPathPoints() {
List<LatLong> path = new ArrayList<LatLong>();
GuidedState guidedPoint = drone.getAttribute(AttributeType.GUIDED_STATE);
if (guidedPoint != null && guidedPoint.isActive()) {
Gps gps = drone.getAttribute(AttributeType.GPS);
if (gps != null && gps.isValid()) {
path.add(gps.getPosition());
}
path.add(guidedPoint.getCoordinate());
}
return path;
}
开发者ID:mxiao6,项目名称:Tower-develop,代码行数:14,代码来源:GraphicGuided.java
示例7: onApiConnected
import com.o3dr.services.android.lib.drone.property.GuidedState; //导入依赖的package包/类
@Override
public void onApiConnected() {
if (mAltitudeWheel != null) {
GuidedState guidedState = getDrone().getGuidedState();
final int initialValue = (int) Math.max(guidedState == null
? DEFAULT_ALTITUDE
: guidedState.getCoordinate().getAltitude(),
DEFAULT_ALTITUDE);
mAltitudeWheel.setCurrentValue(initialValue);
}
}
开发者ID:jiaminghan,项目名称:droidplanner-master,代码行数:13,代码来源:ModeGuidedFragment.java
示例8: getGuidedState
import com.o3dr.services.android.lib.drone.property.GuidedState; //导入依赖的package包/类
private GuidedState getGuidedState() {
final GuidedPoint guidedPoint = this.droneMgr.getDrone().getGuidedPoint();
int guidedState;
switch (guidedPoint.getState()) {
default:
case UNINITIALIZED:
guidedState = GuidedState.STATE_UNINITIALIZED;
break;
case ACTIVE:
guidedState = GuidedState.STATE_ACTIVE;
break;
case IDLE:
guidedState = GuidedState.STATE_IDLE;
break;
}
Coord2D guidedCoord = guidedPoint.getCoord() == null
? new Coord2D(0, 0)
: guidedPoint.getCoord();
double guidedAlt = guidedPoint.getAltitude() == null
? 0
: guidedPoint.getAltitude().valueInMeters();
return new GuidedState(guidedState, new LatLongAlt(guidedCoord.getLat(),
guidedCoord.getLng(), guidedAlt));
}
开发者ID:jiaminghan,项目名称:droidplanner-master,代码行数:28,代码来源:DroneApi.java
示例9: getPathPoints
import com.o3dr.services.android.lib.drone.property.GuidedState; //导入依赖的package包/类
@Override
public List<LatLong> getPathPoints() {
List<LatLong> path = new ArrayList<LatLong>();
GuidedState guidedPoint = drone.getGuidedState();
if (guidedPoint != null && guidedPoint.isActive()) {
Gps gps = drone.getGps();
if (gps != null && gps.isValid()) {
path.add(gps.getPosition());
}
path.add(guidedPoint.getCoordinate());
}
return path;
}
开发者ID:jiaminghan,项目名称:droidplanner-master,代码行数:14,代码来源:GraphicGuided.java
示例10: updateFlightModeButtons
import com.o3dr.services.android.lib.drone.property.GuidedState; //导入依赖的package包/类
private void updateFlightModeButtons() {
resetFlightModeButtons();
State droneState = getDrone().getAttribute(AttributeType.STATE);
if (droneState == null)
return;
final VehicleMode flightMode = droneState.getVehicleMode();
if (flightMode == null)
return;
switch (flightMode) {
case COPTER_AUTO:
autoBtn.setActivated(true);
break;
case COPTER_GUIDED:
final Drone drone = getDrone();
final GuidedState guidedState = drone.getAttribute(AttributeType.GUIDED_STATE);
final FollowState followState = drone.getAttribute(AttributeType.FOLLOW_STATE);
if (guidedState.isInitialized() && !followState.isEnabled()) {
pauseBtn.setActivated(true);
}
break;
case COPTER_RTL:
homeBtn.setActivated(true);
break;
case COPTER_LAND:
landBtn.setActivated(true);
break;
default:
break;
}
}
开发者ID:sommishra,项目名称:DroidPlanner-Tower,代码行数:37,代码来源:CopterFlightControlFragment.java
示例11: onMapLongClick
import com.o3dr.services.android.lib.drone.property.GuidedState; //导入依赖的package包/类
@Override
public void onMapLongClick(LatLong coord) {
if (drone != null && drone.isConnected()) {
final GuidedState guidedState = drone.getAttribute(AttributeType.GUIDED_STATE);
if (guidedState.isInitialized()) {
if(guidedClickListener != null)
guidedClickListener.onGuidedClick(coord);
} else {
GuidedDialog dialog = new GuidedDialog();
dialog.setCoord(DroneHelper.CoordToLatLang(coord));
dialog.setListener(this);
dialog.show(getChildFragmentManager(), "GUIDED dialog");
}
}
}
开发者ID:sommishra,项目名称:DroidPlanner-Tower,代码行数:16,代码来源:FlightMapFragment.java
示例12: onVehicleDataUpdated
import com.o3dr.services.android.lib.drone.property.GuidedState; //导入依赖的package包/类
@Override
protected void onVehicleDataUpdated(String dataType, byte[] eventData) {
switch (dataType) {
case AttributeType.STATE:
vehicleState = eventData == null ? null : ParcelableUtils.unmarshall(eventData, State.CREATOR);
final boolean isFollowMeReady = vehicleState != null && vehicleState.isConnected()
&& vehicleState.isArmed() && vehicleState.isFlying();
if (!isFollowMeReady)
finish();
else {
gridView.setKeepScreenOn(appPrefs.keepScreenBright());
}
broadcastManager.sendBroadcast(new Intent(dataType).putExtra(EXTRA_VEHICLE_STATE, vehicleState));
break;
case AttributeType.FOLLOW_STATE:
followState = eventData == null ? null : ParcelableUtils.unmarshall(eventData,
WearFollowState.CREATOR);
broadcastManager.sendBroadcast(new Intent(dataType).putExtra(EXTRA_VEHICLE_FOLLOW_STATE, followState));
break;
case AttributeType.GUIDED_STATE:
guidedState = eventData == null ? null : ParcelableUtils.unmarshall(eventData,
GuidedState.CREATOR);
broadcastManager.sendBroadcast(new Intent(dataType).putExtra(EXTRA_GUIDED_STATE, guidedState));
break;
}
}
开发者ID:DroidPlanner,项目名称:tower-wear,代码行数:29,代码来源:WearUIActivity.java
示例13: isVisible
import com.o3dr.services.android.lib.drone.property.GuidedState; //导入依赖的package包/类
@Override
public boolean isVisible() {
GuidedState guidedPoint = drone.getAttribute(AttributeType.GUIDED_STATE);
return guidedPoint != null && guidedPoint.isActive();
}
开发者ID:mxiao6,项目名称:Tower-develop,代码行数:6,代码来源:GraphicGuided.java
示例14: getPosition
import com.o3dr.services.android.lib.drone.property.GuidedState; //导入依赖的package包/类
@Override
public LatLong getPosition() {
GuidedState guidedPoint = drone.getAttribute(AttributeType.GUIDED_STATE);
return guidedPoint == null ? null : guidedPoint.getCoordinate();
}
开发者ID:mxiao6,项目名称:Tower-develop,代码行数:6,代码来源:GraphicGuided.java
示例15: isVisible
import com.o3dr.services.android.lib.drone.property.GuidedState; //导入依赖的package包/类
@Override
public boolean isVisible() {
GuidedState guidedPoint = drone.getGuidedState();
return guidedPoint != null && guidedPoint.isActive();
}
开发者ID:jiaminghan,项目名称:droidplanner-master,代码行数:6,代码来源:GraphicGuided.java
示例16: getPosition
import com.o3dr.services.android.lib.drone.property.GuidedState; //导入依赖的package包/类
@Override
public LatLong getPosition() {
GuidedState guidedPoint = drone.getGuidedState();
return guidedPoint == null ? null : guidedPoint.getCoordinate();
}
开发者ID:jiaminghan,项目名称:droidplanner-master,代码行数:6,代码来源:GraphicGuided.java
示例17: getGuidedState
import com.o3dr.services.android.lib.drone.property.GuidedState; //导入依赖的package包/类
public GuidedState getGuidedState() {
GuidedState guidedState = getAttribute(AttributeType.GUIDED_STATE,
GuidedState.class.getClassLoader());
return guidedState == null ? new GuidedState() : guidedState;
}
开发者ID:jiaminghan,项目名称:droidplanner-master,代码行数:6,代码来源:Drone.java
示例18: sendDataToWatchNow
import com.o3dr.services.android.lib.drone.property.GuidedState; //导入依赖的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
*/
private void sendDataToWatchNow(Drone drone) {
final FollowState followState = drone.getAttribute(AttributeType.FOLLOW_STATE);
final State droneState = drone.getAttribute(AttributeType.STATE);
if (followState == null || droneState == null)
return;
PebbleDictionary data = new PebbleDictionary();
VehicleMode mode = droneState.getVehicleMode();
if (mode == null)
return;
final GuidedState guidedState = drone.getAttribute(AttributeType.GUIDED_STATE);
String modeLabel = mode.getLabel();
if (!droneState.isArmed())
modeLabel = "Disarmed";
else if (followState.isEnabled())
modeLabel = "Follow";
else if (guidedState.isInitialized() && !followState.isEnabled())
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");
final Battery droneBattery = drone.getAttribute(AttributeType.BATTERY);
Double battVoltage = droneBattery.getBatteryVoltage();
if (battVoltage == null)
battVoltage = 0.0;
String bat = "Bat: " + Double.toString((double) Math.round(battVoltage * 10) / 10) + "V";
final Altitude droneAltitude = drone.getAttribute(AttributeType.ALTITUDE);
String altitude = "Alt: " + roundToTwoDigits(droneAltitude.getAltitude()) + "m";
String telem = bat + "\n" + altitude;
data.addString(KEY_TELEM, telem);
data.addString(KEY_APP_VERSION, EXPECTED_APP_VERSION);
PebbleKit.sendDataToPebble(applicationContext, DP_UUID, data);
}
开发者ID:DroidPlanner,项目名称:tower-pebble,代码行数:52,代码来源:PebbleCommunicatorService.java
示例19: getVehicleGuidedState
import com.o3dr.services.android.lib.drone.property.GuidedState; //导入依赖的package包/类
protected GuidedState getVehicleGuidedState(){
return parentActivity.getGuidedState();
}
开发者ID:DroidPlanner,项目名称:tower-wear,代码行数:4,代码来源:BaseActionFragment.java
示例20: getGuidedState
import com.o3dr.services.android.lib.drone.property.GuidedState; //导入依赖的package包/类
public GuidedState getGuidedState() {
return guidedState;
}
开发者ID:DroidPlanner,项目名称:tower-wear,代码行数:4,代码来源:WearUIActivity.java
注:本文中的com.o3dr.services.android.lib.drone.property.GuidedState类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论