• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java FollowState类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中com.o3dr.services.android.lib.gcs.follow.FollowState的典型用法代码示例。如果您正苦于以下问题:Java FollowState类的具体用法?Java FollowState怎么用?Java FollowState使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



FollowState类属于com.o3dr.services.android.lib.gcs.follow包,在下文中一共展示了FollowState类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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


示例16: handleIntent

import com.o3dr.services.android.lib.gcs.follow.FollowState; //导入依赖的package包/类
private void handleIntent(Intent intent) {
    if (intent == null)
        return;

    final FollowState followState = intent.getParcelableExtra(WearUIActivity.EXTRA_VEHICLE_FOLLOW_STATE);
    if (followState != null) {
        RecyclerView.LayoutManager layoutMgr = followTypesView.getLayoutManager();
        if (layoutMgr != null) {
            layoutMgr.scrollToPosition(adapter.getItemPosition(followState.getMode()));
        }
    }
}
 
开发者ID:DroidPlanner,项目名称:tower-wear,代码行数:13,代码来源:FollowMeTypesSelector.java


示例17: getDroneAttribute

import com.o3dr.services.android.lib.gcs.follow.FollowState; //导入依赖的package包/类
private byte[] getDroneAttribute(String attributeType) {
    Parcelable attribute = drone.getAttribute(attributeType);
    if (attribute instanceof FollowState) {
        attribute = new WearFollowState((FollowState) attribute);
    }

    return attribute == null ? null : ParcelableUtils.marshall(attribute);
}
 
开发者ID:DroidPlanner,项目名称:tower-wear,代码行数:9,代码来源:DroneService.java


示例18: 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.STATE_ARMING:
        case AttributeEvent.STATE_CONNECTED:
        case AttributeEvent.STATE_DISCONNECTED:
        case AttributeEvent.STATE_UPDATED:
            setupButtonsByFlightState();
            break;

        case AttributeEvent.STATE_VEHICLE_MODE:
            updateFlightModeButtons();
            break;

        case AttributeEvent.FOLLOW_START:
        case AttributeEvent.FOLLOW_STOP:
            final FollowState followState = getDrone().getAttribute(AttributeType.FOLLOW_STATE);
            if (followState != null) {
                String eventLabel = null;
                switch (followState.getState()) {
                    case FollowState.STATE_START:
                        eventLabel = "FollowMe enabled";
                        break;

                    case FollowState.STATE_RUNNING:
                        eventLabel = "FollowMe running";
                        break;

                    case FollowState.STATE_END:
                        eventLabel = "FollowMe disabled";
                        break;

                    case FollowState.STATE_INVALID:
                        eventLabel = "FollowMe error: invalid state";
                        break;

                    case FollowState.STATE_DRONE_DISCONNECTED:
                        eventLabel = "FollowMe error: drone not connected";
                        break;

                    case FollowState.STATE_DRONE_NOT_ARMED:
                        eventLabel = "FollowMe error: drone not armed";
                        break;
                }

                if (eventLabel != null) {
                    HitBuilders.EventBuilder eventBuilder = new HitBuilders.EventBuilder()
                            .setCategory(GAUtils.Category.FLIGHT)
                            .setAction(ACTION_FLIGHT_ACTION_BUTTON)
                            .setLabel(eventLabel);
                    GAUtils.sendEvent(eventBuilder);

                    Toast.makeText(getActivity(), eventLabel, Toast.LENGTH_SHORT).show();
                }
            }

            /* FALL - THROUGH */
        case AttributeEvent.FOLLOW_UPDATE:
            updateFlightModeButtons();
            updateFollowButton();
            break;

        case AttributeEvent.MISSION_DRONIE_CREATED:
            //Get the bearing of the dronie mission.
            float bearing = intent.getFloatExtra(AttributeEventExtra.EXTRA_MISSION_DRONIE_BEARING, -1);
            if (bearing >= 0) {
                final FlightControlManagerFragment parent = (FlightControlManagerFragment) getParentFragment();
                if (parent != null) {
                    parent.updateMapBearing(bearing);
                }
            }
            break;
    }
}
 
开发者ID:mxiao6,项目名称:Tower-develop,代码行数:76,代码来源:CopterFlightControlFragment.java


示例19: onClick

