SctApiCrateServer.h

00001 #ifndef SCTAPIIPC_SCTAPICRATESERVER_H
00002 #define SCTAPIIPC_SCTAPICRATESERVER_H
00003 
00004 #include <map>
00005 
00006 #include <boost/shared_ptr.hpp>
00007 
00008 #include <ipc/object.h>
00009 #include <ipc/server.h>
00010 #include <mrs/message.h>
00011 #include <omniORB4/poa.h> // For PortableServer::RefCountServantBase
00012 
00013 namespace SctApi {
00014   class SctApi;
00015   class Trigger;
00016   class TriggerImpl;
00017   class Scan;
00018   class IdiosyncrasyServer;
00019 }
00020 
00021 #include "Sct_SctApi/SctApi.hh"
00022 
00028 // other fwd decs:
00029 namespace Sct {
00030   class ApiServerStatusManager;
00031 };
00032 
00036 class SctApiCrateServer : public IPCNamedObject<POA_Sct_SctApi::CrateIPC>,
00037                           public IPCServer {
00038 
00039  public:
00040 
00041   SctApiCrateServer(SctApi::SctApi& api);
00042   virtual ~SctApiCrateServer();     // destructor
00043 
00044  // methods
00045 
00046   virtual Sct_SctApi::Idiosyncrasy_ptr getIdiosyncrasy();
00047   virtual char *getHostName();
00048   virtual void initialiseAll (CORBA::ULong runNumber);
00049   virtual CORBA::Boolean isInitialised ();
00050   virtual void shutdownAll ();
00051   virtual char* status ();
00052   virtual void setRunNumber (CORBA::ULong newRun);
00053   virtual void setScanNumber (CORBA::ULong newScan);
00054   virtual CORBA::ULong getRunNumber ();
00055   virtual CORBA::ULong getScanNumber ();
00056   virtual CORBA::Boolean changeRunMode(Sct_SctApi::RunType mode);
00057   virtual CORBA::Boolean changeEventFormat(Sct_SctApi::EventFormatType format);
00058   virtual void unsetDebugOption (const char * opt);
00059   virtual void setDebugOption (const char * opt);
00060   virtual Sct_SctApi::DebugOptionList * listEnabledDebugOptions ();
00061   virtual Sct_SctApi::DebugOptionList * listDebugOptions ();
00062   virtual void unsetBusy();
00063   virtual void standardRegisterDumpRod (CORBA::ULong rod);
00064   virtual void standardRegisterDumpAll ();
00065   virtual sctConf::ModuleList * getModuleList ();
00066   virtual CORBA::Boolean isRODPresent (CORBA::ULong rod);
00067   virtual void awaitResponse (CORBA::ULong rod);
00068   virtual Sct_SctApi::DataBlock * getResponse (CORBA::ULong rod);
00069   virtual void configureBOC (CORBA::ULong partition, CORBA::ULong crate, CORBA::ULong rod);
00070   virtual Sct_SctApi::BOCMonitorSequence* getBOCMonitorArray(CORBA::ULong partition, CORBA::ULong crate, CORBA::ULong rod);
00071   virtual void flashLED (CORBA::ULong rod, CORBA::UShort slaveNumber, CORBA::ULong period, CORBA::ULong flashes);
00072   virtual void echo (CORBA::ULong rod, const Sct_SctApi::DataBlock & data);
00073   virtual void createDebugPrimList ();
00074   virtual void addDebugPrimList (CORBA::Long index, CORBA::Long id, CORBA::Long version, const Sct_SctApi::DataBlock & body);
00075   virtual void sendDebugPrimList (CORBA::ULong rod);
00076   virtual void sendDebugSlavePrimList (CORBA::ULong rod, CORBA::ULong slave, CORBA::Boolean await, CORBA::Boolean response);
00077   virtual void loadConfiguration (const char * filename);
00078   virtual void storeModuleConfigurations (Sct_SctApi::BankType bank);
00079   virtual void storeBOCConfigurations ();
00080   virtual void configureAllModules ();
00081   virtual void loadModuleConfigurations ();
00082   virtual sctConf::ABCDModule retrieveModule (CORBA::ULong mid);
00083   virtual CORBA::Short dspBlockDump (CORBA::ULong rod, CORBA::Long dspStart, CORBA::Long numWords, CORBA::Long dspNumber);
00084   virtual Sct_SctApi::DataBlock * dspBlockRead (CORBA::ULong rod, CORBA::Long dspStart, CORBA::Long numWords, CORBA::Long dspNumber);
00085   virtual CORBA::Short dspBlockWrite (CORBA::ULong rod, const Sct_SctApi::DataBlock & buffer, CORBA::ULong dspAddress, CORBA::Long dspNumber);
00086   virtual CORBA::ULong dspSingleRead (CORBA::ULong rod, CORBA::ULong dspAddr, CORBA::Long dspNumber);
00087   virtual void dspSingleWrite (CORBA::ULong rod, CORBA::ULong dspAddr, CORBA::ULong val, CORBA::Long dspNumber);
00088   virtual Sct_SctApi::DataBlock * readSlaveDsp (CORBA::ULong rod, CORBA::Short s, CORBA::ULong add, CORBA::ULong words);
00089   virtual CORBA::ULong findModuleSerial (const char * sn);
00090   virtual char * convertToString (CORBA::ULong mid);
00091   virtual CORBA::ULong findModule (CORBA::UShort mur, CORBA::UShort number);
00092   virtual CORBA::ULong findModuleRod (CORBA::ULong partition, CORBA::ULong crate, CORBA::ULong rod, CORBA::ULong channel);
00093   virtual CORBA::ULong findBarrelModule (CORBA::ULong barrel, CORBA::ULong row, CORBA::Short number);
00094   virtual void convertToBarrelModule (CORBA::ULong mid, CORBA::ULong & barrel, CORBA::ULong & row, CORBA::Short & number);
00095   virtual CORBA::ULong findEndcapModule (CORBA::Long disk, CORBA::Long ring, CORBA::Long number);
00096   virtual void convertToEndcapModule (CORBA::ULong mid, CORBA::Long & disk, CORBA::ULong & ring, CORBA::ULong & number);
00097   virtual void getABCDModules (Sct_SctApi::BankType bank);
00098   virtual void getABCDModule (CORBA::ULong mid, Sct_SctApi::BankType bank);
00099   virtual sctConf::ABCDModule getABCDModuleRaw (CORBA::ULong rod, CORBA::ULong slot, Sct_SctApi::BankType bank);
00100  
00101   virtual void setABCDModule (CORBA::ULong mid, const Sct_SctApi::BankList& banks);
00102   virtual void setABCDModules (const Sct_SctApi::BankList& bank);
00103 
00104   virtual void copyABCDModule (CORBA::ULong mid, Sct_SctApi::BankType source, const Sct_SctApi::BankList& to);
00105   virtual void copyABCDModules (Sct_SctApi::BankType source, const Sct_SctApi::BankList& to);
00106   virtual void sendABCDModule (CORBA::ULong mid, Sct_SctApi::BankType bank, CORBA::ULong type);
00107   virtual void sendABCDModules (Sct_SctApi::BankType bank);
00108   virtual void modifyABCDMask (CORBA::ULong mid, const Sct_SctApi::DataBlock & mask);
00109   virtual void modifyABCDTrims (CORBA::ULong mid, const Sct_SctApi::CharBlock & trims);
00110   virtual void modifyABCDRC (CORBA::ULong mid, CORBA::ULong chip, CORBA::UShort index, CORBA::Double p0, CORBA::Double p1, CORBA::Double p2);
00111   virtual void setAutoUpdateBanks(const Sct_SctApi::BankList& banks);
00112   virtual void modifyABCDVar (CORBA::ULong typ, CORBA::Double var);
00113   virtual void modifyABCDModuleVar (CORBA::ULong mid, CORBA::ULong typ, CORBA::Double var);
00114   virtual void modifyABCDChipVar (CORBA::ULong mid, CORBA::ULong chip, CORBA::ULong typ, CORBA::Double var);
00115   virtual void modifyABCDVarAllModulesOneChip (CORBA::ULong chip, CORBA::ULong typ, CORBA::Double var);
00116   virtual void modifyABCDVarROD (CORBA::ULong typ, CORBA::Double var, const Sct_SctApi::BankList& bank);
00117   virtual void modifyABCDModuleVarROD (CORBA::ULong mid, CORBA::ULong typ, CORBA::Double var, const Sct_SctApi::BankList& bank);
00118   virtual void modifyBOCParam (CORBA::ULong partition, CORBA::ULong crate, CORBA::ULong rod, CORBA::ULong channel, CORBA::ULong type, CORBA::ULong val);
00119   virtual void lasersOff ();
00120   virtual void timSetFrequency (CORBA::ULong partition, CORBA::ULong crate, CORBA::Double trigFreq, CORBA::Double rstFreq);
00121   virtual void freeTriggers (CORBA::ULong partition, CORBA::ULong crate);
00122   virtual void stopTriggers (CORBA::ULong partition, CORBA::ULong crate);
00123   virtual void timL1A (CORBA::ULong partition, CORBA::ULong crate);
00124   virtual void timCalL1A (CORBA::ULong partition, CORBA::ULong crate, CORBA::Short delay);
00125   virtual CORBA::Short timReadRegister (CORBA::ULong partition, CORBA::ULong crate, CORBA::Short value);
00126   virtual void timWriteRegister (CORBA::ULong partition, CORBA::ULong crate, CORBA::Short reg, CORBA::Short value);
00127   virtual CORBA::ULong sendTriggers (CORBA::ULong partition, CORBA::ULong crate, Sct_SctApi::Trigger_ptr trig,
00128                      CORBA::ULong ntrigs, CORBA::UShort point_in_scan);
00129   virtual void sendRodTrigger (CORBA::ULong partition, CORBA::ULong crate, CORBA::ULong rod, Sct_SctApi::Trigger_ptr trig);
00130 
00131   virtual void doScan (Sct_SctApi::Scan_ptr thisScan);
00132   virtual void doRawScan (Sct_SctApi::Scan_ptr thisScan, CORBA::Long delay, CORBA::Long width, CORBA::Boolean configure, CORBA::Boolean clockByTwo);
00133   virtual Sct_SctApi::ScanMonitor_ptr startAsyncScan(Sct_SctApi::Scan_ptr thisScan);
00134   virtual CORBA::Boolean hasFinishedScanning();
00135   virtual void abortScan();
00136 
00137   virtual void printBOCSetup (CORBA::ULong rod);
00138   virtual Sct_SctApi::BOCChannelList * currentBOCSetup (CORBA::ULong partition, CORBA::ULong crate, CORBA::ULong rod);
00139   virtual sctConf::BOCGlobalConfig currentBOCRegisters (CORBA::ULong partition, CORBA::ULong crate, CORBA::ULong rod);
00140   virtual void printABCDModule (CORBA::ULong mid);
00141   virtual void printABCDRodModule (CORBA::ULong mid, Sct_SctApi::BankType bank);
00142   virtual void decodeEvent (CORBA::ULong partition, CORBA::ULong crate, CORBA::ULong rod, CORBA::Short sl, CORBA::Short index, CORBA::Boolean extFlag, CORBA::Boolean errorType);
00143   virtual void rawData (CORBA::ULong partition, CORBA::ULong crate, CORBA::ULong rod, CORBA::Long delay, CORBA::Long units, CORBA::Boolean setMask);
00144   virtual void rawDataWithTrigger (CORBA::ULong partition, CORBA::ULong crate, CORBA::ULong rod, CORBA::Long delay, CORBA::Long units, CORBA::Boolean setMask, Sct_SctApi::Trigger_ptr trig);
00145   virtual void sendL1A (CORBA::ULong partition, CORBA::ULong crate, CORBA::ULong rod);
00146   virtual Sct_SctApi::CharBlock * probe (CORBA::ULong partition, CORBA::ULong crate, CORBA::ULong rod);
00147   virtual Sct_SctApi::CharBlock * probeHarness (CORBA::ULong partition, CORBA::ULong crate, CORBA::ULong rod, CORBA::ULong harness);
00148   virtual Sct_SctApi::CharBlock * probeWithTrigger (CORBA::ULong partition, CORBA::ULong crate, CORBA::ULong rod, Sct_SctApi::Trigger_ptr trig);
00149   virtual Sct_SctApi::CharBlock * probeHarnessWithTrigger (CORBA::ULong partition, CORBA::ULong crate, CORBA::ULong rod, Sct_SctApi::Trigger_ptr trig, CORBA::ULong harness);
00150   virtual Sct_SctApi::CharMatrix * probeScanHarnessWithTrigger (CORBA::ULong partition, CORBA::ULong crate, CORBA::ULong rod, Sct_SctApi::Scan_ptr trig, CORBA::ULong harness);
00151   virtual CORBA::Boolean checkAllModulesProbe (const char * chars);
00152   virtual Sct_SctApi::AutoResultList * autoConfigureScan ();
00153   virtual CORBA::ULong getRodSlot (CORBA::ULong rod);
00154   virtual void testLinkOutSelect (CORBA::ULong rod, CORBA::ULong link);
00155   virtual CORBA::ULong testLinkOutRetrieve (CORBA::ULong rod);
00156 
00157  private:
00158   boost::shared_ptr<Sct::ApiServerStatusManager> m_assm;
00159   boost::shared_ptr<SctApi::IdiosyncrasyServer> m_idServer;  
00160  
00161  public:
00162   static SctApiCrateServer *singleton;
00163 
00164   virtual void shutdown();
00165 
00166  protected:
00167   SctApi::SctApi &worker();
00168 
00169   MRSStream mrsStream;
00170   
00171  private:
00172   SctApi::SctApi& api;
00173 };
00174 
00175 #endif

Generated on Mon Feb 6 14:01:28 2006 for SCT DAQ/DCS Software - C++ by  doxygen 1.4.6