def command_list_query(): print("in command_list_query") try: p = DeviceProxy("sys/tg_test/1") commands = p.command_list_query() parsedCommands = parseCommandInfoList(commands) return jsonify(parsedCommands) except (CommunicationFailed, ConnectionFailed, DevFailed) as e: return jsonify(handleException(e))
def get_device_commands(self, with_context=True): """ Get device proxy commands""" ### TBD - Why use DeviceProxy? ### Can this not be known through self which is a Device commands = [] device_proxy = DeviceProxy(self.get_name()) cmd_config_list = device_proxy.command_list_query() for device_cmd_config in cmd_config_list: commands.append(get_dp_command( device_proxy.dev_name(), device_cmd_config, with_context)) return commands
def command_list_query(): Log("in command_list_query", 'd') try: global disable_Pytango if disable_Pytango: p = DeviceProxy("sys/tg_test/1") commands = p.command_list_query() parsedCommands = parseCommandInfoList(commands) else: parsedCommands = "" return jsonify(parsedCommands) except (CommunicationFailed, ConnectionFailed, DevFailed) as e: return jsonify(handleException(e))
def parse(self, device_url): device = DeviceProxy(device_url) result = Documentation() result.name = device.info().dev_class result.description = device.description() # FIXME: perhaps need to query the database about the propertiess propertyNames = device.get_property_list('*') for propertyName in propertyNames: result.addproperty(propertyName, 'TODO description', 'TODO type name', 'TODO default') attributeInfos = device.attribute_list_query() for attributeInfo in attributeInfos: result.addattribute(attributeInfo.name, attributeInfo.description, self.translate(attributeInfo.data_type, attributeInfo.data_format)) commandInfos = device.command_list_query() for commandInfo in commandInfos: result.addcommand( commandInfo.cmd_name, 'TODO command description', self.translate_command_argument(commandInfo.in_type), commandInfo.in_type_desc, self.translate_command_argument(commandInfo.out_type), commandInfo.out_type_desc) return [result]