-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Adding a task to periodically resets the packet buffers #20
- Loading branch information
Showing
5 changed files
with
94 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -25,7 +25,7 @@ | |
* | ||
* \author Gabriel Mariano Marcelino <[email protected]> | ||
* | ||
* \version 0.6.7 | ||
* \version 0.6.8 | ||
* | ||
* \date 10/09/2017 | ||
* | ||
|
@@ -833,10 +833,13 @@ int FSatGRS::Run(Glib::RefPtr<Gtk::Application> app) | |
system(cmd.c_str()); | ||
|
||
this->LoadConfigs(); | ||
|
||
auto timer_slot = sigc::mem_fun(*this, &FSatGRS::Timer); | ||
auto conn = Glib::signal_timeout().connect(timer_slot, DATA_RECEPTION_SAMPLE_RATE); | ||
|
||
auto timer_slot_buffer_reset = sigc::mem_fun(*this, &FSatGRS::TimerBufferReset); | ||
auto conn_buffer_reset = Glib::signal_timeout().connect(timer_slot_buffer_reset, DATA_RECEPTION_BUFFER_RESET_PERIOD_MS); | ||
|
||
return app->run(*window_fsat_grs); | ||
} | ||
/* | ||
|
@@ -1028,6 +1031,44 @@ bool FSatGRS::Timer() | |
return true; | ||
} | ||
|
||
bool FSatGRS::TimerBufferReset() | ||
{ | ||
if (togglebutton_play_beacon->get_active()) | ||
{ | ||
|
||
// Save bin stream for further analysis | ||
system(string(string("mkdir -p ") + string(FSAT_GRS_OUTPUT_DIR) + string(FSAT_GRS_BINDATA_DIR)).c_str()); | ||
system(string(string("cp -a ") + string(FSAT_GRS_GRC_BEACON_BIN) + string(" ") + string(FSAT_GRS_OUTPUT_DIR) + string(FSAT_GRS_BINDATA_DIR) + string("/BEACON_`date +\"%Y-%m-%d_%H-%M-%S\"`.bin")).c_str()); | ||
|
||
// Deleting the buffer | ||
system("rm -f " FSAT_GRS_GRC_BEACON_BIN); | ||
|
||
// Creating an empty buffer | ||
system("touch " FSAT_GRS_GRC_BEACON_BIN); | ||
|
||
// Reseting the buffer counters | ||
ngham_pkts_beacon->reset(); | ||
} | ||
|
||
if (togglebutton_play_telemetry->get_active()) | ||
{ | ||
// Save bin stream for further analysis | ||
system(string(string("mkdir -p ") + string(FSAT_GRS_OUTPUT_DIR) + string(FSAT_GRS_BINDATA_DIR)).c_str()); | ||
system(string(string("cp -a ") + string(FSAT_GRS_GRC_TELEMETRY_BIN) + string(" ") + string(FSAT_GRS_OUTPUT_DIR) + string(FSAT_GRS_BINDATA_DIR) + string("/DOWNLINK_`date +\"%Y-%m-%d_%H-%M-%S\"`.bin")).c_str()); | ||
|
||
// Deleting the buffer | ||
system("rm -f " FSAT_GRS_GRC_TELEMETRY_BIN); | ||
|
||
// Creating an empty buffer | ||
system("touch " FSAT_GRS_GRC_TELEMETRY_BIN); | ||
|
||
// Reseting the buffer counters | ||
ngham_pkts_telemetry->reset(); | ||
} | ||
|
||
return true; | ||
} | ||
|
||
void FSatGRS::UpdateBeaconDataTab(grs::BeaconData beacon) | ||
{ | ||
// EPS data | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
/* | ||
* fsat-grs.h | ||
* | ||
* Copyright (C) 2017-2019, Federal University of Santa Catarina. | ||
* Copyright (C) 2017-2019, Universidade Federal de Santa Catarina. | ||
* | ||
* This file is part of FloripaSat-GRS. | ||
* | ||
|
@@ -25,7 +25,7 @@ | |
* | ||
* \author Gabriel Mariano Marcelino <[email protected]> | ||
* | ||
* \version 0.5.11 | ||
* \version 0.6.8 | ||
* | ||
* \date 10/09/2017 | ||
* | ||
|
@@ -58,6 +58,7 @@ | |
#define FSAT_PKT_ANA_DEFAULT_UI_FILE_LOCAL "glade/fsat_grs_gui.glade" | ||
|
||
#define DATA_RECEPTION_SAMPLE_RATE 1000 | ||
#define DATA_RECEPTION_BUFFER_RESET_PERIOD_MS (60*60*1000) // 1 hour | ||
|
||
#define FSAT_GRS_RX_BEACON 0 | ||
#define FSAT_GRS_RX_TELEMETRY 1 | ||
|
@@ -532,6 +533,13 @@ class FSatGRS | |
*/ | ||
bool Timer(); | ||
|
||
/** | ||
* \brief Buffer reset task. | ||
* | ||
* \return TRUE/FALSE if the task must continue or not. | ||
*/ | ||
bool TimerBufferReset(); | ||
|
||
/** | ||
* \brief Updates the beacon data tab. | ||
* | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -25,7 +25,7 @@ | |
* | ||
* \author Gabriel Mariano Marcelino <[email protected]> | ||
* | ||
* \version 0.4.9 | ||
* \version 0.6.8 | ||
* | ||
* \date 06/10/2017 | ||
* | ||
|
@@ -195,4 +195,10 @@ string Packets::LogPayload() | |
return string(); | ||
} | ||
|
||
void Packets::reset() | ||
{ | ||
this->prev_fin_byte_counter = 0; | ||
this->fin_byte_counter = 0; | ||
} | ||
|
||
//! \} End of packets group |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
/* | ||
* packets.h | ||
* | ||
* Copyright (C) 2017, Federal University of Santa Catarina. | ||
* Copyright (C) 2017-2019, Universidade Federal de Santa Catarina. | ||
* | ||
* This file is part of FloripaSat-GRS. | ||
* | ||
|
@@ -21,13 +21,11 @@ | |
*/ | ||
|
||
/** | ||
* \file packets.h | ||
* | ||
* \brief Packets class. | ||
* | ||
* \author Gabriel Mariano Marcelino <[email protected]> | ||
* | ||
* \version 1.0-dev | ||
* \version 0.6.8 | ||
* | ||
* \date 06/10/2017 | ||
* | ||
|
@@ -54,94 +52,112 @@ | |
#define PACKETS_SYNC_BYTE_S3_DEFAULT 0x5D | ||
|
||
/** | ||
* \class Packets | ||
* | ||
* \brief | ||
*/ | ||
class Packets: public std::ifstream | ||
{ | ||
protected: | ||
|
||
/** | ||
* \brief | ||
*/ | ||
std::vector<uint8_t> preamble; | ||
|
||
/** | ||
* \brief | ||
*/ | ||
std::vector<uint8_t> sync_bytes; | ||
|
||
/** | ||
* \brief | ||
*/ | ||
bool receive_pkt; | ||
|
||
/** | ||
* \brief | ||
*/ | ||
std::vector<uint8_t> sync_bytes_buffer; | ||
|
||
/** | ||
* \brief | ||
*/ | ||
std::vector<uint8_t> byte_buffer; | ||
|
||
/** | ||
* \brief | ||
*/ | ||
bool make_log; | ||
|
||
/** | ||
* \brief | ||
*/ | ||
Log *log_pkts; | ||
|
||
/** | ||
* \brief | ||
*/ | ||
bool make_data_log; | ||
|
||
/** | ||
* \brief | ||
*/ | ||
Log *log_data_pkts; | ||
|
||
/** | ||
* \brief | ||
*/ | ||
EventLog *event_log; | ||
|
||
/** | ||
* \brief | ||
*/ | ||
PacketData *packet_data; | ||
|
||
/** | ||
* \brief | ||
*/ | ||
ProtocolStatistic *protocol_statistic; | ||
|
||
/** | ||
* \brief | ||
*/ | ||
uint64_t prev_fin_byte_counter; | ||
|
||
/** | ||
* \brief | ||
*/ | ||
uint64_t fin_byte_counter; | ||
|
||
public: | ||
|
||
/** | ||
* \brief | ||
* | ||
* \return None | ||
*/ | ||
Packets(); | ||
|
||
/** | ||
* \brief Class destructor. | ||
* | ||
* \return None | ||
*/ | ||
~Packets(); | ||
|
||
/** | ||
* \brief Variables initialization. | ||
* | ||
* \return None | ||
*/ | ||
void InitPkts(); | ||
|
||
/** | ||
* \brief Sets the preamle value. | ||
* | ||
* \return None | ||
*/ | ||
void SetPreamble(uint8_t byte, uint8_t quant); | ||
|
||
/** | ||
* \brief Sets the sync. word. | ||
* | ||
|
@@ -153,6 +169,7 @@ class Packets: public std::ifstream | |
* \return None | ||
*/ | ||
void SetSyncBytes(uint8_t s0, uint8_t s1, uint8_t s2, uint8_t s3); | ||
|
||
/** | ||
* \brief | ||
* | ||
|
@@ -161,6 +178,7 @@ class Packets: public std::ifstream | |
* \return | ||
*/ | ||
virtual bool ProcessByte(uint8_t b); | ||
|
||
/** | ||
* \brief Search for packets in a binary file. | ||
* | ||
|
@@ -169,12 +187,20 @@ class Packets: public std::ifstream | |
* \return None | ||
*/ | ||
virtual void Search(const char *file); | ||
|
||
/** | ||
* \brief Log the payload of a found packet. | ||
* | ||
* \return The respective log line of the packet payload to the log file. | ||
*/ | ||
std::string LogPayload(); | ||
|
||
/** | ||
* \brief Resets the buffer position. | ||
* | ||
* \return None. | ||
*/ | ||
void reset(); | ||
}; | ||
|
||
#endif // PACKETS_H_ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -25,7 +25,7 @@ | |
* | ||
* \author Gabriel Mariano Marcelino <[email protected]> | ||
* | ||
* \version 0.6.7 | ||
* \version 0.6.8 | ||
* | ||
* \date 13/02/2019 | ||
* | ||
|
@@ -37,7 +37,7 @@ | |
#ifndef VERSION_H_ | ||
#define VERSION_H_ | ||
|
||
#define GRS_SOFTWARE_VERSION "0.6.7" | ||
#define GRS_SOFTWARE_VERSION "0.6.8" | ||
|
||
#endif // VERSION_H_ | ||
|
||
|