def serial_login(self):
if not self._serial_connected:<EOL><INDENT>raise termineter.errors.FrameworkRuntimeError('<STR_LIT>')<EOL><DEDENT>username = self.options['<STR_LIT>']<EOL>user_id = self.options['<STR_LIT>']<EOL>password = self.options['<STR_LIT>']<EOL>if self.options['<STR_LIT>']:<EOL><INDENT>hex_regex = re.compile('<STR_LIT>')<EOL>if hex_regex.match(password) is None:<EOL><INDENT>self.print_error('<STR_LIT>')<EOL>raise termineter.errors.FrameworkConfigurationError('<STR_LIT>')<EOL><DEDENT>password = binascii.a2b_hex(password)<EOL><DEDENT>if len(username) > <NUM_LIT:10>:<EOL><INDENT>self.print_error('<STR_LIT>')<EOL>raise termineter.errors.FrameworkConfigurationError('<STR_LIT>')<EOL><DEDENT>if not (<NUM_LIT:0> <= user_id <= <NUM_LIT>):<EOL><INDENT>self.print_error('<STR_LIT>')<EOL>raise termineter.errors.FrameworkConfigurationError('<STR_LIT>')<EOL><DEDENT>if len(password) > <NUM_LIT:20>:<EOL><INDENT>self.print_error('<STR_LIT>')<EOL>raise termineter.errors.FrameworkConfigurationError('<STR_LIT>')<EOL><DEDENT>if not self.serial_connection.login(username, user_id, password):<EOL><INDENT>return False<EOL><DEDENT>return True<EOL>
Attempt to log into the meter over the C12.18 protocol. Returns True on success, False on a failure. This can be
called by modules in order to login with a username and password configured within the framework instance.