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


Java AttributeEvent.ALTITUDE_UPDATED属性代码示例

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


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

示例1: onReceive

@Override
public void onReceive(Context context, Intent intent) {
    if (getActivity() == null)
        return;

    switch (intent.getAction()) {
        case AttributeEvent.BATTERY_UPDATED:
            updateBatteryTelem();
            break;

        case AttributeEvent.STATE_CONNECTED:
            showTelemBar();
            updateAllTelem();
            break;

        case AttributeEvent.STATE_DISCONNECTED:
            hideTelemBar();
            updateAllTelem();
            break;

        case DroidPlannerPrefs.ACTION_PREF_RETURN_TO_ME_UPDATED:
        case AttributeEvent.RETURN_TO_ME_STATE_UPDATE:
        case AttributeEvent.GPS_POSITION:
        case AttributeEvent.HOME_UPDATED:
            updateHomeTelem();
            break;

        case AttributeEvent.GPS_COUNT:
        case AttributeEvent.GPS_FIX:
            updateGpsTelem();
            break;

        case AttributeEvent.SIGNAL_UPDATED:
            updateSignalTelem();
            break;

        case AttributeEvent.STATE_VEHICLE_MODE:
        case AttributeEvent.TYPE_UPDATED:
            updateFlightModeTelem();
            break;

        case SettingsFragment.ACTION_PREF_HDOP_UPDATE:
            updateGpsTelem();
            break;

        case SettingsFragment.ACTION_PREF_UNIT_SYSTEM_UPDATE:
            updateHomeTelem();
            break;

        case AttributeEvent.ALTITUDE_UPDATED:
            updateAltitudeTelem();
            break;

        default:
            break;
    }
}
 
开发者ID:mxiao6,项目名称:Tower-develop,代码行数:57,代码来源:ActionBarTelemFragment.java

示例2: onDroneEvent

@Override
public void onDroneEvent(String event, Bundle extras) {
    switch (event) {

        case AttributeEvent.STATE_CONNECTED:
            handleDroneConnected();
            break;

        case AttributeEvent.STATE_DISCONNECTED:
            handleDroneDisconnected();
            break;

        case AttributeEvent.STATE_UPDATED:
            break;

        case AttributeEvent.STATE_ARMING:
            if (startMission) {
                DroneStateApi.setVehicleMode(drone, VehicleMode.COPTER_GUIDED);
                GuidedApi.takeoff(drone, TAKEOFF_ALTITUDE);
            }
            break;

        case AttributeEvent.STATE_VEHICLE_MODE:
            break;

        case AttributeEvent.HOME_UPDATED:
            break;

        case AttributeEvent.TYPE_UPDATED:
        case AttributeEvent.ATTITUDE_UPDATED:
        case AttributeEvent.ALTITUDE_UPDATED:
            Altitude altitude = drone.getAttribute(AttributeType.ALTITUDE);

            if (startMission) {
                startAutoPilotWhenTakeOffFinished(altitude);
            } else if (endMissionWhenLanded) {
                if (altitude != null && altitude.getAltitude() < 1) {
                    missionListener.onMissionFinished();
                    endMissionWhenLanded = false;
                }
            }
            break;
        case AttributeEvent.SPEED_UPDATED:
            break;
        case AttributeEvent.BATTERY_UPDATED:
            handleBatteryStateChange();
            break;

        case AttributeEvent.GPS_POSITION:
        case AttributeEvent.GPS_FIX:
        case AttributeEvent.GPS_COUNT:
        case AttributeEvent.WARNING_NO_GPS:
            handleGpsStateChange();
            break;
        case AttributeEvent.AUTOPILOT_MESSAGE:
            Log.i("DRONE_EVENT", extras.getString(AttributeEventExtra.EXTRA_AUTOPILOT_MESSAGE));

        default:

            break;
    }
}
 
开发者ID:Project-Helin,项目名称:drone-onboard-app,代码行数:62,代码来源:DroneConnectionService.java

示例3: onDroneEvent

