当前位置: 首页>>代码示例>>Python>>正文


Python Interpreter.buildDeleteAllSent方法代码示例

本文整理汇总了Python中interpreter.Interpreter.buildDeleteAllSent方法的典型用法代码示例。如果您正苦于以下问题:Python Interpreter.buildDeleteAllSent方法的具体用法?Python Interpreter.buildDeleteAllSent怎么用?Python Interpreter.buildDeleteAllSent使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在interpreter.Interpreter的用法示例。


在下文中一共展示了Interpreter.buildDeleteAllSent方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: Modem

# 需要导入模块: from interpreter import Interpreter [as 别名]
# 或者: from interpreter.Interpreter import buildDeleteAllSent [as 别名]

#.........这里部分代码省略.........
        @param sens_t of the sensors that have the data to be deleted:
            0 --> all
            1 --> hydrophone,
            2 --> camera
            3 --> others
        @return the message
        """
        while self.status != Modem.Status.IDLE :
            sleep(0.1)
        if self.status != Modem.Status.IDLE:
            raise ValueError("Modem deleteAllRec unexpected status: \
                " + str(self.status))
        self.status = Modem.Status.BUSY2REQ
        self.send(self.interpreter.buildDeleteAllRec(sens_t))
        while self.status != Modem.Status.IDLE and self.status != Modem.Status.KILL:
            sleep(self.m_to)
            #self.recvCommand()
        if self.status == Modem.Status.KILL:
            return self.close()
        return self.errorCheck()

    def reqDeleteAllSent(self):
        """
        Delete the files sent by the node
        @param self pointer to the class object
        @return the message
        """
        while self.status != Modem.Status.IDLE :
            sleep(0.1)
        if self.status != Modem.Status.IDLE:
            raise ValueError("Modem deleteAllSent unexpected status: \
                " + str(self.status))
        self.status = Modem.Status.BUSY2REQ
        self.send(self.interpreter.buildDeleteAllSent())
        while self.status != Modem.Status.IDLE and self.status != Modem.Status.KILL:
            sleep(self.m_to)
            #self.recvCommand()
        if self.status == Modem.Status.KILL:
            return self.close()
        return self.errorCheck()

    def recvDataFile(self, file_name, length_f, confirm_flag):
        """
        Require all the data from the submerged node
        @param self pointer to the class object
        @param file_name name of the required file
        @param length_f of the file, in bytes
        @paran confirm_flag True if confirm needed. When stream is false
        """
        while self.status != Modem.Status.IDLE and self.status != Modem.Status.BUSY2REQ:
            sleep(0.1)
        if self.status == Modem.Status.IDLE:
            self.status = Modem.Status.BUSY2DATA
        elif self.status == Modem.Status.BUSY2REQ:
            self.status = Modem.Status.BUSY2REQ2DATA
        else:
            raise ValueError("Modem recvDataFile unexpected status: \
                " + str(self.status))
        if(confirm_flag):
            self.send(self.interpreter.buildConfirm())
        self.status = Modem.Status.BUSY2DATA
        f = open(file_name,'wb') #open in binary
        n_recv = 0;
        if self.interpreter.debug:
            print "Modem::recvDataFile: recvFile", file_name, length_f
        while (n_recv < length_f and self.status != Modem.Status.KILL):
开发者ID:marinetech,项目名称:Udoo,代码行数:70,代码来源:modem.py


注:本文中的interpreter.Interpreter.buildDeleteAllSent方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。