package org.josast.CubesatSim.TLM;

import java.util.HashMap;

import org.josast.CubesatSim.kaitai.generated.Cubesatsim;
import org.josast.CubesatSim.kaitai.generated.Cubesatsim.CubesatsimAo7;
import org.josast.CubesatSim.kaitai.generated.Cubesatsim.CubesatsimData;

import io.kaitai.struct.ByteBufferKaitaiStream;

public class ManageFrame {

    private Cubesatsim cube = null;
    private HashMap<String, String> hashHeader = new HashMap<String, String>();

    public ManageFrame(byte[] data) {
        cube = new Cubesatsim(new ByteBufferKaitaiStream(data));
    }

    public String HeaderToString() {
        hashHeader.put("Source",
                cube.ax25Header().srcAddress().srcAddressStr());
        hashHeader.put("Destination",
                cube.ax25Header().destAddress().destAddressStr());
        hashHeader.put("Dest SSID", "" + cube.ax25Header().destSsid());
        hashHeader.put("Src SSID", "" + cube.ax25Header().srcSsid());
        return hashHeader.toString();
    }

    public CubesatsimAo7 getCubesatsimAo7() {
        CubesatsimData data = cube.frametype().ax25Info();
        return data.payload();

    }

}
