2021-03-07 12:46:25 +01:00
|
|
|
/**********************************************************************
|
2022-03-20 20:56:32 +01:00
|
|
|
* This file is used for testing random stuff without running the
|
2021-03-07 12:46:25 +01:00
|
|
|
* whole of SatDump, which comes in handy for debugging individual
|
|
|
|
|
* elements before putting them all together in modules...
|
2022-03-20 20:56:32 +01:00
|
|
|
*
|
|
|
|
|
* If you are an user, ignore this file which will not be built by
|
2021-05-12 21:16:53 +02:00
|
|
|
* default, and if you're a developper in need of doing stuff here...
|
2021-03-07 12:46:25 +01:00
|
|
|
* Go ahead!
|
2022-03-20 20:56:32 +01:00
|
|
|
*
|
2021-03-07 12:46:25 +01:00
|
|
|
* Don't judge the code you might see in there! :)
|
|
|
|
|
**********************************************************************/
|
|
|
|
|
|
2022-03-28 11:51:13 +02:00
|
|
|
#include "logger.h"
|
2022-08-14 18:17:22 +02:00
|
|
|
#include <fstream>
|
2022-08-14 18:52:15 +02:00
|
|
|
#include "common/dsp/hier/gfsk_mod.h"
|
2022-08-14 18:17:22 +02:00
|
|
|
#include "common/dsp/file_sink.h"
|
2022-07-30 16:11:29 +02:00
|
|
|
|
2022-08-14 18:17:22 +02:00
|
|
|
#include "common/codings/randomization.h"
|
2022-05-30 14:25:41 +02:00
|
|
|
|
2022-05-11 23:46:39 +02:00
|
|
|
int main(int argc, char *argv[])
|
|
|
|
|
{
|
|
|
|
|
initLogger();
|
2022-08-14 18:17:22 +02:00
|
|
|
std::ifstream input_frm(argv[1]);
|
2022-06-08 21:50:47 +02:00
|
|
|
|
2022-08-14 18:17:22 +02:00
|
|
|
uint8_t cadu[1024];
|
2022-07-30 16:11:29 +02:00
|
|
|
|
2022-08-14 18:17:22 +02:00
|
|
|
std::shared_ptr<dsp::stream<float>> input_vco = std::make_shared<dsp::stream<float>>();
|
2022-07-30 16:11:29 +02:00
|
|
|
|
2022-08-14 18:52:15 +02:00
|
|
|
dsp::GFSKMod gfsk_mod(input_vco, 1.0, 0.35);
|
2022-07-30 16:11:29 +02:00
|
|
|
|
2022-08-14 18:52:15 +02:00
|
|
|
dsp::FileSinkBlock file_sink_blk(gfsk_mod.output_stream);
|
2022-07-30 16:11:29 +02:00
|
|
|
|
2022-08-14 18:52:15 +02:00
|
|
|
gfsk_mod.start();
|
2022-08-14 18:17:22 +02:00
|
|
|
file_sink_blk.start();
|
2022-08-14 18:52:15 +02:00
|
|
|
file_sink_blk.set_output_sample_type(dsp::CF_32);
|
2022-08-14 18:17:22 +02:00
|
|
|
file_sink_blk.start_recording("test", 2e6);
|
2022-07-30 16:11:29 +02:00
|
|
|
|
2022-08-14 18:17:22 +02:00
|
|
|
while (!input_frm.eof())
|
2022-07-30 16:11:29 +02:00
|
|
|
{
|
2022-08-14 18:17:22 +02:00
|
|
|
input_frm.read((char *)cadu, 1024);
|
2022-07-30 16:11:29 +02:00
|
|
|
|
2022-08-14 18:17:22 +02:00
|
|
|
derand_ccsds(&cadu[4], 1020);
|
2022-07-30 16:11:29 +02:00
|
|
|
|
2022-08-14 18:17:22 +02:00
|
|
|
for (int i = 0; i < 8192; i++)
|
2022-07-31 12:33:07 +02:00
|
|
|
{
|
2022-08-14 18:17:22 +02:00
|
|
|
bool bit = (cadu[i / 8] >> (7 - (i % 8))) & 1;
|
|
|
|
|
input_vco->writeBuf[i] = bit ? 1 : -1;
|
2022-07-30 16:11:29 +02:00
|
|
|
}
|
|
|
|
|
|
2022-08-14 18:17:22 +02:00
|
|
|
input_vco->swap(8192);
|
2022-07-31 12:33:07 +02:00
|
|
|
}
|
|
|
|
|
|
2022-08-14 18:17:22 +02:00
|
|
|
logger->critical("DONE!!");
|
|
|
|
|
}
|