本文整理汇总了Java中com.o3dr.services.android.lib.drone.attribute.AttributeEvent.GPS_POSITION属性的典型用法代码示例。如果您正苦于以下问题:Java AttributeEvent.GPS_POSITION属性的具体用法?Java AttributeEvent.GPS_POSITION怎么用?Java AttributeEvent.GPS_POSITION使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类com.o3dr.services.android.lib.drone.attribute.AttributeEvent
的用法示例。
在下文中一共展示了AttributeEvent.GPS_POSITION属性的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: onReceive
@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;
}
}
示例2: 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();
}
}
示例3: onReceive
@Override
public void onReceive(Context context, Intent intent) {
final String action = intent.getAction();
switch (action) {
case AttributeEvent.GPS_POSITION:
if (mPanMode.get() == AutoPanMode.DRONE) {
final Drone drone = getDroneApi();
if (!drone.isConnected())
return;
final Gps droneGps = drone.getAttribute(AttributeType.GPS);
if (droneGps != null && droneGps.isValid()) {
final LatLong droneLocation = droneGps.getPosition();
updateCamera(droneLocation);
}
}
break;
case SettingsFragment.ACTION_MAP_ROTATION_PREFERENCE_UPDATED:
setupMapUI(getBaiduMap());
break;
case com.baidu.mapapi.SDKInitializer.SDK_BROADTCAST_ACTION_STRING_PERMISSION_CHECK_ERROR:
Toast.makeText(getActivity().getApplicationContext(),
R.string.baidu_map_sdk_initializer_permission_error_message, Toast.LENGTH_LONG).show();
break;
case com.baidu.mapapi.SDKInitializer.SDK_BROADCAST_ACTION_STRING_NETWORK_ERROR:
Toast.makeText(getActivity().getApplicationContext(),
R.string.baidu_map_sdk_initializer_network_error_message, Toast.LENGTH_LONG).show();
break;
}
}
示例4: onReceive
@Override
public void onReceive(Context context, Intent intent) {
final String action = intent.getAction();
switch (action) {
case AttributeEvent.GPS_POSITION:
if (mPanMode.get() == AutoPanMode.DRONE) {
final Drone drone = getDroneApi();
if (!drone.isConnected())
return;
final Gps droneGps = drone.getAttribute(AttributeType.GPS);
if (droneGps != null && droneGps.isValid()) {
final LatLong droneLocation = droneGps.getPosition();
updateCamera(droneLocation);
}
}
break;
case SettingsFragment.ACTION_MAP_ROTATION_PREFERENCE_UPDATED:
getMapAsync(new OnMapReadyCallback() {
@Override
public void onMapReady(GoogleMap googleMap) {
setupMapUI(googleMap);
}
});
break;
}
}
示例5: 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;
}
}
示例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: 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();
}
}
示例8: 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;
}
}
示例9: onReceive
@Override
public void onReceive(Context context, Intent intent) {
final String action = intent.getAction();
switch (action) {
case AttributeEvent.GPS_POSITION:
if (mPanMode.get() == AutoPanMode.DRONE) {
final Drone drone = getDroneApi();
if (!drone.isConnected())
return;
final Gps droneGps = drone.getAttribute(AttributeType.GPS);
if (droneGps != null && droneGps.isValid()) {
final LatLong droneLocation = droneGps.getPosition();
updateCamera(droneLocation);
}
}
break;
case SettingsFragment.ACTION_MAP_ROTATION_PREFERENCE_UPDATED:
getMapAsync(new OnMapReadyCallback() {
@Override
public void onMapReady(GoogleMap googleMap) {
setupMapUI(googleMap);
}
});
break;
case SettingsFragment.ACTION_LOCATION_SETTINGS_UPDATED:
final int resultCode = intent.getIntExtra(SettingsFragment.EXTRA_RESULT_CODE, Activity.RESULT_OK);
switch (resultCode) {
case Activity.RESULT_OK:
// All required changes were successfully made. Try to acquire user location again
mGApiClientMgr.addTask(mRequestLocationUpdateTask);
break;
case Activity.RESULT_CANCELED:
// The user was asked to change settings, but chose not to
Toast.makeText(getActivity(), "Please update your location settings!", Toast.LENGTH_LONG).show();
break;
default:
break;
}
break;
}
}
示例10: 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);
}