57 lines
1.4 KiB
C++
57 lines
1.4 KiB
C++
#include <iostream>
|
|
#include "mock_core.h"
|
|
int main() {
|
|
std::cout << "Hello World!\n";
|
|
|
|
std::vector<Mock::BaseStation*> stations;
|
|
auto yan_tai = new Mock::BaseStation();
|
|
yan_tai->set_pos(37.5102686, 121.4399498);
|
|
stations.push_back(yan_tai);
|
|
auto qing_dao = new Mock::BaseStation();
|
|
qing_dao->set_pos(36.0759435, 120.4085225);
|
|
stations.push_back(qing_dao);
|
|
auto ji_nan = new Mock::BaseStation();
|
|
ji_nan->set_pos(36.6513057, 116.9837594);
|
|
stations.push_back(ji_nan);
|
|
|
|
|
|
|
|
Mock::Plane plane;
|
|
plane.icao = "ABCDEF";
|
|
while (true) {
|
|
MLAT_timestamp cur;
|
|
|
|
for (auto station : stations)
|
|
{
|
|
auto i = plane.generate_message(&cur, {37, 121}, station);
|
|
auto t = station->generage_message();
|
|
std::cout << memory2hex(i) << std::endl;
|
|
std::cout << memory2hex(t) << std::endl;
|
|
}
|
|
|
|
|
|
std::this_thread::sleep_for(std::chrono::milliseconds(1000));
|
|
|
|
}
|
|
|
|
|
|
return 0;
|
|
}
|
|
|
|
|
|
|
|
|
|
// Mock::BaseStation b;
|
|
// b.set_pos(37, 137);
|
|
//
|
|
// auto mem = b.generage_message();
|
|
//
|
|
// auto mem2 = unescape_packet(mem);
|
|
// std::cout << mem << std::endl;
|
|
//
|
|
// std::cout << mem2.size() << " parse_hex:" << memory2hex(mem2) << std::endl;
|
|
//
|
|
// HULC_Status_Message message = create_HULC_Status_Message(mem2);
|
|
//
|
|
// std::cout << "完全相等" << bool (unescape_packet(message.toBinary()) == mem2) << std::endl;
|