# Path: src/alexapi/device_platforms/baseplatform.py
# class BasePlatform:
# 	__metaclass__ = ABCMeta
# 
# 	_trigger_callback = None
# 
# 	def __init__(self, config, platform_name):
# 		self._config = config
# 
# 		self._pconfig = {}
# 		if config['platforms']['common']:
# 			self._pconfig = config['platforms']['common']
# 
# 		if config['platforms'][platform_name]:
# 			self._pconfig.update(config['platforms'][platform_name])
# 
# 	@abstractmethod
# 	def setup(self):
# 		pass
# 
# 	@abstractmethod
# 	def after_setup(self, trigger_callback=None):
# 		pass
# 
# 	@abstractmethod
# 	def indicate_failure(self):
# 		pass
# 
# 	@abstractmethod
# 	def indicate_success(self):
# 		pass
# 
# 	@abstractmethod
# 	def indicate_recording(self, state=True):
# 		pass
# 
# 	@abstractmethod
# 	def indicate_playback(self, state=True):
# 		pass
# 
# 	@abstractmethod
# 	def indicate_processing(self, state=True):
# 		pass
# 
# 	@abstractmethod
# 	def force_recording(self):
# 		pass
# 
# 	@abstractmethod
# 	def cleanup(self):
# 		pass


import logging
import threading
	import BaseHTTPServer
	import http.server as BaseHTTPServer
import urllib.parse as urlparse
from urllib.request import urlopen, URLError
from .baseplatform import BasePlatform
		logger.debug("Setting up Magic Mirror platform")
		logger.info("Magic Mirror HTTP Server - %s:%s", self.host_name, self.port_number)

		# Setup http server
		self.httpd = CallbackHTTPServer((self.host_name, self.port_number), MMHTTPHandler)
		self.httpd.set_callback(self.http_callback)
		self.serverthread = threading.Thread(target=self.httpd.serve_forever)
		self.serverthread.daemon = True

	def indicate_failure(self):
		logger.debug("Indicating Failure")

		self.update_mm("failure")

	def indicate_success(self):
		logger.debug("Indicating Success")

		self.update_mm("success")

	def after_setup(self, trigger_callback=None):

		self._trigger_callback = trigger_callback

		logger.debug("Starting Magic Mirror platform HTTP Server")
		self.serverthread.start()

		logger.debug("Starting Magic Mirror heartbeat with %s second interval", self.hb_timer)
		self.mm_heartbeat()

	def indicate_recording(self, state=True):

# Path: src/alexapi/device_platforms/baseplatform.py
# class BasePlatform:
# 	__metaclass__ = ABCMeta
# 
# 	_trigger_callback = None
# 
# 	def __init__(self, config, platform_name):
# 		self._config = config
# 
# 		self._pconfig = {}
# 		if config['platforms']['common']:
# 			self._pconfig = config['platforms']['common']
# 
# 		if config['platforms'][platform_name]:
# 			self._pconfig.update(config['platforms'][platform_name])
# 
# 	@abstractmethod
# 	def setup(self):
# 		pass
# 
# 	@abstractmethod
# 	def after_setup(self, trigger_callback=None):
# 		pass
# 
# 	@abstractmethod
# 	def indicate_failure(self):
# 		pass
# 
# 	@abstractmethod
# 	def indicate_success(self):
# 		pass
# 
# 	@abstractmethod
# 	def indicate_recording(self, state=True):
# 		pass
# 
# 	@abstractmethod
# 	def indicate_playback(self, state=True):
# 		pass
# 
# 	@abstractmethod
# 	def indicate_processing(self, state=True):
# 		pass
# 
# 	@abstractmethod
# 	def force_recording(self):
# 		pass
# 
# 	@abstractmethod
# 	def cleanup(self):
# 		pass


# Path: src/alexapi/device_platforms/magicmirrorplatform.py
import logging
import threading
	import BaseHTTPServer
	import http.server as BaseHTTPServer
import urllib.parse as urlparse
from urllib.request import urlopen, URLError
from .baseplatform import BasePlatform

		logger.debug("Setting up Magic Mirror platform")
		logger.info("Magic Mirror HTTP Server - %s:%s", self.host_name, self.port_number)

		# Setup http server
		self.httpd = CallbackHTTPServer((self.host_name, self.port_number), MMHTTPHandler)
		self.httpd.set_callback(self.http_callback)
		self.serverthread = threading.Thread(target=self.httpd.serve_forever)
		self.serverthread.daemon = True

	def indicate_failure(self):
		logger.debug("Indicating Failure")

		self.update_mm("failure")

	def indicate_success(self):
		logger.debug("Indicating Success")

		self.update_mm("success")

	def after_setup(self, trigger_callback=None):

		self._trigger_callback = trigger_callback

		logger.debug("Starting Magic Mirror platform HTTP Server")
		self.serverthread.start()

		logger.debug("Starting Magic Mirror heartbeat with %s second interval", self.hb_timer)
		self.mm_heartbeat()

	def indicate_recording(self, state=True):

		logger.debug("Indicate Start Recording" if state else "Indicate Stop Recording")