summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorburet2007-06-06 09:54:00 +0000
committerburet2007-06-06 09:54:00 +0000
commit04fd6ec52ac81bd626c244170c8849270debce87 (patch)
tree9e83f26e30d0093f73f332223ac433ab3f326683
parent07cb3c6b59897b1a2c4c47439e0ea3ff40de3635 (diff)
Development of dispatch clock SCI msg
git-svn-id: svn+ssh://pessac/svn/cesar/trunk@240 017c9cb6-072f-447c-8318-d5b54f68fe89
-rw-r--r--maximus/common/types/networkclock_types.h2
-rw-r--r--maximus/networkclock/inc/ClockSciMsg.h19
-rw-r--r--maximus/networkclock/inc/NetworkClockEvt.h16
-rw-r--r--maximus/networkclock/inc/NetworkClockEvtList.h6
-rw-r--r--maximus/networkclock/src/ClockSciMsg.cpp86
-rw-r--r--maximus/networkclock/src/NetworkClockEvt.cpp32
-rw-r--r--maximus/networkclock/src/NetworkClockEvtList.cpp45
-rw-r--r--maximus/networkclock/src/NetworkClockEvtListTest.cpp45
-rw-r--r--maximus/networkclock/src/NetworkClockProcessor.cpp3
-rw-r--r--maximus/sci/inc/SciServerTest.h6
-rw-r--r--maximus/sci/src/SciMsg.cpp7
-rw-r--r--maximus/sci/src/SciServerTest.cpp29
-rw-r--r--maximus/system/inc/Station.h13
-rw-r--r--maximus/system/src/Station.cpp22
14 files changed, 272 insertions, 59 deletions
diff --git a/maximus/common/types/networkclock_types.h b/maximus/common/types/networkclock_types.h
index 77b7417f41..e91b05781f 100644
--- a/maximus/common/types/networkclock_types.h
+++ b/maximus/common/types/networkclock_types.h
@@ -18,7 +18,7 @@ enum Network_Clock_Type
};
typedef uint16_t Sci_Station_Id;
-typedef uint16_t Sci_Msg_Id;
+typedef uint16_t Network_Clock_Id;
typedef double Network_Clock_Tick;
diff --git a/maximus/networkclock/inc/ClockSciMsg.h b/maximus/networkclock/inc/ClockSciMsg.h
index 31050348bc..02a77238af 100644
--- a/maximus/networkclock/inc/ClockSciMsg.h
+++ b/maximus/networkclock/inc/ClockSciMsg.h
@@ -34,7 +34,7 @@ The original location of this file is /home/buret/eclipse/maximus/networkclock/i
#include "SciMsg.h"
#include "networkclock_types.h"
-class SciServer;
+class NetworkClockProcessor;
/**
@@ -56,6 +56,7 @@ private:
Network_Clock_Type mSpecializedSciMsgType;
Network_Clock_Header * mpSpecializedSciMsgHeader;
+ NetworkClockProcessor * mpNetworkClockProcessor;
protected:
@@ -73,6 +74,11 @@ public:
ClockSciMsg ( );
/**
+ * Constructor
+ */
+ ClockSciMsg ( NetworkClockProcessor * p_network_clock_processor );
+
+ /**
* Empty Destructor
*/
virtual ~ClockSciMsg ( );
@@ -114,6 +120,17 @@ public:
*/
bool setSpecializedSciMsgHeader ( const Network_Clock_Header * p_specialized_sci_msg_header );
+ /**
+ * @return Network_Clock_Type
+ */
+ Network_Clock_Type getSpecializedSciMsgType ( ) const;
+
+ /**
+ * @return bool
+ * @param type
+ */
+ bool setSpecializedSciMsgType ( const Network_Clock_Type type );
+
// protected attribute accessor methods
//
diff --git a/maximus/networkclock/inc/NetworkClockEvt.h b/maximus/networkclock/inc/NetworkClockEvt.h
index 4325906807..cbb94cd310 100644
--- a/maximus/networkclock/inc/NetworkClockEvt.h
+++ b/maximus/networkclock/inc/NetworkClockEvt.h
@@ -54,7 +54,7 @@ private:
//
Sci_Station_Id mStationId;
- Sci_Msg_Id mMsgId;
+ Network_Clock_Id mId;
Network_Clock_Type mType;
protected:
@@ -76,7 +76,7 @@ public:
* Constructor
*/
NetworkClockEvt ( const Sci_Station_Id station_id,
- const Sci_Msg_Id msg_id,
+ const Network_Clock_Id id,
const Network_Clock_Type type = NETWORK_CLOCK_TYPE_NONE );
/**
@@ -132,17 +132,17 @@ public:
Network_Clock_Type getType ( ) const;
/**
- * Set the value of mMsgId
+ * Set the value of mId
* @return bool
- * @param msg_id the new value of mMsgId
+ * @param id the new value of mId
*/
- bool setMsgId ( const Sci_Msg_Id msg_id );
+ bool setId ( const Network_Clock_Id id );
/**
- * Get the value of mMsgId
- * @return the value of mMsgId
+ * Get the value of mId
+ * @return the value of mId
*/
- Sci_Msg_Id getMsgId ( ) const;
+ Network_Clock_Id getId ( ) const;
// protected attribute accessor methods
//
diff --git a/maximus/networkclock/inc/NetworkClockEvtList.h b/maximus/networkclock/inc/NetworkClockEvtList.h
index fd20b1552c..d6d5f00b68 100644
--- a/maximus/networkclock/inc/NetworkClockEvtList.h
+++ b/maximus/networkclock/inc/NetworkClockEvtList.h
@@ -96,6 +96,12 @@ public:
/**
* @return bool
+ * @param evt_to_remove
+ */
+ bool removeElement ( const NetworkClockEvt * evt_to_remove );
+
+ /**
+ * @return bool
* @param tick_value
* @param evt_to_remove
*/
diff --git a/maximus/networkclock/src/ClockSciMsg.cpp b/maximus/networkclock/src/ClockSciMsg.cpp
index e6ece384dc..90a5823814 100644
--- a/maximus/networkclock/src/ClockSciMsg.cpp
+++ b/maximus/networkclock/src/ClockSciMsg.cpp
@@ -29,9 +29,10 @@ The original location of this file is /home/buret/eclipse/maximus/networkclock/s
**************************************************************************/
#include "ClockSciMsg.h"
-#include "SciServer.h"
+#include "NetworkClockProcessor.h"
#include "Error.h"
+#include <iomanip> // for 'std::setfill' and 'std::setw'
#include <iostream> // for 'cout', 'clog' and 'cerr'
using namespace std;
@@ -42,7 +43,8 @@ using namespace std;
ClockSciMsg::ClockSciMsg ( ):
mSpecializedSciMsgType(NETWORK_CLOCK_TYPE_NONE),
-mpSpecializedSciMsgHeader(NULL)
+mpSpecializedSciMsgHeader(NULL),
+mpNetworkClockProcessor(NULL)
{
clog << "ClockSciMsg()" << endl;
@@ -50,6 +52,25 @@ mpSpecializedSciMsgHeader(NULL)
}
+ClockSciMsg::ClockSciMsg ( NetworkClockProcessor * p_network_clock_processor ):
+mSpecializedSciMsgType(NETWORK_CLOCK_TYPE_NONE),
+mpSpecializedSciMsgHeader(NULL),
+mpNetworkClockProcessor(NULL)
+{
+ clog << "ClockSciMsg(NetworkClockProcessor*)" << endl;
+
+ initAttributes();
+ if (NULL != p_network_clock_processor)
+ {
+ mpNetworkClockProcessor = p_network_clock_processor;
+ }
+ else
+ {
+ throw Error("ClockSciMsg(NetworkClockProcessor*)", "Received NetworkClockProcessor pointer is NULL");
+ }
+}
+
+
void ClockSciMsg::initAttributes ( )
{
clog << "ClockSciMsg::initAttributes" << endl;
@@ -59,6 +80,7 @@ void ClockSciMsg::initAttributes ( )
{
mpSpecializedSciMsgHeader->version = NETWORK_CLOCK_VERSION;
mpSpecializedSciMsgHeader->type = 0;
+ mpSpecializedSciMsgHeader->id = 0;
mpSpecializedSciMsgHeader->flags = 0;
mpSpecializedSciMsgHeader->reserved = 0;
mpSpecializedSciMsgHeader->tick_high = 0;
@@ -100,15 +122,54 @@ SciMsg * ClockSciMsg::create ( ) const
{
clog << "ClockSciMsg::create" << endl;
- return new ClockSciMsg ();
+ return new ClockSciMsg (mpNetworkClockProcessor);
}
bool ClockSciMsg::dispatchMsg ( )
{
clog << "ClockSciMsg::dispatchMsg" << endl;
+ bool bDispatch = false;
- return true;
+ if (NULL != mpNetworkClockProcessor)
+ {
+ if ( (NULL != SciMsg::getSciMsgHeader()) && (NULL != getSpecializedSciMsgHeader()) )
+ {
+ // Recompose tick value at which event has to be inserted or removed
+ //
+ uint64_t tempTickValue = (((uint64_t)getSpecializedSciMsgHeader()->tick_high) << 32)+(uint64_t)getSpecializedSciMsgHeader()->tick_low;
+ clog << "\ttemp tick value = 0x" << hex << setfill('0') << setw(16) << uppercase << tempTickValue << endl;
+ Network_Clock_Tick tickValue = Network_Clock_Tick(tempTickValue);
+ clog << "\ttick value = " << dec << tickValue << endl;
+
+ // Create event to insert or remove
+ //
+ NetworkClockEvt evtToDispatch ( SciMsg::getSciMsgHeader()->station_id,
+ getSpecializedSciMsgHeader()->id,
+ getSpecializedSciMsgType() );
+
+ // According to the clock SCI msg type, dispatch clock SCI msg
+ //
+ if ( NETWORK_CLOCK_TYPE_REMOVE == getSpecializedSciMsgType() )
+ {
+ bDispatch = mpNetworkClockProcessor->removeEvt (tickValue, evtToDispatch);
+ }
+ else
+ {
+ bDispatch = mpNetworkClockProcessor->insertEvt (tickValue, evtToDispatch);
+ }
+ }
+ else
+ {
+ throw Error("ClockSciMsg::dispatchMsg", "Cannot dispatch clock SCI msg because clock SCI msg header and/or SCI msg header pointer is NULL");
+ }
+ }
+ else
+ {
+ throw Error("ClockSciMsg::dispatchMsg", "Initialized NetworkClockProcessor pointer is NULL");
+ }
+
+ return bDispatch;
}
@@ -200,6 +261,23 @@ bool ClockSciMsg::setSpecializedSciMsgHeader ( const Network_Clock_Header * p_sp
}
+Network_Clock_Type ClockSciMsg::getSpecializedSciMsgType ( ) const
+{
+ return mSpecializedSciMsgType;
+}
+
+
+bool ClockSciMsg::setSpecializedSciMsgType ( const Network_Clock_Type type )
+{
+ clog << "ClockSciMsg::setSpecializedSciMsgType" << endl;
+
+ mSpecializedSciMsgType = type;
+ clog << "\tspecialized SCI msg type = " << mSpecializedSciMsgType << endl;
+
+ return true;
+}
+
+
// protected attribute accessor methods
//
diff --git a/maximus/networkclock/src/NetworkClockEvt.cpp b/maximus/networkclock/src/NetworkClockEvt.cpp
index eed35328eb..e3c3127566 100644
--- a/maximus/networkclock/src/NetworkClockEvt.cpp
+++ b/maximus/networkclock/src/NetworkClockEvt.cpp
@@ -43,7 +43,7 @@ using namespace std;
NetworkClockEvt::NetworkClockEvt ( ):
mStationId(0),
-mMsgId(0),
+mId(0),
mType(NETWORK_CLOCK_TYPE_NONE)
{
clog << "NetworkClockEvt()" << endl;
@@ -52,13 +52,13 @@ mType(NETWORK_CLOCK_TYPE_NONE)
}
NetworkClockEvt::NetworkClockEvt ( const Sci_Station_Id station_id,
- const Sci_Msg_Id msg_id,
+ const Network_Clock_Id id,
const Network_Clock_Type type )
{
clog << "NetworkClockEvt(...)" << endl;
setStationId (station_id);
- setMsgId (msg_id);
+ setId (id);
setType (type);
initAttributes();
@@ -70,7 +70,7 @@ NetworkClockEvt::NetworkClockEvt ( const NetworkClockEvt & evt )
clog << "NetworkClockEvt(NetworkClockEvt&)" << endl;
setStationId (evt.getStationId());
- setMsgId (evt.getMsgId());
+ setId (evt.getId());
setType (evt.getType());
initAttributes();
@@ -84,7 +84,7 @@ NetworkClockEvt::NetworkClockEvt ( const NetworkClockEvt * evt )
if (NULL != evt)
{
setStationId (evt->getStationId());
- setMsgId (evt->getMsgId());
+ setId (evt->getId());
setType (evt->getType());
}
else
@@ -105,6 +105,10 @@ void NetworkClockEvt::initAttributes ( )
NetworkClockEvt::~NetworkClockEvt ( )
{
clog << "~NetworkClockEvt" << endl;
+
+ clog << "\tdelete event ";
+ display();
+ clog << endl;
}
@@ -127,7 +131,7 @@ bool NetworkClockEvt::operator== ( const NetworkClockEvt & evt ) const
bool bOperator = false;
if ( (getStationId() == evt.getStationId())
- && (getMsgId() == evt.getMsgId())
+ && (getId() == evt.getId())
&& (getType() == evt.getType()) )
{
bOperator = true;
@@ -142,7 +146,7 @@ NetworkClockEvt & NetworkClockEvt::operator= ( const NetworkClockEvt & evt )
clog << "NetworkClockEvt::operator=" << endl;
setStationId (evt.getStationId());
- setMsgId (evt.getMsgId());
+ setId (evt.getId());
setType (evt.getType());
return *this;
@@ -151,7 +155,7 @@ NetworkClockEvt & NetworkClockEvt::operator= ( const NetworkClockEvt & evt )
void NetworkClockEvt::display ( ) const
{
- clog << "[station id = " << getStationId() << ", msg id = " << getMsgId() << "]";
+ clog << "[station id = " << getStationId() << ", id = " << getId() << ", type = " << getType() << "]";
}
@@ -209,20 +213,20 @@ Network_Clock_Type NetworkClockEvt::getType ( ) const
}
-bool NetworkClockEvt::setMsgId ( const Sci_Msg_Id msg_id )
+bool NetworkClockEvt::setId ( const Network_Clock_Id id )
{
- clog << "NetworkClockEvt::setMsgId" << endl;
+ clog << "NetworkClockEvt::setId" << endl;
- mMsgId = msg_id;
- clog << "\tmsg id = " << mMsgId << endl;
+ mId = id;
+ clog << "\tid = " << mId << endl;
return true;
}
-Sci_Msg_Id NetworkClockEvt::getMsgId ( ) const
+Network_Clock_Id NetworkClockEvt::getId ( ) const
{
- return mMsgId;
+ return mId;
}
diff --git a/maximus/networkclock/src/NetworkClockEvtList.cpp b/maximus/networkclock/src/NetworkClockEvtList.cpp
index ec4be8e3fe..4370f83c77 100644
--- a/maximus/networkclock/src/NetworkClockEvtList.cpp
+++ b/maximus/networkclock/src/NetworkClockEvtList.cpp
@@ -63,7 +63,7 @@ void NetworkClockEvtList::initAttributes ( )
NetworkClockEvtList::~NetworkClockEvtList ( )
{
- clog << "~NetworkClockEvtList()"<< endl;
+ clog << "~NetworkClockEvtList"<< endl;
if (NULL != mpListOfEvts)
{
@@ -122,6 +122,16 @@ bool NetworkClockEvtList::insertElement ( const Network_Clock_Tick tick_value, c
{
if (NULL != mpListOfEvts)
{
+ // If the event to insert already exists in the list, it is an update
+ // 1. Remove this event from the list
+ //
+ if (removeElement(evt_to_insert))
+ {
+ clog << "\tupdate tick at which the event has to be processed" << endl;
+ }
+
+ // 2. Insert the event at the required tick
+ //
mpListOfEvts->insert(Multimap::value_type(tick_value, evt_to_insert)); // return Multimap::iterator
displayListOfEvts (tick_value);
bInsert = true;
@@ -140,6 +150,37 @@ bool NetworkClockEvtList::insertElement ( const Network_Clock_Tick tick_value, c
}
+bool NetworkClockEvtList::removeElement ( const NetworkClockEvt * evt_to_remove )
+{
+ clog << "NetworkClockEvtList::removeElement" << endl;
+ bool bRemove = false;
+ displayListOfEvts();
+
+ if (NULL != mpListOfEvts)
+ {
+ for (Multimap::iterator it = mpListOfEvts->begin(); it != mpListOfEvts->end(); ++it)
+ {
+ if ( !bRemove && (*evt_to_remove == *(it->second)) )
+ {
+ clog << "\tremove element ";
+ it->second->display();
+ clog << " at tick " << it->first << endl;
+ delete(it->second);
+ mpListOfEvts->erase(it);
+ displayListOfEvts();
+ bRemove = true;
+ }
+ }
+ }
+ else
+ {
+ throw Error("NetworkClockEvtList::removeElement", "Initialized Multimap pointer is NULL");
+ }
+
+ return bRemove;
+}
+
+
bool NetworkClockEvtList::removeElement ( const Network_Clock_Tick tick_value, const NetworkClockEvt * evt_to_remove )
{
clog << "NetworkClockEvtList::removeElement" << endl;
@@ -152,7 +193,7 @@ bool NetworkClockEvtList::removeElement ( const Network_Clock_Tick tick_value, c
for (Multimap::iterator it = evtsToRemove.first; it != evtsToRemove.second; ++it)
{
- if ( !bRemove && (evtsToRemove.first != evtsToRemove.second) && (*evt_to_remove == *(it->second)) )
+ if ( !bRemove && (*evt_to_remove == *(it->second)) )
{
clog << "\tremove element ";
it->second->display();
diff --git a/maximus/networkclock/src/NetworkClockEvtListTest.cpp b/maximus/networkclock/src/NetworkClockEvtListTest.cpp
index 2ee1db6d4c..134bf21ebd 100644
--- a/maximus/networkclock/src/NetworkClockEvtListTest.cpp
+++ b/maximus/networkclock/src/NetworkClockEvtListTest.cpp
@@ -42,9 +42,9 @@ void NetworkClockEvtListTest::insertElementTest (void)
if (NULL != evt)
{
- clog << "\tNetworkClockEvtListTest -> NetworkClockEvtList::setMsgId" << endl;
- CPPUNIT_ASSERT_MESSAGE ( CPPUNIT_NS::Message("setMsgId failed"),
- evt->setMsgId(123) );
+ clog << "\tNetworkClockEvtListTest -> NetworkClockEvtList::setId" << endl;
+ CPPUNIT_ASSERT_MESSAGE ( CPPUNIT_NS::Message("setId failed"),
+ evt->setId(123) );
}
else
{
@@ -72,9 +72,9 @@ void NetworkClockEvtListTest::removeElementTest (void)
NetworkClockEvt * evt1 = new NetworkClockEvt (); // will be deleted by NetworkClockList
if (NULL != evt1)
{
- clog << "\tNetworkClockEvtListTest -> NetworkClockEvtList::setMsgId" << endl;
- CPPUNIT_ASSERT_MESSAGE ( CPPUNIT_NS::Message("setMsgId failed"),
- evt1->setMsgId(1) );
+ clog << "\tNetworkClockEvtListTest -> NetworkClockEvtList::setId" << endl;
+ CPPUNIT_ASSERT_MESSAGE ( CPPUNIT_NS::Message("setId failed"),
+ evt1->setId(1) );
}
else
{
@@ -89,7 +89,7 @@ void NetworkClockEvtListTest::removeElementTest (void)
NetworkClockEvt * evt2 = new NetworkClockEvt (); // will be deleted by NetworkClockList
if (NULL != evt2)
{
- evt2->setMsgId(2);
+ evt2->setId(2);
}
mpNetworkClockEvtList->insertElement (3, evt2);
@@ -98,7 +98,7 @@ void NetworkClockEvtListTest::removeElementTest (void)
NetworkClockEvt * evt3 = new NetworkClockEvt (); // will be deleted by NetworkClockList
if (NULL != evt3)
{
- evt3->setMsgId(3);
+ evt3->setId(3);
}
mpNetworkClockEvtList->insertElement (65, evt3);
@@ -107,7 +107,7 @@ void NetworkClockEvtListTest::removeElementTest (void)
NetworkClockEvt * evt4 = new NetworkClockEvt (); // will be deleted by NetworkClockList
if (NULL != evt4)
{
- evt4->setMsgId(4);
+ evt4->setId(4);
}
mpNetworkClockEvtList->insertElement (5, evt4);
@@ -116,7 +116,7 @@ void NetworkClockEvtListTest::removeElementTest (void)
NetworkClockEvt * evt5 = new NetworkClockEvt (); // will be deleted by NetworkClockList
if (NULL != evt5)
{
- evt5->setMsgId(5);
+ evt5->setId(5);
}
mpNetworkClockEvtList->insertElement (687, evt5);
@@ -125,7 +125,7 @@ void NetworkClockEvtListTest::removeElementTest (void)
NetworkClockEvt * evt6 = new NetworkClockEvt (); // will be deleted by NetworkClockList
if (NULL != evt6)
{
- evt6->setMsgId(6);
+ evt6->setId(6);
}
mpNetworkClockEvtList->insertElement (98726, evt6);
@@ -134,7 +134,7 @@ void NetworkClockEvtListTest::removeElementTest (void)
NetworkClockEvt * evt7 = new NetworkClockEvt (); // will be deleted by NetworkClockList
if (NULL != evt7)
{
- evt7->setMsgId(7);
+ evt7->setId(7);
}
mpNetworkClockEvtList->insertElement (0, evt7);
@@ -143,7 +143,7 @@ void NetworkClockEvtListTest::removeElementTest (void)
NetworkClockEvt * evt8 = new NetworkClockEvt (); // will be deleted by NetworkClockList
if (NULL != evt8)
{
- evt8->setMsgId(8);
+ evt8->setId(8);
}
mpNetworkClockEvtList->insertElement (1, evt8);
@@ -152,19 +152,24 @@ void NetworkClockEvtListTest::removeElementTest (void)
NetworkClockEvt * evt9 = new NetworkClockEvt (); // will be deleted by NetworkClockList
if (NULL != evt9)
{
- evt9->setMsgId(9);
+ evt9->setId(9);
}
mpNetworkClockEvtList->insertElement (68, evt9);
-
+
// Insert Event 10
//
NetworkClockEvt * evt10 = new NetworkClockEvt (); // will be deleted by NetworkClockList
if (NULL != evt10)
{
- evt10->setMsgId(10);
+ evt10->setId(10);
}
mpNetworkClockEvtList->insertElement (2, evt10);
+ // Update Event 7
+ //
+ NetworkClockEvt * evt7bis = new NetworkClockEvt (evt7); // will be deleted by NetworkClockList
+ mpNetworkClockEvtList->insertElement (7, evt7bis);
+
clog << "\tNetworkClockEvtListTest -> NetworkClockEvtList::removeElement" << endl;
CPPUNIT_ASSERT_MESSAGE ( CPPUNIT_NS::Message("removeElement failed"),
mpNetworkClockEvtList->removeElement (2, evt1) );
@@ -187,7 +192,7 @@ void NetworkClockEvtListTest::getNextElementTest (void)
if (NULL != evt1)
{
clog << "\tNetworkClockEvtListTest -> NetworkClockEvtList::setName" << endl;
- evt1->setMsgId(1);
+ evt1->setId(1);
}
else
{
@@ -202,7 +207,7 @@ void NetworkClockEvtListTest::getNextElementTest (void)
NetworkClockEvt * evt2 = new NetworkClockEvt (); // will be deleted by NetworkClockList
if (NULL != evt2)
{
- evt2->setMsgId(2);
+ evt2->setId(2);
}
mpNetworkClockEvtList->insertElement (3524, evt2);
@@ -211,7 +216,7 @@ void NetworkClockEvtListTest::getNextElementTest (void)
NetworkClockEvt * evt3 = new NetworkClockEvt (); // will be deleted by NetworkClockList
if (NULL != evt3)
{
- evt3->setMsgId(3);
+ evt3->setId(3);
}
mpNetworkClockEvtList->insertElement (6457, evt3);
@@ -220,7 +225,7 @@ void NetworkClockEvtListTest::getNextElementTest (void)
NetworkClockEvt * evt4 = new NetworkClockEvt (evt3); // will be deleted by NetworkClockList
if (NULL != evt4)
{
- evt4->setMsgId(4);
+ evt4->setId(4);
}
mpNetworkClockEvtList->insertElement (111, evt4);
diff --git a/maximus/networkclock/src/NetworkClockProcessor.cpp b/maximus/networkclock/src/NetworkClockProcessor.cpp
index 4d758ede17..74b1886ee7 100644
--- a/maximus/networkclock/src/NetworkClockProcessor.cpp
+++ b/maximus/networkclock/src/NetworkClockProcessor.cpp
@@ -293,6 +293,7 @@ bool NetworkClockProcessor::processEvtStation ( NetworkClockEvt & evt_to_process
evt_to_process.getType(),
0,
0,
+ 0,
netclockHigh,
netclockLow };
@@ -303,7 +304,7 @@ bool NetworkClockProcessor::processEvtStation ( NetworkClockEvt & evt_to_process
SCI_MSG_TYPE_NETWORK_CLOCK,
sizeof(struct Network_Clock_Header) + sizeof(NetworkClockEvt),
evt_to_process.getStationId(),
- evt_to_process.getMsgId(),
+ evt_to_process.getId(),
netclockHigh,
netclockLow,
0,
diff --git a/maximus/sci/inc/SciServerTest.h b/maximus/sci/inc/SciServerTest.h
index d3cc424bbb..77ffed61b2 100644
--- a/maximus/sci/inc/SciServerTest.h
+++ b/maximus/sci/inc/SciServerTest.h
@@ -8,6 +8,9 @@
#include "SciServer.h"
#include "FunctionCallManager.h"
#include "sci_types.h"
+#include "SystemManager.h"
+#include "PhyProcessor.h"
+#include "NetworkClockProcessor.h"
using namespace std;
@@ -36,6 +39,9 @@ private:
SciServer * mpSciServer;
FunctionCallManager * mpFunctionCallManager;
+ SystemManager * mpSystemManager;
+ PhyProcessor * mpPhyProcessor;
+ NetworkClockProcessor * mpNetworkClockProcessor;
void registerClockSciMsgTest (void);
void registerPhySciMsgTest (void);
diff --git a/maximus/sci/src/SciMsg.cpp b/maximus/sci/src/SciMsg.cpp
index 7da94a0f7f..379a570b7c 100644
--- a/maximus/sci/src/SciMsg.cpp
+++ b/maximus/sci/src/SciMsg.cpp
@@ -222,9 +222,9 @@ void SciMsg::displaySciMsgHeader ( ) const
clog << "\tSCI msg header = " << endl;
clog << hex;
clog << "\t\tmagic_id = 0x" << setfill('0') << setw(8) << uppercase << getSciMsgHeader()->magic_id << endl;
- clog << "\t\tlength = 0x" << setfill('0') << setw(2) << uppercase << getSciMsgHeader()->length << endl;
- clog << "\t\ttype = 0x" << setfill('0') << setw(2) << uppercase << getSciMsgHeader()->type << endl;
- clog << "\t\tversion = 0x" << setfill('0') << setw(4) << uppercase << getSciMsgHeader()->version << endl;
+ clog << "\t\tlength = " << dec << getSciMsgHeader()->length << endl;
+ clog << "\t\ttype = " << dec << getSciMsgHeader()->type << endl;
+ clog << "\t\tversion = 0x" << hex << setfill('0') << setw(4) << uppercase << getSciMsgHeader()->version << endl;
clog << "\t\tmsg_id = 0x" << setfill('0') << setw(4) << uppercase << getSciMsgHeader()->msg_id << endl;
clog << "\t\tstation_id = 0x" << setfill('0') << setw(4) << uppercase << getSciMsgHeader()->station_id << endl;
clog << "\t\tnetclock_high = 0x" << setfill('0') << setw(8) << uppercase << getSciMsgHeader()->netclock_high << endl;
@@ -333,6 +333,7 @@ bool SciMsg::setSciMsgType ( const Sci_Msg_Type type )
clog << "SciMsg::setSciMsgType" << endl;
mSciMsgType = type;
+ clog << "\ttype = " << mSciMsgType << endl;
return true;
}
diff --git a/maximus/sci/src/SciServerTest.cpp b/maximus/sci/src/SciServerTest.cpp
index a1e438c1d8..31213f18b7 100644
--- a/maximus/sci/src/SciServerTest.cpp
+++ b/maximus/sci/src/SciServerTest.cpp
@@ -20,8 +20,14 @@ void SciServerTest::setUp (void)
clog << "\tSciServerTest -> SciServer()" << endl;
mpSciServer = new SciServer ();
- clog << "\tSciServerTest -> FunctionCallManager(SciServer)" << endl;
+ clog << "\tSciServerTest -> FunctionCallManager(SciServer*)" << endl;
mpFunctionCallManager = new FunctionCallManager(mpSciServer);
+ clog << "\tSciServerTest -> SystemManager(SciServer*)" << endl;
+ mpSystemManager = new SystemManager(mpSciServer);
+ clog << "\tSciServerTest -> PhyProcessor(SciServer*)" << endl;
+ mpPhyProcessor = new PhyProcessor(mpSciServer);
+ clog << "\tSciServerTest -> NetworkClockProcessor(...)" << endl;
+ mpNetworkClockProcessor = new NetworkClockProcessor(mpSciServer, mpSystemManager, mpFunctionCallManager, mpPhyProcessor);
}
@@ -29,6 +35,25 @@ void SciServerTest::tearDown (void)
{
clog << "SciServerTest::tearDown" << endl;
+
+ if (NULL != mpNetworkClockProcessor)
+ {
+ clog << "\tSciServerTest -> ~NetworkClockProcessor" << endl;
+ delete mpNetworkClockProcessor;
+ mpNetworkClockProcessor = NULL;
+ }
+ if (NULL != mpPhyProcessor)
+ {
+ clog << "\tSciServerTest -> ~PhyProcessor" << endl;
+ delete mpPhyProcessor;
+ mpPhyProcessor = NULL;
+ }
+ if (NULL != mpSystemManager)
+ {
+ clog << "\tSciServerTest -> ~SystemManager" << endl;
+ delete mpSystemManager;
+ mpSystemManager = NULL;
+ }
if (NULL != mpFunctionCallManager)
{
clog << "\tSciServerTest -> ~FunctionCallManager" << endl;
@@ -141,7 +166,7 @@ void SciServerTest::registerClockSciMsgTest (void)
//
clog << "\tSciServerTest -> SciServer::registerSpecializedSciMsg" << endl;
CPPUNIT_ASSERT_MESSAGE ( CPPUNIT_NS::Message("registerSpecializedSciMsg failed"),
- mpSciServer->registerSpecializedSciMsg(SCI_MSG_TYPE_NETWORK_CLOCK, new ClockSciMsg()) );
+ mpSciServer->registerSpecializedSciMsg(SCI_MSG_TYPE_NETWORK_CLOCK, new ClockSciMsg(mpNetworkClockProcessor)) );
// Check results
//
diff --git a/maximus/system/inc/Station.h b/maximus/system/inc/Station.h
index 4390294d6b..e5358bb83d 100644
--- a/maximus/system/inc/Station.h
+++ b/maximus/system/inc/Station.h
@@ -31,8 +31,8 @@ The original location of this file is /home/buret/eclipse/maximus/system/inc/Sta
#ifndef STATION_H
#define STATION_H
-#include <iostream>
#include <exception>
+#include <iostream> // for 'cout', 'cerr', 'clog' and 'pid_t'
#include "system_types.h"
@@ -115,6 +115,17 @@ public:
//
/**
+ * @return pid_t
+ */
+ pid_t getStationId ( ) const;
+
+ /**
+ * @return bool
+ * @param station_id
+ */
+ bool setStationId ( const pid_t station_id );
+
+ /**
* @return bool
* @param input_file_descriptor
*/
diff --git a/maximus/system/src/Station.cpp b/maximus/system/src/Station.cpp
index 1e381a0c13..742afe2295 100644
--- a/maximus/system/src/Station.cpp
+++ b/maximus/system/src/Station.cpp
@@ -37,7 +37,6 @@ The original location of this file is /home/buret/eclipse/maximus/system/src/Sta
#include "StationConfiguration.h"
#include "Error.h"
-#include <iostream> // for 'cout', 'cerr' and 'clog'
using namespace std;
@@ -160,7 +159,8 @@ bool Station::operator== ( const Station & station ) const
if ( (getStationStatus() == station.getStationStatus())
&& (getStationConfiguration() == station.getStationConfiguration())
&& (getInputFileDescriptor() == station.getInputFileDescriptor())
- && (getOutputFileDescriptor() == station.getOutputFileDescriptor()) )
+ && (getOutputFileDescriptor() == station.getOutputFileDescriptor())
+ && (getStationId() == station.getStationId()) )
{
bOperator = true;
}
@@ -176,6 +176,7 @@ Station & Station::operator= ( const Station & station )
if ( (!setInputFileDescriptor (station.getInputFileDescriptor()))
|| (!setOutputFileDescriptor (station.getOutputFileDescriptor()))
+ || (!setStationId (station.getStationId()))
|| (!setStationStatus (station.getStationStatus()))
|| (!setStationConfiguration (station.getStationConfiguration())) )
{
@@ -198,6 +199,23 @@ Station & Station::operator= ( const Station & station )
//
+pid_t Station::getStationId ( ) const
+{
+ return mPid;
+}
+
+
+bool Station::setStationId ( const pid_t station_id )
+{
+ clog << "Station::setStationId" << endl;
+
+ mPid = station_id;
+ clog << "\tstation id = " << mPid << endl;
+
+ return true;
+}
+
+
bool Station::setInputFileDescriptor ( const File_Descriptor input_file_descriptor )
{
clog << "Station::setInputFileDescriptor" << endl;