FileDocCategorySizeDatePackage
GpsNavigationMessage.javaAPI DocAndroid 5.1 API7749Thu Mar 12 22:22:30 GMT 2015android.location

GpsNavigationMessage

public class GpsNavigationMessage extends Object implements android.os.Parcelable
A class containing a GPS satellite Navigation Message.
hide

Fields Summary
private static final String
TAG
private static final byte[]
EMPTY_ARRAY
public static final byte
TYPE_UNKNOWN
The type of the navigation message is not available or unknown.
public static final byte
TYPE_L1CA
The Navigation Message is of type L1 C/A.
public static final byte
TYPE_L2CNAV
The Navigation Message is of type L1-CNAV.
public static final byte
TYPE_L5CNAV
The Navigation Message is of type L5-CNAV.
public static final byte
TYPE_CNAV2
The Navigation Message is of type CNAV-2.
private byte
mType
private byte
mPrn
private short
mMessageId
private short
mSubmessageId
private byte[]
mData
public static final Creator
CREATOR
Constructors Summary
GpsNavigationMessage()


     
        initialize();
    
Methods Summary
public intdescribeContents()

        return 0;
    
public byte[]getData()
Gets the data associated with the Navigation Message. The bytes (or words) specified using big endian format (MSB first).

        return mData;
    
public shortgetMessageId()
Gets the Message Identifier. It provides an index so the complete Navigation Message can be assembled. i.e. for L1 C/A subframe 4 and 5, this value corresponds to the 'frame id' of the navigation message. Subframe 1, 2, 3 does not contain a 'frame id' and this might be reported as -1.

        return mMessageId;
    
public bytegetPrn()
Gets the Pseudo-random number. Range: [1, 32].

        return mPrn;
    
public shortgetSubmessageId()
Gets the Sub-message Identifier. If required by {@link #getType()}, this value contains a sub-index within the current message (or frame) that is being transmitted. i.e. for L1 C/A the sub-message identifier corresponds to the sub-frame Id of the navigation message.

        return mSubmessageId;
    
public bytegetType()
Gets the type of the navigation message contained in the object.

        return mType;
    
private java.lang.StringgetTypeString()
Gets a string representation of the 'type'. For internal and logging use only.

        switch (mType) {
            case TYPE_UNKNOWN:
                return "Unknown";
            case TYPE_L1CA:
                return "L1 C/A";
            case TYPE_L2CNAV:
                return "L2-CNAV";
            case TYPE_L5CNAV:
                return "L5-CNAV";
            case TYPE_CNAV2:
                return "CNAV-2";
            default:
                return "<Invalid>";
        }
    
private voidinitialize()

        mType = TYPE_UNKNOWN;
        mPrn = 0;
        mMessageId = -1;
        mSubmessageId = -1;
        mData = EMPTY_ARRAY;
    
public voidreset()
Resets all the contents to its original state.

        initialize();
    
public voidset(android.location.GpsNavigationMessage navigationMessage)
Sets all contents to the values stored in the provided object.

        mType = navigationMessage.mType;
        mPrn = navigationMessage.mPrn;
        mMessageId = navigationMessage.mMessageId;
        mSubmessageId = navigationMessage.mSubmessageId;
        mData = navigationMessage.mData;
    
public voidsetData(byte[] value)
Sets the data associated with the Navigation Message.

        if (value == null) {
            throw new InvalidParameterException("Data must be a non-null array");
        }

        mData = value;
    
public voidsetMessageId(short value)
Sets the Message Identifier.

        mMessageId = value;
    
public voidsetPrn(byte value)
Sets the Pseud-random number.

        mPrn = value;
    
public voidsetSubmessageId(short value)
Sets the Sub-message identifier.

        mSubmessageId = value;
    
public voidsetType(byte value)
Sets the type of the navigation message.

        switch (value) {
            case TYPE_UNKNOWN:
            case TYPE_L1CA:
            case TYPE_L2CNAV:
            case TYPE_L5CNAV:
            case TYPE_CNAV2:
                mType = value;
                break;
            default:
                Log.d(TAG, "Sanitizing invalid 'type': " + value);
                mType = TYPE_UNKNOWN;
                break;
        }
    
public java.lang.StringtoString()

        final String format = "   %-15s = %s\n";
        StringBuilder builder = new StringBuilder("GpsNavigationMessage:\n");

        builder.append(String.format(format, "Type", getTypeString()));
        builder.append(String.format(format, "Prn", mPrn));
        builder.append(String.format(format, "MessageId", mMessageId));
        builder.append(String.format(format, "SubmessageId", mSubmessageId));

        builder.append(String.format(format, "Data", "{"));
        String prefix = "        ";
        for(byte value : mData) {
            builder.append(prefix);
            builder.append(value);
            prefix = ", ";
        }
        builder.append(" }");

        return builder.toString();
    
public voidwriteToParcel(android.os.Parcel parcel, int flags)


          
        parcel.writeByte(mType);
        parcel.writeByte(mPrn);
        parcel.writeInt(mMessageId);
        parcel.writeInt(mSubmessageId);
        parcel.writeInt(mData.length);
        parcel.writeByteArray(mData);