本文整理汇总了Java中com.o3dr.services.android.lib.gcs.follow.FollowState类的典型用法代码示例。如果您正苦于以下问题:Java FollowState类的具体用法?Java FollowState怎么用?Java FollowState使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
FollowState类属于com.o3dr.services.android.lib.gcs.follow包,在下文中一共展示了FollowState类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: updateFollowButton
import com.o3dr.services.android.lib.gcs.follow.FollowState; //导入依赖的package包/类
private void updateFollowButton() {
FollowState followState = getDrone().getAttribute(AttributeType.FOLLOW_STATE);
if (followState == null)
return;
switch (followState.getState()) {
case FollowState.STATE_START:
followBtn.setBackgroundColor(orangeColor);
break;
case FollowState.STATE_RUNNING:
followBtn.setActivated(true);
followBtn.setBackgroundResource(R.drawable.flight_action_row_bg_selector);
break;
default:
followBtn.setActivated(false);
followBtn.setBackgroundResource(R.drawable.flight_action_row_bg_selector);
break;
}
}
示例2: updateFollowButton
import com.o3dr.services.android.lib.gcs.follow.FollowState; //导入依赖的package包/类
private void updateFollowButton() {
final FollowState followState = getDrone().getAttribute(AttributeType.FOLLOW_STATE);
if (followState == null)
return;
switch (followState.getState()) {
case FollowState.STATE_START:
followBtn.setBackgroundColor(orangeColor);
break;
case FollowState.STATE_RUNNING:
followBtn.setActivated(true);
followBtn.setBackgroundResource(R.drawable.flight_action_row_bg_selector);
break;
default:
followBtn.setActivated(false);
followBtn.setBackgroundResource(R.drawable.flight_action_row_bg_selector);
break;
}
}
示例3: updateFlightModeButtons
import com.o3dr.services.android.lib.gcs.follow.FollowState; //导入依赖的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;
}
}
}
示例4: onGuidedClick
import com.o3dr.services.android.lib.gcs.follow.FollowState; //导入依赖的package包/类
@Override
public void onGuidedClick(LatLong coord) {
final Drone drone = getDrone();
final FollowState followState = drone.getAttribute(AttributeType.FOLLOW_STATE);
if (followState != null && followState.isEnabled() && followState.getMode().hasParam(FollowType.EXTRA_FOLLOW_ROI_TARGET)) {
Toast.makeText(getContext(), R.string.guided_scan_roi_set_message, Toast.LENGTH_LONG).show();
final double roiHeight = roiHeightWheel.getCurrentValue().toBase().getValue();
final LatLongAlt roiCoord = new LatLongAlt(coord.getLatitude(), coord.getLongitude(), roiHeight);
pushROITargetToVehicle(drone, roiCoord);
updateROITargetMarker(coord);
} else {
super.onGuidedClick(coord);
}
}
示例5: updateFollowButton
import com.o3dr.services.android.lib.gcs.follow.FollowState; //导入依赖的package包/类
private void updateFollowButton() {
FollowState followState = getDrone().getFollowState();
if(followState == null)
return;
switch (followState.getState()) {
case FollowState.STATE_START:
followBtn.setBackgroundColor(Color.RED);
break;
case FollowState.STATE_RUNNING:
followBtn.setActivated(true);
followBtn.setBackgroundResource(R.drawable.flight_action_row_bg_selector);
break;
default:
followBtn.setActivated(false);
followBtn.setBackgroundResource(R.drawable.flight_action_row_bg_selector);
break;
}
}
示例6: toggleFollowMe
import com.o3dr.services.android.lib.gcs.follow.FollowState; //导入依赖的package包/类
protected void toggleFollowMe() {
final Drone drone = getDrone();
if (drone == null)
return;
final FollowState followState = drone.getAttribute(AttributeType.FOLLOW_STATE);
if (followState.isEnabled()) {
FollowApi.getApi(drone).disableFollowMe();
} else {
enableFollowMe(drone);
}
}
示例7: onReceive
import com.o3dr.services.android.lib.gcs.follow.FollowState; //导入依赖的package包/类
@Override
public void onReceive(Context context, Intent intent) {
final String action = intent.getAction();
switch (action) {
case AttributeEvent.FOLLOW_UPDATE:
final FollowState followState = getDrone().getAttribute(AttributeType.FOLLOW_STATE);
if (followState != null) {
final FollowType followType = followState.getMode();
onFollowTypeUpdate(followType, followState.getParams());
}
break;
}
}
示例8: onApiConnected
import com.o3dr.services.android.lib.gcs.follow.FollowState; //导入依赖的package包/类
@Override
public void onApiConnected() {
super.onApiConnected();
final FollowState followState = getDrone().getAttribute(AttributeType.FOLLOW_STATE);
if (followState != null) {
final FollowType followType = followState.getMode();
onFollowTypeUpdate(followType, followState.getParams());
}
parent.addMarker(roiMarkerInfo);
getBroadcastManager().registerReceiver(eventReceiver, eventFilter);
}
示例9: receiveData
import com.o3dr.services.android.lib.gcs.follow.FollowState; //导入依赖的package包/类
@Override
public void receiveData(Context context, int transactionId, PebbleDictionary data) {
FollowState followMe = dpApi.getFollowState();
if(followMe == null)
return ;
PebbleKit.sendAckToPebble(applicationContext, transactionId);
int request = (data.getInteger(KEY_PEBBLE_REQUEST).intValue());
switch (request) {
case KEY_REQUEST_MODE_FOLLOW:
if(followMe.isEnabled()){
dpApi.disableFollowMe();
}
else {
dpApi.enableFollowMe(followMe.getMode());
}
break;
case KEY_REQUEST_CYCLE_FOLLOW_TYPE:
List<FollowType> followTypes = Arrays.asList(FollowType.values());
int currentTypeIndex = followTypes.indexOf(followMe.getMode());
int nextTypeIndex = currentTypeIndex++ % followTypes.size();
dpApi.enableFollowMe(followTypes.get(nextTypeIndex));
break;
case KEY_REQUEST_PAUSE:
dpApi.pauseAtCurrentLocation();
break;
case KEY_REQUEST_MODE_RTL:
dpApi.changeVehicleMode(VehicleMode.COPTER_RTL);
break;
}
}
示例10: onReceive
import com.o3dr.services.android.lib.gcs.follow.FollowState; //导入依赖的package包/类
@Override
public void onReceive(Context context, Intent intent) {
final String action = intent.getAction();
if (AttributeEvent.FOLLOW_UPDATE.equals(action)) {
final FollowState followState = getDrone().getFollowState();
if (followState != null) {
spinner.setSelection(adapter.getPosition(followState.getMode()));
}
}
}
示例11: updateFollowButton
import com.o3dr.services.android.lib.gcs.follow.FollowState; //导入依赖的package包/类
private void updateFollowButton() {
switch (getDrone().getFollowState().getState()) {
case FollowState.STATE_START:
followBtn.setBackgroundColor(Color.RED);
break;
case FollowState.STATE_RUNNING:
followBtn.setActivated(true);
followBtn.setBackgroundResource(R.drawable.flight_action_row_bg_selector);
break;
default:
followBtn.setActivated(false);
followBtn.setBackgroundResource(R.drawable.flight_action_row_bg_selector);
break;
}
}
示例12: getFollowState
import com.o3dr.services.android.lib.gcs.follow.FollowState; //导入依赖的package包/类
private FollowState getFollowState() {
final Follow followMe = this.droneMgr.getFollowMe();
final double radius = followMe.getRadius().valueInMeters();
final int state;
switch (followMe.getState()) {
default:
case FOLLOW_INVALID_STATE:
state = FollowState.STATE_INVALID;
break;
case FOLLOW_DRONE_NOT_ARMED:
state = FollowState.STATE_DRONE_NOT_ARMED;
break;
case FOLLOW_DRONE_DISCONNECTED:
state = FollowState.STATE_DRONE_DISCONNECTED;
break;
case FOLLOW_START:
state = FollowState.STATE_START;
break;
case FOLLOW_RUNNING:
state = FollowState.STATE_RUNNING;
break;
case FOLLOW_END:
state = FollowState.STATE_END;
break;
}
return new FollowState(state, radius, followModeToType(followMe.getType()));
}
示例13: updateFlightModeButtons
import com.o3dr.services.android.lib.gcs.follow.FollowState; //导入依赖的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;
}
}
示例14: onReceive
import com.o3dr.services.android.lib.gcs.follow.FollowState; //导入依赖的package包/类
@Override
public void onReceive(Context context, Intent intent) {
final String action = intent.getAction();
if (AttributeEvent.FOLLOW_UPDATE.equals(action)) {
final FollowState followState = getDrone().getAttribute(AttributeType.FOLLOW_STATE);
if (followState != null) {
final FollowType followType = followState.getMode();
spinner.setSelection(adapter.getPosition(followType));
onFollowTypeUpdate(followType, followState.getParams());
}
}
}
示例15: onApiConnected
import com.o3dr.services.android.lib.gcs.follow.FollowState; //导入依赖的package包/类
@Override
public void onApiConnected() {
super.onApiConnected();
final FollowState followState = getDrone().getAttribute(AttributeType.FOLLOW_STATE);
if (followState != null) {
final FollowType followType = followState.getMode();
spinner.setSelection(adapter.getPosition(followType));
onFollowTypeUpdate(followType, followState.getParams());
}
parentActivity.addMapMarkerProvider(this);
getBroadcastManager().registerReceiver(eventReceiver, eventFilter);
}