本文整理汇总了Java中com.o3dr.services.android.lib.drone.attribute.AttributeEvent.STATE_DISCONNECTED属性的典型用法代码示例。如果您正苦于以下问题:Java AttributeEvent.STATE_DISCONNECTED属性的具体用法?Java AttributeEvent.STATE_DISCONNECTED怎么用?Java AttributeEvent.STATE_DISCONNECTED使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类com.o3dr.services.android.lib.drone.attribute.AttributeEvent
的用法示例。
在下文中一共展示了AttributeEvent.STATE_DISCONNECTED属性的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: 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;
}
}
示例2: onReceive
@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;
}
}
示例3: onDroneEvent
@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);
}
示例4: 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;
}
}
示例5: onReceive
@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;
}
}
示例6: 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;
}
}
示例7: onReceive
@Override
public void onReceive(Context context, Intent intent) {
switch(intent.getAction()){
case AttributeEvent.HEARTBEAT_RESTORED:
case AttributeEvent.STATE_DISCONNECTED:
case AttributeEvent.STATE_CONNECTED:
case AttributeEvent.HOME_UPDATED:
updateHomeDistance();
break;
}
}
示例8: onReceive
@Override
public void onReceive(Context context, Intent intent) {
switch (intent.getAction()) {
case AttributeEvent.STATE_CONNECTED:
if (notificationHandler != null)
notificationHandler.init();
if (NetworkUtils.isOnSoloNetwork(context)) {
bringUpCellularNetwork();
}
break;
case AttributeEvent.STATE_DISCONNECTED:
if (notificationHandler != null) {
notificationHandler.terminate();
}
stopSelf();
break;
case AttributeEvent.AUTOPILOT_ERROR:
final String errorName = intent.getStringExtra(AttributeEventExtra.EXTRA_AUTOPILOT_ERROR_ID);
if (notificationHandler != null)
notificationHandler.onAutopilotError(errorName);
break;
}
}
示例9: 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;
}
}
示例10: 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;
}
}
示例11: 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.STATE_ARMING:
case AttributeEvent.STATE_CONNECTED:
case AttributeEvent.STATE_DISCONNECTED:
case AttributeEvent.STATE_UPDATED:
enableSlidingUpPanel(dpApp.getDrone());
break;
case AttributeEvent.FOLLOW_START:
//Extend the sliding drawer if collapsed.
if (!mSlidingPanelCollapsing.get() && mSlidingPanel.isSlidingEnabled() &&
!mSlidingPanel.isPanelExpanded()) {
mSlidingPanel.expandPanel();
}
break;
case AttributeEvent.MISSION_DRONIE_CREATED:
float dronieBearing = intent.getFloatExtra(AttributeEventExtra.EXTRA_MISSION_DRONIE_BEARING, -1);
if (dronieBearing != -1)
updateMapBearing(dronieBearing);
break;
}
}
示例12: 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;
}
}
示例13: 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;
}
}
示例14: 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;
}
}
示例15: 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;
}
}