summaryrefslogtreecommitdiff
path: root/ebus/model/__init__.py
diff options
context:
space:
mode:
Diffstat (limited to 'ebus/model/__init__.py')
-rw-r--r--ebus/model/__init__.py19
1 files changed, 10 insertions, 9 deletions
diff --git a/ebus/model/__init__.py b/ebus/model/__init__.py
index ecdf3bc..1e2d080 100644
--- a/ebus/model/__init__.py
+++ b/ebus/model/__init__.py
@@ -1,3 +1,4 @@
+# -*- coding:utf8 -*-
class DataField(object):
def __init__(self, name, offset):
self.name = name
@@ -5,20 +6,20 @@ class DataField(object):
def value(self,data):
raise NotImplemented()
- class Data1b(DataField):
- """
+class Data1b(DataField):
+ """
Beispiel für die Berechnung:
if ((x & 80h) == 80h) // y negativ
y = - [dez(!x) + 1]
else
y = dez(x)
"""
- def value(self,data):
- x = ord(data[self.offset])
- if x & 0x80 == 0x80:
- return (-1) * (0xff^x + 1)
- else:
- return x
+ def value(self,data):
+ x = ord(data[self.offset])
+ if x & 0x80 == 0x80:
+ return (-1) * (0xff^x + 1)
+ else:
+ return x
class Data1c(DataField):
def value(self,data):
@@ -81,7 +82,7 @@ class Byte(DataField):
class ByteEnum(DataField):
def __init__(self, name, offset, values):
- fields.DataField.__init__(self, name, offset)
+ DataField.__init__(self, name, offset)
self.values = values
def value(self, data):