mirror of
https://github.com/gnss-sdr/gnss-sdr
synced 2024-12-15 04:30:33 +00:00
Merge branch 'next' of https://github.com/gnss-sdr/gnss-sdr into next
This commit is contained in:
commit
dda9a945df
@ -39,7 +39,7 @@ GNSS-SDR.SUPL_gps_ephemeris_port=7275
|
||||
GNSS-SDR.SUPL_gps_acquisition_server=supl.google.com
|
||||
GNSS-SDR.SUPL_gps_acquisition_port=7275
|
||||
GNSS-SDR.SUPL_MCC=217
|
||||
GNSS-SDR.SUPL_MNS=7
|
||||
GNSS-SDR.SUPL_MNC=7
|
||||
GNSS-SDR.SUPL_LAC=861
|
||||
GNSS-SDR.SUPL_CI=40184
|
||||
|
||||
|
@ -23,7 +23,7 @@ GNSS-SDR.SUPL_gps_ephemeris_port=7275
|
||||
GNSS-SDR.SUPL_gps_acquisition_server=supl.google.com
|
||||
GNSS-SDR.SUPL_gps_acquisition_port=7275
|
||||
GNSS-SDR.SUPL_MCC=244
|
||||
GNSS-SDR.SUPL_MNS=5
|
||||
GNSS-SDR.SUPL_MNC=5
|
||||
GNSS-SDR.SUPL_LAC=0x59e2
|
||||
GNSS-SDR.SUPL_CI=0x31b0
|
||||
|
||||
|
@ -24,7 +24,7 @@ GNSS-SDR.SUPL_gps_ephemeris_port=7275
|
||||
GNSS-SDR.SUPL_gps_acquisition_server=supl.google.com
|
||||
GNSS-SDR.SUPL_gps_acquisition_port=7275
|
||||
GNSS-SDR.SUPL_MCC=244
|
||||
GNSS-SDR.SUPL_MNS=5
|
||||
GNSS-SDR.SUPL_MNC=5
|
||||
GNSS-SDR.SUPL_LAC=0x59e2
|
||||
GNSS-SDR.SUPL_CI=0x31b0
|
||||
|
||||
|
@ -23,7 +23,7 @@ GNSS-SDR.SUPL_gps_ephemeris_port=7275
|
||||
GNSS-SDR.SUPL_gps_acquisition_server=supl.google.com
|
||||
GNSS-SDR.SUPL_gps_acquisition_port=7275
|
||||
GNSS-SDR.SUPL_MCC=244
|
||||
GNSS-SDR.SUPL_MNS=5
|
||||
GNSS-SDR.SUPL_MNC=5
|
||||
GNSS-SDR.SUPL_LAC=0x59e2
|
||||
GNSS-SDR.SUPL_CI=0x31b0
|
||||
|
||||
|
@ -21,7 +21,7 @@ GNSS-SDR.SUPL_gps_ephemeris_port=7275
|
||||
GNSS-SDR.SUPL_gps_acquisition_server=supl.google.com
|
||||
GNSS-SDR.SUPL_gps_acquisition_port=7275
|
||||
GNSS-SDR.SUPL_MCC=244
|
||||
GNSS-SDR.SUPL_MNS=5
|
||||
GNSS-SDR.SUPL_MNC=5
|
||||
GNSS-SDR.SUPL_LAC=0x59e2
|
||||
GNSS-SDR.SUPL_CI=0x31b0
|
||||
|
||||
|
@ -25,7 +25,7 @@ GNSS-SDR.SUPL_gps_ephemeris_port=7275
|
||||
GNSS-SDR.SUPL_gps_acquisition_server=supl.google.com
|
||||
GNSS-SDR.SUPL_gps_acquisition_port=7275
|
||||
GNSS-SDR.SUPL_MCC=244
|
||||
GNSS-SDR.SUPL_MNS=5
|
||||
GNSS-SDR.SUPL_MNC=5
|
||||
GNSS-SDR.SUPL_LAC=0x59e2
|
||||
GNSS-SDR.SUPL_CI=0x31b0
|
||||
|
||||
|
@ -25,7 +25,7 @@ GNSS-SDR.SUPL_gps_ephemeris_port=7275
|
||||
GNSS-SDR.SUPL_gps_acquisition_server=supl.google.com
|
||||
GNSS-SDR.SUPL_gps_acquisition_port=7275
|
||||
GNSS-SDR.SUPL_MCC=244
|
||||
GNSS-SDR.SUPL_MNS=5
|
||||
GNSS-SDR.SUPL_MNC=5
|
||||
GNSS-SDR.SUPL_LAC=0x59e2
|
||||
GNSS-SDR.SUPL_CI=0x31b0
|
||||
|
||||
|
@ -24,7 +24,7 @@ GNSS-SDR.SUPL_gps_ephemeris_port=7275
|
||||
GNSS-SDR.SUPL_gps_acquisition_server=supl.google.com
|
||||
GNSS-SDR.SUPL_gps_acquisition_port=7275
|
||||
GNSS-SDR.SUPL_MCC=244
|
||||
GNSS-SDR.SUPL_MNS=5
|
||||
GNSS-SDR.SUPL_MNC=5
|
||||
GNSS-SDR.SUPL_LAC=0x59e2
|
||||
GNSS-SDR.SUPL_CI=0x31b0
|
||||
|
||||
|
@ -22,7 +22,7 @@ GNSS-SDR.SUPL_gps_ephemeris_port=7275
|
||||
GNSS-SDR.SUPL_gps_acquisition_server=supl.google.com
|
||||
GNSS-SDR.SUPL_gps_acquisition_port=7275
|
||||
GNSS-SDR.SUPL_MCC=244
|
||||
GNSS-SDR.SUPL_MNS=5
|
||||
GNSS-SDR.SUPL_MNC=5
|
||||
GNSS-SDR.SUPL_LAC=0x59e2
|
||||
GNSS-SDR.SUPL_CI=0x31b0
|
||||
|
||||
|
@ -24,7 +24,7 @@ GNSS-SDR.SUPL_gps_ephemeris_port=7275
|
||||
GNSS-SDR.SUPL_gps_acquisition_server=supl.google.com
|
||||
GNSS-SDR.SUPL_gps_acquisition_port=7275
|
||||
GNSS-SDR.SUPL_MCC=244
|
||||
GNSS-SDR.SUPL_MNS=5_1C
|
||||
GNSS-SDR.SUPL_MNC=5
|
||||
GNSS-SDR.SUPL_LAC=0x59e2
|
||||
GNSS-SDR.SUPL_CI=0x31b0
|
||||
|
||||
|
@ -24,7 +24,7 @@ GNSS-SDR.SUPL_gps_ephemeris_port=7275
|
||||
GNSS-SDR.SUPL_gps_acquisition_server=supl.google.com
|
||||
GNSS-SDR.SUPL_gps_acquisition_port=7275
|
||||
GNSS-SDR.SUPL_MCC=244
|
||||
GNSS-SDR.SUPL_MNS=5
|
||||
GNSS-SDR.SUPL_MNC=5
|
||||
GNSS-SDR.SUPL_LAC=0x59e2
|
||||
GNSS-SDR.SUPL_CI=0x31b0
|
||||
|
||||
|
@ -22,7 +22,7 @@ GNSS-SDR.SUPL_gps_ephemeris_port=7275
|
||||
GNSS-SDR.SUPL_gps_acquisition_server=supl.google.com
|
||||
GNSS-SDR.SUPL_gps_acquisition_port=7275
|
||||
GNSS-SDR.SUPL_MCC=244
|
||||
GNSS-SDR.SUPL_MNS=5
|
||||
GNSS-SDR.SUPL_MNC=5
|
||||
GNSS-SDR.SUPL_LAC=0x59e2
|
||||
GNSS-SDR.SUPL_CI=0x31b0
|
||||
|
||||
|
@ -23,7 +23,7 @@ GNSS-SDR.SUPL_gps_ephemeris_port=7275
|
||||
GNSS-SDR.SUPL_gps_acquisition_server=supl.google.com
|
||||
GNSS-SDR.SUPL_gps_acquisition_port=7275
|
||||
GNSS-SDR.SUPL_MCC=244
|
||||
GNSS-SDR.SUPL_MNS=5
|
||||
GNSS-SDR.SUPL_MNC=5
|
||||
GNSS-SDR.SUPL_LAC=0x59e2
|
||||
GNSS-SDR.SUPL_CI=0x31b0
|
||||
|
||||
|
@ -23,7 +23,7 @@ GNSS-SDR.SUPL_gps_ephemeris_port=7275
|
||||
GNSS-SDR.SUPL_gps_acquisition_server=supl.google.com
|
||||
GNSS-SDR.SUPL_gps_acquisition_port=7275
|
||||
GNSS-SDR.SUPL_MCC=244
|
||||
GNSS-SDR.SUPL_MNS=5
|
||||
GNSS-SDR.SUPL_MNC=5
|
||||
GNSS-SDR.SUPL_LAC=0x59e2
|
||||
GNSS-SDR.SUPL_CI=0x31b0
|
||||
|
||||
|
@ -22,7 +22,7 @@ GNSS-SDR.internal_fs_sps=32000000
|
||||
;GNSS-SDR.SUPL_gps_acquisition_server=supl.google.com
|
||||
;GNSS-SDR.SUPL_gps_acquisition_port=7275
|
||||
;GNSS-SDR.SUPL_MCC=244
|
||||
;GNSS-SDR.SUPL_MNS=5
|
||||
;GNSS-SDR.SUPL_MNC=5
|
||||
;GNSS-SDR.SUPL_LAC=0x59e2
|
||||
;GNSS-SDR.SUPL_CI=0x31b0
|
||||
|
||||
|
@ -21,7 +21,7 @@ GNSS-SDR.internal_fs_sps=50000000
|
||||
;GNSS-SDR.SUPL_gps_acquisition_server=supl.google.com
|
||||
;GNSS-SDR.SUPL_gps_acquisition_port=7275
|
||||
;GNSS-SDR.SUPL_MCC=244
|
||||
;GNSS-SDR.SUPL_MNS=5
|
||||
;GNSS-SDR.SUPL_MNC=5
|
||||
;GNSS-SDR.SUPL_LAC=0x59e2
|
||||
;GNSS-SDR.SUPL_CI=0x31b0
|
||||
|
||||
|
@ -22,7 +22,7 @@ GNSS-SDR.SUPL_gps_ephemeris_port=7275
|
||||
GNSS-SDR.SUPL_gps_acquisition_server=supl.google.com
|
||||
GNSS-SDR.SUPL_gps_acquisition_port=7275
|
||||
GNSS-SDR.SUPL_MCC=244
|
||||
GNSS-SDR.SUPL_MNS=5
|
||||
GNSS-SDR.SUPL_MNC=5
|
||||
GNSS-SDR.SUPL_LAC=0x59e2
|
||||
GNSS-SDR.SUPL_CI=0x31b0
|
||||
|
||||
|
@ -21,7 +21,7 @@ GNSS-SDR.SUPL_gps_ephemeris_port=7275
|
||||
GNSS-SDR.SUPL_gps_acquisition_server=supl.google.com
|
||||
GNSS-SDR.SUPL_gps_acquisition_port=7275
|
||||
GNSS-SDR.SUPL_MCC=244
|
||||
GNSS-SDR.SUPL_MNS=5
|
||||
GNSS-SDR.SUPL_MNC=5
|
||||
GNSS-SDR.SUPL_LAC=0x59e2
|
||||
GNSS-SDR.SUPL_CI=0x31b0
|
||||
|
||||
|
@ -22,7 +22,7 @@ GNSS-SDR.SUPL_gps_ephemeris_port=7275
|
||||
GNSS-SDR.SUPL_gps_acquisition_server=supl.google.com
|
||||
GNSS-SDR.SUPL_gps_acquisition_port=7275
|
||||
GNSS-SDR.SUPL_MCC=244
|
||||
GNSS-SDR.SUPL_MNS=5
|
||||
GNSS-SDR.SUPL_MNC=5
|
||||
GNSS-SDR.SUPL_LAC=0x59e2
|
||||
GNSS-SDR.SUPL_CI=0x31b0
|
||||
|
||||
|
@ -22,7 +22,7 @@ GNSS-SDR.SUPL_gps_ephemeris_port=7275
|
||||
GNSS-SDR.SUPL_gps_acquisition_server=supl.google.com
|
||||
GNSS-SDR.SUPL_gps_acquisition_port=7275
|
||||
GNSS-SDR.SUPL_MCC=244
|
||||
GNSS-SDR.SUPL_MNS=5
|
||||
GNSS-SDR.SUPL_MNC=5
|
||||
GNSS-SDR.SUPL_LAC=0x59e2
|
||||
GNSS-SDR.SUPL_CI=0x31b0
|
||||
|
||||
|
@ -22,7 +22,7 @@ GNSS-SDR.SUPL_gps_ephemeris_port=7275
|
||||
GNSS-SDR.SUPL_gps_acquisition_server=supl.google.com
|
||||
GNSS-SDR.SUPL_gps_acquisition_port=7275
|
||||
GNSS-SDR.SUPL_MCC=244
|
||||
GNSS-SDR.SUPL_MNS=5
|
||||
GNSS-SDR.SUPL_MNC=5
|
||||
GNSS-SDR.SUPL_LAC=0x59e2
|
||||
GNSS-SDR.SUPL_CI=0x31b0
|
||||
|
||||
|
@ -22,7 +22,7 @@ GNSS-SDR.SUPL_gps_ephemeris_port=7275
|
||||
GNSS-SDR.SUPL_gps_acquisition_server=supl.google.com
|
||||
GNSS-SDR.SUPL_gps_acquisition_port=7275
|
||||
GNSS-SDR.SUPL_MCC=244
|
||||
GNSS-SDR.SUPL_MNS=5
|
||||
GNSS-SDR.SUPL_MNC=5
|
||||
GNSS-SDR.SUPL_LAC=0x59e2
|
||||
GNSS-SDR.SUPL_CI=0x31b0
|
||||
|
||||
|
@ -22,7 +22,7 @@ GNSS-SDR.SUPL_gps_ephemeris_port=7275
|
||||
GNSS-SDR.SUPL_gps_acquisition_server=supl.google.com
|
||||
GNSS-SDR.SUPL_gps_acquisition_port=7275
|
||||
GNSS-SDR.SUPL_MCC=244
|
||||
GNSS-SDR.SUPL_MNS=5
|
||||
GNSS-SDR.SUPL_MNC=5
|
||||
GNSS-SDR.SUPL_LAC=0x59e2
|
||||
GNSS-SDR.SUPL_CI=0x31b0
|
||||
|
||||
|
@ -22,7 +22,7 @@ GNSS-SDR.SUPL_gps_ephemeris_port=7275
|
||||
GNSS-SDR.SUPL_gps_acquisition_server=supl.google.com
|
||||
GNSS-SDR.SUPL_gps_acquisition_port=7275
|
||||
GNSS-SDR.SUPL_MCC=244
|
||||
GNSS-SDR.SUPL_MNS=5
|
||||
GNSS-SDR.SUPL_MNC=5
|
||||
GNSS-SDR.SUPL_LAC=0x59e2
|
||||
GNSS-SDR.SUPL_CI=0x31b0
|
||||
|
||||
|
@ -22,7 +22,7 @@ GNSS-SDR.SUPL_1C_ephemeris_port=7275
|
||||
GNSS-SDR.SUPL_1C_acquisition_server=supl.google.com
|
||||
GNSS-SDR.SUPL_1C_acquisition_port=7275
|
||||
GNSS-SDR.SUPL_MCC=244
|
||||
GNSS-SDR.SUPL_MNS=5
|
||||
GNSS-SDR.SUPL_MNC=5
|
||||
GNSS-SDR.SUPL_LAC=0x59e2
|
||||
GNSS-SDR.SUPL_CI=0x31b0
|
||||
|
||||
|
@ -22,7 +22,7 @@ GNSS-SDR.SUPL_gps_ephemeris_port=7275
|
||||
GNSS-SDR.SUPL_gps_acquisition_server=supl.google.com
|
||||
GNSS-SDR.SUPL_gps_acquisition_port=7275
|
||||
GNSS-SDR.SUPL_MCC=244
|
||||
GNSS-SDR.SUPL_MNS=5
|
||||
GNSS-SDR.SUPL_MNC=5
|
||||
GNSS-SDR.SUPL_LAC=0x59e2
|
||||
GNSS-SDR.SUPL_CI=0x31b0
|
||||
|
||||
|
@ -22,7 +22,7 @@ GNSS-SDR.SUPL_gps_ephemeris_port=7275
|
||||
GNSS-SDR.SUPL_gps_acquisition_server=supl.google.com
|
||||
GNSS-SDR.SUPL_gps_acquisition_port=7275
|
||||
GNSS-SDR.SUPL_MCC=244
|
||||
GNSS-SDR.SUPL_MNS=5
|
||||
GNSS-SDR.SUPL_MNC=5
|
||||
GNSS-SDR.SUPL_LAC=0x59e2
|
||||
GNSS-SDR.SUPL_CI=0x31b0
|
||||
|
||||
|
@ -22,7 +22,7 @@ GNSS-SDR.SUPL_gps_ephemeris_port=7275
|
||||
GNSS-SDR.SUPL_gps_acquisition_server=supl.google.com
|
||||
GNSS-SDR.SUPL_gps_acquisition_port=7275
|
||||
GNSS-SDR.SUPL_MCC=244
|
||||
GNSS-SDR.SUPL_MNS=5
|
||||
GNSS-SDR.SUPL_MNC=5
|
||||
GNSS-SDR.SUPL_LAC=0x59e2
|
||||
GNSS-SDR.SUPL_CI=0x31b0
|
||||
|
||||
|
@ -80,6 +80,7 @@ ControlThread::ControlThread()
|
||||
configuration_ = std::make_shared<FileConfiguration>(FLAGS_c);
|
||||
}
|
||||
delete_configuration_ = false;
|
||||
restart_ = false;
|
||||
init();
|
||||
}
|
||||
|
||||
@ -115,7 +116,7 @@ void ControlThread::telecommand_listener()
|
||||
* while (flowgraph_->running() && !stop)_{
|
||||
* 3- Read control messages and process them }
|
||||
*/
|
||||
void ControlThread::run()
|
||||
int ControlThread::run()
|
||||
{
|
||||
// Connect the flowgraph
|
||||
try
|
||||
@ -125,7 +126,7 @@ void ControlThread::run()
|
||||
catch (const std::exception &e)
|
||||
{
|
||||
LOG(ERROR) << e.what();
|
||||
return;
|
||||
return 0;
|
||||
}
|
||||
if (flowgraph_->connected())
|
||||
{
|
||||
@ -134,7 +135,7 @@ void ControlThread::run()
|
||||
else
|
||||
{
|
||||
LOG(ERROR) << "Unable to connect flowgraph";
|
||||
return;
|
||||
return 0;
|
||||
}
|
||||
// Start the flowgraph
|
||||
flowgraph_->start();
|
||||
@ -145,7 +146,7 @@ void ControlThread::run()
|
||||
else
|
||||
{
|
||||
LOG(ERROR) << "Unable to start flowgraph";
|
||||
return;
|
||||
return 0;
|
||||
}
|
||||
|
||||
//launch GNSS assistance process AFTER the flowgraph is running because the GNURadio asynchronous queues must be already running to transport msgs
|
||||
@ -189,6 +190,15 @@ void ControlThread::run()
|
||||
#endif
|
||||
|
||||
LOG(INFO) << "Flowgraph stopped";
|
||||
|
||||
if (restart_)
|
||||
{
|
||||
return 42; //signal the gnss-sdr-harness.sh to restart the receiver program
|
||||
}
|
||||
else
|
||||
{
|
||||
return 0; //normal shutdown
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -200,6 +210,7 @@ void ControlThread::set_control_queue(gr::msg_queue::sptr control_queue)
|
||||
return;
|
||||
}
|
||||
control_queue_ = control_queue;
|
||||
cmd_interface_.set_msg_queue(control_queue_);
|
||||
}
|
||||
|
||||
|
||||
@ -413,24 +424,37 @@ void ControlThread::assist_GNSS()
|
||||
supl_client_ephemeris_.server_port = configuration_->property("GNSS-SDR.SUPL_gps_ephemeris_port", 7275);
|
||||
supl_client_acquisition_.server_port = configuration_->property("GNSS-SDR.SUPL_gps_acquisition_port", 7275);
|
||||
supl_mcc = configuration_->property("GNSS-SDR.SUPL_MCC", 244);
|
||||
supl_mns = configuration_->property("GNSS-SDR.SUPL_MNS", 5);
|
||||
supl_mns = configuration_->property("GNSS-SDR.SUPL_MNC ", 5);
|
||||
|
||||
std::string default_lac = "0x59e2";
|
||||
std::string default_ci = "0x31b0";
|
||||
std::string supl_lac_s = configuration_->property("GNSS-SDR.SUPL_LAC", default_lac);
|
||||
std::string supl_ci_s = configuration_->property("GNSS-SDR.SUPL_CI", default_ci);
|
||||
try
|
||||
{
|
||||
supl_lac = boost::lexical_cast<int>(configuration_->property("GNSS-SDR.SUPL_LAC", default_lac));
|
||||
supl_lac = std::stoi(supl_lac_s, nullptr, 0);
|
||||
}
|
||||
catch (boost::bad_lexical_cast &)
|
||||
catch (const std::invalid_argument &ia)
|
||||
{
|
||||
std::cerr << "Invalid argument for SUPL LAC: " << ia.what() << '\n';
|
||||
supl_lac = -1;
|
||||
}
|
||||
try
|
||||
{
|
||||
supl_ci = std::stoi(supl_ci_s, nullptr, 0);
|
||||
}
|
||||
catch (const std::invalid_argument &ia)
|
||||
{
|
||||
std::cerr << "Invalid argument for SUPL CI: " << ia.what() << '\n';
|
||||
supl_ci = -1;
|
||||
}
|
||||
|
||||
if (supl_lac < 0 or supl_lac > 65535)
|
||||
{
|
||||
supl_lac = 0x59e2;
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
supl_ci = boost::lexical_cast<int>(configuration_->property("GNSS-SDR.SUPL_CI", default_ci));
|
||||
}
|
||||
catch (boost::bad_lexical_cast &)
|
||||
if (supl_ci < 0 or supl_ci > 268435455) // 2^16 for GSM and CDMA, 2^28 for UMTS and LTE networks
|
||||
{
|
||||
supl_ci = 0x31b0;
|
||||
}
|
||||
@ -589,6 +613,7 @@ void ControlThread::init()
|
||||
{
|
||||
// Instantiates a control queue, a GNSS flowgraph, and a control message factory
|
||||
control_queue_ = gr::msg_queue::make(0);
|
||||
cmd_interface_.set_msg_queue(control_queue_); //set also the queue pointer for the telecommand thread
|
||||
try
|
||||
{
|
||||
flowgraph_ = std::make_shared<GNSSFlowgraph>(configuration_, control_queue_);
|
||||
@ -655,6 +680,12 @@ void ControlThread::apply_action(unsigned int what)
|
||||
stop_ = true;
|
||||
applied_actions_++;
|
||||
break;
|
||||
case 1:
|
||||
DLOG(INFO) << "Received action RESTART";
|
||||
stop_ = true;
|
||||
restart_ = true;
|
||||
applied_actions_++;
|
||||
break;
|
||||
default:
|
||||
DLOG(INFO) << "Unrecognized action.";
|
||||
break;
|
||||
|
@ -83,7 +83,7 @@ public:
|
||||
*
|
||||
* - Read control messages and process them; }
|
||||
*/
|
||||
void run();
|
||||
int run();
|
||||
|
||||
/*!
|
||||
* \brief Sets the control_queue
|
||||
@ -155,6 +155,7 @@ private:
|
||||
std::shared_ptr<ControlMessageFactory> control_message_factory_;
|
||||
std::shared_ptr<std::vector<std::shared_ptr<ControlMessage>>> control_messages_;
|
||||
bool stop_;
|
||||
bool restart_;
|
||||
bool delete_configuration_;
|
||||
unsigned int processed_control_messages_;
|
||||
unsigned int applied_actions_;
|
||||
|
@ -30,8 +30,27 @@
|
||||
*/
|
||||
|
||||
#include "tcp_cmd_interface.h"
|
||||
#include "control_message_factory.h"
|
||||
#include <functional>
|
||||
|
||||
|
||||
std::string TcpCmdInterface::reset(const std::vector<std::string> &commandLine)
|
||||
{
|
||||
std::string response;
|
||||
std::unique_ptr<ControlMessageFactory> cmf(new ControlMessageFactory());
|
||||
if (control_queue_ != nullptr)
|
||||
{
|
||||
control_queue_->handle(cmf->GetQueueMessage(200, 1)); //send the restart message (who=200,what=1)
|
||||
response = "OK\n";
|
||||
}
|
||||
else
|
||||
{
|
||||
response = "ERROR\n";
|
||||
}
|
||||
|
||||
return response;
|
||||
}
|
||||
|
||||
std::string TcpCmdInterface::stop(const std::vector<std::string> &commandLine)
|
||||
{
|
||||
std::string response;
|
||||
@ -78,21 +97,28 @@ std::string TcpCmdInterface::set_ch_satellite(const std::vector<std::string> &co
|
||||
|
||||
void TcpCmdInterface::register_functions()
|
||||
{
|
||||
functions["status"] = status;
|
||||
functions["stop"] = stop;
|
||||
functions["assistedstart"] = assistedstart;
|
||||
functions["warmstart"] = warmstart;
|
||||
functions["coldstart"] = coldstart;
|
||||
functions["set_ch_satellite"] = set_ch_satellite;
|
||||
functions["status"] = std::bind(&TcpCmdInterface::status, this, std::placeholders::_1);
|
||||
functions["stop"] = std::bind(&TcpCmdInterface::stop, this, std::placeholders::_1);
|
||||
functions["reset"] = std::bind(&TcpCmdInterface::reset, this, std::placeholders::_1);
|
||||
functions["assistedstart"] = std::bind(&TcpCmdInterface::assistedstart, this, std::placeholders::_1);
|
||||
functions["warmstart"] = std::bind(&TcpCmdInterface::warmstart, this, std::placeholders::_1);
|
||||
functions["coldstart"] = std::bind(&TcpCmdInterface::coldstart, this, std::placeholders::_1);
|
||||
functions["set_ch_satellite"] = std::bind(&TcpCmdInterface::set_ch_satellite, this, std::placeholders::_1);
|
||||
}
|
||||
|
||||
|
||||
TcpCmdInterface::TcpCmdInterface()
|
||||
{
|
||||
register_functions();
|
||||
keep_running_ = true;
|
||||
control_queue_ = nullptr;
|
||||
}
|
||||
|
||||
|
||||
void TcpCmdInterface::set_msg_queue(gr::msg_queue::sptr control_queue)
|
||||
{
|
||||
control_queue_ = control_queue;
|
||||
}
|
||||
void TcpCmdInterface::run_cmd_server(int tcp_port)
|
||||
{
|
||||
// Get the port from the parameters
|
||||
@ -106,18 +132,18 @@ void TcpCmdInterface::run_cmd_server(int tcp_port)
|
||||
try
|
||||
{
|
||||
boost::asio::ip::tcp::acceptor acceptor(service, boost::asio::ip::tcp::endpoint(boost::asio::ip::tcp::v4(), port));
|
||||
bool keep_running = true;
|
||||
while (keep_running)
|
||||
|
||||
while (keep_running_)
|
||||
{
|
||||
try
|
||||
{
|
||||
std::cout << "Telecommand TCP interface listening on port " << tcp_port << std::endl;
|
||||
std::cout << "TcpCmdInterface: Telecommand TCP interface listening on port " << tcp_port << std::endl;
|
||||
|
||||
boost::asio::ip::tcp::socket socket(service);
|
||||
acceptor.accept(socket, not_throw);
|
||||
if (not_throw)
|
||||
{
|
||||
std::cerr << "Error when binding the port in the socket" << std::endl;
|
||||
std::cout << "TcpCmdInterface: Error when binding the port in the socket" << std::endl;
|
||||
continue;
|
||||
}
|
||||
|
||||
@ -127,12 +153,10 @@ void TcpCmdInterface::run_cmd_server(int tcp_port)
|
||||
{
|
||||
std::string response;
|
||||
boost::asio::streambuf b;
|
||||
boost::asio::read_until(socket, b, '\n');
|
||||
boost::asio::read_until(socket, b, '\n', error);
|
||||
std::istream is(&b);
|
||||
std::string line;
|
||||
std::getline(is, line);
|
||||
std::cout << "received command: " << line << std::endl;
|
||||
|
||||
std::istringstream iss(line);
|
||||
std::vector<std::string> cmd_vector(std::istream_iterator<std::string>{iss},
|
||||
std::istream_iterator<std::string>());
|
||||
@ -140,9 +164,16 @@ void TcpCmdInterface::run_cmd_server(int tcp_port)
|
||||
if (cmd_vector.size() > 0)
|
||||
{
|
||||
try
|
||||
{
|
||||
if (cmd_vector.at(0).compare("exit") == 0)
|
||||
{
|
||||
error = boost::asio::error::eof;
|
||||
}
|
||||
else
|
||||
{
|
||||
response = functions[cmd_vector.at(0)](cmd_vector);
|
||||
}
|
||||
}
|
||||
catch (const std::exception &ex)
|
||||
{
|
||||
response = "ERROR: command execution error: " + std::string(ex.what()) + "\n";
|
||||
@ -157,19 +188,19 @@ void TcpCmdInterface::run_cmd_server(int tcp_port)
|
||||
socket.write_some(boost::asio::buffer(response), not_throw);
|
||||
if (not_throw)
|
||||
{
|
||||
std::cerr << "Error sending(" << not_throw.value() << "): " << not_throw.message() << std::endl;
|
||||
std::cout << "Error sending(" << not_throw.value() << "): " << not_throw.message() << std::endl;
|
||||
break;
|
||||
}
|
||||
}
|
||||
while (!error); // && error != boost::asio::error::eof);
|
||||
while (error != boost::asio::error::eof);
|
||||
|
||||
if (error == boost::asio::error::eof)
|
||||
{
|
||||
std::cout << "EOF detected\n";
|
||||
std::cout << "TcpCmdInterface: EOF detected\n";
|
||||
}
|
||||
else
|
||||
{
|
||||
std::cout << "error: " << error << std::endl;
|
||||
std::cout << "TcpCmdInterface unexpected error: " << error << std::endl;
|
||||
}
|
||||
|
||||
// Close socket
|
||||
@ -177,11 +208,11 @@ void TcpCmdInterface::run_cmd_server(int tcp_port)
|
||||
}
|
||||
catch (const boost::exception &e)
|
||||
{
|
||||
std::cout << "Boost exception " << std::endl;
|
||||
std::cout << "TcpCmdInterface: Boost exception " << std::endl;
|
||||
}
|
||||
catch (const std::exception &ex)
|
||||
{
|
||||
std::cout << "Exception " << ex.what() << std::endl;
|
||||
std::cout << "TcpCmdInterface: Exception " << ex.what() << std::endl;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -38,7 +38,10 @@
|
||||
#include <unordered_map>
|
||||
#include <algorithm>
|
||||
#include <boost/asio.hpp>
|
||||
#include <glog/logging.h>
|
||||
#include <cstdint>
|
||||
#include <gnuradio/message.h>
|
||||
#include <gnuradio/msg_queue.h>
|
||||
|
||||
|
||||
class TcpCmdInterface
|
||||
@ -47,18 +50,24 @@ public:
|
||||
TcpCmdInterface();
|
||||
virtual ~TcpCmdInterface();
|
||||
void run_cmd_server(int tcp_port);
|
||||
void set_msg_queue(gr::msg_queue::sptr control_queue);
|
||||
|
||||
|
||||
private:
|
||||
std::unordered_map<std::string, std::function<std::string(const std::vector<std::string> &)>>
|
||||
functions;
|
||||
static std::string status(const std::vector<std::string> &commandLine);
|
||||
static std::string stop(const std::vector<std::string> &commandLine);
|
||||
static std::string assistedstart(const std::vector<std::string> &commandLine);
|
||||
static std::string warmstart(const std::vector<std::string> &commandLine);
|
||||
static std::string coldstart(const std::vector<std::string> &commandLine);
|
||||
static std::string set_ch_satellite(const std::vector<std::string> &commandLine);
|
||||
std::string status(const std::vector<std::string> &commandLine);
|
||||
std::string reset(const std::vector<std::string> &commandLine);
|
||||
std::string stop(const std::vector<std::string> &commandLine);
|
||||
std::string assistedstart(const std::vector<std::string> &commandLine);
|
||||
std::string warmstart(const std::vector<std::string> &commandLine);
|
||||
std::string coldstart(const std::vector<std::string> &commandLine);
|
||||
std::string set_ch_satellite(const std::vector<std::string> &commandLine);
|
||||
|
||||
void register_functions();
|
||||
|
||||
gr::msg_queue::sptr control_queue_;
|
||||
bool keep_running_;
|
||||
};
|
||||
|
||||
#endif /* GNSS_SDR_TCPCMDINTERFACE_H_ */
|
||||
|
@ -135,9 +135,10 @@ int main(int argc, char** argv)
|
||||
std::chrono::time_point<std::chrono::system_clock> start, end;
|
||||
start = std::chrono::system_clock::now();
|
||||
|
||||
int return_code;
|
||||
try
|
||||
{
|
||||
control_thread->run();
|
||||
return_code = control_thread->run();
|
||||
}
|
||||
catch (const boost::exception& e)
|
||||
{
|
||||
@ -189,5 +190,5 @@ int main(int argc, char** argv)
|
||||
|
||||
google::ShutDownCommandLineFlags();
|
||||
std::cout << "GNSS-SDR program ended." << std::endl;
|
||||
return 0;
|
||||
return return_code;
|
||||
}
|
||||
|
@ -193,7 +193,7 @@ int PositionSystemTest::configure_receiver()
|
||||
config->set_property("GNSS-SDR.SUPL_gps_acquisition_server", "supl.google.com");
|
||||
config->set_property("GNSS-SDR.SUPL_gps_acquisition_port", std::to_string(7275));
|
||||
config->set_property("GNSS-SDR.SUPL_MCC", std::to_string(244));
|
||||
config->set_property("GNSS-SDR.SUPL_MNS", std::to_string(5));
|
||||
config->set_property("GNSS-SDR.SUPL_MNC", std::to_string(5));
|
||||
config->set_property("GNSS-SDR.SUPL_LAC", "0x59e2");
|
||||
config->set_property("GNSS-SDR.SUPL_CI", "0x31b0");
|
||||
|
||||
|
@ -135,7 +135,7 @@ void TtffTest::config_1()
|
||||
config->set_property("GNSS-SDR.SUPL_gps_acquisition_server", "supl.google.com");
|
||||
config->set_property("GNSS-SDR.SUPL_gps_acquisition_port", std::to_string(7275));
|
||||
config->set_property("GNSS-SDR.SUPL_MCC", std::to_string(244));
|
||||
config->set_property("GNSS-SDR.SUPL_MNS", std::to_string(5));
|
||||
config->set_property("GNSS-SDR.SUPL_MNC", std::to_string(5));
|
||||
config->set_property("GNSS-SDR.SUPL_LAC", "0x59e2");
|
||||
config->set_property("GNSS-SDR.SUPL_CI", "0x31b0");
|
||||
|
||||
|
@ -110,7 +110,7 @@ int FrontEndCal::Get_SUPL_Assist()
|
||||
supl_client_ephemeris_.server_port = configuration_->property("GNSS-SDR.SUPL_gps_ephemeris_port", 7275);
|
||||
supl_client_acquisition_.server_port = configuration_->property("GNSS-SDR.SUPL_gps_acquisition_port", 7275);
|
||||
supl_mcc = configuration_->property("GNSS-SDR.SUPL_MCC", 244);
|
||||
supl_mns = configuration_->property("GNSS-SDR.SUPL_MNS", 5);
|
||||
supl_mns = configuration_->property("GNSS-SDR.SUPL_MNC", 5);
|
||||
|
||||
std::string default_lac = "0x59e2";
|
||||
std::string default_ci = "0x31b0";
|
||||
|
10
src/utils/scripts/gnss-sdr-harness.sh
Executable file
10
src/utils/scripts/gnss-sdr-harness.sh
Executable file
@ -0,0 +1,10 @@
|
||||
#!/bin/sh
|
||||
# GNSS-SDR shell script that enables the remote GNSS-SDR restart telecommand
|
||||
# usage: ./gnss-sdr-harness.sh ./gnss-sdr -c config_file.conf
|
||||
echo $@
|
||||
$@
|
||||
while [ $? -eq 42 ]
|
||||
do
|
||||
echo "restarting GNSS-SDR..."
|
||||
$@
|
||||
done
|
Loading…
Reference in New Issue
Block a user