def get_command_input_param_format(self, to, requested_command_id):
"""
Given a command ID and item ID, sends a message to the item ID requesting
the format of its input parameters. This functions should return a string
that describes each parameter. NOTE: variable arrays are indicated with a *.
Eg. A list of ints would be "*i". See format string details for character->byte
translation.
:param to: destination item ID
:param requested_command_id: command ID that we want the parameter format of
:return: format string describing input parameters
"""
try:
response = yield self.send_command(to, command_id=GET_COMMAND_INPUT_PARAM_FORMAT, params=["command_id"],
data=[requested_command_id])
except Exception as e:
logger.error("[PCOM] Unable to find command input format for command {0} in item {1} because of exception:"
"{2}".format(requested_command_id, to, e))
defer.returnValue(None)
r_val = '' if len(response.data) == 0 else response.data[0]
defer.returnValue(r_val)
评论列表
文章目录