本文整理汇总了Python中device.Device.module_open方法的典型用法代码示例。如果您正苦于以下问题:Python Device.module_open方法的具体用法?Python Device.module_open怎么用?Python Device.module_open使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类device.Device
的用法示例。
在下文中一共展示了Device.module_open方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: callModule
# 需要导入模块: from device import Device [as 别名]
# 或者: from device.Device import module_open [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: _open_or_validate
# 需要导入模块: from device import Device [as 别名]
# 或者: from device.Device import module_open [as 别名]
def _open_or_validate(self, modulename, board):
"""
Open o check if modulename module is open in board: board
"""
if modulename in self._openables:
if modulename in board.get_openables_loaded():
return board.get_device_handler(modulename)
else:
dev = Device(board, modulename, None, self._drivers_loaded[modulename], True)
number = dev.module_open()
if number == 255:
self._debug('cannot open module', modulename)
return ERROR
else:
board.add_device(number, dev)
return number
return ERROR