class MachineChecker:
	mPowerAverageThresholdOn = 0.0
	mPowerAverageThresholdOff = 0.0

	mMa = None
	mEdimaxDevice = None

	def __init__( self, thresholdOn, thresholdOff , numAvgValues ,machineHost ):
		self.mEdimaxDevice = EdimaxDevice(machineHost)
		self.mPowerAverageThresholdOn = thresholdOn
		self.mPowerAverageThresholdOff = thresholdOff
		self.mMa = MovingAverage(numAvgValues)

	def mainloop(self):
		while True:
			print "Average Value is %f" %  self.mMa.add(self.mEdimaxDevice.getCurrentPowerUsage()['watts'])
			if self.mMa.average() < self.mPowerAverageThresholdOff:
				print "Machine has finished"
				return
			time.sleep(2)
	def __init__( self, thresholdOn, thresholdOff , numAvgValues ,machineHost ):
		self.mEdimaxDevice = EdimaxDevice(machineHost)
		self.mPowerAverageThresholdOn = thresholdOn
		self.mPowerAverageThresholdOff = thresholdOff
		self.mMa = MovingAverage(numAvgValues)