Changeset 2490 for trunk/MagicSoft/Mars/mraw
- Timestamp:
- 11/10/03 11:14:35 (21 years ago)
- Location:
- trunk/MagicSoft/Mars/mraw
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/MagicSoft/Mars/mraw/MRawSocketRead.cc
r2466 r2490 35 35 // 36 36 // Output Containers: 37 // MRawRunHeader, MRawEvtHeader, MRawEvtData, MRawCrateArray, MRawEvtTime 37 // MRawRunHeader 38 // MRawEvtHeader 39 // MRawEvtData 40 // MRawCrateArray 41 // MRawEvtTime 38 42 // 39 43 ////////////////////////////////////////////////////////////////////////////// … … 58 62 #include "MRawCrateArray.h" 59 63 60 //#include "../mmain/MStatusDisplay.h"64 #include "MStatusDisplay.h" 61 65 62 66 ClassImp(MRawSocketRead); … … 69 73 // 70 74 MRawSocketRead::MRawSocketRead(const char *name, const char *title) 71 : fIn(NULL) 75 : fIn(NULL), fPort(-1) 72 76 { 73 77 fName = name ? name : "MRawSocketRead"; 74 78 fTitle = title ? title : "Task to read DAQ binary data from tcp/ip socket"; 75 79 76 fIn = new MReadSocket (7000);80 fIn = new MReadSocket; 77 81 } 78 82 … … 84 88 { 85 89 delete fIn; 90 } 91 92 // -------------------------------------------------------------------------- 93 // 94 // Open the socket. This blocks until the connection has been established, 95 // an error occured opening the connection or the user requested to 96 // quit the application. 97 // 98 Bool_t MRawSocketRead::OpenSocket() 99 { 100 if (fDisplay) 101 fDisplay->SetStatusLine2(Form("Waiting for connection on port #%d...", fPort)); 102 103 // 104 // Open socket connection 105 // 106 while (1) 107 { 108 // 109 // If port could be opened eveything is ok 110 // 111 if (fIn->Open(fPort)) 112 return kTRUE; 113 114 // 115 // If a MStatusDisplay is attached the user might have 116 // requested to quit the application 117 // 118 if (fDisplay) 119 switch (fDisplay->CheckStatus()) 120 { 121 case MStatusDisplay::kFileClose: 122 case MStatusDisplay::kFileExit: 123 *fLog << inf << "MRawSocketRead::PreProcess - MStatusDisplay triggered exit." << endl; 124 return kFALSE; 125 default: 126 break; 127 } 128 129 // 130 // If an error occured during opening the socket stop 131 // 132 if (fIn->fail()) 133 break; 134 } 135 136 *fLog << err << "ERROR - Cannot open port #" << fPort << endl; 137 return kFALSE; 86 138 } 87 139 … … 104 156 Int_t MRawSocketRead::PreProcess(MParList *pList) 105 157 { 158 if (!OpenSocket()) 159 return kFALSE; 160 106 161 // 107 162 // check if all necessary containers exist in the Parameter list. … … 269 324 270 325 fEvtNumber=fRawEvtHeader->GetDAQEvtNumber(); 271 /* 326 272 327 if (fDisplay) 273 328 fDisplay->SetProgressBarPosition((Float_t)fEvtNumber/fRawRunHeader->GetNumEvents()); 274 */ 329 275 330 return kTRUE; 276 331 } 277 332 278 333 Int_t MRawSocketRead::PostProcess() 279 { /* 334 { 335 // 336 // Close Socket connection 337 // 338 fIn->Close(); 339 280 340 if (fDisplay) 281 341 fDisplay->SetProgressBarPosition(1); 282 */ 342 283 343 return kTRUE; 284 344 } -
trunk/MagicSoft/Mars/mraw/MRawSocketRead.h
r2466 r2490 4 4 #ifndef MARS_MTask 5 5 #include "MTask.h" 6 #endif7 8 #ifndef __IOSFWD__9 #include <iosfwd>10 6 #endif 11 7 … … 33 29 UInt_t fEvtNumber; //! 34 30 35 Int_t PreProcess(MParList *pList); 36 Int_t Process(); 37 Int_t PostProcess(); 31 Int_t fPort; // Port on which we wait for the connection 32 33 Bool_t OpenSocket(); 34 35 Int_t PreProcess(MParList *pList); 36 Int_t Process(); 37 Int_t PostProcess(); 38 38 39 39 public: … … 41 41 ~MRawSocketRead(); 42 42 43 void SetPort(int port) { fPort = port; } 44 43 45 ClassDef(MRawSocketRead, 0) //Task to read DAQ binary data from tcp/ip socket 44 46 };
Note:
See TracChangeset
for help on using the changeset viewer.