Mock.py 503 Bytes
Newer Older
Pedro Henrique Kopper's avatar
Pedro Henrique Kopper committed
1
from random import random
2
from util.Logger import Logger
Pedro Henrique Kopper's avatar
Pedro Henrique Kopper committed
3

4
class Mock(object):
5 6 7 8 9
    def __init__(self, location, channels):
        self.logger = Logger()
        self.logger.writeLog("mock", "teste!!!")
        self.logger.writeLog("mock", "deu certo!!!")

10
        self.channels = len(channels)
11 12
        self.reading = 10

13
    def read(self, channel):
14 15 16
        self.reading += (random() - 0.5)
        return self.reading

17
    def readAll(self):
18
        return [self.read(0) for i in range(self.channels)]