Commit 646de831 authored by Aurélien Delrieu's avatar Aurélien Delrieu

Always enable attenuation in core src

parent f797a956
......@@ -148,12 +148,6 @@ bool BlockPhysicalLayer::Upward::onInit()
return false;
}
// Check attenuation is enabled
if(!this->isAttenuationEnabled())
{
return true;
}
// Initialize the total CN probe
this->probe_total_cn = Output::registerProbe<float>("Phy.Total_cn", "dB", true, SAMPLE_LAST);
......@@ -260,39 +254,6 @@ bool BlockPhysicalLayer::Upward::onEvent(const RtEvent *const event)
}
bool BlockPhysicalLayer::Upward::forwardPacket(DvbFrame *dvb_frame)
{
// Forward packet
if(this->attenuation_hdl)
{
if(!this->forwardPacketWithAttenuation(dvb_frame))
{
return false;
}
}
else
{
if(!this->forwardPacketWithoutAttenuation(dvb_frame))
{
return false;
}
}
return true;
}
bool BlockPhysicalLayer::Upward::forwardPacketWithoutAttenuation(DvbFrame *dvb_frame)
{
// Send frame to upper layer
if(!this->enqueueMessage((void **)&dvb_frame))
{
LOG(this->log_send, LEVEL_ERROR,
"Failed to send burst of packets to upper layer");
delete dvb_frame;
return false;
}
return true;
}
bool BlockPhysicalLayer::Upward::forwardPacketWithAttenuation(DvbFrame *dvb_frame)
{
if(IS_ATTENUATED_FRAME(dvb_frame->getMessageType()))
{
......@@ -454,18 +415,6 @@ bool BlockPhysicalLayer::Downward::onEvent(const RtEvent *const event)
}
void BlockPhysicalLayer::Downward::preparePacket(DvbFrame *dvb_frame)
{
if(this->isAttenuationEnabled())
{
this->preparePacketWithAttenuation(dvb_frame);
}
else
{
this->preparePacketWithoutAttenuation(dvb_frame);
}
}
void BlockPhysicalLayer::Downward::preparePacketWithAttenuation(DvbFrame *dvb_frame)
{
if(!IS_ATTENUATED_FRAME(dvb_frame->getMessageType()))
{
......@@ -477,11 +426,6 @@ void BlockPhysicalLayer::Downward::preparePacketWithAttenuation(DvbFrame *dvb_fr
dvb_frame->setCn(this->getCurrentCn());
}
void BlockPhysicalLayer::Downward::preparePacketWithoutAttenuation(DvbFrame *UNUSED(dvb_frame))
{
// Nothing to do
}
bool BlockPhysicalLayer::Downward::updateDelay()
{
LOG(this->log_channel, LEVEL_DEBUG,
......
......@@ -84,24 +84,6 @@ class BlockPhysicalLayer: public Block
*/
bool forwardPacket(DvbFrame *dvb_frame);
/**
* @brief Forward the frame to the next channel after attenuation application
*
* @param dvb_frame the DVB frame to forward
*
* @return true on success, false otherwise
*/
bool forwardPacketWithoutAttenuation(DvbFrame *dvb_frame);
/**
* @brief Forward the frame to the next channel
*
* @param dvb_frame the DVB frame to forward
*
* @return true on success, false otherwise
*/
bool forwardPacketWithAttenuation(DvbFrame *dvb_frame);
/**
* @brief Get the C/N fot the current DVB frame
*
......@@ -249,20 +231,6 @@ class BlockPhysicalLayer: public Block
*/
void preparePacket(DvbFrame *dvb_frame);
/**
* @brief Prepare the frame applying attenuation application
*
* @param dvb_frame the DVB frame to forward
*/
void preparePacketWithAttenuation(DvbFrame *dvb_frame);
/**
* @brief Prepare the frame applying no attenuation application
*
* @param dvb_frame the DVB frame to forward
*/
void preparePacketWithoutAttenuation(DvbFrame *UNUSED(dvb_frame));
public:
/**
* @brief Constructor of the ground downward physical channel
......
......@@ -64,39 +64,6 @@ BlockPhysicalLayerSat::Upward::~Upward()
}
bool BlockPhysicalLayerSat::Upward::forwardPacket(DvbFrame *dvb_frame)
{
// Forward packet
if(this->attenuation_hdl)
{
if(!this->forwardPacketWithAttenuation(dvb_frame))
{
return false;
}
}
else
{
if(!this->forwardPacketWithoutAttenuation(dvb_frame))
{
return false;
}
}
return true;
}
bool BlockPhysicalLayerSat::Upward::forwardPacketWithoutAttenuation(DvbFrame *dvb_frame)
{
// Send frame to upper layer
if(!this->enqueueMessage((void **)&dvb_frame))
{
LOG(this->log_send, LEVEL_ERROR,
"Failed to send burst of packets to upper layer");
delete dvb_frame;
return false;
}
return true;
}
bool BlockPhysicalLayerSat::Upward::forwardPacketWithAttenuation(DvbFrame *dvb_frame)
{
if(IS_ATTENUATED_FRAME(dvb_frame->getMessageType()))
{
......@@ -123,32 +90,16 @@ bool BlockPhysicalLayerSat::Upward::forwardPacketWithAttenuation(DvbFrame *dvb_f
bool BlockPhysicalLayerSat::Upward::onInit()
{
bool attenuation_enabled = true;
// Check attenuation activation
if(!Conf::getValue(Conf::section_map[PHYSICAL_LAYER_SECTION],
ENABLE, attenuation_enabled))
// Initialize the attenuation handler
this->attenuation_hdl = new AttenuationHandler(this->log_channel);
if(!this->attenuation_hdl->initialize(SAT_PHYSICAL_LAYER_SECTION,
this->log_init))
{
LOG(log_init, LEVEL_ERROR,
"Unable to check if physical layer is enabled");
LOG(this->log_init, LEVEL_ERROR,
"Unable to initialize Attenuation Handler");
return false;
}
if(!attenuation_enabled)
{
return true;
}
// Initialize the attenuation handler
this->attenuation_hdl = new AttenuationHandler(this->log_channel);
if(!this->attenuation_hdl->initialize(SAT_PHYSICAL_LAYER_SECTION,
this->log_init))
{
LOG(this->log_init, LEVEL_ERROR,
"Unable to initialize Attenuation Handler");
return false;
}
//TODO: set the function pointer to 'forwardPacketWithAttenuation'
return true;
}
......
......@@ -83,24 +83,6 @@ class BlockPhysicalLayerSat: public Block
*/
bool forwardPacket(DvbFrame *dvb_frame);
/**
* @brief Forward the frame to the next channel after attenuation application
*
* @param dvb_frame the DVB frame to forward
*
* @return true on success, false otherwise
*/
bool forwardPacketWithoutAttenuation(DvbFrame *dvb_frame);
/**
* @brief Forward the frame to the next channel
*
* @param dvb_frame the DVB frame to forward
*
* @return true on success, false otherwise
*/
bool forwardPacketWithAttenuation(DvbFrame *dvb_frame);
public:
/**
* @brief Constructor of the ground upward physical channel
......
......@@ -75,7 +75,6 @@ bool GroundPhysicalChannel::initGround(const string &channel_name, RtChannel *ch
{
ostringstream name;
char probe_name[128];
bool attenuation_enabled = false;
vol_pkt_t max_size;
time_ms_t refresh_period_ms;
string attenuation_type;
......@@ -135,19 +134,6 @@ bool GroundPhysicalChannel::initGround(const string &channel_name, RtChannel *ch
"PhysicalLayer.%sward.Event", channel_name.c_str());
this->log_event = Output::registerLog(LEVEL_WARNING, probe_name);
// Check attenuation activation
if(!Conf::getValue(Conf::section_map[PHYSICAL_LAYER_SECTION],
ENABLE, attenuation_enabled))
{
LOG(log_init, LEVEL_ERROR,
"Unable to check if physical layer is enabled");
return false;
}
if(!attenuation_enabled)
{
return true;
}
// Get the refresh period
if(!Conf::getValue(Conf::section_map[PHYSICAL_LAYER_SECTION],
ACM_PERIOD_REFRESH,
......@@ -223,21 +209,10 @@ bool GroundPhysicalChannel::initGround(const string &channel_name, RtChannel *ch
return true;
}
bool GroundPhysicalChannel::isAttenuationEnabled() const
{
return this->attenuation_model != NULL;
}
bool GroundPhysicalChannel::updateAttenuation()
{
LOG(this->log_channel, LEVEL_DEBUG,
"Update attenuation");
if(this->attenuation_model == NULL)
{
LOG(this->log_channel, LEVEL_ERROR,
"Attenuation update impossible: attenuation is disabled");
return false;
}
if(!this->attenuation_model->updateAttenuationModel())
{
......
......@@ -99,13 +99,6 @@ class GroundPhysicalChannel
*/
bool initGround(const string &channel_name, RtChannel *channel, OutputLog *log_init);
/**
* @brief Get the attenuation enabled status
*
* @return true if enabled, false else
*/
bool isAttenuationEnabled() const;
/**
* @brief Update the attenuation
*
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment