ekmmeters.py
def serialCmdPwdAuth(self, password_str):
        """ Password step of set commands

        This method is normally called within another serial command, so it
        does not issue a termination string.  Any default password is set
        in the caller parameter list, never here.

        Args:
            password_str (str): Required password.

        Returns:
            bool: True on completion and ACK.
        """
        result = False
        try:
            req_start = "0150310228" + binascii.hexlify(password_str) + "2903"
            req_crc = self.calc_crc16(req_start[2:].decode("hex"))
            req_str = req_start + req_crc
            self.m_serial_port.write(req_str.decode("hex"))
            if self.m_serial_port.getResponse(self.getContext()).encode("hex") == "06":
                ekm_log("Password accepted (" + self.getContext() + ")")
                result = True
            else:
                ekm_log("Password call failure no 06(" + self.getContext() + ")")
        except:
            ekm_log("Password call failure by exception(" + self.getContext() + ")")

            ekm_log(traceback.format_exc(sys.exc_info()))

        return result
def serialCmdPwdAuth(self, password_str):
        result = False
        try:
            req_start = "0150310228" + binascii.hexlify(password_str) + "2903"
            req_crc = self.calc_crc16(req_start[2:].decode("hex"))
            req_str = req_start + req_crc
            self.m_serial_port.write(req_str.decode("hex"))
            if self.m_serial_port.getResponse(self.getContext()).encode("hex") == "06":
                ekm_log("Password accepted (" + self.getContext() + ")")
                result = True
            else:
                ekm_log("Password call failure no 06(" + self.getContext() + ")")
        except:
            ekm_log("Password call failure by exception(" + self.getContext() + ")")

            ekm_log(traceback.format_exc(sys.exc_info()))

        return result
def serialCmdPwdAuth ( self , password_str ) : result = False try : req_start = "0150310228" + binascii . hexlify ( password_str ) + "2903" req_crc = self . calc_crc16 ( req_start [ 2 : ] . decode ( "hex" ) ) req_str = req_start + req_crc self . m_serial_port . write ( req_str . decode ( "hex" ) ) if self . m_serial_port . getResponse ( self . getContext ( ) ) . encode ( "hex" ) == "06" : ekm_log ( "Password accepted (" + self . getContext ( ) + ")" ) result = True else : ekm_log ( "Password call failure no 06(" + self . getContext ( ) + ")" ) except : ekm_log ( "Password call failure by exception(" + self . getContext ( ) + ")" ) ekm_log ( traceback . format_exc ( sys . exc_info ( ) ) ) return result
Password step of set commands

        This method is normally called within another serial command, so it
        does not issue a termination string.  Any default password is set
        in the caller parameter list, never here.

        Args:
            password_str (str): Required password.

        Returns:
            bool: True on completion and ACK.
Password step of set commands