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


Java FollowState.STATE_END属性代码示例

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


在下文中一共展示了FollowState.STATE_END属性的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getFollowState

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,代码行数:35,代码来源:DroneApi.java

示例2: onReceive

@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,代码行数:75,代码来源:CopterFlightControlFragment.java

示例3: onReceive

@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,代码行数:64,代码来源:PlaneFlightControlFragment.java

示例4: onReceive

@Override
public void onReceive(Context context, Intent intent) {
    final String action = intent.getAction();
    if(AttributeEvent.STATE_CONNECTED.equals(action)){
        PebbleKit.startAppOnPebble(applicationContext, DP_UUID);
    }
    else if(AttributeEvent.STATE_VEHICLE_MODE.equals(action)
            || AttributeEvent.BATTERY_UPDATED.equals(action)
            ||AttributeEvent.SPEED_UPDATED.equals(action)){
        sendDataToWatchIfTimeHasElapsed(dpApi);
    }
    else if((AttributeEvent.FOLLOW_START.equals(action)
            || AttributeEvent.FOLLOW_STOP.equals(action))) {
        sendDataToWatchIfTimeHasElapsed(dpApi);

        FollowState followState = dpApi.getFollowState();
        if(followState != null) {
            String eventLabel = null;
            switch (followState.getState()) {
                case FollowState.STATE_START:
                case FollowState.STATE_RUNNING:
                    eventLabel = "FollowMe enabled";
                    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) {
                Toast.makeText(applicationContext, eventLabel, Toast.LENGTH_SHORT).show();
            }
        }
    }
}
 
开发者ID:jiaminghan,项目名称:droidplanner-master,代码行数:47,代码来源:PebbleNotificationProvider.java

示例5: onReceive

@Override
public void onReceive(Context context, Intent intent) {
    final String action = intent.getAction();
    if(AttributeEvent.STATE_ARMING.equals(action)
            || AttributeEvent.STATE_CONNECTED.equals(action)
            || AttributeEvent.STATE_DISCONNECTED.equals(action)
            || AttributeEvent.STATE_UPDATED.equals(action)){
        setupButtonsByFlightState();
    }
    else if(AttributeEvent.STATE_VEHICLE_MODE.equals(action)){
        updateFlightModeButtons();
    }
    else if(AttributeEvent.FOLLOW_START.equals(action)
            || AttributeEvent.FOLLOW_STOP.equals(action)
            || AttributeEvent.FOLLOW_UPDATE.equals(action)){
        updateFlightModeButtons();
        updateFollowButton();

        if((AttributeEvent.FOLLOW_START.equals(action)
                || AttributeEvent.FOLLOW_STOP.equals(action))) {
            final FollowState followState = getDrone().getFollowState();
            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();
                }
            }
        }
    }
    else if(AttributeEvent.MISSION_DRONIE_CREATED.equals(action)){
        //Get the bearing of the dronie mission.
        float bearing = intent.getFloatExtra(AttributeEventExtra.EXTRA_MISSION_DRONIE_BEARING, -1);
        if(bearing >= 0){
            final FlightActivity flightActivity = (FlightActivity) getActivity();
            if(flightActivity != null){
                flightActivity.updateMapBearing(bearing);
            }
        }
    }
}
 
开发者ID:jiaminghan,项目名称:droidplanner-master,代码行数:72,代码来源:CopterFlightActionsFragment.java

示例6: onReceive

@Override
public void onReceive(Context context, Intent intent) {
    final String action = intent.getAction();
    if (AttributeEvent.STATE_CONNECTED.equals(action) || AttributeEvent.STATE_DISCONNECTED.equals(action)
            || AttributeEvent.STATE_UPDATED.equals(action)) {
        setupButtonsByFlightState();
    } else if (AttributeEvent.STATE_VEHICLE_MODE.equals(action)) {
        updateFlightModeButtons();
    } else if (AttributeEvent.FOLLOW_START.equals(action)
            || AttributeEvent.FOLLOW_STOP.equals(action)
            || AttributeEvent.FOLLOW_UPDATE.equals(action)) {
        updateFlightModeButtons();
        updateFollowButton();

        if((AttributeEvent.FOLLOW_START.equals(action)
                || AttributeEvent.FOLLOW_STOP.equals(action))) {
            final FollowState followState = getDrone().getFollowState();
            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();
                }
            }
        }
    }
}
 
开发者ID:jiaminghan,项目名称:droidplanner-master,代码行数:58,代码来源:PlaneFlightActionsFragment.java

示例7: onReceive

@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 FlightActivity flightActivity = (FlightActivity) getActivity();
                if (flightActivity != null) {
                    flightActivity.updateMapBearing(bearing);
                }
            }
            break;
    }
}
 
开发者ID:sommishra,项目名称:DroidPlanner-Tower,代码行数:75,代码来源:CopterFlightControlFragment.java


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