Main Page | Modules | Namespace List | Class Hierarchy | Alphabetical List | Data Structures | File List | Namespace Members | Data Fields | Globals | Related Pages

SctApiServer.h

00001 #ifndef SCTAPIIPC_SCTAPISERVER_H
00002 #define SCTAPIIPC_SCTAPISERVER_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 <vector>
00012 
00013 namespace SctApi {
00014   class SctApi;
00015   class Trigger;
00016   class TriggerImpl;
00017   class Scan;
00018   class ScanDefImpl;
00019 }
00020 
00021 #include "Sct_SctApi/SctApi.hh"
00022 #include "CrateStore.h"
00023 
00024 #include "Sct/Addressing.h"
00025 
00031 // other fwd decs:
00032 namespace Sct {
00033   class ScanStatusManager;
00034 };
00035 
00036 // Obsolete?
00037 // extern std::auto_ptr<IPCServer> ipcServer; 
00038 
00039 class ScanServer;
00040 class TriggerServer;
00041 
00045 class SctApiServer : public IPCNamedObject<POA_Sct_SctApi::SctApiIPC>,
00046                      public IPCServer {
00047 
00048  public:
00049   typedef std::vector<Sct_SctApi::CrateIPC_var> CrateIPC_vars;
00050   typedef std::vector<Sct::UCID> CrateDescriptors; // perhaps later will be typedef to CrateIPC_vars, but for the moment will be vector of UCIDs!
00051 
00052   SctApiServer(const CrateDescriptors & apis,
00053                const char* interfaceName);
00054   virtual ~SctApiServer();      // destructor
00055 
00056  // methods
00057 
00058   virtual Sct_SctApi::CrateIPC_ptr getCrate(const Sct::Corba::UCID& ucid);
00059   virtual Sct_SctApi::CrateIPC_ptr getCrateLegacy(CORBA::ULong partition, CORBA::ULong crate);
00060   virtual Sct::Corba::UCIDs* getCrateUCIDs();
00061   virtual void initialiseAll (CORBA::ULong runNumber);
00062   virtual void shutdownAll ();
00063   virtual char* status ();
00064   virtual void setRunNumber (CORBA::ULong newRun);
00065   virtual void setScanNumber (CORBA::ULong newScan);
00066   virtual CORBA::ULong getRunNumber ();
00067   virtual CORBA::ULong getScanNumber ();
00068   virtual CORBA::Boolean changeRunMode(Sct_SctApi::RunType mode);
00069   virtual CORBA::Boolean changeEventFormat(Sct_SctApi::EventFormatType format);
00070   virtual void unsetDebugOption (const char * opt);
00071   virtual void setDebugOption (const char * opt);
00072   virtual Sct_SctApi::DebugOptionList * listEnabledDebugOptions ();
00073   virtual Sct_SctApi::DebugOptionList * listDebugOptions ();
00074   virtual void unsetBusy();
00075   virtual void standardRegisterDumpURID (const Sct::Corba::URID& urid);
00076   virtual void standardRegisterDumpAll ();
00077   virtual sctConf::ModuleList * getModuleList ();
00078   virtual void configureBOC (CORBA::ULong partition, CORBA::ULong crate, CORBA::ULong rod);
00079   virtual Sct_SctApi::BOCMonitorSequence* getBOCMonitorArray(CORBA::ULong partition, CORBA::ULong crate, CORBA::ULong rod);
00080   virtual void loadConfiguration (const char * filename);
00081   virtual void storeModuleConfigurations (Sct_SctApi::BankType bank);
00082   virtual void storeBOCConfigurations ();
00083   virtual void configureAllModules ();
00084   virtual sctConf::ABCDModule retrieveModule (CORBA::ULong mid);
00085 
00086   /* REMOVE
00087   virtual CORBA::Short dspBlockDump (CORBA::ULong partition, CORBA::ULong crate, CORBA::ULong rod, CORBA::Long dspStart, CORBA::Long numWords, CORBA::Long dspNumber);
00088   virtual Sct_SctApi::DataBlock * dspBlockRead (CORBA::ULong partition, CORBA::ULong crate, CORBA::ULong rod, CORBA::Long dspStart, CORBA::Long numWords, CORBA::Long dspNumber);
00089   virtual CORBA::Short dspBlockWrite (CORBA::ULong partition, CORBA::ULong crate, CORBA::ULong rod, const Sct_SctApi::DataBlock & buffer, CORBA::ULong dspAddress, CORBA::Long dspNumber);
00090   virtual CORBA::ULong dspSingleRead (CORBA::ULong partition, CORBA::ULong crate, CORBA::ULong rod, CORBA::ULong dspAddr, CORBA::Long dspNumber);
00091   virtual void dspSingleWrite (CORBA::ULong partition, CORBA::ULong crate, CORBA::ULong rod, CORBA::ULong dspAddr, CORBA::ULong val, CORBA::Long dspNumber);
00092   virtual Sct_SctApi::DataBlock * readSlaveDsp (CORBA::ULong partition, CORBA::ULong crate, CORBA::ULong rod, CORBA::Short s, CORBA::ULong add, CORBA::ULong words);
00093   */
00094   virtual CORBA::ULong findModuleSerial (const char * sn);
00095   virtual char * convertToString (CORBA::ULong mid);
00096   virtual CORBA::ULong findModule (CORBA::UShort mur, CORBA::UShort number);
00097   virtual CORBA::ULong findModuleRod (CORBA::ULong partition, CORBA::ULong crate, CORBA::ULong rod, CORBA::ULong channel);
00098   virtual CORBA::ULong findBarrelModule (CORBA::ULong barrel, CORBA::ULong row, CORBA::Short number);
00099   virtual void convertToBarrelModule (CORBA::ULong mid, CORBA::ULong & barrel, CORBA::ULong & row, CORBA::Short & number);
00100   virtual CORBA::ULong findEndcapModule (CORBA::Long disk, CORBA::Long ring, CORBA::Long number);
00101   virtual void convertToEndcapModule (CORBA::ULong mid, CORBA::Long & disk, CORBA::ULong & ring, CORBA::ULong & number);
00102   virtual void getABCDModules (Sct_SctApi::BankType bank);
00103   virtual void getABCDModule (CORBA::ULong mid, Sct_SctApi::BankType bank);
00104   // REMOVE virtual sctConf::ABCDModule getABCDModuleRaw (CORBA::ULong partition, CORBA::ULong crate, CORBA::ULong rod, CORBA::ULong slot, Sct_SctApi::BankType bank);
00105   virtual void setABCDModule (CORBA::ULong mid, const Sct_SctApi::BankList& banks);
00106   virtual void setABCDModules (const Sct_SctApi::BankList& bank);
00107 
00108   virtual void copyABCDModule (CORBA::ULong mid, Sct_SctApi::BankType source, const Sct_SctApi::BankList& to);
00109   virtual void copyABCDModules (Sct_SctApi::BankType source, const Sct_SctApi::BankList& to);
00110   virtual void sendABCDModule (CORBA::ULong mid, Sct_SctApi::BankType bank, CORBA::ULong type);
00111   virtual void sendABCDModules (Sct_SctApi::BankType bank);
00112   virtual void modifyABCDMask (CORBA::ULong mid, const Sct_SctApi::DataBlock & mask);
00113   virtual void modifyABCDTrims (CORBA::ULong mid, const Sct_SctApi::CharBlock & trims);
00114   virtual void modifyABCDRC (CORBA::ULong mid, CORBA::ULong chip, CORBA::UShort index, CORBA::Double p0, CORBA::Double p1, CORBA::Double p2);
00115   virtual void setAutoUpdateBanks(const Sct_SctApi::BankList& banks);
00116   virtual void modifyABCDVar (CORBA::ULong typ, CORBA::Double var);
00117   virtual void modifyABCDModuleVar (CORBA::ULong mid, CORBA::ULong typ, CORBA::Double var);
00118   virtual void modifyABCDChipVar (CORBA::ULong mid, CORBA::ULong chip, CORBA::ULong typ, CORBA::Double var);
00119   virtual void modifyABCDVarAllModulesOneChip (CORBA::ULong chip, CORBA::ULong typ, CORBA::Double var);
00120   virtual void modifyABCDVarROD (CORBA::ULong typ, CORBA::Double var, const Sct_SctApi::BankList& banks);
00121   virtual void modifyABCDModuleVarROD (CORBA::ULong mid, CORBA::ULong typ, CORBA::Double var, const Sct_SctApi::BankList& banks);
00122   virtual void modifyBOCParam (CORBA::ULong partition, CORBA::ULong crate, CORBA::ULong rod, CORBA::ULong channel, CORBA::ULong type, CORBA::ULong val);
00123   virtual void lasersOff ();
00124   virtual void timSetFrequency (CORBA::ULong partition, CORBA::ULong crate, CORBA::Double trigFreq, CORBA::Double rstFreq);
00125   virtual void freeTriggers (CORBA::ULong partition, CORBA::ULong crate);
00126   virtual void stopTriggers (CORBA::ULong partition, CORBA::ULong crate);
00127   virtual void timL1A (CORBA::ULong partition, CORBA::ULong crate);
00128   virtual void timCalL1A (CORBA::ULong partition, CORBA::ULong crate, CORBA::Short delay);
00129   virtual CORBA::Short timReadRegister (CORBA::ULong partition, CORBA::ULong crate, CORBA::Short value);
00130   virtual void timWriteRegister (CORBA::ULong partition, CORBA::ULong crate, CORBA::Short reg, CORBA::Short value);
00131   CORBA::ULong sendTriggers (CORBA::ULong partition, CORBA::ULong crate, Sct_SctApi::Trigger_ptr trig, CORBA::ULong ntrigs, CORBA::UShort point_in_scan);
00132   virtual void sendRodTrigger (CORBA::ULong partition, CORBA::ULong crate, CORBA::ULong rod, Sct_SctApi::Trigger_ptr trig);
00133 
00134   virtual void doScan (Sct_SctApi::Scan_ptr thisScan);
00135   virtual void doRawScan (Sct_SctApi::Scan_ptr thisScan, CORBA::Long delay, CORBA::Long width, CORBA::Boolean configure, CORBA::Boolean clockByTwo);
00136   virtual Sct_SctApi::ScanMonitor_ptr startAsyncScan(Sct_SctApi::Scan_ptr thisScan);
00137   virtual CORBA::Boolean hasFinishedScanning();
00138   virtual void abortScan();
00139 
00140   //REMOVE virtual void printBOCSetup (CORBA::ULong partition, CORBA::ULong crate, CORBA::ULong rod);
00141   virtual Sct_SctApi::BOCChannelList * currentBOCSetup (CORBA::ULong partition, CORBA::ULong crate, CORBA::ULong rod);
00142   virtual sctConf::BOCGlobalConfig currentBOCRegisters (CORBA::ULong partition, CORBA::ULong crate, CORBA::ULong rod);
00143   virtual void sendL1A (CORBA::ULong partition, CORBA::ULong crate, CORBA::ULong rod);
00144   virtual Sct_SctApi::CharBlock * probe (CORBA::ULong partition, CORBA::ULong crate, CORBA::ULong rod);
00145   virtual Sct_SctApi::CharBlock * probeHarness (CORBA::ULong partition, CORBA::ULong crate, CORBA::ULong rod, CORBA::ULong harness);
00146   virtual Sct_SctApi::CharBlock * probeWithTrigger (CORBA::ULong partition, CORBA::ULong crate, CORBA::ULong rod, Sct_SctApi::Trigger_ptr trig);
00147   virtual Sct_SctApi::CharBlock * probeHarnessWithTrigger (CORBA::ULong partition, CORBA::ULong crate, CORBA::ULong rod, Sct_SctApi::Trigger_ptr trig, CORBA::ULong harness);
00148   virtual Sct_SctApi::CharMatrix * probeScanHarnessWithTrigger (CORBA::ULong partition, CORBA::ULong crate, CORBA::ULong rod, Sct_SctApi::Scan_ptr trig, CORBA::ULong harness);
00149   virtual CORBA::Boolean checkAllModulesProbe (const char * chars);
00150   virtual Sct_SctApi::AutoResultList * autoConfigureScan ();
00151   virtual Sct_SctApi::Scan_ptr createScan ();
00152   virtual Sct_SctApi::Scan_ptr getDefaultScan ();
00153   // Next two NOT USED
00154   virtual Sct_SctApi::Trigger_ptr createTrigger ();
00155   // virtual Sct_SctApi::Trigger_ptr getDefaultTrigger ();
00156   virtual Sct_SctApi::ScanList * knownScans ();
00157 
00158  private:
00159   typedef boost::shared_ptr<ScanServer> SharedScanServer;
00160   boost::shared_ptr<Sct::ScanStatusManager> m_assm;
00161 
00162  public:
00163   typedef std::list<SharedScanServer> Scans;
00164   Scans scans;
00165 
00166   ScanServer *defaultScan;
00167   TriggerServer *defaultTrigger;
00168 
00169   static SctApiServer *singleton;
00170 
00171   virtual void shutdown();
00172 
00173  protected:
00175   Sct_SctApi::CrateIPC_var worker();   // note that this "worker()" method is a stop-gap work-around only needed during the *transition* to multicrate.  For the moment, it returns an "arbitrary" worker, out of all of the registered CrateController workers. It is only for hanger-on methods that do not yet know about multi crate and expect SctApiServer to only know about one worker.  Eventually, every method of this class will have to avoid calling worker() and must instead distribute its work across the appropriate workers in "workers()" ... you were warned.
00176   typedef Sct::CrateStore::Worker Worker;
00177   typedef Sct::CrateStore::Workers Workers;
00178   Workers & workers();
00179 
00180  protected:
00181   MRSStream mrsStream;
00182   
00183   // NOT NEEDED CORBA::Short ddcSingleTimeout;
00184   // NOT NEEDED CORBA::Short ddcMultipleTimeout;
00185 
00186  private:
00187   Sct::CrateStore m_crateStore;
00188   unsigned long m_localRunNumber;
00189   unsigned long m_localScanNumber;
00190 };
00191 
00192 #endif

Generated on Fri Dec 16 19:38:19 2005 for SCT DAQ/DCS Software - C++ by doxygen 1.3.5