pcom_serial.py 文件源码

python
阅读 23 收藏 0 点赞 0 评论 0

项目:Parlay 作者: PromenadeSoftware 项目源码 文件源码
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)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号