Skip to content
Snippets Groups Projects
Commit e3b7100a authored by jkerdreu's avatar jkerdreu
Browse files

Addred addr = tools.get_random_uuid() if needed

git-svn-id: https://redmine.imt-atlantique.fr/svn/xaal/code/Python/trunk@1967 b32b6428-25c9-4566-ad07-03861ab6144f
parent 54e89c90
Branches
No related tags found
No related merge requests found
......@@ -29,3 +29,8 @@ you do.
If your device isn't in this package, please send us a email to add a schema
or use the xaal.lib.Device API directly. (don't tweak devices.py)
TODO
----
Right now xaal.lib.Attribute doesn't support type checking (You know, it's
Python anyway..) but I think we should provide some default type checking,
in devices module.
#=====================================================================
def ${name}(addr=None):
"""${doc}"""
if (addr==None):addr = tools.get_random_uuid()
dev = Device('${devtype}',addr)
% if (len(attributes) !=0):
......
......@@ -159,5 +159,7 @@ db = DeviceBuilder()
print("from xaal.lib import Device,tools")
print("import logging")
print("logger = logging.getLogger(__name__)")
print("from xaal.lib import tools")
print()
db.build_all()
from xaal.lib import Device,tools
import logging
logger = logging.getLogger(__name__)
from xaal.lib import tools
#=====================================================================
def audiomixer(addr=None):
"""Simple audio mixer with only one general volume control"""
if (addr==None):addr = tools.get_random_uuid()
dev = Device('audiomixer.basic',addr)
# -- Attributes --
......@@ -44,6 +47,7 @@ def audiomixer(addr=None):
#=====================================================================
def barometer(addr=None):
"""Simple barometer"""
if (addr==None):addr = tools.get_random_uuid()
dev = Device('barometer.basic',addr)
# -- Attributes --
......@@ -54,12 +58,14 @@ def barometer(addr=None):
#=====================================================================
def basic(addr=None):
"""Generic schema for any devices"""
if (addr==None):addr = tools.get_random_uuid()
dev = Device('basic.basic',addr)
return dev
#=====================================================================
def cache(addr=None):
"""Simple cache that can be queried about attributes of devices"""
if (addr==None):addr = tools.get_random_uuid()
dev = Device('cache.basic',addr)
# -- Methods --
......@@ -79,6 +85,7 @@ def cache(addr=None):
#=====================================================================
def co2meter(addr=None):
"""Simple CO2 meter"""
if (addr==None):addr = tools.get_random_uuid()
dev = Device('co2meter.basic',addr)
# -- Attributes --
......@@ -89,6 +96,7 @@ def co2meter(addr=None):
#=====================================================================
def door(addr=None):
"""Simple door device"""
if (addr==None):addr = tools.get_random_uuid()
dev = Device('door.basic',addr)
# -- Attributes --
......@@ -112,6 +120,7 @@ def door(addr=None):
#=====================================================================
def falldetector(addr=None):
"""Simple fall detection device"""
if (addr==None):addr = tools.get_random_uuid()
dev = Device('falldetector.basic',addr)
# -- Attributes --
......@@ -122,6 +131,7 @@ def falldetector(addr=None):
#=====================================================================
def gateway(addr=None):
"""Simple gateway that manage physical devices"""
if (addr==None):addr = tools.get_random_uuid()
dev = Device('gateway.basic',addr)
# -- Attributes --
......@@ -132,12 +142,14 @@ def gateway(addr=None):
#=====================================================================
def hmi(addr=None):
"""Basic Human Machine Interface"""
if (addr==None):addr = tools.get_random_uuid()
dev = Device('hmi.basic',addr)
return dev
#=====================================================================
def hygrometer(addr=None):
"""Simple hygrometer"""
if (addr==None):addr = tools.get_random_uuid()
dev = Device('hygrometer.basic',addr)
# -- Attributes --
......@@ -148,6 +160,7 @@ def hygrometer(addr=None):
#=====================================================================
def lamp(addr=None):
"""Simple lamp"""
if (addr==None):addr = tools.get_random_uuid()
dev = Device('lamp.basic',addr)
# -- Attributes --
......@@ -171,6 +184,7 @@ def lamp(addr=None):
#=====================================================================
def lamp_cie1931(addr=None):
"""Lamp color in cie1931 color space"""
if (addr==None):addr = tools.get_random_uuid()
dev = Device('lamp.cie1931',addr)
# -- Attributes --
......@@ -215,6 +229,7 @@ def lamp_cie1931(addr=None):
#=====================================================================
def lamp_dimmer(addr=None):
"""Lamp with a dimmer"""
if (addr==None):addr = tools.get_random_uuid()
dev = Device('lamp.dimmer',addr)
# -- Attributes --
......@@ -245,6 +260,7 @@ def lamp_dimmer(addr=None):
#=====================================================================
def luxmeter(addr=None):
"""Simple luxmeter"""
if (addr==None):addr = tools.get_random_uuid()
dev = Device('luxmeter.basic',addr)
# -- Attributes --
......@@ -255,6 +271,7 @@ def luxmeter(addr=None):
#=====================================================================
def mediaplayer(addr=None):
"""Generic media player"""
if (addr==None):addr = tools.get_random_uuid()
dev = Device('mediaplayer.basic',addr)
# -- Attributes --
......@@ -310,6 +327,7 @@ def mediaplayer(addr=None):
#=====================================================================
def mediaplayer_spotify(addr=None):
"""A Spotify player"""
if (addr==None):addr = tools.get_random_uuid()
dev = Device('mediaplayer.spotify',addr)
# -- Attributes --
......@@ -370,6 +388,7 @@ def mediaplayer_spotify(addr=None):
#=====================================================================
def metadatadb(addr=None):
"""Simple metatdata database to manage tags associated with devices"""
if (addr==None):addr = tools.get_random_uuid()
dev = Device('metadatadb.basic',addr)
# -- Methods --
......@@ -404,6 +423,7 @@ def metadatadb(addr=None):
#=====================================================================
def motion(addr=None):
"""Simple motion detector device"""
if (addr==None):addr = tools.get_random_uuid()
dev = Device('motion.basic',addr)
# -- Attributes --
......@@ -414,6 +434,7 @@ def motion(addr=None):
#=====================================================================
def powerrelay(addr=None):
"""Simple power relay device"""
if (addr==None):addr = tools.get_random_uuid()
dev = Device('powerrelay.basic',addr)
# -- Attributes --
......@@ -437,6 +458,7 @@ def powerrelay(addr=None):
#=====================================================================
def scales(addr=None):
"""Simple scales"""
if (addr==None):addr = tools.get_random_uuid()
dev = Device('scales.basic',addr)
# -- Attributes --
......@@ -447,6 +469,7 @@ def scales(addr=None):
#=====================================================================
def schemarepository(addr=None):
"""Simple schema repository that can be queried about a schema name"""
if (addr==None):addr = tools.get_random_uuid()
dev = Device('schemarepository.basic',addr)
# -- Methods --
......@@ -466,6 +489,7 @@ def schemarepository(addr=None):
#=====================================================================
def shutter(addr=None):
"""Simple shutter"""
if (addr==None):addr = tools.get_random_uuid()
dev = Device('shutter.basic',addr)
# -- Attributes --
......@@ -494,6 +518,7 @@ def shutter(addr=None):
#=====================================================================
def shutter_position(addr=None):
"""Shutter with a position managment"""
if (addr==None):addr = tools.get_random_uuid()
dev = Device('shutter.position',addr)
# -- Attributes --
......@@ -529,6 +554,7 @@ def shutter_position(addr=None):
#=====================================================================
def soundmeter(addr=None):
"""Simple sound meter"""
if (addr==None):addr = tools.get_random_uuid()
dev = Device('soundmeter.basic',addr)
# -- Attributes --
......@@ -539,6 +565,7 @@ def soundmeter(addr=None):
#=====================================================================
def switch(addr=None):
"""Simple switch button device"""
if (addr==None):addr = tools.get_random_uuid()
dev = Device('switch.basic',addr)
# -- Attributes --
......@@ -549,6 +576,7 @@ def switch(addr=None):
#=====================================================================
def thermometer(addr=None):
"""Simple thermometer"""
if (addr==None):addr = tools.get_random_uuid()
dev = Device('thermometer.basic',addr)
# -- Attributes --
......@@ -559,6 +587,7 @@ def thermometer(addr=None):
#=====================================================================
def tts(addr=None):
"""Text-To-Speech devices"""
if (addr==None):addr = tools.get_random_uuid()
dev = Device('tts.basic',addr)
# -- Methods --
......@@ -573,6 +602,7 @@ def tts(addr=None):
#=====================================================================
def window(addr=None):
"""Simple window device"""
if (addr==None):addr = tools.get_random_uuid()
dev = Device('window.basic',addr)
# -- Attributes --
......@@ -596,6 +626,7 @@ def window(addr=None):
#=====================================================================
def worktop(addr=None):
"""Simple worktop, e.g. kitchen worktop"""
if (addr==None):addr = tools.get_random_uuid()
dev = Device('worktop.basic',addr)
# -- Attributes --
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment