/home/fwph/code/wurde/rde/core/capabilities/PTUnit.cpp

Go to the documentation of this file.
00001 
00029 #include <PTUnit.H>
00030 #include <CommsManager.H>
00031 #include <Logger.H>
00032 
00033 // $Id: Type.cpp 68 2007-02-01 17:56:57Z fwph $
00034 
00035 using namespace WURDE;
00036 
00037 PTUnit::PTUnit(const std::string & streamname){
00038        init(streamname,STRAT_NORMAL,"Any");
00039 
00040        //global name will be set later
00041        m_haveGlobalname=false;
00042 }
00043 
00044 PTUnit::PTUnit(const ConnectionStrategy & strategy,const std::string & gblName){
00045        init("Any",strategy,gblName);
00046 
00047        if(strategy==STRAT_NORMAL){
00048               //then the global name really specifies the streamname,
00049               // and the global name should be assigned automagically once we have
00050               // confirmation that the stream has been started
00051               m_haveGlobalname=false;   
00052        }
00053 
00054        m_haveStream=false;
00055        
00056 }
00057 
00058 PTUnit::PTUnit(const std::string &streamname,const std::string &gblName){
00059        init(streamname,STRAT_NORMAL,gblName);
00060 }
00061 
00062 void PTUnit::init(const std::string &streamname,const ConnectionStrategy &strategy,const std::string &gblName){
00063   m_globalname=gblName;
00064   m_streamname=streamname;
00065 
00066   myCOMObject=NULL;
00067   
00068   //  data.source=streamname.c_str();
00069   requests=info;
00070 
00071   m_queue=false;
00072   m_supplier=false;
00073   m_doTimestamp=true;
00074   m_doTag=true;
00075 
00076   m_doPublishData=false;
00077   m_doPublishInfo=false;
00078 
00079   m_initialize=false;
00080   m_strategy=strategy;
00081 
00082   m_haveStream=true;
00083   m_haveGlobalname=true;
00084   m_doPublishData=false;
00085   m_doPublishInfo=false;
00086 
00087   m_doAutoPing=true;
00088 
00089   info.source=streamname;
00090   requests.source=m_globalname;
00091   info.target="Any";
00092   requests.target=streamname;
00093   info.timestamp.now();
00094   requests.timestamp.now();
00095 
00096   m_streamRequest=STAT_NULL;
00097   
00098   m_sourceModule="Unknown";
00099 }
00100 
00101 
00102 PTUnit::~PTUnit(){
00103   myManager=NULL;
00104   if(myCOMObject){
00105 
00106          //      delete myCOMObject;
00107   }
00108 }
00109 
00110 
00111 void PTUnit::activateSupplier(){
00112        if(m_haveStream){
00113               m_supplier=true;
00114               m_globalname=m_streamname;
00115               m_haveGlobalname=true;
00116               m_initialize=false;
00117               if(myCOMObject){
00118                       //                     myCOMObject=new CMUIPCRobotProtocol::CMUIPCPTUnit(m_globalname);
00119                      myCOMObject->setGlobalName(m_globalname);
00120                      myCOMObject->setStreamName(m_streamname);
00121                      myCOMObject->setInfo(&requests);
00122                      myCOMObject->setRequests(&info);
00123                      myCOMObject->setStaging(&data);
00124                      myCOMObject->activateSupplier();
00125                      myCOMObject->setAutoPing(m_doAutoPing);
00126                      myCOMObject->setInfoVector(&m_requestVector);
00127                      myCOMObject->setRequestVector(&m_infoVector);
00128                      myCOMObject->setDataVector(&m_dataVector);
00129 
00130                      data.source=m_streamname;
00131                      info.source=m_streamname;
00132 
00133                      if(m_queue){
00134                             myCOMObject->setQueueMode(true);
00135                      }
00136 
00137               }else{
00138                       g_fatal("Attempted to activateSupplier before setting a COMObject Please just use registerSupplier.");
00139                       exit(-1);
00140               }
00141         if(m_supplier){
00142                 info.pan_upper.setCMode(C_SUPPLIER);
00143         }else{
00144                 info.pan_upper.setCMode(C_CONSUMER);
00145         }
00146         if(m_supplier){
00147                 info.pan_accel.setCMode(C_SUPPLIER);
00148         }else{
00149                 info.pan_accel.setCMode(C_CONSUMER);
00150         }
00151         if(m_supplier){
00152                 info.tilt_accel.setCMode(C_SUPPLIER);
00153         }else{
00154                 info.tilt_accel.setCMode(C_CONSUMER);
00155         }
00156         if(m_supplier){
00157                 info.tilt.setCMode(C_SUPPLIER);
00158         }else{
00159                 info.tilt.setCMode(C_CONSUMER);
00160         }
00161         if(m_supplier){
00162                 info.pan.setCMode(C_SUPPLIER);
00163         }else{
00164                 info.pan.setCMode(C_CONSUMER);
00165         }
00166         if(m_supplier){
00167                 info.tilt_upper.setCMode(C_SUPPLIER);
00168         }else{
00169                 info.tilt_upper.setCMode(C_CONSUMER);
00170         }
00171         if(m_supplier){
00172                 info.tilt_vel.setCMode(C_SUPPLIER);
00173         }else{
00174                 info.tilt_vel.setCMode(C_CONSUMER);
00175         }
00176         if(m_supplier){
00177                 info.pan_vel.setCMode(C_SUPPLIER);
00178         }else{
00179                 info.pan_vel.setCMode(C_CONSUMER);
00180         }
00181        }else{
00182               //this shouldn't happen, but there's no real problem with it.
00183               //it'd just be dumb.
00184               m_initialize=true;
00185               m_supplier=true;
00186        }
00187        
00188        requests=info;
00189 
00190 }
00191 
00192 void PTUnit::activateConsumer(){
00193        std::string localname;
00194        
00195        if(m_haveStream){
00196               m_initialize=false;
00197               m_supplier=false;
00198               if(myCOMObject&&myManager){
00199                       /* global name so we don't have conflicts with the naming service */
00200                       if(!m_haveGlobalname&&m_strategy==STRAT_NORMAL){
00201                               m_globalname=myManager->getName()+PTUNIT+m_streamname+"Consumer";
00202                               m_haveGlobalname=true;
00203                       }
00204 
00205                      myCOMObject->setGlobalName(m_globalname);
00206                      myCOMObject->setStreamName(m_streamname);
00207                      requests.source=m_globalname;
00208                      data.source=m_streamname;
00209                      info.source=m_streamname;
00210                      myCOMObject->setInfo(&info);
00211                      myCOMObject->setRequests(&requests);
00212                      myCOMObject->setStaging(&data);
00213                      myCOMObject->setAutoPing(m_doAutoPing);
00214                      myCOMObject->activateConsumer();
00215                      myCOMObject->setInfoVector(&m_infoVector);
00216                      myCOMObject->setRequestVector(&m_requestVector);
00217                      myCOMObject->setDataVector(&m_dataVector);
00218 
00219                      if(m_queue){
00220                             myCOMObject->setQueueMode(true);
00221                      }
00222               }else{
00223                       g_fatal("Attempted to activateConsumer before setting a COMObject and CommsManager. Please use registerConsumer instead.");
00224                      exit(-1);
00225               }
00226 
00227         if(m_supplier){
00228                 info.pan_upper.setCMode(C_SUPPLIER);
00229         }else{
00230                 info.pan_upper.setCMode(C_CONSUMER);
00231         }
00232         if(m_supplier){
00233                 info.pan_accel.setCMode(C_SUPPLIER);
00234         }else{
00235                 info.pan_accel.setCMode(C_CONSUMER);
00236         }
00237         if(m_supplier){
00238                 info.tilt_accel.setCMode(C_SUPPLIER);
00239         }else{
00240                 info.tilt_accel.setCMode(C_CONSUMER);
00241         }
00242         if(m_supplier){
00243                 info.tilt.setCMode(C_SUPPLIER);
00244         }else{
00245                 info.tilt.setCMode(C_CONSUMER);
00246         }
00247         if(m_supplier){
00248                 info.pan.setCMode(C_SUPPLIER);
00249         }else{
00250                 info.pan.setCMode(C_CONSUMER);
00251         }
00252         if(m_supplier){
00253                 info.tilt_upper.setCMode(C_SUPPLIER);
00254         }else{
00255                 info.tilt_upper.setCMode(C_CONSUMER);
00256         }
00257         if(m_supplier){
00258                 info.tilt_vel.setCMode(C_SUPPLIER);
00259         }else{
00260                 info.tilt_vel.setCMode(C_CONSUMER);
00261         }
00262         if(m_supplier){
00263                 info.pan_vel.setCMode(C_SUPPLIER);
00264         }else{
00265                 info.pan_vel.setCMode(C_CONSUMER);
00266         }
00267        }else{
00268               //no stream, so we can't connect yet. tell the system 
00269               //to initialize as soon as we've got one
00270               m_initialize=true;
00271        }
00272 
00273 }
00274 
00275 void PTUnit::runUpdate(){
00276        if(myCOMObject){
00277 
00278               myCOMObject->runUpdate(m_doPublishData,m_doPublishInfo);
00279               
00280               m_doPublishData=false;
00281               m_doPublishInfo=false;
00282               
00283        }
00284 }
00285 
00286 void PTUnit::setManager(CommsManager *myManager_){
00287 
00288   if(!myCOMObject){
00289     myManager=myManager_;
00290   }
00291 
00292 }
00293 
00294 void PTUnit::setQueueMode(const bool & val){
00295 
00296        if(!myCOMObject){
00297               m_queue=val;
00298        }else if(!m_queue&&val){
00299               m_queue=val;
00300               myCOMObject->setDataVector(&m_dataVector);
00301               myCOMObject->setQueueMode(true);
00302 
00303        }else if(!val&&m_queue){
00304               m_queue=val;
00305               myCOMObject->setQueueMode(false);
00306               while(!m_dataVector.empty()){
00307                      m_dataVector.pop();
00308               }
00309               while(!m_infoVector.empty()){
00310                      m_infoVector.pop();
00311               }
00312               while(!m_requestVector.empty()){
00313                      m_requestVector.pop();
00314               }
00315        }
00316 }
00317 
00318 bool PTUnit::newData(){
00319        if(m_queue){
00320               return !m_dataVector.empty();
00321        }else{
00322               if(myCOMObject){
00323                      return myCOMObject->newData();
00324               }
00325        }
00326 
00327        return false;
00328 }
00329 
00330 bool PTUnit::newInfo(){
00331        if(m_queue){
00332               if(m_supplier){
00333                      return !m_requestVector.empty();
00334               }
00335 
00336               return !m_infoVector.empty();
00337        }else{
00338               if(myCOMObject){
00339                      return myCOMObject->newInfo();
00340               }
00341        }
00342 
00343 
00344        return false;
00345 }
00346 
00347 void PTUnit::publishData(){
00348        if(m_supplier){
00349               if(m_doTimestamp){
00350                      data.timestamp.now();
00351               }
00352               if(m_doTag){
00353                      data.source=m_globalname;
00354               }
00355               if(m_queue){
00356                      PTUnitDataStruct temp;
00357                      temp.source=data.source;
00358 temp.timestamp=data.timestamp;
00359  
00360                      m_dataVector.push(temp);
00361                               //                     m_dataVector.push(data);
00362               }
00363               m_doPublishData=true;
00364        }
00365 }
00366 
00367 void PTUnit::publishInfo(){
00368        if(m_supplier){
00369 
00370               info.mType=MESSAGE_INFO;
00371               if(m_doTimestamp){
00372                      info.timestamp.now();
00373               }
00374 
00375               if(m_doTag){
00376                      info.source=m_globalname;
00377                      info.target="Any";
00378               }
00379 
00380               if(m_queue){
00381                      PTUnitInfoStruct temp;
00382                      
00383                     
00384                      temp.source=info.source;
00385 temp.pan_upper=info.pan_upper;
00386 temp.pan_accel=info.pan_accel;
00387 temp.tilt_accel=info.tilt_accel;
00388 temp.tilt=info.tilt;
00389 temp.pan=info.pan;
00390 temp.mType=info.mType;
00391 temp.tilt_upper=info.tilt_upper;
00392 temp.target=info.target;
00393 temp.timestamp=info.timestamp;
00394 temp.tilt_vel=info.tilt_vel;
00395 temp.pan_vel=info.pan_vel;
00396 
00397                      m_infoVector.push(temp);
00398                     
00399                      //              m_infoVector.push(info);
00400               }
00401 
00402               m_doPublishInfo=true;
00403        }else{
00404 
00405               requests.mType=MESSAGE_REQUEST;
00406               
00407               if(m_doTimestamp){
00408                      requests.timestamp.now();
00409               }
00410 
00411               if(m_doTag){
00412                      requests.source=m_globalname;
00413                      requests.target=m_streamname;
00414               }
00415 
00416               if(m_queue){
00417                      PTUnitInfoStruct temp;
00418         if(m_supplier){
00419                 temp.pan_upper.setCMode(C_SUPPLIER);
00420         }else{
00421                 temp.pan_upper.setCMode(C_CONSUMER);
00422         }
00423         if(m_supplier){
00424                 temp.pan_accel.setCMode(C_SUPPLIER);
00425         }else{
00426                 temp.pan_accel.setCMode(C_CONSUMER);
00427         }
00428         if(m_supplier){
00429                 temp.tilt_accel.setCMode(C_SUPPLIER);
00430         }else{
00431                 temp.tilt_accel.setCMode(C_CONSUMER);
00432         }
00433         if(m_supplier){
00434                 temp.tilt.setCMode(C_SUPPLIER);
00435         }else{
00436                 temp.tilt.setCMode(C_CONSUMER);
00437         }
00438         if(m_supplier){
00439                 temp.pan.setCMode(C_SUPPLIER);
00440         }else{
00441                 temp.pan.setCMode(C_CONSUMER);
00442         }
00443         if(m_supplier){
00444                 temp.tilt_upper.setCMode(C_SUPPLIER);
00445         }else{
00446                 temp.tilt_upper.setCMode(C_CONSUMER);
00447         }
00448         if(m_supplier){
00449                 temp.tilt_vel.setCMode(C_SUPPLIER);
00450         }else{
00451                 temp.tilt_vel.setCMode(C_CONSUMER);
00452         }
00453         if(m_supplier){
00454                 temp.pan_vel.setCMode(C_SUPPLIER);
00455         }else{
00456                 temp.pan_vel.setCMode(C_CONSUMER);
00457         }
00458                      temp.source=requests.source;
00459 temp.pan_upper=requests.pan_upper;
00460 temp.pan_accel=requests.pan_accel;
00461 temp.tilt_accel=requests.tilt_accel;
00462 temp.tilt=requests.tilt;
00463 temp.pan=requests.pan;
00464 temp.mType=requests.mType;
00465 temp.tilt_upper=requests.tilt_upper;
00466 temp.target=requests.target;
00467 temp.timestamp=requests.timestamp;
00468 temp.tilt_vel=requests.tilt_vel;
00469 temp.pan_vel=requests.pan_vel;
00470 
00471                      m_requestVector.push(temp);
00472 
00473                      //              m_requestVector.push(requests);
00474               }
00475 
00476               m_doPublishInfo=true;
00477        }
00478 }
00479 
00480 PTUnitDataStruct PTUnit::getNextData(){
00481        if(m_queue){
00482               PTUnitDataStruct retval;
00483               retval.source="NULL";
00484               if(m_dataVector.empty()){
00485                      return data;
00486               }
00487              
00488               retval.source=m_dataVector.front().source;
00489 retval.timestamp=m_dataVector.front().timestamp;
00490 
00491                        //             retval=m_dataVector.front();
00492               m_dataVector.pop();
00493               data=retval;
00494        
00495               return retval;
00496        }else{
00497               myCOMObject->resetData();
00498               return data;
00499        }
00500 }
00501 
00502 PTUnitInfoStruct PTUnit::getNextInfo(){
00503        if(m_queue){
00504               PTUnitInfoStruct retval;
00505         if(m_supplier){
00506                 retval.pan_upper.setCMode(C_SUPPLIER);
00507         }else{
00508                 retval.pan_upper.setCMode(C_CONSUMER);
00509         }
00510         if(m_supplier){
00511                 retval.pan_accel.setCMode(C_SUPPLIER);
00512         }else{
00513                 retval.pan_accel.setCMode(C_CONSUMER);
00514         }
00515         if(m_supplier){
00516                 retval.tilt_accel.setCMode(C_SUPPLIER);
00517         }else{
00518                 retval.tilt_accel.setCMode(C_CONSUMER);
00519         }
00520         if(m_supplier){
00521                 retval.tilt.setCMode(C_SUPPLIER);
00522         }else{
00523                 retval.tilt.setCMode(C_CONSUMER);
00524         }
00525         if(m_supplier){
00526                 retval.pan.setCMode(C_SUPPLIER);
00527         }else{
00528                 retval.pan.setCMode(C_CONSUMER);
00529         }
00530         if(m_supplier){
00531                 retval.tilt_upper.setCMode(C_SUPPLIER);
00532         }else{
00533                 retval.tilt_upper.setCMode(C_CONSUMER);
00534         }
00535         if(m_supplier){
00536                 retval.tilt_vel.setCMode(C_SUPPLIER);
00537         }else{
00538                 retval.tilt_vel.setCMode(C_CONSUMER);
00539         }
00540         if(m_supplier){
00541                 retval.pan_vel.setCMode(C_SUPPLIER);
00542         }else{
00543                 retval.pan_vel.setCMode(C_CONSUMER);
00544         }
00545               retval.source="NULL";
00546               if(m_supplier){
00547                      if(m_requestVector.empty()){
00548                             return requests;
00549                      }
00550                      retval.source=m_requestVector.front().source;
00551 retval.pan_upper=m_requestVector.front().pan_upper;
00552 retval.pan_accel=m_requestVector.front().pan_accel;
00553 retval.tilt_accel=m_requestVector.front().tilt_accel;
00554 retval.tilt=m_requestVector.front().tilt;
00555 retval.pan=m_requestVector.front().pan;
00556 retval.mType=m_requestVector.front().mType;
00557 retval.tilt_upper=m_requestVector.front().tilt_upper;
00558 retval.target=m_requestVector.front().target;
00559 retval.timestamp=m_requestVector.front().timestamp;
00560 retval.tilt_vel=m_requestVector.front().tilt_vel;
00561 retval.pan_vel=m_requestVector.front().pan_vel;
00562 
00563                               //                     retval=m_requestVector.front();
00564         if(m_supplier){
00565                 retval.pan_upper.setCMode(C_SUPPLIER);
00566         }else{
00567                 retval.pan_upper.setCMode(C_CONSUMER);
00568         }
00569         if(m_supplier){
00570                 retval.pan_accel.setCMode(C_SUPPLIER);
00571         }else{
00572                 retval.pan_accel.setCMode(C_CONSUMER);
00573         }
00574         if(m_supplier){
00575                 retval.tilt_accel.setCMode(C_SUPPLIER);
00576         }else{
00577                 retval.tilt_accel.setCMode(C_CONSUMER);
00578         }
00579         if(m_supplier){
00580                 retval.tilt.setCMode(C_SUPPLIER);
00581         }else{
00582                 retval.tilt.setCMode(C_CONSUMER);
00583         }
00584         if(m_supplier){
00585                 retval.pan.setCMode(C_SUPPLIER);
00586         }else{
00587                 retval.pan.setCMode(C_CONSUMER);
00588         }
00589         if(m_supplier){
00590                 retval.tilt_upper.setCMode(C_SUPPLIER);
00591         }else{
00592                 retval.tilt_upper.setCMode(C_CONSUMER);
00593         }
00594         if(m_supplier){
00595                 retval.tilt_vel.setCMode(C_SUPPLIER);
00596         }else{
00597                 retval.tilt_vel.setCMode(C_CONSUMER);
00598         }
00599         if(m_supplier){
00600                 retval.pan_vel.setCMode(C_SUPPLIER);
00601         }else{
00602                 retval.pan_vel.setCMode(C_CONSUMER);
00603         }
00604                      m_requestVector.pop();
00605                      requests=retval;
00606                      return retval;
00607               }else{
00608                      if(m_infoVector.empty()){
00609                             return info;
00610                      }
00611                      retval.source=m_infoVector.front().source;
00612 retval.pan_upper=m_infoVector.front().pan_upper;
00613 retval.pan_accel=m_infoVector.front().pan_accel;
00614 retval.tilt_accel=m_infoVector.front().tilt_accel;
00615 retval.tilt=m_infoVector.front().tilt;
00616 retval.pan=m_infoVector.front().pan;
00617 retval.mType=m_infoVector.front().mType;
00618 retval.tilt_upper=m_infoVector.front().tilt_upper;
00619 retval.target=m_infoVector.front().target;
00620 retval.timestamp=m_infoVector.front().timestamp;
00621 retval.tilt_vel=m_infoVector.front().tilt_vel;
00622 retval.pan_vel=m_infoVector.front().pan_vel;
00623 
00624         if(m_supplier){
00625                 retval.pan_upper.setCMode(C_SUPPLIER);
00626         }else{
00627                 retval.pan_upper.setCMode(C_CONSUMER);
00628         }
00629         if(m_supplier){
00630                 retval.pan_accel.setCMode(C_SUPPLIER);
00631         }else{
00632                 retval.pan_accel.setCMode(C_CONSUMER);
00633         }
00634         if(m_supplier){
00635                 retval.tilt_accel.setCMode(C_SUPPLIER);
00636         }else{
00637                 retval.tilt_accel.setCMode(C_CONSUMER);
00638         }
00639         if(m_supplier){
00640                 retval.tilt.setCMode(C_SUPPLIER);
00641         }else{
00642                 retval.tilt.setCMode(C_CONSUMER);
00643         }
00644         if(m_supplier){
00645                 retval.pan.setCMode(C_SUPPLIER);
00646         }else{
00647                 retval.pan.setCMode(C_CONSUMER);
00648         }
00649         if(m_supplier){
00650                 retval.tilt_upper.setCMode(C_SUPPLIER);
00651         }else{
00652                 retval.tilt_upper.setCMode(C_CONSUMER);
00653         }
00654         if(m_supplier){
00655                 retval.tilt_vel.setCMode(C_SUPPLIER);
00656         }else{
00657                 retval.tilt_vel.setCMode(C_CONSUMER);
00658         }
00659         if(m_supplier){
00660                 retval.pan_vel.setCMode(C_SUPPLIER);
00661         }else{
00662                 retval.pan_vel.setCMode(C_CONSUMER);
00663         }
00664                      m_infoVector.pop();
00665                      info=retval;
00666                      // the requests struct really should get the values in 
00667                      // info
00668                      requests=info;
00669                      
00670                      return retval;
00671               }
00672        }else{
00673               myCOMObject->resetInfo();
00674               if(m_supplier){
00675         if(m_supplier){
00676                 requests.pan_upper.setCMode(C_SUPPLIER);
00677         }else{
00678                 requests.pan_upper.setCMode(C_CONSUMER);
00679         }
00680         if(m_supplier){
00681                 requests.pan_accel.setCMode(C_SUPPLIER);
00682         }else{
00683                 requests.pan_accel.setCMode(C_CONSUMER);
00684         }
00685         if(m_supplier){
00686                 requests.tilt_accel.setCMode(C_SUPPLIER);
00687         }else{
00688                 requests.tilt_accel.setCMode(C_CONSUMER);
00689         }
00690         if(m_supplier){
00691                 requests.tilt.setCMode(C_SUPPLIER);
00692         }else{
00693                 requests.tilt.setCMode(C_CONSUMER);
00694         }
00695         if(m_supplier){
00696                 requests.pan.setCMode(C_SUPPLIER);
00697         }else{
00698                 requests.pan.setCMode(C_CONSUMER);
00699         }
00700         if(m_supplier){
00701                 requests.tilt_upper.setCMode(C_SUPPLIER);
00702         }else{
00703                 requests.tilt_upper.setCMode(C_CONSUMER);
00704         }
00705         if(m_supplier){
00706                 requests.tilt_vel.setCMode(C_SUPPLIER);
00707         }else{
00708                 requests.tilt_vel.setCMode(C_CONSUMER);
00709         }
00710         if(m_supplier){
00711                 requests.pan_vel.setCMode(C_SUPPLIER);
00712         }else{
00713                 requests.pan_vel.setCMode(C_CONSUMER);
00714         }
00715                      return requests;
00716               }else{
00717         if(m_supplier){
00718                 info.pan_upper.setCMode(C_SUPPLIER);
00719         }else{
00720                 info.pan_upper.setCMode(C_CONSUMER);
00721         }
00722         if(m_supplier){
00723                 info.pan_accel.setCMode(C_SUPPLIER);
00724         }else{
00725                 info.pan_accel.setCMode(C_CONSUMER);
00726         }
00727         if(m_supplier){
00728                 info.tilt_accel.setCMode(C_SUPPLIER);
00729         }else{
00730                 info.tilt_accel.setCMode(C_CONSUMER);
00731         }
00732         if(m_supplier){
00733                 info.tilt.setCMode(C_SUPPLIER);
00734         }else{
00735                 info.tilt.setCMode(C_CONSUMER);
00736         }
00737         if(m_supplier){
00738                 info.pan.setCMode(C_SUPPLIER);
00739         }else{
00740                 info.pan.setCMode(C_CONSUMER);
00741         }
00742         if(m_supplier){
00743                 info.tilt_upper.setCMode(C_SUPPLIER);
00744         }else{
00745                 info.tilt_upper.setCMode(C_CONSUMER);
00746         }
00747         if(m_supplier){
00748                 info.tilt_vel.setCMode(C_SUPPLIER);
00749         }else{
00750                 info.tilt_vel.setCMode(C_CONSUMER);
00751         }
00752         if(m_supplier){
00753                 info.pan_vel.setCMode(C_SUPPLIER);
00754         }else{
00755                 info.pan_vel.setCMode(C_CONSUMER);
00756         }
00757                      // the requests struct really should get the values in 
00758                      // info
00759                      requests=info;
00760                      return info;
00761               }
00762        }
00763 }
00764 
00765 void PTUnit::setStreamName(const std::string & name){
00766 
00767        if(m_supplier&&name=="Any"){
00768               return;
00769        }
00770 
00771        m_streamname=name;
00772        m_haveStream=true;
00773 
00774        if(m_supplier){
00775               m_globalname=name;
00776        }
00777        
00778        if(myCOMObject){
00779               myCOMObject->setStreamName(name);
00780        }
00781 
00782        if(m_initialize){
00783               if(m_supplier){
00784                      activateSupplier();
00785               }else{
00786                      activateConsumer();
00787               }
00788        }
00789 
00790        m_streamRequest=STAT_OKAY;
00791 }
00792 
00793 void PTUnit::setGlobalName(const std::string & name){
00794        
00795        if(name=="Any"){
00796               return;
00797        }
00798 
00799        m_globalname=name;
00800        m_haveGlobalname=true;
00801        if(m_supplier){
00802               m_streamname=name;
00803        }
00804 
00805        if(myCOMObject){
00806               myCOMObject->setGlobalName(name);
00807        }
00808 }
00809 
00810 void PTUnit::doPing(){
00811        if(myCOMObject){
00812               myCOMObject->doPing();
00813        }
00814 }
00815 
00816 void PTUnit::setAutoPing(const bool & val){
00817        m_doAutoPing=val; 
00818        if(myCOMObject){
00819               myCOMObject->setAutoPing(val);
00820        }
00821 }
00822 
00823 

Generated on Thu Feb 1 15:31:53 2007 for WURDE by  doxygen 1.5.1