diff --git a/libs/schemas/xaal/schemas/devices.py b/libs/schemas/xaal/schemas/devices.py index c207820b25736ff87589f738988e05cce68dd2ea..78c33b6a1781568c634c639f517090f3ac5bab84 100644 --- a/libs/schemas/xaal/schemas/devices.py +++ b/libs/schemas/xaal/schemas/devices.py @@ -1,18 +1,22 @@ """ -Autogenerated devices skeletons. This file is generated from the json schemas +Autogenerated devices skeletons. This file is generated from the json schemas at https://redmine.telecom-bretagne.eu/svn/xaal/schemas/branches/schemas-0.7 This python module is updated frequently according to schemas """ - -from xaal.lib import Device,tools import logging +from typing import Optional + +from xaal.lib import Device, tools +from xaal.lib.bindings import UUID + logger = logging.getLogger(__name__) + #===================================================================== -def barometer(addr=None): +def barometer(addr: Optional[UUID] = None) -> Device: """Simple barometer""" addr = addr or tools.get_random_uuid() dev = Device('barometer.basic',addr) @@ -23,14 +27,14 @@ def barometer(addr=None): return dev #===================================================================== -def basic(addr=None): +def basic(addr: Optional[UUID] = None) -> Device: """Generic schema for any devices""" addr = addr or tools.get_random_uuid() dev = Device('basic.basic',addr) return dev #===================================================================== -def battery(addr=None): +def battery(addr: Optional[UUID] = None) -> Device: """Report on state of a battery""" addr = addr or tools.get_random_uuid() dev = Device('battery.basic',addr) @@ -43,14 +47,14 @@ def battery(addr=None): return dev #===================================================================== -def button(addr=None): +def button(addr: Optional[UUID] = None) -> Device: """Simple button device""" addr = addr or tools.get_random_uuid() dev = Device('button.basic',addr) return dev #===================================================================== -def button_remote(addr=None): +def button_remote(addr: Optional[UUID] = None) -> Device: """Simple remote device with several buttons""" addr = addr or tools.get_random_uuid() dev = Device('button.remote',addr) @@ -65,7 +69,7 @@ def button_remote(addr=None): return dev #===================================================================== -def cache(addr=None): +def cache(addr: Optional[UUID] = None) -> Device: """Simple cache that can be queried about attributes of devices""" addr = addr or tools.get_random_uuid() dev = Device('cache.basic',addr) @@ -80,7 +84,7 @@ def cache(addr=None): return dev #===================================================================== -def co2meter(addr=None): +def co2meter(addr: Optional[UUID] = None) -> Device: """Simple CO2 meter""" addr = addr or tools.get_random_uuid() dev = Device('co2meter.basic',addr) @@ -91,7 +95,7 @@ def co2meter(addr=None): return dev #===================================================================== -def contact(addr=None): +def contact(addr: Optional[UUID] = None) -> Device: """Simple contact-sensor device; e.g. door or window opening sensor""" addr = addr or tools.get_random_uuid() dev = Device('contact.basic',addr) @@ -102,7 +106,7 @@ def contact(addr=None): return dev #===================================================================== -def door(addr=None): +def door(addr: Optional[UUID] = None) -> Device: """Simple door device""" addr = addr or tools.get_random_uuid() dev = Device('door.basic',addr) @@ -126,7 +130,7 @@ def door(addr=None): return dev #===================================================================== -def falldetector(addr=None): +def falldetector(addr: Optional[UUID] = None) -> Device: """Simple fall detection device""" addr = addr or tools.get_random_uuid() dev = Device('falldetector.basic',addr) @@ -137,7 +141,7 @@ def falldetector(addr=None): return dev #===================================================================== -def gateway(addr=None): +def gateway(addr: Optional[UUID] = None) -> Device: """Simple gateway that manage physical devices""" addr = addr or tools.get_random_uuid() dev = Device('gateway.basic',addr) @@ -150,14 +154,14 @@ def gateway(addr=None): return dev #===================================================================== -def hmi(addr=None): +def hmi(addr: Optional[UUID] = None) -> Device: """Basic Human Machine Interface""" addr = addr or tools.get_random_uuid() dev = Device('hmi.basic',addr) return dev #===================================================================== -def hygrometer(addr=None): +def hygrometer(addr: Optional[UUID] = None) -> Device: """Simple hygrometer""" addr = addr or tools.get_random_uuid() dev = Device('hygrometer.basic',addr) @@ -168,7 +172,7 @@ def hygrometer(addr=None): return dev #===================================================================== -def lamp(addr=None): +def lamp(addr: Optional[UUID] = None) -> Device: """Simple lamp""" addr = addr or tools.get_random_uuid() dev = Device('lamp.basic',addr) @@ -192,7 +196,7 @@ def lamp(addr=None): return dev #===================================================================== -def lamp_color(addr=None): +def lamp_color(addr: Optional[UUID] = None) -> Device: """Color-changing lamp""" addr = addr or tools.get_random_uuid() dev = Device('lamp.color',addr) @@ -256,7 +260,7 @@ def lamp_color(addr=None): return dev #===================================================================== -def lamp_dimmer(addr=None): +def lamp_dimmer(addr: Optional[UUID] = None) -> Device: """Simple dimmable lamp""" addr = addr or tools.get_random_uuid() dev = Device('lamp.dimmer',addr) @@ -294,7 +298,7 @@ def lamp_dimmer(addr=None): return dev #===================================================================== -def lamp_toggle(addr=None): +def lamp_toggle(addr: Optional[UUID] = None) -> Device: """Simple lamp with toggle function - Note that a toggle function may leads to undefined state due to its stateful nature; its usage should be avoided.""" addr = addr or tools.get_random_uuid() dev = Device('lamp.toggle',addr) @@ -323,7 +327,7 @@ def lamp_toggle(addr=None): return dev #===================================================================== -def lightgauge(addr=None): +def lightgauge(addr: Optional[UUID] = None) -> Device: """Simple light gauge""" addr = addr or tools.get_random_uuid() dev = Device('lightgauge.basic',addr) @@ -334,7 +338,7 @@ def lightgauge(addr=None): return dev #===================================================================== -def linkquality(addr=None): +def linkquality(addr: Optional[UUID] = None) -> Device: """Report on quality of a transmission link""" addr = addr or tools.get_random_uuid() dev = Device('linkquality.basic',addr) @@ -347,7 +351,7 @@ def linkquality(addr=None): return dev #===================================================================== -def luxmeter(addr=None): +def luxmeter(addr: Optional[UUID] = None) -> Device: """Simple luxmeter""" addr = addr or tools.get_random_uuid() dev = Device('luxmeter.basic',addr) @@ -358,7 +362,7 @@ def luxmeter(addr=None): return dev #===================================================================== -def metadatadb(addr=None): +def metadatadb(addr: Optional[UUID] = None) -> Device: """Simple metatdata database to manage tags associated with devices""" addr = addr or tools.get_random_uuid() dev = Device('metadatadb.basic',addr) @@ -388,7 +392,7 @@ def metadatadb(addr=None): return dev #===================================================================== -def motion(addr=None): +def motion(addr: Optional[UUID] = None) -> Device: """Simple motion detector device""" addr = addr or tools.get_random_uuid() dev = Device('motion.basic',addr) @@ -399,7 +403,7 @@ def motion(addr=None): return dev #===================================================================== -def powermeter(addr=None): +def powermeter(addr: Optional[UUID] = None) -> Device: """Simple powermeter""" addr = addr or tools.get_random_uuid() dev = Device('powermeter.basic',addr) @@ -414,7 +418,7 @@ def powermeter(addr=None): return dev #===================================================================== -def powerrelay(addr=None): +def powerrelay(addr: Optional[UUID] = None) -> Device: """Simple power relay device""" addr = addr or tools.get_random_uuid() dev = Device('powerrelay.basic',addr) @@ -438,7 +442,7 @@ def powerrelay(addr=None): return dev #===================================================================== -def powerrelay_toggle(addr=None): +def powerrelay_toggle(addr: Optional[UUID] = None) -> Device: """Power relay with toggle function - Note that a toggle function may leads to undefined state due to its stateful nature; its usage should be avoided.""" addr = addr or tools.get_random_uuid() dev = Device('powerrelay.toggle',addr) @@ -467,7 +471,7 @@ def powerrelay_toggle(addr=None): return dev #===================================================================== -def raingauge(addr=None): +def raingauge(addr: Optional[UUID] = None) -> Device: """Simple rain gauge""" addr = addr or tools.get_random_uuid() dev = Device('raingauge.basic',addr) @@ -480,7 +484,7 @@ def raingauge(addr=None): return dev #===================================================================== -def scale(addr=None): +def scale(addr: Optional[UUID] = None) -> Device: """Simple scale""" addr = addr or tools.get_random_uuid() dev = Device('scale.basic',addr) @@ -491,7 +495,7 @@ def scale(addr=None): return dev #===================================================================== -def scenario(addr=None): +def scenario(addr: Optional[UUID] = None) -> Device: """Simple Scenario""" addr = addr or tools.get_random_uuid() dev = Device('scenario.basic',addr) @@ -527,7 +531,7 @@ def scenario(addr=None): return dev #===================================================================== -def shutter(addr=None): +def shutter(addr: Optional[UUID] = None) -> Device: """Simple shutter""" addr = addr or tools.get_random_uuid() dev = Device('shutter.basic',addr) @@ -556,7 +560,7 @@ def shutter(addr=None): return dev #===================================================================== -def shutter_position(addr=None): +def shutter_position(addr: Optional[UUID] = None) -> Device: """Shutter with a position managment""" addr = addr or tools.get_random_uuid() dev = Device('shutter.position',addr) @@ -592,7 +596,7 @@ def shutter_position(addr=None): return dev #===================================================================== -def soundmeter(addr=None): +def soundmeter(addr: Optional[UUID] = None) -> Device: """Simple soundmeter""" addr = addr or tools.get_random_uuid() dev = Device('soundmeter.basic',addr) @@ -603,7 +607,7 @@ def soundmeter(addr=None): return dev #===================================================================== -def switch(addr=None): +def switch(addr: Optional[UUID] = None) -> Device: """Simple switch button device""" addr = addr or tools.get_random_uuid() dev = Device('switch.basic',addr) @@ -614,7 +618,7 @@ def switch(addr=None): return dev #===================================================================== -def thermometer(addr=None): +def thermometer(addr: Optional[UUID] = None) -> Device: """Simple thermometer""" addr = addr or tools.get_random_uuid() dev = Device('thermometer.basic',addr) @@ -625,7 +629,7 @@ def thermometer(addr=None): return dev #===================================================================== -def tts(addr=None): +def tts(addr: Optional[UUID] = None) -> Device: """Text-To-Speech device""" addr = addr or tools.get_random_uuid() dev = Device('tts.basic',addr) @@ -640,7 +644,7 @@ def tts(addr=None): return dev #===================================================================== -def windgauge(addr=None): +def windgauge(addr: Optional[UUID] = None) -> Device: """Simple wind gauge""" addr = addr or tools.get_random_uuid() dev = Device('windgauge.basic',addr) @@ -657,7 +661,7 @@ def windgauge(addr=None): return dev #===================================================================== -def window(addr=None): +def window(addr: Optional[UUID] = None) -> Device: """Simple window device""" addr = addr or tools.get_random_uuid() dev = Device('window.basic',addr) @@ -681,7 +685,7 @@ def window(addr=None): return dev #===================================================================== -def worktop(addr=None): +def worktop(addr: Optional[UUID] = None) -> Device: """Simple worktop""" addr = addr or tools.get_random_uuid() dev = Device('worktop.basic',addr) diff --git a/libs/schemas/xaal/schemas/devices_py.mako b/libs/schemas/xaal/schemas/devices_py.mako index a2c58f4f5f3e369e0345b0a6540643285cf103ed..1423d3ea00985cb70fb864b39ba839629cfa2b24 100644 --- a/libs/schemas/xaal/schemas/devices_py.mako +++ b/libs/schemas/xaal/schemas/devices_py.mako @@ -1,5 +1,5 @@ #===================================================================== -def ${name}(addr=None): +def ${name}(addr: Optional[UUID] = None) -> Device: """${doc}""" addr = addr or tools.get_random_uuid() dev = Device('${devtype}',addr) @@ -39,9 +39,9 @@ def ${name}(addr=None): %> def default_${meth}(${args}): """${methods[meth]['description']}""" % if len(args) == 0: - logger.info("default_${meth}()") + logger.warning("default_${meth}()") % else: - logger.info("default_${meth}(${buf})" % (${print_keys})) + logger.warning("default_${meth}(${buf})" % (${print_keys})) % endif % endfor diff --git a/libs/schemas/xaal/schemas/head_py.txt b/libs/schemas/xaal/schemas/head_py.txt index 90fc65059358432cd5c5eae0bd7bf4704d0e9a8b..6137b3691adcd0c0c012450455145d6949cd8eb0 100644 --- a/libs/schemas/xaal/schemas/head_py.txt +++ b/libs/schemas/xaal/schemas/head_py.txt @@ -5,8 +5,12 @@ at https://redmine.telecom-bretagne.eu/svn/xaal/schemas/branches/schemas-0.7 This python module is updated frequently according to schemas """ - -from xaal.lib import Device,tools import logging +from typing import Optional + +from xaal.lib import Device, tools +from xaal.lib.bindings import UUID + logger = logging.getLogger(__name__) +