Skip to content
Snippets Groups Projects
Commit 720de332 authored by Ruud Overeem's avatar Ruud Overeem
Browse files

Bug 1167: Cleaned up MAC layers. There are less dependancies between the packages now.

parent 34799ec6
No related branches found
No related tags found
No related merge requests found
......@@ -58,10 +58,11 @@ lofar_PVSS(1)
lofar_INTERNAL(LCS/Common, common, , 1, Common/LofarTypes.h,,)
lofar_INTERNAL(LCS/ACC/APS, aps, , 1, APS/ParameterSet.h,,)
lofar_INTERNAL(SAS/OTDB, otdb, , 1, OTDB/OTDBconnection.h,,)
lofar_INTERNAL(MAC/GCF/GCFCommon, gcfcommon, , 1, GCF/GCF_Defines.h,,)
lofar_INTERNAL(MAC/MACIO, MACIO, , 1, MACIO/MACServiceInfo.h,,)
lofar_INTERNAL(MAC/GCF/TM, gcftm, , 1, GCF/TM/GCF_Task.h,,)
lofar_INTERNAL(MAC/GCF/RTDB, rtdb, , 1, GCF/RTDB/RTDB_PropertySet.h,,)
lofar_INTERNAL(MAC/APL/APLCommon, aplcommon, , 1, APL/APLCommon/APL_Defines.h,,)
lofar_INTERNAL(Appl/ApplCommon, applcommon, , 1, ApplCommon/Observation.h,,)
lofar_EXTERNAL(boost,1,boost/date_time/date.hpp, boost_date_time)
lofar_EXTERNAL(pqxx,2.5.5,pqxx/pqxx, pqxx)
lofar_EXTERNAL(pq,,libpq-fe.h, pq, /usr/local/pgsql)
......
......@@ -21,12 +21,12 @@
//# $Id$
#include <lofar_config.h>
#include <Common/LofarLogger.h>
#include <Common/SystemUtil.h>
#include <APS/ParameterSet.h>
#include <GCF/TM/GCF_Protocols.h>
#include <GCF/GCF_ServiceInfo.h>
#include <MACIO/MACServiceInfo.h>
#include <GCF/PVSS/GCF_PVTypes.h>
#include <GCF/Utils.h>
#include <APL/APLCommon/APL_Defines.h>
#include <APL/APLCommon/ControllerDefines.h>
#include <APL/APLCommon/StationInfo.h>
......@@ -38,7 +38,6 @@
#include "MACSchedulerDefines.h"
#include "MACScheduler.h"
using namespace LOFAR::GCF::Common;
using namespace LOFAR::GCF::PVSS;
using namespace LOFAR::GCF::TM;
using namespace LOFAR::GCF::RTDB;
......@@ -93,8 +92,8 @@ MACScheduler::MACScheduler() :
itsObservations.reserve(10); // already reserve memory for 10 observations.
GCF::TM::registerProtocol(CONTROLLER_PROTOCOL, CONTROLLER_PROTOCOL_STRINGS);
GCF::TM::registerProtocol(DP_PROTOCOL, DP_PROTOCOL_STRINGS);
registerProtocol(CONTROLLER_PROTOCOL, CONTROLLER_PROTOCOL_STRINGS);
registerProtocol(DP_PROTOCOL, DP_PROTOCOL_STRINGS);
}
......@@ -365,6 +364,9 @@ GCFEvent::TResult MACScheduler::active_state(GCFEvent& event, GCFPortInterface&
if (msg.successful) {
LOG_DEBUG_STR("Start of " << msg.cntlrName <<
" was successful, waiting for connection.");
#if 0
// TODO: this code became obsolete because the Obscontroller now sends
// CONTROL_CONNECTED events.
// ---
// Ok, controller is really up, update SAS so that obs will not appear in
// in the SAS list again.
......@@ -378,6 +380,7 @@ GCFEvent::TResult MACScheduler::active_state(GCFEvent& event, GCFPortInterface&
TreeStateConv tsc(itsOTDBconnection);
tm.setTreeState(theObs->obsID, tsc.get("queued"));
// ---
#endif
}
else {
LOG_ERROR_STR("Observation controller " << msg.cntlrName <<
......@@ -389,11 +392,9 @@ GCFEvent::TResult MACScheduler::active_state(GCFEvent& event, GCFPortInterface&
break;
}
// TODO: the ObsControls don't send the CONTROL_CONNECT yet.
// so the code is copied to the CONTROL STARTED event for now.
case CONTROL_CONNECT: {
case CONTROL_CONNECTED: {
// The observationController has registered itself at childControl.
CONTROLConnectEvent conEvent(event);
CONTROLConnectedEvent conEvent(event);
LOG_DEBUG_STR(conEvent.cntlrName << " is connected, updating SAS)");
// Ok, controller is really up, update SAS so that obs will not appear in
......
......@@ -24,24 +24,21 @@
#define MACScheduler_H
//# GCF Includes
#include <GCF/RTDB/RTDB_PropertySet.h>
#include <MACIO/GCF_Event.h>
#include <GCF/TM/GCF_Control.h>
#include <GCF/PVSS/GCF_PVTypes.h>
#include <GCF/TM/GCF_Port.h>
#include <GCF/TM/GCF_ITCPort.h>
#include <GCF/TM/GCF_TimerPort.h>
#include <GCF/TM/GCF_Task.h>
#include <GCF/TM/GCF_Event.h>
#include <GCF/RTDB/RTDB_PropertySet.h>
//# local includes
#include <APL/APLCommon/Controller_Protocol.ph>
#include <APL/APLCommon/ChildControl.h>
#include <APL/APLCommon/CTState.h>
#include <APL/APLCommon/Observation.h>
//# Common Includes
#include <Common/lofar_string.h>
#include <Common/lofar_vector.h>
#include <Common/LofarLogger.h>
#include <ApplCommon/Observation.h>
//# ACC Includes
#include <OTDB/OTDBconnection.h>
......@@ -52,15 +49,14 @@
// forward declaration
namespace LOFAR {
using MACIO::GCFEvent;
using GCF::TM::GCFTimerPort;
using GCF::TM::GCFITCPort;
using GCF::TM::GCFPort;
using GCF::TM::GCFEvent;
using GCF::TM::GCFPortInterface;
using GCF::TM::GCFTask;
using GCF::RTDB::RTDBPropertySet;
using APLCommon::ChildControl;
using APLCommon::Observation;
namespace MainCU {
......
......@@ -24,13 +24,13 @@
#include <Common/StreamUtil.h>
#include <APS/ParameterSet.h>
#include <GCF/Utils.h>
#include <GCF/GCF_ServiceInfo.h>
#include <Common/SystemUtil.h>
#include <ApplCommon/Observation.h>
#include <MACIO/MACServiceInfo.h>
#include <APL/APLCommon/APL_Defines.h>
#include <APL/APLCommon/APLUtilities.h>
#include <APL/APLCommon/Controller_Protocol.ph>
#include <APL/APLCommon/StationInfo.h>
#include <APL/APLCommon/Observation.h>
#include <APL/APLCommon/StationInfo.h>
#include <GCF/PVSS/GCF_PVTypes.h>
#include <GCF/RTDB/DP_Protocol.ph>
......@@ -123,8 +123,8 @@ ObservationControl::ObservationControl(const string& cntlrName) :
// need port for timers.
itsTimerPort = new GCFTimerPort(*this, "TimerPort");
GCF::TM::registerProtocol (CONTROLLER_PROTOCOL, CONTROLLER_PROTOCOL_STRINGS);
GCF::TM::registerProtocol (DP_PROTOCOL, DP_PROTOCOL_STRINGS);
registerProtocol (CONTROLLER_PROTOCOL, CONTROLLER_PROTOCOL_STRINGS);
registerProtocol (DP_PROTOCOL, DP_PROTOCOL_STRINGS);
// we cannot use setState right now, wait for propertysets to come online
// setState(CTState::CREATED);
......@@ -265,7 +265,7 @@ GCFEvent::TResult ObservationControl::prepDB_state(GCFEvent& event,
vector<string>::iterator iter = stations.begin();
vector<string>::iterator end = stations.end();
gNrStations = stations.size();
LOG_DEBUG_STR(gNrStations << " are used in this Observation.");
LOG_DEBUG_STR(gNrStations << " stations are used in this Observation.");
string DPobsName(createPropertySetName(PSN_OBSERVATION, getName())+"_Core_"); // observation<nr>_
while (iter != end) {
string stationName(PVSSDatabaseName(*iter));
......@@ -393,22 +393,22 @@ GCFEvent::TResult ObservationControl::starting_state(GCFEvent& event,
itsPropertySet->setValue(PN_OBSCTRL_NYQUISTZONE, GCFPVInteger(theObs.nyquistZone));
itsPropertySet->setValue(PN_OBSCTRL_ANTENNA_ARRAY, GCFPVString(theObs.antennaArray));
itsPropertySet->setValue(PN_OBSCTRL_RECEIVER_LIST, GCFPVString(
APLUtilities::compactedArrayString(globalParameterSet()->
compactedArrayString(globalParameterSet()->
getString("Observation.receiverList"))));
itsPropertySet->setValue(PN_OBSCTRL_SAMPLE_CLOCK, GCFPVInteger(theObs.sampleClock));
itsPropertySet->setValue(PN_OBSCTRL_MEASUREMENT_SET, GCFPVString(
globalParameterSet()->getString("Observation.MSNameMask")));
itsPropertySet->setValue(PN_OBSCTRL_STATION_LIST, GCFPVString(
APLUtilities::compactedArrayString(globalParameterSet()->
compactedArrayString(globalParameterSet()->
getString("Observation.VirtualInstrument.stationList"))));
itsPropertySet->setValue(PN_OBSCTRL_INPUT_NODE_LIST, GCFPVString(
APLUtilities::compactedArrayString(globalParameterSet()->
compactedArrayString(globalParameterSet()->
getString("Observation.VirtualInstrument.inputNodeList"))));
itsPropertySet->setValue(PN_OBSCTRL_BGL_NODE_LIST, GCFPVString(
APLUtilities::compactedArrayString(globalParameterSet()->
compactedArrayString(globalParameterSet()->
getString("Observation.VirtualInstrument.BGLNodeList"))));
itsPropertySet->setValue(PN_OBSCTRL_STORAGE_NODE_LIST, GCFPVString(
APLUtilities::compactedArrayString(globalParameterSet()->
compactedArrayString(globalParameterSet()->
getString("Observation.VirtualInstrument.storageNodeList"))));
// for the beams we have to construct dyn arrays first.
......@@ -582,14 +582,16 @@ GCFEvent::TResult ObservationControl::active_state(GCFEvent& event, GCFPortInter
break;
}
case CONTROL_CONNECT: {
CONTROLConnectEvent msg(event);
LOG_DEBUG_STR("Received CONNECT(" << msg.cntlrName << ")");
case CONTROL_CONNECTED: {
CONTROLConnectedEvent msg(event);
LOG_DEBUG_STR("Received CONNECTED(" << msg.cntlrName << ")");
// TODO: do something usefull with this information!
CONTROLConnectedEvent answer;
answer.cntlrName = msg.cntlrName;
answer.result = CT_RESULT_NO_ERROR;
itsParentPort->send(answer);
// CONTROLConnectedEvent answer;
// answer.cntlrName = msg.cntlrName;
// answer.result = CT_RESULT_NO_ERROR;
// itsParentPort->send(answer);
msg.cntlrName = getName();
itsParentPort->send(msg);
break;
}
......
......@@ -24,12 +24,9 @@
#define ObservationControl_H
//# GCF Includes
#include <MACIO/GCF_Event.h>
#include <GCF/TM/GCF_Control.h>
#include <GCF/RTDB/RTDB_PropertySet.h>
#include <GCF/TM/GCF_Port.h>
#include <GCF/TM/GCF_ITCPort.h>
#include <GCF/TM/GCF_TimerPort.h>
#include <GCF/TM/GCF_Task.h>
#include <GCF/TM/GCF_Event.h>
//# local includes
#include <APL/APLCommon/Controller_Protocol.ph>
......@@ -50,10 +47,10 @@
// forward declaration
namespace LOFAR {
using MACIO::GCFEvent;
using GCF::TM::GCFTimerPort;
using GCF::TM::GCFITCPort;
using GCF::TM::GCFPort;
using GCF::TM::GCFEvent;
using GCF::TM::GCFPortInterface;
using GCF::TM::GCFTask;
using GCF::RTDB::RTDBPropertySet;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment