def get_command_name(self, to, requested_command_id):
"""
Sends a messge down the serial line requesting the property name of a given property ID,
used in discovery protocol
:param to: destination ID
:param requested_command_id: command ID that we want to know the name of
:return: name from Embedded Core
"""
try:
response = yield self.send_command(to, command_id=GET_COMMAND_NAME, params=["command_id"],
data=[requested_command_id])
except Exception as e:
logger.error("[PCOM] Unable to find command name for command {0} in item {1} because of exception:"
"{2}".format(requested_command_id, to, e))
defer.returnValue(None)
# The data in the response message will be a list,
# the command name should be in the 0th position
try:
defer.returnValue(response.data[0])
except IndexError:
logger.error("Response from embedded board during discovery sequence did not return data in expect format."
" Expected at least one data field, received: {0}".format(response.data))
defer.returnValue(None)
评论列表
文章目录