Skip to content

Commit

Permalink
Merge pull request #193 from pixxelhq/master
Browse files Browse the repository at this point in the history
v5.10.9-Pixxel-8.1.0
  • Loading branch information
swarup-n authored Jan 13, 2025
2 parents f525999 + 15f054b commit 3d5b9a0
Show file tree
Hide file tree
Showing 32 changed files with 52 additions and 193 deletions.
2 changes: 1 addition & 1 deletion distribution/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<parent>
<groupId>org.yamcs</groupId>
<artifactId>yamcs</artifactId>
<version>5.10.9-Pixxel-8.0.0</version>
<version>5.10.9-Pixxel-8.1.0</version>
</parent>

<artifactId>distribution</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion examples/cascading/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<groupId>org.yamcs.examples</groupId>
<artifactId>examples</artifactId>
<version>5.10.9-Pixxel-8.0.0</version>
<version>5.10.9-Pixxel-8.1.0</version>
</parent>

<artifactId>cascading</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion examples/ccsds-frames/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<groupId>org.yamcs.examples</groupId>
<artifactId>examples</artifactId>
<version>5.10.9-Pixxel-8.0.0</version>
<version>5.10.9-Pixxel-8.1.0</version>
</parent>

<artifactId>ccsds-frames</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion examples/cfdp-udp/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<groupId>org.yamcs.examples</groupId>
<artifactId>examples</artifactId>
<version>5.10.9-Pixxel-8.0.0</version>
<version>5.10.9-Pixxel-8.1.0</version>
</parent>

<artifactId>cfdp-udp</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion examples/cfdp/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<groupId>org.yamcs.examples</groupId>
<artifactId>examples</artifactId>
<version>5.10.9-Pixxel-8.0.0</version>
<version>5.10.9-Pixxel-8.1.0</version>
</parent>

<artifactId>cfdp</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion examples/perftest1/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<groupId>org.yamcs.examples</groupId>
<artifactId>examples</artifactId>
<version>5.10.9-Pixxel-8.0.0</version>
<version>5.10.9-Pixxel-8.1.0</version>
</parent>

<artifactId>perftest1</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion examples/perftest2/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<groupId>org.yamcs.examples</groupId>
<artifactId>examples</artifactId>
<version>5.10.9-Pixxel-8.0.0</version>
<version>5.10.9-Pixxel-8.1.0</version>
</parent>

<artifactId>perftest2</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion examples/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<groupId>org.yamcs</groupId>
<artifactId>yamcs</artifactId>
<version>5.10.9-Pixxel-8.0.0</version>
<version>5.10.9-Pixxel-8.1.0</version>
</parent>

<groupId>org.yamcs.examples</groupId>
Expand Down
2 changes: 1 addition & 1 deletion examples/pus/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<groupId>org.yamcs.examples</groupId>
<artifactId>examples</artifactId>
<version>5.10.9-Pixxel-8.0.0</version>
<version>5.10.9-Pixxel-8.1.0</version>
</parent>

<artifactId>pus</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion examples/replication1/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<groupId>org.yamcs.examples</groupId>
<artifactId>examples</artifactId>
<version>5.10.9-Pixxel-8.0.0</version>
<version>5.10.9-Pixxel-8.1.0</version>
</parent>

<artifactId>replication1</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion examples/replication2/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<groupId>org.yamcs.examples</groupId>
<artifactId>examples</artifactId>
<version>5.10.9-Pixxel-8.0.0</version>
<version>5.10.9-Pixxel-8.1.0</version>
</parent>

<artifactId>replication2</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion examples/replication3/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<groupId>org.yamcs.examples</groupId>
<artifactId>examples</artifactId>
<version>5.10.9-Pixxel-8.0.0</version>
<version>5.10.9-Pixxel-8.1.0</version>
</parent>

<artifactId>replication3</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion examples/simulation/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<groupId>org.yamcs.examples</groupId>
<artifactId>examples</artifactId>
<version>5.10.9-Pixxel-8.0.0</version>
<version>5.10.9-Pixxel-8.1.0</version>
</parent>

<artifactId>simulation</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion examples/snippets/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<groupId>org.yamcs.examples</groupId>
<artifactId>examples</artifactId>
<version>5.10.9-Pixxel-8.0.0</version>
<version>5.10.9-Pixxel-8.1.0</version>
</parent>

<artifactId>snippets</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion examples/templates/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<groupId>org.yamcs.examples</groupId>
<artifactId>examples</artifactId>
<version>5.10.9-Pixxel-8.0.0</version>
<version>5.10.9-Pixxel-8.1.0</version>
</parent>

