00001 // $Id: TGo4ComDisconnectSlave.cxx 478 2009-10-29 12:26:09Z linev $ 00002 //----------------------------------------------------------------------- 00003 // The GSI Online Offline Object Oriented (Go4) Project 00004 // Experiment Data Processing at EE department, GSI 00005 //----------------------------------------------------------------------- 00006 // Copyright (C) 2000- GSI Helmholtzzentrum für Schwerionenforschung GmbH 00007 // Planckstr. 1, 64291 Darmstadt, Germany 00008 // Contact: http://go4.gsi.de 00009 //----------------------------------------------------------------------- 00010 // This software can be used under the license agreements as stated 00011 // in Go4License.txt file which is part of the distribution. 00012 //----------------------------------------------------------------------- 00013 00014 #include "TGo4ComDisconnectSlave.h" 00015 00016 #include "TGo4Log.h" 00017 #include "TGo4Master.h" 00018 00019 TGo4ComDisconnectSlave::TGo4ComDisconnectSlave() 00020 :TGo4TaskHandlerCommand("MRDisconnectSlave","disconnect the specified slave") 00021 { 00022 SetReceiverName("MasterTask"); // sets the receiver name checked by command invoker 00023 // receiver name neednt be class name! 00024 fbIsLocal = kTRUE; 00025 fxSlaveName = "currentslave"; 00026 fbWaitForSlave = kTRUE; 00027 } 00028 TGo4ComDisconnectSlave::~TGo4ComDisconnectSlave() 00029 { 00030 00031 } 00032 00033 00034 Int_t TGo4ComDisconnectSlave::ExeCom() 00035 { 00036 TGo4Master* master=dynamic_cast<TGo4Master*>(fxReceiverBase); 00037 if(master) 00038 { 00039 TGo4Log::Debug(" removing slave %s",fxSlaveName.Data()); 00040 if(!master->DisconnectSlave(fxSlaveName.Data(), fbWaitForSlave)) 00041 { 00042 TGo4Log::Debug(" ComDisconnectSlave: Sorry, the specified slave is not connected "); 00043 return 1; 00044 } 00045 else 00046 { 00047 TGo4Log::Debug(" ComDisconnectSlave: Slave %s is removed ",fxSlaveName.Data()); 00048 return 0; 00049 } 00050 } 00051 else 00052 { 00053 TGo4Log::Debug(" !!! ComRemoveClient ''%s'': NO RECEIVER ERROR!!!",GetName()); 00054 return 1; 00055 } 00056 return -1; 00057 }