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> 49 #if USE_GLOG_AND_GFLAGS 50 #include <glog/logging.h> 52 #include <absl/log/log.h> 61 #if USE_BOOST_ASIO_IO_CONTEXT 62 using b_io_context = boost::asio::io_context;
64 using b_io_context = boost::asio::io_service;
100 explicit Rtcm(uint16_t port = 2101);
106 std::string
print_MT1001(
const Gps_Ephemeris& gps_eph,
double obs_time,
const std::map<int32_t, Gnss_Synchro>& observables, uint16_t station_id);
111 std::string
print_MT1002(
const Gps_Ephemeris& gps_eph,
double obs_time,
const std::map<int32_t, Gnss_Synchro>& observables, uint16_t station_id);
126 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);
131 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);
136 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);
143 std::string
print_MT1008(uint32_t ref_id,
const std::string& antenna_descriptor, uint32_t antenna_setup_id,
const std::string& antenna_serial_number);
242 const std::map<int32_t, Gnss_Synchro>& observables,
244 uint32_t clock_steering_indicator,
245 uint32_t external_clock_indicator,
247 bool divergence_free,
258 const std::map<int32_t, Gnss_Synchro>& observables,
260 uint32_t clock_steering_indicator,
261 uint32_t external_clock_indicator,
263 bool divergence_free,
274 const std::map<int32_t, Gnss_Synchro>& observables,
276 uint32_t clock_steering_indicator,
277 uint32_t external_clock_indicator,
279 bool divergence_free,
290 const std::map<int32_t, Gnss_Synchro>& observables,
292 uint32_t clock_steering_indicator,
293 uint32_t external_clock_indicator,
295 bool divergence_free,
306 const std::map<int32_t, Gnss_Synchro>& observables,
308 uint32_t clock_steering_indicator,
309 uint32_t external_clock_indicator,
311 bool divergence_free,
322 const std::map<int32_t, Gnss_Synchro>& observables,
324 uint32_t clock_steering_indicator,
325 uint32_t external_clock_indicator,
327 bool divergence_free,
338 const std::map<int32_t, Gnss_Synchro>& observables,
340 uint32_t clock_steering_indicator,
341 uint32_t external_clock_indicator,
343 bool divergence_free,
380 std::string
bin_to_hex(
const std::string& s)
const;
381 std::string
hex_to_bin(
const std::string& s)
const;
387 int32_t bin_to_int(
const std::string& s)
const;
389 int32_t bin_to_sint(
const std::string& s)
const;
391 int64_t
hex_to_int(
const std::string& s)
const;
393 bool check_CRC(
const std::string& message)
const;
405 std::bitset<64> get_MT1001_4_header(uint32_t msg_number,
407 const std::map<int32_t, Gnss_Synchro>& observables,
411 bool divergence_free);
418 std::bitset<152> get_MT1005_test();
431 std::bitset<61> get_MT1009_12_header(uint32_t msg_number,
433 const std::map<int32_t, Gnss_Synchro>& observables,
437 bool divergence_free);
484 std::string get_MSM_header(uint32_t msg_number,
486 const std::map<int32_t, Gnss_Synchro>& observables,
488 uint32_t clock_steering_indicator,
489 uint32_t external_clock_indicator,
491 bool divergence_free,
494 std::string get_MSM_1_content_sat_data(
const std::map<int32_t, Gnss_Synchro>& observables);
495 std::string get_MSM_4_content_sat_data(
const std::map<int32_t, Gnss_Synchro>& observables);
496 std::string get_MSM_5_content_sat_data(
const std::map<int32_t, Gnss_Synchro>& observables);
498 std::string get_MSM_1_content_signal_data(
const std::map<int32_t, Gnss_Synchro>& observables);
506 std::string get_IGM01_header(
const Galileo_HAS_data& has_data, uint8_t nsys,
bool ssr_multiple_msg_indicator);
507 std::string get_IGM01_content_sat(
const Galileo_HAS_data& has_data, uint8_t nsys_index);
508 std::string get_IGM02_header(
const Galileo_HAS_data& has_data, uint8_t nsys,
bool ssr_multiple_msg_indicator);
509 std::string get_IGM02_content_sat(
const Galileo_HAS_data& has_data, uint8_t nsys_index);
510 std::string get_IGM03_header(
const Galileo_HAS_data& has_data, uint8_t nsys,
bool ssr_multiple_msg_indicator);
511 std::string get_IGM03_content_sat(
const Galileo_HAS_data& has_data, uint8_t nsys_index);
512 std::string get_IGM05_header(
const Galileo_HAS_data& has_data, uint8_t nsys,
bool ssr_multiple_msg_indicator);
513 std::string get_IGM05_content_sat(
const Galileo_HAS_data& has_data, uint8_t nsys_index);
518 static std::map<std::string, int> galileo_signal_map;
519 static std::map<std::string, int> gps_signal_map;
520 std::vector<std::pair<int32_t, Gnss_Synchro>> sort_by_signal(
const std::vector<std::pair<int32_t, Gnss_Synchro>>& synchro_map)
const;
521 std::vector<std::pair<int32_t, Gnss_Synchro>> sort_by_PRN_mask(
const std::vector<std::pair<int32_t, Gnss_Synchro>>& synchro_map)
const;
522 boost::posix_time::ptime compute_GPS_time(
const Gps_Ephemeris& eph,
double obs_time)
const;
523 boost::posix_time::ptime compute_GPS_time(
const Gps_CNAV_Ephemeris& eph,
double obs_time)
const;
524 boost::posix_time::ptime compute_Galileo_time(
const Galileo_Ephemeris& eph,
double obs_time)
const;
526 boost::posix_time::ptime gps_L1_last_lock_time[64];
527 boost::posix_time::ptime gps_L2_last_lock_time[64];
528 boost::posix_time::ptime gal_E1_last_lock_time[64];
529 boost::posix_time::ptime gal_E5_last_lock_time[64];
530 boost::posix_time::ptime glo_L1_last_lock_time[64];
531 boost::posix_time::ptime glo_L2_last_lock_time[64];
532 uint32_t lock_time_indicator(uint32_t lock_time_period_s);
533 uint32_t msm_lock_time_indicator(uint32_t lock_time_period_s);
534 uint32_t msm_extended_lock_time_indicator(uint32_t lock_time_period_s);
536 uint8_t ssr_update_interval(uint16_t validity_seconds)
const;
546 static const std::size_t header_length = 6;
547 static const std::size_t max_body_length = 1029;
554 const char* data()
const 564 inline std::size_t length()
const 566 return header_length + body_length_;
569 const char* body()
const 571 return data_.data() + header_length;
576 return data_.data() + header_length;
579 std::size_t body_length()
const 584 void body_length(std::size_t new_length)
586 body_length_ = new_length;
587 if (body_length_ > max_body_length)
589 body_length_ = max_body_length;
593 inline bool decode_header()
595 std::string header(data_.data(), header_length);
596 if (header[0] !=
'G' || header[1] !=
'S')
601 auto header2 = header.substr(2);
604 body_length_ = std::stoi(header2);
606 catch (
const std::exception& e)
613 if (body_length_ == 0)
618 if (body_length_ > max_body_length)
626 inline void encode_header()
628 std::stringstream ss;
629 ss <<
"GS" << std::setw(4) << std::max(std::min(static_cast<int>(body_length_), static_cast<int>(max_body_length)), 0);
630 std::string header = ss.str();
631 header.resize(header_length,
' ');
632 std::copy(header.begin(), header.end(), data_.begin());
636 std::array<char, header_length + max_body_length> data_{};
637 std::size_t body_length_;
644 virtual ~RtcmListener() =
default;
645 virtual void deliver(
const Rtcm_Message& msg) = 0;
649 class Rtcm_Listener_Room
652 inline void join(
const std::shared_ptr<RtcmListener>& participant)
654 participants_.insert(participant);
655 for (
const auto& msg : recent_msgs_)
657 participant->deliver(msg);
661 inline void leave(
const std::shared_ptr<RtcmListener>& participant)
663 participants_.erase(participant);
666 inline void deliver(
const Rtcm_Message& msg)
668 recent_msgs_.push_back(msg);
669 while (recent_msgs_.size() > max_recent_msgs)
671 recent_msgs_.pop_front();
674 for (
const auto& participant : participants_)
676 participant->deliver(msg);
681 std::set<std::shared_ptr<RtcmListener>> participants_;
686 std::deque<Rtcm_Message> recent_msgs_;
691 :
public RtcmListener,
692 public std::enable_shared_from_this<Rtcm_Session>
695 Rtcm_Session(boost::asio::ip::tcp::socket socket, Rtcm_Listener_Room& room) : socket_(std::move(socket)), room_(room) {}
698 room_.join(shared_from_this());
699 do_read_message_header();
702 inline void deliver(
const Rtcm_Message& msg)
704 bool write_in_progress = !write_msgs_.empty();
705 write_msgs_.push_back(msg);
706 if (!write_in_progress)
713 inline void do_read_message_header()
715 auto self(shared_from_this());
716 boost::asio::async_read(socket_,
717 boost::asio::buffer(read_msg_.data(), Rtcm_Message::header_length),
718 [
this,
self](boost::system::error_code ec, std::size_t ) {
719 if (!ec and read_msg_.decode_header())
721 do_read_message_body();
723 else if (!ec and !read_msg_.decode_header())
725 client_says += read_msg_.data();
727 while (client_says.length() >= 80)
731 DLOG(INFO) <<
"Client says:";
734 DLOG(INFO) << client_says;
735 client_says = client_says.substr(80, client_says.length() - 80);
737 do_read_message_header();
741 std::cout <<
"Closing connection with RTCM client\n";
742 room_.leave(shared_from_this());
747 inline void do_read_message_body()
749 auto self(shared_from_this());
750 boost::asio::async_read(socket_,
751 boost::asio::buffer(read_msg_.body(), read_msg_.body_length()),
752 [
this,
self](boost::system::error_code ec, std::size_t ) {
755 room_.deliver(read_msg_);
759 do_read_message_header();
763 std::cout <<
"Closing connection with RTCM client\n";
764 room_.leave(shared_from_this());
769 inline void do_write()
771 auto self(shared_from_this());
772 boost::asio::async_write(socket_,
773 boost::asio::buffer(write_msgs_.front().body(), write_msgs_.front().body_length()),
774 [
this,
self](boost::system::error_code ec, std::size_t ) {
777 write_msgs_.pop_front();
778 if (!write_msgs_.empty())
785 std::cout <<
"Closing connection with RTCM client\n";
786 room_.leave(shared_from_this());
791 boost::asio::ip::tcp::socket socket_;
792 Rtcm_Listener_Room& room_;
793 Rtcm_Message read_msg_;
794 std::deque<Rtcm_Message> write_msgs_;
795 std::string client_says;
799 class Tcp_Internal_Client
800 :
public std::enable_shared_from_this<Tcp_Internal_Client>
803 Tcp_Internal_Client(b_io_context& io_context,
804 #
if BOOST_ASIO_USE_RESOLVER_ITERATOR
805 boost::asio::ip::tcp::resolver::iterator endpoint_iterator)
806 : io_context_(io_context), socket_(io_context)
808 do_connect(std::move(endpoint_iterator));
811 boost::asio::ip::tcp::resolver::results_type endpoints)
812 : io_context_(io_context), socket_(io_context)
814 do_connect(std::move(endpoints));
820 #if BOOST_ASIO_USE_IOCONTEXT_POST 821 io_context_.post([
this]() { socket_.close(); });
823 boost::asio::post(io_context_, [
this]() { socket_.close(); });
827 inline void write(
const Rtcm_Message& msg)
829 #if BOOST_ASIO_USE_IOCONTEXT_POST 833 boost::asio::post(io_context_,
836 bool write_in_progress = !write_msgs_.empty();
837 write_msgs_.push_back(msg);
838 if (!write_in_progress)
846 #if BOOST_ASIO_USE_RESOLVER_ITERATOR 847 inline void do_connect(boost::asio::ip::tcp::resolver::iterator endpoint_iterator)
849 boost::asio::async_connect(socket_, std::move(endpoint_iterator),
850 [
this](boost::system::error_code ec, boost::asio::ip::tcp::resolver::iterator) {
852 inline void do_connect(boost::asio::ip::tcp::resolver::results_type endpoints)
854 boost::asio::async_connect(socket_, std::move(endpoints),
855 [
this](boost::system::error_code ec, boost::asio::ip::tcp::endpoint) {
863 std::cout <<
"Server is down.\n";
868 inline void do_read_message()
870 boost::asio::async_read(socket_,
871 boost::asio::buffer(read_msg_.data(), 1029),
872 [
this](boost::system::error_code ec, std::size_t ) {
879 std::cout <<
"Error in client\n";
885 inline void do_write()
887 boost::asio::async_write(socket_,
888 boost::asio::buffer(write_msgs_.front().data(), write_msgs_.front().length()),
889 [
this](boost::system::error_code ec, std::size_t ) {
892 write_msgs_.pop_front();
893 if (!write_msgs_.empty())
905 b_io_context& io_context_;
906 boost::asio::ip::tcp::socket socket_;
907 Rtcm_Message read_msg_;
908 std::deque<Rtcm_Message> write_msgs_;
917 boost::asio::ip::tcp::resolver resolver(io_context);
918 std::string host(
"localhost");
919 std::string port_str = std::to_string(port);
920 #if BOOST_ASIO_USE_RESOLVER_ITERATOR 921 auto queue_endpoint_iterator = resolver.resolve({host.c_str(), port_str.c_str()});
922 c = std::make_shared<Tcp_Internal_Client>(io_context, queue_endpoint_iterator);
924 auto endpoints = resolver.resolve(host, port_str);
925 c = std::make_shared<Tcp_Internal_Client>(io_context, endpoints);
929 inline void do_read_queue()
935 queue_->wait_and_pop(message);
936 if (message ==
"Goodbye")
941 const char* char_msg = message.c_str();
942 msg.body_length(message.length());
943 std::copy_n(char_msg, msg.body_length(), msg.body());
950 std::shared_ptr<Tcp_Internal_Client> c;
951 std::shared_ptr<Concurrent_Queue<std::string>>& queue_;
958 Tcp_Server(b_io_context& io_context,
const boost::asio::ip::tcp::endpoint& endpoint)
959 : acceptor_(io_context), socket_(io_context)
961 acceptor_.open(endpoint.protocol());
962 acceptor_.set_option(boost::asio::ip::tcp::acceptor::reuse_address(
true));
963 acceptor_.bind(endpoint);
968 inline void close_server()
975 inline void do_accept()
977 acceptor_.async_accept(socket_, [
this](boost::system::error_code ec) {
982 std::cout <<
"The TCP/IP server of RTCM messages is up and running. Accepting connections ...\n";
983 first_client =
false;
987 std::cout <<
"Starting RTCM TCP/IP server session...\n";
988 boost::system::error_code ec2;
989 boost::asio::ip::tcp::endpoint endpoint = socket_.remote_endpoint(ec2);
993 std::cout <<
"Error getting remote IP address, closing session.\n";
994 LOG(INFO) <<
"Error getting remote IP address";
995 start_session =
false;
999 std::string remote_addr = endpoint.address().to_string();
1000 std::cout <<
"Serving client from " << remote_addr <<
'\n';
1001 LOG(INFO) <<
"Serving client from " << remote_addr;
1006 std::make_shared<Rtcm_Session>(std::move(socket_), room_)->start();
1011 std::cout <<
"Error when invoking a RTCM session. " << ec <<
'\n';
1013 start_session =
true;
1018 boost::asio::ip::tcp::acceptor acceptor_;
1019 boost::asio::ip::tcp::socket socket_;
1020 Rtcm_Listener_Room room_;
1021 bool first_client =
true;
1022 bool start_session =
true;
1025 b_io_context io_context;
1026 std::shared_ptr<Concurrent_Queue<std::string>> rtcm_message_queue;
1029 std::list<Rtcm::Tcp_Server> servers;
1030 bool server_is_running;
1031 void stop_service();
1036 std::bitset<8> preamble;
1037 std::bitset<6> reserved_field;
1038 std::string add_CRC(
const std::string& m)
const;
1039 std::string build_message(
const std::string& data)
const;
1044 std::bitset<12> DF002;
1045 int32_t set_DF002(uint32_t message_number);
1047 std::bitset<12> DF003;
1048 int32_t set_DF003(uint32_t ref_station_ID);
1050 std::bitset<30> DF004;
1051 int32_t set_DF004(
double obs_time);
1053 std::bitset<1> DF005;
1054 int32_t set_DF005(
bool sync_flag);
1056 std::bitset<5> DF006;
1057 int32_t set_DF006(
const std::map<int32_t, Gnss_Synchro>& observables);
1059 std::bitset<1> DF007;
1060 int32_t set_DF007(
bool divergence_free_smoothing_indicator);
1062 std::bitset<3> DF008;
1063 int32_t set_DF008(int16_t smoothing_interval);
1065 std::bitset<6> DF009;
1069 std::bitset<1> DF010;
1070 int32_t set_DF010(
bool code_indicator);
1072 std::bitset<24> DF011;
1075 std::bitset<20> DF012;
1078 std::bitset<7> DF013;
1081 std::bitset<8> DF014;
1084 std::bitset<8> DF015;
1087 std::bitset<14> DF017;
1090 std::bitset<20> DF018;
1093 std::bitset<7> DF019;
1096 std::bitset<8> DF020;
1099 std::bitset<6> DF021;
1100 int32_t set_DF021();
1102 std::bitset<1> DF022;
1103 int32_t set_DF022(
bool gps_indicator);
1105 std::bitset<1> DF023;
1106 int32_t set_DF023(
bool glonass_indicator);
1108 std::bitset<1> DF024;
1109 int32_t set_DF024(
bool galileo_indicator);
1111 std::bitset<38> DF025;
1112 int32_t set_DF025(
double antenna_ECEF_X_m);
1114 std::bitset<38> DF026;
1115 int32_t set_DF026(
double antenna_ECEF_Y_m);
1117 std::bitset<38> DF027;
1118 int32_t set_DF027(
double antenna_ECEF_Z_m);
1120 std::bitset<16> DF028;
1121 int32_t set_DF028(
double height);
1123 std::bitset<8> DF029;
1125 std::bitset<8> DF031;
1126 int32_t set_DF031(uint32_t antenna_setup_id);
1128 std::bitset<8> DF032;
1136 int32_t set_DF034(
double obs_time);
1137 std::bitset<27> DF034;
1139 std::bitset<5> DF035;
1140 int32_t set_DF035(
const std::map<int32_t, Gnss_Synchro>& observables);
1142 std::bitset<1> DF036;
1143 int32_t set_DF036(
bool divergence_free_smoothing_indicator);
1145 std::bitset<3> DF037;
1146 int32_t set_DF037(int16_t smoothing_interval);
1148 std::bitset<6> DF038;
1152 std::bitset<1> DF039;
1153 int32_t set_DF039(
bool code_indicator);
1155 std::bitset<5> DF040;
1156 int32_t set_DF040(int32_t frequency_channel_number);
1159 std::bitset<25> DF041;
1162 std::bitset<20> DF042;
1165 std::bitset<7> DF043;
1168 std::bitset<7> DF044;
1171 std::bitset<8> DF045;
1174 std::bitset<2> DF046;
1175 int32_t set_DF046(uint16_t code_indicator);
1177 std::bitset<14> DF047;
1180 std::bitset<20> DF048;
1183 std::bitset<7> DF049;
1186 std::bitset<8> DF050;
1189 std::bitset<16> DF051;
1190 int32_t set_DF051(
const Gps_Ephemeris& gps_eph,
double obs_time);
1192 std::bitset<17> DF052;
1193 int32_t set_DF052(
const Gps_Ephemeris& gps_eph,
double obs_time);
1196 std::bitset<8> DF071;
1199 std::bitset<10> DF076;
1202 std::bitset<4> DF077;
1205 std::bitset<2> DF078;
1208 std::bitset<14> DF079;
1211 std::bitset<8> DF080;
1214 std::bitset<16> DF081;
1217 std::bitset<8> DF082;
1220 std::bitset<16> DF083;
1223 std::bitset<22> DF084;
1226 std::bitset<10> DF085;
1229 std::bitset<16> DF086;
1232 std::bitset<16> DF087;
1235 std::bitset<32> DF088;
1238 std::bitset<16> DF089;
1241 std::bitset<32> DF090;
1244 std::bitset<16> DF091;
1247 std::bitset<32> DF092;
1250 std::bitset<16> DF093;
1253 std::bitset<16> DF094;
1256 std::bitset<32> DF095;
1259 std::bitset<16> DF096;
1262 std::bitset<32> DF097;
1265 std::bitset<16> DF098;
1268 std::bitset<32> DF099;
1271 std::bitset<24> DF100;
1274 std::bitset<8> DF101;
1277 std::bitset<6> DF102;
1280 std::bitset<1> DF103;
1283 std::bitset<1> DF104;
1284 int32_t set_DF104(uint32_t glonass_gnav_alm_health);
1286 std::bitset<1> DF105;
1287 int32_t set_DF105(uint32_t glonass_gnav_alm_health_ind);
1289 std::bitset<2> DF106;
1292 std::bitset<12> DF107;
1295 std::bitset<1> DF108;
1298 std::bitset<1> DF109;
1301 std::bitset<7> DF110;
1304 std::bitset<24> DF111;
1307 std::bitset<27> DF112;
1310 std::bitset<5> DF113;
1313 std::bitset<24> DF114;
1316 std::bitset<27> DF115;
1319 std::bitset<5> DF116;
1322 std::bitset<24> DF117;
1325 std::bitset<27> DF118;
1328 std::bitset<5> DF119;
1331 std::bitset<1> DF120;
1334 std::bitset<11> DF121;
1337 std::bitset<2> DF122;
1340 std::bitset<1> DF123;
1343 std::bitset<22> DF124;
1346 std::bitset<5> DF125;
1349 std::bitset<5> DF126;
1352 std::bitset<1> DF127;
1355 std::bitset<4> DF128;
1358 std::bitset<11> DF129;
1361 std::bitset<2> DF130;
1364 std::bitset<1> DF131;
1365 int32_t set_DF131(uint32_t fifth_str_additional_data_ind);
1367 std::bitset<11> DF132;
1370 std::bitset<32> DF133;
1373 std::bitset<5> DF134;
1376 std::bitset<22> DF135;
1379 std::bitset<1> DF136;
1382 std::bitset<1> DF137;
1386 std::bitset<1> DF141;
1389 std::bitset<1> DF142;
1392 std::bitset<30> DF248;
1393 int32_t set_DF248(
double obs_time);
1396 std::bitset<6> DF252;
1399 std::bitset<12> DF289;
1402 std::bitset<10> DF290;
1405 std::bitset<8> DF291;
1408 std::bitset<14> DF292;
1411 std::bitset<14> DF293;
1414 std::bitset<6> DF294;
1417 std::bitset<21> DF295;
1420 std::bitset<31> DF296;
1423 std::bitset<16> DF297;
1426 std::bitset<16> DF298;
1429 std::bitset<32> DF299;
1432 std::bitset<16> DF300;
1435 std::bitset<32> DF301;
1438 std::bitset<16> DF302;
1441 std::bitset<32> DF303;
1444 std::bitset<14> DF304;
1447 std::bitset<16> DF305;
1450 std::bitset<32> DF306;
1453 std::bitset<16> DF307;
1456 std::bitset<32> DF308;
1459 std::bitset<16> DF309;
1462 std::bitset<32> DF310;
1465 std::bitset<24> DF311;
1468 std::bitset<10> DF312;
1471 std::bitset<10> DF313;
1474 std::bitset<2> DF314;
1477 std::bitset<1> DF315;
1480 std::bitset<2> DF364;
1483 std::bitset<1> DF393;
1484 int32_t set_DF393(
bool more_messages);
1486 std::bitset<64> DF394;
1487 int32_t set_DF394(
const std::map<int32_t, Gnss_Synchro>& gnss_synchro);
1489 std::bitset<32> DF395;
1490 int32_t set_DF395(
const std::map<int32_t, Gnss_Synchro>& gnss_synchro);
1492 std::string set_DF396(
const std::map<int32_t, Gnss_Synchro>& observables);
1494 std::bitset<8> DF397;
1497 std::bitset<10> DF398;
1500 std::bitset<14> DF399;
1503 std::bitset<15> DF400;
1506 std::bitset<22> DF401;
1509 std::bitset<4> DF402;
1512 std::bitset<6> DF403;
1515 std::bitset<15> DF404;
1518 std::bitset<20> DF405;
1521 std::bitset<24> DF406;
1524 std::bitset<10> DF407;
1527 std::bitset<10> DF408;
1530 std::bitset<3> DF409;
1531 int32_t set_DF409(uint32_t iods);
1533 std::bitset<2> DF411;
1534 int32_t set_DF411(uint32_t clock_steering_indicator);
1536 std::bitset<2> DF412;
1537 int32_t set_DF412(uint32_t external_clock_indicator);
1539 std::bitset<1> DF417;
1540 int32_t set_DF417(
bool using_divergence_free_smoothing);
1542 std::bitset<3> DF418;
1543 int32_t set_DF418(int32_t carrier_smoothing_interval_s);
1545 std::bitset<1> DF420;
1550 std::bitset<3> IDF001;
1551 void set_IDF001(uint8_t version);
1553 std::bitset<8> IDF002;
1554 void set_IDF002(uint8_t igs_message_number);
1556 std::bitset<20> IDF003;
1557 void set_IDF003(uint32_t tow);
1559 std::bitset<4> IDF004;
1560 void set_IDF004(uint8_t ssr_update_interval);
1562 std::bitset<1> IDF005;
1563 void set_IDF005(
bool ssr_multiple_message_indicator);
1565 std::bitset<1> IDF006;
1566 void set_IDF006(
bool regional_indicator);
1568 std::bitset<4> IDF007;
1569 void set_IDF007(uint8_t ssr_iod);
1571 std::bitset<16> IDF008;
1572 void set_IDF008(uint16_t ssr_provider_id);
1574 std::bitset<4> IDF009;
1575 void set_IDF009(uint8_t ssr_solution_id);
1577 std::bitset<6> IDF010;
1578 void set_IDF010(uint8_t num_satellites);
1580 std::bitset<6> IDF011;
1581 void set_IDF011(uint8_t gnss_satellite_id);
1583 std::bitset<8> IDF012;
1584 void set_IDF012(uint8_t gnss_iod);
1586 std::bitset<22> IDF013;
1587 void set_IDF013(
float delta_orbit_radial_m);
1589 std::bitset<20> IDF014;
1590 void set_IDF014(
float delta_orbit_in_track_m);
1592 std::bitset<20> IDF015;
1593 void set_IDF015(
float delta_orbit_cross_track_m);
1595 std::bitset<21> IDF016;
1596 void set_IDF016(
float dot_orbit_delta_track_m_s);
1598 std::bitset<19> IDF017;
1599 void set_IDF017(
float dot_orbit_delta_in_track_m_s);
1601 std::bitset<19> IDF018;
1602 void set_IDF018(
float dot_orbit_delta_cross_track_m_s);
1604 std::bitset<22> IDF019;
1605 void set_IDF019(
float delta_clock_c0_m);
1607 std::bitset<21> IDF020;
1608 void set_IDF020(
float delta_clock_c1_m_s);
1610 std::bitset<27> IDF021;
1611 void set_IDF021(
float delta_clock_c2_m_s2);
1613 std::bitset<5> IDF023;
1614 void set_IDF023(uint8_t num_bias_processed);
1616 std::bitset<5> IDF024;
1617 void set_IDF024(uint8_t gnss_signal_tracking_mode_id);
1619 std::bitset<14> IDF025;
1620 void set_IDF025(
float code_bias_m);
1626 #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.