MCPcopy Create free account
hub / github.com/SatDump/SatDump / process

Method process

plugins/aim_support/aim/module_aim_instruments.cpp:22–109  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

20 }
21
22 void AIMInstrumentsDecoderModule::process()
23 {
24 filesize = getFilesize(d_input_file);
25 std::ifstream data_in(d_input_file, std::ios::binary);
26
27 logger->info("Using input frames " + d_input_file);
28
29 time_t lastTime = 0;
30 uint8_t cadu[1244];
31
32 // Demuxers
33 ccsds::ccsds_tm::Demuxer demuxer_vcid1(1062, true, 12);
34
35 // std::ofstream output("file.ccsds");
36
37 // Products dataset
38 // satdump::ProductDataSet dataset;
39 // dataset.satellite_name = "AIM";
40 // dataset.timestamp = time(0); // avg_overflowless(avhrr_reader.timestamps);
41
42 cips_readers[0].init(340, 170);
43 cips_readers[1].init(170, 340);
44 cips_readers[2].init(340, 170);
45 cips_readers[3].init(170, 340);
46
47 while (!data_in.eof())
48 {
49 // Read buffer
50 data_in.read((char *)&cadu, 1244);
51
52 // Parse this transport frame
53 ccsds::ccsds_tm::VCDU vcdu = ccsds::ccsds_tm::parseVCDU(cadu);
54
55 // logger->info(pkt.header.apid);
56 // logger->info(vcdu.vcid);
57
58 if (vcdu.vcid == 1) // Replay VCID
59 {
60 std::vector<ccsds::CCSDSPacket> ccsdsFrames = demuxer_vcid1.work(cadu);
61 for (ccsds::CCSDSPacket &pkt : ccsdsFrames)
62 {
63 if (pkt.header.apid == 360)
64 cips_readers[0].work(pkt);
65 else if (pkt.header.apid == 361)
66 cips_readers[1].work(pkt);
67 else if (pkt.header.apid == 362)
68 cips_readers[2].work(pkt);
69 else if (pkt.header.apid == 363)
70 cips_readers[3].work(pkt);
71 }
72 }
73
74 progress = data_in.tellg();
75 if (time(NULL) % 10 == 0 && lastTime != time(NULL))
76 {
77 lastTime = time(NULL);
78 logger->info("Progress " + std::to_string(round(((double)progress / (double)filesize) * 1000.0) / 10.0) + "%%");
79 }

Callers

nothing calls this directly

Calls 11

getFilesizeFunction · 0.85
to_stringFunction · 0.85
save_imgFunction · 0.85
infoMethod · 0.80
eofMethod · 0.80
parseVCDUFunction · 0.50
initMethod · 0.45
readMethod · 0.45
workMethod · 0.45
closeMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected