18 sys.path.insert(1,
"../")
23 from ConfigAdmin
import *
25 configsample_spec = [
"implementation_id",
"ConfigSample",
26 "type_name",
"ConfigSample",
27 "description",
"Configuration example component",
29 "vendor",
"Shinji Kurihara, AIST",
30 "category",
"example",
31 "activity_type",
"DataFlowComponent",
34 "lang_type",
"compile",
36 "conf.default.int_param0",
"0",
37 "conf.default.int_param1",
"1",
38 "conf.default.double_param0",
"0.11",
39 "conf.default.double_param1",
"9.9",
40 "conf.default.str_param0",
"hoge",
41 "conf.default.str_param1",
"dara",
42 "conf.default.vector_param0",
"0.0,1.0,2.0,3.0,4.0",
45 configsample_mode_spec = [
"conf.default.int_param0",
"10",
46 "conf.default.int_param1",
"11",
47 "conf.default.double_param0",
"0.22",
48 "conf.default.double_param1",
"9999.9",
49 "conf.default.str_param0",
"hogehoge",
50 "conf.default.str_param1",
"daradaradata",
51 "conf.default.vector_param0",
"0.1,1.1,2.1,3.1,4.1",
54 configsample_add_spec = [
"conf.mode0.int_param0",
"10",
55 "conf.mode0.int_param1",
"11",
56 "conf.mode0.double_param0",
"0.22",
57 "conf.mode0.double_param1",
"9999.9",
58 "conf.mode0.str_param0",
"hogehoge",
59 "conf.mode0.str_param1",
"daradaradata",
60 "conf.mode0.vector_param0",
"0.1,1.1,2.1,3.1,4.1",
69 OpenRTM_aist.Manager.instance().shutdownManager()
91 self.
_ca.bindParameter(
"vector_param0", self.
vector_param0,
"0.0,1.0,2.0,3.0,4.0")
95 self.
_ca.update(config_set=
"default")
96 self.
_ca.update(
"default",
"int_param0")
107 default_value =
"3.14159" 109 self.assertEqual(
True, ca.bindParameter(varName,var,default_value))
110 self.assertEqual(3.14159,var[0])
113 self.assertEqual(
True, ca.isExist(
"name"))
116 self.assertEqual(
False, ca.isExist(
"inexist name"))
121 self.assertEqual(self.
_ca.isChanged(),
False)
126 self.assertEqual(self.
_ca.getActiveId(),
"default")
131 self.assertEqual(self.
_ca.haveConfig(
"default"),
True)
138 self.assertEqual(self.
_ca.isActive(),
True)
143 self.assertEqual(self.
_ca.getConfigurationSets()[0].name,
"default")
148 self.assertEqual(self.
_ca.getConfigurationSet(
"default").name,
"default")
153 self.assertEqual(self.
_ca.setConfigurationSetValues(prop.getNode(
"conf.default")),
True)
157 self.assertEqual(self.
_ca.getActiveConfigurationSet().getName(),
"default")
162 self.assertEqual(self.
_ca.addConfigurationSet(prop.getNode(
"conf.mode0")),
True)
167 self.assertEqual(self.
_ca.addConfigurationSet(prop.getNode(
"conf.mode0")),
True)
168 self.assertEqual(self.
_ca.removeConfigurationSet(
"mode0"),
True)
174 self.assertEqual(self.
_ca.addConfigurationSet(prop.getNode(
"conf.mode0")),
True)
175 self.assertEqual(self.
_ca.activateConfigurationSet(
"mode0"),
True)
176 self.assertEqual(self.
_ca.activateConfigurationSet(
"default"),
True)
177 self.assertEqual(self.
_ca.activateConfigurationSet(
"mode0"),
True)
183 self.
_ca.setOnUpdate(
None)
187 self.
_ca.setOnUpdateParam(
None)
191 self.
_ca.setOnSetConfigurationSet(
None)
195 self.
_ca.setOnAddConfigurationSet(
None)
200 self.
_ca.setOnRemoveConfigurationSet(
None)
205 self.
_ca.setOnActivateSet(
None)
211 self.
_ca.onUpdate(
"onUpdate")
217 self.
_ca.onUpdateParam(
"onUpdateParam",
"Param")
223 self.
_ca.onSetConfigurationSet(
"onSetConfigurationSet")
229 self.
_ca.onAddConfigurationSet(
"onAddConfigurationSet")
234 self.
_ca.setOnRemoveConfigurationSet(self.
CallBack)
235 self.
_ca.onRemoveConfigurationSet(
"onRemoveConfigurationSet")
241 self.
_ca.onActivateSet(
"ActivateSet")
247 self.
_ca.addConfigurationParamListener(OpenRTM_aist.ConfigurationParamListenerType.ON_UPDATE_CONFIG_PARAM,
249 self.
_ca.onUpdateParam(
"",
"")
250 self.
_ca.removeConfigurationParamListener(OpenRTM_aist.ConfigurationParamListenerType.ON_UPDATE_CONFIG_PARAM,
256 self.
_ca.addConfigurationSetListener(OpenRTM_aist.ConfigurationSetListenerType.ON_SET_CONFIG_SET,
258 self.
_ca.onSetConfigurationSet(
None)
259 self.
_ca.removeConfigurationSetListener(OpenRTM_aist.ConfigurationSetListenerType.ON_SET_CONFIG_SET,
261 self.
_ca.addConfigurationSetListener(OpenRTM_aist.ConfigurationSetListenerType.ON_ADD_CONFIG_SET,
263 self.
_ca.onSetConfigurationSet(
None)
264 self.
_ca.removeConfigurationSetListener(OpenRTM_aist.ConfigurationSetListenerType.ON_ADD_CONFIG_SET,
270 self.
_ca.addConfigurationSetNameListener(OpenRTM_aist.ConfigurationSetNameListenerType.ON_UPDATE_CONFIG_SET,
272 self.
_ca.onUpdate(
"")
273 self.
_ca.removeConfigurationSetNameListener(OpenRTM_aist.ConfigurationSetNameListenerType.ON_UPDATE_CONFIG_SET,
276 self.
_ca.addConfigurationSetNameListener(OpenRTM_aist.ConfigurationSetNameListenerType.ON_REMOVE_CONFIG_SET,
278 self.
_ca.onUpdate(
"")
279 self.
_ca.removeConfigurationSetNameListener(OpenRTM_aist.ConfigurationSetNameListenerType.ON_REMOVE_CONFIG_SET,
282 self.
_ca.addConfigurationSetNameListener(OpenRTM_aist.ConfigurationSetNameListenerType.ON_ACTIVATE_CONFIG_SET,
284 self.
_ca.onUpdate(
"")
285 self.
_ca.removeConfigurationSetNameListener(OpenRTM_aist.ConfigurationSetNameListenerType.ON_ACTIVATE_CONFIG_SET,
291 OpenRTM_aist.ConfigurationParamListener.__init__(self)
294 def __call__(self, config_set_name, config_param_name):
295 print "ConfigParamListenerCallback called" 300 OpenRTM_aist.ConfigurationSetListener.__init__(self)
304 print "ConfigSetListenerCallback called" 309 OpenRTM_aist.ConfigurationSetNameListener.__init__(self)
313 print "ConfigSetNameListenerCallback called" 318 if __name__ ==
'__main__':
def test_addremoveConfigurationSetNameListener(self)
def test_setOnUpdateParam(self)
def test_removeConfigurationSet(self)
def test_onAddConfigurationSet(self)
def test_setOnSetConfigurationSet(self)
def test_addConfigurationSet(self)
def test_activateConfigurationSet(self)
The Properties class represents a persistent set of properties.
def __call__(self, config_set_name, config_param_name)
def test_setConfigurationSetValues(self)
def test_addremoveConfigurationParamListener(self)
def test_setOnRemoveConfigurationSet(self)
ConfigurationParamListener class.
def test_onRemoveConfigurationSet(self)
def test_setOnUpdate(self)
def test_haveConfig(self)
def test_getConfigurationSet(self)
def test_setOnActivateSet(self)
def test_addremoveConfigurationSetListener(self)
def test_bindParameter(self)
def test_onSetConfigurationSet(self)
def test_setOnAddConfigurationSet(self)
def test_getActiveId(self)
ConfigurationSetListener class.
def test_getConfigurationSets(self)
def test_onActivateSet(self)
def test_getActiveConfigurationSet(self)
def __call__(self, config_set_name)
ConfigurationSetNameListener class.
def test_onUpdateParam(self)
def __call__(self, config_set)