You can subscribe to this list here.
| 2010 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
(1) |
Nov
(121) |
Dec
(58) |
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 2011 |
Jan
(38) |
Feb
(36) |
Mar
(7) |
Apr
(2) |
May
(32) |
Jun
(24) |
Jul
(16) |
Aug
(21) |
Sep
(17) |
Oct
(62) |
Nov
(60) |
Dec
(70) |
| 2012 |
Jan
(54) |
Feb
(41) |
Mar
(21) |
Apr
(38) |
May
(76) |
Jun
(47) |
Jul
(25) |
Aug
(72) |
Sep
(29) |
Oct
(64) |
Nov
(93) |
Dec
(97) |
| 2013 |
Jan
(100) |
Feb
(168) |
Mar
(115) |
Apr
(59) |
May
(37) |
Jun
(32) |
Jul
(45) |
Aug
(42) |
Sep
(24) |
Oct
(73) |
Nov
(64) |
Dec
(4) |
| 2014 |
Jan
(14) |
Feb
(57) |
Mar
(58) |
Apr
(10) |
May
(18) |
Jun
(12) |
Jul
(7) |
Aug
(12) |
Sep
(15) |
Oct
(6) |
Nov
(32) |
Dec
(17) |
| 2015 |
Jan
(50) |
Feb
(5) |
Mar
(1) |
Apr
(26) |
May
(10) |
Jun
(3) |
Jul
(3) |
Aug
(2) |
Sep
(3) |
Oct
(18) |
Nov
(18) |
Dec
(8) |
| 2016 |
Jan
(33) |
Feb
(35) |
Mar
(50) |
Apr
(20) |
May
(25) |
Jun
(17) |
Jul
(8) |
Aug
(73) |
Sep
(64) |
Oct
(51) |
Nov
(20) |
Dec
(14) |
| 2017 |
Jan
(41) |
Feb
(57) |
Mar
(44) |
Apr
(136) |
May
(32) |
Jun
(39) |
Jul
(2) |
Aug
(12) |
Sep
(32) |
Oct
(103) |
Nov
(12) |
Dec
(4) |
| 2018 |
Jan
(9) |
Feb
(1) |
Mar
(60) |
Apr
(24) |
May
(15) |
Jun
(1) |
Jul
(2) |
Aug
(23) |
Sep
(15) |
Oct
(57) |
Nov
(21) |
Dec
(77) |
| 2019 |
Jan
(62) |
Feb
(99) |
Mar
(98) |
Apr
(49) |
May
(6) |
Jun
(3) |
Jul
(6) |
Aug
(18) |
Sep
(9) |
Oct
(15) |
Nov
(30) |
Dec
(6) |
| 2020 |
Jan
(14) |
Feb
(2) |
Mar
(22) |
Apr
(33) |
May
(47) |
Jun
(12) |
Jul
|
Aug
|
Sep
(4) |
Oct
(2) |
Nov
(5) |
Dec
(5) |
| 2021 |
Jan
(4) |
Feb
(101) |
Mar
(13) |
Apr
(32) |
May
(40) |
Jun
|
Jul
(3) |
Aug
|
Sep
|
Oct
(25) |
Nov
(12) |
Dec
|
| 2022 |
Jan
(154) |
Feb
(82) |
Mar
(63) |
Apr
(27) |
May
(26) |
Jun
(5) |
Jul
(12) |
Aug
(23) |
Sep
(17) |
Oct
(37) |
Nov
(13) |
Dec
(21) |
| 2023 |
Jan
(43) |
Feb
(43) |
Mar
(15) |
Apr
(8) |
May
(3) |
Jun
(25) |
Jul
(6) |
Aug
(38) |
Sep
(5) |
Oct
(20) |
Nov
(9) |
Dec
(28) |
| 2024 |
Jan
(15) |
Feb
(2) |
Mar
(12) |
Apr
(2) |
May
(8) |
Jun
(10) |
Jul
(10) |
Aug
(2) |
Sep
(3) |
Oct
(15) |
Nov
(6) |
Dec
(20) |
| 2025 |
Jan
|
Feb
(2) |
Mar
(6) |
Apr
(2) |
May
(2) |
Jun
|
Jul
|
Aug
(1) |
Sep
(1) |
Oct
(11) |
Nov
|
Dec
|
|
From: <ni...@us...> - 2010-11-04 21:54:19
|
Revision: 78
http://openautomation.svn.sourceforge.net/openautomation/?rev=78&view=rev
Author: nilss1
Date: 2010-11-04 21:54:13 +0000 (Thu, 04 Nov 2010)
Log Message:
-----------
added Warning when non Unicode Data ist set by a connector
Modified Paths:
--------------
PyWireGate/trunk/datastore.py
Modified: PyWireGate/trunk/datastore.py
===================================================================
--- PyWireGate/trunk/datastore.py 2010-11-04 21:50:46 UTC (rev 77)
+++ PyWireGate/trunk/datastore.py 2010-11-04 21:54:13 UTC (rev 78)
@@ -208,6 +208,9 @@
self.write_mutex.acquire()
## save the modified time
self.lastupdate = time.time()
+ if type(val) == str:
+ self.WG.log("Non Unicode Value received for %s" % self.id,'warning')
+ val = unicode(val,encoding='iso-8859-15',errors='ignore')
self.value = val
if send:
self._setValue(self)
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ni...@us...> - 2010-11-04 21:50:52
|
Revision: 77
http://openautomation.svn.sourceforge.net/openautomation/?rev=77&view=rev
Author: nilss1
Date: 2010-11-04 21:50:46 +0000 (Thu, 04 Nov 2010)
Log Message:
-----------
Fixed: Date and Time returned str instead pf unicode
Modified Paths:
--------------
PyWireGate/trunk/knx_connector/DPT_Types.py
Modified: PyWireGate/trunk/knx_connector/DPT_Types.py
===================================================================
--- PyWireGate/trunk/knx_connector/DPT_Types.py 2010-11-04 21:39:18 UTC (rev 76)
+++ PyWireGate/trunk/knx_connector/DPT_Types.py 2010-11-04 21:50:46 UTC (rev 77)
@@ -291,7 +291,7 @@
sec = raw[2] & 0x3f
## Fixme: eigentlich sollte Zeit als Unix Timestamp gespeichert werden, was macht man mit dem Wochentag
## machs erstmal so wie makki
- return "%s %d:%d:%d" % (weekdays[weekday], hour,min,sec)
+ return u"%s %d:%d:%d" % (weekdays[weekday], hour,min,sec)
def encodeDPT10(self,val):
## checktype default unix timestamp
@@ -345,7 +345,7 @@
year += 2000
else:
year += 1900
- return "%02d.%02d.%04d" % (day,mon,year)
+ return u"%02d.%02d.%04d" % (day,mon,year)
def encodeDPT11(self,val):
if type(val) in [float, int]:
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ni...@us...> - 2010-11-04 21:39:25
|
Revision: 76
http://openautomation.svn.sourceforge.net/openautomation/?rev=76&view=rev
Author: nilss1
Date: 2010-11-04 21:39:18 +0000 (Thu, 04 Nov 2010)
Log Message:
-----------
completed DPT encode
Modified Paths:
--------------
PyWireGate/trunk/knx_connector/DPT_Types.py
Modified: PyWireGate/trunk/knx_connector/DPT_Types.py
===================================================================
--- PyWireGate/trunk/knx_connector/DPT_Types.py 2010-11-04 20:51:46 UTC (rev 75)
+++ PyWireGate/trunk/knx_connector/DPT_Types.py 2010-11-04 21:39:18 UTC (rev 76)
@@ -124,7 +124,8 @@
return msg
def errormsg(self,msg=False):
- self.WG.errorlog(msg)
+ if self.WG:
+ self.WG.errorlog(msg)
def debug(self,msg):
self.log(msg,'debug')
@@ -132,7 +133,8 @@
def log(self,msg,severity='info',instance=False):
if not instance:
instance = "dpt-types"
- self.WG.log(msg,severity,instance)
+ if self.WG:
+ self.WG.log(msg,severity,instance)
def toByteArray(self,val,length):
## Set ByteArray
@@ -160,7 +162,7 @@
return int(raw[0]) & 0x1
def encodeDPT1(self,val):
- pass
+ return int(val) & 0x1
def decodeDPT2(self,raw):
## 2 Bit Control
@@ -171,7 +173,7 @@
return int(raw[0]) & 0x3
def encodeDPT2(self,val):
- pass
+ return int(val) & 0x3
def decodeDPT3(self,raw):
## 4 bit Dim (DPT 3.007)
@@ -183,29 +185,35 @@
return int(raw[0]) & 0xf
def encodeDPT3(self,val):
- pass
+ return int(val) & 0xf
def decodeDPT4(self,raw):
- ## 1 Byte Character
- return chr(raw[0] & 0xff)
+ ## 1 Byte Character
+ ## ISO 2 Unicode
+ return chr(raw[0] & 0xff).decode('iso-8859-15')
def encodeDPT4(self,val):
- pass
+ if type(val) == unicode:
+ ## convert to str
+ val = val.encode('iso-8859-15')
+ if type(val) <> str:
+ val = "%r" % val
+ return ord(val[0]) & 0xff
def decodeDPT5(self,raw):
## 1 Byte unsigned
- return (int(raw[0] & 0xff))
+ return int(raw[0]) & 0xff
def encodeDPT5(self,val):
- pass
+ return int(val) & 0xff
def decodeDPT501(self,raw):
## 1 Byte unsigned percent
self.debug("DPT5.001 Scaling: value: %d" % raw[0])
- return int(raw[0] & 0xff) * 100 / 255
+ return (int(raw[0]) & 0xff) * 100 / 255
def encodeDPT501(self,val):
- pass
+ return (int(val) * 255 / 100 ) & 0xff
def decodeDPT6(self,raw):
## 1 Byte signed
@@ -213,14 +221,17 @@
return (val > 127 and val - 256 or val)
def encodeDPT6(self,val):
- pass
+ if val > 127:
+ ## Max
+ val = 127
+ return int(val) & 0xff
def decodeDPT7(self,raw):
## 2 byte unsigned
return int(self.toBigInt(raw) & 0xffff)
def encodeDPT7(self,val):
- pass
+ return self.toByteArray(val & 0xffff,2)
def decodeDPT8(self,raw):
## 2 Byte signed
@@ -228,7 +239,9 @@
return (val > 32767 and val - 32768 or val)
def encodeDPT8(self,val):
- pass
+ if val > 32767:
+ val = 32767
+ return self.toByteArray(val & 0xffff,2)
def decodeDPT9(self,raw):
## 2 Byte Float
@@ -242,7 +255,7 @@
exp = (val & 0x7800) >> 11
mant = val & 0x07ff
if sign <> 0:
- mant = -(~(mant - 1) & 0x7ff)
+ mant = -(~(mant - 1) & 0x07ff)
self.debug("DPT9: value: %d sign: %d exp: %d mant: %f" % (val, sign,exp,mant))
return (1 << exp) * 0.01 * mant
@@ -252,10 +265,11 @@
if val < 0:
sign = 0x8000
mant = val * 100
- while mant > 2047:
+ while mant > 0x07ff:
mant = mant >> 1
exp +=1
data = sign | (exp << 11) | (int(mant) & 0x07ff)
+ self.debug("DPT9: value: %d sign: %d exp: %d mant: %r" % (val, sign,exp,mant))
## change to 2Byte bytearray
return self.toByteArray(data,2)
@@ -362,21 +376,22 @@
year -= 1900
else:
year -= 2000
-
return [ day & 0x1f, mon & 0xf, year & 0x7f ]
def decodeDPT12(self,raw):
return int(self.toBigInt(raw)) % 0xffffffff
def encodeDPT12(self,val):
- pass
+ return self.toByteArray(val & 0xffffffff,4)
def decodeDPT13(self,raw):
val = int(self.toBigInt(raw)) % 0xffffffff
return (val > 2147483647 and val - 2147483648 or val)
def encodeDPT13(self,val):
- pass
+ if val > 2147483647:
+ val = 2147483647
+ return self.toByteArray(val & 0xffffffff,4)
def decodeDPT14(self,raw):
## 4 Byte Float
@@ -394,7 +409,18 @@
return (1 << exp) * 0.01 * mant
def encodeDPT14(self,val):
- pass
+ sign = 0
+ exp = 0
+ if val < 0:
+ sign = 0x80000000
+ mant = val * 100
+ while mant > 0x7fffff:
+ mant = mant >> 1
+ exp +=1
+ data = sign | (exp << 23) | (int(mant) & 0x07ff)
+ self.debug("DPT14: value: %d sign: %d exp: %d mant: %r" % (val, sign,exp,mant))
+ ## change to 4Byte bytearray
+ return self.toByteArray(data,4)
def decodeDPT16(self,raw):
res = ""
@@ -405,10 +431,21 @@
res += chr(char)
## Decode ISO 2 Unicode
- return res.decode("iso-8859-15")
+ return res.decode('iso-8859-15')
def encodeDPT16(self,val):
- pass
+ if type(val) == unicode:
+ val = val.encode('iso-8859-15')
+ ## max 14
+ val = val[:14]
+ data = []
+ for cnt in range(14):
+ if len(val) > cnt:
+ char = ord(val[cnt])
+ else:
+ char = 0
+ data.append(char)
+ return data
def validTypes(self,datalen):
##TODO:
@@ -441,8 +478,8 @@
if __name__ == "__main__":
- dpttypes = dpt_type()
+ dpttypes = dpt_type(False)
print dpttypes.decode([24,88],dptid=9)
print dpttypes.decode([1],dptid=1)
print dpttypes.decode([35,76,58],dptid=16)
-
\ No newline at end of file
+ print dpttypes.encode("Das ist",dptid=16)
\ No newline at end of file
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ni...@us...> - 2010-11-04 20:51:52
|
Revision: 75
http://openautomation.svn.sourceforge.net/openautomation/?rev=75&view=rev
Author: nilss1
Date: 2010-11-04 20:51:46 +0000 (Thu, 04 Nov 2010)
Log Message:
-----------
Changed logging to UTF-8 and console logging to default encoding of stderr
Modified Paths:
--------------
PyWireGate/trunk/WireGate.py
Modified: PyWireGate/trunk/WireGate.py
===================================================================
--- PyWireGate/trunk/WireGate.py 2010-11-04 20:06:44 UTC (rev 74)
+++ PyWireGate/trunk/WireGate.py 2010-11-04 20:51:46 UTC (rev 75)
@@ -236,17 +236,19 @@
logger.setLevel(level)
if filename:
## python handle logrotating
- handler = logging.handlers.TimedRotatingFileHandler(filename,'midnight',backupCount=7)
+ handler = logging.handlers.TimedRotatingFileHandler(filename,'MIDNIGHT',encoding='utf-8',backupCount=7)
## Handler if logrotate handles Logfiles
#handler = logging.handlers.WatchedFileHandle(filename)
handler.setFormatter(formatter)
+ handler.setLevel(level)
logger.addHandler(handler)
# create console handler and set level to debug
if self.REDIRECTIO:
- console = logging.StreamHandler()
+ #console = logging.StreamHandler()
+ console = isoStreamHandler()
console.setFormatter(formatter)
logger.addHandler(console)
return logger
@@ -285,7 +287,13 @@
os.umask(0)
+class isoStreamHandler(logging.StreamHandler):
+ def emit(self,record):
+ #record.message = record.message.decode('utf-8').encode('iso-8859-15')
+ record.message = record.message.encode(sys.stderr.encoding)
+ logging.StreamHandler.emit(self,record)
+
if __name__ == "__main__":
try:
import os
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ni...@us...> - 2010-11-04 20:06:50
|
Revision: 74
http://openautomation.svn.sourceforge.net/openautomation/?rev=74&view=rev
Author: nilss1
Date: 2010-11-04 20:06:44 +0000 (Thu, 04 Nov 2010)
Log Message:
-----------
added time and date and changed dpt16 to unicode
Modified Paths:
--------------
PyWireGate/trunk/knx_connector/DPT_Types.py
Modified: PyWireGate/trunk/knx_connector/DPT_Types.py
===================================================================
--- PyWireGate/trunk/knx_connector/DPT_Types.py 2010-11-04 20:05:11 UTC (rev 73)
+++ PyWireGate/trunk/knx_connector/DPT_Types.py 2010-11-04 20:06:44 UTC (rev 74)
@@ -269,6 +269,8 @@
## M Minutes
## S Seconds
weekday = (raw[0] & 0xe0) >> 5
+
+ ## Fixme: I18N
weekdays = ["","Mo","Di","Mi","Do","Fr","Sa","So"]
hour = raw[0] & 0x1f
min = raw[1] & 0x3f
@@ -278,8 +280,43 @@
return "%s %d:%d:%d" % (weekdays[weekday], hour,min,sec)
def encodeDPT10(self,val):
- pass
-
+ ## checktype default unix timestamp
+ ## except standard timestring 20:15 or 20:15:34 or Mo 20:14:55
+ weekday = 0
+ hour = 0
+ min = 0
+ sec = 0
+ if type(val) == str:
+ ## check for weekday
+ if val[0].isalpha():
+ ## extract Weekday
+ day,val = val.split(" ",1)
+ ## Fixme: I18N
+ day = day.lower()
+ weekdays = ["","mo","di","mi","do","fr","sa","so"]
+ if weekday in weekdays:
+ weekday = weekdays.index(day)
+
+ timeval = val.split(":")
+ if len(timeval) == 2:
+ hour = int(timeval[0])
+ min = int(timeval[1])
+ if len(timeval) == 3:
+ sec = int(timeval[2])
+ elif type(val) in [float, int]:
+ now = time.localtime(val)
+ weekday = now[6]
+ hour = now[3]
+ min = now[4]
+ sec = now[5]
+
+ else:
+ ## can't convert
+ return False
+
+ weekday = weekday << 5
+ return [weekday | hour , min, sec]
+
def decodeDPT11(self,raw):
## 3 byte Date
## RRRDDDDD RRRRMMMM RYYYYYYY
@@ -297,7 +334,36 @@
return "%02d.%02d.%04d" % (day,mon,year)
def encodeDPT11(self,val):
- pass
+ if type(val) in [float, int]:
+ tval = val
+ else:
+ tval =0
+ ## make time struct accesible
+ utime = [v for v in time.localtime(tval)]
+ if type(val) == str:
+ datestr = val.split(".")
+ if len(datestr) == 2:
+ # day
+ utime[2] = val[0]
+ # month
+ utime[1] = val[1]
+ ##year
+ if val[2]<90:
+ utime[2] = 2000 + val[2]
+ elif val[2]<100:
+ utime = 1900 + val[2]
+ else:
+ utime = val[2]
+
+ day = utime[2]
+ mon = utime[1]
+ year = utime[2]
+ if year < 2000:
+ year -= 1900
+ else:
+ year -= 2000
+
+ return [ day & 0x1f, mon & 0xf, year & 0x7f ]
def decodeDPT12(self,raw):
return int(self.toBigInt(raw)) % 0xffffffff
@@ -337,7 +403,9 @@
if char == 0:
break
res += chr(char)
- return res
+
+ ## Decode ISO 2 Unicode
+ return res.decode("iso-8859-15")
def encodeDPT16(self,val):
pass
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ni...@us...> - 2010-11-04 20:05:18
|
Revision: 73
http://openautomation.svn.sourceforge.net/openautomation/?rev=73&view=rev
Author: nilss1
Date: 2010-11-04 20:05:11 +0000 (Thu, 04 Nov 2010)
Log Message:
-----------
changed datastore.db to UTF-8 and Datastore to unicode
Modified Paths:
--------------
PyWireGate/trunk/DSupdate.py
PyWireGate/trunk/datastore.py
Modified: PyWireGate/trunk/DSupdate.py
===================================================================
--- PyWireGate/trunk/DSupdate.py 2010-11-04 13:27:57 UTC (rev 72)
+++ PyWireGate/trunk/DSupdate.py 2010-11-04 20:05:11 UTC (rev 73)
@@ -1,6 +1,7 @@
import getopt
import ConfigParser
import sys
+import codecs
import datastore
try:
@@ -24,7 +25,7 @@
self.save()
def readConfig(self,configfile):
- cfile = open(configfile,"r")
+ cfile = codecs.open(configfile,"r")
## fix for missingsectionheaders
while True:
pos = cfile.tell()
@@ -52,7 +53,7 @@
ga = self.readConfig(fname)
for key in ga.keys():
id = "%s:%s" % (self.config['namespace'],key)
- self.dataobjects[id] = datastore.dataObject(False,id,unicode(ga[key]['name'],errors='ignore'))
+ self.dataobjects[id] = datastore.dataObject(False,id,ga[key]['name'].decode('iso-8859-15'))
self.dataobjects[id].config['dptid'] = ga[key]['dptsubid']
def OWFSloader(self,fname):
@@ -61,7 +62,7 @@
id = "%s:%s_temperature" % (self.config['namespace'],key)
## Fixme: Humidity ... not included
print "add %s " % id
- self.dataobjects[id] = datastore.dataObject(False,id,unicode(ow[key]['name'],errors='ignore'))
+ self.dataobjects[id] = datastore.dataObject(False,id,ow[key]['name'].decode('iso-8859-15'))
if 'resolution' in ow[key]:
self.dataobjects[id].config['resolution'] = ow[key]['resolution']
if 'eib_ga_temp' in ow[key]:
@@ -78,7 +79,7 @@
def load(self):
self.debug("load DATASTORE")
try:
- db = open(self.config['datastore'],"rb")
+ db = codecs.open(self.config['datastore'],"rb",encoding='utf-8')
loaddict = json.load(db)
db.close()
for name, obj in loaddict.items():
@@ -106,7 +107,7 @@
'config' : obj.config,
'connected' : obj.connected
}
- dbfile = open(self.config['datastore'],"wb")
+ dbfile = codecs.open(self.config['datastore'],"wb",encoding='utf-8')
json.dump(savedict,dbfile,sort_keys=True,indent=3)
dbfile.close()
for i in savedict.keys():
Modified: PyWireGate/trunk/datastore.py
===================================================================
--- PyWireGate/trunk/datastore.py 2010-11-04 13:27:57 UTC (rev 72)
+++ PyWireGate/trunk/datastore.py 2010-11-04 20:05:11 UTC (rev 73)
@@ -2,6 +2,8 @@
import time
import threading
+import codecs
+
try:
## use included json in > Python 2.6
import json
@@ -89,7 +91,7 @@
def load(self):
self.debug("load DATASTORE")
try:
- db = open(self.WG.config['WireGate']['datastore'],"rb")
+ db = codecs.open(self.WG.config['WireGate']['datastore'],"rb",encoding='utf-8')
loaddict = json.load(db)
db.close()
for name, obj in loaddict.items():
@@ -127,8 +129,10 @@
'config' : obj.config,
'connected' : obj.connected
}
- dbfile = open(self.WG.config['WireGate']['datastore'],"wb")
- json.dump(savedict,dbfile,sort_keys=True,indent=3)
+ dbfile = codecs.open(self.WG.config['WireGate']['datastore'],"wb",encoding='utf-8')
+ utfdb = json.dumps(savedict,dbfile,ensure_ascii=False,sort_keys=True,indent=3)
+ dbfile.write(utfdb)
+ #json.dump(savedict,dbfile,sort_keys=True,indent=3)
dbfile.close()
@@ -168,12 +172,15 @@
if not name:
## Initial Name
- self.name = "%s:unbekannt-%s" % (namespace, time.strftime("%Y-%m-%d_%H:%M:%S"))
+ self.name = u"%s:unbekannt-%s" % (namespace, time.strftime("%Y-%m-%d_%H:%M:%S"))
else:
self.name = name
+ if type(self.name) <> unicode:
+ ## guess that non unicode is iso8859
+ self.name = name.decode("iso-8859-15")
## some defaults
- self.value = ""
+ self.value = u""
self.lastupdate = 0
self.id = id
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ni...@us...> - 2010-11-04 13:28:04
|
Revision: 72
http://openautomation.svn.sourceforge.net/openautomation/?rev=72&view=rev
Author: nilss1
Date: 2010-11-04 13:27:57 +0000 (Thu, 04 Nov 2010)
Log Message:
-----------
encoding of DPT and send to KNX
Modified Paths:
--------------
PyWireGate/trunk/knx_connector/DPT_Types.py
PyWireGate/trunk/knx_connector/KNX_Connector.py
Modified: PyWireGate/trunk/knx_connector/DPT_Types.py
===================================================================
--- PyWireGate/trunk/knx_connector/DPT_Types.py 2010-11-04 10:54:37 UTC (rev 71)
+++ PyWireGate/trunk/knx_connector/DPT_Types.py 2010-11-04 13:27:57 UTC (rev 72)
@@ -20,6 +20,8 @@
### Da die EIBConnection Lib den string nicht hexadezimal zurueckgibt,
### sondern als LIST mit den dezimalen Werten ist das decode hier ein bischen angepasst
+import struct
+
class dpt_type:
def __init__(self,WireGateInstance):
self.WG = WireGateInstance
@@ -43,6 +45,26 @@
14:self.decodeDPT14, # EIS 9 / 4 byte float
16:self.decodeDPT16 # EIS 15 / 14 byte Text
}
+ self.ENCODER = {
+ 1:self.encodeDPT1, # EIS 1/7 / 1 bit 0=Aus/1=Ein
+ 2:self.encodeDPT2, # EIS 8 / 2 bit 0,1=Frei/2=Prio_Aus/3=Prio_Ein
+ 3:self.encodeDPT3, # EIS 2 / 4 bit
+ 4:self.encodeDPT4, # EIS 13 / 1 byte 1 Zeichen
+ 5:self.encodeDPT5, # EIS 6/14.001 / 1 byte 0...255 5.001
+ 5.001:self.encodeDPT501, # PDT_SCALING
+ 5.005:self.encodeDPT5, # DPT_DecimalFactor
+ 5.010:self.encodeDPT5, # DPT_Value_1_Ucount
+ 6:self.encodeDPT6, # EIS 14.000 / 1 byte -128 ... 127
+ 7:self.encodeDPT7, # EIS 10.000 / 2 byte 0....65535
+ 8:self.encodeDPT8, # EIS 10.001 / 2 byte -32768 .... 32767
+ 9:self.encodeDPT9, # EIS 5 / 2 byte Float
+ 10:self.encodeDPT10, # EIS 3 / 3 byte WoTag/Stunde/Minute/Sekunde
+ 11:self.encodeDPT11, # EIS 4 / 3 byte Tag/Monat/Jahr
+ 12:self.encodeDPT12, # EIS 11.000 / 4 byte unsigned [0...4.294.967.295]
+ 13:self.encodeDPT13, # EIS 11.001 / 4 byte signed -2.147.483.648 ... 2.147.483.647]
+ 14:self.encodeDPT14, # EIS 9 / 4 byte float
+ 16:self.encodeDPT16 # EIS 15 / 14 byte Text
+ }
def decode(self,raw,dptid=0,dsobj=False):
@@ -52,8 +74,8 @@
elif dsobj:
if "dptid" in dsobj.config:
dpt = dsobj.config['dptid']
- else:
- return False
+ #else:
+ # return False
if dpt == -1:
dpt = self.guessType(raw)
if dsobj:
@@ -63,6 +85,18 @@
return raw
return self._decode(raw,dpt)
+ def encode(self,msg,dptid=0,dsobj=False):
+ dpt=-1
+ if dptid > 0:
+ dpt = dptid
+ elif dsobj:
+ if "dptid" in dsobj.config:
+ dpt = dsobj.config['dptid']
+ else:
+ return False
+ return self._encode(msg,dpt)
+
+
def _decode(self,raw,dpt):
try:
try:
@@ -75,9 +109,22 @@
except:
self.errormsg()
return raw
+
+ def _encode(self,msg,dpt):
+ try:
+ try:
+ return self.ENCODER[dpt](msg)
+ except KeyError:
+ try:
+ return self.ENCODER[int(dpt)](msg)
+ except KeyError:
+ return msg
+ except:
+ self.errormsg()
+ return msg
def errormsg(self,msg=False):
- self.WG.errormsg(msg)
+ self.WG.errorlog(msg)
def debug(self,msg):
self.log(msg,'debug')
@@ -87,6 +134,18 @@
instance = "dpt-types"
self.WG.log(msg,severity,instance)
+ def toByteArray(self,val,length):
+ ## Set ByteArray
+ ret = [0 for b in range(length)]
+ for val in struct.pack("L",val):
+ ## Fill up from end
+ length -= 1
+ ## if struct larger then len return
+ if length < 0:
+ return ret
+ ## write from end to start
+ ret[length] = ord(val)
+ return ret
def toBigInt(self,raw):
c=0
@@ -99,7 +158,10 @@
def decodeDPT1(self,raw):
return int(raw[0]) & 0x1
-
+
+ def encodeDPT1(self,val):
+ pass
+
def decodeDPT2(self,raw):
## 2 Bit Control
## RRRRRRCS
@@ -108,6 +170,9 @@
## S Switch 0=off/1=on
return int(raw[0]) & 0x3
+ def encodeDPT2(self,val):
+ pass
+
def decodeDPT3(self,raw):
## 4 bit Dim (DPT 3.007)
## RRRRDSSS
@@ -116,34 +181,55 @@
## S Step (1-7) 0=Break
## FIXME: dont know what a Datastore should accept here
return int(raw[0]) & 0xf
+
+ def encodeDPT3(self,val):
+ pass
def decodeDPT4(self,raw):
## 1 Byte Character
return chr(raw[0] & 0xff)
+ def encodeDPT4(self,val):
+ pass
+
def decodeDPT5(self,raw):
## 1 Byte unsigned
return (int(raw[0] & 0xff))
+ def encodeDPT5(self,val):
+ pass
+
def decodeDPT501(self,raw):
## 1 Byte unsigned percent
self.debug("DPT5.001 Scaling: value: %d" % raw[0])
return int(raw[0] & 0xff) * 100 / 255
+
+ def encodeDPT501(self,val):
+ pass
def decodeDPT6(self,raw):
## 1 Byte signed
val = int(raw[0] & 0xff)
return (val > 127 and val - 256 or val)
+
+ def encodeDPT6(self,val):
+ pass
def decodeDPT7(self,raw):
## 2 byte unsigned
return int(self.toBigInt(raw) & 0xffff)
+
+ def encodeDPT7(self,val):
+ pass
def decodeDPT8(self,raw):
## 2 Byte signed
val = int(self.toBigInt(raw) & 0xffff)
return (val > 32767 and val - 32768 or val)
+ def encodeDPT8(self,val):
+ pass
+
def decodeDPT9(self,raw):
## 2 Byte Float
## SEEEEMMM MMMMMMMM
@@ -160,6 +246,19 @@
self.debug("DPT9: value: %d sign: %d exp: %d mant: %f" % (val, sign,exp,mant))
return (1 << exp) * 0.01 * mant
+ def encodeDPT9(self,val):
+ sign = 0
+ exp = 0
+ if val < 0:
+ sign = 0x8000
+ mant = val * 100
+ while mant > 2047:
+ mant = mant >> 1
+ exp +=1
+ data = sign | (exp << 11) | (int(mant) & 0x07ff)
+ ## change to 2Byte bytearray
+ return self.toByteArray(data,2)
+
def decodeDPT10(self,raw):
## 3 Byte Time
@@ -177,6 +276,9 @@
## Fixme: eigentlich sollte Zeit als Unix Timestamp gespeichert werden, was macht man mit dem Wochentag
## machs erstmal so wie makki
return "%s %d:%d:%d" % (weekdays[weekday], hour,min,sec)
+
+ def encodeDPT10(self,val):
+ pass
def decodeDPT11(self,raw):
## 3 byte Date
@@ -194,12 +296,22 @@
year += 1900
return "%02d.%02d.%04d" % (day,mon,year)
+ def encodeDPT11(self,val):
+ pass
+
def decodeDPT12(self,raw):
return int(self.toBigInt(raw)) % 0xffffffff
+
+ def encodeDPT12(self,val):
+ pass
+
def decodeDPT13(self,raw):
val = int(self.toBigInt(raw)) % 0xffffffff
return (val > 2147483647 and val - 2147483648 or val)
+ def encodeDPT13(self,val):
+ pass
+
def decodeDPT14(self,raw):
## 4 Byte Float
## SEEEEEEE EFFFFFFF FFFFFFFF FFFFFFFF
@@ -215,6 +327,9 @@
self.debug("DPT14: value: %d sign: %d exp: %d mant: %f" % (val, sign,exp,mant))
return (1 << exp) * 0.01 * mant
+ def encodeDPT14(self,val):
+ pass
+
def decodeDPT16(self,raw):
res = ""
for char in raw:
@@ -224,6 +339,9 @@
res += chr(char)
return res
+ def encodeDPT16(self,val):
+ pass
+
def validTypes(self,datalen):
##TODO:
ret = []
Modified: PyWireGate/trunk/knx_connector/KNX_Connector.py
===================================================================
--- PyWireGate/trunk/knx_connector/KNX_Connector.py 2010-11-04 10:54:37 UTC (rev 71)
+++ PyWireGate/trunk/knx_connector/KNX_Connector.py 2010-11-04 13:27:57 UTC (rev 72)
@@ -18,11 +18,17 @@
from connector import Connector
+import re
import EIBConnection
import select
import BusMonitor
import GroupSocket
+import DPT_Types
+KNXREADFLAG = 0x00
+KNXRESPONSEFLAG = 0x40
+KNXWRITEFLAG = 0x80
+
class knx_connector(Connector):
CONNECTOR_NAME = 'KNX Connector'
CONNECTOR_VERSION = 0.2
@@ -37,7 +43,10 @@
self.KNXDst = EIBConnection.EIBAddr()
self.busmon = BusMonitor.busmonitor(WireGateInstance,self)
self.groupsocket = GroupSocket.groupsocket(WireGateInstance,self)
+ self.dpt = DPT_Types.dpt_type(WireGateInstance)
+ self.GrpAddrRegex = re.compile(r"(?:|(\d+)\x2F)(\d+)\x2F(\d+)$",re.MULTILINE)
+
## Deafaultconfig
defaultconfig = {
'url':'ip:127.0.0.1',
@@ -115,6 +124,33 @@
self.busmon.decode(self.KNXBuffer.buffer)
+ def str2grpaddr(self,addrstr):
+ grpaddr = self.GrpAddrRegex.findall(addrstr)
+ if not grpaddr:
+ return False
+ ## regex result 1
+ grpaddr = grpaddr[0]
+ addr = 0
+ ## if GROUP3 Addr
+ if grpaddr[0]:
+ addr = int(grpaddr[0]) << 11
+ addr = addr | (int(grpaddr[1]) << 8)
+ addr = addr | int(grpaddr[2])
+ return addr
+
- def send(self,dsobj):
- print "SEND to %s" % dsobj.name
\ No newline at end of file
+ def send(self,msg,dstaddr):
+ try:
+ addr = self.str2grpaddr(dstaddr)
+ if addr:
+ msg = [0,KNXWRITEFLAG] +msg
+ self.KNX.EIBSendGroup(addr,msg)
+ except:
+ self.errormsg("Failed send %r to %r" % (msg,dstaddr))
+
+ def setValue(self,dsobj,msg=False):
+ if not msg:
+ msg = dsobj.getValue()
+ self.debug("SEND %r to %s (%s)" % (msg,dsobj.name,dsobj.id))
+ self.send(self.dpt.encode(msg,dsobj=dsobj),dsobj.id)
+
\ No newline at end of file
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ni...@us...> - 2010-11-04 10:54:43
|
Revision: 71
http://openautomation.svn.sourceforge.net/openautomation/?rev=71&view=rev
Author: nilss1
Date: 2010-11-04 10:54:37 +0000 (Thu, 04 Nov 2010)
Log Message:
-----------
don't write the db if the datastore.db is corrupt (missing commata....)
Modified Paths:
--------------
PyWireGate/trunk/datastore.py
Modified: PyWireGate/trunk/datastore.py
===================================================================
--- PyWireGate/trunk/datastore.py 2010-11-04 08:12:36 UTC (rev 70)
+++ PyWireGate/trunk/datastore.py 2010-11-04 10:54:37 UTC (rev 71)
@@ -24,6 +24,7 @@
####################################################
self.WG = WireGateInstance
self.log("DATASTORE starting up")
+ self.DBLOADED = False
self.dataobjects = {}
self.locked = threading.RLock()
self.locked.acquire()
@@ -98,6 +99,7 @@
self.dataobjects[name].connected = obj['connected']
self.debug("%d entries loaded in DATASTORE" % len(self.dataobjects))
self.locked.release()
+ self.DBLOADED = True
except IOError:
## no DB File
pass
@@ -110,6 +112,9 @@
def save(self):
self.debug("save DATASTORE")
+ if not self.DBLOADED:
+ self.debug("No valid config, not saving")
+ return False
self.locked.acquire()
savedict = {}
## FIXME: user create a __reduce__ method for the Datastoreitem object
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ni...@us...> - 2010-11-04 08:12:42
|
Revision: 70
http://openautomation.svn.sourceforge.net/openautomation/?rev=70&view=rev
Author: nilss1
Date: 2010-11-04 08:12:36 +0000 (Thu, 04 Nov 2010)
Log Message:
-----------
Add .db and .log to ignorelist
Property Changed:
----------------
PyWireGate/trunk/
Property changes on: PyWireGate/trunk
___________________________________________________________________
Modified: svn:ignore
- wiregated.pid
+ *.db
*.log
wiregated.pid
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ni...@us...> - 2010-11-04 08:09:47
|
Revision: 69
http://openautomation.svn.sourceforge.net/openautomation/?rev=69&view=rev
Author: nilss1
Date: 2010-11-04 08:09:41 +0000 (Thu, 04 Nov 2010)
Log Message:
-----------
remove UTF32 stuff
Removed Paths:
-------------
PyWireGate/trunk/simplejson/.___init__.py
PyWireGate/trunk/simplejson/._decoder.py
PyWireGate/trunk/simplejson/._scanner.py
PyWireGate/trunk/simplejson/tests/.___init__.py
PyWireGate/trunk/simplejson/tests/._test_dump.py
PyWireGate/trunk/simplejson/tests/._test_errors.py
PyWireGate/trunk/simplejson/tests/._test_fail.py
Deleted: PyWireGate/trunk/simplejson/.___init__.py
===================================================================
(Binary files differ)
Deleted: PyWireGate/trunk/simplejson/._decoder.py
===================================================================
(Binary files differ)
Deleted: PyWireGate/trunk/simplejson/._scanner.py
===================================================================
(Binary files differ)
Deleted: PyWireGate/trunk/simplejson/tests/.___init__.py
===================================================================
(Binary files differ)
Deleted: PyWireGate/trunk/simplejson/tests/._test_dump.py
===================================================================
(Binary files differ)
Deleted: PyWireGate/trunk/simplejson/tests/._test_errors.py
===================================================================
(Binary files differ)
Deleted: PyWireGate/trunk/simplejson/tests/._test_fail.py
===================================================================
(Binary files differ)
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ni...@us...> - 2010-11-04 08:05:42
|
Revision: 68
http://openautomation.svn.sourceforge.net/openautomation/?rev=68&view=rev
Author: nilss1
Date: 2010-11-04 08:05:36 +0000 (Thu, 04 Nov 2010)
Log Message:
-----------
cleanup, removed pickle and XML
Modified Paths:
--------------
PyWireGate/trunk/DSupdate.py
Modified: PyWireGate/trunk/DSupdate.py
===================================================================
--- PyWireGate/trunk/DSupdate.py 2010-11-04 08:01:58 UTC (rev 67)
+++ PyWireGate/trunk/DSupdate.py 2010-11-04 08:05:36 UTC (rev 68)
@@ -1,20 +1,16 @@
import getopt
import ConfigParser
-try:
- import cPickle as pickle
-except ImportError:
- import pickle
+import sys
+import datastore
try:
+ ## try Python 2.6 json lib
import json
except ImportError:
import simplejson as json
-import datastore
-import sys
-
class dbloader:
def __init__(self,config,fname):
self.config = config
@@ -63,6 +59,7 @@
ow = self.readConfig(fname)
for key in ow.keys():
id = "%s:%s_temperature" % (self.config['namespace'],key)
+ ## Fixme: Humidity ... not included
print "add %s " % id
self.dataobjects[id] = datastore.dataObject(False,id,unicode(ow[key]['name'],errors='ignore'))
if 'resolution' in ow[key]:
@@ -72,18 +69,16 @@
knxid = "KNX:%s" % ow[key]['eib_ga_temp']
print "Try to attach to %s " % knxid
self.dataobjects[id].connected.append(knxid)
- print "attaached"
+ print "attached"
def debug(self,msg=''):
print msg
def load(self):
- ## TODO:
self.debug("load DATASTORE")
try:
db = open(self.config['datastore'],"rb")
- #loaddict = pickle.Unpickler(db).load()
loaddict = json.load(db)
db.close()
for name, obj in loaddict.items():
@@ -95,13 +90,10 @@
except:
## no DB File
print "DB not found"
- pass
- ## Fixme: should belong to conncetor
def save(self):
- ## TODO:
self.debug("save DATASTORE")
savedict = {}
## FIXME: user create a __reduce__ method for the Datastoreitem object
@@ -115,8 +107,6 @@
'connected' : obj.connected
}
dbfile = open(self.config['datastore'],"wb")
- #db = pickle.Pickler(dbfile,-1)
- #db.dump(savedict)
json.dump(savedict,dbfile,sort_keys=True,indent=3)
dbfile.close()
for i in savedict.keys():
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ni...@us...> - 2010-11-04 08:02:04
|
Revision: 67
http://openautomation.svn.sourceforge.net/openautomation/?rev=67&view=rev
Author: nilss1
Date: 2010-11-04 08:01:58 +0000 (Thu, 04 Nov 2010)
Log Message:
-----------
cleanup, removed pickle and XML in favor of json
Modified Paths:
--------------
PyWireGate/trunk/datastore.py
Modified: PyWireGate/trunk/datastore.py
===================================================================
--- PyWireGate/trunk/datastore.py 2010-11-04 07:49:34 UTC (rev 66)
+++ PyWireGate/trunk/datastore.py 2010-11-04 08:01:58 UTC (rev 67)
@@ -1,3 +1,4 @@
+import sys
import time
import threading
@@ -2,13 +3,7 @@
try:
- import cPickle as pickle
-except ImportError:
- import pickle
-
-try:
+ ## use included json in > Python 2.6
import json
except ImportError:
import simplejson as json
-import sys
-import xml.dom.minidom
@@ -32,8 +27,7 @@
self.dataobjects = {}
self.locked = threading.RLock()
self.locked.acquire()
- self.xmltag = lambda x,y,z='': len(z)>0 and "<%s %s>%s</%s>" % (x,z,y,x) or "<%s>%s</%s>" % (x,y,x)
- ## Load XML Database
+ ## Load JSON Database
self.load()
@@ -91,23 +85,10 @@
return self.dataobjects[id]
- ## FIXME: that should belong to the Connector
- def readgaconf(self):
- print "SHOULD NOT BE CALLED"
- ga = self.WG.readConfig("/etc/wiregate/eibga.conf")
- for key in ga.keys():
- obj = self.get("KNX:%s" % key)
- obj.config['dptid'] = ga[key]['dptsubid']
- obj.name = ga[key]['name']
- obj._send = self.WG.connectors['KNX'].send
-
-
def load(self):
- ## TODO:
self.debug("load DATASTORE")
try:
db = open(self.WG.config['WireGate']['datastore'],"rb")
- #loaddict = pickle.Unpickler(db).load()
loaddict = json.load(db)
db.close()
for name, obj in loaddict.items():
@@ -120,17 +101,14 @@
except IOError:
## no DB File
pass
- ## Fixme: should belong to conncetor
- self.locked.release()
- self.readgaconf()
except:
+ self.WG.errorlog()
## error
pass
def save(self):
- ## TODO:
self.debug("save DATASTORE")
self.locked.acquire()
savedict = {}
@@ -145,31 +123,11 @@
'connected' : obj.connected
}
dbfile = open(self.WG.config['WireGate']['datastore'],"wb")
- #db = pickle.Pickler(dbfile,-1)
- #db.dump(savedict)
json.dump(savedict,dbfile,sort_keys=True,indent=3)
dbfile.close()
- def savetoXML(self):
- objitemxml = ""
- for name,obj in self.dataobjects.items():
- configxml = ""
- for cname,cval in obj.config.items():
- configxml += self.xmltag(cname,cval)
- objitemxml += self.xmltag(
- "DSitem",
- self.xmltag("id",name) +
- self.xmltag("value",obj.getValue(),'type=%r' % type(obj.value).__name__) +
- self.xmltag("config",configxml)
- )
- self.locked.release()
- xmlout = xml.dom.minidom.parseString(self.xmltag("Datastore",objitemxml))
- #xmlout = xmlout.toprettyxml(indent=" ")
- xmlout = xmlout.toxml()
- ## write binary to preserve UTF8
- open(self.WG.config['WireGate']['datastore'],"wb").write(xmlout)
-
+
def debug(self,msg):
####################################################
## Function: debug
@@ -225,12 +183,10 @@
def _setValue(self,refered_self):
## self override
- print "Ovveride now"
+ ## override with connector send function
if self.namespace:
self._setValue = self.WG.connectors[self.namespace].setValue
self.WG.connectors[self.namespace].setValue(refered_self)
- ## override with connector send function
- pass
def setValue(self,val,send=False):
try:
@@ -259,40 +215,3 @@
self.read_mutex.release()
-
-#import json
-
-def JSON2DataStore(text):
- obj = {}
- return obj
-
-
-def DataStore2JSON(obj):
- text = ""
- return text
-
-class testtwo:
- def __init__(self):
- self.i=10
- def _send(self,val):
- """Hallo"""
- print str(dir(self)) +str(val+self.i)
-
-class testthree:
- def __init__(self):
- self.u=1
- def send(self,val):
- """its me"""
- print str(dir(self)) +str(self.u)
-
-
-
-if __name__ == "__main__":
- two = testtwo()
- two._send(20)
- three = testthree()
- two._send = three.send
- two._send(20)
- print two._send
- print dir(two)
-
\ No newline at end of file
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ni...@us...> - 2010-11-04 07:49:40
|
Revision: 66
http://openautomation.svn.sourceforge.net/openautomation/?rev=66&view=rev
Author: nilss1
Date: 2010-11-04 07:49:34 +0000 (Thu, 04 Nov 2010)
Log Message:
-----------
cleanup, changed pack to uint
Modified Paths:
--------------
PyWireGate/trunk/owfs_connector/connection.py
Modified: PyWireGate/trunk/owfs_connector/connection.py
===================================================================
--- PyWireGate/trunk/owfs_connector/connection.py 2010-11-03 13:17:57 UTC (rev 65)
+++ PyWireGate/trunk/owfs_connector/connection.py 2010-11-04 07:49:34 UTC (rev 66)
@@ -241,7 +241,7 @@
"""
#print 'Connection.pack(%i, %i, %i)' % (function, payload_len, data_len)
- return struct.pack('iiiiii',
+ return struct.pack('IIIIII',
socket.htonl(0), #version
socket.htonl(payload_len), #payload length
socket.htonl(function), #type of function call
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ni...@us...> - 2010-11-03 13:18:06
|
Revision: 65
http://openautomation.svn.sourceforge.net/openautomation/?rev=65&view=rev
Author: nilss1
Date: 2010-11-03 13:17:57 +0000 (Wed, 03 Nov 2010)
Log Message:
-----------
sorry, too many updates cleanup later, just want to keep a version in repo
Modified Paths:
--------------
PyWireGate/trunk/WireGate.py
PyWireGate/trunk/connector.py
PyWireGate/trunk/datastore.py
PyWireGate/trunk/knx_connector/BusMonitor.py
PyWireGate/trunk/knx_connector/DPT_Types.py
PyWireGate/trunk/knx_connector/GroupSocket.py
PyWireGate/trunk/knx_connector/KNX_Connector.py
PyWireGate/trunk/owfs_connector/OWFS_Connector.py
PyWireGate/trunk/owfs_connector/connection.py
Added Paths:
-----------
PyWireGate/trunk/DSupdate.py
PyWireGate/trunk/simplejson/
PyWireGate/trunk/simplejson/.___init__.py
PyWireGate/trunk/simplejson/._decoder.py
PyWireGate/trunk/simplejson/._scanner.py
PyWireGate/trunk/simplejson/__init__.py
PyWireGate/trunk/simplejson/_speedups.c
PyWireGate/trunk/simplejson/decoder.py
PyWireGate/trunk/simplejson/encoder.py
PyWireGate/trunk/simplejson/ordered_dict.py
PyWireGate/trunk/simplejson/scanner.py
PyWireGate/trunk/simplejson/tests/
PyWireGate/trunk/simplejson/tests/.___init__.py
PyWireGate/trunk/simplejson/tests/._test_dump.py
PyWireGate/trunk/simplejson/tests/._test_errors.py
PyWireGate/trunk/simplejson/tests/._test_fail.py
PyWireGate/trunk/simplejson/tests/__init__.py
PyWireGate/trunk/simplejson/tests/test_check_circular.py
PyWireGate/trunk/simplejson/tests/test_decimal.py
PyWireGate/trunk/simplejson/tests/test_decode.py
PyWireGate/trunk/simplejson/tests/test_default.py
PyWireGate/trunk/simplejson/tests/test_dump.py
PyWireGate/trunk/simplejson/tests/test_encode_basestring_ascii.py
PyWireGate/trunk/simplejson/tests/test_encode_for_html.py
PyWireGate/trunk/simplejson/tests/test_errors.py
PyWireGate/trunk/simplejson/tests/test_fail.py
PyWireGate/trunk/simplejson/tests/test_float.py
PyWireGate/trunk/simplejson/tests/test_indent.py
PyWireGate/trunk/simplejson/tests/test_pass1.py
PyWireGate/trunk/simplejson/tests/test_pass2.py
PyWireGate/trunk/simplejson/tests/test_pass3.py
PyWireGate/trunk/simplejson/tests/test_recursion.py
PyWireGate/trunk/simplejson/tests/test_scanstring.py
PyWireGate/trunk/simplejson/tests/test_separators.py
PyWireGate/trunk/simplejson/tests/test_speedups.py
PyWireGate/trunk/simplejson/tests/test_unicode.py
PyWireGate/trunk/simplejson/tool.py
Added: PyWireGate/trunk/DSupdate.py
===================================================================
--- PyWireGate/trunk/DSupdate.py (rev 0)
+++ PyWireGate/trunk/DSupdate.py 2010-11-03 13:17:57 UTC (rev 65)
@@ -0,0 +1,161 @@
+import getopt
+import ConfigParser
+try:
+ import cPickle as pickle
+except ImportError:
+ import pickle
+
+try:
+ import json
+except ImportError:
+ import simplejson as json
+
+
+import datastore
+
+import sys
+
+class dbloader:
+ def __init__(self,config,fname):
+ self.config = config
+ self.dataobjects = {}
+ ## load datastore
+ self.load()
+ if config['type'].upper() == "KNX":
+ self.KNXloader(fname)
+ elif config['type'].upper() == "OWFS":
+ self.OWFSloader(fname)
+ self.save()
+
+ def readConfig(self,configfile):
+ cfile = open(configfile,"r")
+ ## fix for missingsectionheaders
+ while True:
+ pos = cfile.tell()
+ if cfile.readline().startswith("["):
+ break
+ cfile.seek(pos)
+ config = {}
+ configparse = ConfigParser.SafeConfigParser()
+ configparse.readfp(cfile)
+ for section in configparse.sections():
+ options = configparse.options(section)
+ config[section] = {}
+ for opt in options:
+ try:
+ config[section][opt] = configparse.getint(section,opt)
+ except ValueError:
+ try:
+ config[section][opt] = configparse.getfloat(section,opt)
+ except ValueError:
+ config[section][opt] = configparse.get(section,opt)
+
+ return config
+
+ def KNXloader(self,fname):
+ ga = self.readConfig(fname)
+ for key in ga.keys():
+ id = "%s:%s" % (self.config['namespace'],key)
+ self.dataobjects[id] = datastore.dataObject(False,id,unicode(ga[key]['name'],errors='ignore'))
+ self.dataobjects[id].config['dptid'] = ga[key]['dptsubid']
+
+ def OWFSloader(self,fname):
+ ow = self.readConfig(fname)
+ for key in ow.keys():
+ id = "%s:%s_temperature" % (self.config['namespace'],key)
+ print "add %s " % id
+ self.dataobjects[id] = datastore.dataObject(False,id,unicode(ow[key]['name'],errors='ignore'))
+ if 'resolution' in ow[key]:
+ self.dataobjects[id].config['resolution'] = ow[key]['resolution']
+ if 'eib_ga_temp' in ow[key]:
+ if len(ow[key]['eib_ga_temp']) >0:
+ knxid = "KNX:%s" % ow[key]['eib_ga_temp']
+ print "Try to attach to %s " % knxid
+ self.dataobjects[id].connected.append(knxid)
+ print "attaached"
+
+
+ def debug(self,msg=''):
+ print msg
+
+ def load(self):
+ ## TODO:
+ self.debug("load DATASTORE")
+ try:
+ db = open(self.config['datastore'],"rb")
+ #loaddict = pickle.Unpickler(db).load()
+ loaddict = json.load(db)
+ db.close()
+ for name, obj in loaddict.items():
+ self.dataobjects[name] = datastore.dataObject(False,obj['id'],obj['name'])
+ self.dataobjects[name].lastupdate = obj['lastupdate']
+ self.dataobjects[name].config = obj['config']
+ self.dataobjects[name].connected = obj['connected']
+ self.debug("%d entries loaded in DATASTORE" % len(self.dataobjects))
+ except:
+ ## no DB File
+ print "DB not found"
+ pass
+ ## Fixme: should belong to conncetor
+
+
+
+ def save(self):
+ ## TODO:
+ self.debug("save DATASTORE")
+ savedict = {}
+ ## FIXME: user create a __reduce__ method for the Datastoreitem object
+ for name,obj in self.dataobjects.items():
+ savedict[name] = {
+ 'name' : obj.name,
+ 'id' : obj.id,
+ 'value' : obj.value,
+ 'lastupdate' : obj.lastupdate,
+ 'config' : obj.config,
+ 'connected' : obj.connected
+ }
+ dbfile = open(self.config['datastore'],"wb")
+ #db = pickle.Pickler(dbfile,-1)
+ #db.dump(savedict)
+ json.dump(savedict,dbfile,sort_keys=True,indent=3)
+ dbfile.close()
+ for i in savedict.keys():
+ if len(savedict[i]['connected'])>0:
+ print savedict[i]
+
+
+if __name__ == "__main__":
+ import os
+ import sys
+ import getopt
+ try:
+ opts, args = getopt.getopt(sys.argv[1:], "f:d:n:t:", ["file=","datastore=","namespace=","type="])
+ except getopt.GetoptError:
+ print "Fehler"
+ sys.exit(2)
+ config = {
+ 'datastore' : 'datastore.db',
+ 'namespace' : 'KNX',
+ 'type' : False
+ }
+ fname = False
+ for opt, arg in opts:
+ if opt in ("-d","--datastore"):
+ config['datastore'] = arg
+
+ if opt in ("-n","--namespace"):
+ config['namespace'] = arg
+
+ if opt in ("-t","--type"):
+ config['type'] = arg
+
+ if opt in ("-f","--file"):
+ fname = arg
+
+ if not fname:
+ print "no configfilename"
+ sys.exit(1)
+ if not config['type']:
+ config['type'] = config['namespace']
+ dbloader(config,fname)
+
Modified: PyWireGate/trunk/WireGate.py
===================================================================
--- PyWireGate/trunk/WireGate.py 2010-11-01 21:14:31 UTC (rev 64)
+++ PyWireGate/trunk/WireGate.py 2010-11-03 13:17:57 UTC (rev 65)
@@ -58,6 +58,7 @@
self.config = self.readConfig("/etc/wiregate/pywiregate.conf")
defaultconfig = {
'pidfile' : "%s/wiregated.pid" % self.scriptpath,
+ 'datastore' : "%s/datastore.db" % self.scriptpath,
'logfile' : "%s/wiregated.log" % self.scriptpath,
'errorlog' : "%s/wiregated-error.log" % self.scriptpath,
'loglevel': 'info'
@@ -148,6 +149,7 @@
##Set Permissions
os.chown(self.config['WireGate']['pidfile'],runasuser[2],runasuser[3])
os.chown(self.config['WireGate']['logfile'],runasuser[2],runasuser[3])
+ os.chown(self.config['WireGate']['datastore'],runasuser[2],runasuser[3])
os.setregid(runasuser[3],runasuser[3])
os.setreuid(runasuser[2],runasuser[2])
@@ -251,8 +253,6 @@
## Logger for all instances that check/create logger based on Configfile
def log(self,msg,severity="info",instance="WireGate"):
- LEVELS = {'debug': logging.debug,'info': logging.info,'warning': logging.warning,'warn': logging.warning,'error': logging.error,'critical': logging.critical}
- level = LEVELS.get(severity, logging.info)
try:
logger = self.LOGGER[instance]
except KeyError:
@@ -262,8 +262,12 @@
logger.debug(msg)
elif severity=="info":
logger.info(msg)
+ elif severity=="notice":
+ logger.info(msg)
elif severity=="warning":
logger.warning(msg)
+ elif severity=="warn":
+ logger.warning(msg)
elif severity=="error":
logger.error(msg)
elif severity=="critical":
Modified: PyWireGate/trunk/connector.py
===================================================================
--- PyWireGate/trunk/connector.py 2010-11-01 21:14:31 UTC (rev 64)
+++ PyWireGate/trunk/connector.py 2010-11-03 13:17:57 UTC (rev 65)
@@ -47,6 +47,10 @@
pass
+ def setValue(self, dsobj):
+ self.log("unconfigured setValue in %r called for %s" % (self,dsobj.name) ,'warn','WireGate')
+ pass
+
import SocketServer
import socket
class ConnectorServer(SocketServer.ThreadingMixIn, SocketServer.TCPServer,Connector):
Modified: PyWireGate/trunk/datastore.py
===================================================================
--- PyWireGate/trunk/datastore.py 2010-11-01 21:14:31 UTC (rev 64)
+++ PyWireGate/trunk/datastore.py 2010-11-03 13:17:57 UTC (rev 65)
@@ -1,7 +1,19 @@
import time
import threading
+try:
+ import cPickle as pickle
+except ImportError:
+ import pickle
+try:
+ import json
+except ImportError:
+ import simplejson as json
+
+import sys
+import xml.dom.minidom
+
class datastore:
"""
Datastore Instance
@@ -16,23 +28,15 @@
##
####################################################
self.WG = WireGateInstance
+ self.log("DATASTORE starting up")
self.dataobjects = {}
-
+ self.locked = threading.RLock()
+ self.locked.acquire()
+ self.xmltag = lambda x,y,z='': len(z)>0 and "<%s %s>%s</%s>" % (x,z,y,x) or "<%s>%s</%s>" % (x,y,x)
## Load XML Database
self.load()
- ## Fixme: should belong to conncetor
- self.readgaconf()
-
- ## FIXME: that should belong to the Connector
- def readgaconf(self):
- ga = self.WG.readConfig("/etc/wiregate/eibga.conf")
- for key in ga.keys():
- obj = self.get("KNX:%s" % key)
- obj.dptid = ga[key]['dptsubid']
- obj.name = ga[key]['name']
-
def update(self,id,val):
## Update the communication Object with value
####################################################
@@ -44,14 +48,23 @@
## update or create a Datastoreobject
## schould be used by all connectors to set their Values
####################################################
+ ##
## get the Datastore object
obj = self.get(id)
self.debug("Updating %s (%s): %r" % (obj.name,id,val))
## Set the value of the object
obj.setValue(val)
-
+
##TODO: central subscriber function for other connectore or servers
+
+ for attached in obj.connected:
+ try:
+ self.dataobjects[attached].setValue(val,True)
+ except:
+ print "FAILED %s" % attached
+ __import__('traceback').print_exc(file=__import__('sys').stdout)
+ pass
## return the object for additional updates
@@ -66,6 +79,7 @@
## returns or create and returns the Dataobejct with ID id
##
####################################################
+ self.locked.acquire()
try:
## check for existence
type(self.dataobjects[id])
@@ -73,18 +87,88 @@
## create a new one if it don't exist
self.dataobjects[id] = dataObject(self.WG,id)
## return it
+ self.locked.release()
return self.dataobjects[id]
+ ## FIXME: that should belong to the Connector
+ def readgaconf(self):
+ print "SHOULD NOT BE CALLED"
+ ga = self.WG.readConfig("/etc/wiregate/eibga.conf")
+ for key in ga.keys():
+ obj = self.get("KNX:%s" % key)
+ obj.config['dptid'] = ga[key]['dptsubid']
+ obj.name = ga[key]['name']
+ obj._send = self.WG.connectors['KNX'].send
+
+
def load(self):
## TODO:
self.debug("load DATASTORE")
- pass
+ try:
+ db = open(self.WG.config['WireGate']['datastore'],"rb")
+ #loaddict = pickle.Unpickler(db).load()
+ loaddict = json.load(db)
+ db.close()
+ for name, obj in loaddict.items():
+ self.dataobjects[name] = dataObject(self.WG,obj['id'],obj['name'])
+ self.dataobjects[name].lastupdate = obj['lastupdate']
+ self.dataobjects[name].config = obj['config']
+ self.dataobjects[name].connected = obj['connected']
+ self.debug("%d entries loaded in DATASTORE" % len(self.dataobjects))
+ self.locked.release()
+ except IOError:
+ ## no DB File
+ pass
+ ## Fixme: should belong to conncetor
+ self.locked.release()
+ self.readgaconf()
+
+ except:
+ ## error
+ pass
+
def save(self):
## TODO:
self.debug("save DATASTORE")
- pass
+ self.locked.acquire()
+ savedict = {}
+ ## FIXME: user create a __reduce__ method for the Datastoreitem object
+ for name,obj in self.dataobjects.items():
+ savedict[name] = {
+ 'name' : obj.name,
+ 'id' : obj.id,
+ 'value' : obj.value,
+ 'lastupdate' : obj.lastupdate,
+ 'config' : obj.config,
+ 'connected' : obj.connected
+ }
+ dbfile = open(self.WG.config['WireGate']['datastore'],"wb")
+ #db = pickle.Pickler(dbfile,-1)
+ #db.dump(savedict)
+ json.dump(savedict,dbfile,sort_keys=True,indent=3)
+ dbfile.close()
+
+
+ def savetoXML(self):
+ objitemxml = ""
+ for name,obj in self.dataobjects.items():
+ configxml = ""
+ for cname,cval in obj.config.items():
+ configxml += self.xmltag(cname,cval)
+ objitemxml += self.xmltag(
+ "DSitem",
+ self.xmltag("id",name) +
+ self.xmltag("value",obj.getValue(),'type=%r' % type(obj.value).__name__) +
+ self.xmltag("config",configxml)
+ )
+ self.locked.release()
+ xmlout = xml.dom.minidom.parseString(self.xmltag("Datastore",objitemxml))
+ #xmlout = xmlout.toprettyxml(indent=" ")
+ xmlout = xmlout.toxml()
+ ## write binary to preserve UTF8
+ open(self.WG.config['WireGate']['datastore'],"wb").write(xmlout)
def debug(self,msg):
####################################################
@@ -109,6 +193,7 @@
## Threadlocking
self.write_mutex = threading.RLock()
self.read_mutex = threading.RLock()
+
## check for namespace
namespace = id.split(":",1)
if len(namespace)>1:
@@ -116,10 +201,14 @@
else:
## Fixme: maybe default Namespace
namespace = ""
+ self.namespace = namespace
+
+ if not name:
+ ## Initial Name
+ self.name = "%s:unbekannt-%s" % (namespace, time.strftime("%Y-%m-%d_%H:%M:%S"))
+ else:
+ self.name = name
- ## Initial Name
- self.name = "%s:unbekannt-%s" % (namespace, time.strftime("%Y-%m-%d_%H:%M:%S"))
-
## some defaults
self.value = ""
self.lastupdate = 0
@@ -132,9 +221,18 @@
self.config = {}
## connected Logics, communication objects ... goes here
- self.connected = {}
+ self.connected = []
- def setValue(self,val):
+ def _setValue(self,refered_self):
+ ## self override
+ print "Ovveride now"
+ if self.namespace:
+ self._setValue = self.WG.connectors[self.namespace].setValue
+ self.WG.connectors[self.namespace].setValue(refered_self)
+ ## override with connector send function
+ pass
+
+ def setValue(self,val,send=False):
try:
## get read lock
self.read_mutex.acquire()
@@ -143,6 +241,8 @@
## save the modified time
self.lastupdate = time.time()
self.value = val
+ if send:
+ self._setValue(self)
finally:
## release locks
self.write_mutex.release()
@@ -160,3 +260,39 @@
+#import json
+
+def JSON2DataStore(text):
+ obj = {}
+ return obj
+
+
+def DataStore2JSON(obj):
+ text = ""
+ return text
+
+class testtwo:
+ def __init__(self):
+ self.i=10
+ def _send(self,val):
+ """Hallo"""
+ print str(dir(self)) +str(val+self.i)
+
+class testthree:
+ def __init__(self):
+ self.u=1
+ def send(self,val):
+ """its me"""
+ print str(dir(self)) +str(self.u)
+
+
+
+if __name__ == "__main__":
+ two = testtwo()
+ two._send(20)
+ three = testthree()
+ two._send = three.send
+ two._send(20)
+ print two._send
+ print dir(two)
+
\ No newline at end of file
Modified: PyWireGate/trunk/knx_connector/BusMonitor.py
===================================================================
--- PyWireGate/trunk/knx_connector/BusMonitor.py 2010-11-01 21:14:31 UTC (rev 64)
+++ PyWireGate/trunk/knx_connector/BusMonitor.py 2010-11-03 13:17:57 UTC (rev 65)
@@ -20,11 +20,12 @@
import time
class busmonitor:
- def __init__(self, WireGateInstance):
+ def __init__(self, WireGateInstance,connectorInstance):
self.WG = WireGateInstance
+ self.KNX = connectorInstance
self.nicehex=lambda x: " ".join(map(lambda y:"%.2x" % y,x))
self.tobinstr=lambda n,b=8: "".join([str((n >> y) & 1) for y in range(b-1, -1, -1)])
- self.dpt = DPT_Types.dpt_type()
+ self.dpt = DPT_Types.dpt_type(WireGateInstance)
## FIXME: Not fully implemented
self.apcicodes = {
@@ -99,8 +100,9 @@
if msg['ctrl2']['DestAddrType'] == 0 and msg['apdu']['tpdu'] == "T_DATA_XXX_REQ":
msg['dstaddr'] = self._decodeGrpAddr(buf[3:5])
- id = "KNX:%s" % msg['dstaddr']
+ id = "%s:%s" % (self.KNX.instanceName, msg['dstaddr'])
+
## search Datastoreobject
dsobj = self.WG.DATASTORE.get(id)
## Decode the DPT Value
@@ -121,12 +123,8 @@
return msg
- def errormsg(self,msg=''):
- f=open("/tmp/WGerror","a+")
- __import__('traceback').print_exc(file=f)
- f.write(time.asctime())
- f.write("MSG:"+repr(msg))
- f.close()
+ def errormsg(self,msg=False):
+ self.WG.errorlog(msg)
def _decodeCtrlField1(self,raw):
Modified: PyWireGate/trunk/knx_connector/DPT_Types.py
===================================================================
--- PyWireGate/trunk/knx_connector/DPT_Types.py 2010-11-01 21:14:31 UTC (rev 64)
+++ PyWireGate/trunk/knx_connector/DPT_Types.py 2010-11-03 13:17:57 UTC (rev 65)
@@ -21,7 +21,7 @@
### sondern als LIST mit den dezimalen Werten ist das decode hier ein bischen angepasst
class dpt_type:
- def __init__(self,WireGateInstance=False):
+ def __init__(self,WireGateInstance):
self.WG = WireGateInstance
self.DECODER = {
1:self.decodeDPT1, # EIS 1/7 / 1 bit 0=Aus/1=Ein
@@ -50,7 +50,8 @@
if dptid > 0:
dpt = dptid
elif dsobj:
- dpt = dsobj.dptid
+ if "dptid" in dsobj.config:
+ dpt = dsobj.config['dptid']
else:
return False
if dpt == -1:
@@ -75,13 +76,18 @@
self.errormsg()
return raw
- def errormsg(self,msg=''):
- __import__('traceback').print_exc(file=__import__('sys').stdout)
+ def errormsg(self,msg=False):
+ self.WG.errormsg(msg)
def debug(self,msg):
- #print msg
- pass
+ self.log(msg,'debug')
+
+ def log(self,msg,severity='info',instance=False):
+ if not instance:
+ instance = "dpt-types"
+ self.WG.log(msg,severity,instance)
+
def toBigInt(self,raw):
c=0
res = 0
@@ -212,6 +218,7 @@
def decodeDPT16(self,raw):
res = ""
for char in raw:
+ ## stop on terminating \x00
if char == 0:
break
res += chr(char)
Modified: PyWireGate/trunk/knx_connector/GroupSocket.py
===================================================================
--- PyWireGate/trunk/knx_connector/GroupSocket.py 2010-11-01 21:14:31 UTC (rev 64)
+++ PyWireGate/trunk/knx_connector/GroupSocket.py 2010-11-03 13:17:57 UTC (rev 65)
@@ -20,11 +20,12 @@
import time
class groupsocket:
- def __init__(self, WireGateInstance):
+ def __init__(self, WireGateInstance, connectorInstance):
self.WG = WireGateInstance
+ self.KNX = connectorInstance
self.nicehex=lambda x: " ".join(map(lambda y:"%.2x" % y,x))
self.tobinstr=lambda n,b=8: "".join([str((n >> y) & 1) for y in range(b-1, -1, -1)])
- self.dpt = DPT_Types.dpt_type()
+ self.dpt = DPT_Types.dpt_type(WireGateInstance)
def decode(self,buf,src,dst):
## Accept List Hex or Binary Data
@@ -48,7 +49,7 @@
msg['srcaddr'] = self._decodePhysicalAddr(src)
try:
msg['dstaddr'] = self._decodeGrpAddr(dst)
- id = "KNX:%s" % msg['dstaddr']
+ id = "%s:%s" % (self.KNX.instanceName, msg['dstaddr'])
if (buf[0] & 0x3 or (buf[1] & 0xC0) == 0xC0):
##FIXME: unknown APDU
self.debug("unknown APDU from "+msg['srcaddr']+" to "+msg['dstaddr']+ " raw:"+buf)
@@ -78,13 +79,9 @@
return msg
- def errormsg(self,msg=''):
- f=open("/tmp/WGerror","a+")
- __import__('traceback').print_exc(file=f)
- f.write(time.asctime())
- f.write("MSG:"+repr(msg))
- f.close()
-
+ def errormsg(self,msg=False):
+ ## central error handling
+ self.WG.errorlog(msg)
def _decodePhysicalAddr(self,raw):
return "%d.%d.%d" % ((raw >> 12) & 0x0f, (raw >> 8) & 0x0f, (raw) & 0xff)
@@ -93,7 +90,7 @@
return "%d/%d/%d" % ((raw >> 11) & 0x1f, (raw >> 8) & 0x07, (raw) & 0xff)
def debug(self,msg):
- print "DEBUG: GROUPSOCKET: "+ repr(msg)
+ #print "DEBUG: GROUPSOCKET: "+ repr(msg)
pass
Modified: PyWireGate/trunk/knx_connector/KNX_Connector.py
===================================================================
--- PyWireGate/trunk/knx_connector/KNX_Connector.py 2010-11-01 21:14:31 UTC (rev 64)
+++ PyWireGate/trunk/knx_connector/KNX_Connector.py 2010-11-03 13:17:57 UTC (rev 65)
@@ -35,8 +35,8 @@
self.KNXBuffer = EIBConnection.EIBBuffer()
self.KNXSrc = EIBConnection.EIBAddr()
self.KNXDst = EIBConnection.EIBAddr()
- self.busmon = BusMonitor.busmonitor(WireGateInstance)
- self.groupsocket = GroupSocket.groupsocket(WireGateInstance)
+ self.busmon = BusMonitor.busmonitor(WireGateInstance,self)
+ self.groupsocket = GroupSocket.groupsocket(WireGateInstance,self)
## Deafaultconfig
defaultconfig = {
@@ -82,7 +82,7 @@
def _run(self):
while self.isrunning:
## Check if we are alive and responde until 10 secs
- self.WG.watchdog("knx_connector",10)
+ self.WG.watchdog(self.instanceName,10)
try:
vbusmonin, vbusmonout, vbusmonerr = select.select([self.KNX.EIB_Poll_FD()],[],[],1)
except:
@@ -114,3 +114,7 @@
if len(self.KNXBuffer.buffer) > 7 :
self.busmon.decode(self.KNXBuffer.buffer)
+
+
+ def send(self,dsobj):
+ print "SEND to %s" % dsobj.name
\ No newline at end of file
Modified: PyWireGate/trunk/owfs_connector/OWFS_Connector.py
===================================================================
--- PyWireGate/trunk/owfs_connector/OWFS_Connector.py 2010-11-01 21:14:31 UTC (rev 64)
+++ PyWireGate/trunk/owfs_connector/OWFS_Connector.py 2010-11-03 13:17:57 UTC (rev 65)
@@ -172,7 +172,7 @@
## loop through their interfaces
for get in self.busmaster[busname]['sensors'][sensor]['interfaces']:
resolution = ""
- id = "OW:"+sensor+"_"+get
+ id = "%s:%s_%s" % (self.instanceName,sensor,get)
## get the Datastore Object and look for config
obj = self.WG.DATASTORE.get(id)
@@ -205,4 +205,3 @@
threadname = "OWFS-Reader_%s" % busname
self.busmaster[busname]['readthread'] = threading.Thread(target=self._read,args=[busname],name=threadname)
self.busmaster[busname]['readthread'].start()
-
\ No newline at end of file
Modified: PyWireGate/trunk/owfs_connector/connection.py
===================================================================
--- PyWireGate/trunk/owfs_connector/connection.py 2010-11-01 21:14:31 UTC (rev 64)
+++ PyWireGate/trunk/owfs_connector/connection.py 2010-11-03 13:17:57 UTC (rev 65)
@@ -88,6 +88,7 @@
self._server = server
self._port = port
+ self.checknum = re.compile(r"(^\d+$)|(^\d+\x2e\d+$)", re.MULTILINE)
def __str__(self):
@@ -121,91 +122,120 @@
"""
"""
- #print 'Connection.read("%s", %i, "%s")' % (path)
- s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
- s.connect((self._server, self._port))
+ #print 'Connection.read("%s")' % (path)
+
+ rtn = None
+ ## we don't want errors
+ try:
+ s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
+ try:
+ s.connect((self._server, self._port))
+ except:
+ ##
+ return rtn
- smsg = self.pack(OWMsg.read, len(path) + 1, 8192)
- s.sendall(smsg)
- s.sendall(path + '\x00')
+ smsg = self.pack(OWMsg.read, len(path) + 1, 8192)
+ s.sendall(smsg)
+ s.sendall(path + '\x00')
- while 1:
- data = s.recv(24)
+ while 1:
+ try:
+ data = s.recv(24)
+ except:
+ ##
+ return rtn
- if len(data) is not 24:
- raise exShortRead
+ payload_len = -1
+ if len(data) is 24:
+ ret, payload_len, data_len = self.unpack(data)
- ret, payload_len, data_len = self.unpack(data)
+ if payload_len >= 0:
+ data = s.recv(payload_len)
+ return self.toNumber(data[:data_len])
+ break
+ else:
+ # ping response
+ return None
- if payload_len >= 0:
- data = s.recv(payload_len)
- rtn = self.toNumber(data[:data_len])
- break
- else:
- # ping response
- rtn = None
- break
+ finally:
+ s.close()
+
- s.close()
- return rtn
-
def write(self, path, value):
"""
"""
+ ret = None
+ try:
+ #print 'Connection.write("%s", "%s")' % (path, str(value))
+ s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
+ try:
+ s.connect((self._server, self._port))
+ except:
+ return ret
- #print 'Connection.write("%s", "%s")' % (path, str(value))
- s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
- s.connect((self._server, self._port))
+ value = str(value)
+ smsg = self.pack(OWMsg.write, len(path) + 1 + len(value) + 1, len(value) + 1)
+ s.sendall(smsg)
+ s.sendall(path + '\x00' + value + '\x00')
- value = str(value)
- smsg = self.pack(OWMsg.write, len(path) + 1 + len(value) + 1, len(value) + 1)
- s.sendall(smsg)
- s.sendall(path + '\x00' + value + '\x00')
+ try:
+ data = s.recv(24)
+ except:
+ return ret
- data = s.recv(24)
+ if len(data) is 24:
+ ret, payload_len, data_len = self.unpack(data)
+ return ret
- if len(data) is not 24:
- raise exShortRead
+
+ finally:
+ s.close()
+
- ret, payload_len, data_len = self.unpack(data)
- s.close()
- return ret
-
-
def dir(self, path):
"""
"""
+
+ fields = []
+ try:
+ #print 'Connection.dir("%s")' % (path)
+ s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
+ try:
+ s.connect((self._server, self._port))
+ except:
+ return fields
- #print 'Connection.dir("%s")' % (path)
- s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
- s.connect((self._server, self._port))
+ smsg = self.pack(OWMsg.dir, len(path) + 1, 0)
+ s.sendall(smsg)
+ s.sendall(path + '\x00')
- smsg = self.pack(OWMsg.dir, len(path) + 1, 0)
- s.sendall(smsg)
- s.sendall(path + '\x00')
+ while 1:
+ try:
+ data = s.recv(24)
+ except:
+ return fields
- fields = []
- while 1:
- data = s.recv(24)
+ if len(data) is not 24:
+ return fields
- if len(data) is not 24:
- raise exShortRead
+ ret, payload_len, data_len = self.unpack(data)
- ret, payload_len, data_len = self.unpack(data)
+ if payload_len > 0:
+ try:
+ data = s.recv(payload_len)
+ except:
+ return fields
+ fields.append(data[:data_len])
+ else:
+ # end of dir list or 'ping' response
+ return fields
- if payload_len > 0:
- data = s.recv(payload_len)
- fields.append(data[:data_len])
- else:
- # end of dir list or 'ping' response
- break
+ finally:
+ s.close()
- s.close()
- return fields
-
def pack(self, function, payload_len, data_len):
"""
"""
@@ -241,15 +271,15 @@
return ret_value, payload_len, data_len
- def toNumber(self, str):
+ def toNumber(self, owstr):
"""
"""
+ owstr = owstr.strip()
+ numresult = self.checknum.findall(owstr)
+ if numresult:
+ if numresult[0][0]:
+ return int(numresult[0][0])
+ elif numresult[0][1]:
+ return float(numresult[0][1])
- stripped = str.strip()
- if re.compile('^-?\d+$').match(stripped) :
- return int(stripped)
-
- if re.compile('^-?\d*\.\d*$').match(stripped) : # Could crash if it matched '.' - let it.
- return float(stripped)
-
- return str
+ return owstr
Added: PyWireGate/trunk/simplejson/.___init__.py
===================================================================
(Binary files differ)
Property changes on: PyWireGate/trunk/simplejson/.___init__.py
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added: PyWireGate/trunk/simplejson/._decoder.py
===================================================================
(Binary files differ)
Property changes on: PyWireGate/trunk/simplejson/._decoder.py
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added: PyWireGate/trunk/simplejson/._scanner.py
===================================================================
(Binary files differ)
Property changes on: PyWireGate/trunk/simplejson/._scanner.py
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added: PyWireGate/trunk/simplejson/__init__.py
===================================================================
--- PyWireGate/trunk/simplejson/__init__.py (rev 0)
+++ PyWireGate/trunk/simplejson/__init__.py 2010-11-03 13:17:57 UTC (rev 65)
@@ -0,0 +1,437 @@
+r"""JSON (JavaScript Object Notation) <http://json.org> is a subset of
+JavaScript syntax (ECMA-262 3rd edition) used as a lightweight data
+interchange format.
+
+:mod:`simplejson` exposes an API familiar to users of the standard library
+:mod:`marshal` and :mod:`pickle` modules. It is the externally maintained
+version of the :mod:`json` library contained in Python 2.6, but maintains
+compatibility with Python 2.4 and Python 2.5 and (currently) has
+significant performance advantages, even without using the optional C
+extension for speedups.
+
+Encoding basic Python object hierarchies::
+
+ >>> import simplejson as json
+ >>> json.dumps(['foo', {'bar': ('baz', None, 1.0, 2)}])
+ '["foo", {"bar": ["baz", null, 1.0, 2]}]'
+ >>> print json.dumps("\"foo\bar")
+ "\"foo\bar"
+ >>> print json.dumps(u'\u1234')
+ "\u1234"
+ >>> print json.dumps('\\')
+ "\\"
+ >>> print json.dumps({"c": 0, "b": 0, "a": 0}, sort_keys=True)
+ {"a": 0, "b": 0, "c": 0}
+ >>> from StringIO import StringIO
+ >>> io = StringIO()
+ >>> json.dump(['streaming API'], io)
+ >>> io.getvalue()
+ '["streaming API"]'
+
+Compact encoding::
+
+ >>> import simplejson as json
+ >>> json.dumps([1,2,3,{'4': 5, '6': 7}], separators=(',',':'))
+ '[1,2,3,{"4":5,"6":7}]'
+
+Pretty printing::
+
+ >>> import simplejson as json
+ >>> s = json.dumps({'4': 5, '6': 7}, sort_keys=True, indent=' ')
+ >>> print '\n'.join([l.rstrip() for l in s.splitlines()])
+ {
+ "4": 5,
+ "6": 7
+ }
+
+Decoding JSON::
+
+ >>> import simplejson as json
+ >>> obj = [u'foo', {u'bar': [u'baz', None, 1.0, 2]}]
+ >>> json.loads('["foo", {"bar":["baz", null, 1.0, 2]}]') == obj
+ True
+ >>> json.loads('"\\"foo\\bar"') == u'"foo\x08ar'
+ True
+ >>> from StringIO import StringIO
+ >>> io = StringIO('["streaming API"]')
+ >>> json.load(io)[0] == 'streaming API'
+ True
+
+Specializing JSON object decoding::
+
+ >>> import simplejson as json
+ >>> def as_complex(dct):
+ ... if '__complex__' in dct:
+ ... return complex(dct['real'], dct['imag'])
+ ... return dct
+ ...
+ >>> json.loads('{"__complex__": true, "real": 1, "imag": 2}',
+ ... object_hook=as_complex)
+ (1+2j)
+ >>> from decimal import Decimal
+ >>> json.loads('1.1', parse_float=Decimal) == Decimal('1.1')
+ True
+
+Specializing JSON object encoding::
+
+ >>> import simplejson as json
+ >>> def encode_complex(obj):
+ ... if isinstance(obj, complex):
+ ... return [obj.real, obj.imag]
+ ... raise TypeError(repr(o) + " is not JSON serializable")
+ ...
+ >>> json.dumps(2 + 1j, default=encode_complex)
+ '[2.0, 1.0]'
+ >>> json.JSONEncoder(default=encode_complex).encode(2 + 1j)
+ '[2.0, 1.0]'
+ >>> ''.join(json.JSONEncoder(default=encode_complex).iterencode(2 + 1j))
+ '[2.0, 1.0]'
+
+
+Using simplejson.tool from the shell to validate and pretty-print::
+
+ $ echo '{"json":"obj"}' | python -m simplejson.tool
+ {
+ "json": "obj"
+ }
+ $ echo '{ 1.2:3.4}' | python -m simplejson.tool
+ Expecting property name: line 1 column 2 (char 2)
+"""
+__version__ = '2.1.2'
+__all__ = [
+ 'dump', 'dumps', 'load', 'loads',
+ 'JSONDecoder', 'JSONDecodeError', 'JSONEncoder',
+ 'OrderedDict',
+]
+
+__author__ = 'Bob Ippolito <bo...@re...>'
+
+from decimal import Decimal
+
+from decoder import JSONDecoder, JSONDecodeError
+from encoder import JSONEncoder
+def _import_OrderedDict():
+ import collections
+ try:
+ return collections.OrderedDict
+ except AttributeError:
+ import ordered_dict
+ return ordered_dict.OrderedDict
+OrderedDict = _import_OrderedDict()
+
+def _import_c_make_encoder():
+ try:
+ from simplejson._speedups import make_encoder
+ return make_encoder
+ except ImportError:
+ return None
+
+_default_encoder = JSONEncoder(
+ skipkeys=False,
+ ensure_ascii=True,
+ check_circular=True,
+ allow_nan=True,
+ indent=None,
+ separators=None,
+ encoding='utf-8',
+ default=None,
+ use_decimal=False,
+)
+
+def dump(obj, fp, skipkeys=False, ensure_ascii=True, check_circular=True,
+ allow_nan=True, cls=None, indent=None, separators=None,
+ encoding='utf-8', default=None, use_decimal=False, **kw):
+ """Serialize ``obj`` as a JSON formatted stream to ``fp`` (a
+ ``.write()``-supporting file-like object).
+
+ If ``skipkeys`` is true then ``dict`` keys that are not basic types
+ (``str``, ``unicode``, ``int``, ``long``, ``float``, ``bool``, ``None``)
+ will be skipped instead of raising a ``TypeError``.
+
+ If ``ensure_ascii`` is false, then the some chunks written to ``fp``
+ may be ``unicode`` instances, subject to normal Python ``str`` to
+ ``unicode`` coercion rules. Unless ``fp.write()`` explicitly
+ understands ``unicode`` (as in ``codecs.getwriter()``) this is likely
+ to cause an error.
+
+ If ``check_circular`` is false, then the circular reference check
+ for container types will be skipped and a circular reference will
+ result in an ``OverflowError`` (or worse).
+
+ If ``allow_nan`` is false, then it will be a ``ValueError`` to
+ serialize out of range ``float`` values (``nan``, ``inf``, ``-inf``)
+ in strict compliance of the JSON specification, instead of using the
+ JavaScript equivalents (``NaN``, ``Infinity``, ``-Infinity``).
+
+ If *indent* is a string, then JSON array elements and object members
+ will be pretty-printed with a newline followed by that string repeated
+ for each level of nesting. ``None`` (the default) selects the most compact
+ representation without any newlines. For backwards compatibility with
+ versions of simplejson earlier than 2.1.0, an integer is also accepted
+ and is converted to a string with that many spaces.
+
+ If ``separators`` is an ``(item_separator, dict_separator)`` tuple
+ then it will be used instead of the default ``(', ', ': ')`` separators.
+ ``(',', ':')`` is the most compact JSON representation.
+
+ ``encoding`` is the character encoding for str instances, default is UTF-8.
+
+ ``default(obj)`` is a function that should return a serializable version
+ of obj or raise TypeError. The default simply raises TypeError.
+
+ If *use_decimal* is true (default: ``False``) then decimal.Decimal
+ will be natively serialized to JSON with full precision.
+
+ To use a custom ``JSONEncoder`` subclass (e.g. one that overrides the
+ ``.default()`` method to serialize additional types), specify it with
+ the ``cls`` kwarg.
+
+ """
+ # cached encoder
+ if (not skipkeys and ensure_ascii and
+ check_circular and allow_nan and
+ cls is None and indent is None and separators is None and
+ encoding == 'utf-8' and default is None and not kw):
+ iterable = _default_encoder.iterencode(obj)
+ else:
+ if cls is None:
+ cls = JSONEncoder
+ iterable = cls(skipkeys=skipkeys, ensure_ascii=ensure_ascii,
+ check_circular=check_circular, allow_nan=allow_nan, indent=indent,
+ separators=separators, encoding=encoding,
+ default=default, use_decimal=use_decimal, **kw).iterencode(obj)
+ # could accelerate with writelines in some versions of Python, at
+ # a debuggability cost
+ for chunk in iterable:
+ fp.write(chunk)
+
+
+def dumps(obj, skipkeys=False, ensure_ascii=True, check_circular=True,
+ allow_nan=True, cls=None, indent=None, separators=None,
+ encoding='utf-8', default=None, use_decimal=False, **kw):
+ """Serialize ``obj`` to a JSON formatted ``str``.
+
+ If ``skipkeys`` is false then ``dict`` keys that are not basic types
+ (``str``, ``unicode``, ``int``, ``long``, ``float``, ``bool``, ``None``)
+ will be skipped instead of raising a ``TypeError``.
+
+ If ``ensure_ascii`` is false, then the return value will be a
+ ``unicode`` instance subject to normal Python ``str`` to ``unicode``
+ coercion rules instead of being escaped to an ASCII ``str``.
+
+ If ``check_circular`` is false, then the circular reference check
+ for container types will be skipped and a circular reference will
+ result in an ``OverflowError`` (or worse).
+
+ If ``allow_nan`` is false, then it will be a ``ValueError`` to
+ serialize out of range ``float`` values (``nan``, ``inf``, ``-inf``) in
+ strict compliance of the JSON specification, instead of using the
+ JavaScript equivalents (``NaN``, ``Infinity``, ``-Infinity``).
+
+ If ``indent`` is a string, then JSON array elements and object members
+ will be pretty-printed with a newline followed by that string repeated
+ for each level of nesting. ``None`` (the default) selects the most compact
+ representation without any newlines. For backwards compatibility with
+ versions of simplejson earlier than 2.1.0, an integer is also accepted
+ and is converted to a string with that many spaces.
+
+ If ``separators`` is an ``(item_separator, dict_separator)`` tuple
+ then it will be used instead of the default ``(', ', ': ')`` separators.
+ ``(',', ':')`` is the most compact JSON representation.
+
+ ``encoding`` is the character encoding for str instances, default is UTF-8.
+
+ ``default(obj)`` is a function that should return a serializable version
+ of obj or raise TypeError. The default simply raises TypeError.
+
+ If *use_decimal* is true (default: ``False``) then decimal.Decimal
+ will be natively serialized to JSON with full precision.
+
+ To use a custom ``JSONEncoder`` subclass (e.g. one that overrides the
+ ``.default()`` method to serialize additional types), specify it with
+ the ``cls`` kwarg.
+
+ """
+ # cached encoder
+ if (not skipkeys and ensure_ascii and
+ check_circular and allow_nan and
+ cls is None and indent is None and separators is None and
+ encoding == 'utf-8' and default is None and not use_decimal
+ and not kw):
+ return _default_encoder.encode(obj)
+ if cls is None:
+ cls = JSONEncoder
+ return cls(
+ skipkeys=skipkeys, ensure_ascii=ensure_ascii,
+ check_circular=check_circular, allow_nan=allow_nan, indent=indent,
+ separators=separators, encoding=encoding, default=default,
+ use_decimal=use_decimal, **kw).encode(obj)
+
+
+_default_decoder = JSONDecoder(encoding=None, object_hook=None,
+ object_pairs_hook=None)
+
+
+def load(fp, encoding=None, cls=None, object_hook=None, parse_float=None,
+ parse_int=None, parse_constant=None, object_pairs_hook=None,
+ use_decimal=False, **kw):
+ """Deserialize ``fp`` (a ``.read()``-supporting file-like object containing
+ a JSON document) to a Python object.
+
+ *encoding* determines the encoding used to interpret any
+ :class:`str` objects decoded by this instance (``'utf-8'`` by
+ default). It has no effect when decoding :class:`unicode` objects.
+
+ Note that currently only encodings that are a superset of ASCII work,
+ strings of other encodings should be passed in as :class:`unicode`.
+
+ *object_hook*, if specified, will be called with the result of every
+ JSON object decoded and its return value will be used in place of the
+ given :class:`dict`. This can be used to provide custom
+ deserializations (e.g. to support JSON-RPC class hinting).
+
+ *object_pairs_hook* is an optional function that will be called with
+ the result of any object literal decode with an ordered list of pairs.
+ The return value of *object_pairs_hook* will be used instead of the
+ :class:`dict`. This feature can be used to implement custom decoders
+ that rely on the order that the key and value pairs are decoded (for
+ example, :func:`collections.OrderedDict` will remember the order of
+ insertion). If *object_hook* is also defined, the *object_pairs_hook*
+ takes priority.
+
+ *parse_float*, if specified, will be called with the string of every
+ JSON float to be decoded. By default, this is equivalent to
+ ``float(num_str)``. This can be used to use another datatype or parser
+ for JSON floats (e.g. :class:`decimal.Decimal`).
+
+ *parse_int*, if specified, will be called with the string of every
+ JSON int to be decoded. By default, this is equivalent to
+ ``int(num_str)``. This can be used to use another datatype or parser
+ for JSON integers (e.g. :class:`float`).
+
+ *parse_constant*, if specified, will be called with one of the
+ following strings: ``'-Infinity'``, ``'Infinity'``, ``'NaN'``. This
+ can be used to raise an exception if invalid JSON numbers are
+ encountered.
+
+ If *use_decimal* is true (default: ``False``) then it implies
+ parse_float=decimal.Decimal for parity with ``dump``.
+
+ To use a custom ``JSONDecoder`` subclass, specify it with the ``cls``
+ kwarg.
+
+ """
+ return loads(fp.read(),
+ encoding=encoding, cls=cls, object_hook=object_hook,
+ parse_float=parse_float, parse_int=parse_int,
+ parse_constant=parse_constant, object_pairs_hook=object_pairs_hook,
+ use_decimal=use_decimal, **kw)
+
+
+def loads(s, encoding=None, cls=None, object_hook=None, parse_float=None,
+ parse_int=None, parse_constant=None, object_pairs_hook=None,
+ use_decimal=False, **kw):
+ """Deserialize ``s`` (a ``str`` or ``unicode`` instance containing a JSON
+ document) to a Python object.
+
+ *encoding* determines the encoding used to interpret any
+ :class:`str` objects decoded by this instance (``'utf-8'`` by
+ default). It has no effect when decoding :class:`unicode` objects.
+
+ Note that currently only encodings that are a superset of ASCII work,
+ strings of other encodings should be passed in as :class:`unicode`.
+
+ *object_hook*, if specified, will be called with the result of every
+ JSON object decoded and its return value will be used in place of the
+ given :class:`dict`. This can be used to provide custom
+ deserializations (e.g. to support JSON-RPC class hinting).
+
+ *object_pairs_hook* is an optional function that will be called with
+ the result of any object literal decode with an ordered list of pairs.
+ The return value of *object_pairs_hook* will be used instead of the
+ :class:`dict`. This feature can be used to implement custom decoders
+ that rely on the order that the key and value pairs are decoded (for
+ example, :func:`collections.OrderedDict` will remember the order of
+ insertion). If *object_hook* is also defined, the *object_pairs_hook*
+ takes priority.
+
+ *parse_float*, if specified, will be called with the string of every
+ JSON float to be decoded. By default, this is equivalent to
+ ``float(num_str)``. This can be used to use another datatype or parser
+ for JSON floats (e.g. :class:`decimal.Decimal`).
+
+ *parse_int*, if specified, will be called with the string of every
+ JSON int to be decoded. By default, this is equivalent to
+ ``int(num_str)``. This can be used to use another datatype or parser
+ for JSON integers (e.g. :class:`float`).
+
+ *parse_constant*, if specified, will be called with one of the
+ following strings: ``'-Infinity'``, ``'Infinity'``, ``'NaN'``. This
+ can be used to raise an exception if invalid JSON numbers are
+ encountered.
+
+ If *use_decimal* is true (default: ``False``) then it implies
+ parse_float=decimal.Decimal for parity with ``dump``.
+
+ To use a custom ``JSONDecoder`` subclass, specify it with the ``cls``
+ kwarg.
+
+ """
+ if (cls is None and encoding is None and object_hook is None and
+ parse_int is None and parse_float is None and
+ parse_constant is None and object_pairs_hook is None
+ and not use_decimal and not kw):
+ return _default_decoder.decode(s)
+ if cls is None:
+ cls = JSONDecoder
+ if object_hook is not None:
+ kw['object_hook'] = object_hook
+ if object_pairs_hook is not None:
+ kw['object_pairs_hook'] = object_pairs_hook
+ if parse_float is not None:
+ kw['parse_float'] = parse_float
+ if parse_int is not None:
+ kw['parse_int'] = parse_int
+ if parse_constant is not None:
+ kw['parse_constant'] = parse_constant
+ if use_decimal:
+ if parse_float is not None:
+ raise TypeError("use_decimal=True implies parse_float=Decimal")
+ kw['parse_float'] = Decimal
+ return cls(encoding=encoding, **kw).decode(s)
+
+
+def _toggle_speedups(enabled):
+ import simplejson.decoder as dec
+ import simplejson.encoder as enc
+ import simplejson.scanner as scan
+ c_make_encoder = _import_c_make_encoder()
+ if enabled:
+ dec.scanstring = dec.c_scanstring or dec.py_scanstring
+ enc.c_make_encoder = c_make_encoder
+ enc.encode_basestring_ascii = (enc.c_encode_basestring_ascii or
+ enc.py_encode_basestring_ascii)
+ scan.make_scanner = scan.c_make_scanner or scan.py_make_scanner
+ else:
+ dec.scanstring = dec.py_scanstring
+ enc.c_make_encoder = None
+ enc.encode_basestring_ascii = enc.py_encode_basestring_ascii
+ scan.make_scanner = scan.py_make_scanner
+ dec.make_scanner = scan.make_scanner
+ global _default_decoder
+ _default_decoder = JSONDecoder(
+ encoding=None,
+ object_hook=None,
+ object_pairs_hook=None,
+ )
+ global _default_encoder
+ _default_encoder = JSONEncoder(
+ skipkeys=False,
+ ensure_ascii=True,
+ check_circular=True,
+ allow_nan=True,
+ indent=None,
+ separators=None,
+ encoding='utf-8',
+ default=None,
+ )
Added: PyWireGate/trunk/simplejson/_speedups.c
===================================================================
--- PyWireGate/trunk/simplejson/_speedups.c (rev 0)
+++ PyWireGate/trunk/simplejson/_speedups.c 2010-11-03 13:17:57 UTC (rev 65)
@@ -0,0 +1,2561 @@
+#include "Python.h"
+#include "structmember.h"
+#if PY_VERSION_HEX < 0x02070000 && !defined(PyOS_string_to_double)
+#define PyOS_string_to_double json_PyOS_string_to_double
+static double
+json_PyOS_string_to_double(const char *s, char **endptr, PyObject *overflow_exception);
+static double
+json_PyOS_string_to_double(const char *s, char **endptr, PyObject *overflow_exception) {
+ double x;
+ assert(endptr == NULL);
+ assert(overflow_exception == NULL);
+ PyFPE_START_PROTECT("json_PyOS_string_to_double", return -1.0;)
+ x = PyOS_ascii_atof(s);
+ PyFPE_END_PROTECT(x)
+ return x;
+}
+#endif
+#if PY_VERSION_HEX < 0x02060000 && !defined(Py_TYPE)
+#define Py_TYPE(ob) (((PyObject*)(ob))->ob_type)
+#endif
+#if PY_VERSION_HEX < 0x02050000 && !defined(PY_SSIZE_T_MIN)
+typedef int Py_ssize_t;
+#define PY_SSIZE_T_MAX INT_MAX
+#define PY_SSIZE_T_MIN INT_MIN
+#define PyInt_FromSsize_t PyInt_FromLong
+#define PyInt_AsSsize_t PyInt_AsLong
+#endif
+#ifndef Py_IS_FINITE
+#define Py_IS_FINITE(X) (!Py_IS_INFINITY(X) && !Py_IS_NAN(X))
+#endif
+
+#ifdef __GNUC__
+#define UNUSED __attribute__((__unused__))
+#else
+#define UNUSED
+#endif
+
+#define DEFAULT_ENCODING "utf-8"
+
+#define PyScanner_Check(op) PyObject_TypeCheck(op, &PyScannerType)
+#define PyScanner_CheckExact(op) (Py_TYPE(op) == &PyScannerType)
+#define PyEncoder_Check(op) PyObject_TypeCheck(op, &PyEncoderType)
+#define PyEncoder_CheckExact(op) (Py_TYPE(op) == &PyEncoderType)
+#define Decimal_Check(op) (PyObject_TypeCheck(op, DecimalTypePtr))
+
+static PyTypeObject PyScannerType;
+static PyTypeObject PyEncoderType;
+static PyTypeObject *DecimalTypePtr;
+
+typedef struct _PyScannerObject {
+ PyObject_HEAD
+ PyObject *encoding;
+ PyObject *strict;
+ PyObject *object_hook;
+ PyObject *pairs_hook;
+ PyObject *parse_float;
+ PyObject *parse_int;
+ PyObject *parse_constant;
+ PyObject *memo;
+} PyScannerObject;
+
+static PyMemberDef scanner_members[] = {
+ {"encoding", T_OBJECT, offsetof(PyScannerObject, encoding), READONLY, "encoding"},
+ {"strict", T_OBJECT, offsetof(PyScannerObject, strict), READONLY, "strict"},
+ {"object_hook", T_OBJECT, offsetof(PyScannerObject, object_hook), READONLY, "object_hook"},
+ {"object_pairs_hook", T_OBJECT, offsetof(PyScannerObject, pairs_hook), READONLY, "object_pairs_hook"},
+ {"parse_float", T_OBJECT, offsetof(PyScannerObject, parse_float), READONLY, "parse_float"},
+ {"parse_int", T_OBJECT, offsetof(PyScannerObject, parse_int), READONLY, "parse_int"},
+ {"parse_constant", T_OBJECT, offsetof(PyScannerObject, parse_constant), READONLY, "parse_constant"},
+ {NULL}
+};
+
+typedef struct _PyEncoderObject {
+ PyObject_HEAD
+ PyObject *markers;
+ PyObject *defaultfn;
+ PyObject *encoder;
+ PyObject *indent;
+ PyObject *key_separator;
+ PyObject *item_separator;
+ PyObject *sort_keys;
+ PyObject *skipkeys;
+ PyObject *key_memo;
+ int fast_encode;
+ int allow_nan;
+ int use_decimal;
+} PyEncoderObject;
+
+static PyMemberDef encoder_members[] = {
+ {"markers", T_OBJECT, offsetof(PyEncoderObject, markers), READONLY, "markers"},
+ {"default", T_OBJECT, offsetof(PyEncoderObject, defaultfn), READONLY, "default"},
+ {"encoder", T_OBJECT, offsetof(PyEncoderObject, encoder), READONLY, "encoder"},
+ {"indent", T_OBJECT, offsetof(PyEncoderObject, indent), READONLY, "indent"},
+ {"key_separator", T_OBJECT, offsetof(PyEncoderObject, key_separator), READONLY, "key_separator"},
+ {"item_separator", T_OBJECT, offsetof(PyEncoderObject, item_separator), READONLY, "item_separator"},
+ {"sort_keys", T_OBJECT, offsetof(PyEncoderObject, sort_keys), READONLY, "sort_keys"},
+ {"skipkeys", T_OBJECT, offsetof(PyEncoderObject, skipkeys), READONLY, "skipkeys"},
+ {"key_memo", T_OBJECT, offsetof(PyEncoderObject, key_memo), READONLY, "key_memo"},
+ {NULL}
+};
+
+static Py_ssize_t
+ascii_escape_char(Py_UNICODE c, char *output, Py_ssize_t chars);
+static PyObject *
+ascii_escape_unicode(PyObject *pystr);
+static PyObject *
+ascii_escape_str(PyObject *pystr);
+static PyObject *
+py_encode_basestring_ascii(PyObject* self UNUSED, PyObject *pystr);
+void init_speedups(void);
+static PyObject *
+scan_once_str(PyScannerObject *s, PyObject *pystr, Py_ssize_t idx, Py_ssize_t *next_idx_ptr);
+static PyObject *
+scan_once_unicode(PyScannerObject *s, PyObject *pystr, Py_ssize_t idx, Py_ssize_t *next_idx_ptr);
+static PyObject *
+_build_rval_index_tuple(PyObject *rval, Py_ssize_t idx);
+static PyObject *
+scanner_new(PyTypeObject *type, PyObject *args, PyObject *kwds);
+static int
+scanner_init(PyObject *self, PyObject *args, PyObject *kwds);
+static void
+scanner_dealloc(PyObject *self);
+static int
+scanner_clear(PyObject *self);
+static PyObject *
+encoder_new(PyTypeObject *type, PyObject *args, PyObject *kwds);
+static int
+encoder_init(PyObject *self, PyObject *args, PyObject *kwds);
+static void
+encoder_dealloc(PyObject *self);
+static int
+encoder_clear(PyObject *self);
+static int
+encoder_listencode_list(PyEncoderObject *s, PyObject *rval, PyObject *seq, Py_ssize_t indent_level);
+static int
+encoder_listencode_obj(PyEncoderObject *s, PyObject *rval, PyObject *obj, Py_ssize_t indent_level);
+static int
+encoder_listencode_dict(PyEncoderObject *s, PyObject *rval, PyObject *dct, Py_ssize_t indent_level);
+static PyObject *
+_encoded_const(PyObject *obj);
+static void
+raise_errmsg(char *msg, PyObject *s, Py_ssize_t end);
+static PyObject *
+encoder_encode_string(PyEncoderObject *s, PyObject *obj);
+static int
+_convertPyInt_AsSsize_t(PyObject *o, Py_ssize_t *size_ptr);
+static PyObject *
+_convertPyInt_FromSsize_t(Py_ssize_t *size_ptr);
+static PyObject *
+encoder_encode_float(PyEncoderObject *s, PyObject *obj);
+
+#define S_CHAR(c) (c >= ' ' && c <= '~' && c != '\\' && c != '"')
+#define IS_WHITESPACE(c) (((c) == ' ') || ((c) == '\t') || ((c) == '\n') || ((c) == '\r'))
+
+#define MIN_EXPANSION 6
+#ifdef Py_UNICODE_WIDE
+#define MAX_EXPANSION (2 * MIN_EXPANSION)
+#else
+#define MAX_EXPANSION MIN_EXPANSION
+#endif
+
+static int
+_convertPyInt_AsSsize_t(PyObject *o, Py_ssize_t *size_ptr)
+{
+ /* PyObject to Py_ssize_t converter */
+ *size_ptr = PyInt_AsSsize_t(o);
+ if (*size_ptr == -1 && PyErr_Occurred())
+ return 0;
+ return 1;
+}
+
+static PyObject *
+_convertPyInt_FromSsize_t(Py_ssize_t *size_ptr)
+{
+ /* Py_ssize_t to PyObject converter */
+ return PyInt_FromSsize_t(*size_ptr);
+}
+
+static Py_ssize_t
+ascii_escape_char(Py_UNICODE c, char *output, Py_ssize_t chars)
+{
+ /* Escape unicode code point c to ASCII escape sequences
+ in char *output. output must have at least 12 bytes unused to
+ accommodate an escaped surrogate pair "\uXXXX\uXXXX" */
+ output[chars++] = '\\';
+ switch (c) {
+ case '\\': output[chars++] = (char)c; break;
+ case '"': output[chars++] = (char)c; break;
+ case '\b': output[chars++] = 'b'; break;
+ case '\f': output[chars++] = 'f'; break;
+ case '\n': output[chars++] = 'n'; break;
+ case '\r': output[chars++] = 'r'; break;
+ case '\t': output[chars++] = 't'; break;
+ default:
+#ifdef Py_UNICODE_WIDE
+ if (c >= 0x10000) {
+ /* UTF-16 surrogate pair */
+ Py_UNICODE v = c - 0x10000;
+ c = 0xd800 | ((v >> 10) & 0x3ff);
+ output[chars++] = 'u';
+ output[...
[truncated message content] |
|
From: <net...@us...> - 2010-11-01 21:14:37
|
Revision: 64
http://openautomation.svn.sourceforge.net/openautomation/?rev=64&view=rev
Author: netzkind
Date: 2010-11-01 21:14:31 +0000 (Mon, 01 Nov 2010)
Log Message:
-----------
Added XML-Schema/XSD to validate config-XML
Modified Paths:
--------------
CometVisu/trunk/ChangeLog
Added Paths:
-----------
CometVisu/trunk/visu/visu_config.xsd
Modified: CometVisu/trunk/ChangeLog
===================================================================
--- CometVisu/trunk/ChangeLog 2010-11-01 17:37:41 UTC (rev 63)
+++ CometVisu/trunk/ChangeLog 2010-11-01 21:14:31 UTC (rev 64)
@@ -8,6 +8,7 @@
- New Feature: tag for "line" break
- New Feature: tag for images
- New Feature: <text> has new optional attribute "align"
+- Added XML Schema / XSD to validate config-XML
0.5.0
=====
Added: CometVisu/trunk/visu/visu_config.xsd
===================================================================
--- CometVisu/trunk/visu/visu_config.xsd (rev 0)
+++ CometVisu/trunk/visu/visu_config.xsd 2010-11-01 21:14:31 UTC (rev 64)
@@ -0,0 +1,191 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema">
+
+<!-- basic types -->
+<xsd:simpleType name="address">
+ <xsd:restriction base="xsd:string">
+ <xsd:pattern value="[0-9]{1,2}/[0-9]{1,2}/[0-9]{1,2}" />
+ </xsd:restriction>
+</xsd:simpleType>
+
+<xsd:simpleType name="dimension">
+ <xsd:restriction base="xsd:string" />
+</xsd:simpleType>
+<xsd:simpleType name="uri">
+ <xsd:restriction base="xsd:string" />
+</xsd:simpleType>
+
+<xsd:complexType name="entry">
+ <xsd:simpleContent>
+ <xsd:extension base="xsd:string">
+ <xsd:attribute ref="value" use="required" />
+ </xsd:extension>
+ </xsd:simpleContent>
+</xsd:complexType>
+
+<!-- simple elements -->
+
+
+<!-- attributes -->
+<xsd:attribute name="address" type="address" />
+<xsd:attribute name="datatype" type="xsd:decimal" />
+<xsd:attribute name="response_address" type="address" />
+<xsd:attribute name="response_datatype" type="xsd:decimal" />
+
+<xsd:attribute name="pre" type="xsd:string" />
+<xsd:attribute name="post" type="xsd:string" />
+
+<xsd:attribute name="min" type="xsd:decimal" />
+<xsd:attribute name="max" type="xsd:decimal" />
+<xsd:attribute name="step" type="xsd:decimal" />
+
+<xsd:attribute name="mapping" type="xsd:string" />
+<xsd:attribute name="style" type="xsd:string" />
+<xsd:attribute name="value" type="xsd:string" />
+
+<!-- complex elements -->
+<xsd:element name="pages">
+ <xsd:complexType>
+ <xsd:choice minOccurs="0" maxOccurs="unbounded">
+ <xsd:element ref="mappings" />
+ <xsd:element ref="styles" />
+ <xsd:element ref="page" minOccurs="1" />
+ </xsd:choice>
+ </xsd:complexType>
+</xsd:element>
+
+<xsd:element name="mappings">
+ <xsd:complexType>
+ <xsd:choice minOccurs="0" maxOccurs="unbounded">
+ <xsd:element ref="mapping" />
+ </xsd:choice>
+ </xsd:complexType>
+</xsd:element>
+
+<xsd:element name="mapping">
+ <xsd:complexType>
+ <xsd:choice minOccurs="0" maxOccurs="unbounded">
+ <xsd:element name="entry" type="entry" minOccurs="1" />
+ </xsd:choice>
+ <xsd:attribute name="name" type="xsd:string" use="required" />
+ </xsd:complexType>
+</xsd:element>
+
+<xsd:element name="styles">
+ <xsd:complexType>
+ <xsd:choice minOccurs="0" maxOccurs="unbounded">
+ <xsd:element ref="style" />
+ </xsd:choice>
+ </xsd:complexType>
+</xsd:element>
+
+<xsd:element name="style">
+ <xsd:complexType>
+ <xsd:choice minOccurs="0" maxOccurs="unbounded">
+ <xsd:element name="entry" type="entry" minOccurs="1" />
+ </xsd:choice>
+ <xsd:attribute name="name" type="xsd:string" use="required" />
+ </xsd:complexType>
+</xsd:element>
+
+<!-- define a page - if you add a new widget, you need to list it here -->
+<xsd:element name="page">
+ <xsd:complexType>
+ <xsd:choice minOccurs="0" maxOccurs="unbounded">
+ <!-- list all possbile widgets here -->
+ <xsd:element name="text" type="xsd:string" />
+ <xsd:element name="line" type="line" />
+ <xsd:element name="switch" type="switch" />
+ <xsd:element name="toggle" type="switch" />
+ <xsd:element name="trigger" type="trigger" />
+ <xsd:element name="dim" type="dim" />
+ <xsd:element name="slider" type="dim" />
+ <xsd:element name="info" type="info" />
+ <xsd:element name="shade" type="info" />
+ <xsd:element name="image" type="image" />
+ <xsd:element name="break" type="break" />
+ <xsd:element ref="page" />
+ </xsd:choice>
+ <xsd:attribute name="name" type="xsd:string" use="required" />
+ </xsd:complexType>
+</xsd:element>
+
+<!-- more fun part - all widgets - if you add a new widget, you need to define it here -->
+
+<xsd:complexType name="switch">
+ <xsd:simpleContent>
+ <xsd:extension base="xsd:string">
+ <xsd:attribute ref="address" use="required" />
+ <xsd:attribute ref="datatype" use="required" />
+ <xsd:attribute ref="response_address" use="required" />
+ <xsd:attribute ref="response_datatype" use="required" />
+ <xsd:attribute ref="pre" />
+ <xsd:attribute ref="post" />
+ <xsd:attribute ref="mapping" />
+ <xsd:attribute ref="style" />
+ </xsd:extension>
+ </xsd:simpleContent>
+</xsd:complexType>
+
+
+<xsd:complexType name="trigger">
+ <xsd:simpleContent>
+ <xsd:extension base="xsd:string">
+ <xsd:attribute ref="address" use="required" />
+ <xsd:attribute ref="datatype" use="required" />
+ <xsd:attribute ref="value" use="required" />
+ <xsd:attribute ref="pre" />
+ <xsd:attribute ref="post" />
+ <xsd:attribute ref="mapping" />
+ <xsd:attribute ref="style" />
+ </xsd:extension>
+ </xsd:simpleContent>
+</xsd:complexType>
+
+<xsd:complexType name="dim">
+ <xsd:simpleContent>
+ <xsd:extension base="xsd:string">
+ <xsd:attribute ref="address" use="required" />
+ <xsd:attribute ref="datatype" use="required" />
+ <xsd:attribute ref="response_address" use="required" />
+ <xsd:attribute ref="response_datatype" use="required" />
+ <xsd:attribute ref="min" />
+ <xsd:attribute ref="max" />
+ <xsd:attribute ref="step" />
+ <xsd:attribute ref="mapping" />
+ <xsd:attribute ref="style" />
+ </xsd:extension>
+ </xsd:simpleContent>
+</xsd:complexType>
+
+<xsd:complexType name="info">
+ <xsd:simpleContent>
+ <xsd:extension base="xsd:string">
+ <xsd:attribute ref="address" use="required" />
+ <xsd:attribute ref="datatype" use="required" />
+ <xsd:attribute ref="pre" />
+ <xsd:attribute ref="post" />
+ <xsd:attribute ref="mapping" />
+ <xsd:attribute ref="style" />
+ </xsd:extension>
+ </xsd:simpleContent>
+</xsd:complexType>
+
+<xsd:complexType name="image">
+ <xsd:simpleContent>
+ <xsd:extension base="xsd:string">
+ <xsd:attribute name="src" type="uri" use="required" />
+ <xsd:attribute name="width" type="dimension" />
+ <xsd:attribute name="height" type="dimension" />
+ </xsd:extension>
+ </xsd:simpleContent>
+</xsd:complexType>
+
+<xsd:complexType name="break" />
+<xsd:complexType name="line" />
+
+<!-- toggle is not yet implemented -->
+<!-- shade is not yet implemented -->
+<!-- slider is not yet implemented -->
+
+</xsd:schema>
\ No newline at end of file
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ma...@us...> - 2010-11-01 17:37:47
|
Revision: 63
http://openautomation.svn.sourceforge.net/openautomation/?rev=63&view=rev
Author: mayerch
Date: 2010-11-01 17:37:41 +0000 (Mon, 01 Nov 2010)
Log Message:
-----------
- New Feature: tag for images
- New Feature: <text> has new optional attribute "align"
Modified Paths:
--------------
CometVisu/trunk/ChangeLog
Modified: CometVisu/trunk/ChangeLog
===================================================================
--- CometVisu/trunk/ChangeLog 2010-11-01 17:28:18 UTC (rev 62)
+++ CometVisu/trunk/ChangeLog 2010-11-01 17:37:41 UTC (rev 63)
@@ -6,6 +6,8 @@
- New Feature: slide and dim widgets allow range and step attributes
- New Feature: ranges for mapping and style
- New Feature: tag for "line" break
+- New Feature: tag for images
+- New Feature: <text> has new optional attribute "align"
0.5.0
=====
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ma...@us...> - 2010-11-01 17:28:24
|
Revision: 62
http://openautomation.svn.sourceforge.net/openautomation/?rev=62&view=rev
Author: mayerch
Date: 2010-11-01 17:28:18 +0000 (Mon, 01 Nov 2010)
Log Message:
-----------
Bugfix: <text> will use full space
New Feature: <text> has new optional attribute "align"
Modified Paths:
--------------
CometVisu/trunk/visu/lib/visudesign_pure.js
CometVisu/trunk/visu/visu_config.xml
Modified: CometVisu/trunk/visu/lib/visudesign_pure.js
===================================================================
--- CometVisu/trunk/visu/lib/visudesign_pure.js 2010-11-01 17:17:16 UTC (rev 61)
+++ CometVisu/trunk/visu/lib/visudesign_pure.js 2010-11-01 17:28:18 UTC (rev 62)
@@ -53,7 +53,10 @@
{
var ret_val = $('<div class="widget" />');
ret_val.addClass( 'text' );
- ret_val.append( '<div class="label">' + page.textContent + '</div>' );
+ var style = '';
+ if( $(page).attr('align') ) style += 'text-align:' + $(page).attr('align') + ';';
+ if( style != '' ) style = 'style="' + style + '"';
+ ret_val.append( '<div ' + style + '>' + page.textContent + '</div>' );
return ret_val;
}
Modified: CometVisu/trunk/visu/visu_config.xml
===================================================================
--- CometVisu/trunk/visu/visu_config.xml 2010-11-01 17:17:16 UTC (rev 61)
+++ CometVisu/trunk/visu/visu_config.xml 2010-11-01 17:28:18 UTC (rev 62)
@@ -31,7 +31,7 @@
</style>
</styles>
<page name="Übersicht">
- <text>Willkommen bei der CometVisu!</text>
+ <text align="center">Willkommen bei der CometVisu!</text>
<toggle address="1/0/2" datatype="1.001" response_address="1/0/2" mapping="OnOff">Terrase Licht</toggle>
<trigger address="1/0/2" datatype="1.001" value="0" mapping="OnOff">Terrase Licht 0</trigger>
<trigger address="1/0/2" datatype="1.001" value="1" mapping="OnOff">Terrase Licht 1</trigger>
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ma...@us...> - 2010-11-01 17:17:24
|
Revision: 61
http://openautomation.svn.sourceforge.net/openautomation/?rev=61&view=rev
Author: mayerch
Date: 2010-11-01 17:17:16 +0000 (Mon, 01 Nov 2010)
Log Message:
-----------
Initial implementation of new Feature: <image> tag
Modified Paths:
--------------
CometVisu/trunk/visu/lib/templateengine.js
CometVisu/trunk/visu/lib/visudesign_pure.js
CometVisu/trunk/visu/visu_config.xml
Modified: CometVisu/trunk/visu/lib/templateengine.js
===================================================================
--- CometVisu/trunk/visu/lib/templateengine.js 2010-11-01 16:44:27 UTC (rev 60)
+++ CometVisu/trunk/visu/lib/templateengine.js 2010-11-01 17:17:16 UTC (rev 61)
@@ -237,6 +237,8 @@
return design.createSwitch( page );
case 'trigger':
return design.createTrigger( page );
+ case 'image':
+ return design.createImage( page );
}
return design.createUnknown( page );
}
Modified: CometVisu/trunk/visu/lib/visudesign_pure.js
===================================================================
--- CometVisu/trunk/visu/lib/visudesign_pure.js 2010-11-01 16:44:27 UTC (rev 60)
+++ CometVisu/trunk/visu/lib/visudesign_pure.js 2010-11-01 17:17:16 UTC (rev 61)
@@ -156,6 +156,19 @@
return ret_val;
}
+ this.createImage = function( page )
+ {
+ var ret_val = $('<div class="widget" />');
+ ret_val.addClass( 'image' );
+ ret_val.append( '<div class="label">' + page.textContent + '</div>' );
+ var style = '';
+ if( $(page).attr('width') ) style += 'width:' + $(page).attr('width') + ';';
+ if( $(page).attr('height') ) style += 'height:' + $(page).attr('height') + ';';
+ if( style != '' ) style = 'style="' + style + '"';
+ ret_val.append( '<div class="actor"><img src="' +$(page).attr('src') + '" ' + style + ' /></div>' );
+ return ret_val;
+ }
+
this.createUnknown = function( page )
{
var ret_val = $('<div class="widget" />');
Modified: CometVisu/trunk/visu/visu_config.xml
===================================================================
--- CometVisu/trunk/visu/visu_config.xml 2010-11-01 16:44:27 UTC (rev 60)
+++ CometVisu/trunk/visu/visu_config.xml 2010-11-01 17:17:16 UTC (rev 61)
@@ -45,6 +45,10 @@
<info address="12/4/250" datatype="9" style="BluePurpleRed">Slide Info</info>
<info address="12/4/250" datatype="9" style="BluePurpleRed" mapping="Sign">Slide Info</info>
<line />
+ <image src="icon/comet_128_ff8000.png" >Ein Bild</image>
+ <image src="icon/comet_128_ff8000.png" />
+ <image src="icon/comet_128_ff8000.png" width="500px" height="46px" />
+ <line />
<info address="1/0/41" datatype="1.000" mapping="OnOff">Treppenlicht</info>
<page name="Fenster Kontakte">
<info address="4/3/10" datatype="1" mapping="OpenClose" style="GreenRed">Bad EG Reed Fenster</info>
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ma...@us...> - 2010-11-01 16:44:33
|
Revision: 60
http://openautomation.svn.sourceforge.net/openautomation/?rev=60&view=rev
Author: mayerch
Date: 2010-11-01 16:44:27 +0000 (Mon, 01 Nov 2010)
Log Message:
-----------
New Feature: tag for "line" break
Modified Paths:
--------------
CometVisu/trunk/ChangeLog
Modified: CometVisu/trunk/ChangeLog
===================================================================
--- CometVisu/trunk/ChangeLog 2010-11-01 16:42:44 UTC (rev 59)
+++ CometVisu/trunk/ChangeLog 2010-11-01 16:44:27 UTC (rev 60)
@@ -5,6 +5,7 @@
- New Feature: generic slide widget
- New Feature: slide and dim widgets allow range and step attributes
- New Feature: ranges for mapping and style
+- New Feature: tag for "line" break
0.5.0
=====
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ma...@us...> - 2010-11-01 16:42:50
|
Revision: 59
http://openautomation.svn.sourceforge.net/openautomation/?rev=59&view=rev
Author: mayerch
Date: 2010-11-01 16:42:44 +0000 (Mon, 01 Nov 2010)
Log Message:
-----------
New Feature: tag for "line" break
Modified Paths:
--------------
CometVisu/trunk/visu/lib/templateengine.js
CometVisu/trunk/visu/lib/visudesign_pure.js
CometVisu/trunk/visu/style_orange.css
CometVisu/trunk/visu/visu_config.xml
Modified: CometVisu/trunk/visu/lib/templateengine.js
===================================================================
--- CometVisu/trunk/visu/lib/templateengine.js 2010-11-01 11:06:39 UTC (rev 58)
+++ CometVisu/trunk/visu/lib/templateengine.js 2010-11-01 16:42:44 UTC (rev 59)
@@ -221,6 +221,8 @@
return design.createPage( page, path );
case 'line':
return design.createLine();
+ case 'break':
+ return design.createBreak();
case 'text':
return design.createText( page );
case 'info':
Modified: CometVisu/trunk/visu/lib/visudesign_pure.js
===================================================================
--- CometVisu/trunk/visu/lib/visudesign_pure.js 2010-11-01 11:06:39 UTC (rev 58)
+++ CometVisu/trunk/visu/lib/visudesign_pure.js 2010-11-01 16:42:44 UTC (rev 59)
@@ -44,6 +44,11 @@
return $( '<hr />' );
}
+ this.createBreak = function()
+ {
+ return $( '<br />' );
+ }
+
this.createText = function( page )
{
var ret_val = $('<div class="widget" />');
Modified: CometVisu/trunk/visu/style_orange.css
===================================================================
--- CometVisu/trunk/visu/style_orange.css 2010-11-01 11:06:39 UTC (rev 58)
+++ CometVisu/trunk/visu/style_orange.css 2010-11-01 16:42:44 UTC (rev 59)
@@ -25,6 +25,11 @@
margin:0.1em;
}
+body br
+{
+ clear:both;
+}
+
.nav_path
{
color: #ff8000;
Modified: CometVisu/trunk/visu/visu_config.xml
===================================================================
--- CometVisu/trunk/visu/visu_config.xml 2010-11-01 11:06:39 UTC (rev 58)
+++ CometVisu/trunk/visu/visu_config.xml 2010-11-01 16:42:44 UTC (rev 59)
@@ -38,6 +38,7 @@
<trigger address="2/2/5" datatype="5.001" value="0" >Rolladen Licht 0</trigger>
<trigger address="2/2/5" datatype="5.001" value="100" >Rolladen Licht 100</trigger>
<switch address="1/0/50" datatype="1.001" response_address="1/4/50" mapping="OnOff">Schalt Schiebetüre Licht</switch>
+ <break />
<dim address="1/2/51" datatype="5.010" response_address="1/3/51" response_datatype="5.010">Dim Esstisch</dim>
<shade address="2/4/5" datatype="5.001">Rollladen links</shade>
<slide address="12/4/250" datatype="9" min="-18" max="26">Slide</slide>
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ni...@us...> - 2010-11-01 11:06:45
|
Revision: 58
http://openautomation.svn.sourceforge.net/openautomation/?rev=58&view=rev
Author: nilss1
Date: 2010-11-01 11:06:39 +0000 (Mon, 01 Nov 2010)
Log Message:
-----------
change unpack of msg to unsigned Integer
Modified Paths:
--------------
PyWireGate/trunk/owfs_connector/connection.py
Modified: PyWireGate/trunk/owfs_connector/connection.py
===================================================================
--- PyWireGate/trunk/owfs_connector/connection.py 2010-10-31 23:35:57 UTC (rev 57)
+++ PyWireGate/trunk/owfs_connector/connection.py 2010-11-01 11:06:39 UTC (rev 58)
@@ -229,7 +229,8 @@
if len(msg) is not 24:
raise exInvalidMessage, msg
- val = struct.unpack('iiiiii', msg)
+ val = struct.unpack('IIIIII', msg)
+
version = socket.ntohl(val[0])
payload_len = socket.ntohl(val[1])
ret_value = socket.ntohl(val[2])
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ma...@us...> - 2010-10-31 23:36:03
|
Revision: 57
http://openautomation.svn.sourceforge.net/openautomation/?rev=57&view=rev
Author: mayerch
Date: 2010-10-31 23:35:57 +0000 (Sun, 31 Oct 2010)
Log Message:
-----------
First little step towards 2d and 3d pages...
Modified Paths:
--------------
CometVisu/trunk/visu/lib/visudesign_pure.js
Modified: CometVisu/trunk/visu/lib/visudesign_pure.js
===================================================================
--- CometVisu/trunk/visu/lib/visudesign_pure.js 2010-10-31 21:01:35 UTC (rev 56)
+++ CometVisu/trunk/visu/lib/visudesign_pure.js 2010-10-31 23:35:57 UTC (rev 57)
@@ -25,6 +25,7 @@
var ret_val = $('<div class="widget" />');
var style = ( '0' != path ) ? 'display:none' : '';
var name = $(page).attr('name'); //path += '_' + name;
+ var type = $(page).attr('type'); //text, 2d or 3d
ret_val.addClass( 'link' );
ret_val.append( '<a href="javascript:scrollToPage(\''+path+'\')">' + name + '</a>' );
var childs = $(page).children();
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|