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

SctApiServer.h

00001 #include <map>
00002 
00003 #include <boost/shared_ptr.hpp>
00004 
00005 #include <ipc/object.h>
00006 #include <is/isinfo.h>
00007 #include <mrs/message.h>
00008 #include <omniORB4/poa.h> // For PortableServer::RefCountServantBase
00009 
00010 namespace SctApi {
00011   class SctApi;
00012   class Trigger;
00013   class TriggerImpl;
00014   class Scan;
00015   class ScanDefImpl;
00016 }
00017 
00018 #include "Sct_SctApi/SctApi.hh"
00019 
00025 // Obsolete?
00026 // extern std::auto_ptr<IPCServer> ipcServer; 
00027 
00028 class ScanServer;
00029 class TriggerServer;
00030 
00034 class SctApiServer : public IPCNamedObject<POA_Sct_SctApi::SctApiIPC> {
00035 
00036  public:
00037 
00038   SctApiServer(SctApi::SctApi& api,
00039            const char* interfaceName);
00040   virtual ~SctApiServer();      // destructor
00041 
00042  // methods
00043 
00044   virtual void initialiseAll (CORBA::ULong runNumber);
00045   virtual void shutdownAll ();
00046   virtual void status ();
00047   virtual void setRunNumber (CORBA::ULong newRun);
00048   virtual void setScanNumber (CORBA::ULong newScan);
00049   virtual CORBA::ULong getRunNumber ();
00050   virtual CORBA::ULong getScanNumber ();
00051   virtual void unsetDebugOption (const char * opt);
00052   virtual void setDebugOption (const char * opt);
00053   virtual Sct_SctApi::DebugOptionList * listEnabledDebugOptions ();
00054   virtual Sct_SctApi::DebugOptionList * listDebugOptions ();
00055   virtual void standardRegisterDump (CORBA::ULong partition, CORBA::ULong crate, CORBA::ULong rod);
00056   virtual void standardRegisterDumpAll ();
00057   virtual sctConf::ModuleList * getModuleList ();
00058   virtual CORBA::Boolean isRODPresent (CORBA::ULong partition, CORBA::ULong crate, CORBA::ULong rod);
00059   virtual void awaitResponse (CORBA::ULong partition, CORBA::ULong crate, CORBA::ULong rod);
00060   virtual Sct_SctApi::DataBlock * getResponse (CORBA::ULong partition, CORBA::ULong crate, CORBA::ULong rod);
00061   virtual void configureBOC (CORBA::ULong partition, CORBA::ULong crate, CORBA::ULong rod);
00062   virtual Sct_SctApi::BOCMonitorSequence* getBOCMonitorArray(CORBA::ULong partition, CORBA::ULong crate, CORBA::ULong rod);
00063   virtual void flashLED (CORBA::ULong partition, CORBA::ULong crate, CORBA::ULong rod, CORBA::UShort slaveNumber, CORBA::ULong period, CORBA::ULong flashes);
00064   virtual void echo (CORBA::ULong partition, CORBA::ULong crate, CORBA::ULong rod, const Sct_SctApi::DataBlock & data);
00065   virtual void createDebugPrimList ();
00066   virtual void addDebugPrimList (CORBA::Long index, CORBA::Long id, CORBA::Long version, const Sct_SctApi::DataBlock & body);
00067   virtual void sendDebugPrimList (CORBA::ULong partition, CORBA::ULong crate, CORBA::ULong rod);
00068   virtual void sendDebugSlavePrimList (CORBA::ULong partition, CORBA::ULong crate, CORBA::ULong rod, CORBA::ULong slave, CORBA::Boolean await, CORBA::Boolean response);
00069   virtual void loadConfiguration (const char * filename);
00070   virtual void storeModuleConfigurations ();
00071   virtual void configureAllModules ();
00072   virtual sctConf::ABCDModule retrieveModule (CORBA::ULong mid);
00073   virtual CORBA::Short dspBlockDump (CORBA::ULong partition, CORBA::ULong crate, CORBA::ULong rod, CORBA::Long dspStart, CORBA::Long numWords, CORBA::Long dspNumber);
00074   virtual Sct_SctApi::DataBlock * dspBlockRead (CORBA::ULong partition, CORBA::ULong crate, CORBA::ULong rod, CORBA::Long dspStart, CORBA::Long numWords, CORBA::Long dspNumber);
00075   virtual CORBA::Short dspBlockWrite (CORBA::ULong partition, CORBA::ULong crate, CORBA::ULong rod, const Sct_SctApi::DataBlock & buffer, CORBA::ULong dspAddress, CORBA::Long dspNumber);
00076   virtual CORBA::ULong dspSingleRead (CORBA::ULong partition, CORBA::ULong crate, CORBA::ULong rod, CORBA::ULong dspAddr, CORBA::Long dspNumber);
00077   virtual void dspSingleWrite (CORBA::ULong partition, CORBA::ULong crate, CORBA::ULong rod, CORBA::ULong dspAddr, CORBA::ULong val, CORBA::Long dspNumber);
00078   virtual Sct_SctApi::DataBlock * readSlaveDsp (CORBA::ULong partition, CORBA::ULong crate, CORBA::ULong rod, CORBA::Short s, CORBA::ULong add, CORBA::ULong words);
00079   virtual CORBA::ULong findModuleSerial (const char * sn);
00080   virtual char * convertToString (CORBA::ULong mid);
00081   virtual CORBA::ULong findModule (CORBA::UShort mur, CORBA::UShort number);
00082   virtual CORBA::ULong findModuleRod (CORBA::ULong partition, CORBA::ULong crate, CORBA::ULong rod, CORBA::ULong channel);
00083   virtual CORBA::ULong findBarrelModule (CORBA::ULong barrel, CORBA::ULong row, CORBA::Short number);
00084   virtual void convertToBarrelModule (CORBA::ULong mid, CORBA::ULong & barrel, CORBA::ULong & row, CORBA::Short & number);
00085   virtual CORBA::ULong findEndcapModule (CORBA::Long disk, CORBA::Long ring, CORBA::Long number);
00086   virtual void convertToEndcapModule (CORBA::ULong mid, CORBA::Long & disk, CORBA::ULong & ring, CORBA::ULong & number);
00087   virtual void getABCDModules (Sct_SctApi::BankType bank);
00088   virtual void getABCDModule (CORBA::ULong mid, Sct_SctApi::BankType bank);
00089   virtual sctConf::ABCDModule getABCDModuleRaw (CORBA::ULong partition, CORBA::ULong crate, CORBA::ULong rod, CORBA::ULong slot, Sct_SctApi::BankType bank);
00090   virtual void setABCDModule (CORBA::ULong mid, Sct_SctApi::BankType bank);
00091   virtual void setABCDModules (Sct_SctApi::BankType bank);
00092   virtual void sendABCDModule (CORBA::ULong mid, Sct_SctApi::BankType bank, CORBA::ULong type);
00093   virtual void sendABCDModules (Sct_SctApi::BankType bank);
00094   virtual void modifyABCDMask (CORBA::ULong mid, const Sct_SctApi::DataBlock & mask);
00095   virtual void modifyABCDTrims (CORBA::ULong mid, const Sct_SctApi::CharBlock & trims);
00096   virtual void modifyABCDRC (CORBA::ULong mid, CORBA::ULong chip, CORBA::UShort index, CORBA::Double p0, CORBA::Double p1, CORBA::Double p2);
00097   virtual void modifyABCDVar (CORBA::ULong typ, CORBA::Double var);
00098   virtual void modifyABCDModuleVar (CORBA::ULong mid, CORBA::ULong typ, CORBA::Double var);
00099   virtual void modifyABCDChipVar (CORBA::ULong mid, CORBA::ULong chip, CORBA::ULong typ, CORBA::Double var);
00100   virtual void modifyABCDVarROD (CORBA::ULong typ, CORBA::Double var, Sct_SctApi::BankType bank);
00101   virtual void modifyABCDModuleVarROD (CORBA::ULong mid, CORBA::ULong typ, CORBA::Double var, Sct_SctApi::BankType bank);
00102   virtual void modifyBOCParam (CORBA::ULong partition, CORBA::ULong crate, CORBA::ULong rod, CORBA::ULong channel, CORBA::ULong type, CORBA::ULong val);
00103   virtual void lasersOff ();
00104   virtual void timSetFrequency (CORBA::ULong partition, CORBA::ULong crate, CORBA::Double trigFreq, CORBA::Double rstFreq);
00105   virtual void freeTriggers (CORBA::ULong partition, CORBA::ULong crate);
00106   virtual void stopTriggers (CORBA::ULong partition, CORBA::ULong crate);
00107   virtual void timL1A (CORBA::ULong partition, CORBA::ULong crate);
00108   virtual void timCalL1A (CORBA::ULong partition, CORBA::ULong crate, CORBA::Short delay);
00109   virtual CORBA::Short timReadRegister (CORBA::ULong partition, CORBA::ULong crate, CORBA::Short value);
00110   virtual void timWriteRegister (CORBA::ULong partition, CORBA::ULong crate, CORBA::Short reg, CORBA::Short value);
00111   virtual void sendTimTrigger (CORBA::ULong partition, CORBA::ULong crate, Sct_SctApi::Trigger_ptr trig);
00112   virtual void sendTrigger (CORBA::ULong partition, CORBA::ULong crate, CORBA::ULong rod, Sct_SctApi::Trigger_ptr trig);
00113   virtual void doScan (Sct_SctApi::Scan_ptr thisScan);
00114   virtual void doRawScan (Sct_SctApi::Scan_ptr thisScan, CORBA::Long delay, CORBA::Long width, CORBA::Boolean configure, CORBA::Boolean clockByTwo);
00115   virtual void printBOCSetup (CORBA::ULong partition, CORBA::ULong crate, CORBA::ULong rod);
00116   virtual Sct_SctApi::BOCChannelList * currentBOCSetup (CORBA::ULong partition, CORBA::ULong crate, CORBA::ULong rod);
00117   virtual sctConf::BOCGlobalConfig currentBOCRegisters (CORBA::ULong partition, CORBA::ULong crate, CORBA::ULong rod);
00118   virtual void printABCDModule (CORBA::ULong mid);
00119   virtual void printABCDRodModule (CORBA::ULong mid, Sct_SctApi::BankType bank);
00120   virtual void decodeEvent (CORBA::ULong partition, CORBA::ULong crate, CORBA::ULong rod, CORBA::Short sl, CORBA::Short index, CORBA::Boolean extFlag, CORBA::Boolean errorType);
00121   virtual void rawData (CORBA::ULong partition, CORBA::ULong crate, CORBA::ULong rod, CORBA::Long delay, CORBA::Long units, CORBA::Boolean setMask);
00122   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);
00123   virtual void sendL1A (CORBA::ULong partition, CORBA::ULong crate, CORBA::ULong rod);
00124   virtual Sct_SctApi::CharBlock * probe (CORBA::ULong partition, CORBA::ULong crate, CORBA::ULong rod);
00125   virtual Sct_SctApi::CharBlock * probeHarness (CORBA::ULong partition, CORBA::ULong crate, CORBA::ULong rod, CORBA::ULong harness);
00126   virtual Sct_SctApi::CharBlock * probeWithTrigger (CORBA::ULong partition, CORBA::ULong crate, CORBA::ULong rod, Sct_SctApi::Trigger_ptr trig);
00127   virtual Sct_SctApi::CharBlock * probeHarnessWithTrigger (CORBA::ULong partition, CORBA::ULong crate, CORBA::ULong rod, Sct_SctApi::Trigger_ptr trig, CORBA::ULong harness);
00128   virtual Sct_SctApi::CharMatrix * probeScanHarnessWithTrigger (CORBA::ULong partition, CORBA::ULong crate, CORBA::ULong rod, Sct_SctApi::Scan_ptr trig, CORBA::ULong harness);
00129   virtual CORBA::Boolean checkAllModulesProbe (const char * chars);
00130   virtual Sct_SctApi::AutoResultList * autoConfigureScan ();
00131   virtual CORBA::ULong getRodSlot (CORBA::ULong partition, CORBA::ULong crate, CORBA::ULong rod);
00132   virtual void testLinkOutSelect (CORBA::ULong partition, CORBA::ULong crate, CORBA::ULong rod, CORBA::ULong link);
00133   virtual CORBA::ULong testLinkOutRetrieve (CORBA::ULong partition, CORBA::ULong crate, CORBA::ULong rod);
00134   virtual void requestHardReset (CORBA::ULong mid);
00135   virtual void requestIVCurve (CORBA::ULong mid, CORBA::Float start, CORBA::Float stop, CORBA::Float step, CORBA::UShort delay, CORBA::Float currentLim);
00136   virtual void setSelect (CORBA::ULong mid, CORBA::Boolean value);
00137   virtual void setSelectAllInCrate (CORBA::Long crate, CORBA::Boolean value);
00138   virtual void changeRunState (CORBA::Long state);
00139   virtual void ddcSetSingleTimeout (CORBA::Short timeout);
00140   virtual CORBA::Short ddcGetSingleTimeout ();
00141   virtual void ddcSetMultipleTimeout (CORBA::Short timeout);
00142   virtual CORBA::Short ddcGetMultipleTimeout ();
00143   virtual void ddcChangeState (CORBA::Long crate, CORBA::Long channel, CORBA::Short state);
00144   virtual void ddcChangeStateAll (CORBA::Long crate, CORBA::Short state);
00145   virtual void ddcLoadConfiguration (CORBA::Long crate, CORBA::Short state);
00146   virtual void ddcHardReset (CORBA::Long crate, CORBA::Long channel);
00147   virtual void ddcHardResetAll (CORBA::Long crate);
00148   virtual CORBA::ULong ddcGetChannelParameterInt (CORBA::Long crate, CORBA::Long channel, const char * name);
00149   virtual CORBA::Float ddcGetChannelParameterFloat (CORBA::Long crate, CORBA::Long channel, const char * name);
00150   virtual char * ddcGetChannelParameterString (CORBA::Long crate, CORBA::Long channel, const char * name);
00151   virtual CORBA::ULong ddcGetCardParameterInt (CORBA::Long crate, CORBA::Long card, const char * name);
00152   virtual CORBA::Float ddcGetCardParameterFloat (CORBA::Long crate, CORBA::Long card, const char * name);
00153   virtual char * ddcGetCardParameterString (CORBA::Long crate, CORBA::Long card, const char * name);
00154   virtual CORBA::ULong ddcGetCrateParameterInt (CORBA::Long crate, const char * name);
00155   virtual CORBA::Float ddcGetCrateParameterFloat (CORBA::Long crate, const char * name);
00156   virtual char * ddcGetCrateParameterString (CORBA::Long crate, const char * name);
00157   virtual void ddcGetCrateParameters (CORBA::Long crate, const Sct_SctApi::NameList & names, Sct_SctApi::NameValueList_out nameValues);
00158   virtual void ddcSetCrateParameterFloat(CORBA::Long crate, const char* name, CORBA::Float value);
00159   virtual void ddcSetCardParameterFloat(CORBA::Long crate, CORBA::Long card, const char* name, CORBA::Float value);
00160   virtual void ddcSetChannelParameterFloat(CORBA::Long crate, CORBA::Long channel, const char* name, CORBA::Float value);
00161   virtual Sct_SctApi::Scan_ptr createScan ();
00162   virtual Sct_SctApi::Scan_ptr getDefaultScan ();
00163   virtual Sct_SctApi::Trigger_ptr createTrigger ();
00164   virtual Sct_SctApi::Trigger_ptr getDefaultTrigger ();
00165   virtual Sct_SctApi::ScanList * knownScans ();
00166 
00167  private:
00168   typedef boost::shared_ptr<ScanServer>  SharedScanServer;
00169 
00170     public:
00171   typedef std::list<SharedScanServer> Scans;
00172   Scans scans;
00173 
00174   ScanServer *defaultScan;
00175   TriggerServer *defaultTrigger;
00176 
00177   static SctApiServer *singleton;
00178 
00179   virtual void shutdown();
00180 
00181  protected:
00182   SctApi::SctApi &worker();
00183 
00184   MRSStream mrsStream;
00185   ISInfoDictionary isDict;
00186   
00187   CORBA::Short ddcSingleTimeout;
00188   CORBA::Short ddcMultipleTimeout;
00189 
00190  private:
00191   SctApi::SctApi& api;
00192 };
00193 
00194 // ILU wrapper for SctApi::Scan class
00195 class ScanServer : public IPCNamedObject<POA_Sct_SctApi::Scan>
00196 {
00197   ScanServer(const ScanServer &);
00198   ScanServer &operator=(const ScanServer &);
00199 
00200   static int nextNumber;
00201 
00202  public:
00203   ScanServer();
00204 
00205   //ScanServer(const ScanServer &copy);
00206 
00207   virtual ~ScanServer();
00208 
00209   virtual void print ();
00210   virtual void configure (CORBA::UShort type, CORBA::Double start, CORBA::Double stop, CORBA::Double step);
00211   virtual void configure2 (CORBA::UShort type, CORBA::Double start, CORBA::Double stop, CORBA::Double step);
00212   virtual Sct_SctApi::Trigger_ptr getTrigger1 ();
00213   virtual Sct_SctApi::Trigger_ptr getTrigger2 ();
00214   virtual void setTrigger1 (Sct_SctApi::Trigger_ptr trig);
00215   virtual void setTrigger2 (Sct_SctApi::Trigger_ptr trig);
00216   virtual void setScanVariable1 (CORBA::UShort var);
00217   virtual void setScanVariable2 (CORBA::UShort var);
00218   virtual CORBA::UShort getScanVariable1 ();
00219   virtual CORBA::UShort getScanVariable2 ();
00220   virtual void setNTrigs (CORBA::ULong nTrigs);
00221   virtual CORBA::ULong getNTrigs ();
00222   virtual Sct_SctApi::Scan::TrigPoints * getVariableTrigs();
00223   virtual void setVariableTrigs(const Sct_SctApi::Scan::TrigPoints& scans);
00224   virtual void setVariableTrigRange(CORBA::UShort start, CORBA::UShort end, CORBA::ULong value);
00225   virtual Sct_SctApi::Scan::ScanPoints * getScanPoints1 ();
00226   virtual Sct_SctApi::Scan::ScanPoints * getScanPoints2 ();
00227   virtual void setScanPoints1 (const Sct_SctApi::Scan::ScanPoints & scans);
00228   virtual void setScanPoints2 (const Sct_SctApi::Scan::ScanPoints & scans);
00229   virtual CORBA::Long getOption (Sct_SctApi::Scan::ScanOptions opt);
00230   virtual void setOption (Sct_SctApi::Scan::ScanOptions opt, CORBA::Long val);
00231   virtual void setScanNumber (CORBA::UShort scan);
00232   virtual void setRunNumber (CORBA::UShort scan);
00233   virtual CORBA::ULong getScanNumber ();
00234   virtual CORBA::ULong getRunNumber ();
00235   virtual sctConf::ModuleList * getModuleList (CORBA::ULong group);
00236   virtual void setModuleList (CORBA::ULong group, const sctConf::ModuleList& newList);
00237   virtual CORBA::ULong getNGroups ();
00238   virtual void setNGroups(CORBA::UShort val);
00239   virtual char * getStartTime();
00240   virtual void setStartTime(const char* t);
00241   virtual char * getEndTime();
00242   virtual void setEndTime(const char* t);
00243 
00244   // Override default freeable
00245 #warning LESTER is guessing that the old destroy method corresponds to the new shutdown, so ... there is ALSO a similar method in the ScanServer class which I have similarly altered.
00246   // LESTER WAS
00247   // virtual void destroy(ipcStatus *_status);
00248   // LESTER BECOMES
00249   virtual void shutdown();
00250 
00251   boost::shared_ptr<SctApi::Scan> m_worker;
00252 
00253  protected:
00254   static std::string getServerName();
00255 
00256  protected:
00257   SctApi::Scan &worker();
00258 
00259 };
00260 
00261 // ILU wrapper for SctApi::Trigger class
00262 class TriggerServer : 
00263       public IPCNamedObject<POA_Sct_SctApi::Trigger>,
00264       public virtual PortableServer::RefCountServantBase {
00265   TriggerServer(const TriggerServer &);
00266   TriggerServer &operator=(const TriggerServer &);
00267   static int nextNumber;
00268  public:
00269   TriggerServer();
00270   explicit TriggerServer(const boost::shared_ptr< ::SctApi::Trigger> other);
00271 
00272   //static TriggerServer *getServer(boost::shared_ptr< ::SctApi::Trigger> trigger);
00273   //static void mapServer(boost::shared_ptr< ::SctApi::Trigger> trigger, TriggerServer *server);
00274 
00275   virtual ~TriggerServer();
00276 
00277   virtual void print ();
00278   virtual void singleL1A ();
00279   virtual void doubleL1A (CORBA::UShort delay);
00280   virtual void delayedL1A (CORBA::UShort delay);
00281   virtual void calL1A (CORBA::UShort delay);
00282   virtual void pulseL1A (CORBA::UShort delay);
00283   virtual void softL1A (CORBA::UShort delay);
00284   virtual void softCalL1A (CORBA::UShort delay, CORBA::UShort delay2);
00285   virtual void softPulseL1A (CORBA::UShort delay, CORBA::UShort delay2);
00286   virtual void softBc (CORBA::UShort delay);
00287   virtual void bcL1A (CORBA::UShort delay);
00288   virtual void bcCalL1A (CORBA::UShort delay, CORBA::UShort delay2);
00289   virtual void bcPulseL1A (CORBA::UShort delay, CORBA::UShort delay2);
00290   virtual void setCommIncr (CORBA::UShort command, CORBA::UShort incr);
00291   virtual void getCommIncr (CORBA::UShort & command, CORBA::UShort & incr);
00292 
00293   virtual Sct_SctApi::RODTriggers * getRODTriggers();
00294 
00295   virtual void shutdown();
00296 
00297  private:
00298   boost::shared_ptr< ::SctApi::Trigger> m_worker;
00299   boost::shared_ptr< ::SctApi::Trigger> worker() { return m_worker; };
00300  protected:
00301   //static std::map<boost::shared_ptr< ::SctApi::Trigger>, TriggerServer *> serverMap;
00302 
00303  private:
00304   static std::string getServerName();
00305 
00306   //SctApi::Trigger &worker();
00307 };
00308 

Generated on Thu Feb 10 02:40:16 2005 for SCT DAQ/DCS Software - C++ by doxygen 1.3.5