summaryrefslogtreecommitdiff
path: root/cesar/maximus/channel/src/ChannelSettings.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'cesar/maximus/channel/src/ChannelSettings.cpp')
-rw-r--r--cesar/maximus/channel/src/ChannelSettings.cpp229
1 files changed, 229 insertions, 0 deletions
diff --git a/cesar/maximus/channel/src/ChannelSettings.cpp b/cesar/maximus/channel/src/ChannelSettings.cpp
new file mode 100644
index 0000000000..1eab9c1798
--- /dev/null
+++ b/cesar/maximus/channel/src/ChannelSettings.cpp
@@ -0,0 +1,229 @@
+/************************************************************************
+ ChannelSettings.cpp - Copyright buret
+
+Here you can write a license for your code, some comments or any other
+information you want to have in your generated code. To to this simply
+configure the "headings" directory in uml to point to a directory
+where you have your heading files.
+
+or you can just replace the contents of this file with your own.
+If you want to do this, this file is located at
+
+/usr/share/apps/umbrello/headings/heading.h
+
+-->Code Generators searches for heading files based on the file extension
+ i.e. it will look for a file name ending in ".h" to include in C++ header
+ files, and for a file name ending in ".java" to include in all generated
+ java code.
+ If you name the file "heading.<extension>", Code Generator will always
+ choose this file even if there are other files with the same extension in the
+ directory. If you name the file something else, it must be the only one with that
+ extension in the directory to guarantee that Code Generator will choose it.
+
+you can use variables in your heading files which are replaced at generation
+time. possible variables are : author, date, time, filename and filepath.
+just write %variable_name%
+
+This file was generated on %date% at %time%
+The original location of this file is /home/buret/eclipse/maximus/channel/src/ChannelSettings.cpp
+**************************************************************************/
+
+#include "ChannelSettings.h"
+
+#include "Error.h"
+#include "Logger.h"
+
+#include "hal/phy/maximus/inc/maximus_defs.h" // for 'MAXIMUS_PHY_FC_RECEPTION_DELAY_TCK'
+
+
+// Constructors/Destructors
+//
+
+
+ChannelSettings::ChannelSettings ( ):
+mIsConfigured(false),
+mPreDetectionDate(0),
+mFcReceptionDate(0)
+{
+ initAttributes();
+}
+
+
+void ChannelSettings::initAttributes ( )
+{
+ logFunction();
+
+ // Init SNR array
+ memset(mSnrArray, '\0', MAXIMUS_CHANNEL_INTERVAL_MAX_NB * (PHY_CARRIER_NB + 1) * sizeof(float));
+
+ // Init tonemap array
+ memset(mTonemapArray, '\0', PHY_CARRIER_NB * sizeof(Channel_Mod));
+}
+
+
+ChannelSettings::~ChannelSettings ( )
+{
+ logFunction();
+}
+
+
+//
+// Methods
+//
+
+
+// Other methods
+//
+
+
+// public methods
+//
+
+
+const Network_Clock_Tick ChannelSettings::getFirstSymbolStartDate ( ) const
+{
+ return getFcReceptionDate() - MAXIMUS_PHY_FC_RECEPTION_DELAY_TCK;
+}
+
+
+const Channel_Mod ChannelSettings::getModulation ( const unsigned int carrier ) const
+{
+ return mTonemapArray[carrier];
+}
+
+
+const float ChannelSettings::getSnr ( const Network_Clock_Tick beacon_period,
+ const Network_Clock_Tick symbol_start_date,
+ const unsigned int carrier ) const
+{
+ return mSnrArray[getInterval(beacon_period, symbol_start_date)][carrier + 1];
+}
+
+
+// private methods
+//
+
+
+bool ChannelSettings::setIsConfigured ( const bool is_configured )
+{
+ logFunction();
+
+ mIsConfigured = is_configured;
+
+ return true;
+}
+
+
+const Network_Clock_Tick ChannelSettings::getPreDetectionDate ( ) const
+{
+ return mPreDetectionDate;
+}
+
+
+const Network_Clock_Tick ChannelSettings::getFcReceptionDate ( ) const
+{
+ return mFcReceptionDate;
+}
+
+
+const unsigned int ChannelSettings::getInterval ( const Network_Clock_Tick beacon_period,
+ const Network_Clock_Tick symbol_start_date ) const
+{
+ unsigned int i;
+
+ for (i=0; i<MAXIMUS_CHANNEL_INTERVAL_MAX_NB; i++)
+ {
+ if ( (symbol_start_date % beacon_period) / 25 < mSnrArray[i][0] )
+ {
+ break;
+ }
+ }
+
+ return i;
+}
+
+
+// protected methods
+//
+
+
+// Accessor methods
+//
+
+
+// public attribute accessor methods
+//
+
+
+// private attribute accessor methods
+//
+
+
+const bool ChannelSettings::isConfigured ( ) const
+{
+ return mIsConfigured;
+}
+
+
+bool ChannelSettings::setSnr ( const float snr_value )
+{
+ logFunction();
+
+ for (int i=0; i<MAXIMUS_CHANNEL_INTERVAL_MAX_NB; i++)
+ {
+ for (int j=0; j<=PHY_CARRIER_NB; j++)
+ {
+ mSnrArray[i][j] = snr_value;
+ }
+ }
+
+ return setIsConfigured();
+}
+
+
+bool ChannelSettings::setSnr ( const float snr_values[MAXIMUS_CHANNEL_INTERVAL_MAX_NB][PHY_CARRIER_NB + 1] )
+{
+ logFunction();
+
+ for (int i=0; i<MAXIMUS_CHANNEL_INTERVAL_MAX_NB; i++)
+ {
+ for (int j=0; j<=PHY_CARRIER_NB; j++)
+ {
+ mSnrArray[i][j] = snr_values[i][j];
+ }
+ }
+
+ return setIsConfigured();
+}
+
+
+bool ChannelSettings::setTonemap ( const Channel_Mod tonemap_array[PHY_CARRIER_NB + 1] )
+{
+ for (int i=0; i<PHY_CARRIER_NB; i++)
+ {
+ mTonemapArray[i] = tonemap_array[i];
+ }
+
+ return true;
+}
+
+
+bool ChannelSettings::setPreDetectionDate ( const Network_Clock_Tick date )
+{
+ mPreDetectionDate = date;
+
+ return true;
+}
+
+
+bool ChannelSettings::setFcReceptionDate ( const Network_Clock_Tick date )
+{
+ mFcReceptionDate = date;
+
+ return true;
+}
+
+
+// protected attribute accessor methods
+//
+