summaryrefslogtreecommitdiff
path: root/ebus/model/__init__.py
diff options
context:
space:
mode:
authoryvesf <yvesf-git@xapek.org>2010-08-15 22:54:27 +0200
committeryvesf <yvesf-git@xapek.org>2010-08-15 22:54:27 +0200
commit7ff580a6fe60f7e3ea160f7b181ff0fa934453ce (patch)
tree55ea82fdffaaf50ed099f3bc663cb083952d1fc5 /ebus/model/__init__.py
parent3e70cb0892a703888e913ee5a1545f488a22a4a3 (diff)
downloadebus-alt-7ff580a6fe60f7e3ea160f7b181ff0fa934453ce.tar.gz
ebus-alt-7ff580a6fe60f7e3ea160f7b181ff0fa934453ce.zip
So 15. Aug 22:54:27 CEST 2010
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):