21 #ifndef GNSS_SDR_RTCM_H 22 #define GNSS_SDR_RTCM_H 32 #include <boost/asio.hpp> 33 #include <boost/date_time/posix_time/posix_time.hpp> 34 #include <glog/logging.h> 51 #if USE_BOOST_ASIO_IO_CONTEXT 52 using b_io_context = boost::asio::io_context;
54 using b_io_context = boost::asio::io_service;
90 explicit Rtcm(uint16_t port = 2101);
96 std::string
print_MT1001(
const Gps_Ephemeris& gps_eph,
double obs_time,
const std::map<int32_t, Gnss_Synchro>& observables, uint16_t station_id);
101 std::string
print_MT1002(
const Gps_Ephemeris& gps_eph,
double obs_time,
const std::map<int32_t, Gnss_Synchro>& observables, uint16_t station_id);
116 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);
121 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);
126 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);
133 std::string
print_MT1008(uint32_t ref_id,
const std::string& antenna_descriptor, uint32_t antenna_setup_id,
const std::string& antenna_serial_number);
232 const std::map<int32_t, Gnss_Synchro>& observables,
234 uint32_t clock_steering_indicator,
235 uint32_t external_clock_indicator,
237 bool divergence_free,
248 const std::map<int32_t, Gnss_Synchro>& observables,
250 uint32_t clock_steering_indicator,
251 uint32_t external_clock_indicator,
253 bool divergence_free,
264 const std::map<int32_t, Gnss_Synchro>& observables,
266 uint32_t clock_steering_indicator,
267 uint32_t external_clock_indicator,
269 bool divergence_free,
280 const std::map<int32_t, Gnss_Synchro>& observables,
282 uint32_t clock_steering_indicator,
283 uint32_t external_clock_indicator,
285 bool divergence_free,
296 const std::map<int32_t, Gnss_Synchro>& observables,
298 uint32_t clock_steering_indicator,
299 uint32_t external_clock_indicator,
301 bool divergence_free,
312 const std::map<int32_t, Gnss_Synchro>& observables,
314 uint32_t clock_steering_indicator,
315 uint32_t external_clock_indicator,
317 bool divergence_free,
328 const std::map<int32_t, Gnss_Synchro>& observables,
330 uint32_t clock_steering_indicator,
331 uint32_t external_clock_indicator,
333 bool divergence_free,
350 std::string
bin_to_hex(
const std::string& s)
const;
351 std::string
hex_to_bin(
const std::string& s)
const;
357 int32_t bin_to_int(
const std::string& s)
const;
359 int32_t bin_to_sint(
const std::string& s)
const;
361 int64_t
hex_to_int(
const std::string& s)
const;
363 bool check_CRC(
const std::string& message)
const;
375 std::bitset<64> get_MT1001_4_header(uint32_t msg_number,
377 const std::map<int32_t, Gnss_Synchro>& observables,
381 bool divergence_free);
388 std::bitset<152> get_MT1005_test();
401 std::bitset<61> get_MT1009_12_header(uint32_t msg_number,
403 const std::map<int32_t, Gnss_Synchro>& observables,
407 bool divergence_free);
454 std::string get_MSM_header(uint32_t msg_number,
456 const std::map<int32_t, Gnss_Synchro>& observables,
458 uint32_t clock_steering_indicator,
459 uint32_t external_clock_indicator,
461 bool divergence_free,
464 std::string get_MSM_1_content_sat_data(
const std::map<int32_t, Gnss_Synchro>& observables);
465 std::string get_MSM_4_content_sat_data(
const std::map<int32_t, Gnss_Synchro>& observables);
466 std::string get_MSM_5_content_sat_data(
const std::map<int32_t, Gnss_Synchro>& observables);
468 std::string get_MSM_1_content_signal_data(
const std::map<int32_t, Gnss_Synchro>& observables);
479 static std::map<std::string, int> galileo_signal_map;
480 static std::map<std::string, int> gps_signal_map;
481 std::vector<std::pair<int32_t, Gnss_Synchro> > sort_by_signal(
const std::vector<std::pair<int32_t, Gnss_Synchro> >& synchro_map)
const;
482 std::vector<std::pair<int32_t, Gnss_Synchro> > sort_by_PRN_mask(
const std::vector<std::pair<int32_t, Gnss_Synchro> >& synchro_map)
const;
483 boost::posix_time::ptime compute_GPS_time(
const Gps_Ephemeris& eph,
double obs_time)
const;
484 boost::posix_time::ptime compute_GPS_time(
const Gps_CNAV_Ephemeris& eph,
double obs_time)
const;
485 boost::posix_time::ptime compute_Galileo_time(
const Galileo_Ephemeris& eph,
double obs_time)
const;
487 boost::posix_time::ptime gps_L1_last_lock_time[64];
488 boost::posix_time::ptime gps_L2_last_lock_time[64];
489 boost::posix_time::ptime gal_E1_last_lock_time[64];
490 boost::posix_time::ptime gal_E5_last_lock_time[64];
491 boost::posix_time::ptime glo_L1_last_lock_time[64];
492 boost::posix_time::ptime glo_L2_last_lock_time[64];
493 uint32_t lock_time_indicator(uint32_t lock_time_period_s);
494 uint32_t msm_lock_time_indicator(uint32_t lock_time_period_s);
495 uint32_t msm_extended_lock_time_indicator(uint32_t lock_time_period_s);
505 static const std::size_t header_length = 6;
506 static const std::size_t max_body_length = 1029;
513 const char* data()
const 523 inline std::size_t length()
const 525 return header_length + body_length_;
528 const char* body()
const 530 return data_.data() + header_length;
535 return data_.data() + header_length;
538 std::size_t body_length()
const 543 void body_length(std::size_t new_length)
545 body_length_ = new_length;
546 if (body_length_ > max_body_length)
548 body_length_ = max_body_length;
552 inline bool decode_header()
554 char header[header_length + 1] =
"";
555 std::strncat(header, data_.data(), header_length);
556 if (header[0] !=
'G' || header[1] !=
'S')
561 char header2_[header_length - 1] =
"";
562 std::strncat(header2_, data_.data() + 2, header_length - 2);
563 body_length_ = std::atoi(header2_);
564 if (body_length_ == 0)
569 if (body_length_ > max_body_length)
577 inline void encode_header()
579 char header[header_length + 1] =
"";
580 std::snprintf(header, header_length + 1,
"GS%4d", std::max(std::min(static_cast<int>(body_length_), static_cast<int>(max_body_length)), 0));
581 std::memcpy(data_.data(), header, header_length);
585 std::array<char, header_length + max_body_length> data_{};
586 std::size_t body_length_;
593 virtual ~RtcmListener() =
default;
594 virtual void deliver(
const Rtcm_Message& msg) = 0;
598 class Rtcm_Listener_Room
601 inline void join(
const std::shared_ptr<RtcmListener>& participant)
603 participants_.insert(participant);
604 for (
auto msg : recent_msgs_)
606 participant->deliver(msg);
610 inline void leave(
const std::shared_ptr<RtcmListener>& participant)
612 participants_.erase(participant);
615 inline void deliver(
const Rtcm_Message& msg)
617 recent_msgs_.push_back(msg);
618 while (recent_msgs_.size() > max_recent_msgs)
620 recent_msgs_.pop_front();
623 for (
const auto& participant : participants_)
625 participant->deliver(msg);
630 std::set<std::shared_ptr<RtcmListener> > participants_;
635 std::deque<Rtcm_Message> recent_msgs_;
640 :
public RtcmListener,
641 public std::enable_shared_from_this<Rtcm_Session>
644 Rtcm_Session(boost::asio::ip::tcp::socket socket, Rtcm_Listener_Room& room) : socket_(std::move(socket)), room_(room) {}
647 room_.join(shared_from_this());
648 do_read_message_header();
651 inline void deliver(
const Rtcm_Message& msg)
653 bool write_in_progress = !write_msgs_.empty();
654 write_msgs_.push_back(msg);
655 if (!write_in_progress)
662 inline void do_read_message_header()
664 auto self(shared_from_this());
665 boost::asio::async_read(socket_,
666 boost::asio::buffer(read_msg_.data(), Rtcm_Message::header_length),
667 [
this,
self](boost::system::error_code ec, std::size_t ) {
668 if (!ec and read_msg_.decode_header())
670 do_read_message_body();
672 else if (!ec and !read_msg_.decode_header())
674 client_says += read_msg_.data();
676 while (client_says.length() >= 80)
680 LOG(INFO) <<
"Client says:";
683 LOG(INFO) << client_says;
684 client_says = client_says.substr(80, client_says.length() - 80);
686 do_read_message_header();
690 std::cout <<
"Closing connection with RTCM client\n";
691 room_.leave(shared_from_this());
696 inline void do_read_message_body()
698 auto self(shared_from_this());
699 boost::asio::async_read(socket_,
700 boost::asio::buffer(read_msg_.body(), read_msg_.body_length()),
701 [
this,
self](boost::system::error_code ec, std::size_t ) {
704 room_.deliver(read_msg_);
708 do_read_message_header();
712 std::cout <<
"Closing connection with RTCM client\n";
713 room_.leave(shared_from_this());
718 inline void do_write()
720 auto self(shared_from_this());
721 boost::asio::async_write(socket_,
722 boost::asio::buffer(write_msgs_.front().body(), write_msgs_.front().body_length()),
723 [
this,
self](boost::system::error_code ec, std::size_t ) {
726 write_msgs_.pop_front();
727 if (!write_msgs_.empty())
734 std::cout <<
"Closing connection with RTCM client\n";
735 room_.leave(shared_from_this());
740 boost::asio::ip::tcp::socket socket_;
741 Rtcm_Listener_Room& room_;
742 Rtcm_Message read_msg_;
743 std::deque<Rtcm_Message> write_msgs_;
744 std::string client_says;
748 class Tcp_Internal_Client
749 :
public std::enable_shared_from_this<Tcp_Internal_Client>
752 Tcp_Internal_Client(b_io_context& io_context,
753 boost::asio::ip::tcp::resolver::iterator endpoint_iterator)
754 : io_context_(io_context), socket_(io_context)
756 do_connect(std::move(endpoint_iterator));
761 io_context_.post([
this]() { socket_.close(); });
764 inline void write(
const Rtcm_Message& msg)
768 bool write_in_progress = !write_msgs_.empty();
769 write_msgs_.push_back(msg);
770 if (!write_in_progress)
778 inline void do_connect(boost::asio::ip::tcp::resolver::iterator endpoint_iterator)
780 boost::asio::async_connect(socket_, std::move(endpoint_iterator),
781 [
this](boost::system::error_code ec, boost::asio::ip::tcp::resolver::iterator) {
788 std::cout <<
"Server is down.\n";
793 inline void do_read_message()
795 boost::asio::async_read(socket_,
796 boost::asio::buffer(read_msg_.data(), 1029),
797 [
this](boost::system::error_code ec, std::size_t ) {
804 std::cout <<
"Error in client\n";
810 inline void do_write()
812 boost::asio::async_write(socket_,
813 boost::asio::buffer(write_msgs_.front().data(), write_msgs_.front().length()),
814 [
this](boost::system::error_code ec, std::size_t ) {
817 write_msgs_.pop_front();
818 if (!write_msgs_.empty())
830 b_io_context& io_context_;
831 boost::asio::ip::tcp::socket socket_;
832 Rtcm_Message read_msg_;
833 std::deque<Rtcm_Message> write_msgs_;
842 boost::asio::ip::tcp::resolver resolver(io_context);
843 std::string host(
"localhost");
844 std::string port_str = std::to_string(port);
845 auto queue_endpoint_iterator = resolver.resolve({host.c_str(), port_str.c_str()});
846 c = std::make_shared<Tcp_Internal_Client>(io_context, queue_endpoint_iterator);
849 inline void do_read_queue()
855 queue_->wait_and_pop(message);
856 if (message ==
"Goodbye")
861 const char* char_msg = message.c_str();
862 msg.body_length(message.length());
863 std::memcpy(msg.body(), char_msg, msg.body_length());
870 std::shared_ptr<Tcp_Internal_Client> c;
871 std::shared_ptr<Concurrent_Queue<std::string> >& queue_;
878 Tcp_Server(b_io_context& io_context,
const boost::asio::ip::tcp::endpoint& endpoint)
879 : acceptor_(io_context), socket_(io_context)
881 acceptor_.open(endpoint.protocol());
882 acceptor_.set_option(boost::asio::ip::tcp::acceptor::reuse_address(
true));
883 acceptor_.bind(endpoint);
888 inline void close_server()
895 inline void do_accept()
897 acceptor_.async_accept(socket_, [
this](boost::system::error_code ec) {
902 std::cout <<
"The TCP/IP server of RTCM messages is up and running. Accepting connections ...\n";
903 first_client =
false;
907 std::cout <<
"Starting RTCM TCP/IP server session...\n";
908 boost::system::error_code ec2;
909 boost::asio::ip::tcp::endpoint endpoint = socket_.remote_endpoint(ec2);
913 std::cout <<
"Error getting remote IP address, closing session.\n";
914 LOG(INFO) <<
"Error getting remote IP address";
915 start_session =
false;
919 std::string remote_addr = endpoint.address().to_string();
920 std::cout <<
"Serving client from " << remote_addr <<
'\n';
921 LOG(INFO) <<
"Serving client from " << remote_addr;
926 std::make_shared<Rtcm_Session>(std::move(socket_), room_)->start();
931 std::cout <<
"Error when invoking a RTCM session. " << ec <<
'\n';
933 start_session =
true;
938 boost::asio::ip::tcp::acceptor acceptor_;
939 boost::asio::ip::tcp::socket socket_;
940 Rtcm_Listener_Room room_;
941 bool first_client =
true;
942 bool start_session =
true;
945 b_io_context io_context;
946 std::shared_ptr<Concurrent_Queue<std::string> > rtcm_message_queue;
949 std::list<Rtcm::Tcp_Server> servers;
950 bool server_is_running;
956 std::bitset<8> preamble;
957 std::bitset<6> reserved_field;
958 std::string add_CRC(
const std::string& m)
const;
959 std::string build_message(
const std::string& data)
const;
964 std::bitset<12> DF002;
965 int32_t set_DF002(uint32_t message_number);
967 std::bitset<12> DF003;
968 int32_t set_DF003(uint32_t ref_station_ID);
970 std::bitset<30> DF004;
971 int32_t set_DF004(
double obs_time);
973 std::bitset<1> DF005;
974 int32_t set_DF005(
bool sync_flag);
976 std::bitset<5> DF006;
977 int32_t set_DF006(
const std::map<int32_t, Gnss_Synchro>& observables);
979 std::bitset<1> DF007;
980 int32_t set_DF007(
bool divergence_free_smoothing_indicator);
982 std::bitset<3> DF008;
983 int32_t set_DF008(int16_t smoothing_interval);
985 std::bitset<6> DF009;
989 std::bitset<1> DF010;
990 int32_t set_DF010(
bool code_indicator);
992 std::bitset<24> DF011;
995 std::bitset<20> DF012;
998 std::bitset<7> DF013;
1001 std::bitset<8> DF014;
1004 std::bitset<8> DF015;
1007 std::bitset<14> DF017;
1010 std::bitset<20> DF018;
1013 std::bitset<7> DF019;
1016 std::bitset<8> DF020;
1019 std::bitset<6> DF021;
1020 int32_t set_DF021();
1022 std::bitset<1> DF022;
1023 int32_t set_DF022(
bool gps_indicator);
1025 std::bitset<1> DF023;
1026 int32_t set_DF023(
bool glonass_indicator);
1028 std::bitset<1> DF024;
1029 int32_t set_DF024(
bool galileo_indicator);
1031 std::bitset<38> DF025;
1032 int32_t set_DF025(
double antenna_ECEF_X_m);
1034 std::bitset<38> DF026;
1035 int32_t set_DF026(
double antenna_ECEF_Y_m);
1037 std::bitset<38> DF027;
1038 int32_t set_DF027(
double antenna_ECEF_Z_m);
1040 std::bitset<16> DF028;
1041 int32_t set_DF028(
double height);
1043 std::bitset<8> DF029;
1045 std::bitset<8> DF031;
1046 int32_t set_DF031(uint32_t antenna_setup_id);
1048 std::bitset<8> DF032;
1056 int32_t set_DF034(
double obs_time);
1057 std::bitset<27> DF034;
1059 std::bitset<5> DF035;
1060 int32_t set_DF035(
const std::map<int32_t, Gnss_Synchro>& observables);
1062 std::bitset<1> DF036;
1063 int32_t set_DF036(
bool divergence_free_smoothing_indicator);
1065 std::bitset<3> DF037;
1066 int32_t set_DF037(int16_t smoothing_interval);
1068 std::bitset<6> DF038;
1072 std::bitset<1> DF039;
1073 int32_t set_DF039(
bool code_indicator);
1075 std::bitset<5> DF040;
1076 int32_t set_DF040(int32_t frequency_channel_number);
1079 std::bitset<25> DF041;
1082 std::bitset<20> DF042;
1085 std::bitset<7> DF043;
1088 std::bitset<7> DF044;
1091 std::bitset<8> DF045;
1094 std::bitset<2> DF046;
1095 int32_t set_DF046(uint16_t code_indicator);
1097 std::bitset<14> DF047;
1100 std::bitset<20> DF048;
1103 std::bitset<7> DF049;
1106 std::bitset<8> DF050;
1109 std::bitset<16> DF051;
1110 int32_t set_DF051(
const Gps_Ephemeris& gps_eph,
double obs_time);
1112 std::bitset<17> DF052;
1113 int32_t set_DF052(
const Gps_Ephemeris& gps_eph,
double obs_time);
1116 std::bitset<8> DF071;
1119 std::bitset<10> DF076;
1122 std::bitset<4> DF077;
1125 std::bitset<2> DF078;
1128 std::bitset<14> DF079;
1131 std::bitset<8> DF080;
1134 std::bitset<16> DF081;
1137 std::bitset<8> DF082;
1140 std::bitset<16> DF083;
1143 std::bitset<22> DF084;
1146 std::bitset<10> DF085;
1149 std::bitset<16> DF086;
1152 std::bitset<16> DF087;
1155 std::bitset<32> DF088;
1158 std::bitset<16> DF089;
1161 std::bitset<32> DF090;
1164 std::bitset<16> DF091;
1167 std::bitset<32> DF092;
1170 std::bitset<16> DF093;
1173 std::bitset<16> DF094;
1176 std::bitset<32> DF095;
1179 std::bitset<16> DF096;
1182 std::bitset<32> DF097;
1185 std::bitset<16> DF098;
1188 std::bitset<32> DF099;
1191 std::bitset<24> DF100;
1194 std::bitset<8> DF101;
1197 std::bitset<6> DF102;
1200 std::bitset<1> DF103;
1203 std::bitset<1> DF104;
1204 int32_t set_DF104(uint32_t glonass_gnav_alm_health);
1206 std::bitset<1> DF105;
1207 int32_t set_DF105(uint32_t glonass_gnav_alm_health_ind);
1209 std::bitset<2> DF106;
1212 std::bitset<12> DF107;
1215 std::bitset<1> DF108;
1218 std::bitset<1> DF109;
1221 std::bitset<7> DF110;
1224 std::bitset<24> DF111;
1227 std::bitset<27> DF112;
1230 std::bitset<5> DF113;
1233 std::bitset<24> DF114;
1236 std::bitset<27> DF115;
1239 std::bitset<5> DF116;
1242 std::bitset<24> DF117;
1245 std::bitset<27> DF118;
1248 std::bitset<5> DF119;
1251 std::bitset<1> DF120;
1254 std::bitset<11> DF121;
1257 std::bitset<2> DF122;
1260 std::bitset<1> DF123;
1263 std::bitset<22> DF124;
1266 std::bitset<5> DF125;
1269 std::bitset<5> DF126;
1272 std::bitset<1> DF127;
1275 std::bitset<4> DF128;
1278 std::bitset<11> DF129;
1281 std::bitset<2> DF130;
1284 std::bitset<1> DF131;
1285 int32_t set_DF131(uint32_t fifth_str_additional_data_ind);
1287 std::bitset<11> DF132;
1290 std::bitset<32> DF133;
1293 std::bitset<5> DF134;
1296 std::bitset<22> DF135;
1299 std::bitset<1> DF136;
1302 std::bitset<1> DF137;
1306 std::bitset<1> DF141;
1309 std::bitset<1> DF142;
1312 std::bitset<30> DF248;
1313 int32_t set_DF248(
double obs_time);
1316 std::bitset<6> DF252;
1319 std::bitset<12> DF289;
1322 std::bitset<10> DF290;
1325 std::bitset<8> DF291;
1328 std::bitset<14> DF292;
1331 std::bitset<14> DF293;
1334 std::bitset<6> DF294;
1337 std::bitset<21> DF295;
1340 std::bitset<31> DF296;
1343 std::bitset<16> DF297;
1346 std::bitset<16> DF298;
1349 std::bitset<32> DF299;
1352 std::bitset<16> DF300;
1355 std::bitset<32> DF301;
1358 std::bitset<16> DF302;
1361 std::bitset<32> DF303;
1364 std::bitset<14> DF304;
1367 std::bitset<16> DF305;
1370 std::bitset<32> DF306;
1373 std::bitset<16> DF307;
1376 std::bitset<32> DF308;
1379 std::bitset<16> DF309;
1382 std::bitset<32> DF310;
1385 std::bitset<24> DF311;
1388 std::bitset<10> DF312;
1391 std::bitset<10> DF313;
1394 std::bitset<2> DF314;
1397 std::bitset<1> DF315;
1400 std::bitset<2> DF364;
1403 std::bitset<1> DF393;
1404 int32_t set_DF393(
bool more_messages);
1406 std::bitset<64> DF394;
1407 int32_t set_DF394(
const std::map<int32_t, Gnss_Synchro>& gnss_synchro);
1409 std::bitset<32> DF395;
1410 int32_t set_DF395(
const std::map<int32_t, Gnss_Synchro>& gnss_synchro);
1412 std::string set_DF396(
const std::map<int32_t, Gnss_Synchro>& observables);
1414 std::bitset<8> DF397;
1417 std::bitset<10> DF398;
1420 std::bitset<14> DF399;
1423 std::bitset<15> DF400;
1426 std::bitset<22> DF401;
1429 std::bitset<4> DF402;
1432 std::bitset<6> DF403;
1435 std::bitset<15> DF404;
1438 std::bitset<20> DF405;
1441 std::bitset<24> DF406;
1444 std::bitset<10> DF407;
1447 std::bitset<10> DF408;
1450 std::bitset<3> DF409;
1451 int32_t set_DF409(uint32_t iods);
1453 std::bitset<2> DF411;
1454 int32_t set_DF411(uint32_t clock_steering_indicator);
1456 std::bitset<2> DF412;
1457 int32_t set_DF412(uint32_t external_clock_indicator);
1459 std::bitset<1> DF417;
1460 int32_t set_DF417(
bool using_divergence_free_smoothing);
1462 std::bitset<3> DF418;
1463 int32_t set_DF418(int32_t carrier_smoothing_interval_s);
1465 std::bitset<1> DF420;
uint32_t bin_to_uint(const std::string &s) const
Returns an uint32_t from a string of binary symbols.
This class is a storage and orbital model functions for the GPS SV ephemeris data as described in IS-...
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.
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...
int32_t read_MT1045(const std::string &message, Galileo_Ephemeris &gal_eph)
Verifies and reads messages of type 1045 (Galileo Ephemeris). Returns 1 if anything goes wrong...
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.
int32_t read_MT1019(const std::string &message, Gps_Ephemeris &gps_eph)
Verifies and reads messages of type 1019 (GPS Ephemeris). Returns 1 if anything goes wrong...
std::string bin_to_hex(const std::string &s) const
Returns a string of hexadecimal symbols from a string of binary symbols.
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.
int32_t read_MT1020(const std::string &message, Glonass_Gnav_Ephemeris &glonass_gnav_eph, Glonass_Gnav_Utc_Model &glonass_gnav_utc_model)
Verifies and reads messages of type 1020 (GLONASS Ephemeris).
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.
Interface of the Gnss_Synchro class.