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


Java AttributeEvent类代码示例

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


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

示例1: onReceive

import com.o3dr.services.android.lib.drone.attribute.AttributeEvent; //导入依赖的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;

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

示例2: onReceive

import com.o3dr.services.android.lib.drone.attribute.AttributeEvent; //导入依赖的package包/类
@Override
public void onReceive(Context context, Intent intent) {
    final String action = intent.getAction();
    switch (action){
        case AttributeEvent.MISSION_RECEIVED:
        case AttributeEvent.MISSION_UPDATED:
            final MissionProxy missionProxy = getMissionProxy();
            if(missionProxy != null) {
                mission = drone.getAttribute(AttributeType.MISSION);
                waypointSelectorAdapter = new NumericWheelAdapter(context, R.layout.wheel_text_centered,
                        missionProxy.getFirstWaypoint(), missionProxy.getLastWaypoint(), "%3d");
                waypointSelector.setViewAdapter(waypointSelectorAdapter);
            }
            break;

        case AttributeEvent.MISSION_ITEM_UPDATED:
            mission = drone.getAttribute(AttributeType.MISSION);
            nextWaypoint = intent.getIntExtra(AttributeEventExtra.EXTRA_MISSION_CURRENT_WAYPOINT, 0);
            waypointSelector.setCurrentValue(nextWaypoint);
            break;
        case AttributeEvent.GPS_POSITION:
            updateMission();
            break;
    }
}
 
开发者ID:mxiao6,项目名称:Tower-develop,代码行数:26,代码来源:ModeAutoFragment.java

示例3: onReceive

import com.o3dr.services.android.lib.drone.attribute.AttributeEvent; //导入依赖的package包/类
@Override
public void onReceive(Context context, Intent intent) {
    final String action = intent.getAction();
    switch (action) {
        case AttributeEvent.STATE_CONNECTED:
            onDroneConnected();
            break;

        case AttributeEvent.STATE_DISCONNECTED:
            onDroneDisconnected();
            break;

        case SettingsFragment.ACTION_ADVANCED_MENU_UPDATED:
            supportInvalidateOptionsMenu();
            break;
    }
}
 
开发者ID:mxiao6,项目名称:Tower-develop,代码行数:18,代码来源:SuperUI.java

示例4: onReceive

import com.o3dr.services.android.lib.drone.attribute.AttributeEvent; //导入依赖的package包/类
@Override
public void onReceive(Context context, Intent intent) {
    final String action = intent.getAction();
    switch (action) {
        case MissionProxy.ACTION_MISSION_PROXY_UPDATE:
            if (mAppPrefs.isZoomToFitEnable()) gestureMapFragment.getMapFragment().zoomToFit();
            // FALL THROUGH
        case AttributeEvent.PARAMETERS_REFRESH_COMPLETED:
        case DroidPlannerPrefs.PREF_VEHICLE_DEFAULT_SPEED:
        case AttributeEvent.STATE_CONNECTED:
        case AttributeEvent.HEARTBEAT_RESTORED:
            updateMissionLength();
            break;

        case AttributeEvent.MISSION_RECEIVED:
            final EditorMapFragment planningMapFragment = gestureMapFragment.getMapFragment();
            if (planningMapFragment != null) {
                planningMapFragment.zoomToFit();
            }
            break;
    }
}
 
开发者ID:mxiao6,项目名称:Tower-develop,代码行数:23,代码来源:EditorActivity.java

示例5: changedConnectionStateTest

import com.o3dr.services.android.lib.drone.attribute.AttributeEvent; //导入依赖的package包/类
@Test
public void changedConnectionStateTest() throws Exception {
    Altitude altitude = new Altitude();
    altitude.setAltitude(100);
    altitude.setTargetAltitude(150);

    Speed speed = new Speed();
    speed.setGroundSpeed(5);
    speed.setVerticalSpeed(1);

    Type type = new Type();
    type.setFirmware(Type.Firmware.ARDU_COPTER);

    when(drone.getAttribute(AttributeType.ALTITUDE)).thenReturn(altitude);
    when(drone.getAttribute(AttributeType.SPEED)).thenReturn(speed);
    when(drone.getAttribute(AttributeType.TYPE)).thenReturn(type);

    service.addConnectionListener(droneConnectionListener);

    service.onDroneEvent(AttributeEvent.STATE_CONNECTED, new Bundle());

    DroneState droneState = new DroneStateMapper().getDroneState(drone);
    droneState.setIsConnected(true);

    verify(droneConnectionListener).onDroneStateChange(droneState);
}
 
