text: #####
  # 
  # This class is part of the Programming the Internet of Things project.
  # 
  # It is provided as a simple shell to guide the student and assist with
  # implementation for the Programming the Internet of Things exercises,
  # and designed to be modified by the student as needed.
  #
  
  import logging
  
  from apscheduler.schedulers.background import BackgroundScheduler
  
  from programmingtheiot.common.IDataMessageListener import IDataMessageListener
  
  from programmingtheiot.cda.sim.TemperatureSensorSimTask import TemperatureSensorSimTask
  from programmingtheiot.cda.sim.HumiditySensorSimTask import HumiditySensorSimTask
  from programmingtheiot.cda.sim.SensorDataGenerator import SensorDataGenerator
  from programmingtheiot.common.ConfigUtil import ConfigUtil
  from programmingtheiot.common import ConfigConst
  from programmingtheiot.cda.sim.PressureSensorSimTask import PressureSensorSimTask
  from builtins import __import__
  #from programmingtheiot.part02.unit.sim import TemperatureSensorSimTaskTest
  
  class SensorAdapterManager(object):
  	"""
  	Shell representation of class for student implementation.
  	
  	"""
  
  	def __init__(self, useEmulator: bool = False, pollRate: int = 5, allowConfigOverride: bool = True):
  		self.useEmulator = useEmulator
  		self.pollRate = pollRate
  		self.dataMsgListener = None
  		
  		"""
  		Creating a scheduler and adding a job to the scheduler for later execution
  		"""
  		self.scheduler = BackgroundScheduler()
  		self.scheduler.add_job(self.handleTelemetry, 'interval', seconds = self.pollRate)
  		
  		if self.useEmulator == True:
  			logging.info("Emulators will be used")
  			
  			"""
  			Loading the Humidity Emulator
  			"""
  			humidityModule = __import__('programmingtheiot.cda.emulated.HumiditySensorEmulatorTask', fromlist = ['HumiditySensorEmulatorTask'])
  			heClazz = getattr(humidityModule, 'HumiditySensorEmulatorTask')
  			self.humidityEmulator = heClazz()
  			
  			"""
  			Loading the Pressure Emulator
  			"""
  			pressureModule = __import__('programmingtheiot.cda.emulated.PressureSensorEmulatorTask', fromlist = ['PressureSensorEmulatedTask'])
  			pressureAttribute = getattr(pressureModule, 'PressureSensorEmulatorTask')
  			self.pressureEmulator = pressureAttribute()
  			
  			"""
  			Loading the Temperature Emulator
  			"""
  			temperatureModule = __import__('programmingtheiot.cda.emulated.TemperatureSensorEmulatorTask', fromlist = ['TemperatureSensorEmulatedTask'])
  			temperatureAttribute = getattr(temperatureModule, 'TemperatureSensorEmulatorTask')
  			self.temperatureEmulator = temperatureAttribute
  		else:
  			logging.info("Simulators will be used")
  			self.dataGenerator = SensorDataGenerator()
  			configUtil = ConfigUtil()
  			humidityFloor = configUtil.getFloat(ConfigConst.CONSTRAINED_DEVICE, ConfigConst.HUMIDITY_SIM_FLOOR_KEY, SensorDataGenerator.LOW_NORMAL_ENV_HUMIDITY)
  			humidityCeiling = configUtil.getFloat(ConfigConst.CONSTRAINED_DEVICE, ConfigConst.HUMIDITY_SIM_CEILING_KEY, SensorDataGenerator.HI_NORMAL_ENV_HUMIDITY)
  		
  	def handleTelemetry(self):
  		if self.useEmulator == False:
  			humiditySensorData = self.humiditySensorSimTask.generateTelemetry()
  			pressureSensorData = self.pressureSensorSimTask.generateTelemetry()
  			temperatureSensorData = self.temperatureSensorSimTask.generateTelemetry()
  			self.dataMsgListener.handleSensorMessage(humiditySensorData)
  			self.dataMsgListener.handleSensorMessage(pressureSensorData)
  			self.dataMsgListener.handleSensorMessage(temperatureSensorData)
  		else:
  			humiditySensorData = self.humidityEmulator.generateTelemetry()
  			pressureSensorData = self.pressureEmulator.generatorTelemetry()
  			temperatureSensorData = self.temperatureEmulator.generateTelemetry()
  			self.dataMsgListener.handleSensorMessage(humiditySensorData)
  			self.dataMsgListener.handleSensorMessage(pressureSensorData)
  			self.dataMsgListener.handleSensorMessage(temperatureSensorData)
  		
  	def setDataMessageListener(self, listener: IDataMessageListener) -> bool:
  		pass
  	
  	def startManager(self):
  		pass
  		
  	def stopManager(self):
  		pass
  