ekmmeters.py
def setPulseInputRatio(self, line_in, new_cnst, password="00000000"):
        """Serial call to set pulse input ratio on a line.

        Args:
            line_in (int): Member of :class:`~ekmmeters.Pulse`
            new_cnst (int): New pulse input ratio
            password (str): Optional password

        Returns:

        """
        result = False
        self.setContext("setPulseInputRatio")

        try:
            if not self.requestA():
                self.writeCmdMsg("Bad read CRC on setting")
            else:
                if not self.serialCmdPwdAuth(password):
                    self.writeCmdMsg("Password failure")
                else:
                    req_const = binascii.hexlify(str(new_cnst).zfill(4))
                    line_const = binascii.hexlify(str(line_in - 1))
                    req_str = "01573102303041" + line_const + "28" + req_const + "2903"
                    req_str += self.calc_crc16(req_str[2:].decode("hex"))
                    self.m_serial_port.write(req_str.decode("hex"))
                    if self.m_serial_port.getResponse(self.getContext()).encode("hex") == "06":
                        self.writeCmdMsg("Success: 06 returned.")
                        result = True

            self.serialPostEnd()
        except:
            ekm_log(traceback.format_exc(sys.exc_info()))

        self.setContext("")
        return result
def setPulseInputRatio(self, line_in, new_cnst, password="00000000"):
        result = False
        self.setContext("setPulseInputRatio")

        try:
            if not self.requestA():
                self.writeCmdMsg("Bad read CRC on setting")
            else:
                if not self.serialCmdPwdAuth(password):
                    self.writeCmdMsg("Password failure")
                else:
                    req_const = binascii.hexlify(str(new_cnst).zfill(4))
                    line_const = binascii.hexlify(str(line_in - 1))
                    req_str = "01573102303041" + line_const + "28" + req_const + "2903"
                    req_str += self.calc_crc16(req_str[2:].decode("hex"))
                    self.m_serial_port.write(req_str.decode("hex"))
                    if self.m_serial_port.getResponse(self.getContext()).encode("hex") == "06":
                        self.writeCmdMsg("Success: 06 returned.")
                        result = True

            self.serialPostEnd()
        except:
            ekm_log(traceback.format_exc(sys.exc_info()))

        self.setContext("")
        return result
def setPulseInputRatio ( self , line_in , new_cnst , password = "00000000" ) : result = False self . setContext ( "setPulseInputRatio" ) try : if not self . requestA ( ) : self . writeCmdMsg ( "Bad read CRC on setting" ) else : if not self . serialCmdPwdAuth ( password ) : self . writeCmdMsg ( "Password failure" ) else : req_const = binascii . hexlify ( str ( new_cnst ) . zfill ( 4 ) ) line_const = binascii . hexlify ( str ( line_in - 1 ) ) req_str = "01573102303041" + line_const + "28" + req_const + "2903" req_str += self . calc_crc16 ( req_str [ 2 : ] . decode ( "hex" ) ) self . m_serial_port . write ( req_str . decode ( "hex" ) ) if self . m_serial_port . getResponse ( self . getContext ( ) ) . encode ( "hex" ) == "06" : self . writeCmdMsg ( "Success: 06 returned." ) result = True self . serialPostEnd ( ) except : ekm_log ( traceback . format_exc ( sys . exc_info ( ) ) ) self . setContext ( "" ) return result
Serial call to set pulse input ratio on a line.

        Args:
            line_in (int): Member of :class:`~ekmmeters.Pulse`
            new_cnst (int): New pulse input ratio
            password (str): Optional password

        Returns:
Serial call to set pulse input ratio on a line .