generated from selabhvl/ing301-projectpartA-startcode
-
Notifications
You must be signed in to change notification settings - Fork 0
/
devices.py
39 lines (22 loc) · 754 Bytes
/
devices.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
import json
f = open('dev.json')
devs = json.load(f)
class Device:
def __init__(self):
self.devices = devs
class Sensor(Device):
def __init__(self):
self.sensors = []
def add_sensors(self, devices):
for i in devices['dev_type']:
if i == "sensor" or "aktuator & sensor":
print(i)
self.sensors.append(i)
class Actuator(Device):
def __init__(self):
self.actuators = []
def add_actuators(self, devices):
for i in devices['dev_type']:
if i == "actuator" or "aktuator & sensor":
self.actuators.append(i)
# TODO! Her skal du utvikle din egen design av en klassestruktur med enheter og deres funkjsoner!