本文整理汇总了Python中device.Device.add_functions方法的典型用法代码示例。如果您正苦于以下问题:Python Device.add_functions方法的具体用法?Python Device.add_functions怎么用?Python Device.add_functions使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类device.Device
的用法示例。
在下文中一共展示了Device.add_functions方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: callModule
# 需要导入模块: from device import Device [as 别名]
# 或者: from device.Device import add_functions [as 别名]
def callModule(self, modulename, board_number, number, function, params = []):
"""
Call one function: function for module: modulename in board: board_name
with handler: number (only if the module is pnp, else, the parameter is
None) with parameteres: params
"""
try:
board = self._bb[board_number]
if board.devices.has_key(number) and (board.devices[number].name == modulename):
return board.devices[number].call_function(function, params)
else:
if modulename in self._openables:
if modulename in board.get_openables_loaded():
number = board.get_device_handler(modulename)
else:
board.add_openable_loaded(modulename)
dev = Device(board, modulename)
number = dev.module_open()
dev.add_functions(self._drivers_loaded[modulename])
board.add_device(number, dev)
return board.devices[number].call_function(function, params)
else:
if self._debug:
print 'no open and no openable'
return ERROR
except Exception, err:
if self._debug:
print 'error call module', err
return ERROR
示例2: get_modules_list
# 需要导入模块: from device import Device [as 别名]
# 或者: from device.Device import add_functions [as 别名]
def get_modules_list(self, normal=True):
"""
Get the list of modules loaded in the board
"""
self._modules = []
n_boards = self.get_butia_count()
if self._debug:
print '=Listing Devices'
for i, b in enumerate(self._bb):
try:
listi = b.get_listi()
s = b.get_handler_size()
if self._debug:
print '===board', i
for m in range(0, s + 1):
module_name = listi[b.get_handler_type(m)]
if n_boards > 1:
complete_name = module_name + '@' + str(i) + ':' + str(m)
else:
complete_name = module_name + ':' + str(m)
if self._debug:
print '=====module', module_name, (8 - len(module_name)) * ' ', complete_name
if not(module_name == 'port'):
if normal:
self._modules.append(complete_name)
else:
self._modules.append((str(m), module_name, str(i)))
if not(b.devices.has_key(m) and (b.devices[m].name == module_name)):
d = Device(b, module_name, m)
d.add_functions(self._drivers_loaded[module_name])
b.add_device(m, d)
if module_name in self._openables:
b.add_openable_loaded(module_name)
else:
if b.devices.has_key(m):
b.devices.pop(m)
except Exception, err:
if self._debug:
print 'error module list', err