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


Java FollowState类代码示例

本文整理汇总了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;
    }
}
 
开发者ID:mxiao6,项目名称:Tower-develop,代码行数:22,代码来源:CopterFlightControlFragment.java

示例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;
    }
}
 
开发者ID:mxiao6,项目名称:Tower-develop,代码行数:20,代码来源:PlaneFlightControlFragment.java

示例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;
        }
    }
}
 
开发者ID:mxiao6,项目名称:Tower-develop,代码行数:27,代码来源:PlaneFlightControlFragment.java

示例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);
    }
}
 
开发者ID:mxiao6,项目名称:Tower-develop,代码行数:17,代码来源:ModeFollowFragment.java

示例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;
    }
}
 
开发者ID:jiaminghan,项目名称:droidplanner-master,代码行数:22,代码来源:CopterFlightActionsFragment.java

示例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);
    }
}
 
开发者ID:mxiao6,项目名称:Tower-develop,代码行数:13,代码来源:BaseFlightControlFragment.java

示例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;
    }
}
 
开发者ID:mxiao6,项目名称:Tower-develop,代码行数:14,代码来源:ModeFollowFragment.java

示例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);
}
 
开发者ID:mxiao6,项目名称:Tower-develop,代码行数:14,代码来源:ModeFollowFragment.java

示例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;
	}
}
 
开发者ID:jiaminghan,项目名称:droidplanner-master,代码行数:35,代码来源:PebbleNotificationProvider.java

示例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()));
		}
	}
}
 
开发者ID:jiaminghan,项目名称:droidplanner-master,代码行数:11,代码来源:ModeFollowFragment.java

示例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;
	}
}
 
开发者ID:jiaminghan,项目名称:droidplanner-master,代码行数:16,代码来源:PlaneFlightActionsFragment.java

示例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()));
}
 
开发者ID:jiaminghan,项目名称:droidplanner-master,代码行数:36,代码来源:DroneApi.java

示例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;
    }
}
 
开发者ID:sommishra,项目名称:DroidPlanner-Tower,代码行数:37,代码来源:CopterFlightControlFragment.java

示例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());
        }
    }
}
 
开发者ID:sommishra,项目名称:DroidPlanner-Tower,代码行数:13,代码来源:ModeFollowFragment.java

示例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);
}
 
开发者ID:sommishra,项目名称:DroidPlanner-Tower,代码行数:15,代码来源:ModeFollowFragment.java


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