本文整理汇总了Java中com.o3dr.services.android.lib.drone.attribute.AttributeEvent.STATE_ARMING属性的典型用法代码示例。如果您正苦于以下问题:Java AttributeEvent.STATE_ARMING属性的具体用法?Java AttributeEvent.STATE_ARMING怎么用?Java AttributeEvent.STATE_ARMING使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类com.o3dr.services.android.lib.drone.attribute.AttributeEvent
的用法示例。
在下文中一共展示了AttributeEvent.STATE_ARMING属性的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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.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;
}
}
示例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;
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;
}
}
示例4: 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;
}
}
示例5: 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;
}
}
示例6: 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;
}
}
示例7: onDroneEvent
@Override
public void onDroneEvent(String event, Bundle bundle) {
try {
final String action = new Intent(event).getAction();
switch (action) {
case AttributeEvent.STATE_DISCONNECTED:
PebbleKit.closeAppOnPebble(applicationContext, DP_UUID);
stopSelf();
break;
case AttributeEvent.STATE_CONNECTED:
case AttributeEvent.HEARTBEAT_FIRST:
PebbleKit.startAppOnPebble(applicationContext, DP_UUID);
Thread.sleep(250);
sendDataToWatchNow(drone);
break;
//Telem gets slow updates
case AttributeEvent.BATTERY_UPDATED:
case AttributeEvent.ATTITUDE_UPDATED:
sendDataToWatchIfTimeHasElapsed(drone);
break;
//Mode changes get fast updates
case AttributeEvent.STATE_VEHICLE_MODE:
case AttributeEvent.FOLLOW_START:
case AttributeEvent.STATE_ARMING:
case AttributeEvent.STATE_UPDATED:
sendDataToWatchNow(drone);
break;
//Follow type update gets fast update
case AttributeEvent.FOLLOW_UPDATE:
final FollowState followState = drone.getAttribute(AttributeType.FOLLOW_STATE);
if(followState != null){
final FollowType followType = followState.getMode();
if(!previousFollowType.equals(followType)){
previousFollowType = followType;
sendDataToWatchNow(drone);
}
}
}
}catch(Exception e){
//TODO figure out what was messing up here
}
}
示例8: 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;
}
}
示例9: onDroneEvent
@Override
public void onDroneEvent(String event, Bundle bundle) {
String attributeType = null;
switch (event) {
case AttributeEvent.STATE_CONNECTED:
case AttributeEvent.STATE_DISCONNECTED:
//Update all of the vehicle's properties.
Log.d(TAG, "Received drone connection event: " + event);
updateAllVehicleAttributes();
break;
case AttributeEvent.STATE_UPDATED:
case AttributeEvent.STATE_VEHICLE_MODE:
case AttributeEvent.STATE_ARMING:
//Retrieve the state attribute
attributeType = AttributeType.STATE;
break;
case AttributeEvent.BATTERY_UPDATED:
//Retrieve the battery attribute
attributeType = AttributeType.BATTERY;
break;
case AttributeEvent.SIGNAL_UPDATED:
//Retrieve the signal attribute
attributeType = AttributeType.SIGNAL;
break;
case AttributeEvent.GPS_POSITION:
case AttributeEvent.GPS_FIX:
case AttributeEvent.GPS_COUNT:
attributeType = AttributeType.GPS;
break;
case AttributeEvent.GUIDED_POINT_UPDATED:
attributeType = AttributeType.GUIDED_STATE;
break;
case AttributeEvent.FOLLOW_START:
case AttributeEvent.FOLLOW_STOP:
case AttributeEvent.FOLLOW_UPDATE:
attributeType = AttributeType.FOLLOW_STATE;
break;
case AttributeEvent.HOME_UPDATED:
attributeType = AttributeType.HOME;
break;
}
updateVehicleAttribute(attributeType);
}
示例10: 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;
}
}