开发者ID:Project-Helin,项目名称:drone-onboard-app,代码行数:27,代码来源:DroneConnectionServiceTest.java

示例6: onReceive

import com.o3dr.services.android.lib.drone.attribute.AttributeEvent; //导入依赖的package包/类
@Override
public void onReceive(Context context, Intent intent) {
    final String action = intent.getAction();
    if (AttributeEvent.STATE_DISCONNECTED.equals(action)) {
        updateMavlinkVersionPreference(null);
        updateFirmwareVersionPreference(null);
    } else if (AttributeEvent.HEARTBEAT_FIRST.equals(action)
            || AttributeEvent.HEARTBEAT_RESTORED.equals(action)) {
        int mavlinkVersion = intent.getIntExtra(AttributeEventExtra.EXTRA_MAVLINK_VERSION, -1);
        if (mavlinkVersion == -1)
            updateMavlinkVersionPreference(null);
        else
            updateMavlinkVersionPreference(String.valueOf(mavlinkVersion));
    } else if (AttributeEvent.TYPE_UPDATED.equals(action)) {
        Drone drone = dpApp.getDrone();
        if (drone.isConnected()) {
            updateFirmwareVersionPreference(drone.getType().getFirmwareVersion());
        } else
            updateFirmwareVersionPreference(null);
    }
}
 
开发者ID:jiaminghan,项目名称:droidplanner-master,代码行数:22,代码来源:SettingsFragment.java

示例7: newEstimation

import com.o3dr.services.android.lib.drone.attribute.AttributeEvent; //导入依赖的package包/类
@Override
public void newEstimation(FitPoints fit, List<ThreeSpacePoint> points) {
    double fitness = fit.getFitness();
    double[] fitCenter = fit.center.isNaN()
            ? null
            : new double[]{fit.center.getEntry(0), fit.center.getEntry(1), fit.center.getEntry(2)};
    double[] fitRadii = fit.radii.isNaN()
            ? null
            : new double[]{fit.radii.getEntry(0), fit.radii.getEntry(1), fit.radii.getEntry(2)};

    Bundle paramsBundle = new Bundle(4);
    paramsBundle.putDouble(AttributeEventExtra.EXTRA_CALIBRATION_MAG_FITNESS, fitness);
    paramsBundle.putDoubleArray(AttributeEventExtra.EXTRA_CALIBRATION_MAG_FIT_CENTER, fitCenter);
    paramsBundle.putDoubleArray(AttributeEventExtra.EXTRA_CALIBRATION_MAG_FIT_RADII, fitRadii);

    double[][] pointsArr = MathUtils.threeSpacePointToPointsArray(points);
    paramsBundle.putSerializable(AttributeEventExtra.EXTRA_CALIBRATION_MAG_POINTS_X, pointsArr[0]);
    paramsBundle.putSerializable(AttributeEventExtra.EXTRA_CALIBRATION_MAG_POINTS_Y, pointsArr[1]);
    paramsBundle.putSerializable(AttributeEventExtra.EXTRA_CALIBRATION_MAG_POINTS_Z, pointsArr[2]);

    notifyAttributeUpdate(AttributeEvent.CALIBRATION_MAG_ESTIMATION, paramsBundle);
}
 
开发者ID:jiaminghan,项目名称:droidplanner-master,代码行数:23,代码来源:DroneApi.java

示例8: notifyAttributeUpdated

import com.o3dr.services.android.lib.drone.attribute.AttributeEvent; //导入依赖的package包/类
void notifyAttributeUpdated(final String attributeEvent, final Bundle extras) {
    if (AttributeEvent.STATE_UPDATED.equals(attributeEvent)) {
        if (getState().isFlying())
            startTimer();
        else
            stopTimer();
    } else if (AttributeEvent.SPEED_UPDATED.equals(attributeEvent)) {
        checkForGroundCollision();
    }

    if (droneListeners.isEmpty())
        return;

    handler.post(new Runnable() {
        @Override
        public void run() {
            for (DroneListener listener : droneListeners)
                listener.onDroneEvent(attributeEvent, extras);
        }
    });
}
 
开发者ID:jiaminghan,项目名称:droidplanner-master,代码行数:22,代码来源:Drone.java

示例9: onReceive

import com.o3dr.services.android.lib.drone.attribute.AttributeEvent; //导入依赖的package包/类
@Override
public void onReceive(Context context, Intent intent) {
    final String action = intent.getAction();
    switch (action) {
        case AttributeEvent.AUTOPILOT_ERROR:
            final String errorName = intent.getStringExtra(AttributeEventExtra.EXTRA_AUTOPILOT_ERROR_ID);
            final ErrorType errorType = ErrorType.getErrorById(errorName);
            if (errorType != null && ErrorType.NO_ERROR != errorType) {
                final HitBuilders.EventBuilder eventBuilder = new HitBuilders.EventBuilder()
                        .setCategory(GAUtils.Category.FAILSAFE)
                        .setAction("Autopilot error")
                        .setLabel(errorType.getLabel(context).toString());
                GAUtils.sendEvent(eventBuilder);
            }
            break;
    }
}
 
开发者ID:sommishra,项目名称:DroidPlanner-Tower,代码行数:18,代码来源:NotificationHandler.java

示例10: onReceive

import com.o3dr.services.android.lib.drone.attribute.AttributeEvent; //导入依赖的package包/类
@Override
public void onReceive(Context context, Intent intent) {
    final String action = intent.getAction();
    final Drone drone = getDrone();

    switch (action) {
        case AttributeEvent.ATTITUDE_UPDATED:
            final Attitude attitude = drone.getAttribute(AttributeType.ATTITUDE);
            onOrientationUpdate(attitude);
            break;

        case AttributeEvent.SPEED_UPDATED:
            final Speed droneSpeed = drone.getAttribute(AttributeType.SPEED);
            onSpeedUpdate(droneSpeed);

            final Altitude droneAltitude = drone.getAttribute(AttributeType.ALTITUDE);
            onAltitudeUpdate(droneAltitude);
            break;

        case AttributeEvent.STATE_UPDATED:
            updateFlightTimer();
            break;
    }
}
 
开发者ID:sommishra,项目名称:DroidPlanner-Tower,代码行数:25,代码来源:TelemetryFragment.java

示例11: onReceive

import com.o3dr.services.android.lib.drone.attribute.AttributeEvent; //导入依赖的package包/类
@Override
public void onReceive(Context context, Intent intent) {
    final String action = intent.getAction();
    switch (action) {
        case AttributeEvent.PARAMETERS_REFRESH_ENDED:
        case MissionProxy.ACTION_MISSION_PROXY_UPDATE:
            updateMissionLength();
            break;

        case AttributeEvent.MISSION_RECEIVED:
            final EditorMapFragment planningMapFragment = gestureMapFragment.getMapFragment();
            if (planningMapFragment != null) {
                planningMapFragment.zoomToFit();
            }
            break;
    }
}
 
开发者ID:sommishra,项目名称:DroidPlanner-Tower,代码行数:18,代码来源:EditorActivity.java

示例12: onDroneEvent

import com.o3dr.services.android.lib.drone.attribute.AttributeEvent; //导入依赖的package包/类
@Override
public void onDroneEvent(String event, Bundle extras) {
    switch (event) {
        case AttributeEvent.STATE_CONNECTED:
            handler.removeCallbacks(disconnectionTask);
            if (notificationHandler == null) {
                notificationHandler = new NotificationHandler(getApplicationContext(), drone);
            }
            break;
        case AttributeEvent.STATE_DISCONNECTED:
            shouldWeTerminate();
            break;
    }

    lbm.sendBroadcast(new Intent(ACTION_DRONE_EVENT).putExtra(EXTRA_DRONE_EVENT, event));

    final Intent droneIntent = new Intent(event);
    if (extras != null)
        droneIntent.putExtras(extras);
    lbm.sendBroadcast(droneIntent);
}
 
开发者ID:sommishra,项目名称:DroidPlanner-Tower,代码行数:22,代码来源:DroidPlannerApp.java

示例13: onReceive

import com.o3dr.services.android.lib.drone.attribute.AttributeEvent; //导入依赖的package包/类
@Override
public void onReceive(Context context, Intent intent) {
    boolean showNotification = true;
    final String action = intent.getAction();
    switch (action) {

        case AttributeEvent.GPS_POSITION:
            updateHome(drone);
            break;
        case AttributeEvent.GPS_FIX:
        case AttributeEvent.GPS_COUNT:
            updateGps(drone);
            break;
        case AttributeEvent.BATTERY_UPDATED:
            updateBattery(drone);
            break;
        case AttributeEvent.HOME_UPDATED:
            updateHome(drone);
            break;
        case AttributeEvent.SIGNAL_UPDATED:
            updateRadio(drone);
            break;
        case AttributeEvent.STATE_UPDATED:
            updateDroneState(drone);
            break;
        case AttributeEvent.STATE_VEHICLE_MODE:
        case AttributeEvent.TYPE_UPDATED:
            updateFlightMode(drone);
            break;

        default:
            showNotification = false;
            break;
    }

    if (showNotification) {
        showNotification();
    }
}
 
开发者ID:mxiao6,项目名称:Tower-develop,代码行数:40,代码来源:StatusBarNotificationProvider.java

示例14: onReceive

import com.o3dr.services.android.lib.drone.attribute.AttributeEvent; //导入依赖的package包/类
@Override
public void onReceive(Context context, Intent intent) {
    final Activity activity = getActivity();
    if(activity == null)
        return;

    final String action = intent.getAction();
    switch (action) {
        case AttributeEvent.STATE_DISCONNECTED:
            updateFirmwareVersionPreference(null);
            break;

        case AttributeEvent.STATE_CONNECTED:
        case AttributeEvent.TYPE_UPDATED:
            Drone drone = dpApp.getDrone();
            if (drone.isConnected()) {
                Type droneType = drone.getAttribute(AttributeType.TYPE);
                updateFirmwareVersionPreference(droneType);
            } else
                updateFirmwareVersionPreference(null);
            break;

        case ACTION_PREF_UNIT_SYSTEM_UPDATE:
            setupAltitudePreferences();
            setupSpeedPreferences();
            break;
    }
}
 
开发者ID:mxiao6,项目名称:Tower-develop,代码行数:29,代码来源:SettingsFragment.java

示例15: onReceive

import com.o3dr.services.android.lib.drone.attribute.AttributeEvent; //导入依赖的package包/类
@Override
public void onReceive(Context context, Intent intent) {
    switch (intent.getAction()) {
        case AttributeEvent.CALIBRATION_MAG_CANCELLED:
            updateUI(STEP_CALIBRATION_CANCELLED);
            stopTimeout();
            break;

        case AttributeEvent.CALIBRATION_MAG_COMPLETED:
            final MagnetometerCalibrationResult result = intent.getParcelableExtra(AttributeEventExtra
                .EXTRA_CALIBRATION_MAG_RESULT);
            handleMagResult(result);
            stopTimeout();
            break;

        case AttributeEvent.CALIBRATION_MAG_PROGRESS:
            final MagnetometerCalibrationProgress progress = intent.getParcelableExtra(AttributeEventExtra
                .EXTRA_CALIBRATION_MAG_PROGRESS);
            handleMagProgress(progress);
            break;

        case AttributeEvent.STATE_CONNECTED:
            break;

        case AttributeEvent.STATE_DISCONNECTED:
            cancelCalibration();
            break;
    }
}
 
开发者ID:mxiao6,项目名称:Tower-develop,代码行数:30,代码来源:FragmentSetupCompass.java


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