def login(self, username='0000', userid=0, password=None):
		"""
		Log into the connected device.

		:param str username: the username to log in with (len(username) <= 10)
		:param int userid: the userid to log in with (0x0000 <= userid <= 0xffff)
		:param str password: password to log in with (len(password) <= 20)
		:rtype: bool
		"""
		if password and len(password) > 20:
			self.logger.error('password longer than 20 characters received')
			raise Exception('password longer than 20 characters, login failed')

		self.send(C1218LogonRequest(username, userid))
		data = self.recv()
		if data != b'\x00':
			self.logger.warning('login failed, username and user id rejected')
			return False

		if password is not None:
			self.send(C1218SecurityRequest(password))
			data = self.recv()
			if data != b'\x00':
				self.logger.warning('login failed, password rejected')
				return False

		self.logged_in = True
		return True
Log into the connected device.

		:param str username: the username to log in with (len(username) <= 10)
		:param int userid: the userid to log in with (0x0000 <= userid <= 0xffff)
		:param str password: password to log in with (len(password) <= 20)
		:rtype: bool