com.swiftnav.sbp.tracking.TrackingChannelCorrelation.java Source code

Java tutorial

Introduction

Here is the source code for com.swiftnav.sbp.tracking.TrackingChannelCorrelation.java

Source

/*
 * Copyright (C) 2015 Swift Navigation Inc.
 * Contact: Gareth McMullin <gareth@swiftnav.com>
 * Contact: Bhaskar Mookerji <mookerji@swiftnav.com>
 *
 * This source is subject to the license found in the file 'LICENSE' which must
 * be be distributed together with this source. All other rights reserved.
 *
 * THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND,
 * EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED
 * WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE.
 */

package com.swiftnav.sbp.tracking;

import com.swiftnav.sbp.SBPMessage;
import com.swiftnav.sbp.SBPBinaryException;
import com.swiftnav.sbp.SBPStruct;
import com.swiftnav.sbp.gnss_signal.*;

import org.json.JSONObject;
import org.json.JSONArray;
import com.swiftnav.sbp.SBPStruct;

public class TrackingChannelCorrelation extends SBPStruct {

    /** In-phase correlation */
    public int I;

    /** Quadrature correlation */
    public int Q;

    public TrackingChannelCorrelation() {
    }

    @Override
    public TrackingChannelCorrelation parse(SBPMessage.Parser parser) throws SBPBinaryException {
        /* Parse fields from binary */
        I = parser.getS32();
        Q = parser.getS32();
        return this;
    }

    @Override
    public void build(SBPMessage.Builder builder) {
        /* Build fields into binary */
        builder.putS32(I);
        builder.putS32(Q);
    }

    @Override
    public JSONObject toJSON() {
        JSONObject obj = new JSONObject();
        obj.put("I", I);
        obj.put("Q", Q);
        return obj;
    }
}