<artifactId>templates</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion packet-viewer/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<parent>
<groupId>org.yamcs</groupId>
<artifactId>yamcs</artifactId>
<version>5.10.9-Pixxel-8.0.0</version>
<version>5.10.9-Pixxel-8.1.0</version>
</parent>

<artifactId>packet-viewer</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<modelVersion>4.0.0</modelVersion>
<groupId>org.yamcs</groupId>
<artifactId>yamcs</artifactId>
<version>5.10.9-Pixxel-8.0.0</version>
<version>5.10.9-Pixxel-8.1.0</version>

<packaging>pom</packaging>

Expand Down
2 changes: 1 addition & 1 deletion simulator/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<groupId>org.yamcs</groupId>
<artifactId>yamcs</artifactId>
<version>5.10.9-Pixxel-8.0.0</version>
<version>5.10.9-Pixxel-8.1.0</version>
</parent>

<artifactId>simulator</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion tests/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<parent>
<groupId>org.yamcs</groupId>
<artifactId>yamcs</artifactId>
<version>5.10.9-Pixxel-8.0.0</version>
<version>5.10.9-Pixxel-8.1.0</version>
</parent>

<artifactId>tests</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion yamcs-api/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<parent>
<groupId>org.yamcs</groupId>
<artifactId>yamcs</artifactId>
<version>5.10.9-Pixxel-8.0.0</version>
<version>5.10.9-Pixxel-8.1.0</version>
</parent>

<artifactId>yamcs-api</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion yamcs-client/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<parent>
<groupId>org.yamcs</groupId>
<artifactId>yamcs</artifactId>
<version>5.10.9-Pixxel-8.0.0</version>
<version>5.10.9-Pixxel-8.1.0</version>
</parent>

<artifactId>yamcs-client</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion yamcs-core/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<parent>
<groupId>org.yamcs</groupId>
<artifactId>yamcs</artifactId>
<version>5.10.9-Pixxel-8.0.0</version>
<version>5.10.9-Pixxel-8.1.0</version>
</parent>

<artifactId>yamcs-core</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,6 @@
import org.yamcs.yarch.YarchException;
import org.yamcs.yarch.rocksdb.protobuf.Tablespace.ObjectProperties;

import com.google.gson.Gson;


