Skip to content
SIDSData.java 4.85 KiB
Newer Older
xtof's avatar
xtof committed
package org.josast.SIDS;

import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.TimeZone;

xtof's avatar
xtof committed
/**
 * SIDSdate is a simple class used to store SIDS data information
 *
xtof's avatar
xtof committed
 * @author Xtophe
 *
 */

public class SIDSData {

xtof's avatar
xtof committed
    private final SimpleDateFormat ISO8601DATEFORMAT = new SimpleDateFormat(
            "yyyy-MM-dd'T'HH:mm:ss'Z'");

    private int noradID; // Norad ID of the spacecraft

    private String source = ""; // Callsign or user name of the receiver

    private String timestamp; // UTC timestamp (see ISO 8601)
                              // 2018-01-24T23:42:46Z

    private String frame; // The received data, in hexadecimal string (AX.25
                          // packet with or without KISS 'C0 00 .. C0'.
                          // Whitespaces optional. C0 00 A9 05 DE ...

    private final String locator = "longLat"; // Type of the given receiver's
                                              // location. Currently, only
                                              // 'longLat' is supported. longLat

    private String longitude = null; // Longitude of the receiver (WGS84)
                                     // 8.95564E

    private String latitude = null; // Latitude of the receiver (WGS84)
                                    // 49.73145N

    private int tncPort = 0; // Optional as per SiDS standard specification, but
                             // not used in PicSat SiDS system 0

    private double azimuth = 0.0; // azimuth degree of directionnal antenna (if
                                  // avaiblable) 10.5
xtof's avatar
xtof committed

xtof's avatar
xtof committed
    private double elevation = 0.0; // elevation degree of directionnal antenna
                                    // (if avaiblable) 85.0
xtof's avatar
xtof committed

xtof's avatar
xtof committed
    private long fDown = 0; // Frequency of the receiver's downlink channel
                            // during reception (with Doppler), in Hz 435525000
xtof's avatar
xtof committed

xtof's avatar
xtof committed
    private final String version = "2.0.1";
xtof's avatar
xtof committed

xtof's avatar
xtof committed
    public SIDSData() {
xtof's avatar
xtof committed

xtof's avatar
xtof committed
    }
xtof's avatar
xtof committed

xtof's avatar
xtof committed
    /**
     * addTelemetryData is used for adding telemetry data with associated
     * TimeStamp. The timestamp is formated in correct date format.
     *
     * @param date       Date in local time
     * @param inputframe telemetry data
     */
    public void setTelemetryData(final Date date, final String inputframe) {
xtof's avatar
xtof committed

xtof's avatar
xtof committed
        ISO8601DATEFORMAT.setTimeZone(TimeZone.getTimeZone("UTC"));
        timestamp = ISO8601DATEFORMAT.format(date);
        frame = inputframe;
xtof's avatar
xtof committed

xtof's avatar
xtof committed
    }
xtof's avatar
xtof committed

xtof's avatar
xtof committed
    public String getLongitude() {
        return longitude;
    }
xtof's avatar
xtof committed

xtof's avatar
xtof committed
    public void setLongitude(final String longitude) {
        this.longitude = longitude;
    }
xtof's avatar
xtof committed

xtof's avatar
xtof committed
    public String getLatitude() {
        return latitude;
    }
xtof's avatar
xtof committed

xtof's avatar
xtof committed
    public void setLatitude(final String latitudein) {
        this.latitude = latitudein;
    }
xtof's avatar
xtof committed

xtof's avatar
xtof committed
    public int getNoradID() {
        return noradID;
    }
xtof's avatar
xtof committed

xtof's avatar
xtof committed
    public void setNoradID(final int noradID) {
        this.noradID = noradID;
    }
xtof's avatar
xtof committed

xtof's avatar
xtof committed
    public String getSource() {
        return source;
    }
xtof's avatar
xtof committed

xtof's avatar
xtof committed
    public void setSource(final String source) {
        this.source = source;
    }
xtof's avatar
xtof committed

xtof's avatar
xtof committed
    public String getTimestamp() {
        return timestamp;
    }
xtof's avatar
xtof committed

xtof's avatar
xtof committed
    public void setTimestamp(final String timestamp) {
        this.timestamp = timestamp;
    }
xtof's avatar
xtof committed

xtof's avatar
xtof committed
    public String getFrame() {
        return frame;
    }
xtof's avatar
xtof committed

xtof's avatar
xtof committed
    public void setFrame(final String frame) {
        this.frame = frame;
    }
xtof's avatar
xtof committed

xtof's avatar
xtof committed
    public int getTncPort() {
        return tncPort;
    }
xtof's avatar
xtof committed

xtof's avatar
xtof committed
    public void setTncPort(final int tncPort) {
        this.tncPort = tncPort;
    }
xtof's avatar
xtof committed

xtof's avatar
xtof committed
    public double getAzimuth() {
        return azimuth;
    }
xtof's avatar
xtof committed

xtof's avatar
xtof committed
    public void setAzimuth(final double azimuth) {
        this.azimuth = azimuth;
    }
xtof's avatar
xtof committed

xtof's avatar
xtof committed
    public double getElevation() {
        return elevation;
    }
xtof's avatar
xtof committed

xtof's avatar
xtof committed
    public void setElevation(final double elevation) {
        this.elevation = elevation;
    }
xtof's avatar
xtof committed

xtof's avatar
xtof committed
    public long getfDown() {
        return fDown;
    }
xtof's avatar
xtof committed

xtof's avatar
xtof committed
    public void setfDown(final long fDown) {
        this.fDown = fDown;
    }
xtof's avatar
xtof committed

xtof's avatar
xtof committed
    /**
     * Set Station information. Fill source, longitude & latitude information.
     *
     * @param station
     */
    public void setStation(final Station station) {

        source = station.getCallsign();
xtof's avatar
xtof committed

xtof's avatar
xtof committed
        longitude = station.getLongitude();
xtof's avatar
xtof committed

xtof's avatar
xtof committed
        latitude = station.getLatitude();
xtof's avatar
xtof committed

xtof's avatar
xtof committed
    }
xtof's avatar
xtof committed

xtof's avatar
xtof committed
    public String getLocator() {
xtof's avatar
xtof committed

xtof's avatar
xtof committed
        return locator;
    }
xtof's avatar
xtof committed

xtof's avatar
xtof committed
    public String toStringBasic() {
        StringBuilder sb = new StringBuilder();
        sb.append("noradID=");
        sb.append(noradID);
        sb.append("&source=");
        sb.append(source);
        sb.append("&timestamp=");
        sb.append(timestamp);
        sb.append("&frame=");
        sb.append(frame);
        sb.append("&locator=");
        sb.append(locator);
        sb.append("&longitude=");
        sb.append(longitude);
        sb.append("&latitude=");
        sb.append(latitude);
        sb.append("&version=");
        sb.append(version);
xtof's avatar
xtof committed

xtof's avatar
xtof committed
        return sb.toString();
xtof's avatar
xtof committed

xtof's avatar
xtof committed
    }
xtof's avatar
xtof committed

}