summaryrefslogtreecommitdiff
path: root/cesar/maximus/phy/inc
diff options
context:
space:
mode:
Diffstat (limited to 'cesar/maximus/phy/inc')
-rw-r--r--cesar/maximus/phy/inc/IPhy.h234
-rw-r--r--cesar/maximus/phy/inc/PhyProcessor.h512
-rw-r--r--cesar/maximus/phy/inc/PhyProcessorTest.h74
-rw-r--r--cesar/maximus/phy/inc/PhySciMsg.h524
-rw-r--r--cesar/maximus/phy/inc/PhySciMsgFc.h148
-rw-r--r--cesar/maximus/phy/inc/PhySciMsgFcTest.h42
-rw-r--r--cesar/maximus/phy/inc/PhySciMsgMpdu.h290
-rw-r--r--cesar/maximus/phy/inc/PhySciMsgMpduTest.h48
-rw-r--r--cesar/maximus/phy/inc/PhySciMsgNoise.h87
-rw-r--r--cesar/maximus/phy/inc/PhySciMsgNoiseTest.h38
-rw-r--r--cesar/maximus/phy/inc/PhySciMsgPre.h116
-rw-r--r--cesar/maximus/phy/inc/PhySciMsgPreTest.h38
-rw-r--r--cesar/maximus/phy/inc/PhySciMsgTest.h38
13 files changed, 2189 insertions, 0 deletions
diff --git a/cesar/maximus/phy/inc/IPhy.h b/cesar/maximus/phy/inc/IPhy.h
new file mode 100644
index 0000000000..96e425d2c3
--- /dev/null
+++ b/cesar/maximus/phy/inc/IPhy.h
@@ -0,0 +1,234 @@
+/************************************************************************
+ IPhy.h - 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/common/interfaces/IPhy.h
+**************************************************************************/
+
+#ifndef IPHY_H
+#define IPHY_H
+
+#include "hal_phy_types.h"
+#include "networkclock_types.h" // for 'Network_Clock_Tick'
+
+#include <boost/function.hpp> // for 'PhyMpduCb'
+
+class PhySciMsg;
+class PhySciMsgMpdu;
+class NetworkClockEvt;
+class INetworkClock;
+class IChannel;
+
+typedef boost::function <void (PhySciMsgMpdu &)> PhyMpduCb;
+
+
+/**
+ * class IPhy
+ */
+
+class IPhy
+{
+
+public:
+
+ // Constructors/Destructors
+ //
+
+ /**
+ * Empty Constructor
+ */
+ IPhy ( ) { }
+
+ /**
+ * Empty Destructor
+ */
+ virtual ~IPhy ( ) { }
+
+ // public methods
+ //
+
+ /**
+ * @param interface_cb
+ * Initialize PHY with an interface callback function for PHY SCI message MPDU reception.
+ */
+ virtual bool init ( PhyMpduCb interface_cb ) = 0;
+
+ /**
+ * Initialize PHY with the PLC frequency for PHY SCI message of type ZERO_CROSS.
+ * @param frequency
+ * @return bool
+ */
+ virtual bool init ( const float frequency ) = 0;
+
+ /**
+ * @return PhySciMsg *
+ */
+ virtual PhySciMsg * createMsg ( ) = 0;
+
+ /**
+ * Creates a PHY SCI message MPDU.
+ * @return PhySciMsgMpdu *
+ */
+ virtual PhySciMsgMpdu * createMpdu ( ) = 0;
+
+ /**
+ * Sends a PHY SCI message MPDU.
+ * This message has to be configured before transmission.
+ * @param p_mpdu
+ * @return bool
+ */
+ virtual bool sendMpdu ( PhySciMsgMpdu * p_mpdu ) = 0;
+
+ /**
+ * Sends the PHY SCI message associated to the received Network Clock event.
+ * @param received_evt
+ * @return bool
+ */
+ virtual bool receiveEvt ( NetworkClockEvt & received_evt ) = 0;
+
+ /**
+ * Processes the received PHY SCI message of type NONE or NOISE.
+ * @return bool
+ * @param received_phy_sci_msg
+ */
+ virtual bool receiveInvalid ( PhySciMsg & received_phy_sci_msg ) = 0;
+
+ /**
+ * Processes the received PHY SCI message of type PREAMBLE.
+ * @return bool
+ * @param received_phy_sci_msg
+ */
+ virtual bool receivePre ( PhySciMsg & received_phy_sci_msg ) = 0;
+
+ /**
+ * Processes the received PHY SCI message of type FC_HYBRID_MODE or FC_AV_ONLY_MODE.
+ * @return bool
+ * @param received_phy_sci_msg
+ */
+ virtual bool receiveFc ( PhySciMsg & received_phy_sci_msg ) = 0;
+
+ /**
+ * Processes the received PHY SCI message of type PRS.
+ * @return bool
+ * @param received_phy_sci_msg
+ */
+ virtual bool receivePrs ( PhySciMsg & received_phy_sci_msg ) = 0;
+
+ /**
+ * Processes the received PHY SCI message of type MPDU_PAYLOAD.
+ * @return bool
+ * @param received_phy_sci_msg
+ */
+ virtual bool receiveMpdu ( PhySciMsg & received_phy_sci_msg ) = 0;
+
+ /**
+ * Processes the received PHY SCI message of type TONEMASK.
+ * @return bool
+ * @param received_phy_sci_msg
+ */
+ virtual bool receiveTonemask ( PhySciMsg & received_phy_sci_msg ) = 0;
+
+ /**
+ * Processes the received PHY SCI message of type TONEMAP.
+ * @return bool
+ * @param received_phy_sci_msg
+ */
+ virtual bool receiveTonemap ( PhySciMsg & received_phy_sci_msg ) = 0;
+
+ /**
+ * Processes the received PHY SCI message of type RX.
+ * @return bool
+ * @param received_phy_sci_msg
+ */
+ virtual bool receiveRx ( PhySciMsg & received_phy_sci_msg ) = 0;
+
+ /**
+ * @return bool
+ * @param p_network_clock the new value of mpNetworkClock
+ */
+ virtual bool setNetworkClock ( INetworkClock * p_network_clock ) = 0;
+
+ /**
+ * @return bool
+ * @param p_channel the new value of mpChannel
+ */
+ virtual bool setChannel ( IChannel * p_channel ) = 0;
+
+ /**
+ * Sets the channel perturbation.
+ * @param is_channel_enabled the new value of mIsChannelEnabled
+ */
+ virtual bool setIsChannelEnabled ( const bool is_channel_enabled ) = 0;
+
+ /**
+ * Gets the TX ID.
+ * @return Phy_Tx_Id
+ */
+ virtual const Phy_Tx_Id getTxId ( ) const = 0;
+
+ /**
+ * Gets the tonemask.
+ * @return mpTonemask
+ */
+ virtual const uint8_t * getTonemask ( ) const = 0;
+
+ /**
+ * Check if the channel perturbation is enabled.
+ * @return mIsChannelEnabled
+ */
+ virtual bool isChannelEnabled ( ) const = 0;
+
+ /**
+ * Sets the power line frequency.
+ * @param frequency the new value of mFrequency
+ * @return bool
+ */
+ virtual bool setFrequency ( const float frequency ) = 0;
+
+ /**
+ * Gets the power line frequency.
+ * @return mFrequency
+ */
+ virtual const float getFrequency ( ) const = 0;
+
+ /**
+ * Activate the wrong preambles transmission feature.
+ * @param average_duration average number of ticks 25 MHz between two consecutive wrong preambles
+ * @param std_deviation the standard deviation
+ * @return bool
+ */
+ virtual bool activateFalseAlarm ( const Network_Clock_Tick average_duration, const float std_deviation ) = 0;
+
+ /**
+ * Deactivate the wrong preambles transmission feature.
+ * @return bool
+ */
+ virtual bool deactivateFalseAlarm ( ) = 0;
+
+};
+
+
+#endif // IPHY_H
diff --git a/cesar/maximus/phy/inc/PhyProcessor.h b/cesar/maximus/phy/inc/PhyProcessor.h
new file mode 100644
index 0000000000..aec51fc05f
--- /dev/null
+++ b/cesar/maximus/phy/inc/PhyProcessor.h
@@ -0,0 +1,512 @@
+/************************************************************************
+ PhyProcessor.h - 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/phy/inc/PhyProcessor.h
+**************************************************************************/
+
+#ifndef PHYPROCESSOR_H
+#define PHYPROCESSOR_H
+
+#include "IPhy.h"
+
+#include "phy_types.h"
+
+#include <map> // for 'map' and 'multimap'
+
+class ISci;
+class PhySciMsgNoise;
+class PhySciMsgPre;
+
+struct Expected_Tx
+{
+ Phy_Tx_Id src_tx_id; // expected transmission ID
+ Sci_Msg_Station_Id src_station_id; // expected transmitting station ID
+};
+struct lttx
+{
+ bool operator() ( const Expected_Tx tx1, const Expected_Tx tx2 ) const
+ {
+ if (tx1.src_tx_id != tx2.src_tx_id)
+ {
+ return tx1.src_tx_id < tx2.src_tx_id;
+ }
+ else
+ {
+ return tx1.src_station_id < tx2.src_station_id;
+ }
+ }
+};
+typedef std::multimap<const Expected_Tx, const Sci_Msg_Station_Id, lttx> RxStationsList; // list of destination stations
+struct Frame_Control
+{
+ uint32_t fc_10;
+ uint32_t fc_av[4];
+};
+typedef std::map<const Expected_Tx, Frame_Control, lttx> RxFcList; // list of received Frame Control
+struct Mpdu_Payload
+{
+ unsigned short int msg_nb; // number of PHY SCI messages MPDU that have been received
+ unsigned long data_length;
+ unsigned char * p_data;
+ uint32_t pb_header[MAC_MAX_PB_PER_MPDU];
+};
+typedef std::map<const Expected_Tx, Mpdu_Payload, lttx> RxMpduList; // list of received MPDU
+
+
+/**
+ * class PhyProcessor
+ * Simulates the real HomePlugAV physical interface and data bus.
+ */
+
+class PhyProcessor : public IPhy
+{
+
+public:
+
+ // public attributes
+ //
+
+private:
+
+ // private attributes
+ //
+ ISci * mpSciServer;
+ INetworkClock * mpNetworkClock;
+ IChannel * mpChannel;
+
+ bool mIsChannelEnabled;
+
+ unsigned int mNbOfCarriers;
+ uint8_t * mpTonemask;
+
+ Phy_Tx_Id mTxId; // unique ID incremented for each transmission
+ // (PREAMBLE, FC, MPDU, and NOISE if enabled).
+ RxStationsList mListOfRxStations;
+
+ PhyMpduCb mInterfaceCb;
+ RxFcList mListOfRxFc;
+ RxMpduList mListOfRxMpdu;
+
+ float mFrequency;
+ Network_Clock_Tick mZeroCrossDelay;
+ PhySciMsg * mpZeroCross;
+
+ // For the wrong preambles transmission feature
+ bool mIsFalseAlarmActivated;
+ PhySciMsgPre * mpWrongPre;
+ Network_Clock_Tick mAverageDuration;
+ float mStdDeviation;
+
+protected:
+
+ // protected attributes
+ //
+
+public:
+
+ // Constructors/Destructors
+ //
+
+ /**
+ * Constructor
+ */
+ PhyProcessor ( ISci * p_sci_server );
+
+ /**
+ * Empty Destructor
+ */
+ virtual ~PhyProcessor ( );
+
+ // public methods
+ //
+
+ /**
+ * @param interface_cb
+ * Initialize PHY with an interface callback function for PHY SCI message MPDU reception.
+ */
+ bool init ( PhyMpduCb interface_cb );
+
+ /**
+ * Initialize PHY with the PLC frequency for PHY SCI message of type ZERO_CROSS.
+ * @param frequency
+ * @return bool
+ */
+ bool init ( const float frequency );
+
+ /**
+ * @return PhySciMsg *
+ */
+ PhySciMsg * createMsg ( );
+
+ /**
+ * Creates a PHY SCI message MPDU.
+ * @return PhySciMsgMpdu *
+ */
+ PhySciMsgMpdu * createMpdu ( );
+
+ /**
+ * Sends a PHY SCI message MPDU.
+ * This message has to be configured before transmission.
+ * @param p_mpdu
+ * @return bool
+ */
+ bool sendMpdu ( PhySciMsgMpdu * p_mpdu );
+
+ /**
+ * Sends the PHY SCI message associated to the received Network Clock event.
+ * @return bool
+ * @param received_evt
+ */
+ bool receiveEvt ( NetworkClockEvt & received_evt );
+
+ /**
+ * Processes the received PHY SCI message of type NONE or NOISE.
+ * @return bool
+ * @param received_phy_sci_msg
+ */
+ bool receiveInvalid ( PhySciMsg & received_phy_sci_msg );
+
+ /**
+ * Processes the received PHY SCI message of type PREAMBLE.
+ * @return bool
+ * @param received_phy_sci_msg
+ */
+ bool receivePre ( PhySciMsg & received_phy_sci_msg );
+
+ /**
+ * Processes the received PHY SCI message of type FC_HYBRID_MODE or FC_AV_ONLY_MODE.
+ * @return bool
+ * @param received_phy_sci_msg
+ */
+ bool receiveFc ( PhySciMsg & received_phy_sci_msg );
+
+ /**
+ * Processes the received PHY SCI message of type PRS.
+ * @return bool
+ * @param received_phy_sci_msg
+ */
+ bool receivePrs ( PhySciMsg & received_phy_sci_msg );
+
+ /**
+ * Processes the received PHY SCI message of type MPDU_PAYLOAD.
+ * @return bool
+ * @param received_phy_sci_msg
+ */
+ bool receiveMpdu ( PhySciMsg & received_phy_sci_msg );
+
+ /**
+ * Processes the received PHY SCI message of type TONEMASK.
+ * @return bool
+ * @param received_phy_sci_msg
+ */
+ bool receiveTonemask ( PhySciMsg & received_phy_sci_msg );
+
+ /**
+ * Processes the received PHY SCI message of type TONEMAP.
+ * @return bool
+ * @param received_phy_sci_msg
+ */
+ bool receiveTonemap ( PhySciMsg & received_phy_sci_msg );
+
+ /**
+ * Processes the received PHY SCI message of type RX.
+ * @return bool
+ * @param received_phy_sci_msg
+ */
+ bool receiveRx ( PhySciMsg & received_phy_sci_msg );
+
+ /**
+ * @return bool
+ * @param phy_sci_msg_to_send
+ */
+ bool sendMsgToAllStations ( PhySciMsg & phy_sci_msg_to_send ) const;
+
+ /**
+ * Activate the wrong preambles transmission feature.
+ * @param average_duration average number of ticks 25 MHz between two consecutive wrong preambles
+ * @param std_deviation the standard deviation
+ * @return bool
+ */
+ bool activateFalseAlarm ( const Network_Clock_Tick average_duration, const float std_deviation );
+
+ /**
+ * Deactivate the wrong preambles transmission feature.
+ * @return bool
+ */
+ bool deactivateFalseAlarm ( );
+
+ // public attribute accessor methods
+ //
+
+ // private attribute accessor methods
+ //
+
+ /**
+ * @return bool
+ * @param p_network_clock the new value of mpNetworkClock
+ */
+ bool setNetworkClock ( INetworkClock * p_network_clock );
+
+ /**
+ * @return bool
+ * @param p_channel the new value of mpChannel
+ */
+ bool setChannel ( IChannel * p_channel );
+
+ /**
+ * Sets the channel perturbation.
+ * @param is_channel_enabled the new value of mIsChannelEnabled
+ */
+ bool setIsChannelEnabled ( const bool is_channel_enabled );
+
+ /**
+ * Gets the TX ID.
+ * @return mTxId
+ */
+ const Phy_Tx_Id getTxId ( ) const;
+
+ /**
+ * Gets the tonemask.
+ * @return mpTonemask
+ */
+ const uint8_t * getTonemask ( ) const;
+
+ /**
+ * Check if the channel perturbation is enabled.
+ * @return mIsChannelEnabled
+ */
+ bool isChannelEnabled ( ) const;
+
+ /**
+ * Sets the power line frequency.
+ * @param frequency the new value of mFrequency
+ * @return bool
+ */
+ bool setFrequency ( const float frequency );
+
+ /**
+ * Gets the power line frequency.
+ * @return mFrequency
+ */
+ const float getFrequency ( ) const;
+
+ // protected attribute accessor methods
+ //
+
+private:
+
+ // private methods
+ //
+
+ /**
+ * Initializes the PHY processor class attributes.
+ */
+ void initAttributes ( );
+
+ /**
+ * Registers the PHY SCI message creation function to the SCI server.
+ */
+ void registerPhySciMsg ( );
+
+ /**
+ * Computes PREAMBLE transmission duration.
+ * @return preamble delay in ticks
+ */
+ Network_Clock_Tick calculatePreDelay ( ) const;
+
+ /**
+ * Computes Frame Control transmission duration.
+ * @return Frame Control delay in ticks
+ */
+ Network_Clock_Tick calculateFcDelay ( Phy_Fc_Mode fc_mode ) const;
+
+ /**
+ * Computes MPDU payload transission duration.
+ * @return MPDU payload delay in ticks
+ */
+ Network_Clock_Tick calculateMpduDelay ( Phy_Mod mod,
+ Phy_Fecrate fecrate,
+ unsigned short int pb_size,
+ Phy_Nb_Of_Pbs pb_nb,
+ Phy_Gil gil ) const;
+
+ /**
+ * @return bool
+ * @param phy_sci_msg_to_send
+ */
+ bool fillMsg ( PhySciMsg & phy_sci_msg_to_send ) const;
+
+ /**
+ * @return a pointer to SCI server
+ */
+ ISci * getSciServer ( ) const;
+
+ /**
+ * @return a pointer to Network Clock Processor
+ */
+ INetworkClock * getNetworkClock ( ) const;
+
+ /**
+ * Gets a pointer to Channel.
+ * @return mpChannel
+ */
+ IChannel * getChannel ( ) const;
+
+ /**
+ * Gets the number of carriers.
+ * @return mNbOfCarriers
+ */
+ const unsigned int getNbOfCarriers ( ) const;
+
+ /**
+ * Sets the number of carriers.
+ * @return bool
+ * @param nb_of_carriers the new value of mNbOfCarriers
+ */
+ bool setNbOfCarriers ( const unsigned int nb_of_carriers );
+
+ /**
+ * Sets the tonemask.
+ * @return bool
+ * @param length the tonemask length in octets
+ * @param p_tonemask the new value of mpTonemask
+ */
+ bool setTonemask ( const unsigned int length, const uint8_t * p_tonemask );
+
+ /**
+ * Increments the TX ID.
+ * @return bool
+ */
+ bool incrementTxId ( );
+
+ /**
+ * Gets the interface callback function for PHY SCI message MPDU reception.
+ * @return mInterfaceCb
+ */
+ PhyMpduCb getInterfaceCb ( ) const;
+
+ /**
+ * Gets the zero-cross delay for PHY SCI message of type ZERO_CROSS transmission.
+ * @return mZeroCrossDelay
+ */
+ const Network_Clock_Tick getZeroCrossDelay ( ) const;
+
+ /**
+ * Sets the zero-cross delay for PHY SCI message of type ZERO_CROSS transmission.
+ * @param zero_cross_delay the new value of mZeroCrossDelay
+ * @return bool
+ */
+ bool setZeroCrossDelay ( const Network_Clock_Tick zero_cross_delay );
+
+ /**
+ * Gets a pointer to the PHY SCI message of type ZERO_CROSS.
+ * @return mpZeroCross
+ */
+ PhySciMsg * getZeroCross ( ) const;
+
+ /**
+ * Schedules an event for next PHY SCI message of type ZERO_CROSS transmission.
+ * @return bool
+ */
+ bool scheduleZeroCross ( );
+
+ /**
+ * Sends a PHY SCI message of type MPDU to destination stations.
+ * @param mpdu the PHY SCI message MPDU to send
+ * @return bool
+ */
+ bool sendMpduToDestStations ( PhySciMsgMpdu & mpdu );
+
+ /**
+ * Sends an empty PHY SCI message of type NOISE to destination stations.
+ * @param noise the empty PHY SCI message NOISE to send
+ * @return bool
+ */
+ bool sendEmptyNoiseToDestStations ( PhySciMsgNoise & noise );
+
+ /**
+ * Sends PHY SCI message(s) of type MPDU
+ * and a PHY SCI message of type NOISE
+ * to destination stations.
+ * @param mpdu the PHY SCI message of type MPDU
+ * @return bool
+ */
+ bool sendMpduAndNoiseToDestStations ( PhySciMsgMpdu & mpdu );
+
+ /**
+ * Update the list of destination stations.
+ * Once a PHY SCI message MPDU has been sent to the destination stations,
+ * remove the destination stations from the reception list.
+ */
+ void updateListOfRxStations ( PhySciMsgMpdu & mpdu );
+
+ /**
+ * Check if the wrong preambles transmission is enabled or not.
+ * @return mIsFalseAlarmActivated
+ */
+ const bool isFalseAlarmActivated ( ) const;
+
+ /**
+ * Gets a pointer to the PHY SCI message of type PREAMBLE with the flag PHY_FLAG_WRONG_PREAMBLE set.
+ * @return mpWrongPre
+ */
+ PhySciMsgPre * getWrongPre ( ) const;
+
+ /**
+ * Gets the average number of ticks 25 MHz between 2 consecutive wrong preambles transmissions.
+ * @return mAverageDuration
+ */
+ const Network_Clock_Tick getAverageDuration ( ) const;
+
+ /**
+ * Gets the standard deviation (used to calculate date of the next wrong preamble transmission).
+ * @return mStdDeviation
+ */
+ const float getStdDeviation ( ) const;
+
+ /**
+ * Calculate date of next wrong preamble transmission.
+ * @return the calculated date in ticks 25 MHz
+ */
+ const Network_Clock_Tick calculateNextWrongPreDate ( ) const;
+
+ /**
+ * Schedules an event for next wrong preamble transmission.
+ * @param tick_wrong_pre the next wrong preamble should be transmitted at current date + tick_wrong_pre (in 25 MHz)
+ * @return bool
+ */
+ bool scheduleNextWrongPre ( const Network_Clock_Tick tick_wrong_pre ) const;
+
+protected:
+
+ // protected methods
+ //
+
+};
+
+
+#endif // PHYPROCESSOR_H
diff --git a/cesar/maximus/phy/inc/PhyProcessorTest.h b/cesar/maximus/phy/inc/PhyProcessorTest.h
new file mode 100644
index 0000000000..bcb8fdf1ac
--- /dev/null
+++ b/cesar/maximus/phy/inc/PhyProcessorTest.h
@@ -0,0 +1,74 @@
+
+#ifndef PHYPROCESSORTEST_H
+#define PHYPROCESSORTEST_H
+
+#include <cppunit/TestFixture.h>
+#include <cppunit/extensions/HelperMacros.h>
+
+class PhyProcessor;
+class CoreEngine;
+
+
+class PhyProcessorTest : public CPPUNIT_NS::TestFixture
+{
+
+ CPPUNIT_TEST_SUITE (PhyProcessorTest);
+ CPPUNIT_TEST (initTest);
+ CPPUNIT_TEST (createMsgTest);
+ CPPUNIT_TEST (createMpduTest);
+ CPPUNIT_TEST (sendMsgTest);
+ CPPUNIT_TEST (sendMpduTest);
+ CPPUNIT_TEST (receiveEvtTest);
+ CPPUNIT_TEST (receiveInvalidTest);
+ CPPUNIT_TEST (receivePreTest);
+ CPPUNIT_TEST (receiveFcTest);
+ CPPUNIT_TEST (receivePrsTest);
+ CPPUNIT_TEST (receiveMpduTest);
+ CPPUNIT_TEST (receiveTonemaskTest);
+ CPPUNIT_TEST (receiveTonemapTest);
+ CPPUNIT_TEST (receiveRxTest);
+ CPPUNIT_TEST (setNetworkClockTest);
+ CPPUNIT_TEST (setChannelTest);
+ CPPUNIT_TEST (setIsChannelEnabledTest);
+ CPPUNIT_TEST (setFrequencyTest);
+ CPPUNIT_TEST (activateFalseAlarmTest);
+ CPPUNIT_TEST (deactivateFalseAlarmTest);
+ CPPUNIT_TEST_SUITE_END ();
+
+public:
+
+ void setUp (void);
+ void tearDown (void);
+
+protected:
+
+ void initTest (void);
+ void createMsgTest (void);
+ void createMpduTest (void);
+ void sendMsgTest (void);
+ void sendMpduTest (void);
+ void receiveEvtTest (void);
+ void receiveInvalidTest (void);
+ void receivePreTest (void);
+ void receiveFcTest (void);
+ void receivePrsTest (void);
+ void receiveMpduTest (void);
+ void receiveTonemaskTest (void);
+ void receiveTonemapTest (void);
+ void receiveRxTest (void);
+ void setNetworkClockTest (void);
+ void setChannelTest (void);
+ void setIsChannelEnabledTest (void);
+ void setFrequencyTest (void);
+ void activateFalseAlarmTest (void);
+ void deactivateFalseAlarmTest (void);
+
+private:
+
+ PhyProcessor * mpPhyProcessor;
+ CoreEngine * mpCoreEngine;
+
+};
+
+
+#endif // PHYPROCESSORTEST_H
diff --git a/cesar/maximus/phy/inc/PhySciMsg.h b/cesar/maximus/phy/inc/PhySciMsg.h
new file mode 100644
index 0000000000..f543106e11
--- /dev/null
+++ b/cesar/maximus/phy/inc/PhySciMsg.h
@@ -0,0 +1,524 @@
+/************************************************************************
+ PhySciMsg.h - 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/phy/inc/PhySciMsg.h
+**************************************************************************/
+
+#ifndef PHYSCIMSG_H
+#define PHYSCIMSG_H
+
+#include "SciMsg.h"
+
+#include "phy_types.h"
+#include "hal_phy_types.h"
+#include "networkclock_types.h"
+
+
+class IPhy;
+
+
+/**
+ * class PhySciMsg
+ */
+
+class PhySciMsg : public SciMsg
+{
+
+public:
+
+ // public attributes
+ //
+
+private:
+
+ // private attributes
+ //
+
+protected:
+
+ // protected attributes
+ //
+
+ // Get from specialized SCI msg header
+ //
+ Phy_Type mSpecializedSciMsgType;
+ Phy_Mpdu_Format mMpduFormat;
+ Phy_Nb_Of_Pbs mNbOfPbs;
+ unsigned short int mNbOfMsgs;
+ Phy_Fc_Mode mFcMode;
+ Phy_Short_Ppdu mShortPpdu;
+ Phy_Mod mMod;
+ Phy_Fecrate mFecrate;
+ Phy_Gil mGil;
+ Phy_Tonemap_Index mTonemapIndex;
+ Phy_Tx_Id mTxId;
+ Phy_Flags mFlags;
+ bool mIsEncrypted;
+ bool mIsCrcOk;
+ unsigned short int mPbSize;
+ unsigned short int mReserved; // NOT USED YET
+ Phy_Nb_Of_Symbols mNbOfSymbols;
+ uint32_t mIvArray[3];
+ uint32_t mNekArray[4];
+ uint32_t mPbMeasurementArray[PHY_PB_MAX_NB];
+ uint32_t mPbHeaderArray[PHY_PB_MAX_NB];
+
+ // Specialized SCI msg header
+ //
+ Phy_Header mSpecializedSciMsgHeader;
+
+ IPhy * mpPhyProcessor;
+
+ bool mIsSent;
+
+public:
+
+ // Constructors/Destructors
+ //
+
+ /**
+ * Constructor
+ */
+ PhySciMsg ( IPhy * p_phy_processor );
+
+ /**
+ * Empty Destructor
+ */
+ virtual ~PhySciMsg ( );
+
+ // public methods
+ //
+
+ /**
+ * Creates a PHY SCI message.
+ * @return SciMsg *
+ */
+ SciMsg * create ( ) const;
+
+ /**
+ * Handles a received PHY SCI message.
+ * @return bool
+ */
+ bool dispatchMsg ( );
+
+ /**
+ * When receiving a PHY SCI message,
+ * extracts the PHY SCI message header from the received SCI message data.
+ * @return bool
+ */
+ bool identifySpecializedSciMsgHeader ( );
+
+ /**
+ * Checks that software versions are compatible,
+ * i.e. checks specialized SCI msg compatibility (check specialized SCI msg version).
+ * @return bool
+ */
+ bool checkCompatibility ( ) const;
+
+ /**
+ * Checks PHY SCI message header values ranges,
+ * i.e. checks specialized SCI msg validity (check specialized SCI msg header coherence).
+ * @return bool
+ */
+ bool checkValidity ( ) const;
+
+ /**
+ * Displays the PHY SCI message header contents.
+ */
+ void displaySpecializedSciMsgHeader ( ) const;
+
+ /**
+ * Display the specialized SCI message type.
+ */
+ void displaySpecializedSciMsgType ( int log_level ) const;
+
+ /**
+ * Sets the PHY SCI message attributes before transmission.
+ * @param clock_id ID of the Network Clock event received message
+ * @return bool
+ */
+ virtual bool prepare ( Network_Clock_Id clock_id = 0 );
+
+ // public attribute accessor methods
+ //
+
+ // private attribute accessor methods
+ //
+
+ // protected attribute accessor methods
+ //
+
+ /**
+ * Gets a pointer to the PHY SCI message header.
+ * @return mSpecializedSciMsgHeader into a void pointer
+ */
+ void * returnSpecializedSciMsgHeader ( ) const;
+
+ /**
+ * Gets the PHY SCI message header.
+ * @return mSpecializedSciMsgHeader
+ */
+ const Phy_Header & getSpecializedSciMsgHeader ( ) const;
+
+ /**
+ * Sets the value of the PHY SCI message header.
+ * @return bool
+ * @param specialized_sci_msg_header the new value of mSpecializedSciMsgHeader
+ */
+ bool setSpecializedSciMsgHeader ( const Phy_Header & specialized_sci_msg_header );
+
+ /**
+ * Gets a pointer to the PHY processor.
+ * @return mpPhyProcessor
+ */
+ IPhy * getPhyProcessor ( ) const;
+
+ /**
+ * Gets the PHY SCI message type.
+ * @return mSpecializedSciMsgType
+ */
+ Phy_Type getSpecializedSciMsgType ( ) const;
+
+ /**
+ * Sets the PHY SCI message type.
+ * @return bool
+ * @param type the new value of mSpecializedSciMsgType
+ */
+ bool setSpecializedSciMsgType ( const Phy_Type type );
+
+ /**
+ * Gets the PHY SCI message MPDU format.
+ * @return mMpduFormat
+ */
+ Phy_Mpdu_Format getMpduFormat ( ) const;
+
+ /**
+ * Sets the PHY SCI message MPDU format.
+ * @return bool
+ * @param mpdu_format the new value of mMpduFormat
+ */
+ bool setMpduFormat ( const Phy_Mpdu_Format mpdu_format );
+
+ /**
+ * Gets the PHY SCI message PB number.
+ * @return mNbOfPbs
+ */
+ Phy_Nb_Of_Pbs getNbOfPbs ( ) const;
+
+ /**
+ * Sets the PHY SCI message PB number.
+ * @return bool
+ * @param nb_of_pbs the new value of mNbOfPbs
+ */
+ bool setNbOfPbs ( const Phy_Nb_Of_Pbs nb_of_pbs );
+
+ /**
+ * Gets the number of PHY SCI messages (composing the MPDU).
+ * @return mNbOfMsgs
+ */
+ const unsigned short int getNbOfMsgs ( ) const;
+
+ /**
+ * Sets the number of PHY SCI messages (composing the MPDU).
+ * @param nb_of_msgs the new value of mNbOfMsgs
+ * @return bool
+ */
+ bool setNbOfMsgs ( const unsigned short int nb_of_msgs );
+
+ /**
+ * Sets the PHY SCI message Frame Control mode.
+ * @return mFcMode
+ */
+ Phy_Fc_Mode getFcMode ( ) const;
+
+ /**
+ * Sets the PHY SCI message Frame Control mode.
+ * @return bool
+ * @param fc_mode the new value of mFcMode
+ */
+ virtual bool setFcMode ( const Phy_Fc_Mode fc_mode );
+
+ /**
+ * Gets the PHY SCI message short PPDU.
+ * @return mShortPpdu
+ */
+ Phy_Short_Ppdu getShortPpdu ( ) const;
+
+ /**
+ * Sets the PHY SCI message short PPDU.
+ * @return bool
+ * @param short_ppdu the new value of mShortPpdu
+ */
+ virtual bool setShortPpdu ( const Phy_Short_Ppdu short_ppdu );
+
+ /**
+ * Gets the PHY SCI message modulation.
+ * @return mMod
+ */
+ Phy_Mod getMod ( ) const;
+
+ /**
+ * Sets the PHY SCI message modulation.
+ * @return bool
+ * @param mod the new value of mMod
+ */
+ virtual bool setMod ( const Phy_Mod mod );
+
+ /**
+ * Gets the PHY SCI message FEC rate.
+ * @return mFecrate
+ */
+ Phy_Fecrate getFecrate ( ) const;
+
+ /**
+ * Sets the PHY SCI message FEC rate.
+ * @return bool
+ * @param fecrate the new value of mFecrate
+ */
+ virtual bool setFecrate ( const Phy_Fecrate fecrate );
+
+ /**
+ * Gets the PHY SCI message Guard Interval.
+ * @return mGil
+ */
+ Phy_Gil getGil ( ) const;
+
+ /**
+ * Sets the PHY SCI message Guard Interval.
+ * @return bool
+ * @param gil the new value of mGil
+ */
+ virtual bool setGil ( const Phy_Gil gil );
+
+ /**
+ * Gets the PHY SCI message tonemap index.
+ * @return mTonemapIndex
+ */
+ Phy_Tonemap_Index getTonemapIndex ( ) const;
+
+ /**
+ * Sets the PHY SCI message tonemap index.
+ * @return bool
+ * @param tonemap_index the new value of mTonemapIndex
+ */
+ bool setTonemapIndex ( const Phy_Tonemap_Index tonemap_index );
+
+ /**
+ * Sets the PHY SCI message transmission ID.
+ * @return mTxId
+ */
+ Phy_Tx_Id getTxId ( ) const;
+
+ /**
+ * Gets the PHY SCI message transmission ID.
+ * @return bool
+ * @param tx_id the new value of mTxId
+ */
+ bool setTxId ( const Phy_Tx_Id tx_id );
+
+ /**
+ * Gets the PHY SCI message flags.
+ * @return mFlags
+ */
+ Phy_Flags getFlags ( ) const;
+
+ /**
+ * Sets the PHY SCI message flags.
+ * @return bool
+ * @param flags the new value of mFlags
+ */
+ virtual bool setFlags ( const Phy_Flags flags );
+
+ /**
+ * Gets if the PHY SCI message is encrypted or not.
+ * @return mIsEncrypted
+ */
+ bool isEncrypted ( ) const;
+
+ /**
+ * Sets if the PHY SCI message is encrypted or not.
+ * @return bool
+ * @param is_encrypted the new value of mIsEncrypted
+ */
+ bool setIsEncrypted ( const bool is_encrypted );
+
+ /**
+ * Gets if the PHY SCI message CRC is OK or not.
+ * @return mIsCrcOk
+ */
+ bool isCrcOk ( ) const;
+
+ /**
+ * Sets if the PHY SCI message CRC is OK or not.
+ * @return bool
+ * @param is_crc_ok the new value of mIsCrcOk
+ */
+ bool setIsCrcOk ( const bool is_crc_ok );
+
+ /**
+ * Gets the PHY SCI message PB size.
+ * @return mPbSize
+ */
+ unsigned short int getPbSize ( ) const;
+
+ /**
+ * Sets the PHY SCI message PB size.
+ * @return bool
+ * @param pb_size the new value of mPbSize
+ */
+ bool setPbSize ( const unsigned short int pb_size );
+
+ /**
+ * Sets the PHY SCI message reserved field (NOT USED YET).
+ * @return mReserved
+ */
+ inline unsigned short int getReserved ( ) const { return mReserved; }
+
+ /**
+ * Sets the PHY SCI message reserved field (NOT USED YET).
+ * @return bool
+ * @param reserved the new value of mReserved
+ */
+ inline bool setReserved ( const unsigned short int reserved ) { mReserved = reserved;
+ return true; }
+
+ /**
+ * Gets the PHY SCI message symbols number.
+ * @return mNbOfSymbols
+ */
+ Phy_Nb_Of_Symbols getNbOfSymbols ( ) const;
+
+ /**
+ * Sets the PHY SCI message symbols number.
+ * @return bool
+ * @param nb_of_symbols the new value of mNbOfSymbols
+ */
+ bool setNbOfSymbols ( const Phy_Nb_Of_Symbols nb_of_symbols );
+
+ /**
+ * Gets the PHY SCI message IV array.
+ * @return mIvArray
+ */
+ const uint32_t * getIv ( ) const;
+
+ /**
+ * Sets the PHY SCI message IV array.
+ * @return bool
+ * @param iv the new value of mIvArray
+ */
+ bool setIv ( const uint32_t iv[3] );
+
+ /**
+ * Gets the PHY SCI message NEK array.
+ * @return mNekArray
+ */
+ const uint32_t * getNek ( ) const;
+
+ /**
+ * Sets the PHY SCI message NEK array.
+ * @return bool
+ * @param nek the new value of mNekArray
+ */
+ bool setNek ( const uint32_t nek[4] );
+
+ /**
+ * Gets the PHY SCI message PB measurement array.
+ * @return mPbMeasurementArray
+ */
+ const uint32_t * getPbMeasurement ( ) const;
+
+ /**
+ * Sets the PHY SCI message PB measurement array.
+ * @return bool
+ * @param pb_measurement the new value of mPbMeasurementArray
+ */
+ bool setPbMeasurement ( const uint32_t pb_measurement[PHY_PB_MAX_NB] );
+
+ /**
+ * Gets the PHY SCI message PB header array.
+ * @return mPbHeaderArray
+ */
+ const uint32_t * getPbHeader ( ) const;
+
+ /**
+ * @return bool
+ * @param pb_header the new value of mPbHeaderArray
+ */
+ bool setPbHeader ( const uint32_t pb_header[PHY_PB_MAX_NB] );
+
+ /**
+ * Checks if the PHY SCI message has been sent.
+ * @return mIsSent
+ */
+ virtual const bool isSent ( ) const;
+
+ /**
+ * Sets if the PHY SCI message has been sent.
+ * @param is_sent the new value of mIsSent
+ * @return bool
+ */
+ bool setIsSent ( const bool is_sent );
+
+private:
+
+ // private methods
+ //
+
+ /**
+ * Initializes the PHY SCI message class attributes.
+ */
+ void initAttributes ( );
+
+ /**
+ * Displays the PHY SCI message header IV.
+ */
+ void displayIv ( ) const;
+
+ /**
+ * Displays the PHY SCI message header NEK.
+ */
+ void displayNek ( ) const;
+
+ /**
+ * Displays the PHY SCI message header PBs measurements.
+ */
+ void displayPbMeasurement ( ) const;
+
+ /**
+ * Displays the PHY SCI message header PBs headers.
+ */
+ void displayPbHeader ( ) const;
+
+protected:
+
+ // protected methods
+ //
+
+};
+
+
+#endif // PHYSCIMSG_H
diff --git a/cesar/maximus/phy/inc/PhySciMsgFc.h b/cesar/maximus/phy/inc/PhySciMsgFc.h
new file mode 100644
index 0000000000..df549a1a61
--- /dev/null
+++ b/cesar/maximus/phy/inc/PhySciMsgFc.h
@@ -0,0 +1,148 @@
+/************************************************************************
+ PhySciMsgFc.h - 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/phy/inc/PhySciMsgFc.h
+**************************************************************************/
+
+#ifndef PHYSCIMSGFC_H
+#define PHYSCIMSGFC_H
+
+#include "PhySciMsg.h"
+
+
+/**
+ * class PhySciMsgFc
+ */
+
+class PhySciMsgFc : public PhySciMsg
+{
+
+public:
+
+ // public attributes
+ //
+
+private:
+
+ // private attributes
+ //
+
+ uint32_t mFc10;
+ uint32_t mFcAvArray[4];
+
+protected:
+
+ // protected attributes
+ //
+
+public:
+
+ // Constructors/Destructors
+ //
+
+ /**
+ * Constructor
+ * Creates a PHY message of type FC_HYBRID_MODE or FC_AV_ONLY_MODE.
+ * @param p_phy_processor a pointer to the PHY interface
+ */
+ PhySciMsgFc ( IPhy * p_phy_processor );
+
+ /**
+ * Empty Destructor
+ */
+ virtual ~PhySciMsgFc ( );
+
+ // public methods
+ //
+
+ /**
+ * Sets the PHY SCI message class attributes before transmission,
+ * and fills specialized SCI msg data length and specialized SCI msg data
+ * for a PHY message of type FC_AV_ONLY_MODE or FC_HYBRID_MODE.
+ * @param clock_id ID of the Network Clock event received message
+ * @return bool
+ */
+ bool prepare ( Network_Clock_Id clock_id );
+
+ // public attribute accessor methods
+ //
+
+ // private attribute accessor methods
+ //
+
+ /**
+ * Gets the Frame Control 1.0.
+ * @return mFc10
+ */
+ const uint32_t getFc10 ( ) const;
+
+ /**
+ * Sets the Frame Control 1.0.
+ * @param fc_10 the new value of mFc10
+ * @return bool
+ */
+ bool setFc10 ( const uint32_t fc_10 );
+
+ /**
+ * Gets the Frame Control AV.
+ * @return mFcAvArray
+ */
+ const uint32_t * getFcAv ( ) const;
+
+ /**
+ * Sets the Frame Control AV.
+ * @param fc_av the new value of mFcAvArray
+ * @return bool
+ */
+ bool setFcAv ( const uint32_t fc_av[4] );
+
+ // protected attribute accessor methods
+ //
+
+private:
+
+ // private methods
+ //
+
+ /**
+ * Initializes the PHY SCI message class attributes.
+ * Fills PHY SCI message type.
+ */
+ void initAttributes ( );
+
+ // private attribute accessor methods
+ //
+
+protected:
+
+ // protected methods
+ //
+
+};
+
+
+#endif // PHYSCIMSGFC_H
diff --git a/cesar/maximus/phy/inc/PhySciMsgFcTest.h b/cesar/maximus/phy/inc/PhySciMsgFcTest.h
new file mode 100644
index 0000000000..3c9a5f4f83
--- /dev/null
+++ b/cesar/maximus/phy/inc/PhySciMsgFcTest.h
@@ -0,0 +1,42 @@
+
+#ifndef PHYSCIMSGFCTEST_H
+#define PHYSCIMSGFCTEST_H
+
+#include <cppunit/TestFixture.h>
+#include <cppunit/extensions/HelperMacros.h>
+
+class PhySciMsgFc;
+class IPhy;
+class ISci;
+
+
+class PhySciMsgFcTest : public CPPUNIT_NS::TestFixture
+{
+
+ CPPUNIT_TEST_SUITE (PhySciMsgFcTest);
+ CPPUNIT_TEST (prepareTest);
+ CPPUNIT_TEST (fc10Test);
+ CPPUNIT_TEST (fcAvTest);
+ CPPUNIT_TEST_SUITE_END ();
+
+public:
+
+ void setUp (void);
+ void tearDown (void);
+
+protected:
+
+ void prepareTest (void);
+ void fc10Test (void);
+ void fcAvTest (void);
+
+private:
+
+ ISci * mpSci;
+ IPhy * mpPhy;
+ PhySciMsgFc * mpPhySciMsgFc;
+
+};
+
+
+#endif // PHYSCIMSGFCTEST_H
diff --git a/cesar/maximus/phy/inc/PhySciMsgMpdu.h b/cesar/maximus/phy/inc/PhySciMsgMpdu.h
new file mode 100644
index 0000000000..ae92ddb628
--- /dev/null
+++ b/cesar/maximus/phy/inc/PhySciMsgMpdu.h
@@ -0,0 +1,290 @@
+/************************************************************************
+ PhySciMsgMpdu.h - 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/phy/inc/PhySciMsgMpdu.h
+**************************************************************************/
+
+#ifndef PHYSCIMSGMPDU_H
+#define PHYSCIMSGMPDU_H
+
+#include "PhySciMsg.h"
+
+class PhySciMsgPre;
+class PhySciMsgFc;
+
+
+/**
+ * class PhySciMsgMpdu
+ */
+
+class PhySciMsgMpdu : public PhySciMsg
+{
+
+public:
+
+ // public attributes
+ //
+
+private:
+
+ // private attributes
+ //
+
+ unsigned long mPayloadLength;
+ unsigned char * mpPayload;
+
+ PhySciMsgPre * mpPre;
+ PhySciMsgFc * mpFc;
+
+ unsigned short int mNbOfPbsInLastMsg;
+ unsigned char mPbsArray[MAC_MAX_PB_PER_MPDU*MAC_PB520_BYTES];
+ uint32_t mPbsHeadersArray[MAC_MAX_PB_PER_MPDU];
+
+protected:
+
+ // protected attributes
+ //
+
+public:
+
+ // Constructors/Destructors
+ //
+
+ /**
+ * Constructor
+ * Creates a PHY SCI message of type MPDU_PAYLOAD.
+ * @param p_phy_processor a pointer to the PHY interface
+ */
+ PhySciMsgMpdu ( IPhy * p_phy_processor );
+
+ /**
+ * Copy Constructor
+ * Creates a PHY SCI message of type MPDU_PAYLOAD.
+ * @param phy_sci_msg a PHY SCI message
+ */
+ PhySciMsgMpdu ( PhySciMsg & phy_sci_msg );
+
+ /**
+ * Empty Destructor
+ */
+ virtual ~PhySciMsgMpdu ( );
+
+ // public methods
+ //
+
+ /**
+ * Segment the MPDU payload into PBs.
+ * Fills PBs headers.
+ * @return bool
+ */
+ bool segment ( );
+
+ /**
+ * Sets the PHY SCI message class attributes before transmission,
+ * and fills specialized SCI msg data length and specialized SCI msg data
+ * for a PHY message of type MPDU_PAYLOAD.
+ * @param clock_id ID of the Network Clock event received message
+ * @return bool
+ */
+ bool prepare ( Network_Clock_Id clock_id );
+
+ // public attribute accessor methods
+ //
+
+ // private attribute accessor methods
+ //
+
+ /**
+ * Gets the MPDU payload length.
+ * @return mPayloadLength
+ */
+ const unsigned long getPayloadLength ( ) const;
+
+ /**
+ * Gets the MPDU payload.
+ * @return mpPayload
+ */
+ const unsigned char * getPayload ( ) const;
+
+ /**
+ * @param length the new value of mPayloadLength
+ * @param p_payload the new value of mpPayload
+ * @return bool
+ */
+ bool setMpdu ( const unsigned long length, const unsigned char * p_payload );
+
+ /**
+ * Gets the PHY SCI message PREAMBLE.
+ * @return mpPre
+ */
+ PhySciMsgPre * getPre ( ) const;
+
+ /**
+ * Gets the PHY SCI message FC.
+ * @return mpFc
+ */
+ PhySciMsgFc * getFc ( ) const;
+
+ /**
+ * Gets the number of PBs into the last PHY SCI message composing the MPDU.
+ * @return mNbOfPbsInLastMsg
+ */
+ const unsigned short int getNbOfPbsInLastMsg ( ) const;
+
+ /**
+ * Sets the number of PBs into the last PHY SCI message composing the MPDU.
+ * @param nb_of_pbs_in_last_msg the new value of mNbOfPbsInLastMsg
+ * @return bool
+ */
+ bool setNbOfPbsInLastMsg ( const unsigned short int nb_of_pbs_in_last_msg );
+
+ /**
+ * Gets a pointer to the PBs of the nth PHY SCI message composing the MPDU.
+ * @return &mPbsArray[n*PHY_PB_MAX_NB*MAC_PB520_BYTES]
+ */
+ const unsigned char * getPbs ( const unsigned short int n = 0 ) const;
+
+ /**
+ * Checks if the PHY SCI message has been sent (MPDU, or FC in case of a short PPDU).
+ * @return (mIsSent || mpFc->mIsSent)
+ */
+ const bool isSent ( ) const;
+
+ /**
+ * Checks if the MPDU has been completely received
+ * (i.e. all PHY SCI messages MPDU composing the MPDU have been received).
+ * @param nb_of_received_msgs number of PHY SCI messages MPDU that have been received
+ * @return nb_of_received_msgs == mNbOfMsgs
+ */
+ const bool isReceived ( const unsigned short int nb_of_received_msgs ) const;
+
+ /**
+ * Sets the PHY SCI message Frame Control mode for PREAMBLE, FC and MPDU.
+ * @return bool
+ * @param fc_mode the new value of mFcMode, mpPre->mFcMode and mpFc->mFcMode
+ */
+ bool setFcMode ( const Phy_Fc_Mode fc_mode );
+
+ /**
+ * Sets the PHY SCI message short PPDU for PREAMBLE, FC and MPDU.
+ * @return bool
+ * @param short_ppdu the new value of mShortPpdu, mpPre->mShortPpdu and mpFc->mShortPpdu
+ */
+ bool setShortPpdu ( const Phy_Short_Ppdu short_ppdu );
+
+ /**
+ * Sets the PHY SCI message modulation for PREAMBLE, FC and MPDU.
+ * @return bool
+ * @param mod the new value of mMod, mpPre->mMod and mpFc->mMod
+ */
+ bool setMod ( const Phy_Mod mod );
+
+ /**
+ * Sets the PHY SCI message FEC rate for PREAMBLE, FC and MPDU.
+ * @return bool
+ * @param fecrate the new value of mFecrate, mpPre->mFecrate and mpFc->mFecrate
+ */
+ bool setFecrate ( const Phy_Fecrate fecrate );
+
+ /**
+ * Sets the PHY SCI message Guard Interval for PREAMBLE, FC and MPDU.
+ * @return bool
+ * @param gil the new value of mGil, mpPre->mGil and mpFc->mGil
+ */
+ bool setGil ( const Phy_Gil gil );
+
+ /**
+ * Sets the PHY SCI message flags for PREAMBLE, FC and MPDU.
+ * @return bool
+ * @param flags the new value of mFlags, mpPre->mFlags and mpFc->mFlags
+ */
+ bool setFlags ( const Phy_Flags flags );
+
+ /**
+ * Gets the Frame Control 1.0 of the PHY SCI message FC.
+ * @return mpFc->mFc10
+ */
+ const uint32_t getFc10 ( ) const;
+
+ /**
+ * Sets the Frame Control 1.0 of the PHY SCI message FC.
+ * @param fc_10 the new value of mpFc->mFc10
+ * @return bool
+ */
+ bool setFc10 ( const uint32_t fc_10 );
+
+ /**
+ * Gets the Frame Control AV of the PHY SCI message FC.
+ * @return mpFc->mFcAvArray
+ */
+ const uint32_t * getFcAv ( ) const;
+
+ /**
+ * Sets the Frame Control AV of the PHY SCI message FC.
+ * @param fc_av the new value of mpFc->mFcAvArray
+ * @return bool
+ */
+ bool setFcAv ( const uint32_t fc_av[4] );
+
+ /**
+ * Gets a pointer to the PB Header of the nth PHY SCI message composing the MPDU.
+ * @return &mPbsHeadersArray[n*PHY_PB_MAX_NB]
+ */
+ const uint32_t * getPbsHeaders ( const unsigned short int n ) const;
+
+ /**
+ * Sets the (n)th PB header.
+ * @param n indicates the number of the PB to set
+ * @param pb_header the value of the (n)th PB Header
+ * @return bool
+ */
+ bool setPbsHeaders ( const unsigned short int n, const uint32_t pb_header );
+
+ // protected attribute accessor methods
+ //
+
+private:
+
+ // private methods
+ //
+
+ /**
+ * Initializes the PHY SCI message class attributes.
+ * Fills PHY SCI message type.
+ * @param p_phy_processor a pointer to the PHY interface
+ */
+ void initAttributes ( IPhy * p_phy_processor );
+
+protected:
+
+ // protected methods
+ //
+
+};
+
+
+#endif // PHYSCIMSGMPDU_H
diff --git a/cesar/maximus/phy/inc/PhySciMsgMpduTest.h b/cesar/maximus/phy/inc/PhySciMsgMpduTest.h
new file mode 100644
index 0000000000..ce0b2fc8d3
--- /dev/null
+++ b/cesar/maximus/phy/inc/PhySciMsgMpduTest.h
@@ -0,0 +1,48 @@
+
+#ifndef PHYSCIMSGMPDUTEST_H
+#define PHYSCIMSGMPDUTEST_H
+
+#include <cppunit/TestFixture.h>
+#include <cppunit/extensions/HelperMacros.h>
+
+class PhySciMsgMpdu;
+class IPhy;
+class ISci;
+
+
+class PhySciMsgMpduTest : public CPPUNIT_NS::TestFixture
+{
+
+ CPPUNIT_TEST_SUITE (PhySciMsgMpduTest);
+ CPPUNIT_TEST (segmentTest);
+ CPPUNIT_TEST (prepareTest);
+ CPPUNIT_TEST (setMpduTest);
+ CPPUNIT_TEST (setNbOfMsgsTest);
+ CPPUNIT_TEST (setNbOfPbsInLastMsgTest);
+ CPPUNIT_TEST (setPbsHeadersTest);
+ CPPUNIT_TEST_SUITE_END ();
+
+public:
+
+ void setUp (void);
+ void tearDown (void);
+
+protected:
+
+ void segmentTest (void);
+ void prepareTest (void);
+ void setMpduTest (void);
+ void setNbOfMsgsTest (void);
+ void setNbOfPbsInLastMsgTest (void);
+ void setPbsHeadersTest (void);
+
+private:
+
+ ISci * mpSci;
+ IPhy * mpPhy;
+ PhySciMsgMpdu * mpPhySciMsgMpdu;
+
+};
+
+
+#endif // PHYSCIMSGMPDUTEST_H
diff --git a/cesar/maximus/phy/inc/PhySciMsgNoise.h b/cesar/maximus/phy/inc/PhySciMsgNoise.h
new file mode 100644
index 0000000000..3afeab00d5
--- /dev/null
+++ b/cesar/maximus/phy/inc/PhySciMsgNoise.h
@@ -0,0 +1,87 @@
+
+#ifndef PHYSCIMSGNOISE_H_
+#define PHYSCIMSGNOISE_H_
+
+#include "PhySciMsg.h"
+
+
+/**
+ * class PhySciMsgNoise
+ */
+
+class PhySciMsgNoise : public PhySciMsg
+{
+
+public:
+
+ // public attributes
+ //
+
+private:
+
+ // private attributes
+ //
+
+protected:
+
+ // protected attributes
+ //
+
+public:
+
+ // Constructors/Destructors
+ //
+
+ /**
+ * Constructor
+ * Creates a PHY message of type NOISE.
+ * @param p_phy a pointer to the PHY interface
+ */
+ PhySciMsgNoise ( IPhy * p_phy );
+
+ /**
+ * Empty Destructor
+ */
+ virtual ~PhySciMsgNoise ( );
+
+ // public methods
+ //
+
+ /**
+ * Sets the PHY SCI message class attributes before transmission
+ * for a PHY message of type NOISE.
+ * @return bool
+ */
+ bool prepare ( );
+
+ // public attribute accessor methods
+ //
+
+ // private attribute accessor methods
+ //
+
+ // protected attribute accessor methods
+ //
+
+private:
+
+ // private methods
+ //
+
+ /**
+ * Initializes the PHY SCI message class attributes:
+ * fills PHY SCI message type,
+ * and specialized SCI msg data length.
+ *
+ */
+ void initAttributes ( );
+
+protected:
+
+ // protected methods
+ //
+
+};
+
+
+#endif /*PHYSCIMSGNOISE_H_*/
diff --git a/cesar/maximus/phy/inc/PhySciMsgNoiseTest.h b/cesar/maximus/phy/inc/PhySciMsgNoiseTest.h
new file mode 100644
index 0000000000..250af709e3
--- /dev/null
+++ b/cesar/maximus/phy/inc/PhySciMsgNoiseTest.h
@@ -0,0 +1,38 @@
+
+#ifndef PHYSCIMSGNOISETEST_H_
+#define PHYSCIMSGNOISETEST_H_
+
+#include <cppunit/TestFixture.h>
+#include <cppunit/extensions/HelperMacros.h>
+
+class PhySciMsgNoise;
+class IPhy;
+class ISci;
+
+
+class PhySciMsgNoiseTest : public CPPUNIT_NS::TestFixture
+{
+
+ CPPUNIT_TEST_SUITE (PhySciMsgNoiseTest);
+ CPPUNIT_TEST (prepareTest);
+ CPPUNIT_TEST_SUITE_END ();
+
+public:
+
+ void setUp (void);
+ void tearDown (void);
+
+protected:
+
+ void prepareTest (void);
+
+private:
+
+ ISci * mpSci;
+ IPhy * mpPhy;
+ PhySciMsgNoise * mpPhySciMsgNoise;
+
+};
+
+
+#endif /*PHYSCIMSGNOISETEST_H_*/
diff --git a/cesar/maximus/phy/inc/PhySciMsgPre.h b/cesar/maximus/phy/inc/PhySciMsgPre.h
new file mode 100644
index 0000000000..5cdce244c1
--- /dev/null
+++ b/cesar/maximus/phy/inc/PhySciMsgPre.h
@@ -0,0 +1,116 @@
+/************************************************************************
+ PhySciMsgPre.h - 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/phy/inc/PhySciMsgPre.h
+**************************************************************************/
+
+#ifndef PHYSCIMSGPRE_H
+#define PHYSCIMSGPRE_H
+
+#include "PhySciMsg.h"
+
+
+/**
+ * class PhySciMsgPre
+ */
+
+class PhySciMsgPre : public PhySciMsg
+{
+
+public:
+
+ // public attributes
+ //
+
+private:
+
+ // private attributes
+ //
+
+protected:
+
+ // protected attributes
+ //
+
+public:
+
+ // Constructors/Destructors
+ //
+
+ /**
+ * Constructor
+ * Creates a PHY message of type PREAMBLE.
+ * @param p_phy_processor a pointer to the PHY interface
+ */
+ PhySciMsgPre ( IPhy * p_phy_processor );
+
+ /**
+ * Empty Destructor
+ */
+ virtual ~PhySciMsgPre ( );
+
+ // public methods
+ //
+
+ /**
+ * Sets the PHY SCI message class attributes before transmission,
+ * and fills specialized SCI msg data length and specialized SCI msg data
+ * for a PHY SCI message of type PREAMBLE.
+ * @param clock_id ID of the Network Clock event received message
+ * @return bool
+ */
+ bool prepare ( Network_Clock_Id clock_id );
+
+ // public attribute accessor methods
+ //
+
+ // private attribute accessor methods
+ //
+
+ // protected attribute accessor methods
+ //
+
+private:
+
+ // private methods
+ //
+
+ /**
+ * Initializes the PHY SCI message class attributes.
+ * Fills PHY SCI message type.
+ */
+ void initAttributes ( );
+
+protected:
+
+ // protected methods
+ //
+
+};
+
+
+#endif // PHYSCIMSGPRE_H
diff --git a/cesar/maximus/phy/inc/PhySciMsgPreTest.h b/cesar/maximus/phy/inc/PhySciMsgPreTest.h
new file mode 100644
index 0000000000..ff00d90436
--- /dev/null
+++ b/cesar/maximus/phy/inc/PhySciMsgPreTest.h
@@ -0,0 +1,38 @@
+
+#ifndef PHYSCIMSGPRETEST_H
+#define PHYSCIMSGPRETEST_H
+
+#include <cppunit/TestFixture.h>
+#include <cppunit/extensions/HelperMacros.h>
+
+class PhySciMsgPre;
+class IPhy;
+class ISci;
+
+
+class PhySciMsgPreTest : public CPPUNIT_NS::TestFixture
+{
+
+ CPPUNIT_TEST_SUITE (PhySciMsgPreTest);
+ CPPUNIT_TEST (prepareTest);
+ CPPUNIT_TEST_SUITE_END ();
+
+public:
+
+ void setUp (void);
+ void tearDown (void);
+
+protected:
+
+ void prepareTest (void);
+
+private:
+
+ ISci * mpSci;
+ IPhy * mpPhy;
+ PhySciMsgPre * mpPhySciMsgPre;
+
+};
+
+
+#endif // PHYSCIMSGPRETEST_H
diff --git a/cesar/maximus/phy/inc/PhySciMsgTest.h b/cesar/maximus/phy/inc/PhySciMsgTest.h
new file mode 100644
index 0000000000..4619423ac9
--- /dev/null
+++ b/cesar/maximus/phy/inc/PhySciMsgTest.h
@@ -0,0 +1,38 @@
+
+#ifndef PHYSCIMSGTEST_H
+#define PHYSCIMSGTEST_H
+
+#include <cppunit/TestFixture.h>
+#include <cppunit/extensions/HelperMacros.h>
+
+class PhySciMsg;
+class PhyProcessor;
+class SciServer;
+
+
+class PhySciMsgTest : public CPPUNIT_NS::TestFixture
+{
+
+ CPPUNIT_TEST_SUITE (PhySciMsgTest);
+ CPPUNIT_TEST (dispatchMsgTest);
+ CPPUNIT_TEST_SUITE_END ();
+
+public:
+
+ void setUp (void);
+ void tearDown (void);
+
+protected:
+
+ void dispatchMsgTest (void);
+
+private:
+
+ PhySciMsg * mpPhySciMsg;
+ PhyProcessor * mpPhyProcessor;
+ SciServer * mpSciServer;
+
+};
+
+
+#endif // PHYSCIMSGTEST_H