18 #ifndef GNSS_SDR_RTCM_H 19 #define GNSS_SDR_RTCM_H 29 #include <boost/asio.hpp> 30 #include <boost/date_time/posix_time/posix_time.hpp> 31 #include <glog/logging.h> 54 #if USE_BOOST_ASIO_IO_CONTEXT 55 using b_io_context = boost::asio::io_context;
57 using b_io_context = boost::asio::io_service;
93 explicit Rtcm(uint16_t port = 2101);
99 std::string
print_MT1001(
const Gps_Ephemeris& gps_eph,
double obs_time,
const std::map<int32_t, Gnss_Synchro>& observables, uint16_t station_id);
104 std::string
print_MT1002(
const Gps_Ephemeris& gps_eph,
double obs_time,
const std::map<int32_t, Gnss_Synchro>& observables, uint16_t station_id);
119 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);
124 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);
129 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);
136 std::string
print_MT1008(uint32_t ref_id,
const std::string& antenna_descriptor, uint32_t antenna_setup_id,
const std::string& antenna_serial_number);
235 const std::map<int32_t, Gnss_Synchro>& observables,
237 uint32_t clock_steering_indicator,
238 uint32_t external_clock_indicator,
240 bool divergence_free,
251 const std::map<int32_t, Gnss_Synchro>& observables,
253 uint32_t clock_steering_indicator,
254 uint32_t external_clock_indicator,
256 bool divergence_free,
267 const std::map<int32_t, Gnss_Synchro>& observables,
269 uint32_t clock_steering_indicator,
270 uint32_t external_clock_indicator,
272 bool divergence_free,
283 const std::map<int32_t, Gnss_Synchro>& observables,
285 uint32_t clock_steering_indicator,
286 uint32_t external_clock_indicator,
288 bool divergence_free,
299 const std::map<int32_t, Gnss_Synchro>& observables,
301 uint32_t clock_steering_indicator,
302 uint32_t external_clock_indicator,
304 bool divergence_free,
315 const std::map<int32_t, Gnss_Synchro>& observables,
317 uint32_t clock_steering_indicator,
318 uint32_t external_clock_indicator,
320 bool divergence_free,
331 const std::map<int32_t, Gnss_Synchro>& observables,
333 uint32_t clock_steering_indicator,
334 uint32_t external_clock_indicator,
336 bool divergence_free,
353 std::string
bin_to_hex(
const std::string& s)
const;
354 std::string
hex_to_bin(
const std::string& s)
const;
360 int32_t bin_to_int(
const std::string& s)
const;
362 int32_t bin_to_sint(
const std::string& s)
const;
364 int64_t
hex_to_int(
const std::string& s)
const;
366 bool check_CRC(
const std::string& message)
const;
378 std::bitset<64> get_MT1001_4_header(uint32_t msg_number,
380 const std::map<int32_t, Gnss_Synchro>& observables,
384 bool divergence_free);
391 std::bitset<152> get_MT1005_test();
404 std::bitset<61> get_MT1009_12_header(uint32_t msg_number,
406 const std::map<int32_t, Gnss_Synchro>& observables,
410 bool divergence_free);
457 std::string get_MSM_header(uint32_t msg_number,
459 const std::map<int32_t, Gnss_Synchro>& observables,
461 uint32_t clock_steering_indicator,
462 uint32_t external_clock_indicator,
464 bool divergence_free,
467 std::string get_MSM_1_content_sat_data(
const std::map<int32_t, Gnss_Synchro>& observables);
468 std::string get_MSM_4_content_sat_data(
const std::map<int32_t, Gnss_Synchro>& observables);
469 std::string get_MSM_5_content_sat_data(
const std::map<int32_t, Gnss_Synchro>& observables);
471 std::string get_MSM_1_content_signal_data(
const std::map<int32_t, Gnss_Synchro>& observables);
482 static std::map<std::string, int> galileo_signal_map;
483 static std::map<std::string, int> gps_signal_map;
484 std::vector<std::pair<int32_t, Gnss_Synchro>> sort_by_signal(
const std::vector<std::pair<int32_t, Gnss_Synchro>>& synchro_map)
const;
485 std::vector<std::pair<int32_t, Gnss_Synchro>> sort_by_PRN_mask(
const std::vector<std::pair<int32_t, Gnss_Synchro>>& synchro_map)
const;
486 boost::posix_time::ptime compute_GPS_time(
const Gps_Ephemeris& eph,
double obs_time)
const;
487 boost::posix_time::ptime compute_GPS_time(
const Gps_CNAV_Ephemeris& eph,
double obs_time)
const;
488 boost::posix_time::ptime compute_Galileo_time(
const Galileo_Ephemeris& eph,
double obs_time)
const;
490 boost::posix_time::ptime gps_L1_last_lock_time[64];
491 boost::posix_time::ptime gps_L2_last_lock_time[64];
492 boost::posix_time::ptime gal_E1_last_lock_time[64];
493 boost::posix_time::ptime gal_E5_last_lock_time[64];
494 boost::posix_time::ptime glo_L1_last_lock_time[64];
495 boost::posix_time::ptime glo_L2_last_lock_time[64];
496 uint32_t lock_time_indicator(uint32_t lock_time_period_s);
497 uint32_t msm_lock_time_indicator(uint32_t lock_time_period_s);
498 uint32_t msm_extended_lock_time_indicator(uint32_t lock_time_period_s);
508 static const std::size_t header_length = 6;
509 static const std::size_t max_body_length = 1029;
516 const char* data()
const 526 inline std::size_t length()
const 528 return header_length + body_length_;
531 const char* body()
const 533 return data_.data() + header_length;
538 return data_.data() + header_length;
541 std::size_t body_length()
const 546 void body_length(std::size_t new_length)
548 body_length_ = new_length;
549 if (body_length_ > max_body_length)
551 body_length_ = max_body_length;
555 inline bool decode_header()
557 char header[header_length + 1] =
"";
558 std::strncat(header, data_.data(), header_length);
559 if (header[0] !=
'G' || header[1] !=
'S')
564 char header2_[header_length - 1] =
"";
565 std::strncat(header2_, data_.data() + 2, header_length - 2);
566 body_length_ = std::atoi(header2_);
567 if (body_length_ == 0)
572 if (body_length_ > max_body_length)
580 inline void encode_header()
582 char header[header_length + 1] =
"";
583 std::snprintf(header, header_length + 1,
"GS%4d", std::max(std::min(static_cast<int>(body_length_), static_cast<int>(max_body_length)), 0));
584 std::memcpy(data_.data(), header, header_length);
588 std::array<char, header_length + max_body_length> data_{};
589 std::size_t body_length_;
596 virtual ~RtcmListener() =
default;
597 virtual void deliver(
const Rtcm_Message& msg) = 0;
601 class Rtcm_Listener_Room
604 inline void join(
const std::shared_ptr<RtcmListener>& participant)
606 participants_.insert(participant);
607 for (
auto msg : recent_msgs_)
609 participant->deliver(msg);
613 inline void leave(
const std::shared_ptr<RtcmListener>& participant)
615 participants_.erase(participant);
618 inline void deliver(
const Rtcm_Message& msg)
620 recent_msgs_.push_back(msg);
621 while (recent_msgs_.size() > max_recent_msgs)
623 recent_msgs_.pop_front();
626 for (
const auto& participant : participants_)
628 participant->deliver(msg);
633 std::set<std::shared_ptr<RtcmListener>> participants_;
638 std::deque<Rtcm_Message> recent_msgs_;
643 :
public RtcmListener,
644 public std::enable_shared_from_this<Rtcm_Session>
647 Rtcm_Session(boost::asio::ip::tcp::socket socket, Rtcm_Listener_Room& room) : socket_(std::move(socket)), room_(room) {}
650 room_.join(shared_from_this());
651 do_read_message_header();
654 inline void deliver(
const Rtcm_Message& msg)
656 bool write_in_progress = !write_msgs_.empty();
657 write_msgs_.push_back(msg);
658 if (!write_in_progress)
665 inline void do_read_message_header()
667 auto self(shared_from_this());
668 boost::asio::async_read(socket_,
669 boost::asio::buffer(read_msg_.data(), Rtcm_Message::header_length),
670 [
this,
self](boost::system::error_code ec, std::size_t ) {
671 if (!ec and read_msg_.decode_header())
673 do_read_message_body();
675 else if (!ec and !read_msg_.decode_header())
677 client_says += read_msg_.data();
679 while (client_says.length() >= 80)
683 LOG(INFO) <<
"Client says:";
686 LOG(INFO) << client_says;
687 client_says = client_says.substr(80, client_says.length() - 80);
689 do_read_message_header();
693 std::cout <<
"Closing connection with RTCM client\n";
694 room_.leave(shared_from_this());
699 inline void do_read_message_body()
701 auto self(shared_from_this());
702 boost::asio::async_read(socket_,
703 boost::asio::buffer(read_msg_.body(), read_msg_.body_length()),
704 [
this,
self](boost::system::error_code ec, std::size_t ) {
707 room_.deliver(read_msg_);
711 do_read_message_header();
715 std::cout <<
"Closing connection with RTCM client\n";
716 room_.leave(shared_from_this());
721 inline void do_write()
723 auto self(shared_from_this());
724 boost::asio::async_write(socket_,
725 boost::asio::buffer(write_msgs_.front().body(), write_msgs_.front().body_length()),
726 [
this,
self](boost::system::error_code ec, std::size_t ) {
729 write_msgs_.pop_front();
730 if (!write_msgs_.empty())
737 std::cout <<
"Closing connection with RTCM client\n";
738 room_.leave(shared_from_this());
743 boost::asio::ip::tcp::socket socket_;
744 Rtcm_Listener_Room& room_;
745 Rtcm_Message read_msg_;
746 std::deque<Rtcm_Message> write_msgs_;
747 std::string client_says;
751 class Tcp_Internal_Client
752 :
public std::enable_shared_from_this<Tcp_Internal_Client>
755 Tcp_Internal_Client(b_io_context& io_context,
756 boost::asio::ip::tcp::resolver::iterator endpoint_iterator)
757 : io_context_(io_context), socket_(io_context)
759 do_connect(std::move(endpoint_iterator));
764 io_context_.post([
this]() { socket_.close(); });
767 inline void write(
const Rtcm_Message& msg)
771 bool write_in_progress = !write_msgs_.empty();
772 write_msgs_.push_back(msg);
773 if (!write_in_progress)
781 inline void do_connect(boost::asio::ip::tcp::resolver::iterator endpoint_iterator)
783 boost::asio::async_connect(socket_, std::move(endpoint_iterator),
784 [
this](boost::system::error_code ec, boost::asio::ip::tcp::resolver::iterator) {
791 std::cout <<
"Server is down.\n";
796 inline void do_read_message()
798 boost::asio::async_read(socket_,
799 boost::asio::buffer(read_msg_.data(), 1029),
800 [
this](boost::system::error_code ec, std::size_t ) {
807 std::cout <<
"Error in client\n";
813 inline void do_write()
815 boost::asio::async_write(socket_,
816 boost::asio::buffer(write_msgs_.front().data(), write_msgs_.front().length()),
817 [
this](boost::system::error_code ec, std::size_t ) {
820 write_msgs_.pop_front();
821 if (!write_msgs_.empty())
833 b_io_context& io_context_;
834 boost::asio::ip::tcp::socket socket_;
835 Rtcm_Message read_msg_;
836 std::deque<Rtcm_Message> write_msgs_;
845 boost::asio::ip::tcp::resolver resolver(io_context);
846 std::string host(
"localhost");
847 std::string port_str = std::to_string(port);
848 auto queue_endpoint_iterator = resolver.resolve({host.c_str(), port_str.c_str()});
849 c = std::make_shared<Tcp_Internal_Client>(io_context, queue_endpoint_iterator);
852 inline void do_read_queue()
858 queue_->wait_and_pop(message);
859 if (message ==
"Goodbye")
864 const char* char_msg = message.c_str();
865 msg.body_length(message.length());
866 std::memcpy(msg.body(), char_msg, msg.body_length());
873 std::shared_ptr<Tcp_Internal_Client> c;
874 std::shared_ptr<Concurrent_Queue<std::string>>& queue_;
881 Tcp_Server(b_io_context& io_context,
const boost::asio::ip::tcp::endpoint& endpoint)
882 : acceptor_(io_context), socket_(io_context)
884 acceptor_.open(endpoint.protocol());
885 acceptor_.set_option(boost::asio::ip::tcp::acceptor::reuse_address(
true));
886 acceptor_.bind(endpoint);
891 inline void close_server()
898 inline void do_accept()
900 acceptor_.async_accept(socket_, [
this](boost::system::error_code ec) {
905 std::cout <<
"The TCP/IP server of RTCM messages is up and running. Accepting connections ...\n";
906 first_client =
false;
910 std::cout <<
"Starting RTCM TCP/IP server session...\n";
911 boost::system::error_code ec2;
912 boost::asio::ip::tcp::endpoint endpoint = socket_.remote_endpoint(ec2);
916 std::cout <<
"Error getting remote IP address, closing session.\n";
917 LOG(INFO) <<
"Error getting remote IP address";
918 start_session =
false;
922 std::string remote_addr = endpoint.address().to_string();
923 std::cout <<
"Serving client from " << remote_addr <<
'\n';
924 LOG(INFO) <<
"Serving client from " << remote_addr;
929 std::make_shared<Rtcm_Session>(std::move(socket_), room_)->start();
934 std::cout <<
"Error when invoking a RTCM session. " << ec <<
'\n';
936 start_session =
true;
941 boost::asio::ip::tcp::acceptor acceptor_;
942 boost::asio::ip::tcp::socket socket_;
943 Rtcm_Listener_Room room_;
944 bool first_client =
true;
945 bool start_session =
true;
948 b_io_context io_context;
949 std::shared_ptr<Concurrent_Queue<std::string>> rtcm_message_queue;
952 std::list<Rtcm::Tcp_Server> servers;
953 bool server_is_running;
959 std::bitset<8> preamble;
960 std::bitset<6> reserved_field;
961 std::string add_CRC(
const std::string& m)
const;
962 std::string build_message(
const std::string& data)
const;
967 std::bitset<12> DF002;
968 int32_t set_DF002(uint32_t message_number);
970 std::bitset<12> DF003;
971 int32_t set_DF003(uint32_t ref_station_ID);
973 std::bitset<30> DF004;
974 int32_t set_DF004(
double obs_time);
976 std::bitset<1> DF005;
977 int32_t set_DF005(
bool sync_flag);
979 std::bitset<5> DF006;
980 int32_t set_DF006(
const std::map<int32_t, Gnss_Synchro>& observables);
982 std::bitset<1> DF007;
983 int32_t set_DF007(
bool divergence_free_smoothing_indicator);
985 std::bitset<3> DF008;
986 int32_t set_DF008(int16_t smoothing_interval);
988 std::bitset<6> DF009;
992 std::bitset<1> DF010;
993 int32_t set_DF010(
bool code_indicator);
995 std::bitset<24> DF011;
998 std::bitset<20> DF012;
1001 std::bitset<7> DF013;
1004 std::bitset<8> DF014;
1007 std::bitset<8> DF015;
1010 std::bitset<14> DF017;
1013 std::bitset<20> DF018;
1016 std::bitset<7> DF019;
1019 std::bitset<8> DF020;
1022 std::bitset<6> DF021;
1023 int32_t set_DF021();
1025 std::bitset<1> DF022;
1026 int32_t set_DF022(
bool gps_indicator);
1028 std::bitset<1> DF023;
1029 int32_t set_DF023(
bool glonass_indicator);
1031 std::bitset<1> DF024;
1032 int32_t set_DF024(
bool galileo_indicator);
1034 std::bitset<38> DF025;
1035 int32_t set_DF025(
double antenna_ECEF_X_m);
1037 std::bitset<38> DF026;
1038 int32_t set_DF026(
double antenna_ECEF_Y_m);
1040 std::bitset<38> DF027;
1041 int32_t set_DF027(
double antenna_ECEF_Z_m);
1043 std::bitset<16> DF028;
1044 int32_t set_DF028(
double height);
1046 std::bitset<8> DF029;
1048 std::bitset<8> DF031;
1049 int32_t set_DF031(uint32_t antenna_setup_id);
1051 std::bitset<8> DF032;
1059 int32_t set_DF034(
double obs_time);
1060 std::bitset<27> DF034;
1062 std::bitset<5> DF035;
1063 int32_t set_DF035(
const std::map<int32_t, Gnss_Synchro>& observables);
1065 std::bitset<1> DF036;
1066 int32_t set_DF036(
bool divergence_free_smoothing_indicator);
1068 std::bitset<3> DF037;
1069 int32_t set_DF037(int16_t smoothing_interval);
1071 std::bitset<6> DF038;
1075 std::bitset<1> DF039;
1076 int32_t set_DF039(
bool code_indicator);
1078 std::bitset<5> DF040;
1079 int32_t set_DF040(int32_t frequency_channel_number);
1082 std::bitset<25> DF041;
1085 std::bitset<20> DF042;
1088 std::bitset<7> DF043;
1091 std::bitset<7> DF044;
1094 std::bitset<8> DF045;
1097 std::bitset<2> DF046;
1098 int32_t set_DF046(uint16_t code_indicator);
1100 std::bitset<14> DF047;
1103 std::bitset<20> DF048;
1106 std::bitset<7> DF049;
1109 std::bitset<8> DF050;
1112 std::bitset<16> DF051;
1113 int32_t set_DF051(
const Gps_Ephemeris& gps_eph,
double obs_time);
1115 std::bitset<17> DF052;
1116 int32_t set_DF052(
const Gps_Ephemeris& gps_eph,
double obs_time);
1119 std::bitset<8> DF071;
1122 std::bitset<10> DF076;
1125 std::bitset<4> DF077;
1128 std::bitset<2> DF078;
1131 std::bitset<14> DF079;
1134 std::bitset<8> DF080;
1137 std::bitset<16> DF081;
1140 std::bitset<8> DF082;
1143 std::bitset<16> DF083;
1146 std::bitset<22> DF084;
1149 std::bitset<10> DF085;
1152 std::bitset<16> DF086;
1155 std::bitset<16> DF087;
1158 std::bitset<32> DF088;
1161 std::bitset<16> DF089;
1164 std::bitset<32> DF090;
1167 std::bitset<16> DF091;
1170 std::bitset<32> DF092;
1173 std::bitset<16> DF093;
1176 std::bitset<16> DF094;
1179 std::bitset<32> DF095;
1182 std::bitset<16> DF096;
1185 std::bitset<32> DF097;
1188 std::bitset<16> DF098;
1191 std::bitset<32> DF099;
1194 std::bitset<24> DF100;
1197 std::bitset<8> DF101;
1200 std::bitset<6> DF102;
1203 std::bitset<1> DF103;
1206 std::bitset<1> DF104;
1207 int32_t set_DF104(uint32_t glonass_gnav_alm_health);
1209 std::bitset<1> DF105;
1210 int32_t set_DF105(uint32_t glonass_gnav_alm_health_ind);
1212 std::bitset<2> DF106;
1215 std::bitset<12> DF107;
1218 std::bitset<1> DF108;
1221 std::bitset<1> DF109;
1224 std::bitset<7> DF110;
1227 std::bitset<24> DF111;
1230 std::bitset<27> DF112;
1233 std::bitset<5> DF113;
1236 std::bitset<24> DF114;
1239 std::bitset<27> DF115;
1242 std::bitset<5> DF116;
1245 std::bitset<24> DF117;
1248 std::bitset<27> DF118;
1251 std::bitset<5> DF119;
1254 std::bitset<1> DF120;
1257 std::bitset<11> DF121;
1260 std::bitset<2> DF122;
1263 std::bitset<1> DF123;
1266 std::bitset<22> DF124;
1269 std::bitset<5> DF125;
1272 std::bitset<5> DF126;
1275 std::bitset<1> DF127;
1278 std::bitset<4> DF128;
1281 std::bitset<11> DF129;
1284 std::bitset<2> DF130;
1287 std::bitset<1> DF131;
1288 int32_t set_DF131(uint32_t fifth_str_additional_data_ind);
1290 std::bitset<11> DF132;
1293 std::bitset<32> DF133;
1296 std::bitset<5> DF134;
1299 std::bitset<22> DF135;
1302 std::bitset<1> DF136;
1305 std::bitset<1> DF137;
1309 std::bitset<1> DF141;
1312 std::bitset<1> DF142;
1315 std::bitset<30> DF248;
1316 int32_t set_DF248(
double obs_time);
1319 std::bitset<6> DF252;
1322 std::bitset<12> DF289;
1325 std::bitset<10> DF290;
1328 std::bitset<8> DF291;
1331 std::bitset<14> DF292;
1334 std::bitset<14> DF293;
1337 std::bitset<6> DF294;
1340 std::bitset<21> DF295;
1343 std::bitset<31> DF296;
1346 std::bitset<16> DF297;
1349 std::bitset<16> DF298;
1352 std::bitset<32> DF299;
1355 std::bitset<16> DF300;
1358 std::bitset<32> DF301;
1361 std::bitset<16> DF302;
1364 std::bitset<32> DF303;
1367 std::bitset<14> DF304;
1370 std::bitset<16> DF305;
1373 std::bitset<32> DF306;
1376 std::bitset<16> DF307;
1379 std::bitset<32> DF308;
1382 std::bitset<16> DF309;
1385 std::bitset<32> DF310;
1388 std::bitset<24> DF311;
1391 std::bitset<10> DF312;
1394 std::bitset<10> DF313;
1397 std::bitset<2> DF314;
1400 std::bitset<1> DF315;
1403 std::bitset<2> DF364;
1406 std::bitset<1> DF393;
1407 int32_t set_DF393(
bool more_messages);
1409 std::bitset<64> DF394;
1410 int32_t set_DF394(
const std::map<int32_t, Gnss_Synchro>& gnss_synchro);
1412 std::bitset<32> DF395;
1413 int32_t set_DF395(
const std::map<int32_t, Gnss_Synchro>& gnss_synchro);
1415 std::string set_DF396(
const std::map<int32_t, Gnss_Synchro>& observables);
1417 std::bitset<8> DF397;
1420 std::bitset<10> DF398;
1423 std::bitset<14> DF399;
1426 std::bitset<15> DF400;
1429 std::bitset<22> DF401;
1432 std::bitset<4> DF402;
1435 std::bitset<6> DF403;
1438 std::bitset<15> DF404;
1441 std::bitset<20> DF405;
1444 std::bitset<24> DF406;
1447 std::bitset<10> DF407;
1450 std::bitset<10> DF408;
1453 std::bitset<3> DF409;
1454 int32_t set_DF409(uint32_t iods);
1456 std::bitset<2> DF411;
1457 int32_t set_DF411(uint32_t clock_steering_indicator);
1459 std::bitset<2> DF412;
1460 int32_t set_DF412(uint32_t external_clock_indicator);
1462 std::bitset<1> DF417;
1463 int32_t set_DF417(
bool using_divergence_free_smoothing);
1465 std::bitset<3> DF418;
1466 int32_t set_DF418(int32_t carrier_smoothing_interval_s);
1468 std::bitset<1> DF420;
1475 #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::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::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.
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...
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.
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.