Skip to content

Commit

Permalink
Telecommand status: show mode information (channel FSM state)
Browse files Browse the repository at this point in the history
  • Loading branch information
acebrianjuan committed Sep 1, 2020
1 parent 6a16813 commit 15713fc
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 5 deletions.
2 changes: 2 additions & 0 deletions src/algorithms/channel/adapters/channel.h
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,8 @@ class Channel : public ChannelInterface
inline std::shared_ptr<TrackingInterface> tracking() const { return trk_; }
inline std::shared_ptr<TelemetryDecoderInterface> telemetry() const { return nav_; }

inline uint32_t fsm_state() { return channel_fsm_->state(); }

private:
std::shared_ptr<ChannelFsm> channel_fsm_;
std::shared_ptr<AcquisitionInterface> acq_;
Expand Down
2 changes: 2 additions & 0 deletions src/algorithms/channel/libs/channel_fsm.h
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,8 @@ class ChannelFsm
virtual bool Event_failed_acquisition_repeat();
virtual bool Event_failed_acquisition_no_repeat();

inline uint32_t state() { return state_; }

private:
void start_tracking();
void stop_acquisition();
Expand Down
15 changes: 10 additions & 5 deletions src/core/receiver/tcp_cmd_interface.cc
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,10 @@ TcpCmdInterface::TcpCmdInterface()
map_signal_pretty_name_["L5"] = "L5";
map_signal_pretty_name_["B1"] = "B1I";
map_signal_pretty_name_["B3"] = "B3I";

map_state_name_[0] = "STBY";
map_state_name_[1] = "ACQ";
map_state_name_[2] = "TRK";
}


Expand Down Expand Up @@ -153,21 +157,22 @@ std::string TcpCmdInterface::status(const std::vector<std::string> &commandLine
std::shared_ptr<Channel>
ch_sptr = std::dynamic_pointer_cast<Channel>(channels_sptr_->at(n));

std::string sys = ch_sptr->get_signal().get_satellite().get_system();
std::string sig = map_signal_pretty_name_.at(ch_sptr->get_signal().get_signal_str());
std::string system = ch_sptr->get_signal().get_satellite().get_system();
std::string signal = map_signal_pretty_name_.at(ch_sptr->get_signal().get_signal_str());
uint32_t prn = ch_sptr->get_signal().get_satellite().get_PRN();
std::string state = map_state_name_.at(ch_sptr->fsm_state());

str_stream << std::fixed << std::setprecision(1)
<< "| "
<< std::right << std::setw(3) << n
<< " | "
<< std::left << std::setw(7) << sys
<< std::left << std::setw(7) << system
<< " | "
<< std::left << std::setw(6) << sig
<< std::left << std::setw(6) << signal
<< " | "
<< std::right << std::setw(3) << prn
<< " | "
<< std::left << std::setw(4) << "----"
<< std::left << std::setw(4) << state
<< " | "
<< std::left << std::setw(3) << "---"
<< " | "
Expand Down
1 change: 1 addition & 0 deletions src/core/receiver/tcp_cmd_interface.h
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@ class TcpCmdInterface
std::shared_ptr<std::vector<std::shared_ptr<ChannelInterface>>> channels_sptr_;

std::map<std::string, std::string> map_signal_pretty_name_;
std::map<uint32_t, std::string> map_state_name_;

float rx_latitude_;
float rx_longitude_;
Expand Down

0 comments on commit 15713fc

Please sign in to comment.