mirror of https://github.com/PentHertz/srsLTE.git
add console message when prenting metrics in RRC_IDLE
This commit is contained in:
parent
0636aa289c
commit
f92728ad6e
|
@ -48,6 +48,7 @@ public:
|
|||
|
||||
void toggle_print(bool b);
|
||||
void set_metrics(ue_metrics_t &m, float report_period_secs);
|
||||
void set_ue_handle(ue_metrics_interface *ue_);
|
||||
|
||||
private:
|
||||
std::string float_to_string(float f, int digits);
|
||||
|
@ -56,6 +57,7 @@ private:
|
|||
|
||||
bool do_print;
|
||||
uint8_t n_reports;
|
||||
ue_metrics_interface* ue;
|
||||
};
|
||||
|
||||
} // namespace srsue
|
||||
|
|
|
@ -57,6 +57,7 @@ class ue_metrics_interface : public srslte::metrics_interface<ue_metrics_t>
|
|||
{
|
||||
public:
|
||||
virtual bool get_metrics(ue_metrics_t &m) = 0;
|
||||
virtual bool is_attached() = 0;
|
||||
};
|
||||
|
||||
} // namespace srsue
|
||||
|
|
|
@ -366,6 +366,7 @@ int main(int argc, char *argv[])
|
|||
|
||||
metricshub.init(ue, args.expert.metrics_period_secs);
|
||||
metricshub.add_listener(&metrics_screen);
|
||||
metrics_screen.set_ue_handle(ue);
|
||||
|
||||
pthread_t input;
|
||||
pthread_create(&input, NULL, &input_loop, &args);
|
||||
|
|
|
@ -50,9 +50,15 @@ char const * const prefixes[2][9] =
|
|||
metrics_stdout::metrics_stdout()
|
||||
:do_print(false)
|
||||
,n_reports(10)
|
||||
,ue(NULL)
|
||||
{
|
||||
}
|
||||
|
||||
void metrics_stdout::set_ue_handle(ue_metrics_interface *ue_)
|
||||
{
|
||||
ue = ue_;
|
||||
}
|
||||
|
||||
void metrics_stdout::toggle_print(bool b)
|
||||
{
|
||||
do_print = b;
|
||||
|
@ -61,9 +67,14 @@ void metrics_stdout::toggle_print(bool b)
|
|||
|
||||
void metrics_stdout::set_metrics(ue_metrics_t &metrics, float metrics_report_period)
|
||||
{
|
||||
if(!do_print)
|
||||
if(!do_print || ue == NULL)
|
||||
return;
|
||||
|
||||
if (!ue->is_attached()) {
|
||||
cout << "--- disconnected ---" << endl;
|
||||
return;
|
||||
}
|
||||
|
||||
if(++n_reports > 10)
|
||||
{
|
||||
n_reports = 0;
|
||||
|
|
|
@ -247,7 +247,7 @@ void ue::stop()
|
|||
|
||||
bool ue::is_attached()
|
||||
{
|
||||
return (EMM_STATE_REGISTERED == nas.get_state());
|
||||
return (RRC_STATE_CONNECTED == rrc.get_state());
|
||||
}
|
||||
|
||||
void ue::start_plot() {
|
||||
|
|
Loading…
Reference in New Issue