summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoryvesf <yvesf@d0e8fea9-7529-0410-93fb-d39fd5b9c1dd>2010-04-13 20:52:25 +0000
committeryvesf <yvesf@d0e8fea9-7529-0410-93fb-d39fd5b9c1dd>2010-04-13 20:52:25 +0000
commit757d99f7e2e3655b4cb24a1d15b99d655062ac9f (patch)
tree1c5d3bf71683e26123b499b848c562642046b470
parent224d5ec3684294189637cd5feb9a67319baa2b12 (diff)
downloadebus-alt-757d99f7e2e3655b4cb24a1d15b99d655062ac9f.tar.gz
ebus-alt-757d99f7e2e3655b4cb24a1d15b99d655062ac9f.zip
foo
git-svn-id: http://10.2.2.13/svn/common/ebus@1655 d0e8fea9-7529-0410-93fb-d39fd5b9c1dd
-rw-r--r--dist/ebus-0.2_r1652-py2.5.eggbin10378 -> 10430 bytes
-rw-r--r--ebus/__init__.py36
2 files changed, 20 insertions, 16 deletions
diff --git a/dist/ebus-0.2_r1652-py2.5.egg b/dist/ebus-0.2_r1652-py2.5.egg
index 8ff5829..52e26c9 100644
--- a/dist/ebus-0.2_r1652-py2.5.egg
+++ b/dist/ebus-0.2_r1652-py2.5.egg
Binary files differ
diff --git a/ebus/__init__.py b/ebus/__init__.py
index eadb397..3a7e363 100644
--- a/ebus/__init__.py
+++ b/ebus/__init__.py
@@ -91,10 +91,10 @@ class fields:
else:
return None
-#Pflichfelder: primary, secondary, name, id, format (auch leer)
+#Pflichfelder: primary, secondary, description, name, format (auch leer)
packetDescription = [
# Service 0x05 (Brennersteuerbefehle)
- {'primary':0x5, 'secondary':0x3, 'name':'Betriebsdaten des Feuerungsautomaten an den Regler Block1','id':'betriebsdatenRegler1', 'format': {
+ {'primary':0x5, 'secondary':0x3, 'description':'Betriebsdaten des Feuerungsautomaten an den Regler Block1','name':'betriebsdatenRegler1', 'format': {
'blocknumber':fields.Byte(0),
#('errorCode':fields.Byte(1),
'stellgradKesselleistung':fields.Byte(3),
@@ -109,7 +109,7 @@ packetDescription = [
#'gemeinsameVorlaufTemperatur':fields.Data1c(5)),
}},
- {'primary':0x5, 'secondary':0x7, 'name':'Betriebsdaten des Reglers an den Feuerungsautomaten','id':'betriebsdatenFeuerungsautomat','format': {
+ {'primary':0x5, 'secondary':0x7, 'description':'Betriebsdaten des Reglers an den Feuerungsautomaten','name':'betriebsdatenFeuerungsautomat','format': {
'betriebszustand':fields.ByteEnum(0, {
0x00:'Brenner Abschalten',
0x01:'Keine Aktion',
@@ -133,7 +133,7 @@ packetDescription = [
'brauchwasserSollwert':fields.Data1c(7)
}},
# Service 0x07 (Systemdatenbefehle)
- {'primary':0x7, 'secondary':0x0, 'name':'Datum/Zeit - Meldung eines eBUS Masters', 'id':'datumZeit', 'format': {
+ {'primary':0x7, 'secondary':0x0, 'description':'Datum/Zeit - Meldung eines eBUS Masters', 'name':'datumZeit', 'format': {
'ausenTemperatur':fields.Data2b(0),
'sekunden':fields.Bcd(2),
'minuten':fields.Bcd(3),
@@ -143,11 +143,11 @@ packetDescription = [
'wochentag':fields.Bcd(7),
'jahr':fields.Bcd(8)}},
- {'primary':0x7, 'secondary':0x4, 'name':'Identifikation', 'id':'identifikation', 'format':{
+ {'primary':0x7, 'secondary':0x4, 'description':'Identifikation', 'name':'identifikation', 'format':{
}},
# Service 0x08 (Reglerbefehle)
- {'primary':0x8, 'secondary':0x0, 'name':'Sollwertübertragung des Reglers an andere Regler', 'id':'sollwertÜbertragungRegler', 'format':{
+ {'primary':0x8, 'secondary':0x0, 'description':'Sollwertübertragung des Reglers an andere Regler', 'name':'sollwertÜbertragungRegler', 'format':{
}},
# Response
@@ -156,10 +156,10 @@ packetDescription = [
#p[2] = 10^2
#p[3] = 10^4
#p[4] = 10^6
- {'primary':0x3, 'secondary':0x8, 'name':'Gesamtbrennstoffmengenzähler lesen', 'id':'brenstoffMengeLesen', 'format':{
+ {'primary':0x3, 'secondary':0x8, 'description':'Gesamtbrennstoffmengenzähler lesen', 'name':'brenstoffMengeLesen', 'format':{
}},
- {'primary':0x50, 'secondary':0x17, 'name':'Solar Daten', 'id': 'solarDaten', 'format':{
+ {'primary':0x50, 'secondary':0x17, 'description':'Solar Daten', 'name': 'solarDaten', 'format':{
'solarPumpe':fields.Bit(0),
'tempKollektor':fields.Data2c(2),
'tempWarmwasserSolar':fields.Data2c(4)}},
@@ -183,9 +183,13 @@ class EbusPacket(object):
self.secondary_command = secondary_command
def name(self):
- if self.description():
- return self.description()['name']
+ if self._definition():
+ return self._definition()['name']
+ def description(self):
+ if self._definition():
+ return self._definition()['description']
+
def __str__(self):
#XXX self.length only in subclasses
return "<%-18s name=\"%-15s\" source=\"%s\" destination=\"%s\" primary=0x%x secondary=0x%x length=0x%x %s>" % \
@@ -193,7 +197,7 @@ class EbusPacket(object):
self.primary_command, self.secondary_command, self.length, \
" ".join(map(lambda name: "%s=%s" % (name, self.values()[name]),self.values())))
- def description(self):
+ def _definition(self):
desc = filter(lambda p: p['primary'] == self.primary_command \
and p['secondary'] == self.secondary_command, packetDescription)
if len(desc) > 0:
@@ -202,12 +206,12 @@ class EbusPacket(object):
return None
def values(self):
- desc = self.description()
- if not desc or not desc.has_key('format'):
- return dict()
- else:
+ definition = self._definition()
+ if definition and definition.has_key('format'):
#XXX self.data only in subclass
- return dict( map(lambda name: (name, desc['format'][name].value(self.data) ), desc['format'].keys()) )
+ return dict( map(lambda name: (name, definition['format'][name].value(self.data) ), definition['format'].keys()) )
+ else:
+ return dict()
class EbusMasterMaster(EbusPacket):
def __init__(self, source, destination, primary_command, secondary_command, data):