public class SubServiceTen implements PusSubService {
String yamcsInstance;
Expand Down Expand Up @@ -92,38 +90,16 @@ public ObjectProperties findObject(int uniqueSignature) throws IOException {
return null;
}

public ArrayList<byte[]> generateTimetagScheduleDetailReport(long gentime, Map<Long, byte[]> requestTcPacketsMap, Map<String, Integer> props, ObjectProperties foundObject, int apid) {
long missionTime = PusTmManager.timeService.getMissionTime();

public ArrayList<byte[]> generateTimetagScheduleDetailReport(long gentime, Map<Long, byte[]> requestTcPacketsMap, ObjectProperties foundObject, int apid) {
String filename;
String content;
Map<String, String> metadata;

if (foundObject == null) {
filename = "timetagScheduleDetailReport/" + folders.get(apid) + "/" + LocalDateTime.ofInstant(
Instant.ofEpochSecond(gentime),
ZoneId.of("GMT")
).format(DateTimeFormatter.ofPattern("yyyy-MM-dd'T'HH:mm:ss'Z'")) + ".csv";

// Populate metadata
metadata = new HashMap<>();
metadata.put("CreationTime", LocalDateTime.ofInstant(
Instant.ofEpochMilli(missionTime),
ZoneId.of("GMT")
).format(DateTimeFormatter.ofPattern("yyyy-MM-dd'T'HH:mm:ss'Z'")));

// Populate properties
for (Map.Entry<String, Integer> prop: props.entrySet()) {
if (prop.getKey() == "ReportIndex") {
List<String> indices = new ArrayList<>();

indices.add(String.valueOf(prop.getValue()));
metadata.put("ReportIndices", new Gson().toJson(indices));
continue;
}
metadata.put(prop.getKey(), prop.getValue().toString());
}

try (StringWriter stringWriter = new StringWriter();
BufferedWriter writer = new BufferedWriter(stringWriter)) {

Expand All @@ -138,16 +114,7 @@ public ArrayList<byte[]> generateTimetagScheduleDetailReport(long gentime, Map<L
throw new UncheckedIOException("S(11, 10) | Cannot save timetag summary report in bucket: " + filename + " " + (timetagScheduleDetailReportBucket != null ? " -> " + timetagScheduleDetailReportBucket.getName() : ""), e);
}
} else {
metadata = new HashMap<>(foundObject.getMetadataMap());
filename = foundObject.getName();

// Update Report indices in metadata
@SuppressWarnings("unchecked")
List<String> indices = new Gson().fromJson(metadata.get("ReportIndices"), ArrayList.class);

indices.add(String.valueOf(props.get("ReportIndex")));
metadata.put("ReportIndices", new Gson().toJson(indices));

try {
// Fetch content from foundObject
content = new String(timetagScheduleDetailReportBucket.getObject(filename), StandardCharsets.UTF_8);
Expand Down Expand Up @@ -199,7 +166,7 @@ public ArrayList<byte[]> generateTimetagScheduleDetailReport(long gentime, Map<L
writer.flush();

// Put report in the bucket
timetagScheduleDetailReportBucket.putObject(filename, "csv", metadata, stringWriter.getBuffer().toString().getBytes(StandardCharsets.UTF_8));
timetagScheduleDetailReportBucket.putObject(filename, "csv", null, stringWriter.getBuffer().toString().getBytes(StandardCharsets.UTF_8));

} catch (IOException e) {
throw new UncheckedIOException("S(11, 10) | Cannot save timetag detail report in bucket: " + filename + " | " + (timetagScheduleDetailReportBucket != null ? " -> " + timetagScheduleDetailReportBucket.getName() : ""), e);
Expand All @@ -217,43 +184,26 @@ public PreparedCommand process(PreparedCommand telecommand) {
public ArrayList<TmPacket> process(TmPacket tmPacket) {
PusTmCcsdsPacket pPkt = new PusTmCcsdsPacket(tmPacket.getPacket());
byte[] dataField = pPkt.getDataField();
byte[] spareField = pPkt.getSpareField();

int apid = pPkt.getAPID();

Map<String, Integer> props = new HashMap<>();
int uniqueSignature = (int) ByteArrayUtils.decodeCustomInteger(spareField, PusTmManager.spareOffsetForFractionTime, uniqueSignatureSize);
int reportCount = (int) ByteArrayUtils.decodeCustomInteger(spareField, PusTmManager.spareOffsetForFractionTime + uniqueSignatureSize, reportCountSize);
int reportIndex = (int) ByteArrayUtils.decodeCustomInteger(spareField, PusTmManager.spareOffsetForFractionTime + uniqueSignatureSize + reportCountSize, reportIndexSize);

props.put("UniqueSignature", uniqueSignature);
props.put("ReportIndex", reportIndex);
props.put("ReportCount", reportCount);

Map<Long, byte[]> requestTcPacketsMap = getRequestTcPacketMap(dataField);

// Check if a unique file already exists
ObjectProperties foundObject = null;
long generationTime = ByteArrayUtils.decodeCustomInteger(pPkt.getGenerationTime(), 0, PusTmManager.absoluteTimeLength);
String filename = "timetagScheduleDetailReport/" + folders.get(apid) + "/" + LocalDateTime.ofInstant(
Instant.ofEpochSecond(generationTime),
ZoneId.of("GMT")
).format(DateTimeFormatter.ofPattern("yyyy-MM-dd'T'HH:mm:ss'Z'")) + ".csv";

ArrayList<byte[]> newPayload = new ArrayList<>();
try {
foundObject = findObject(uniqueSignature);
if (foundObject == null) {
String filename = "timetagScheduleDetailReport/" + folders.get(apid) + "/" + LocalDateTime.ofInstant(
Instant.ofEpochSecond(generationTime),
ZoneId.of("GMT")
).format(DateTimeFormatter.ofPattern("yyyy-MM-dd'T'HH:mm:ss'Z'")) + ".csv";

foundObject = timetagScheduleDetailReportBucket.findObject(filename);
}
ObjectProperties foundObject = timetagScheduleDetailReportBucket.findObject(filename);
newPayload = generateTimetagScheduleDetailReport(generationTime, requestTcPacketsMap, foundObject, apid);

} catch (IOException e) {
throw new UncheckedIOException("S(11, 10) | Unable to find object with UniqueSignature: " + uniqueSignature + " in bucket: " + (timetagScheduleDetailReportBucket != null ? " -> " + timetagScheduleDetailReportBucket.getName() : ""), e);
throw new UncheckedIOException("S(11, 10) | Unable to find object with filename: " + filename + " in bucket: " + (timetagScheduleDetailReportBucket != null ? " -> " + timetagScheduleDetailReportBucket.getName() : ""), e);
}

// Generate the report
ArrayList<byte[]> newPayload = generateTimetagScheduleDetailReport(generationTime, requestTcPacketsMap, props, foundObject, apid);

// Create a new TmPacket similar S(11, 10)
byte[] primaryHeader = pPkt.getPrimaryHeader();
byte[] secondaryHeader = pPkt.getSecondaryHeader();
Expand Down
Loading

0 comments on commit 3d5b9a0

Please sign in to comment.