-
-
Notifications
You must be signed in to change notification settings - Fork 10
/
Swampsat2Test.java
43 lines (35 loc) · 1.46 KB
/
Swampsat2Test.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
package ru.r2cloud.jradio.swampsat2;
import static org.junit.Assert.assertTrue;
import org.junit.After;
import org.junit.Test;
import ru.r2cloud.jradio.AssertJson;
import ru.r2cloud.jradio.Ax25G3ruhBeaconSource;
import ru.r2cloud.jradio.blocks.ClockRecoveryMM;
import ru.r2cloud.jradio.blocks.FloatToChar;
import ru.r2cloud.jradio.blocks.LowPassFilter;
import ru.r2cloud.jradio.blocks.MultiplyConst;
import ru.r2cloud.jradio.blocks.Rail;
import ru.r2cloud.jradio.blocks.Window;
import ru.r2cloud.jradio.source.WavFileSource;
public class Swampsat2Test {
private Ax25G3ruhBeaconSource<Swampsat2Beacon> input;
@Test
public void testDecodeTelemetry() throws Exception {
float gainMu = 0.175f * 3;
WavFileSource source = new WavFileSource(Swampsat2Test.class.getClassLoader().getResourceAsStream("SwampSat2.wav"));
MultiplyConst mc = new MultiplyConst(source, 1);
LowPassFilter lpf = new LowPassFilter(mc, 1.0, 10000, 600, Window.WIN_HAMMING, 6.76);
ClockRecoveryMM clockRecovery = new ClockRecoveryMM(lpf, lpf.getContext().getSampleRate() / 9600, (float) (0.25 * gainMu * gainMu), 0.5f, gainMu, 0.05f);
Rail rail = new Rail(clockRecovery, -1.0f, 1.0f);
FloatToChar f2char = new FloatToChar(rail, 127.0f);
input = new Ax25G3ruhBeaconSource<>(f2char, Swampsat2Beacon.class);
assertTrue(input.hasNext());
AssertJson.assertObjectsEqual("Swampsat2Beacon.json", input.next());
}
@After
public void stop() throws Exception {
if (input != null) {
input.close();
}
}
}