00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018 import sys
00019 sys.path.insert(1,".")
00020
00021 import RTC
00022 import OpenRTM
00023 import OpenRTM_aist
00024
00025
00026
00027
00028
00029
00030 class ComponentObserverConsumer(OpenRTM_aist.SdoServiceConsumerBase):
00031 """
00032 """
00033
00034
00035
00036
00037
00038
00039
00040
00041 def __init__(self):
00042 self._rtobj = None
00043 self._profile = None
00044 self._observer = OpenRTM_aist.CorbaConsumer(interfaceType=OpenRTM.ComponentObserver)
00045 self._observed = [ False for i in range(OpenRTM.STATUS_KIND_NUM._v)]
00046
00047 self._compstat = self.CompStatMsg(self)
00048 self._portaction = self.PortAction(self)
00049 self._ecaction = self.ECAction(self)
00050 self._configMsg = self.ConfigAction(self)
00051
00052 self._interval = OpenRTM_aist.TimeValue(1, 0)
00053 self._heartbeat = False
00054 self._hblistenerid = None
00055
00056
00057 self._timer = OpenRTM_aist.Timer(self._interval)
00058 return
00059
00060
00061
00062
00063
00064
00065
00066
00067
00068 def __del__(self):
00069 self.unsetComponentProfileListeners()
00070 self.unsetComponentStatusListeners()
00071 self.unsetPortProfileListeners()
00072 self.unsetExecutionContextListeners()
00073 self.unsetConfigurationListeners()
00074 self.unsetHeartbeat()
00075 del self._timer
00076 return
00077
00078
00079
00080
00081
00082
00083
00084
00085
00086
00087
00088 def init(self, rtobj, profile):
00089 if not self._observer.setObject(profile.service):
00090
00091 return False
00092
00093 self._rtobj = rtobj
00094 self._profile = profile
00095 prop = OpenRTM_aist.Properties()
00096 OpenRTM_aist.NVUtil.copyToProperties(prop, profile.properties)
00097 self.setHeartbeat(prop)
00098 self.setListeners(prop)
00099 return True
00100
00101
00102
00103
00104
00105
00106
00107
00108
00109
00110 def reinit(self, profile):
00111 if not self._observer._ptr()._is_equivalent(profile.service):
00112 tmp = OpenRTM_aist.CorbaConsumer(interfaceType=OpenRTM.ComponentObserver)
00113 if not tmp.setObject(profile.service):
00114 return False
00115 self._observer.releaseObject()
00116 self._observer.setObject(profile.service)
00117
00118 self._profile= profile
00119 prop = OpenRTM_aist.Properties()
00120 OpenRTM_aist.NVUtil.copyToProperties(prop, profile.properties)
00121 self.setHeartbeat(prop)
00122 self.setListeners(prop)
00123 return True
00124
00125
00126
00127
00128
00129
00130
00131
00132
00133
00134 def getProfile(self):
00135 return self._profile
00136
00137
00138
00139
00140
00141
00142
00143
00144
00145
00146 def finalize(self):
00147 self.unsetComponentProfileListeners()
00148 self.unsetComponentStatusListeners()
00149 self.unsetPortProfileListeners()
00150 self.unsetExecutionContextListeners()
00151 self.unsetConfigurationListeners()
00152 self.unsetHeartbeat()
00153 return
00154
00155
00156
00157
00158
00159
00160
00161
00162
00163
00164 def updateStatus(self, statuskind, msg):
00165 try:
00166 self._observer._ptr().update_status(statuskind, msg)
00167 except:
00168 self._rtobj.removeSdoServiceConsumer(self._profile.id)
00169 return
00170
00171
00172
00173
00174
00175
00176
00177
00178
00179 def toString(self, kind):
00180 kinds = ["COMPONENT_PROFILE",
00181 "RTC_STATUS",
00182 "EC_STATUS",
00183 "PORT_PROFILE",
00184 "CONFIGURATION",
00185 "HEARTBEAT"]
00186 if kind._v < OpenRTM.STATUS_KIND_NUM._v:
00187 return kinds[kind._v]
00188 return ""
00189
00190
00191
00192
00193
00194
00195
00196
00197
00198
00199 def setListeners(self, prop):
00200 if not prop.getProperty("observed_status"):
00201 prop.setProperty("observed_status", "ALL")
00202
00203 observed_ = [s.strip() for s in prop.getProperty("observed_status").split(",")]
00204 flags_ = [ False for i in range(OpenRTM.STATUS_KIND_NUM._v) ]
00205
00206 for i in range(len(observed_)):
00207 observed_[i] = observed_[i].upper()
00208 if observed_[i] == "COMPONENT_PROFILE":
00209 flags_[OpenRTM.COMPONENT_PROFILE._v] = True
00210 elif observed_[i] == "RTC_STATUS":
00211 flags_[OpenRTM.RTC_STATUS._v] = True
00212 elif observed_[i] == "EC_STATUS":
00213 flags_[OpenRTM.EC_STATUS._v] = True
00214 elif observed_[i] == "PORT_PROFILE":
00215 flags_[OpenRTM.PORT_PROFILE._v] = True
00216 elif observed_[i] == "CONFIGURATION":
00217 flags_[OpenRTM.CONFIGURATION._v] = True
00218 elif observed_[i] == "ALL":
00219 for j in range(OpenRTM.STATUS_KIND_NUM._v):
00220 flags_[j] = True
00221 break
00222
00223 self.switchListeners(flags_[OpenRTM.COMPONENT_PROFILE._v],
00224 self._observed,
00225 OpenRTM.COMPONENT_PROFILE._v,
00226 self.setComponentProfileListeners,
00227 self.unsetComponentProfileListeners)
00228
00229 self.switchListeners(flags_[OpenRTM.RTC_STATUS._v],
00230 self._observed,
00231 OpenRTM.RTC_STATUS._v,
00232 self.setComponentStatusListeners,
00233 self.unsetComponentStatusListeners)
00234
00235 self.switchListeners(flags_[OpenRTM.EC_STATUS._v],
00236 self._observed,
00237 OpenRTM.EC_STATUS._v,
00238 self.setExecutionContextListeners,
00239 self.unsetExecutionContextListeners)
00240
00241 self.switchListeners(flags_[OpenRTM.PORT_PROFILE._v],
00242 self._observed,
00243 OpenRTM.PORT_PROFILE._v,
00244 self.setPortProfileListeners,
00245 self.unsetPortProfileListeners)
00246
00247 self.switchListeners(flags_[OpenRTM.CONFIGURATION._v],
00248 self._observed,
00249 OpenRTM.CONFIGURATION._v,
00250 self.setConfigurationListeners,
00251 self.unsetConfigurationListeners)
00252
00253 return
00254
00255
00256
00257
00258
00259
00260
00261
00262
00263
00264
00265
00266 def switchListeners(self, next, pre, pre_idx, setfunc, unsetfunc):
00267 if (not pre[pre_idx]) and next:
00268 setfunc()
00269 pre[pre_idx] = True
00270 elif pre[pre_idx] and (not next):
00271 unsetfunc()
00272 pre[pre_idx] = False
00273
00274 return
00275
00276
00277
00278
00279
00280
00281
00282
00283
00284
00285
00286
00287
00288 def heartbeat(self):
00289 self.updateStatus(OpenRTM.HEARTBEAT, "")
00290 return
00291
00292
00293
00294
00295
00296
00297
00298
00299
00300
00301 def setHeartbeat(self, prop):
00302 if OpenRTM_aist.toBool(prop.getProperty("heartbeat.enable"), "YES", "NO", False):
00303 interval_ = prop.getProperty("heartbeat.interval")
00304 if not interval_:
00305 self._interval.set_time(1.0)
00306 else:
00307 tmp_ = float(interval_)
00308 self._interval.set_time(tmp_)
00309
00310 tm_ = self._interval
00311 self._hblistenerid = self._timer.registerListenerObj(self,
00312 ComponentObserverConsumer.heartbeat,
00313 tm_)
00314 if not self._heartbeat:
00315 self._timer.start()
00316 self._heartbeat = True
00317
00318 else:
00319 if self._heartbeat and self._hblistenerid:
00320 self.unsetHeartbeat()
00321
00322 return
00323
00324
00325
00326
00327
00328
00329
00330
00331
00332
00333 def unsetHeartbeat(self):
00334 self._timer.unregisterListener(self._hblistenerid)
00335 self._hblistenerid = 0
00336 self._timer.stop()
00337 self._heartbeat = False
00338 return
00339
00340
00341
00342
00343
00344
00345
00346
00347
00348
00349
00350
00351
00352 def setComponentStatusListeners(self):
00353 postclistener_ = OpenRTM_aist.PostComponentActionListenerType
00354 if not self._compstat.activatedListener:
00355 self._compstat.activatedListener = \
00356 self._rtobj.addPostComponentActionListener(postclistener_.POST_ON_ACTIVATED,
00357 self._compstat.onActivated)
00358 if not self._compstat.deactivatedListener:
00359 self._compstat.deactivatedListener = \
00360 self._rtobj.addPostComponentActionListener(postclistener_.POST_ON_DEACTIVATED,
00361 self._compstat.onDeactivated)
00362
00363 if not self._compstat.resetListener:
00364 self._compstat.resetListener = \
00365 self._rtobj.addPostComponentActionListener(postclistener_.POST_ON_RESET,
00366 self._compstat.onReset)
00367
00368 if not self._compstat.abortingListener:
00369 self._compstat.abortingListener = \
00370 self._rtobj.addPostComponentActionListener(postclistener_.POST_ON_ABORTING,
00371 self._compstat.onAborting)
00372
00373 if not self._compstat.finalizeListener:
00374 self._compstat.finalizeListener = \
00375 self._rtobj.addPostComponentActionListener(postclistener_.POST_ON_FINALIZE,
00376 self._compstat.onFinalize)
00377
00378 return
00379
00380
00381
00382
00383
00384
00385
00386
00387
00388
00389 def unsetComponentStatusListeners(self):
00390 postclistener_ = OpenRTM_aist.PostComponentActionListenerType
00391 if self._compstat.activatedListener:
00392 self._rtobj.removePostComponentActionListener(postclistener_.POST_ON_ACTIVATED,
00393 self._compstat.activatedListener)
00394 self._compstat.activatedListener = None
00395
00396 if self._compstat.deactivatedListener:
00397 self._rtobj.removePostComponentActionListener(postclistener_.POST_ON_DEACTIVATED,
00398 self._compstat.deactivatedListener)
00399 self._compstat.deactivatedListener = None
00400
00401 if self._compstat.resetListener:
00402 self._rtobj.removePostComponentActionListener(postclistener_.POST_ON_RESET,
00403 self._compstat.resetListener)
00404 self._compstat.resetListener = None
00405
00406 if self._compstat.abortingListener:
00407 self._rtobj.removePostComponentActionListener(postclistener_.POST_ON_ABORTING,
00408 self._compstat.abortingListener)
00409 self._compstat.abortingListener = None
00410
00411 if self._compstat.finalizeListener:
00412 self._rtobj.removePostComponentActionListener(postclistener_.POST_ON_FINALIZE,
00413 self._compstat.finalizeListener)
00414 self._compstat.finalizeListener = None
00415
00416 return
00417
00418
00419
00420
00421
00422
00423
00424
00425
00426
00427
00428
00429
00430 def setPortProfileListeners(self):
00431 plistener_ = OpenRTM_aist.PortActionListenerType
00432 if not self._portaction.portAddListener:
00433 self._portaction.portAddListener = \
00434 self._rtobj.addPortActionListener(plistener_.ADD_PORT,
00435 self._portaction.onAddPort)
00436
00437 if not self._portaction.portRemoveListener:
00438 self._portaction.portRemoveListener = \
00439 self._rtobj.addPortActionListener(plistener_.REMOVE_PORT,
00440 self._portaction.onRemovePort)
00441
00442 pclistener_ = OpenRTM_aist.PortConnectRetListenerType
00443 if not self._portaction.portConnectListener:
00444 self._portaction.portConnectListener = \
00445 self._rtobj.addPortConnectRetListener(pclistener_.ON_CONNECTED,
00446 self._portaction.onConnect)
00447
00448 if not self._portaction.portDisconnectListener:
00449 self._portaction.portDisconnectListener = \
00450 self._rtobj.addPortConnectRetListener(pclistener_.ON_DISCONNECTED,
00451 self._portaction.onDisconnect)
00452
00453 return
00454
00455
00456
00457
00458
00459
00460
00461
00462
00463 def unsetPortProfileListeners(self):
00464 plistener_ = OpenRTM_aist.PortActionListenerType
00465 if self._portaction.portAddListener:
00466 self._rtobj.removePortActionListener(plistener_.ADD_PORT,
00467 self._portaction.portAddListener)
00468 self._portaction.portAddListener = None
00469
00470 if self._portaction.portRemoveListener:
00471 self._rtobj.removePortActionListener(plistener_.REMOVE_PORT,
00472 self._portaction.portRemoveListener)
00473 self._portaction.portRemoveListener = None
00474
00475 pclistener_ = OpenRTM_aist.PortConnectRetListenerType
00476 if self._portaction.portConnectListener:
00477 self._rtobj.removePortConnectRetListener(pclistener_.ON_CONNECTED,
00478 self._portaction.portConnectListener)
00479 self._portaction.portConnectListener = None
00480
00481 if self._portaction.portDisconnectListener:
00482 self._rtobj.removePortConnectRetListener(pclistener_.ON_DISCONNECTED,
00483 self._portaction.portDisconnectListener)
00484 self._portaction.portDisconnectListener = None
00485
00486 return
00487
00488
00489
00490
00491
00492
00493
00494
00495
00496
00497
00498
00499
00500 def setExecutionContextListeners(self):
00501 ectype_ = OpenRTM_aist.ExecutionContextActionListenerType
00502 if not self._ecaction.ecAttached:
00503 self._ecaction.ecAttached = \
00504 self._rtobj.addExecutionContextActionListener(ectype_.EC_ATTACHED,
00505 self._ecaction.onAttached)
00506
00507 if not self._ecaction.ecDetached:
00508 self._ecaction.ecDetached = \
00509 self._rtobj.addExecutionContextActionListener(ectype_.EC_DETACHED,
00510 self._ecaction.onDetached)
00511
00512 pcaltype_ = OpenRTM_aist.PostComponentActionListenerType
00513 if not self._ecaction.ecRatechanged:
00514 self._ecaction.ecRatechanged = \
00515 self._rtobj.addPostComponentActionListener(pcaltype_.POST_ON_RATE_CHANGED,
00516 self._ecaction.onRateChanged)
00517
00518 if not self._ecaction.ecStartup:
00519 self._ecaction.ecStartup = \
00520 self._rtobj.addPostComponentActionListener(pcaltype_.POST_ON_STARTUP,
00521 self._ecaction.onStartup)
00522
00523 if not self._ecaction.ecShutdown:
00524 self._ecaction.ecShutdown = \
00525 self._rtobj.addPostComponentActionListener(pcaltype_.POST_ON_SHUTDOWN,
00526 self._ecaction.onShutdown)
00527
00528 return
00529
00530
00531
00532
00533
00534
00535
00536
00537
00538
00539 def unsetExecutionContextListeners(self):
00540 ectype_ = OpenRTM_aist.ExecutionContextActionListenerType
00541 if self._ecaction.ecAttached:
00542 self._rtobj.removeExecutionContextActionListener(ectype_.EC_ATTACHED,
00543 self._ecaction.ecAttached)
00544
00545 if self._ecaction.ecDetached:
00546 self._rtobj.removeExecutionContextActionListener(ectype_.EC_ATTACHED,
00547 self._ecaction.ecDetached)
00548
00549 pcaltype_ = OpenRTM_aist.PostComponentActionListenerType
00550 if self._ecaction.ecRatechanged:
00551 self._rtobj.removePostComponentActionListener(pcaltype_.POST_ON_RATE_CHANGED,
00552 self._ecaction.ecRatechanged)
00553
00554 if self._ecaction.ecStartup:
00555 self._rtobj.removePostComponentActionListener(pcaltype_.POST_ON_STARTUP,
00556 self._ecaction.ecStartup)
00557
00558 if self._ecaction.ecShutdown:
00559 self._rtobj.removePostComponentActionListener(pcaltype_.POST_ON_SHUTDOWN,
00560 self._ecaction.ecShutdown)
00561
00562 return
00563
00564
00565
00566
00567
00568
00569
00570
00571
00572
00573
00574
00575
00576 def setComponentProfileListeners(self):
00577 pass
00578
00579
00580
00581
00582
00583
00584
00585
00586
00587
00588 def unsetComponentProfileListeners(self):
00589 pass
00590
00591
00592
00593
00594
00595
00596
00597
00598
00599
00600
00601
00602
00603 def setConfigurationListeners(self):
00604 confprmlistenertype_ = OpenRTM_aist.ConfigurationParamListenerType
00605 self._configMsg.updateConfigParamListener = \
00606 self._rtobj.addConfigurationParamListener(confprmlistenertype_.ON_UPDATE_CONFIG_PARAM,
00607 self._configMsg.updateConfigParam)
00608
00609 confsetlistenertype_ = OpenRTM_aist.ConfigurationSetListenerType
00610 self._configMsg.setConfigSetListener = \
00611 self._rtobj.addConfigurationSetListener(confsetlistenertype_.ON_SET_CONFIG_SET,
00612 self._configMsg.setConfigSet)
00613
00614 self._configMsg.addConfigSetListener = \
00615 self._rtobj.addConfigurationSetListener(confsetlistenertype_.ON_ADD_CONFIG_SET,
00616 self._configMsg.addConfigSet)
00617
00618 confsetnamelistenertype_ = OpenRTM_aist.ConfigurationSetNameListenerType
00619 self._configMsg.updateConfigSetListener = \
00620 self._rtobj.addConfigurationSetNameListener(confsetnamelistenertype_.ON_UPDATE_CONFIG_SET,
00621 self._configMsg.updateConfigSet)
00622
00623 self._configMsg.removeConfigSetListener = \
00624 self._rtobj.addConfigurationSetNameListener(confsetnamelistenertype_.ON_REMOVE_CONFIG_SET,
00625 self._configMsg.removeConfigSet)
00626 self._configMsg.activateConfigSetListener = \
00627 self._rtobj.addConfigurationSetNameListener(confsetnamelistenertype_.ON_ACTIVATE_CONFIG_SET,
00628 self._configMsg.activateConfigSet)
00629 return
00630
00631
00632
00633
00634
00635
00636
00637
00638
00639
00640 def unsetConfigurationListeners(self):
00641 confprmlistenertype_ = OpenRTM_aist.ConfigurationParamListenerType
00642 if self._configMsg.updateConfigParamListener:
00643 self._rtobj.removeConfigurationParamListener(confprmlistenertype_.ON_UPDATE_CONFIG_PARAM,
00644 self._configMsg.updateConfigParamListener)
00645 self._configMsg.updateConfigParamListener = None
00646
00647 confsetlistenertype_ = OpenRTM_aist.ConfigurationSetListenerType
00648 if self._configMsg.setConfigSetListener:
00649 self._rtobj.removeConfigurationSetListener(confsetlistenertype_.ON_SET_CONFIG_SET,
00650 self._configMsg.setConfigSetListener)
00651 self._configMsg.setConfigSetListener = None
00652
00653 if self._configMsg.addConfigSetListener:
00654 self._rtobj.removeConfigurationSetListener(confsetlistenertype_.ON_ADD_CONFIG_SET,
00655 self._configMsg.addConfigSetListener)
00656 self._configMsg.addConfigSetListener = None
00657
00658 confsetnamelistenertype_ = OpenRTM_aist.ConfigurationSetNameListenerType
00659 if self._configMsg.updateConfigSetListener:
00660 self._rtobj.removeConfigurationSetNameListener(confsetnamelistenertype_.ON_UPDATE_CONFIG_SET,
00661 self._configMsg.updateConfigSetListener)
00662 self._configMsg.updateConfigSetListener = None
00663
00664 if self._configMsg.removeConfigSetListener:
00665 self._rtobj.removeConfigurationSetNameListener(confsetnamelistenertype_.ON_REMOVE_CONFIG_SET,
00666 self._configMsg.removeConfigSetListener)
00667 self._configMsg.removeConfigSetListener = None
00668
00669 if self._configMsg.activateConfigSetListener:
00670 self._rtobj.removeConfigurationSetNameListener(confsetnamelistenertype_.ON_ACTIVATE_CONFIG_SET,
00671 self._configMsg.activateConfigSetListener)
00672 self._configMsg.activateConfigSetListener = None
00673
00674 return
00675
00676
00677
00678
00679
00680
00681
00682
00683
00684 class CompStatMsg:
00685 """
00686 """
00687
00688
00689 def __init__(self, coc):
00690 self.activatedListener = None
00691 self.deactivatedListener = None
00692 self.resetListener = None
00693 self.abortingListener = None
00694 self.finalizeListener = None
00695 self._coc = coc
00696 return
00697
00698 def __del__(self):
00699 del self._coc
00700 return
00701
00702
00703 def onGeneric(self, msgprefix, ec_id, ret):
00704 if ret == RTC.RTC_OK:
00705 msg_ = msgprefix
00706 msg_ += str(ec_id)
00707 self._coc.updateStatus(OpenRTM.RTC_STATUS, msg_)
00708 return
00709
00710
00711 def onActivated(self, ec_id, ret):
00712 self.onGeneric("ACTIVE:", ec_id, ret)
00713 return
00714
00715
00716 def onDeactivated(self, ec_id, ret):
00717 self.onGeneric("INACTIVE:", ec_id, ret)
00718 return
00719
00720
00721 def onReset(self, ec_id, ret):
00722 self.onGeneric("INACTIVE:", ec_id, ret)
00723 return
00724
00725
00726 def onAborting(self, ec_id, ret):
00727 self.onGeneric("ERROR:", ec_id, ret)
00728 return
00729
00730
00731 def onFinalize(self, ec_id, ret):
00732 self.onGeneric("FINALIZE:", ec_id, ret)
00733 return
00734
00735
00736
00737
00738
00739
00740
00741
00742 class PortAction:
00743 """
00744 """
00745
00746
00747 def __init__(self, coc):
00748 self.portAddListener = None
00749 self.portRemoveListener = None
00750 self.portConnectListener = None
00751 self.portDisconnectListener = None
00752 self._coc = coc
00753 return
00754
00755 def __del__(self):
00756 del self._coc
00757 return
00758
00759
00760 def onGeneric(self, _msg, portname):
00761 msg_ = _msg
00762 msg_ += portname
00763 self._coc.updateStatus(OpenRTM.PORT_PROFILE, msg_)
00764 return
00765
00766
00767 def onAddPort(self, pprof):
00768 self.onGeneric("ADD:", str(pprof.name))
00769 return
00770
00771
00772 def onRemovePort(self, pprof):
00773 self.onGeneric("REMOVE:", str(pprof.name))
00774 return
00775
00776
00777
00778 def onConnect(self, portname, pprof, ret):
00779 if ret == RTC.RTC_OK:
00780 self.onGeneric("CONNECT:", portname)
00781 return
00782
00783
00784
00785 def onDisconnect(self, portname, pprof, ret):
00786 if ret == RTC.RTC_OK:
00787 self.onGeneric("DISCONNECT:", portname)
00788 return
00789
00790
00791
00792
00793
00794
00795
00796
00797
00798 class ECAction:
00799 """
00800 """
00801
00802
00803 def __init__(self, coc):
00804 self.ecAttached = None
00805 self.ecDetached = None
00806 self.ecRatechanged = None
00807 self.ecStartup = None
00808 self.ecShutdown = None
00809 self._coc = coc
00810 return
00811
00812 def __del__(self):
00813 del self._coc
00814 return
00815
00816
00817 def onGeneric(self, _msg, ec_id):
00818 msg_ = _msg + str(ec_id)
00819 self._coc.updateStatus(OpenRTM.EC_STATUS, msg_)
00820 return
00821
00822
00823 def onAttached(self, ec_id):
00824 self.onGeneric("ATTACHED:", ec_id)
00825 return
00826
00827
00828 def onDetached(self, ec_id):
00829 self.onGeneric("DETACHED:", ec_id)
00830 return
00831
00832
00833 def onRateChanged(self, ec_id, ret):
00834 if ret == RTC.RTC_OK:
00835 self.onGeneric("RATE_CHANGED:", ec_id)
00836 return
00837
00838
00839 def onStartup(self, ec_id, ret):
00840 if ret == RTC.RTC_OK:
00841 self.onGeneric("STARTUP:", ec_id)
00842 return
00843
00844
00845 def onShutdown(self, ec_id, ret):
00846 if ret == RTC.RTC_OK:
00847 self.onGeneric("SHUTDOWN:", ec_id)
00848 return
00849
00850
00851
00852
00853
00854
00855
00856
00857
00858 class ConfigAction:
00859 """
00860 """
00861
00862
00863 def __init__(self, coc):
00864 self.updateConfigParamListener = None
00865 self.setConfigSetListener = None
00866 self.addConfigSetListener = None
00867 self.updateConfigSetListener = None
00868 self.removeConfigSetListener = None
00869 self.activateConfigSetListener = None
00870 self._coc = coc
00871
00872 def __del__(self):
00873 del self._coc
00874 return
00875
00876
00877
00878 def updateConfigParam(self, configsetname, configparamname):
00879 msg_ = "UPDATE_CONFIG_PARAM: "
00880 msg_ += configsetname
00881 msg_ += "."
00882 msg_ += configparamname
00883 self._coc.updateStatus(OpenRTM.CONFIGURATION, msg_)
00884 return
00885
00886
00887 def setConfigSet(self, config_set):
00888 msg_ = "SET_CONFIG_SET: "
00889 msg_ += config_set.getName()
00890 self._coc.updateStatus(OpenRTM.CONFIGURATION, msg_)
00891 return
00892
00893
00894 def addConfigSet(self, config_set):
00895 msg_ = "ADD_CONFIG_SET: "
00896 msg_ += config_set.getName()
00897 self._coc.updateStatus(OpenRTM.CONFIGURATION, msg_)
00898 return
00899
00900
00901 def updateConfigSet(self, config_set_name):
00902 msg_ = "UPDATE_CONFIG_SET: "
00903 msg_ += config_set_name
00904 self._coc.updateStatus(OpenRTM.CONFIGURATION, msg_)
00905 return
00906
00907
00908 def removeConfigSet(self, config_set_name):
00909 msg_ = "REMOVE_CONFIG_SET: "
00910 msg_ += config_set_name
00911 self._coc.updateStatus(OpenRTM.CONFIGURATION, msg_)
00912 return
00913
00914
00915 def activateConfigSet(self, config_set_name):
00916 msg_ = "ACTIVATE_CONFIG_SET: "
00917 msg_ += config_set_name
00918 self._coc.updateStatus(OpenRTM.CONFIGURATION, msg_)
00919 return
00920
00921 def ComponentObserverConsumerInit(mgr=None):
00922 factory = OpenRTM_aist.SdoServiceConsumerFactory.instance()
00923 factory.addFactory(OpenRTM.ComponentObserver._NP_RepositoryId,
00924 ComponentObserverConsumer,
00925 OpenRTM_aist.Delete)
00926 return