import com.o3dr.services.android.lib.gcs.follow.FollowState; //导入依赖的package包/类
@Override
public void onClick(View v) {
    HitBuilders.EventBuilder eventBuilder = new HitBuilders.EventBuilder()
            .setCategory(GAUtils.Category.FLIGHT);

    final Drone drone = getDrone();
    switch (v.getId()) {
        case R.id.mc_connectBtn:
            ((SuperUI) getActivity()).toggleDroneConnection();
            break;

        case R.id.mc_armBtn:
            getArmingConfirmation();
            eventBuilder.setAction(ACTION_FLIGHT_ACTION_BUTTON).setLabel("Arm");
            break;

        case R.id.mc_disarmBtn:
            VehicleApi.getApi(drone).arm(false);
            eventBuilder.setAction(ACTION_FLIGHT_ACTION_BUTTON).setLabel("Disarm");
            break;

        case R.id.mc_land:
            VehicleApi.getApi(drone).setVehicleMode(VehicleMode.COPTER_LAND);
            eventBuilder.setAction(ACTION_FLIGHT_ACTION_BUTTON).setLabel(VehicleMode
                    .COPTER_LAND.getLabel());
            break;

        case R.id.mc_takeoff:
            getTakeOffConfirmation();
            eventBuilder.setAction(ACTION_FLIGHT_ACTION_BUTTON).setLabel("Takeoff");
            break;

        case R.id.mc_homeBtn:
            VehicleApi.getApi(drone).setVehicleMode(VehicleMode.COPTER_RTL);
            eventBuilder.setAction(ACTION_FLIGHT_ACTION_BUTTON).setLabel(VehicleMode.COPTER_RTL
                    .getLabel());
            break;

        case R.id.mc_pause: {
            final FollowState followState = drone.getAttribute(AttributeType.FOLLOW_STATE);
            if (followState.isEnabled()) {
                FollowApi.getApi(drone).disableFollowMe();
            }

            ControlApi.getApi(drone).pauseAtCurrentLocation(null);
            eventBuilder.setAction(ACTION_FLIGHT_ACTION_BUTTON).setLabel("Pause");
            break;
        }

        case R.id.mc_autoBtn:
            VehicleApi.getApi(drone).setVehicleMode(VehicleMode.COPTER_AUTO);
            eventBuilder.setAction(ACTION_FLIGHT_ACTION_BUTTON).setLabel(VehicleMode.COPTER_AUTO.getLabel());
            break;

        case R.id.mc_TakeoffInAutoBtn:
            getTakeOffInAutoConfirmation();
            eventBuilder.setAction(ACTION_FLIGHT_ACTION_BUTTON).setLabel(VehicleMode.COPTER_AUTO.getLabel());
            break;

        case R.id.mc_follow:
            toggleFollowMe();
            break;

        case R.id.mc_dronieBtn:
            getDronieConfirmation();
            eventBuilder.setAction(ACTION_FLIGHT_ACTION_BUTTON).setLabel("Dronie uploaded");
            break;

        default:
            eventBuilder = null;
            break;
    }

    if (eventBuilder != null) {
        GAUtils.sendEvent(eventBuilder);
    }

}
 
开发者ID:mxiao6,项目名称:Tower-develop,代码行数:79,代码来源:CopterFlightControlFragment.java


示例20: 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.STATE_ARMING:
        case AttributeEvent.STATE_CONNECTED:
        case AttributeEvent.STATE_DISCONNECTED:
        case AttributeEvent.STATE_UPDATED:
            setupButtonsByFlightState();
            break;

        case AttributeEvent.STATE_VEHICLE_MODE:
            updateFlightModeButtons();
            break;

        case AttributeEvent.FOLLOW_START:
        case AttributeEvent.FOLLOW_STOP:
            final FollowState followState = getDrone().getAttribute(AttributeType.FOLLOW_STATE);
            if (followState != null) {
                String eventLabel = null;
                switch (followState.getState()) {
                    case FollowState.STATE_START:
                        eventLabel = "FollowMe enabled";
                        break;

                    case FollowState.STATE_RUNNING:
                        eventLabel = "FollowMe running";
                        break;

                    case FollowState.STATE_END:
                        eventLabel = "FollowMe disabled";
                        break;

                    case FollowState.STATE_INVALID:
                        eventLabel = "FollowMe error: invalid state";
                        break;

                    case FollowState.STATE_DRONE_DISCONNECTED:
                        eventLabel = "FollowMe error: drone not connected";
                        break;

                    case FollowState.STATE_DRONE_NOT_ARMED:
                        eventLabel = "FollowMe error: drone not armed";
                        break;
                }

                if (eventLabel != null) {
                    HitBuilders.EventBuilder eventBuilder = new HitBuilders.EventBuilder()
                            .setCategory(GAUtils.Category.FLIGHT)
                            .setAction(ACTION_FLIGHT_ACTION_BUTTON)
                            .setLabel(eventLabel);
                    GAUtils.sendEvent(eventBuilder);

                    Toast.makeText(getActivity(), eventLabel, Toast.LENGTH_SHORT).show();
                }
            }

            /* FALL - THROUGH */
        case AttributeEvent.FOLLOW_UPDATE:
            updateFlightModeButtons();
            updateFollowButton();
            break;
    }
}
 
开发者ID:mxiao6,项目名称:Tower-develop,代码行数:65,代码来源:PlaneFlightControlFragment.java



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java Pack类代码示例发布时间:2022-05-23
下一篇:
Java EurekaInstanceConfig类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap