本文整理汇总了Java中com.o3dr.services.android.lib.drone.attribute.AttributeEvent.TYPE_UPDATED属性的典型用法代码示例。如果您正苦于以下问题:Java AttributeEvent.TYPE_UPDATED属性的具体用法?Java AttributeEvent.TYPE_UPDATED怎么用?Java AttributeEvent.TYPE_UPDATED使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类com.o3dr.services.android.lib.drone.attribute.AttributeEvent
的用法示例。
在下文中一共展示了AttributeEvent.TYPE_UPDATED属性的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: onReceive
@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();
}
}
示例2: onReceive
@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;
}
}
示例3: onReceive
@Override
public void onReceive(Context context, Intent intent) {
final String action = intent.getAction();
switch (action) {
case AttributeEvent.STATE_CONNECTED:
case AttributeEvent.TYPE_UPDATED:
Type type = getDrone().getAttribute(AttributeType.TYPE);
selectActionsBar(type.getDroneType());
break;
}
}
示例4: onReceive
@Override
public void onReceive(Context context, Intent intent) {
final String action = intent.getAction();
switch (action) {
case AttributeEvent.PARAMETERS_REFRESH_STARTED:
startProgress();
break;
case AttributeEvent.PARAMETERS_REFRESH_COMPLETED:
stopProgress();
/*** FALL - THROUGH ***/
case AttributeEvent.STATE_CONNECTED:
case AttributeEvent.TYPE_UPDATED:
final Drone drone = getDrone();
if (drone != null && drone.isConnected()) {
final Parameters droneParams = drone.getAttribute(AttributeType.PARAMETERS);
loadAdapter(droneParams.getParameters(), false);
}
break;
case AttributeEvent.PARAMETER_RECEIVED:
final int defaultValue = -1;
int index = intent.getIntExtra(AttributeEventExtra.EXTRA_PARAMETER_INDEX, defaultValue);
int count = intent.getIntExtra(AttributeEventExtra.EXTRA_PARAMETERS_COUNT, defaultValue);
if (index != defaultValue && count != defaultValue)
updateProgress(index, count);
break;
case AttributeEvent.STATE_DISCONNECTED:
stopProgress();
break;
}
}
示例5: onReceive
@Override
public void onReceive(Context context, Intent intent) {
switch(intent.getAction()){
case AttributeEvent.TYPE_UPDATED:
updateCompassCalibrationAvailability();
break;
}
}
示例6: onReceive
@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:
updateMavlinkVersionPreference(null);
updateFirmwareVersionPreference(null);
break;
case AttributeEvent.HEARTBEAT_FIRST:
case AttributeEvent.HEARTBEAT_RESTORED:
int mavlinkVersion = intent.getIntExtra(AttributeEventExtra.EXTRA_MAVLINK_VERSION, -1);
if (mavlinkVersion == -1)
updateMavlinkVersionPreference(null);
else
updateMavlinkVersionPreference(String.valueOf(mavlinkVersion));
break;
case AttributeEvent.STATE_CONNECTED:
case AttributeEvent.TYPE_UPDATED:
Drone drone = dpApp.getDrone();
if (drone.isConnected()) {
Type droneType = drone.getAttribute(AttributeType.TYPE);
updateFirmwareVersionPreference(droneType.getFirmwareVersion());
} else
updateFirmwareVersionPreference(null);
break;
}
}
示例7: onReceive
@Override
public void onReceive(Context context, Intent intent) {
final String action = intent.getAction();
switch (action) {
case AttributeEvent.STATE_CONNECTED:
case AttributeEvent.TYPE_UPDATED:
Type type = getDrone().getAttribute(AttributeType.TYPE);
selectActionsBar(type == null ? -1 : type.getDroneType());
break;
}
}
示例8: onReceive
@Override
public void onReceive(Context context, Intent intent) {
final String action = intent.getAction();
switch (action) {
case AttributeEvent.PARAMETERS_REFRESH_STARTED:
startProgress();
break;
case AttributeEvent.PARAMETERS_REFRESH_ENDED:
stopProgress();
/*** FALL - THROUGH ***/
case AttributeEvent.STATE_CONNECTED:
case AttributeEvent.TYPE_UPDATED:
final Drone drone = getDrone();
if (drone != null && drone.isConnected()) {
final Parameters droneParams = drone.getAttribute(AttributeType.PARAMETERS);
loadAdapter(droneParams.getParameters(), false);
}
break;
case AttributeEvent.PARAMETERS_RECEIVED:
final int defaultValue = -1;
int index = intent.getIntExtra(AttributeEventExtra.EXTRA_PARAMETER_INDEX, defaultValue);
int count = intent.getIntExtra(AttributeEventExtra.EXTRA_PARAMETERS_COUNT, defaultValue);
if (index != defaultValue && count != defaultValue)
updateProgress(index, count);
break;
case AttributeEvent.STATE_DISCONNECTED:
stopProgress();
break;
}
}
示例9: 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;
}
}
示例10: onReceive
@Override
public void onReceive(Context context, Intent intent) {
final String action = intent.getAction();
switch (action) {
case AttributeEvent.AUTOPILOT_ERROR:
String errorName = intent.getStringExtra(AttributeEventExtra.EXTRA_AUTOPILOT_ERROR_ID);
final ErrorType errorType = ErrorType.getErrorById(errorName);
onAutopilotError(errorType);
break;
case AttributeEvent.AUTOPILOT_MESSAGE:
final int logLevel = intent.getIntExtra(AttributeEventExtra.EXTRA_AUTOPILOT_MESSAGE_LEVEL, Log.VERBOSE);
final String message = intent.getStringExtra(AttributeEventExtra.EXTRA_AUTOPILOT_MESSAGE);
onAutopilotError(logLevel, message);
break;
case AttributeEvent.STATE_ARMING:
case AttributeEvent.STATE_CONNECTED:
case AttributeEvent.STATE_DISCONNECTED:
case AttributeEvent.STATE_UPDATED:
case AttributeEvent.TYPE_UPDATED:
enableSlidingUpPanel(getDrone());
break;
case AttributeEvent.FOLLOW_START:
//Extend the sliding drawer if collapsed.
if (!mSlidingPanelCollapsing.get()
&& mSlidingPanel.isEnabled()
&& mSlidingPanel.getPanelState() != SlidingUpPanelLayout.PanelState.EXPANDED) {
mSlidingPanel.setPanelState(SlidingUpPanelLayout.PanelState.EXPANDED);
}
break;
case AttributeEvent.MISSION_DRONIE_CREATED:
float dronieBearing = intent.getFloatExtra(AttributeEventExtra.EXTRA_MISSION_DRONIE_BEARING, -1);
if (dronieBearing != -1)
updateMapBearing(dronieBearing);
break;
}
}
示例11: 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;
}
}
示例12: onReceive
@Override
public void onReceive(Context context, Intent intent) {
boolean showNotification = true;
final String action = intent.getAction();
switch (action) {
case AttributeEvent.STATE_CONNECTED:
final String summaryText = mContext.getString(R.string.connected);
mInboxBuilder = new InboxStyleBuilder().setSummary(summaryText);
mNotificationBuilder = new NotificationCompat.Builder(mContext)
.addAction(R.drawable.ic_action_io, mContext.getText(R.string.menu_disconnect),
mToggleConnectionIntent)
.setContentIntent(mNotificationIntent)
.setContentText(summaryText)
.setOngoing(mAppPrefs.isNotificationPermanent())
.setSmallIcon(R.drawable.ic_stat_notify)
.setColor(context.getResources().getColor(R.color.stat_notify_connected));
updateFlightMode(drone);
updateDroneState(drone);
updateBattery(drone);
updateGps(drone);
updateHome(drone);
updateRadio(drone);
break;
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;
case AttributeEvent.STATE_DISCONNECTED:
mInboxBuilder = null;
if (mNotificationBuilder != null) {
mNotificationBuilder = new NotificationCompat.Builder(mContext)
.addAction(R.drawable.ic_action_io,
mContext.getText(R.string.menu_connect), mToggleConnectionIntent)
.setContentIntent(mNotificationIntent)
.setContentTitle(mContext.getString(R.string.disconnected))
.setOngoing(false).setContentText("")
.setSmallIcon(R.drawable.ic_stat_notify);
}
break;
default:
showNotification = false;
break;
}
if (showNotification) {
showNotification();
}
}
示例13: 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 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;
default:
break;
}
}
示例14: 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;
}
}