@Override
public void onDroneEvent(String event, Bundle extras) {
    switch (event) {
        case AttributeEvent.STATE_CONNECTED:
            TextView connectionStatusTextView = (TextView)findViewById(R.id.connectionStatus);
            connectionStatusTextView.setText("Connected");
            startVideoFeed();
            break;

        case AttributeEvent.STATE_DISCONNECTED:
            connectionStatusTextView = (TextView)findViewById(R.id.connectionStatus);
            connectionStatusTextView.setText("Disconnected");
            stopVideoFeed();
            break;

        case AttributeEvent.ALTITUDE_UPDATED:
            TextView altitudeTextView = (TextView)findViewById(R.id.altitudeTextView);
            Altitude droneAltitude = this.drone.getAttribute(AttributeType.ALTITUDE);
            altitudeTextView.setText(String.format("Alt: %3.1f", droneAltitude.getAltitude()) + "m");
            break;

        case AttributeEvent.BATTERY_UPDATED:
            TextView batteryTextView = (TextView)findViewById(R.id.batteryTextView);
            Battery batt = this.drone.getAttribute(AttributeType.BATTERY);
            batteryTextView.setText(String.format("Batt: %3.1f", batt.getBatteryRemain()) + "%");
            break;

        case AttributeEvent.GPS_COUNT:
            TextView satelliteTextView = (TextView)findViewById(R.id.satelliteTextView);
            Gps gps = this.drone.getAttribute(AttributeType.GPS);
            satelliteTextView.setText(String.format("Sats: %3.1f", gps.getSatellitesCount()));
            break;

        case AttributeEvent.STATE_VEHICLE_MODE:
            State vehicleState = this.drone.getAttribute(AttributeType.STATE);
            VehicleMode vehicleMode = vehicleState.getVehicleMode();
            TextView flightModeTextView = (TextView)findViewById(R.id.flightModeTextView);
            flightModeTextView.setText("Mode: " + vehicleMode.getLabel());

            // If the mode is switched and the pano is in progress let's release gimbal control
            if(vehicleMode.getLabel() != "Guided" && panoInProgress) {
                panoInProgress = false;
                GimbalApi.getApi(this.drone).stopGimbalControl(gimbalListener);
            }
            break;

        default:
            break;
    }
}
 
开发者ID:dbaldwin,项目名称:DronePan-Solo,代码行数:50,代码来源:MainActivity.java

示例4: onDroneEvent

@Override
    public void onDroneEvent(String event, Bundle extras) {

        switch (event) {
            case AttributeEvent.STATE_CONNECTED:
                alertUser("Drone Connected");
                updateConnectedButton(this.drone.isConnected());
                updateArmButton();
                checkSoloState();
                break;

            case AttributeEvent.STATE_DISCONNECTED:
                alertUser("Drone Disconnected");
                updateConnectedButton(this.drone.isConnected());
                updateArmButton();
                break;

            case AttributeEvent.STATE_UPDATED:
            case AttributeEvent.STATE_ARMING:
                updateArmButton();
                break;

            case AttributeEvent.TYPE_UPDATED:
                Type newDroneType = this.drone.getAttribute(AttributeType.TYPE);
                if (newDroneType.getDroneType() != this.droneType) {
                    this.droneType = newDroneType.getDroneType();
                    updateVehicleModesForType(this.droneType);
                }
                break;

            case AttributeEvent.STATE_VEHICLE_MODE:
                updateVehicleMode();
                break;

            case AttributeEvent.SPEED_UPDATED:
                updateSpeed();
                break;

            case AttributeEvent.ALTITUDE_UPDATED:
                updateAltitude();
                break;

            case AttributeEvent.HOME_UPDATED:
                updateDistanceFromHome();
                break;


            default:
//                Log.i("DRONE_EVENT", event); //Uncomment to see events from the drone
                break;
        }

    }
 
开发者ID:3drobotics,项目名称:DroneKit-Android-Starter,代码行数:53,代码来源:MainActivity.java


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