18 #ifndef GNSS_SDR_RTCM_H 19 #define GNSS_SDR_RTCM_H 30 #include <boost/asio.hpp> 31 #include <boost/date_time/posix_time/posix_time.hpp> 32 #include <glog/logging.h> 56 #if USE_BOOST_ASIO_IO_CONTEXT 57 using b_io_context = boost::asio::io_context;
59 using b_io_context = boost::asio::io_service;
95 explicit Rtcm(uint16_t port = 2101);
101 std::string
print_MT1001(
const Gps_Ephemeris& gps_eph,
double obs_time,
const std::map<int32_t, Gnss_Synchro>& observables, uint16_t station_id);
106 std::string
print_MT1002(
const Gps_Ephemeris& gps_eph,
double obs_time,
const std::map<int32_t, Gnss_Synchro>& observables, uint16_t station_id);
121 std::string
print_MT1005(uint32_t ref_id,
double ecef_x,
double ecef_y,
double ecef_z,
bool gps,
bool glonass,
bool galileo,
bool non_physical,
bool single_oscillator, uint32_t quarter_cycle_indicator);
126 int32_t
read_MT1005(
const std::string& message, uint32_t& ref_id,
double& ecef_x,
double& ecef_y,
double& ecef_z,
bool& gps,
bool& glonass,
bool& galileo);
131 std::string
print_MT1006(uint32_t ref_id,
double ecef_x,
double ecef_y,
double ecef_z,
bool gps,
bool glonass,
bool galileo,
bool non_physical,
bool single_oscillator, uint32_t quarter_cycle_indicator,
double height);
138 std::string
print_MT1008(uint32_t ref_id,
const std::string& antenna_descriptor, uint32_t antenna_setup_id,
const std::string& antenna_serial_number);
237 const std::map<int32_t, Gnss_Synchro>& observables,
239 uint32_t clock_steering_indicator,
240 uint32_t external_clock_indicator,
242 bool divergence_free,
253 const std::map<int32_t, Gnss_Synchro>& observables,
255 uint32_t clock_steering_indicator,
256 uint32_t external_clock_indicator,
258 bool divergence_free,
269 const std::map<int32_t, Gnss_Synchro>& observables,
271 uint32_t clock_steering_indicator,
272 uint32_t external_clock_indicator,
274 bool divergence_free,
285 const std::map<int32_t, Gnss_Synchro>& observables,
287 uint32_t clock_steering_indicator,
288 uint32_t external_clock_indicator,
290 bool divergence_free,
301 const std::map<int32_t, Gnss_Synchro>& observables,
303 uint32_t clock_steering_indicator,
304 uint32_t external_clock_indicator,
306 bool divergence_free,
317 const std::map<int32_t, Gnss_Synchro>& observables,
319 uint32_t clock_steering_indicator,
320 uint32_t external_clock_indicator,
322 bool divergence_free,
333 const std::map<int32_t, Gnss_Synchro>& observables,
335 uint32_t clock_steering_indicator,
336 uint32_t external_clock_indicator,
338 bool divergence_free,
375 std::string
bin_to_hex(
const std::string& s)
const;
376 std::string
hex_to_bin(
const std::string& s)
const;
382 int32_t bin_to_int(
const std::string& s)
const;
384 int32_t bin_to_sint(
const std::string& s)
const;
386 int64_t
hex_to_int(
const std::string& s)
const;
388 bool check_CRC(
const std::string& message)
const;
400 std::bitset<64> get_MT1001_4_header(uint32_t msg_number,
402 const std::map<int32_t, Gnss_Synchro>& observables,
406 bool divergence_free);
413 std::bitset<152> get_MT1005_test();
426 std::bitset<61> get_MT1009_12_header(uint32_t msg_number,
428 const std::map<int32_t, Gnss_Synchro>& observables,
432 bool divergence_free);
479 std::string get_MSM_header(uint32_t msg_number,
481 const std::map<int32_t, Gnss_Synchro>& observables,
483 uint32_t clock_steering_indicator,
484 uint32_t external_clock_indicator,
486 bool divergence_free,
489 std::string get_MSM_1_content_sat_data(
const std::map<int32_t, Gnss_Synchro>& observables);
490 std::string get_MSM_4_content_sat_data(
const std::map<int32_t, Gnss_Synchro>& observables);
491 std::string get_MSM_5_content_sat_data(
const std::map<int32_t, Gnss_Synchro>& observables);
493 std::string get_MSM_1_content_signal_data(
const std::map<int32_t, Gnss_Synchro>& observables);
501 std::string get_IGM01_header(
const Galileo_HAS_data& has_data, uint8_t nsys,
bool ssr_multiple_msg_indicator);
502 std::string get_IGM01_content_sat(
const Galileo_HAS_data& has_data, uint8_t nsys_index);
503 std::string get_IGM02_header(
const Galileo_HAS_data& has_data, uint8_t nsys,
bool ssr_multiple_msg_indicator);
504 std::string get_IGM02_content_sat(
const Galileo_HAS_data& has_data, uint8_t nsys_index);
505 std::string get_IGM03_header(
const Galileo_HAS_data& has_data, uint8_t nsys,
bool ssr_multiple_msg_indicator);
506 std::string get_IGM03_content_sat(
const Galileo_HAS_data& has_data, uint8_t nsys_index);
507 std::string get_IGM05_header(
const Galileo_HAS_data& has_data, uint8_t nsys,
bool ssr_multiple_msg_indicator);
508 std::string get_IGM05_content_sat(
const Galileo_HAS_data& has_data, uint8_t nsys_index);
513 static std::map<std::string, int> galileo_signal_map;
514 static std::map<std::string, int> gps_signal_map;
515 std::vector<std::pair<int32_t, Gnss_Synchro>> sort_by_signal(
const std::vector<std::pair<int32_t, Gnss_Synchro>>& synchro_map)
const;
516 std::vector<std::pair<int32_t, Gnss_Synchro>> sort_by_PRN_mask(
const std::vector<std::pair<int32_t, Gnss_Synchro>>& synchro_map)
const;
517 boost::posix_time::ptime compute_GPS_time(
const Gps_Ephemeris& eph,
double obs_time)
const;
518 boost::posix_time::ptime compute_GPS_time(
const Gps_CNAV_Ephemeris& eph,
double obs_time)
const;
519 boost::posix_time::ptime compute_Galileo_time(
const Galileo_Ephemeris& eph,
double obs_time)
const;
521 boost::posix_time::ptime gps_L1_last_lock_time[64];
522 boost::posix_time::ptime gps_L2_last_lock_time[64];
523 boost::posix_time::ptime gal_E1_last_lock_time[64];
524 boost::posix_time::ptime gal_E5_last_lock_time[64];
525 boost::posix_time::ptime glo_L1_last_lock_time[64];
526 boost::posix_time::ptime glo_L2_last_lock_time[64];
527 uint32_t lock_time_indicator(uint32_t lock_time_period_s);
528 uint32_t msm_lock_time_indicator(uint32_t lock_time_period_s);
529 uint32_t msm_extended_lock_time_indicator(uint32_t lock_time_period_s);
531 uint8_t ssr_update_interval(uint16_t validity_seconds)
const;
541 static const std::size_t header_length = 6;
542 static const std::size_t max_body_length = 1029;
549 const char* data()
const 559 inline std::size_t length()
const 561 return header_length + body_length_;
564 const char* body()
const 566 return data_.data() + header_length;
571 return data_.data() + header_length;
574 std::size_t body_length()
const 579 void body_length(std::size_t new_length)
581 body_length_ = new_length;
582 if (body_length_ > max_body_length)
584 body_length_ = max_body_length;
588 inline bool decode_header()
590 std::string header(data_.data(), header_length);
591 if (header[0] !=
'G' || header[1] !=
'S')
596 auto header2 = header.substr(2);
599 body_length_ = std::stoi(header2);
601 catch (
const std::exception& e)
608 if (body_length_ == 0)
613 if (body_length_ > max_body_length)
621 inline void encode_header()
623 std::stringstream ss;
624 ss <<
"GS" << std::setw(4) << std::max(std::min(static_cast<int>(body_length_), static_cast<int>(max_body_length)), 0);
625 std::string header = ss.str();
626 header.resize(header_length,
' ');
627 std::copy(header.begin(), header.end(), data_.begin());
631 std::array<char, header_length + max_body_length> data_{};
632 std::size_t body_length_;
639 virtual ~RtcmListener() =
default;
640 virtual void deliver(
const Rtcm_Message& msg) = 0;
644 class Rtcm_Listener_Room
647 inline void join(
const std::shared_ptr<RtcmListener>& participant)
649 participants_.insert(participant);
650 for (
const auto& msg : recent_msgs_)
652 participant->deliver(msg);
656 inline void leave(
const std::shared_ptr<RtcmListener>& participant)
658 participants_.erase(participant);
661 inline void deliver(
const Rtcm_Message& msg)
663 recent_msgs_.push_back(msg);
664 while (recent_msgs_.size() > max_recent_msgs)
666 recent_msgs_.pop_front();
669 for (
const auto& participant : participants_)
671 participant->deliver(msg);
676 std::set<std::shared_ptr<RtcmListener>> participants_;
681 std::deque<Rtcm_Message> recent_msgs_;
686 :
public RtcmListener,
687 public std::enable_shared_from_this<Rtcm_Session>
690 Rtcm_Session(boost::asio::ip::tcp::socket socket, Rtcm_Listener_Room& room) : socket_(std::move(socket)), room_(room) {}
693 room_.join(shared_from_this());
694 do_read_message_header();
697 inline void deliver(
const Rtcm_Message& msg)
699 bool write_in_progress = !write_msgs_.empty();
700 write_msgs_.push_back(msg);
701 if (!write_in_progress)
708 inline void do_read_message_header()
710 auto self(shared_from_this());
711 boost::asio::async_read(socket_,
712 boost::asio::buffer(read_msg_.data(), Rtcm_Message::header_length),
713 [
this,
self](boost::system::error_code ec, std::size_t ) {
714 if (!ec and read_msg_.decode_header())
716 do_read_message_body();
718 else if (!ec and !read_msg_.decode_header())
720 client_says += read_msg_.data();
722 while (client_says.length() >= 80)
726 LOG(INFO) <<
"Client says:";
729 LOG(INFO) << client_says;
730 client_says = client_says.substr(80, client_says.length() - 80);
732 do_read_message_header();
736 std::cout <<
"Closing connection with RTCM client\n";
737 room_.leave(shared_from_this());
742 inline void do_read_message_body()
744 auto self(shared_from_this());
745 boost::asio::async_read(socket_,
746 boost::asio::buffer(read_msg_.body(), read_msg_.body_length()),
747 [
this,
self](boost::system::error_code ec, std::size_t ) {
750 room_.deliver(read_msg_);
754 do_read_message_header();
758 std::cout <<
"Closing connection with RTCM client\n";
759 room_.leave(shared_from_this());
764 inline void do_write()
766 auto self(shared_from_this());
767 boost::asio::async_write(socket_,
768 boost::asio::buffer(write_msgs_.front().body(), write_msgs_.front().body_length()),
769 [
this,
self](boost::system::error_code ec, std::size_t ) {
772 write_msgs_.pop_front();
773 if (!write_msgs_.empty())
780 std::cout <<
"Closing connection with RTCM client\n";
781 room_.leave(shared_from_this());
786 boost::asio::ip::tcp::socket socket_;
787 Rtcm_Listener_Room& room_;
788 Rtcm_Message read_msg_;
789 std::deque<Rtcm_Message> write_msgs_;
790 std::string client_says;
794 class Tcp_Internal_Client
795 :
public std::enable_shared_from_this<Tcp_Internal_Client>
798 Tcp_Internal_Client(b_io_context& io_context,
799 boost::asio::ip::tcp::resolver::iterator endpoint_iterator)
800 : io_context_(io_context), socket_(io_context)
802 do_connect(std::move(endpoint_iterator));
807 io_context_.post([
this]() { socket_.close(); });
810 inline void write(
const Rtcm_Message& msg)
814 bool write_in_progress = !write_msgs_.empty();
815 write_msgs_.push_back(msg);
816 if (!write_in_progress)
824 inline void do_connect(boost::asio::ip::tcp::resolver::iterator endpoint_iterator)
826 boost::asio::async_connect(socket_, std::move(endpoint_iterator),
827 [
this](boost::system::error_code ec, boost::asio::ip::tcp::resolver::iterator) {
834 std::cout <<
"Server is down.\n";
839 inline void do_read_message()
841 boost::asio::async_read(socket_,
842 boost::asio::buffer(read_msg_.data(), 1029),
843 [
this](boost::system::error_code ec, std::size_t ) {
850 std::cout <<
"Error in client\n";
856 inline void do_write()
858 boost::asio::async_write(socket_,
859 boost::asio::buffer(write_msgs_.front().data(), write_msgs_.front().length()),
860 [
this](boost::system::error_code ec, std::size_t ) {
863 write_msgs_.pop_front();
864 if (!write_msgs_.empty())
876 b_io_context& io_context_;
877 boost::asio::ip::tcp::socket socket_;
878 Rtcm_Message read_msg_;
879 std::deque<Rtcm_Message> write_msgs_;
888 boost::asio::ip::tcp::resolver resolver(io_context);
889 std::string host(
"localhost");
890 std::string port_str = std::to_string(port);
891 auto queue_endpoint_iterator = resolver.resolve({host.c_str(), port_str.c_str()});
892 c = std::make_shared<Tcp_Internal_Client>(io_context, queue_endpoint_iterator);
895 inline void do_read_queue()
901 queue_->wait_and_pop(message);
902 if (message ==
"Goodbye")
907 const char* char_msg = message.c_str();
908 msg.body_length(message.length());
909 std::copy_n(char_msg, msg.body_length(), msg.body());
916 std::shared_ptr<Tcp_Internal_Client> c;
917 std::shared_ptr<Concurrent_Queue<std::string>>& queue_;
924 Tcp_Server(b_io_context& io_context,
const boost::asio::ip::tcp::endpoint& endpoint)
925 : acceptor_(io_context), socket_(io_context)
927 acceptor_.open(endpoint.protocol());
928 acceptor_.set_option(boost::asio::ip::tcp::acceptor::reuse_address(
true));
929 acceptor_.bind(endpoint);
934 inline void close_server()
941 inline void do_accept()
943 acceptor_.async_accept(socket_, [
this](boost::system::error_code ec) {
948 std::cout <<
"The TCP/IP server of RTCM messages is up and running. Accepting connections ...\n";
949 first_client =
false;
953 std::cout <<
"Starting RTCM TCP/IP server session...\n";
954 boost::system::error_code ec2;
955 boost::asio::ip::tcp::endpoint endpoint = socket_.remote_endpoint(ec2);
959 std::cout <<
"Error getting remote IP address, closing session.\n";
960 LOG(INFO) <<
"Error getting remote IP address";
961 start_session =
false;
965 std::string remote_addr = endpoint.address().to_string();
966 std::cout <<
"Serving client from " << remote_addr <<
'\n';
967 LOG(INFO) <<
"Serving client from " << remote_addr;
972 std::make_shared<Rtcm_Session>(std::move(socket_), room_)->start();
977 std::cout <<
"Error when invoking a RTCM session. " << ec <<
'\n';
979 start_session =
true;
984 boost::asio::ip::tcp::acceptor acceptor_;
985 boost::asio::ip::tcp::socket socket_;
986 Rtcm_Listener_Room room_;
987 bool first_client =
true;
988 bool start_session =
true;
991 b_io_context io_context;
992 std::shared_ptr<Concurrent_Queue<std::string>> rtcm_message_queue;
995 std::list<Rtcm::Tcp_Server> servers;
996 bool server_is_running;
1002 std::bitset<8> preamble;
1003 std::bitset<6> reserved_field;
1004 std::string add_CRC(
const std::string& m)
const;
1005 std::string build_message(
const std::string& data)
const;
1010 std::bitset<12> DF002;
1011 int32_t set_DF002(uint32_t message_number);
1013 std::bitset<12> DF003;
1014 int32_t set_DF003(uint32_t ref_station_ID);
1016 std::bitset<30> DF004;
1017 int32_t set_DF004(
double obs_time);
1019 std::bitset<1> DF005;
1020 int32_t set_DF005(
bool sync_flag);
1022 std::bitset<5> DF006;
1023 int32_t set_DF006(
const std::map<int32_t, Gnss_Synchro>& observables);
1025 std::bitset<1> DF007;
1026 int32_t set_DF007(
bool divergence_free_smoothing_indicator);
1028 std::bitset<3> DF008;
1029 int32_t set_DF008(int16_t smoothing_interval);
1031 std::bitset<6> DF009;
1035 std::bitset<1> DF010;
1036 int32_t set_DF010(
bool code_indicator);
1038 std::bitset<24> DF011;
1041 std::bitset<20> DF012;
1044 std::bitset<7> DF013;
1047 std::bitset<8> DF014;
1050 std::bitset<8> DF015;
1053 std::bitset<14> DF017;
1056 std::bitset<20> DF018;
1059 std::bitset<7> DF019;
1062 std::bitset<8> DF020;
1065 std::bitset<6> DF021;
1066 int32_t set_DF021();
1068 std::bitset<1> DF022;
1069 int32_t set_DF022(
bool gps_indicator);
1071 std::bitset<1> DF023;
1072 int32_t set_DF023(
bool glonass_indicator);
1074 std::bitset<1> DF024;
1075 int32_t set_DF024(
bool galileo_indicator);
1077 std::bitset<38> DF025;
1078 int32_t set_DF025(
double antenna_ECEF_X_m);
1080 std::bitset<38> DF026;
1081 int32_t set_DF026(
double antenna_ECEF_Y_m);
1083 std::bitset<38> DF027;
1084 int32_t set_DF027(
double antenna_ECEF_Z_m);
1086 std::bitset<16> DF028;
1087 int32_t set_DF028(
double height);
1089 std::bitset<8> DF029;
1091 std::bitset<8> DF031;
1092 int32_t set_DF031(uint32_t antenna_setup_id);
1094 std::bitset<8> DF032;
1102 int32_t set_DF034(
double obs_time);
1103 std::bitset<27> DF034;
1105 std::bitset<5> DF035;
1106 int32_t set_DF035(
const std::map<int32_t, Gnss_Synchro>& observables);
1108 std::bitset<1> DF036;
1109 int32_t set_DF036(
bool divergence_free_smoothing_indicator);
1111 std::bitset<3> DF037;
1112 int32_t set_DF037(int16_t smoothing_interval);
1114 std::bitset<6> DF038;
1118 std::bitset<1> DF039;
1119 int32_t set_DF039(
bool code_indicator);
1121 std::bitset<5> DF040;
1122 int32_t set_DF040(int32_t frequency_channel_number);
1125 std::bitset<25> DF041;
1128 std::bitset<20> DF042;
1131 std::bitset<7> DF043;
1134 std::bitset<7> DF044;
1137 std::bitset<8> DF045;
1140 std::bitset<2> DF046;
1141 int32_t set_DF046(uint16_t code_indicator);
1143 std::bitset<14> DF047;
1146 std::bitset<20> DF048;
1149 std::bitset<7> DF049;
1152 std::bitset<8> DF050;
1155 std::bitset<16> DF051;
1156 int32_t set_DF051(
const Gps_Ephemeris& gps_eph,
double obs_time);
1158 std::bitset<17> DF052;
1159 int32_t set_DF052(
const Gps_Ephemeris& gps_eph,
double obs_time);
1162 std::bitset<8> DF071;
1165 std::bitset<10> DF076;
1168 std::bitset<4> DF077;
1171 std::bitset<2> DF078;
1174 std::bitset<14> DF079;
1177 std::bitset<8> DF080;
1180 std::bitset<16> DF081;
1183 std::bitset<8> DF082;
1186 std::bitset<16> DF083;
1189 std::bitset<22> DF084;
1192 std::bitset<10> DF085;
1195 std::bitset<16> DF086;
1198 std::bitset<16> DF087;
1201 std::bitset<32> DF088;
1204 std::bitset<16> DF089;
1207 std::bitset<32> DF090;
1210 std::bitset<16> DF091;
1213 std::bitset<32> DF092;
1216 std::bitset<16> DF093;
1219 std::bitset<16> DF094;
1222 std::bitset<32> DF095;
1225 std::bitset<16> DF096;
1228 std::bitset<32> DF097;
1231 std::bitset<16> DF098;
1234 std::bitset<32> DF099;
1237 std::bitset<24> DF100;
1240 std::bitset<8> DF101;
1243 std::bitset<6> DF102;
1246 std::bitset<1> DF103;
1249 std::bitset<1> DF104;
1250 int32_t set_DF104(uint32_t glonass_gnav_alm_health);
1252 std::bitset<1> DF105;
1253 int32_t set_DF105(uint32_t glonass_gnav_alm_health_ind);
1255 std::bitset<2> DF106;
1258 std::bitset<12> DF107;
1261 std::bitset<1> DF108;
1264 std::bitset<1> DF109;
1267 std::bitset<7> DF110;
1270 std::bitset<24> DF111;
1273 std::bitset<27> DF112;
1276 std::bitset<5> DF113;
1279 std::bitset<24> DF114;
1282 std::bitset<27> DF115;
1285 std::bitset<5> DF116;
1288 std::bitset<24> DF117;
1291 std::bitset<27> DF118;
1294 std::bitset<5> DF119;
1297 std::bitset<1> DF120;
1300 std::bitset<11> DF121;
1303 std::bitset<2> DF122;
1306 std::bitset<1> DF123;
1309 std::bitset<22> DF124;
1312 std::bitset<5> DF125;
1315 std::bitset<5> DF126;
1318 std::bitset<1> DF127;
1321 std::bitset<4> DF128;
1324 std::bitset<11> DF129;
1327 std::bitset<2> DF130;
1330 std::bitset<1> DF131;
1331 int32_t set_DF131(uint32_t fifth_str_additional_data_ind);
1333 std::bitset<11> DF132;
1336 std::bitset<32> DF133;
1339 std::bitset<5> DF134;
1342 std::bitset<22> DF135;
1345 std::bitset<1> DF136;
1348 std::bitset<1> DF137;
1352 std::bitset<1> DF141;
1355 std::bitset<1> DF142;
1358 std::bitset<30> DF248;
1359 int32_t set_DF248(
double obs_time);
1362 std::bitset<6> DF252;
1365 std::bitset<12> DF289;
1368 std::bitset<10> DF290;
1371 std::bitset<8> DF291;
1374 std::bitset<14> DF292;
1377 std::bitset<14> DF293;
1380 std::bitset<6> DF294;
1383 std::bitset<21> DF295;
1386 std::bitset<31> DF296;
1389 std::bitset<16> DF297;
1392 std::bitset<16> DF298;
1395 std::bitset<32> DF299;
1398 std::bitset<16> DF300;
1401 std::bitset<32> DF301;
1404 std::bitset<16> DF302;
1407 std::bitset<32> DF303;
1410 std::bitset<14> DF304;
1413 std::bitset<16> DF305;
1416 std::bitset<32> DF306;
1419 std::bitset<16> DF307;
1422 std::bitset<32> DF308;
1425 std::bitset<16> DF309;
1428 std::bitset<32> DF310;
1431 std::bitset<24> DF311;
1434 std::bitset<10> DF312;
1437 std::bitset<10> DF313;
1440 std::bitset<2> DF314;
1443 std::bitset<1> DF315;
1446 std::bitset<2> DF364;
1449 std::bitset<1> DF393;
1450 int32_t set_DF393(
bool more_messages);
1452 std::bitset<64> DF394;
1453 int32_t set_DF394(
const std::map<int32_t, Gnss_Synchro>& gnss_synchro);
1455 std::bitset<32> DF395;
1456 int32_t set_DF395(
const std::map<int32_t, Gnss_Synchro>& gnss_synchro);
1458 std::string set_DF396(
const std::map<int32_t, Gnss_Synchro>& observables);
1460 std::bitset<8> DF397;
1463 std::bitset<10> DF398;
1466 std::bitset<14> DF399;
1469 std::bitset<15> DF400;
1472 std::bitset<22> DF401;
1475 std::bitset<4> DF402;
1478 std::bitset<6> DF403;
1481 std::bitset<15> DF404;
1484 std::bitset<20> DF405;
1487 std::bitset<24> DF406;
1490 std::bitset<10> DF407;
1493 std::bitset<10> DF408;
1496 std::bitset<3> DF409;
1497 int32_t set_DF409(uint32_t iods);
1499 std::bitset<2> DF411;
1500 int32_t set_DF411(uint32_t clock_steering_indicator);
1502 std::bitset<2> DF412;
1503 int32_t set_DF412(uint32_t external_clock_indicator);
1505 std::bitset<1> DF417;
1506 int32_t set_DF417(
bool using_divergence_free_smoothing);
1508 std::bitset<3> DF418;
1509 int32_t set_DF418(int32_t carrier_smoothing_interval_s);
1511 std::bitset<1> DF420;
1516 std::bitset<3> IDF001;
1517 void set_IDF001(uint8_t version);
1519 std::bitset<8> IDF002;
1520 void set_IDF002(uint8_t igs_message_number);
1522 std::bitset<20> IDF003;
1523 void set_IDF003(uint32_t tow);
1525 std::bitset<4> IDF004;
1526 void set_IDF004(uint8_t ssr_update_interval);
1528 std::bitset<1> IDF005;
1529 void set_IDF005(
bool ssr_multiple_message_indicator);
1531 std::bitset<1> IDF006;
1532 void set_IDF006(
bool regional_indicator);
1534 std::bitset<4> IDF007;
1535 void set_IDF007(uint8_t ssr_iod);
1537 std::bitset<16> IDF008;
1538 void set_IDF008(uint16_t ssr_provider_id);
1540 std::bitset<4> IDF009;
1541 void set_IDF009(uint8_t ssr_solution_id);
1543 std::bitset<6> IDF010;
1544 void set_IDF010(uint8_t num_satellites);
1546 std::bitset<6> IDF011;
1547 void set_IDF011(uint8_t gnss_satellite_id);
1549 std::bitset<8> IDF012;
1550 void set_IDF012(uint8_t gnss_iod);
1552 std::bitset<22> IDF013;
1553 void set_IDF013(
float delta_orbit_radial_m);
1555 std::bitset<20> IDF014;
1556 void set_IDF014(
float delta_orbit_in_track_m);
1558 std::bitset<20> IDF015;
1559 void set_IDF015(
float delta_orbit_cross_track_m);
1561 std::bitset<21> IDF016;
1562 void set_IDF016(
float dot_orbit_delta_track_m_s);
1564 std::bitset<19> IDF017;
1565 void set_IDF017(
float dot_orbit_delta_in_track_m_s);
1567 std::bitset<19> IDF018;
1568 void set_IDF018(
float dot_orbit_delta_cross_track_m_s);
1570 std::bitset<22> IDF019;
1571 void set_IDF019(
float delta_clock_c0_m);
1573 std::bitset<21> IDF020;
1574 void set_IDF020(
float delta_clock_c1_m_s);
1576 std::bitset<27> IDF021;
1577 void set_IDF021(
float delta_clock_c2_m_s2);
1579 std::bitset<5> IDF023;
1580 void set_IDF023(uint8_t num_bias_processed);
1582 std::bitset<5> IDF024;
1583 void set_IDF024(uint8_t gnss_signal_tracking_mode_id);
1585 std::bitset<14> IDF025;
1586 void set_IDF025(
float code_bias_m);
1592 #endif // GNSS_SDR_RTCM_H uint32_t bin_to_uint(const std::string &s) const
Returns an uint32_t from a string of binary symbols.
This is a storage class for the GPS CNAV ephemeris data as described in IS-GPS-200M.
Interface of a thread-safe std::queue.
std::string print_MT1005(uint32_t ref_id, double ecef_x, double ecef_y, double ecef_z, bool gps, bool glonass, bool galileo, bool non_physical, bool single_oscillator, uint32_t quarter_cycle_indicator)
Prints message type 1005 (Stationary Antenna Reference Point)
std::string print_MT1001(const Gps_Ephemeris &gps_eph, double obs_time, const std::map< int32_t, Gnss_Synchro > &observables, uint16_t station_id)
Prints message type 1001 (L1-Only GPS RTK Observables)
Interface of a GLONASS EPHEMERIS storage.
Interface of a GLONASS GNAV UTC MODEL storage.
This class is a storage and orbital model functions for the GPS SV ephemeris data as described in IS-...
std::string print_MT1045(const Galileo_Ephemeris &gal_eph)
Prints message type 1045 (Galileo Ephemeris), should be broadcast every 2 minutes.
std::string print_MT1004(const Gps_Ephemeris &ephL1, const Gps_CNAV_Ephemeris &ephL2, double obs_time, const std::map< int32_t, Gnss_Synchro > &observables, uint16_t station_id)
Prints message type 1004 (Extended L1 & L2 GPS RTK Observables)
uint64_t hex_to_uint(const std::string &s) const
Returns an uint64_t from a string of hexadecimal symbols.
std::vector< std::string > print_IGM05(const Galileo_HAS_data &has_data)
Prints messages of type IGM05 (SSR Bias Correction)
std::string bin_to_binary_data(const std::string &s) const
Returns a string of binary data from a string of binary symbols.
std::string print_MSM_5(const Gps_Ephemeris &gps_eph, const Gps_CNAV_Ephemeris &gps_cnav_eph, const Galileo_Ephemeris &gal_eph, const Glonass_Gnav_Ephemeris &glo_gnav_eph, double obs_time, const std::map< int32_t, Gnss_Synchro > &observables, uint32_t ref_id, uint32_t clock_steering_indicator, uint32_t external_clock_indicator, int32_t smooth_int, bool divergence_free, bool more_messages)
Prints messages of type MSM5 (Full GNSS pseudoranges, phaseranges, phaserange rate and CNR) ...
std::string print_MSM_6(const Gps_Ephemeris &gps_eph, const Gps_CNAV_Ephemeris &gps_cnav_eph, const Galileo_Ephemeris &gal_eph, const Glonass_Gnav_Ephemeris &glo_gnav_eph, double obs_time, const std::map< int32_t, Gnss_Synchro > &observables, uint32_t ref_id, uint32_t clock_steering_indicator, uint32_t external_clock_indicator, int32_t smooth_int, bool divergence_free, bool more_messages)
Prints messages of type MSM6 (Full GNSS pseudoranges and phaseranges plus CNR, high resolution) ...
std::string print_MT1019(const Gps_Ephemeris &gps_eph)
Prints message type 1019 (GPS Ephemeris), should be broadcast in the event that the IODC does not mat...
bool check_CRC(const std::string &message) const
Checks that the CRC of a RTCM package is correct.
std::string print_MSM_1(const Gps_Ephemeris &gps_eph, const Gps_CNAV_Ephemeris &gps_cnav_eph, const Galileo_Ephemeris &gal_eph, const Glonass_Gnav_Ephemeris &glo_gnav_eph, double obs_time, const std::map< int32_t, Gnss_Synchro > &observables, uint32_t ref_id, uint32_t clock_steering_indicator, uint32_t external_clock_indicator, int32_t smooth_int, bool divergence_free, bool more_messages)
Prints messages of type MSM1 (Compact GNSS observables)
std::vector< std::string > print_IGM02(const Galileo_HAS_data &has_data)
Prints messages of type IGM02 (SSR Clock Correction)
std::string print_MT1029(uint32_t ref_id, const Gps_Ephemeris &gps_eph, double obs_time, const std::string &message)
Prints message type 1029 (Unicode Text String)
std::string print_MT1005_test()
For testing purposes.
std::string print_MT1010(const Glonass_Gnav_Ephemeris &glonass_gnav_eph, double obs_time, const std::map< int32_t, Gnss_Synchro > &observables, uint16_t station_id)
Prints Extended L1-Only GLONASS RTK Observables.
This class is a storage for Galileo HAS message type 1, as defined in Galileo High Accuracy Service S...
int32_t read_MT1019(const std::string &message, Gps_Ephemeris &gps_eph) const
Verifies and reads messages of type 1019 (GPS Ephemeris). Returns 1 if anything goes wrong...
std::string print_MT1002(const Gps_Ephemeris &gps_eph, double obs_time, const std::map< int32_t, Gnss_Synchro > &observables, uint16_t station_id)
Prints message type 1002 (Extended L1-Only GPS RTK Observables)
This class is a storage and orbital model functions for the GLONASS SV ephemeris data as described in...
std::vector< std::string > print_IGM03(const Galileo_HAS_data &has_data)
Prints messages of type IGM03 (SSR Combined Orbit and Clock Correction)
This is the class that contains the information that is shared by the processing blocks.
std::string print_MSM_4(const Gps_Ephemeris &gps_eph, const Gps_CNAV_Ephemeris &gps_cnav_eph, const Galileo_Ephemeris &gal_eph, const Glonass_Gnav_Ephemeris &glo_gnav_eph, double obs_time, const std::map< int32_t, Gnss_Synchro > &observables, uint32_t ref_id, uint32_t clock_steering_indicator, uint32_t external_clock_indicator, int32_t smooth_int, bool divergence_free, bool more_messages)
Prints messages of type MSM4 (Full GNSS pseudoranges and phaseranges plus CNR)
This class implements the generation and reading of some Message Types defined in the RTCM 3...
std::string print_MT1008(uint32_t ref_id, const std::string &antenna_descriptor, uint32_t antenna_setup_id, const std::string &antenna_serial_number)
Prints message type 1008 (Antenna Descriptor & Serial Number)
std::string print_MT1003(const Gps_Ephemeris &ephL1, const Gps_CNAV_Ephemeris &ephL2, double obs_time, const std::map< int32_t, Gnss_Synchro > &observables, uint16_t station_id)
Prints message type 1003 (L1 & L2 GPS RTK Observables)
std::string print_MSM_2(const Gps_Ephemeris &gps_eph, const Gps_CNAV_Ephemeris &gps_cnav_eph, const Galileo_Ephemeris &gal_eph, const Glonass_Gnav_Ephemeris &glo_gnav_eph, double obs_time, const std::map< int32_t, Gnss_Synchro > &observables, uint32_t ref_id, uint32_t clock_steering_indicator, uint32_t external_clock_indicator, int32_t smooth_int, bool divergence_free, bool more_messages)
Prints messages of type MSM2 (Compact GNSS phaseranges)
std::string print_MT1009(const Glonass_Gnav_Ephemeris &glonass_gnav_eph, double obs_time, const std::map< int32_t, Gnss_Synchro > &observables, uint16_t station_id)
Prints L1-Only GLONASS RTK Observables.
Rtcm(uint16_t port=2101)
Default constructor that sets TCP port of the RTCM message server and RTCM Station ID...
std::string binary_data_to_bin(const std::string &s) const
Returns a string of binary symbols from a string of binary data.
std::string print_MSM_7(const Gps_Ephemeris &gps_eph, const Gps_CNAV_Ephemeris &gps_cnav_eph, const Galileo_Ephemeris &gal_eph, const Glonass_Gnav_Ephemeris &glo_gnav_eph, double obs_time, const std::map< int32_t, Gnss_Synchro > &observables, uint32_t ref_id, uint32_t clock_steering_indicator, uint32_t external_clock_indicator, int32_t smooth_int, bool divergence_free, bool more_messages)
Prints messages of type MSM7 (Full GNSS pseudoranges, phaseranges, phaserange rate and CNR...
std::string hex_to_bin(const std::string &s) const
Returns a string of binary symbols from a string of hexadecimal symbols.
std::string bin_to_hex(const std::string &s) const
Returns a string of hexadecimal symbols from a string of binary symbols.
int32_t read_MT1045(const std::string &message, Galileo_Ephemeris &gal_eph) const
Verifies and reads messages of type 1045 (Galileo Ephemeris). Returns 1 if anything goes wrong...
void send_message(const std::string &msg)
Sends a message through the server to all connected clients.
uint32_t lock_time(const Gps_Ephemeris &eph, double obs_time, const Gnss_Synchro &gnss_synchro)
Returns the time period in which GPS L1 signals have been continually tracked.
Interface of a GPS EPHEMERIS storage.
This class is a storage and orbital model functions for the Galileo SV ephemeris data as described in...
std::string print_MT1020(const Glonass_Gnav_Ephemeris &glonass_gnav_eph, const Glonass_Gnav_Utc_Model &glonass_gnav_utc_model)
Prints message type 1020 (GLONASS Ephemeris).
This class is a storage for the GLONASS GNAV UTC MODEL data as described in GLONASS ICD (Edition 5...
std::string print_MSM_3(const Gps_Ephemeris &gps_eph, const Gps_CNAV_Ephemeris &gps_cnav_eph, const Galileo_Ephemeris &gal_eph, const Glonass_Gnav_Ephemeris &glo_gnav_eph, double obs_time, const std::map< int32_t, Gnss_Synchro > &observables, uint32_t ref_id, uint32_t clock_steering_indicator, uint32_t external_clock_indicator, int32_t smooth_int, bool divergence_free, bool more_messages)
Prints messages of type MSM3 (Compact GNSS pseudoranges and phaseranges)
std::string print_MT1006(uint32_t ref_id, double ecef_x, double ecef_y, double ecef_z, bool gps, bool glonass, bool galileo, bool non_physical, bool single_oscillator, uint32_t quarter_cycle_indicator, double height)
Prints message type 1006 (Stationary Antenna Reference Point, with Height Information) ...
void stop_server()
Stops the server.
This class implements a thread-safe std::queue.
double bin_to_double(const std::string &s) const
Returns double from a string of binary symbols.
bool is_server_running() const
Returns true if the server is running, false otherwise.
Interface of a GPS CNAV EPHEMERIS storage.
std::string print_MT1011(const Glonass_Gnav_Ephemeris &glonass_gnav_ephL1, const Glonass_Gnav_Ephemeris &glonass_gnav_ephL2, double obs_time, const std::map< int32_t, Gnss_Synchro > &observables, uint16_t station_id)
Prints L1&L2 GLONASS RTK Observables.
int32_t read_MT1005(const std::string &message, uint32_t &ref_id, double &ecef_x, double &ecef_y, double &ecef_z, bool &gps, bool &glonass, bool &galileo)
Verifies and reads messages of type 1005 (Stationary Antenna Reference Point). Returns 1 if anything ...
Interface of a Galileo EPHEMERIS storage.
void run_server()
Starts running the server.
Class for Galileo HAS message type 1 data storage.
std::vector< std::string > print_IGM01(const Galileo_HAS_data &has_data)
Prints messages of type IGM01 (SSR Orbit Correction)
int64_t hex_to_int(const std::string &s) const
Returns a int64_t from a string of hexadecimal symbols.
std::string print_MT1012(const Glonass_Gnav_Ephemeris &glonass_gnav_ephL1, const Glonass_Gnav_Ephemeris &glonass_gnav_ephL2, double obs_time, const std::map< int32_t, Gnss_Synchro > &observables, uint16_t station_id)
Prints Extended L1&L2 GLONASS RTK Observables.
int32_t read_MT1020(const std::string &message, Glonass_Gnav_Ephemeris &glonass_gnav_eph, Glonass_Gnav_Utc_Model &glonass_gnav_utc_model) const
Verifies and reads messages of type 1020 (GLONASS Ephemeris).
Interface of the Gnss_Synchro class.