本文整理汇总了Java中com.o3dr.android.client.Drone.isConnected方法的典型用法代码示例。如果您正苦于以下问题:Java Drone.isConnected方法的具体用法?Java Drone.isConnected怎么用?Java Drone.isConnected使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.o3dr.android.client.Drone
的用法示例。
在下文中一共展示了Drone.isConnected方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: onApiConnected
import com.o3dr.android.client.Drone; //导入方法依赖的package包/类
@Override
public void onApiConnected() {
Drone drone = getDrone();
State droneState = drone.getState();
if (drone.isConnected() && !droneState.isFlying()) {
btnStep.setEnabled(true);
if (droneState.isCalibrating()) {
processMAVMessage(droneState.getCalibrationStatus(), false);
}
else{
resetCalibration();
}
} else {
btnStep.setEnabled(false);
resetCalibration();
}
getBroadcastManager().registerReceiver(broadcastReceiver, intentFilter);
}
示例2: goToDroneLocation
import com.o3dr.android.client.Drone; //导入方法依赖的package包/类
@Override
public void goToDroneLocation() {
Drone dpApi = getDroneApi();
if (!dpApi.isConnected())
return;
Gps gps = dpApi.getGps();
if (!gps.isValid()) {
Toast.makeText(getActivity().getApplicationContext(), R.string.drone_no_location, Toast.LENGTH_SHORT).show();
return;
}
final float currentZoomLevel = getBaiduMap().getMapStatus().zoom;
final LatLong droneLocation = gps.getPosition();
updateCamera(droneLocation, (int) currentZoomLevel);
}
示例3: updateDroneState
import com.o3dr.android.client.Drone; //导入方法依赖的package包/类
private void updateDroneState(Drone drone) {
if (mInboxBuilder == null)
return;
mHandler.removeCallbacks(mFlightTimeUpdater);
if (drone != null && drone.isConnected()) {
mFlightTimeUpdater.run();
}
}
示例4: updateDroneState
import com.o3dr.android.client.Drone; //导入方法依赖的package包/类
private void updateDroneState(Drone drone) {
if (mInboxBuilder == null)
return;
mHandler.removeCallbacks(mFlightTimeUpdater);
if (drone != null && drone.isConnected()) {
mFlightTimeUpdater.run();
}
}
示例5: toggleDroneConnection
import com.o3dr.android.client.Drone; //导入方法依赖的package包/类
public void toggleDroneConnection() {
final Drone drone = dpApp.getDrone();
if (drone != null && drone.isConnected())
dpApp.disconnectFromDrone();
else
dpApp.connectToDrone();
}
示例6: startCalibration
import com.o3dr.android.client.Drone; //导入方法依赖的package包/类
private void startCalibration() {
Drone dpApi = getDrone();
if (dpApi.isConnected()) {
CalibrationApi.getApi(dpApi).startIMUCalibration(new SimpleCommandListener(){
@Override
public void onError(int error){
Toast.makeText(getActivity(), R.string.imu_calibration_start_error, Toast.LENGTH_LONG).show();
}
});
}
}
示例7: onApiConnected
import com.o3dr.android.client.Drone; //导入方法依赖的package包/类
@Override
public void onApiConnected() {
Drone drone = getDrone();
if (drone.isConnected() && !drone.getState().isFlying()) {
buttonStep.setEnabled(true);
} else {
cancelCalibration();
buttonStep.setEnabled(false);
}
getBroadcastManager().registerReceiver(broadcastReceiver, intentFilter);
if (calibrationStatus == CALIBRATION_IN_PROGRESS) {
startCalibration();
}
}
示例8: onApiConnected
import com.o3dr.android.client.Drone; //导入方法依赖的package包/类
@Override
public void onApiConnected() {
Drone drone = getDrone();
if(drone.isConnected())
selectActionsBar(drone.getType().getDroneType());
else{
selectActionsBar(-1);
}
getBroadcastManager().registerReceiver(eventReceiver, eventFilter);
}
示例9: onReceive
import com.o3dr.android.client.Drone; //导入方法依赖的package包/类
@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;
}
}
示例10: onScrollingEnded
import com.o3dr.android.client.Drone; //导入方法依赖的package包/类
@Override
public void onScrollingEnded(CardWheelHorizontalView cardWheel, LengthUnit startValue, LengthUnit endValue) {
switch (cardWheel.getId()) {
case R.id.altitude_spinner:
final Drone drone = getDrone();
if (drone.isConnected()) {
ControlApi.getApi(drone).climbTo(endValue.toBase().getValue());
}
break;
}
}
示例11: updateItemView
import com.o3dr.android.client.Drone; //导入方法依赖的package包/类
@Override
public void updateItemView(Context context, Drone drone) {
if (mItemView == null)
return;
String infoUpdate;
Battery droneBattery;
if (drone == null || !drone.isConnected() || ((droneBattery = drone.getBattery()) ==
null)) {
infoUpdate = sDefaultValue;
currentView.setText(sDefaultValue);
mAhView.setText(sDefaultValue);
} else {
Double discharge = droneBattery.getBatteryDischarge();
String dischargeText;
if (discharge == null) {
dischargeText = sDefaultValue;
}else{
dischargeText = String.format(Locale.ENGLISH, "%2.0f mAh", discharge);
}
mAhView.setText(String.format(Locale.ENGLISH,"Remaining %2.0f%%", droneBattery.getBatteryRemain()));
currentView.setText(String.format("Current %2.1f A", droneBattery.getBatteryCurrent()));
infoUpdate = String.format(Locale.ENGLISH,"%2.1fv\n", droneBattery.getBatteryVoltage());
infoUpdate = infoUpdate.concat(dischargeText);
}
mPopup.update();
((TextView) mItemView).setText(infoUpdate);
}
示例12: onItemSelected
import com.o3dr.android.client.Drone; //导入方法依赖的package包/类
@Override
public void onItemSelected(AdapterView<?> parent, View view, int position, long id) {
final FollowType type = adapter.getItem(position);
getAppPrefs().setLastKnownFollowType(type);
final Drone drone = getDrone();
if (drone.isConnected()) {
FollowApi.getApi(drone).enableFollowMe(type);
}
}
示例13: onReceive
import com.o3dr.android.client.Drone; //导入方法依赖的package包/类
@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;
}
}
示例14: onApiConnected
import com.o3dr.android.client.Drone; //导入方法依赖的package包/类
@Override
public void onApiConnected() {
final Drone drone = getDrone();
if (drone.isConnected())
showTelemBar();
else
hideTelemBar();
updateAllTelem();
getBroadcastManager().registerReceiver(eventReceiver, eventFilter);
}
示例15: onChanged
import com.o3dr.android.client.Drone; //导入方法依赖的package包/类
@Override
public void onChanged(CardWheelHorizontalView cardWheel, int oldValue, int newValue) {
switch (cardWheel.getId()) {
case R.id.altitude_spinner:
final Drone drone = getDrone();
if (drone.isConnected())
drone.setGuidedAltitude(newValue);
break;
}
}