Skip to content

Commit a954193

Browse files
committed
update tests
1 parent e693e6f commit a954193

20 files changed

+4251
-3625
lines changed

src/nfc-test/test-sdr/src/main/cpp/main.cpp

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,7 @@ bool readFrames(const std::string &path, std::list<lab::RawFrame> &list)
6565
lab::RawFrame frame(256);
6666

6767
frame.setTechType(entry["techType"]);
68+
frame.setDateTime(entry["dateTime"]);
6869
frame.setFrameType(entry["frameType"]);
6970
frame.setFramePhase(entry["framePhase"]);
7071
frame.setFrameFlags(entry["frameFlags"]);
@@ -108,12 +109,13 @@ bool writeFrames(const std::string &path, std::list<lab::RawFrame> &list)
108109
});
109110

110111
frames.push_back({
112+
{"techType", frame.techType()},
113+
{"dateTime", frame.dateTime()},
111114
{"sampleStart", frame.sampleStart()},
112115
{"sampleEnd", frame.sampleEnd()},
113-
{"sampleRate", frame.sampleEnd()},
116+
{"sampleRate", frame.sampleRate()},
114117
{"timeStart", frame.timeStart()},
115118
{"timeEnd", frame.timeEnd()},
116-
{"techType", frame.techType()},
117119
{"frameType", frame.frameType()},
118120
{"frameRate", frame.frameRate()},
119121
{"frameFlags", frame.frameFlags()},
@@ -127,7 +129,7 @@ bool writeFrames(const std::string &path, std::list<lab::RawFrame> &list)
127129

128130
std::ofstream output(path);
129131

130-
output << std::setw(3) << info << std::endl;
132+
output << std::setw(3) << info.dump(2) << std::endl;
131133

132134
return true;
133135
}
@@ -137,7 +139,7 @@ bool writeFrames(const std::string &path, std::list<lab::RawFrame> &list)
137139
*/
138140
bool readSignal(const std::string &path, std::list<lab::RawFrame> &list)
139141
{
140-
if (!rt::FileSystem::exists(path))
142+
if (!FileSystem::exists(path))
141143
return false;
142144

143145
hw::RecordDevice source(path);
@@ -154,8 +156,8 @@ bool readSignal(const std::string &path, std::list<lab::RawFrame> &list)
154156

155157
std::list<lab::RawFrame> frames;
156158

157-
int channelCount = std::get<int>(source.get(hw::SignalDevice::PARAM_CHANNEL_COUNT));
158-
int sampleRate = std::get<int>(source.get(hw::SignalDevice::PARAM_SAMPLE_RATE));
159+
unsigned int channelCount = std::get<unsigned int>(source.get(hw::SignalDevice::PARAM_CHANNEL_COUNT));
160+
unsigned int sampleRate = std::get<unsigned int>(source.get(hw::SignalDevice::PARAM_SAMPLE_RATE));
159161

160162
while (!source.isEof())
161163
{
@@ -216,7 +218,7 @@ int testFile(const std::string &signal)
216218

217219
int testPath(const std::string &path)
218220
{
219-
for (const auto &entry: rt::FileSystem::directoryList(path))
221+
for (const auto &entry: FileSystem::directoryList(path))
220222
{
221223
if (entry.name.find(".wav") != std::string::npos)
222224
{
@@ -232,20 +234,20 @@ int main(int argc, char *argv[])
232234
// Logger::init(std::cout, false);
233235

234236
logger->info("***********************************************************************");
235-
logger->info("NFC laboratory, 2021 Jose Vicente Campos Martinez - <josevcm@gmail.com>");
237+
logger->info("NFC laboratory, 2024 Jose Vicente Campos Martinez - <josevcm@gmail.com>");
236238
logger->info("***********************************************************************");
237239

238240
for (int i = 1; i < argc; i++)
239241
{
240-
std::string path{argv[i]};
242+
std::string path {argv[i]};
241243

242-
if (rt::FileSystem::isDirectory(path))
244+
if (FileSystem::isDirectory(path))
243245
{
244246
logger->info("processing path {}", {path});
245247

246248
testPath(path);
247249
}
248-
else if (rt::FileSystem::isRegularFile(path))
250+
else if (FileSystem::isRegularFile(path))
249251
{
250252
logger->info("processing file {}", {path});
251253

wav/test_NFC-A_106kbps_001.json

Lines changed: 142 additions & 122 deletions
Original file line numberDiff line numberDiff line change
@@ -1,124 +1,144 @@
11
{
2-
"frames": [
3-
{
4-
"frameData": "52",
5-
"frameFlags": 1,
6-
"framePhase": 1,
7-
"frameRate": 105938,
8-
"frameType": 2,
9-
"sampleEnd": 11567,
10-
"sampleStart": 10807,
11-
"techType": 1,
12-
"timeEnd": 0.0011567,
13-
"timeStart": 0.0010807
14-
},
15-
{
16-
"frameData": "04:00",
17-
"frameFlags": 0,
18-
"framePhase": 1,
19-
"frameRate": 105938,
20-
"frameType": 3,
21-
"sampleEnd": 14215,
22-
"sampleStart": 12469,
23-
"techType": 1,
24-
"timeEnd": 0.0014215,
25-
"timeStart": 0.0012469
26-
},
27-
{
28-
"frameData": "93:70:46:30:AC:C9:13:08:FA",
29-
"frameFlags": 0,
30-
"framePhase": 1,
31-
"frameRate": 105938,
32-
"frameType": 2,
33-
"sampleEnd": 26864,
34-
"sampleStart": 19124,
35-
"techType": 1,
36-
"timeEnd": 0.0026864,
37-
"timeStart": 0.0019124
38-
},
39-
{
40-
"frameData": "08:B6:DD",
41-
"frameFlags": 0,
42-
"framePhase": 1,
43-
"frameRate": 105938,
44-
"frameType": 3,
45-
"sampleEnd": 30356,
46-
"sampleStart": 27762,
47-
"techType": 1,
48-
"timeEnd": 0.0030356,
49-
"timeStart": 0.0027762
50-
},
51-
{
52-
"frameData": "60:08:BD:F7",
53-
"frameFlags": 0,
54-
"framePhase": 2,
55-
"frameRate": 105938,
56-
"frameType": 2,
57-
"sampleEnd": 58249,
58-
"sampleStart": 54701,
59-
"techType": 1,
60-
"timeEnd": 0.0058249,
61-
"timeStart": 0.0054701
62-
},
63-
{
64-
"frameData": "49:B5:18:7D",
65-
"frameFlags": 2,
66-
"framePhase": 2,
67-
"frameRate": 105938,
68-
"frameType": 3,
69-
"sampleEnd": 64999,
70-
"sampleStart": 61554,
71-
"techType": 1,
72-
"timeEnd": 0.0064999,
73-
"timeStart": 0.0061554
74-
},
75-
{
76-
"frameData": "20:0D:25:13:4B:39:7A:D1",
77-
"frameFlags": 18,
78-
"framePhase": 2,
79-
"frameRate": 105938,
80-
"frameType": 2,
81-
"sampleEnd": 75751,
82-
"sampleStart": 68860,
83-
"techType": 1,
84-
"timeEnd": 0.0075751,
85-
"timeStart": 0.006886
86-
},
87-
{
88-
"frameData": "43:CD:B2:8F",
89-
"frameFlags": 18,
90-
"framePhase": 2,
91-
"frameRate": 105938,
92-
"frameType": 3,
93-
"sampleEnd": 80149,
94-
"sampleStart": 76657,
95-
"techType": 1,
96-
"timeEnd": 0.0080149,
97-
"timeStart": 0.0076657
98-
},
99-
{
100-
"frameData": "D1:C5:A5:29",
101-
"frameFlags": 18,
102-
"framePhase": 2,
103-
"frameRate": 105938,
104-
"frameType": 2,
105-
"sampleEnd": 87644,
106-
"sampleStart": 84153,
107-
"techType": 1,
108-
"timeEnd": 0.0087644,
109-
"timeStart": 0.0084153
110-
},
111-
{
112-
"frameData": "23:90:AA:D6:06:1E:8A:32:96:3A:BD:DB:D8:E0:5E:DA:3B:5B",
113-
"frameFlags": 18,
114-
"framePhase": 2,
115-
"frameRate": 105938,
116-
"frameType": 3,
117-
"sampleEnd": 104739,
118-
"sampleStart": 89400,
119-
"techType": 1,
120-
"timeEnd": 0.0104739,
121-
"timeStart": 0.00894
122-
}
123-
]
2+
"frames": [
3+
{
4+
"dateTime": 0.0010807,
5+
"frameData": "52",
6+
"frameFlags": 1,
7+
"framePhase": 258,
8+
"frameRate": 105938,
9+
"frameType": 258,
10+
"sampleEnd": 11567,
11+
"sampleRate": 10000000,
12+
"sampleStart": 10807,
13+
"techType": 257,
14+
"timeEnd": 0.0011567,
15+
"timeStart": 0.0010807
16+
},
17+
{
18+
"dateTime": 0.0012469,
19+
"frameData": "04:00",
20+
"frameFlags": 0,
21+
"framePhase": 258,
22+
"frameRate": 105938,
23+
"frameType": 259,
24+
"sampleEnd": 14215,
25+
"sampleRate": 10000000,
26+
"sampleStart": 12469,
27+
"techType": 257,
28+
"timeEnd": 0.0014215,
29+
"timeStart": 0.0012469
30+
},
31+
{
32+
"dateTime": 0.0019124,
33+
"frameData": "93:70:46:30:AC:C9:13:08:FA",
34+
"frameFlags": 0,
35+
"framePhase": 258,
36+
"frameRate": 105938,
37+
"frameType": 258,
38+
"sampleEnd": 26864,
39+
"sampleRate": 10000000,
40+
"sampleStart": 19124,
41+
"techType": 257,
42+
"timeEnd": 0.0026864,
43+
"timeStart": 0.0019124
44+
},
45+
{
46+
"dateTime": 0.0027762,
47+
"frameData": "08:B6:DD",
48+
"frameFlags": 0,
49+
"framePhase": 258,
50+
"frameRate": 105938,
51+
"frameType": 259,
52+
"sampleEnd": 30356,
53+
"sampleRate": 10000000,
54+
"sampleStart": 27762,
55+
"techType": 257,
56+
"timeEnd": 0.0030356,
57+
"timeStart": 0.0027762
58+
},
59+
{
60+
"dateTime": 0.0054701,
61+
"frameData": "60:08:BD:F7",
62+
"frameFlags": 0,
63+
"framePhase": 259,
64+
"frameRate": 105938,
65+
"frameType": 258,
66+
"sampleEnd": 58249,
67+
"sampleRate": 10000000,
68+
"sampleStart": 54701,
69+
"techType": 257,
70+
"timeEnd": 0.0058249,
71+
"timeStart": 0.0054701
72+
},
73+
{
74+
"dateTime": 0.0061554,
75+
"frameData": "49:B5:18:7D",
76+
"frameFlags": 2,
77+
"framePhase": 259,
78+
"frameRate": 105938,
79+
"frameType": 259,
80+
"sampleEnd": 64999,
81+
"sampleRate": 10000000,
82+
"sampleStart": 61554,
83+
"techType": 257,
84+
"timeEnd": 0.0064999,
85+
"timeStart": 0.0061554
86+
},
87+
{
88+
"dateTime": 0.006886,
89+
"frameData": "20:0D:25:13:4B:39:7A:D1",
90+
"frameFlags": 2,
91+
"framePhase": 259,
92+
"frameRate": 105938,
93+
"frameType": 258,
94+
"sampleEnd": 75751,
95+
"sampleRate": 10000000,
96+
"sampleStart": 68860,
97+
"techType": 257,
98+
"timeEnd": 0.0075751,
99+
"timeStart": 0.006886
100+
},
101+
{
102+
"dateTime": 0.0076657,
103+
"frameData": "43:CD:B2:8F",
104+
"frameFlags": 2,
105+
"framePhase": 259,
106+
"frameRate": 105938,
107+
"frameType": 259,
108+
"sampleEnd": 80149,
109+
"sampleRate": 10000000,
110+
"sampleStart": 76657,
111+
"techType": 257,
112+
"timeEnd": 0.0080149,
113+
"timeStart": 0.0076657
114+
},
115+
{
116+
"dateTime": 0.0084153,
117+
"frameData": "D1:C5:A5:29",
118+
"frameFlags": 2,
119+
"framePhase": 259,
120+
"frameRate": 105938,
121+
"frameType": 258,
122+
"sampleEnd": 87644,
123+
"sampleRate": 10000000,
124+
"sampleStart": 84153,
125+
"techType": 257,
126+
"timeEnd": 0.0087644,
127+
"timeStart": 0.0084153
128+
},
129+
{
130+
"dateTime": 0.00894,
131+
"frameData": "23:90:AA:D6:06:1E:8A:32:96:3A:BD:DB:D8:E0:5E:DA:3B:5B",
132+
"frameFlags": 2,
133+
"framePhase": 259,
134+
"frameRate": 105938,
135+
"frameType": 259,
136+
"sampleEnd": 104739,
137+
"sampleRate": 10000000,
138+
"sampleStart": 89400,
139+
"techType": 257,
140+
"timeEnd": 0.0104739,
141+
"timeStart": 0.00894
142+
}
143+
]
124144
}

0 commit comments

Comments
 (0)