Mock.py 398 Bytes
Newer Older
Pedro Henrique Kopper's avatar
Pedro Henrique Kopper committed
1
2
from random import random

3
class Mock(object):
4
    def __init__(self, logger, location, channels):
5
        self.channels = len(channels)
6
        logger("[MOCK]", "Generating fake data...")
7
8
        self.reading = 10

9
    def read(self, channel):
10
11
12
        self.reading += (random() - 0.5)
        return self.reading

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