api/iodevices: simplify LUMPDevice API

All these device can do is read or write values at a particular mode. There is also no need for separate mode setters.
This commit is contained in:
Laurens Valk
2020-01-06 17:48:03 +01:00
parent 09d453480b
commit 5a2d1f5406
+7 -45
View File
@@ -12,64 +12,26 @@ class LUMPDevice():
"""
pass
def read(self):
"""Read latest values from the sensor.
def read(self, mode):
"""Read values from a given mode.
Arguments:
mode (``int``): Device mode.
Returns:
``tuple``: Values read from the sensor.
"""
pass
def write(self, values):
def write(self, mode, values):
"""Write values to the sensor.
Arguments:
mode (``int``): Device mode.
data (``tuple``): Values to be written.
"""
pass
def get_mode(self):
"""Get the currently active mode or combi-mode.
Returns:
``tuple``: Values read from the sensor.
"""
pass
def set_mode(self, mode):
"""Set the sensor to a given mode.
Arguments:
mode (``int``): Mode index.
"""
pass
def set_combi_mode(self, todo1, todo2):
"""Set the sensor to a given combi-mode.
TODO: Need to figure out how this works.
Arguments:
TODO (``tuple``): TODO.
"""
pass
def format(self):
"""Get the data type for the currently active mode.
Returns:
``str``: Struct format specifier.
"""
pass
def id(self):
"""Get the unique type ID for this device.
Returns:
``int``: Device ID.
"""
pass
class AnalogSensor():
"""Generic or custom analog sensor."""