Android Open Source - 3DR-Services-Library State






From Project

Back to project page 3DR-Services-Library.

License

The source code is released under:

Apache License

If you think the Android project 3DR-Services-Library listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.

Java Source Code

package com.ox3dr.services.android.lib.drone.property;
//  ww  w  . ja  v  a2  s. c  o m
import android.os.Parcel;
import android.os.Parcelable;
import android.text.TextUtils;

/**
 * Created by fhuya on 10/28/14.
 */
public class State implements Parcelable {

    private boolean armed;
    private boolean isFlying;
    private String calibrationStatus;
    private VehicleMode vehicleMode;
    private Type vehicleType;
    private String failsafeWarning;

    public State(VehicleMode mode, Type type, boolean armed, boolean flying,
                 String failsafeWarning){
        this.vehicleMode = mode;
        this.vehicleType = type;
        this.armed = armed;
        this.isFlying = flying;
        this.failsafeWarning = failsafeWarning;
    }

    public boolean isArmed() {
        return armed;
    }

    public boolean isFlying() {
        return isFlying;
    }

    public VehicleMode getVehicleMode() {
        return vehicleMode;
    }

    public Type getVehicleType(){
        return vehicleType;
    }

    public String getFailsafeWarning() {
        return failsafeWarning;
    }

    public void setFailsafeWarning(String failsafeWarning) {
        this.failsafeWarning = failsafeWarning;
    }

    public boolean isWarning(){
        return TextUtils.isEmpty(failsafeWarning);
    }

    public boolean isCalibrating(){
        return calibrationStatus != null;
    }

    public void setCalibration(String message){
        this.calibrationStatus = message;
    }

    public String getCalibrationStatus(){
        return this.calibrationStatus;
    }

    @Override
    public int describeContents() {
        return 0;
    }

    @Override
    public void writeToParcel(Parcel dest, int flags) {
        dest.writeByte(armed ? (byte) 1 : (byte) 0);
        dest.writeByte(isFlying ? (byte) 1 : (byte) 0);
        dest.writeString(this.calibrationStatus);
        dest.writeParcelable(this.vehicleMode, 0);
        dest.writeParcelable(this.vehicleType, 0);
        dest.writeString(this.failsafeWarning);
    }

    private State(Parcel in) {
        this.armed = in.readByte() != 0;
        this.isFlying = in.readByte() != 0;
        this.calibrationStatus = in.readString();
        this.vehicleMode = in.readParcelable(VehicleMode.class.getClassLoader());
        this.vehicleType = in.readParcelable(Type.class.getClassLoader());
        this.failsafeWarning = in.readString();
    }

    public static final Creator<State> CREATOR = new Creator<State>() {
        public State createFromParcel(Parcel source) {
            return new State(source);
        }

        public State[] newArray(int size) {
            return new State[size];
        }
    };
}




Java Source Code List

com.ox3dr.services.android.lib.ApplicationTest.java
com.ox3dr.services.android.lib.coordinate.LatLngAlt.java
com.ox3dr.services.android.lib.coordinate.LatLng.java
com.ox3dr.services.android.lib.drone.connection.ConnectionParameter.java
com.ox3dr.services.android.lib.drone.connection.ConnectionResult.java
com.ox3dr.services.android.lib.drone.connection.ConnectionType.java
com.ox3dr.services.android.lib.drone.event.Event.java
com.ox3dr.services.android.lib.drone.event.Extra.java
com.ox3dr.services.android.lib.drone.property.Altitude.java
com.ox3dr.services.android.lib.drone.property.Attitude.java
com.ox3dr.services.android.lib.drone.property.Battery.java
com.ox3dr.services.android.lib.drone.property.Gps.java
com.ox3dr.services.android.lib.drone.property.Home.java
com.ox3dr.services.android.lib.drone.property.MissionItemMessage.java
com.ox3dr.services.android.lib.drone.property.Mission.java
com.ox3dr.services.android.lib.drone.property.Parameter.java
com.ox3dr.services.android.lib.drone.property.Parameters.java
com.ox3dr.services.android.lib.drone.property.Speed.java
com.ox3dr.services.android.lib.drone.property.State.java
com.ox3dr.services.android.lib.drone.property.Type.java
com.ox3dr.services.android.lib.drone.property.VehicleMode.java