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
(2) |
Dec
|
|
From: <ni...@us...> - 2010-11-15 19:58:52
|
Revision: 130
http://openautomation.svn.sourceforge.net/openautomation/?rev=130&view=rev
Author: nilss1
Date: 2010-11-15 19:58:41 +0000 (Mon, 15 Nov 2010)
Log Message:
-----------
Use Queue based readThreads and support subtypes (DS2438TH/DS2438THS)
Modified Paths:
--------------
PyWireGate/trunk/owfs_connector/OWFS_Connector.py
PyWireGate/trunk/owfs_connector/sensors.ini
Modified: PyWireGate/trunk/owfs_connector/OWFS_Connector.py
===================================================================
--- PyWireGate/trunk/owfs_connector/OWFS_Connector.py 2010-11-15 19:56:47 UTC (rev 129)
+++ PyWireGate/trunk/owfs_connector/OWFS_Connector.py 2010-11-15 19:58:41 UTC (rev 130)
@@ -22,22 +22,25 @@
import threading
import time
+from Queue import Empty,Full,Queue
+import heapq
+
+
class owfs_connector(Connector):
+
+
CONNECTOR_NAME = 'OWFS Connector'
CONNECTOR_VERSION = 0.2
CONNECTOR_LOGNAME = 'owfs_connector'
def __init__(self,parent, instanceName):
self._parent = parent
- if parent:
- self.WG = parent.WG
- else:
- self.WG = False
+ self.WG = parent.WG
self.instanceName = instanceName
self.mutex = threading.RLock()
defaultconfig = {
- 'cycletime' : 15,
+ 'cycletime' : 600,
'server' : '127.0.0.1',
'port' : 4304
}
@@ -61,7 +64,7 @@
self.supportedsensors[sensor] = {}
cycledefault = defaultconfig['cycletime']
if 'cycle' in sensorconfig[sensor]:
- cycledefault = sensorconfig[sensor]['cycle']
+ self.supportedsensors[sensor]['cycle'] = sensorconfig[sensor]['cycle']
del sensorconfig[sensor]['cycle']
if 'interfaces' in sensorconfig[sensor]:
self.supportedsensors[sensor]['interfaces'] = {}
@@ -70,6 +73,17 @@
## remove Interface key from dict
del sensorconfig[sensor]['interfaces']
+ if 'subtypes' in sensorconfig[sensor]:
+ subtypes = sensorconfig[sensor]['subtypes'].split(",")
+ self.supportedsensors[sensor]['subtypes'] = {}
+ for stype in subtypes:
+ id,subname = stype.split(":",1)
+ try:
+ self.supportedsensors[sensor]['subtypes'][int(id,16)] = subname
+ except:
+ pass
+ del sensorconfig[sensor]['subtypes']
+
for key in sensorconfig[sensor].keys():
if key.startswith("config_"):
try:
@@ -102,11 +116,11 @@
return config
def run(self):
- cnt = 10
+ busscantime = 0
while self.isrunning:
## every 10 runs search new sensors
- if cnt == 10:
- cnt = 0
+ if busscantime < time.time():
+ busscantime = time.time() + self.config['cycletime']
## find new sensors
#self.findsensors()
try:
@@ -122,27 +136,27 @@
## IDLE for cycletime seconds (default 15sec)
## Fixme: maybe optimize cycletime dynamic based on busload
- self.idle(self.config['cycletime'])
+ self.idle(.1)
+ for busname in self.busmaster.keys():
+ if self.busmaster[busname]['readthread'] <> None:
+ self.busmaster[busname]['readthread'].join()
- ## counter increment for sensorsearch
- cnt += 1
-
def findbusmaster(self,path=""):
## search for active busses
- nochilds = True
+ childs = False
uncachedpath = "/uncached%s" % path
for bus in self.owfs.dir(uncachedpath):
bus = bus[9:]
if self.isbus.search(bus):
- nochilds = False
+ childs = True
## get the bus ID
busname = self.isbus.search(bus)
if busname:
try:
- if self.findbusmaster(bus):
+ if not self.findbusmaster(bus):
## if this has no subbuses add it to the list
try:
self.mutex.acquire()
@@ -152,9 +166,11 @@
except KeyError:
## add to list
self.busmaster[bus] = {
- 'sensors' : {},
+ 'buscycle' : 600,
+ 'nextrun' : 0,
'lastseen' : time.time(),
- 'readthread' : None
+ 'readthread' : None,
+ 'readQueue' : ReadQueue(200)
}
finally:
self.mutex.release()
@@ -163,14 +179,12 @@
except:
## ignore all OWFS Errors
pass
- return nochilds
+ return childs
- def checkBusCycleTime(self,bus):
- pass
-
def findsensors(self,path=""):
uncachedpath = "/uncached%s" % path
+ mincycle = 600
for sensor in self.owfs.dir(uncachedpath):
## remove /uncached/bus.x from sensorname
sensor = sensor.split("/")[-1]
@@ -184,82 +198,142 @@
except:
## ignore all OWFS Errors
continue
+ if 'subtypes' in self.supportedsensors[sensortype]:
+ ##check subtypes
+ try:
+ info = ord(self.owfs.read("%s/pages/page.3" % sensor)[0])
+ sensortype += self.supportedsensors[sensortype]['subtypes'][info]
+ self.debug("Sensor Subtype %s is used" % sensortype)
+ except:
+ ## nothing found
+ pass
+
if sensortype not in self.supportedsensors:
self.debug("unsupported Type: %r" % sensortype)
continue
+
if 'interfaces' not in self.supportedsensors[sensortype]:
self.debug("Sensor Type: %r has no supported Interfaces" % sensortype)
continue
- ### add it to the list of active sensors
- ## FIXME: check for old sensor no longer active and remove
+ sensorlist = "sensors"
+ cycle = 600
+ if 'cycle' in self.supportedsensors[sensortype]:
+ cycle = self.supportedsensors[sensortype]['cycle']
+
try:
self.mutex.acquire()
- self.busmaster[path]['sensors'][sensor] = {
+ print "Sensortype: %s config: %r" % (sensortype,self.supportedsensors[sensortype]['interfaces'])
+
+ self.sensors[sensor] = {
'type':sensortype,
+ 'cycle':cycle,
+ 'nextrun':0,
'interfaces': self.supportedsensors[sensortype]['interfaces']
}
finally:
self.mutex.release()
+
+ self._addQueue(path,sensor)
+
+ def read(self):
+ for busname in self.busmaster.keys():
+ if not self.busmaster[busname]['readQueue'].empty():
+ if not self.busmaster[busname]['readthread']:
+ self.debug("Start read Thread for %s" % busname)
+ threadname = "OWFS-Reader_%s" % busname
+ try:
+ self.mutex.acquire()
+ self.busmaster[busname]['readthread'] = threading.Thread(target=self._readThread,args=[busname],name=threadname)
+ self.busmaster[busname]['readthread'].start()
+ finally:
+ self.mutex.release()
-
- def _read(self,busname):
- ## loop through all sensors in lokal busmaster list
- self.debug("Thread running for %s" % busname)
- readtime = time.time()
- for sensor in self.busmaster[busname]['sensors'].keys():
- #self.sensors[sensor]['power'] = self.owfs.read("/"+sensor+"/power")
+ def _read(self,busname,sensor):
+ for get in self.sensors[sensor]['interfaces'].keys():
+ ## make an id for the sensor (OW:28.043242a32_temperature
+ id = "%s:%s_%s" % (self.instanceName,sensor,get)
+ ## get the Datastore Object and look for config
+ obj = self.WG.DATASTORE.get(id)
- ## loop through their interfaces
- for get in self.busmaster[busname]['sensors'][sensor]['interfaces'].keys():
- resolution = ""
- id = "%s:%s_%s" % (self.instanceName,sensor,get)
+ sensortype = self.sensors[sensor]['type']
- ## get the Datastore Object and look for config
- obj = self.WG.DATASTORE.get(id)
- sensortype = self.busmaster[busname]['sensors'][sensor]['type']
- self.checkConfigDefaults(obj,self.supportedsensors[sensortype]['interfaces'][get])
- if "resolution" in obj.config:
- resolution = str(obj.config['resolution'])
-
- owfspath = "/uncached/%s/%s%s" % (sensor,get,resolution)
- self.debug("Reading from path %s" % owfspath)
- data = False
- try:
- ## read uncached and put into local-list
- data = self.owfs.read(owfspath)
- except:
- ## ignore all OWFS Errors
- #self.WG.errorlog("Reading from path %s failed" % owfspath)
- self.log("Reading from path %s failed" % owfspath)
+ ## recheck config
+ self.checkConfigDefaults(obj,self.supportedsensors[sensortype]['interfaces'][get])
+
+ owfspath = "/uncached/%s/%s%s" % (sensor,get,obj.config.get('resolution',''))
+ self.debug("Reading from path %s" % owfspath)
- try:
- self.mutex.acquire()
- self.busmaster[busname]['sensors'][sensor][get] = data
- finally:
- self.mutex.release()
- ## make an id for the sensor (OW:28.043242a32_temperature
- try:
- ## only if there is any Data update it in the DATASTORE
- if self.busmaster[busname]['sensors'][sensor][get]:
- self.WG.DATASTORE.update(id,self.busmaster[busname]['sensors'][sensor][get])
- except:
- self.WG.errorlog()
- self.busmaster[busname]['readthread'] = None
- self.debug("Thread for %s finshed reading %d sensors in %f secs " % (busname,len(self.busmaster[busname]['sensors']), time.time() - readtime))
-
- def read(self):
- for busname in self.busmaster.keys():
- if len(self.busmaster[busname]['sensors'])>0:
- if not self.busmaster[busname]['readthread']:
- self.debug("Start read Thread for %s" % busname)
- threadname = "OWFS-Reader_%s" % busname
- try:
- self.mutex.acquire()
- self.busmaster[busname]['readthread'] = threading.Thread(target=self._read,args=[busname],name=threadname)
- self.busmaster[busname]['readthread'].start()
- finally:
- self.mutex.release()
+ data = None
+ try:
+ ## read uncached and put into local-list
+ data = self.owfs.read(owfspath)
+ except:
+ ## ignore all OWFS Errors
+ #self.WG.errorlog("Reading from path %s failed" % owfspath)
+ self.log("Reading from path %s failed" % owfspath)
+ if data:
+ self.debug("%s: %r" % (id,data))
+ self.WG.DATASTORE.update(id,data)
+ self._addQueue(busname,sensor)
+ def _addQueue(self,busname,sensor):
+ cycletime = time.time() +self.sensors[sensor]['cycle']
+ self.debug("ADDED %s on %s with %s (%d)s" % (sensor,busname, time.asctime(time.localtime(cycletime)),self.sensors[sensor]['cycle']))
+ ## FIXME: not present iButtons should be added to all Busmaster Queues
+ #if self.sensors[sensor]['']
+ self.busmaster[busname]['readQueue'].put((cycletime,sensor))
+
+
+ def _readThread(self,busname):
+ try:
+ while self.isrunning:
+ while not self.busmaster[busname]['readQueue'].check():
+ if not self.isrunning:
+ break
+ time.sleep(.1)
+ rtime, sensor = self.busmaster[busname]['readQueue'].get()
+ self._read(busname,sensor)
+ finally:
+ if self.isrunning:
+ self.busmaster[busname]['readthread'] = None
+
+
+
+class ReadQueue(Queue):
+ def _init(self, maxsize):
+ self.maxsize = maxsize
+ self.queue = []
+
+ def _qsize(self):
+ return len(self.queue)
+
+ # Check whether the queue is empty
+ def _empty(self):
+ return not self.queue
+
+ # Check whether the queue is full
+ def _full(self):
+ return self.maxsize > 0 and len(self.queue) == self.maxsize
+
+ # Put a new item in the queue
+ def _put(self, item):
+ ## only new Sensors
+ if not filter(lambda x: x[1]==item[1],self.queue):
+ heapq.heappush(self.queue,item)
+
+ # Get an item from the queue
+ def _get(self):
+ return heapq.heappop(self.queue)
+
+ def check(self):
+ if len(self.queue) == 0:
+ return False
+ next = min(self.queue)
+ if len(next)==2:
+ next = next[0]
+ else:
+ next = 0
+ return (next <= time.time())
\ No newline at end of file
Modified: PyWireGate/trunk/owfs_connector/sensors.ini
===================================================================
--- PyWireGate/trunk/owfs_connector/sensors.ini 2010-11-15 19:56:47 UTC (rev 129)
+++ PyWireGate/trunk/owfs_connector/sensors.ini 2010-11-15 19:58:41 UTC (rev 130)
@@ -28,9 +28,17 @@
# Battery-monitor with Vxx and current, family 26
# /pages/page.3 conatins type: 0x19 or 0xF1 = TH, 0xF2 = THS
# FIXME: several more (not widely used) to be added
+subtypes = 0x19:TH,0xf1:TH,0xF2:THS
cycle = 60
interfaces = temperature,HIH4000/humidity,vis,VAD,VDD
+[DS2438TH]
+cycle = 60
+interfaces = temperature,HIH4000/humidity
+
+[DS2438THS]
+cycle = 60
+
[DS2406]
# dual switch / IO, family 12
# PIO.[A|B] if used as output
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ni...@us...> - 2010-11-15 19:56:58
|
Revision: 129
http://openautomation.svn.sourceforge.net/openautomation/?rev=129&view=rev
Author: nilss1
Date: 2010-11-15 19:56:47 +0000 (Mon, 15 Nov 2010)
Log Message:
-----------
readded owfs exceptions
Modified Paths:
--------------
PyWireGate/trunk/owfs_connector/connection.py
Modified: PyWireGate/trunk/owfs_connector/connection.py
===================================================================
--- PyWireGate/trunk/owfs_connector/connection.py 2010-11-15 07:26:16 UTC (rev 128)
+++ PyWireGate/trunk/owfs_connector/connection.py 2010-11-15 19:56:47 UTC (rev 129)
@@ -1,284 +1,256 @@
-# -*- coding: iso-8859-1 -*-
-"""
-::BOH
-$Id: connection.py,v 1.7 2009/04/13 01:17:09 alfille Exp $
-$HeadURL: http://subversion/stuff/svn/owfs/trunk/ow/__init__.py $
-
-Copyright (c) 2006 Peter Kropf. All rights reserved.
-
-This program is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2 of the License, or (at
-your option) any later version.
-
-This program is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with this program; if not, write to the Free Software
-Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
-::EOH
-
-OWFS is an open source project developed by Paul Alfille and hosted at
-http://www.owfs.org
-"""
-
-
-import sys
-import os
-import socket
-import struct
-import re
-
-
-__author__ = 'Peter Kropf'
-__email__ = 'pk...@gm...'
-__version__ = '$Id: connection.py,v 1.7 2009/04/13 01:17:09 alfille Exp $'.split()[2]
-
-
-class exError(Exception):
- """base exception for all one wire raised exceptions."""
-
-
-class exErrorValue(exError):
- """Base exception for all one wire raised exceptions with a value."""
- def __init__(self, value):
- self.value = value
-
- def __str__(self):
- return repr(self.value)
-
-
-class exInvalidMessage(exErrorValue):
- """Exception raised when trying to unpack a message that doesn't meet specs."""
-
-
-class exShortRead(exError):
- """Exception raised when too few bytes are received from the owserver."""
-
-
-class OWMsg:
- """
- Constants for the owserver api message types.
- """
- error = 0
- nop = 1
- read = 2
- write = 3
- dir = 4
- size = 5
- presence = 6
-
-
-class Connection(object):
- """
- A Connection provides access to a owserver without the standard
- core ow libraries. Instead, it impliments the wire protocol for
- communicating with the owserver. This allows Python programs to
- interact with the ow sensors on any platform supported by Python.
- """
-
- def __init__(self, server="127.0.0.1", port=4304):
- """
- Create a new connection object.
- """
- #print 'Connection.__init__(%s, %i)' % (server, port)
-
- self._server = server
- self._port = port
- self.checknum = re.compile(r"(^\d+$)|(^\d+\x2e\d+$)", re.MULTILINE)
-
-
- def __str__(self):
- """
- Print a string representation of the Connection in the form of:
-
- server:port
- """
-
- #print 'Connection.__str__'
- return "%s:%i" % (self._server, self._port)
-
-
- def __repr__(self):
- """
- Print a representation of the Connection in the form of:
-
- Connection(server, port)
-
- Example:
-
- >>> Connection('xyzzy', 9876)
- Connection(server="xyzzy", port=9876)
- """
-
- #print 'Connection.__repr__'
- return 'Connection("%s", %i)' % (self._server, self._port)
-
-
- def read(self, path):
- """
- """
-
- #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')
-
- while 1:
- try:
- data = s.recv(24)
- except:
- ##
- return rtn
-
- payload_len = -1
- if len(data) is 24:
- ret, payload_len, data_len = self.unpack(data)
-
- if payload_len >= 0:
- data = s.recv(payload_len)
- return self.toNumber(data[:data_len])
- else:
- # ping response
- return None
-
- finally:
- s.close()
-
-
-
- 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
-
- 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
-
- if len(data) is 24:
- ret, payload_len, data_len = self.unpack(data)
- return ret
-
-
- finally:
- s.close()
-
-
-
- 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
-
- 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
-
- if len(data) is not 24:
- return fields
-
- 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
-
- finally:
- s.close()
-
-
- def pack(self, function, payload_len, data_len):
- """
- """
-
- #print 'Connection.pack(%i, %i, %i)' % (function, payload_len, data_len)
- return struct.pack('IIIIII',
- socket.htonl(0), #version
- socket.htonl(payload_len), #payload length
- socket.htonl(function), #type of function call
- socket.htonl(258), #format flags -- 266 for alias upport
- socket.htonl(data_len), #size of data element for read or write
- socket.htonl(0), #offset for read or write
- )
-
-
- def unpack(self, msg):
- """
- """
-
- #print 'Connection.unpack("%s")' % msg
- if len(msg) is not 24:
- raise exInvalidMessage, msg
-
- val = struct.unpack('IIIIII', msg)
-
- version = socket.ntohl(val[0])
- payload_len = socket.ntohl(val[1])
- ret_value = socket.ntohl(val[2])
- format_flags = socket.ntohl(val[3])
- data_len = socket.ntohl(val[4])
- offset = socket.ntohl(val[5])
-
- return ret_value, payload_len, data_len
-
-
- 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])
-
- return owstr
+# -*- coding: iso-8859-1 -*-
+"""
+::BOH
+$Id: connection.py,v 1.7 2009/04/13 01:17:09 alfille Exp $
+$HeadURL: http://subversion/stuff/svn/owfs/trunk/ow/__init__.py $
+
+Copyright (c) 2006 Peter Kropf. All rights reserved.
+
+This program is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2 of the License, or (at
+your option) any later version.
+
+This program is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program; if not, write to the Free Software
+Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+::EOH
+
+OWFS is an open source project developed by Paul Alfille and hosted at
+http://www.owfs.org
+"""
+
+
+import sys
+import os
+import socket
+import struct
+import re
+
+
+__author__ = 'Peter Kropf'
+__email__ = 'pk...@gm...'
+__version__ = '$Id: connection.py,v 1.7 2009/04/13 01:17:09 alfille Exp $'.split()[2]
+
+
+class exError(Exception):
+ """base exception for all one wire raised exceptions."""
+
+
+class exErrorValue(exError):
+ """Base exception for all one wire raised exceptions with a value."""
+ def __init__(self, value):
+ self.value = value
+
+ def __str__(self):
+ return repr(self.value)
+
+
+class exInvalidMessage(exErrorValue):
+ """Exception raised when trying to unpack a message that doesn't meet specs."""
+
+
+class exShortRead(exError):
+ """Exception raised when too few bytes are received from the owserver."""
+
+
+class OWMsg:
+ """
+ Constants for the owserver api message types.
+ """
+ error = 0
+ nop = 1
+ read = 2
+ write = 3
+ dir = 4
+ size = 5
+ presence = 6
+
+
+class Connection(object):
+ """
+ A Connection provides access to a owserver without the standard
+ core ow libraries. Instead, it impliments the wire protocol for
+ communicating with the owserver. This allows Python programs to
+ interact with the ow sensors on any platform supported by Python.
+ """
+
+ def __init__(self, server="127.0.0.1", port=4304):
+ """
+ Create a new connection object.
+ """
+ #print 'Connection.__init__(%s, %i)' % (server, port)
+
+ self._server = server
+ self._port = port
+ self.checknum = re.compile(r"(^\d+$)|(^\d+\x2e\d+$)", re.MULTILINE)
+
+
+ def __str__(self):
+ """
+ Print a string representation of the Connection in the form of:
+
+ server:port
+ """
+
+ #print 'Connection.__str__'
+ return "%s:%i" % (self._server, self._port)
+
+
+ def __repr__(self):
+ """
+ Print a representation of the Connection in the form of:
+
+ Connection(server, port)
+
+ Example:
+
+ >>> Connection('xyzzy', 9876)
+ Connection(server="xyzzy", port=9876)
+ """
+
+ #print 'Connection.__repr__'
+ return 'Connection("%s", %i)' % (self._server, self._port)
+
+
+ def read(self, path):
+ """
+ """
+
+ #print 'Connection.read("%s", %i, "%s")' % (path)
+ s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
+ s.connect((self._server, self._port))
+
+ smsg = self.pack(OWMsg.read, len(path) + 1, 8192)
+ s.sendall(smsg)
+ s.sendall(path + '\x00')
+
+ while 1:
+ data = s.recv(24)
+
+ if len(data) is not 24:
+ raise exShortRead
+
+ ret, payload_len, data_len = self.unpack(data)
+
+ if payload_len >= 0:
+ data = s.recv(payload_len)
+ rtn = self.toNumber(data[:data_len])
+ break
+ else:
+ # ping response
+ rtn = None
+ break
+
+ s.close()
+ return rtn
+
+
+ def write(self, path, value):
+ """
+ """
+
+ #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')
+
+ data = s.recv(24)
+
+ if len(data) is not 24:
+ raise exShortRead
+
+ ret, payload_len, data_len = self.unpack(data)
+
+ s.close()
+ return ret
+
+
+ def dir(self, path):
+ """
+ """
+
+ #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')
+
+ fields = []
+ while 1:
+ data = s.recv(24)
+
+ if len(data) is not 24:
+ raise exShortRead
+
+ ret, payload_len, data_len = self.unpack(data)
+
+ if payload_len > 0:
+ data = s.recv(payload_len)
+ fields.append(data[:data_len])
+ else:
+ # end of dir list or 'ping' response
+ break
+
+ s.close()
+ return fields
+
+
+ def pack(self, function, payload_len, data_len):
+ """
+ """
+
+ #print 'Connection.pack(%i, %i, %i)' % (function, payload_len, data_len)
+ return struct.pack('IIIIII',
+ socket.htonl(0), #version
+ socket.htonl(payload_len), #payload length
+ socket.htonl(function), #type of function call
+ socket.htonl(258), #format flags -- 266 for alias upport
+ socket.htonl(data_len), #size of data element for read or write
+ socket.htonl(0), #offset for read or write
+ )
+
+
+ def unpack(self, msg):
+ """
+ """
+
+ #print 'Connection.unpack("%s")' % msg
+ if len(msg) is not 24:
+ raise exInvalidMessage, msg
+
+ val = struct.unpack('IIIIII', msg)
+
+ version = socket.ntohl(val[0])
+ payload_len = socket.ntohl(val[1])
+ ret_value = socket.ntohl(val[2])
+ format_flags = socket.ntohl(val[3])
+ data_len = socket.ntohl(val[4])
+ offset = socket.ntohl(val[5])
+
+ return ret_value, payload_len, data_len
+
+
+ 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])
+
+ return owstr
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ni...@us...> - 2010-11-15 07:26:27
|
Revision: 128
http://openautomation.svn.sourceforge.net/openautomation/?rev=128&view=rev
Author: nilss1
Date: 2010-11-15 07:26:16 +0000 (Mon, 15 Nov 2010)
Log Message:
-----------
use N: instead of lastupdate time to avoid illegal attempt to update error
Modified Paths:
--------------
PyWireGate/trunk/rrd_connector/RRD_Connector.py
Modified: PyWireGate/trunk/rrd_connector/RRD_Connector.py
===================================================================
--- PyWireGate/trunk/rrd_connector/RRD_Connector.py 2010-11-14 23:39:30 UTC (rev 127)
+++ PyWireGate/trunk/rrd_connector/RRD_Connector.py 2010-11-15 07:26:16 UTC (rev 128)
@@ -57,12 +57,12 @@
rrdfilename = self.config['path'] +"/"+ self.makeASCII.sub("_",(str(dsobj.id)))+".rrd"
if not os.path.exists(rrdfilename):
self.create(dsobj,rrdfilename)
- val, utime = dsobj.getValue('lastupdate')
+ val = dsobj.getValue()
if val == None or type(val) not in (int,float):
val = "U"
else:
val = "%.2f" % val
- val = "%d:%s" % (utime,val)
+ val = "N:%s" % val
self.debug("set RRD %s VAL: %r" % (rrdfilename,val))
rrdtool.update(rrdfilename,val)
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ni...@us...> - 2010-11-14 23:39:41
|
Revision: 127
http://openautomation.svn.sourceforge.net/openautomation/?rev=127&view=rev
Author: nilss1
Date: 2010-11-14 23:39:30 +0000 (Sun, 14 Nov 2010)
Log Message:
-----------
rrdfilename in datastoreobject config added
Modified Paths:
--------------
PyWireGate/trunk/rrd_connector/RRD_Connector.py
Modified: PyWireGate/trunk/rrd_connector/RRD_Connector.py
===================================================================
--- PyWireGate/trunk/rrd_connector/RRD_Connector.py 2010-11-14 23:22:12 UTC (rev 126)
+++ PyWireGate/trunk/rrd_connector/RRD_Connector.py 2010-11-14 23:39:30 UTC (rev 127)
@@ -70,9 +70,10 @@
def create(self,dsobj,rrdfilename):
rrdarchiv = {}
- rrdconfig = {}
- if 'rrd' in dsobj.config:
- rrdconfig = dsobj.config['rrd']
+ if 'rrd' not in dsobj.config:
+ dsobj.config['rrd'] = {}
+ rrdconfig = dsobj.config['rrd']
+ rrdconfig['rrdfilename'] = rrdfilename
for cfg in ['RRA','ARCHIV','VALTYPE','HEARTBEAT','MIN','MAX']:
if cfg in rrdconfig:
rrdarchiv[cfg] = rrdconfig[cfg]
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ni...@us...> - 2010-11-14 23:22:20
|
Revision: 126
http://openautomation.svn.sourceforge.net/openautomation/?rev=126&view=rev
Author: nilss1
Date: 2010-11-14 23:22:12 +0000 (Sun, 14 Nov 2010)
Log Message:
-----------
changed to single datasource per rrd
Modified Paths:
--------------
PyWireGate/trunk/rrd_connector/RRD_Connector.py
Modified: PyWireGate/trunk/rrd_connector/RRD_Connector.py
===================================================================
--- PyWireGate/trunk/rrd_connector/RRD_Connector.py 2010-11-14 17:28:46 UTC (rev 125)
+++ PyWireGate/trunk/rrd_connector/RRD_Connector.py 2010-11-14 23:22:12 UTC (rev 126)
@@ -17,16 +17,16 @@
self._parent = parent
self.WG = parent.WG
self.instanceName = instanceName
+ self.makeASCII = re.compile(r"[^a-zA-Z0-9_.]+")
## Defaultconfig
defaultconfig = {
'path':self.WG.scriptpath +"/rrd",
'defaultstep':300,
- 'defaultDS':'value',
'defaultRRA':'RRA:%s:0.5:1:2160,RRA:%s:0.5:5:2016,RRA:%s:0.5:15:2880,RRA:%s:0.5:180:8760',
'defaultARCHIV':'AVERAGE,MIN,MAX',
'defaultVALTYPE':'GAUGE',
- 'defaultHEARTBEAT':900,
+ 'defaultHEARTBEAT':600,
'defaultMIN':'-55',
'defaultMAX':'255000'
@@ -41,46 +41,53 @@
def setValue(self,dsobj,msg=False):
- rrdfilename = self.config['path'] +"/"+ re.sub(r"[^\w]","_",(str(dsobj.id)))+".rrd"
- if not os.path.exists(rrdfilename):
- self.create(dsobj,rrdfilename)
- val = "N"
if len(dsobj.connected) == 0:
- val += ":%.2f" % dsobj.getValue()
+ if dsobj.lastsource:
+ self._setValue(dsobj.lastsource.id)
for objid in dsobj.connected:
- obj = self.WG.DATASTORE.dataobjects[objid]
- oval = obj.getValue()
- if oval == None or type(oval) not in (int,float):
- oval = "U"
- else:
- oval = "%.2f" % oval
- val += ":%s" % oval
-
- print "RRD %s VAL: %r" % (rrdfilename,val)
+ self._setValue(objid)
+
+ def _setValue(self,objid):
+ try:
+ dsobj = self.WG.DATASTORE.dataobjects[objid]
+ except KeyError:
+ ## if not found ignore
+ return
+ rrdfilename = self.config['path'] +"/"+ self.makeASCII.sub("_",(str(dsobj.id)))+".rrd"
+ if not os.path.exists(rrdfilename):
+ self.create(dsobj,rrdfilename)
+ val, utime = dsobj.getValue('lastupdate')
+ if val == None or type(val) not in (int,float):
+ val = "U"
+ else:
+ val = "%.2f" % val
+ val = "%d:%s" % (utime,val)
+ self.debug("set RRD %s VAL: %r" % (rrdfilename,val))
rrdtool.update(rrdfilename,val)
+
+
def create(self,dsobj,rrdfilename):
rrdarchiv = {}
+ rrdconfig = {}
if 'rrd' in dsobj.config:
- for cfg in ['DS','RRA','ARCHIV','VALTYPE','HEARTBEAT','MIN','MAX']:
- if cfg in dsobj.config['rrd']:
- rrdarchiv[cfg] = dsobj.config['rrd'][cfg]
- else:
- rrdarchiv[cfg] = self.config['default%s' % cfg] # FIXME: das mag nicht
+ rrdconfig = dsobj.config['rrd']
+ for cfg in ['RRA','ARCHIV','VALTYPE','HEARTBEAT','MIN','MAX']:
+ if cfg in rrdconfig:
+ rrdarchiv[cfg] = rrdconfig[cfg]
+ else:
+ rrdarchiv[cfg] = self.config['default%s' % cfg]
- #FIXME: needed if single DS per rrd?
args = []
datasources = [] + dsobj.connected
if len(datasources) == 0:
datasources.append(dsobj.id)
-# for _d in datasources:
-# id = hashlib.md5(_d).hexdigest()[:19]
- args.append(str("DS:%s:%s:%d:%s:%s" % (rrdarchiv.get('DS',self.config['defaultDS']),rrdarchiv.get('VALTYPE',self.config['defaultVALTYPE']),rrdarchiv.get('HEARTBEAT',self.config['defaultHEARTBEAT']),str(rrdarchiv.get('MIN',self.config['defaultMIN'])),str(rrdarchiv.get('MAX',self.config['defaultMAX'])))))
- for _a in rrdarchiv.get('ARCHIV',self.config['defaultARCHIV']).split(","):
- for _r in rrdarchiv.get('RRA',self.config['defaultRRA']).split(","):
+ args.append(str("DS:value:%s:%d:%s:%s" % (rrdarchiv['VALTYPE'],rrdarchiv['HEARTBEAT'],str(rrdarchiv['MIN']),str(rrdarchiv['MAX']))))
+ for _a in rrdarchiv['ARCHIV'].split(","):
+ for _r in rrdarchiv['RRA'].split(","):
args.append(str(_r % _a))
startdate = int(time.time()) - 5 * 86400
@@ -90,7 +97,6 @@
except:
__import__('traceback').print_exc(file=__import__('sys').stdout)
print "FAILED WITH %r" % args
-
if ret:
self.debug(rrdtool.error())
@@ -98,3 +104,4 @@
while self.isrunning:
self.idle(1)
+
\ 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-14 17:28:58
|
Revision: 125
http://openautomation.svn.sourceforge.net/openautomation/?rev=125&view=rev
Author: makki1
Date: 2010-11-14 17:28:46 +0000 (Sun, 14 Nov 2010)
Log Message:
-----------
RRD creation
Modified Paths:
--------------
PyWireGate/trunk/rrd_connector/RRD_Connector.py
Modified: PyWireGate/trunk/rrd_connector/RRD_Connector.py
===================================================================
--- PyWireGate/trunk/rrd_connector/RRD_Connector.py 2010-11-14 16:41:45 UTC (rev 124)
+++ PyWireGate/trunk/rrd_connector/RRD_Connector.py 2010-11-14 17:28:46 UTC (rev 125)
@@ -18,14 +18,15 @@
self.WG = parent.WG
self.instanceName = instanceName
- ## Deafaultconfig
+ ## Defaultconfig
defaultconfig = {
'path':self.WG.scriptpath +"/rrd",
'defaultstep':300,
+ 'defaultDS':'value',
'defaultRRA':'RRA:%s:0.5:1:2160,RRA:%s:0.5:5:2016,RRA:%s:0.5:15:2880,RRA:%s:0.5:180:8760',
'defaultARCHIV':'AVERAGE,MIN,MAX',
'defaultVALTYPE':'GAUGE',
- 'defaultHEARTBEAT':600,
+ 'defaultHEARTBEAT':900,
'defaultMIN':'-55',
'defaultMAX':'255000'
@@ -62,23 +63,24 @@
def create(self,dsobj,rrdfilename):
rrdarchiv = {}
if 'rrd' in dsobj.config:
- for cfg in ['RRA','ARCHIV','VALTYPE','HEARTBEAT','MIN','MAX']:
+ for cfg in ['DS','RRA','ARCHIV','VALTYPE','HEARTBEAT','MIN','MAX']:
if cfg in dsobj.config['rrd']:
rrdarchiv[cfg] = dsobj.config['rrd'][cfg]
else:
- rrdarchiv[cfg] = self.config['default%s' % cfg]
+ rrdarchiv[cfg] = self.config['default%s' % cfg] # FIXME: das mag nicht
+ #FIXME: needed if single DS per rrd?
args = []
datasources = [] + dsobj.connected
if len(datasources) == 0:
datasources.append(dsobj.id)
- for _d in datasources:
- id = hashlib.md5(_d).hexdigest()[:19]
- args.append(str("DS:%s:%s:%d:%s:%s" % (id,rrdarchiv['VALTYPE'],rrdarchiv['HEARTBEAT'],str(rrdarchiv['MIN']),str(rrdarchiv['MAX']))))
- for _a in rrdarchiv['ARCHIV'].split(","):
- for _r in rrdarchiv['RRA'].split(","):
+# for _d in datasources:
+# id = hashlib.md5(_d).hexdigest()[:19]
+ args.append(str("DS:%s:%s:%d:%s:%s" % (rrdarchiv.get('DS',self.config['defaultDS']),rrdarchiv.get('VALTYPE',self.config['defaultVALTYPE']),rrdarchiv.get('HEARTBEAT',self.config['defaultHEARTBEAT']),str(rrdarchiv.get('MIN',self.config['defaultMIN'])),str(rrdarchiv.get('MAX',self.config['defaultMAX'])))))
+ for _a in rrdarchiv.get('ARCHIV',self.config['defaultARCHIV']).split(","):
+ for _r in rrdarchiv.get('RRA',self.config['defaultRRA']).split(","):
args.append(str(_r % _a))
startdate = int(time.time()) - 5 * 86400
@@ -95,4 +97,4 @@
def run(self):
while self.isrunning:
self.idle(1)
-
\ 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-14 17:08:31
|
Revision: 123
http://openautomation.svn.sourceforge.net/openautomation/?rev=123&view=rev
Author: mayerch
Date: 2010-11-14 16:16:00 +0000 (Sun, 14 Nov 2010)
Log Message:
-----------
Added cross links to the footer, i.e. the normal mode links to the edit and vice versa
Modified Paths:
--------------
CometVisu/trunk/visu/edit_config.html
CometVisu/trunk/visu/index.html
Modified: CometVisu/trunk/visu/edit_config.html
===================================================================
--- CometVisu/trunk/visu/edit_config.html 2010-11-14 16:10:20 UTC (rev 122)
+++ CometVisu/trunk/visu/edit_config.html 2010-11-14 16:16:00 UTC (rev 123)
@@ -32,6 +32,7 @@
<div class="footer">
<img src="icon/comet_64_ff8000.png" alt="CometVisu" />
by <a href="http://www.cometvisu.org/">ComeVisu.org</a> - <a href="edit_config.html">Reload</a>
+ - <a href=".">normal Mode</a>
</div>
</div>
Modified: CometVisu/trunk/visu/index.html
===================================================================
--- CometVisu/trunk/visu/index.html 2010-11-14 16:10:20 UTC (rev 122)
+++ CometVisu/trunk/visu/index.html 2010-11-14 16:16:00 UTC (rev 123)
@@ -27,6 +27,7 @@
<div class="footer">
<img src="icon/comet_64_000000.png" alt="CometVisu" />
by <a href="http://www.cometvisu.org/">CometVisu.org</a> - <a href=".">Reload</a>
+ - <a href="edit_config.html">Edit</a>
</div>
</div>
</body>
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ma...@us...> - 2010-11-14 17:08:20
|
Revision: 122
http://openautomation.svn.sourceforge.net/openautomation/?rev=122&view=rev
Author: mayerch
Date: 2010-11-14 16:10:20 +0000 (Sun, 14 Nov 2010)
Log Message:
-----------
Add new custom widget to toggle beween designs and insert it into the demo config
Modified Paths:
--------------
CometVisu/trunk/visu/lib/visudesign_custom.js
CometVisu/trunk/visu/visu_config.xml
Modified: CometVisu/trunk/visu/lib/visudesign_custom.js
===================================================================
--- CometVisu/trunk/visu/lib/visudesign_custom.js 2010-11-14 12:55:07 UTC (rev 121)
+++ CometVisu/trunk/visu/lib/visudesign_custom.js 2010-11-14 16:10:20 UTC (rev 122)
@@ -34,3 +34,41 @@
});
****************************************
*/
+
+/**
+ * This is a custom function that extends the available widgets.
+ * It's purpose is to change the design of the visu during runtime
+ * to demonstrate all available
+ */
+VisuDesign_Custom.prototype.addCreator("designtoggle", {
+ create: function( page, path ) {
+ var ret_val = $('<div class="widget" />');
+ ret_val.addClass( 'switch' );
+ var label = '<div class="label">' + page.textContent + '</div>';
+ var actor = '<div class="actor switchUnpressed">';
+ var value = $('link').attr('href').split('/')[1];
+ actor += '<div class="value">' + value + '</div>';
+ actor += '</div>';
+ ret_val.append( label ).append( $(actor).data( {
+ 'mapping' : $(page).attr('mapping'),
+ 'style' : $(page).attr('style'),
+ 'value' : value,
+ 'type' : 'toggle'
+ } ).bind('click',designToggleAction) );
+ return ret_val;
+ },
+ attributes: {
+ },
+ content: "string"
+});
+
+function designToggleAction()
+{
+ var designs = [ 'pure', 'discreet' ];
+ var oldDesign = $('.value',this).text();
+ var newDesign = designs[ (designs.indexOf(oldDesign) + 1) % designs.length ];
+ $('.value',this).text(newDesign);
+ $('link').each(function(){
+ this.href = this.href.replace( oldDesign, newDesign );
+ });
+}
Modified: CometVisu/trunk/visu/visu_config.xml
===================================================================
--- CometVisu/trunk/visu/visu_config.xml 2010-11-14 12:55:07 UTC (rev 121)
+++ CometVisu/trunk/visu/visu_config.xml 2010-11-14 16:10:20 UTC (rev 122)
@@ -44,6 +44,7 @@
<slide address="12/4/250" datatype="9" min="-18" max="26">Slide</slide>
<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>
+ <designtoggle>Change design</designtoggle>
<line />
<image src="icon/comet_128_ff8000.png" >Ein Bild</image>
<image src="icon/comet_128_ff8000.png" />
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ma...@us...> - 2010-11-14 17:08:14
|
Revision: 124
http://openautomation.svn.sourceforge.net/openautomation/?rev=124&view=rev
Author: mayerch
Date: 2010-11-14 16:41:45 +0000 (Sun, 14 Nov 2010)
Log Message:
-----------
Fixed design change to work under edit mode as well
Modified Paths:
--------------
CometVisu/trunk/visu/edit_config.html
CometVisu/trunk/visu/lib/visudesign_custom.js
Modified: CometVisu/trunk/visu/edit_config.html
===================================================================
--- CometVisu/trunk/visu/edit_config.html 2010-11-14 16:16:00 UTC (rev 123)
+++ CometVisu/trunk/visu/edit_config.html 2010-11-14 16:41:45 UTC (rev 124)
@@ -5,7 +5,7 @@
<head>
<title>Visu - Editor-Modus</title>
<meta name="viewport" content="width=device-width, initial-scale=1" />
- <link rel="stylesheet" type="text/css" href="style_discreet.css" />
+<!-- <link rel="stylesheet" type="text/css" href="style_discreet.css" /> -->
<link rel="stylesheet" type="text/css" href="edit/style_edit.css" />
<script src="lib/jquery.js" type="text/javascript"></script>
<script src="lib/jquery-ui.js" type="text/javascript"></script>
Modified: CometVisu/trunk/visu/lib/visudesign_custom.js
===================================================================
--- CometVisu/trunk/visu/lib/visudesign_custom.js 2010-11-14 16:16:00 UTC (rev 123)
+++ CometVisu/trunk/visu/lib/visudesign_custom.js 2010-11-14 16:41:45 UTC (rev 124)
@@ -46,7 +46,7 @@
ret_val.addClass( 'switch' );
var label = '<div class="label">' + page.textContent + '</div>';
var actor = '<div class="actor switchUnpressed">';
- var value = $('link').attr('href').split('/')[1];
+ var value = $('link[href*="designs"]').attr('href').split('/')[1];
actor += '<div class="value">' + value + '</div>';
actor += '</div>';
ret_val.append( label ).append( $(actor).data( {
@@ -68,7 +68,7 @@
var oldDesign = $('.value',this).text();
var newDesign = designs[ (designs.indexOf(oldDesign) + 1) % designs.length ];
$('.value',this).text(newDesign);
- $('link').each(function(){
+ $('link[href*="designs"]').each(function(){
this.href = this.href.replace( oldDesign, newDesign );
});
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ni...@us...> - 2010-11-14 12:55:18
|
Revision: 121
http://openautomation.svn.sourceforge.net/openautomation/?rev=121&view=rev
Author: nilss1
Date: 2010-11-14 12:55:07 +0000 (Sun, 14 Nov 2010)
Log Message:
-----------
Fix KeyError when sending to unknown datastoreObject
Modified Paths:
--------------
PyWireGate/trunk/datastore.py
Modified: PyWireGate/trunk/datastore.py
===================================================================
--- PyWireGate/trunk/datastore.py 2010-11-14 09:55:23 UTC (rev 120)
+++ PyWireGate/trunk/datastore.py 2010-11-14 12:55:07 UTC (rev 121)
@@ -290,7 +290,7 @@
self.read_mutex.release()
for attached in self.connected:
try:
- self.WG.DATASTORE.dataobjects[attached].setValue(val,True,source=self)
+ self.WG.DATASTORE.get(attached).setValue(val,True,source=self)
except:
self.WG.log("sendconnected failed for %s" % attached,'error')
__import__('traceback').print_exc(file=__import__('sys').stdout)
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ni...@us...> - 2010-11-14 09:55:33
|
Revision: 120
http://openautomation.svn.sourceforge.net/openautomation/?rev=120&view=rev
Author: nilss1
Date: 2010-11-14 09:55:23 +0000 (Sun, 14 Nov 2010)
Log Message:
-----------
Add rrd-connector
Modified Paths:
--------------
PyWireGate/trunk/rrd_connector/RRD_Connector.py
Modified: PyWireGate/trunk/rrd_connector/RRD_Connector.py
===================================================================
--- PyWireGate/trunk/rrd_connector/RRD_Connector.py 2010-11-14 09:54:53 UTC (rev 119)
+++ PyWireGate/trunk/rrd_connector/RRD_Connector.py 2010-11-14 09:55:23 UTC (rev 120)
@@ -1,3 +1,7 @@
+import time
+import hashlib
+import re
+import os
try:
import rrdtool
except ImportError:
@@ -9,4 +13,86 @@
CONNECTOR_NAME = 'RRD Connector'
CONNECTOR_VERSION = 0.1
CONNECTOR_LOGNAME = __name__
- pass
+ def __init__(self,parent,instanceName):
+ self._parent = parent
+ self.WG = parent.WG
+ self.instanceName = instanceName
+
+ ## Deafaultconfig
+ defaultconfig = {
+ 'path':self.WG.scriptpath +"/rrd",
+ 'defaultstep':300,
+ 'defaultRRA':'RRA:%s:0.5:1:2160,RRA:%s:0.5:5:2016,RRA:%s:0.5:15:2880,RRA:%s:0.5:180:8760',
+ 'defaultARCHIV':'AVERAGE,MIN,MAX',
+ 'defaultVALTYPE':'GAUGE',
+ 'defaultHEARTBEAT':600,
+ 'defaultMIN':'-55',
+ 'defaultMAX':'255000'
+
+ }
+
+ ## check Defaultconfig Options in main configfile
+ self.WG.checkconfig(self.instanceName,defaultconfig)
+
+ ## set local config
+ self.config = self.WG.config[self.instanceName]
+ self.start()
+
+
+ def setValue(self,dsobj,msg=False):
+ rrdfilename = self.config['path'] +"/"+ re.sub(r"[^\w]","_",(str(dsobj.id)))+".rrd"
+ if not os.path.exists(rrdfilename):
+ self.create(dsobj,rrdfilename)
+ val = "N"
+ if len(dsobj.connected) == 0:
+ val += ":%.2f" % dsobj.getValue()
+
+ for objid in dsobj.connected:
+ obj = self.WG.DATASTORE.dataobjects[objid]
+ oval = obj.getValue()
+ if oval == None or type(oval) not in (int,float):
+ oval = "U"
+ else:
+ oval = "%.2f" % oval
+ val += ":%s" % oval
+
+ print "RRD %s VAL: %r" % (rrdfilename,val)
+ rrdtool.update(rrdfilename,val)
+
+ def create(self,dsobj,rrdfilename):
+ rrdarchiv = {}
+ if 'rrd' in dsobj.config:
+ for cfg in ['RRA','ARCHIV','VALTYPE','HEARTBEAT','MIN','MAX']:
+ if cfg in dsobj.config['rrd']:
+ rrdarchiv[cfg] = dsobj.config['rrd'][cfg]
+ else:
+ rrdarchiv[cfg] = self.config['default%s' % cfg]
+
+ args = []
+ datasources = [] + dsobj.connected
+ if len(datasources) == 0:
+ datasources.append(dsobj.id)
+
+
+ for _d in datasources:
+ id = hashlib.md5(_d).hexdigest()[:19]
+ args.append(str("DS:%s:%s:%d:%s:%s" % (id,rrdarchiv['VALTYPE'],rrdarchiv['HEARTBEAT'],str(rrdarchiv['MIN']),str(rrdarchiv['MAX']))))
+ for _a in rrdarchiv['ARCHIV'].split(","):
+ for _r in rrdarchiv['RRA'].split(","):
+ args.append(str(_r % _a))
+
+ startdate = int(time.time()) - 5 * 86400
+ ret = 0
+ try:
+ ret = rrdtool.create(rrdfilename,'--start',str(startdate), *tuple(args))
+ except:
+ __import__('traceback').print_exc(file=__import__('sys').stdout)
+ print "FAILED WITH %r" % args
+
+
+ if ret:
+ self.debug(rrdtool.error())
+ def run(self):
+ while self.isrunning:
+ self.idle(1)
+
\ 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-14 09:55:04
|
Revision: 119
http://openautomation.svn.sourceforge.net/openautomation/?rev=119&view=rev
Author: nilss1
Date: 2010-11-14 09:54:53 +0000 (Sun, 14 Nov 2010)
Log Message:
-----------
add defaultencoding option
Modified Paths:
--------------
PyWireGate/trunk/WireGate.py
Modified: PyWireGate/trunk/WireGate.py
===================================================================
--- PyWireGate/trunk/WireGate.py 2010-11-14 09:53:57 UTC (rev 118)
+++ PyWireGate/trunk/WireGate.py 2010-11-14 09:54:53 UTC (rev 119)
@@ -62,7 +62,8 @@
'datastore' : "%s/datastore.db" % self.scriptpath,
'logfile' : "%s/wiregated.log" % self.scriptpath,
'errorlog' : "%s/wiregated-error.log" % self.scriptpath,
- 'loglevel': 'info'
+ 'loglevel': 'info',
+ 'defaultencoding': 'UTF-8'
}
self.checkconfig("WireGate",defaultconfig)
@@ -117,7 +118,6 @@
def run(self):
- import time
for configpart in self.config.keys():
if "connector" in self.config[configpart]:
name = configpart
@@ -249,7 +249,7 @@
logger.setLevel(level)
if filename:
## python handle logrotating
- handler = log.logging.handlers.TimedRotatingFileHandler(filename,'MIDNIGHT',encoding='utf-8',backupCount=7)
+ handler = log.logging.handlers.TimedRotatingFileHandler(filename,'MIDNIGHT',encoding=self.WG.config['WireGate']['defaultencoding'],backupCount=7)
## Handler if logrotate handles Logfiles
#handler = logging.handlers.WatchedFileHandle(filename)
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ni...@us...> - 2010-11-14 09:54:08
|
Revision: 118
http://openautomation.svn.sourceforge.net/openautomation/?rev=118&view=rev
Author: nilss1
Date: 2010-11-14 09:53:57 +0000 (Sun, 14 Nov 2010)
Log Message:
-----------
change from repr to str for getting dsobject name
Modified Paths:
--------------
PyWireGate/trunk/scheduler.py
Modified: PyWireGate/trunk/scheduler.py
===================================================================
--- PyWireGate/trunk/scheduler.py 2010-11-14 09:52:13 UTC (rev 117)
+++ PyWireGate/trunk/scheduler.py 2010-11-14 09:53:57 UTC (rev 118)
@@ -44,10 +44,12 @@
obj = self.WG.DATASTORE.dataobjects[shed]
if 'cron' in obj.config:
kwargs = {}
+
+ ## change config from unicode to str
for uoption in obj.config['cron'].keys():
kwargs[str(uoption)] = str(obj.config['cron'][uoption])
- self.debug("Adding %s - %r" % (shed,obj))
+ self.debug("Adding %s - %s" % (shed,obj))
setattr(obj.sendConnected.im_func,'__name__',"%s" % shed.encode('UTF-8'))
self.SCHEDULER.add_cron_job(self.WG.DATASTORE.dataobjects[shed].sendConnected,**kwargs)
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ni...@us...> - 2010-11-14 09:52:26
|
Revision: 117
http://openautomation.svn.sourceforge.net/openautomation/?rev=117&view=rev
Author: nilss1
Date: 2010-11-14 09:52:13 +0000 (Sun, 14 Nov 2010)
Log Message:
-----------
Add some hooks for connectors
Modified Paths:
--------------
PyWireGate/trunk/datastore.py
Modified: PyWireGate/trunk/datastore.py
===================================================================
--- PyWireGate/trunk/datastore.py 2010-11-12 23:53:55 UTC (rev 116)
+++ PyWireGate/trunk/datastore.py 2010-11-14 09:52:13 UTC (rev 117)
@@ -68,7 +68,7 @@
self.debug("Updating %s (%s): %r" % (obj.name,id,val))
## Set the value of the object
- obj.setValue(val)
+ obj.setValue(val,source=connector)
##TODO: central subscriber function for other connectore or servers
@@ -103,7 +103,7 @@
def load(self):
self.debug("load DATASTORE")
try:
- db = codecs.open(self.WG.config['WireGate']['datastore'],"rb",encoding='utf-8')
+ db = codecs.open(self.WG.config['WireGate']['datastore'],"r",encoding=self.WG.config['WireGate']['defaultencoding'])
loaddict = json.load(db)
db.close()
for name, obj in loaddict.items():
@@ -120,7 +120,7 @@
except ValueError:
## empty DB File
self.DBLOADED = True
- pass
+ raise
except:
self.WG.errorlog()
## error
@@ -145,7 +145,7 @@
'config' : obj.config,
'connected' : obj.connected
}
- dbfile = codecs.open(self.WG.config['WireGate']['datastore'],"wb",encoding='utf-8')
+ dbfile = codecs.open(self.WG.config['WireGate']['datastore'],"w",encoding=self.WG.config['WireGate']['defaultencoding'])
utfdb = json.dumps(savedict,dbfile,ensure_ascii=False,sort_keys=True,indent=3)
dbfile.write(utfdb)
dbfile.close()
@@ -197,16 +197,14 @@
## set Name to function for Scheduler
if type(self.name) <> unicode:
- ## guess that non unicode is iso8859
- self.name = name.decode("iso-8859-15")
+ ## guess that non unicode is default encoded
+ self.name = name.decode(self.WG.config['WireGate']['defaultencoding'])
## some defaults
self.value = None
self.lastupdate = 0
+ self.lastsource = None
self.id = id
- ## Fixme: dpt is only KNX specific , should be moved to self.config['KNX:dptid']
- self.dptid = -1
-
## connector specific vars
self.config = {}
@@ -217,7 +215,20 @@
self.connected = []
def __repr__(self):
+ return json.dumps({
+ 'name' : self.name,
+ 'id' : self.id,
+ 'value' : self.value,
+ 'lastupdate' : self.lastupdate,
+ 'config' : self.config,
+ 'connected' : self.connected
+ })
+
+
+ def __str__(self):
return "%s - %s" % (self.id,self.name)
+
+
def _setValue(self,refered_self):
## self override
## override with connector send function
@@ -229,7 +240,7 @@
finally:
self.write_mutex.release()
- def setValue(self,val,send=False):
+ def setValue(self,val,send=False,source=None):
if 'sendcycle' in self.config and self.value <> None:
if not self._cyclejob:
self._parent.debug("start Cycle ID: %s" % self.id)
@@ -251,9 +262,9 @@
self._parent.debug("ignore Cycle ID: %s" % self.id)
self.cyclestore.append(val)
else:
- self._real_setValue(val,send)
+ self._real_setValue(val,send,source=source)
- def _real_setValue(self,val,send):
+ def _real_setValue(self,val,send,source=None):
try:
## get read lock
self.read_mutex.acquire()
@@ -261,9 +272,10 @@
self.write_mutex.acquire()
## save the modified time
self.lastupdate = time.time()
+ self.lastsource = source
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')
+ val = unicode(val,encoding=self.WG.config['WireGate']['defaultencoding'],errors='ignore')
self.value = val
if send:
self._setValue(self)
@@ -278,18 +290,21 @@
self.read_mutex.release()
for attached in self.connected:
try:
- self.WG.DATASTORE.dataobjects[attached].setValue(val,True)
+ self.WG.DATASTORE.dataobjects[attached].setValue(val,True,source=self)
except:
self.WG.log("sendconnected failed for %s" % attached,'error')
- #__import__('traceback').print_exc(file=__import__('sys').stdout)
+ __import__('traceback').print_exc(file=__import__('sys').stdout)
- def getValue(self):
+ def getValue(self,other=''):
try:
## get read lock
self.read_mutex.acquire()
- return self.value
+ ret = self.value
+ if other == 'lastupdate':
+ ret = [ret,self.lastupdate]
+ return ret
finally:
## release lock
self.read_mutex.release()
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ma...@us...> - 2010-11-12 23:54:01
|
Revision: 116
http://openautomation.svn.sourceforge.net/openautomation/?rev=116&view=rev
Author: mayerch
Date: 2010-11-12 23:53:55 +0000 (Fri, 12 Nov 2010)
Log Message:
-----------
Added dynamic change of stylesheet dependend on the pages-design-attribute
Modified Paths:
--------------
CometVisu/trunk/visu/index.html
CometVisu/trunk/visu/lib/templateengine.js
Modified: CometVisu/trunk/visu/index.html
===================================================================
--- CometVisu/trunk/visu/index.html 2010-11-12 21:11:21 UTC (rev 115)
+++ CometVisu/trunk/visu/index.html 2010-11-12 23:53:55 UTC (rev 116)
@@ -5,8 +5,6 @@
<head>
<title>CometVisu-Client</title>
<meta name="viewport" content="width=device-width, initial-scale=1" />
- <link rel="stylesheet" type="text/css" href="designs/discreet/basic.css" />
- <link rel="stylesheet" media="only screen and (max-device-width: 480px)" href="designs/pure/mobile.css" type="text/css" />
<script src="lib/jquery.js" type="text/javascript"></script>
<script src="lib/jquery-ui.js" type="text/javascript"></script>
<script src="lib/scrollable.js" type="text/javascript"></script>
Modified: CometVisu/trunk/visu/lib/templateengine.js
===================================================================
--- CometVisu/trunk/visu/lib/templateengine.js 2010-11-12 21:11:21 UTC (rev 115)
+++ CometVisu/trunk/visu/lib/templateengine.js 2010-11-12 23:53:55 UTC (rev 116)
@@ -161,6 +161,10 @@
{
// erst mal den Cache für AJAX-Requests wieder aktivieren
$.ajaxSetup({cache: true});
+
+ var design = $( 'pages', xml ).attr('design');
+ $( 'head' ).append( '<link rel="stylesheet" type="text/css" href="designs/' + design + '/basic.css" />' );
+ $( 'head' ).append( '<link rel="stylesheet" type="text/css" href="designs/' + design + '/mobile.css" media="only screen and (max-device-width: 480px)" />' );
// adapt width for pages to show
handleResize();
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ma...@us...> - 2010-11-12 21:11:31
|
Revision: 115
http://openautomation.svn.sourceforge.net/openautomation/?rev=115&view=rev
Author: mayerch
Date: 2010-11-12 21:11:21 +0000 (Fri, 12 Nov 2010)
Log Message:
-----------
Moved stylesheets et al. to the newly created diretories
Modified Paths:
--------------
CometVisu/trunk/visu/index.html
Added Paths:
-----------
CometVisu/trunk/visu/designs/discreet/basic.css
CometVisu/trunk/visu/designs/discreet/fonts/
CometVisu/trunk/visu/designs/discreet/images/
CometVisu/trunk/visu/designs/pure/basic.css
CometVisu/trunk/visu/designs/pure/mobile.css
Removed Paths:
-------------
CometVisu/trunk/visu/fonts/
CometVisu/trunk/visu/images/
CometVisu/trunk/visu/style_discreet.css
CometVisu/trunk/visu/style_orange.css
CometVisu/trunk/visu/style_orange_mobile.css
Copied: CometVisu/trunk/visu/designs/discreet/basic.css (from rev 112, CometVisu/trunk/visu/style_discreet.css)
===================================================================
--- CometVisu/trunk/visu/designs/discreet/basic.css (rev 0)
+++ CometVisu/trunk/visu/designs/discreet/basic.css 2010-11-12 21:11:21 UTC (rev 115)
@@ -0,0 +1,290 @@
+@font-face { font-family: Liberation; src:url(fonts/liberationsans-regular.ttf); }
+@font-face { font-family: Liberation; font-weight: bold; src:url(fonts/liberationsans-bold.ttf); }
+
+body
+{
+ color: white;
+ font-family: Liberation;
+ font-size: 5.5mm;
+ overflow: hidden;
+ margin:0;
+ background: #1d1d1d url(images/body_bg.png) repeat-x;
+}
+
+h1
+{
+ font-size: 2em;
+ margin-left: 15px;
+}
+
+body hr
+{
+ clear:both;
+ color: #81664b;
+ background-color: #81664b;
+ height: 1px;
+ border:none;
+ padding:0px;
+ margin:0.1em;
+}
+
+#pages hr {
+ border: 0; height: 30px; margin: 0 .1em;
+ background: transparent url(images/hr_bg.png) 50% repeat-x;
+ clear: both;
+}
+
+
+body br
+{
+ clear:both;
+}
+
+div#top {
+ margin-top: 8px;
+}
+
+.nav_path
+{
+ color: #81664b;
+ margin-left: 15px;
+}
+.nav_path a
+{
+ color: white;
+ text-decoration:none;
+}
+
+.footer,
+.footer *
+{
+ color: #000000;
+ font-size: 0.9em;
+ vertical-align: middle;
+}
+
+.widget
+{
+ float:left;
+ width:48%;
+ margin: .2em;
+ padding: 0.3em;
+ /* border:yellow 1px solid; */
+ border-color: #020202;
+ border-style: solid;
+ border-width: 2px 0px 0px 2px;
+ -moz-border-radius: 8px;
+ -webkit-border-radius: 8px;
+ border-radius: 8px;
+ min-height: 2em;
+ background-color: #101010;
+}
+
+.text > div,
+.link > a {
+ float:left;
+ text-align:left;
+ padding-left: 1em;
+}
+
+.widget .label,
+.widget.info .actor,
+.text > div,
+.link > a {
+ line-height: 2em;
+}
+
+.widget .label
+{
+ float:left;
+ width:49%;
+/* color:red; */
+/* padding-right:0.25em; */
+ text-align:left;
+ padding-left: 1em;
+/* border:blue 1px solid; */
+}
+.widget .actor
+{
+ float:left;
+ margin-left:1em;
+ text-align:left;
+}
+.widget .actor div
+{
+ float:left;
+ white-space: pre-wrap;
+}
+
+
+.green.switchPressed div, .green.switchUnpressed div{
+ background: transparent url(images/dot_green.png) no-repeat center center;
+ color: white !important;
+}
+.red.switchPressed div, .red.switchUnpressed div{
+ background: transparent url(images/dot_red.png) no-repeat center center;
+ color: white !important;
+}
+
+
+.red
+{
+ color:#f44;
+ font-weight:bold;
+}
+
+.green
+{
+ color:#4f4;
+}
+
+.blue
+{
+ color:#44f;
+}
+
+.purple
+{
+ color:#f4f;
+}
+
+.link a
+{
+ color: #81664b;
+ width: 49%;
+}
+
+.page
+{
+ float:left;
+ width: 900px;
+ overflow: auto;
+ position: relative;
+}
+
+.switchPressed, .switchUnpressed {
+ border-style: solid;
+ -moz-border-radius: 12px;
+ -webkit-border-radius: 12px;
+ border-radius: 12px;
+ padding: 1px;
+ background: url(images/button_bg.png) #171717 repeat-x;
+}
+
+.switchUnpressed
+{
+ border-width: 1px 2px 2px 1px;
+ border-color: #282828 #010101 #010101 #282828;
+ margin-top: 0px;
+ background-color: #3A3A3A;
+ background-position: center +2px;
+}
+.switchUnpressed div, .switchPressed div
+{
+ padding: 5px;
+ width: 5em;
+ float: left;
+ background: transparent;
+ text-align: center;
+ cursor: pointer;
+}
+
+.switchPressed
+{
+ border-width: 2px 1px 1px 2px;
+ border-color: #010101 #282828 #282828 #010101;
+ margin-top: 1px;
+ background-position: center -2px;
+}
+
+.switchUnpressed div {
+ margin-left: -1px;
+}
+
+.switchPressed div {
+ margin-top: -1px;
+}
+
+.ui-slider { position: relative; text-align: left; }
+.ui-slider .ui-slider-handle { position: absolute; z-index: 2; width: 1.6em; height: 1.6em; cursor: default; }
+.ui-slider .ui-slider-range { position: absolute; z-index: 1; font-size: .7em; display: block; border: 0; background-position: 0 0; }
+
+.ui-slider-horizontal { height: .8em; }
+.ui-slider-horizontal .ui-slider-handle { top: -.5em; margin-left: -.8em; }
+.ui-slider-horizontal .ui-slider-range { top: 0; height: 100%; }
+.ui-slider-horizontal .ui-slider-range-min { left: 0; }
+.ui-slider-horizontal .ui-slider-range-max { right: 0; }
+
+.ui-slider-vertical { width: .8em; height: 100px; }
+.ui-slider-vertical .ui-slider-handle { left: -.3em; margin-left: 0; margin-bottom: -.6em; }
+.ui-slider-vertical .ui-slider-range { left: 0; width: 100%; }
+.ui-slider-vertical .ui-slider-range-min { bottom: 0; }
+.ui-slider-vertical .ui-slider-range-max { top: 0; }
+.ui-widget-content { border: 1px solid #dddddd; background: #000 ; color: #000; }
+.ui-widget-content a { color: #333333; }
+.ui-state-default, .ui-widget-content .ui-state-default, .ui-widget-header .ui-state-default { border: 1px solid #cccccc; background: #000 ; font-weight: bold; color: #1c94c4; }
+.ui-state-default a, .ui-state-default a:link, .ui-state-default a:visited { color: #1c94c4; text-decoration: none; }
+.ui-corner-all { -moz-border-radius: 4px; -webkit-border-radius: 4px; border-radius: 4px; }
+
+.dim .actor
+{
+ width: 3em;
+}
+.widget .ui-slider
+{
+ width: 30%;
+ float: left;
+ margin-left: 10px;
+ margin-left: 1em;
+ margin-top: 0.5em;
+ border-color: #010101 #282828 #282828 #010101;
+ background: url(images/gradient.png) #a7a7a7 repeat-y;
+}
+
+.widget .ui-slider-handle
+{
+ border-style: solid;
+ -moz-border-radius: 12px;
+ -webkit-border-radius: 12px;
+ border-radius: 12px;
+ padding: 1px;
+ background: url(images/button_bg.png) #171717 repeat-x;
+ border-width: 1px 2px 2px 1px;
+ border-color: #282828 #010101 #010101 #282828;
+}
+/* Clearfix */
+.clearfix:after {
+ content: ".";
+ display: block;
+ clear: both;
+ visibility: hidden;
+ line-height: 0;
+ height: 0;
+}
+
+.clearfix {
+ display: inline-block;
+}
+
+html[xmlns] .clearfix {
+ display: block;
+}
+
+*:first-child+html .clearfix {
+ min-height: 0;
+}
+
+* html .clearfix {
+ height: 1%;
+}
+
+* html>body .clearfix {
+ display: inline-block;
+ width: 100%;
+}
+
+* html .clearfix {
+ /* Hides from IE-mac \*/
+ height: 1%;
+ /* End hide from IE-mac */
+}
Copied: CometVisu/trunk/visu/designs/pure/basic.css (from rev 112, CometVisu/trunk/visu/style_orange.css)
===================================================================
--- CometVisu/trunk/visu/designs/pure/basic.css (rev 0)
+++ CometVisu/trunk/visu/designs/pure/basic.css 2010-11-12 21:11:21 UTC (rev 115)
@@ -0,0 +1,253 @@
+body
+{
+ background-color: black;
+ color: white;
+ font-family: Verdana, Helvetica, sans-serif;
+ font-family: 'URW Gothic L','Century Gothic','Apple Gothic',Arial,sans-serif;
+ font-size: 6mm;
+ overflow: hidden;
+ margin:0;
+}
+
+h1
+{
+ font-size: 2em;
+}
+
+body hr
+{
+ clear:both;
+ color: #ff8000;
+ background-color: #ff8000;
+ height: 1px;
+ border:none;
+ padding:0px;
+ margin:0.1em;
+}
+
+body br
+{
+ clear:both;
+}
+
+.nav_path
+{
+ color: #ff8000;
+}
+.nav_path a
+{
+ color: white;
+ text-decoration:none;
+}
+
+.footer,
+.footer *
+{
+ color: #ff8000;
+ font-size: 0.9em;
+ vertical-align: middle;
+}
+
+.widget
+{
+ float:left;
+ width:48%;
+ margin:0.10em;
+ padding:0.1em;
+ /* border:yellow 1px solid; */
+ border: 1px solid #444;
+ -moz-border-radius: 5px;
+ -webkit-border-radius: 5px;
+ border-radius: 5px;
+ min-height: 2em;
+}
+
+.widget .label
+{
+ float:left;
+ width:49%;
+/* color:red; */
+/* padding-right:0.25em; */
+ text-align:right;
+/* border:blue 1px solid; */
+}
+.widget .actor
+{
+ float:left;
+ margin-left:1em;
+ /*width:49%;*/
+ text-align:left;
+/* color:green; */
+/* border:blue 1px solid; */
+}
+.widget .actor div
+{
+ float:left;
+ white-space: pre-wrap;
+}
+
+.red
+{
+ color:#f44;
+ font-weight:bold;
+}
+
+.green
+{
+ color:#4f4;
+}
+
+.blue
+{
+ color:#44f;
+}
+
+.purple
+{
+ color:#f4f;
+}
+
+.link a
+{
+ color: #ff8000;
+ text-align: right;
+ width: 49%;
+}
+
+.page
+{
+ float:left;
+ width: 900px;
+ overflow: auto;
+ position: relative;
+}
+
+.switchUnpressed
+{
+ border-style: solid;
+ border-width: 1px;
+ border-color: #666 #444 #444 #666;
+ -moz-border-radius: 7px;
+ -webkit-border-radius: 7px;
+ border-radius: 7px;
+ padding: 1px;
+}
+.switchUnpressed div
+{
+ border-style: solid;
+ border-width: 1px;
+ border-color: #fff #666 #666 #fff;
+ padding: 5px;
+ width: 5em;
+ float: left;
+ -moz-border-radius: 5px;
+ -webkit-border-radius: 5px;
+ border-radius: 5px;
+}
+
+.switchPressed
+{
+ border-top: 1px solid #666;
+ border-left: 1px solid #666;
+ border-right: 1px solid #ccc;
+ border-bottom: 1px solid #ccc;
+}
+.switchPressed
+{
+ border-style: solid;
+ border-width: 1px;
+ border-color: #666 #fff #fff #666;
+ -moz-border-radius: 7px;
+ -webkit-border-radius: 7px;
+ border-radius: 7px;
+ padding: 1px;
+}
+.switchPressed div
+{
+ border-style: solid;
+ border-width: 1px;
+ border-color: #444 #666 #666 #444;
+ padding: 5px;
+ width: 5em;
+ float: left;
+ -moz-border-radius: 5px;
+ -webkit-border-radius: 5px;
+ border-radius: 5px;
+}
+
+
+.ui-slider { position: relative; text-align: left; }
+.ui-slider .ui-slider-handle { position: absolute; z-index: 2; width: 1.6em; height: 1.6em; cursor: default; }
+.ui-slider .ui-slider-range { position: absolute; z-index: 1; font-size: .7em; display: block; border: 0; background-position: 0 0; }
+
+.ui-slider-horizontal { height: .8em; }
+.ui-slider-horizontal .ui-slider-handle { top: -.5em; margin-left: -.8em; }
+.ui-slider-horizontal .ui-slider-range { top: 0; height: 100%; }
+.ui-slider-horizontal .ui-slider-range-min { left: 0; }
+.ui-slider-horizontal .ui-slider-range-max { right: 0; }
+
+.ui-slider-vertical { width: .8em; height: 100px; }
+.ui-slider-vertical .ui-slider-handle { left: -.3em; margin-left: 0; margin-bottom: -.6em; }
+.ui-slider-vertical .ui-slider-range { left: 0; width: 100%; }
+.ui-slider-vertical .ui-slider-range-min { bottom: 0; }
+.ui-slider-vertical .ui-slider-range-max { top: 0; }
+.ui-widget-content { border: 1px solid #dddddd; background: #000 ; color: #000; }
+.ui-widget-content a { color: #333333; }
+.ui-state-default, .ui-widget-content .ui-state-default, .ui-widget-header .ui-state-default { border: 1px solid #cccccc; background: #000 ; font-weight: bold; color: #1c94c4; }
+.ui-state-default a, .ui-state-default a:link, .ui-state-default a:visited { color: #1c94c4; text-decoration: none; }
+.ui-corner-all { -moz-border-radius: 4px; -webkit-border-radius: 4px; border-radius: 4px; }
+
+.dim .actor
+{
+ width: 3em;
+}
+.widget .ui-slider
+{
+ width: 30%;
+ float: left;
+ margin-left: 10px;
+ margin-left: 1em;
+ margin-top: 0.2em;
+ border-color: #666 #fff #fff #666;
+}
+
+.widget .ui-slider-handle
+{
+ border-color: #fff #666 #666 #fff;
+}
+/* Clearfix */
+.clearfix:after {
+ content: ".";
+ display: block;
+ clear: both;
+ visibility: hidden;
+ line-height: 0;
+ height: 0;
+}
+
+.clearfix {
+ display: inline-block;
+}
+
+html[xmlns] .clearfix {
+ display: block;
+}
+
+*:first-child+html .clearfix {
+ min-height: 0;
+}
+
+* html .clearfix {
+ height: 1%;
+}
+
+* html>body .clearfix {
+ display: inline-block;
+ width: 100%;
+}
+
+* html .clearfix {
+ /* Hides from IE-mac \*/
+ height: 1%;
+ /* End hide from IE-mac */
+}
Copied: CometVisu/trunk/visu/designs/pure/mobile.css (from rev 112, CometVisu/trunk/visu/style_orange_mobile.css)
===================================================================
--- CometVisu/trunk/visu/designs/pure/mobile.css (rev 0)
+++ CometVisu/trunk/visu/designs/pure/mobile.css 2010-11-12 21:11:21 UTC (rev 115)
@@ -0,0 +1,12 @@
+.widget
+{
+ width:98%;
+}
+
+#bottom {
+ display: none;
+}
+
+.page {
+ overflow: visible;
+}
Modified: CometVisu/trunk/visu/index.html
===================================================================
--- CometVisu/trunk/visu/index.html 2010-11-12 20:59:33 UTC (rev 114)
+++ CometVisu/trunk/visu/index.html 2010-11-12 21:11:21 UTC (rev 115)
@@ -5,8 +5,8 @@
<head>
<title>CometVisu-Client</title>
<meta name="viewport" content="width=device-width, initial-scale=1" />
- <link rel="stylesheet" type="text/css" href="style_discreet.css" />
- <link rel="stylesheet" media="only screen and (max-device-width: 480px)" href="style_orange_mobile.css" type="text/css" />
+ <link rel="stylesheet" type="text/css" href="designs/discreet/basic.css" />
+ <link rel="stylesheet" media="only screen and (max-device-width: 480px)" href="designs/pure/mobile.css" type="text/css" />
<script src="lib/jquery.js" type="text/javascript"></script>
<script src="lib/jquery-ui.js" type="text/javascript"></script>
<script src="lib/scrollable.js" type="text/javascript"></script>
Deleted: CometVisu/trunk/visu/style_discreet.css
===================================================================
--- CometVisu/trunk/visu/style_discreet.css 2010-11-12 20:59:33 UTC (rev 114)
+++ CometVisu/trunk/visu/style_discreet.css 2010-11-12 21:11:21 UTC (rev 115)
@@ -1,290 +0,0 @@
-@font-face { font-family: Liberation; src:url(fonts/liberationsans-regular.ttf); }
-@font-face { font-family: Liberation; font-weight: bold; src:url(fonts/liberationsans-bold.ttf); }
-
-body
-{
- color: white;
- font-family: Liberation;
- font-size: 5.5mm;
- overflow: hidden;
- margin:0;
- background: #1d1d1d url(images/body_bg.png) repeat-x;
-}
-
-h1
-{
- font-size: 2em;
- margin-left: 15px;
-}
-
-body hr
-{
- clear:both;
- color: #81664b;
- background-color: #81664b;
- height: 1px;
- border:none;
- padding:0px;
- margin:0.1em;
-}
-
-#pages hr {
- border: 0; height: 30px; margin: 0 .1em;
- background: transparent url(images/hr_bg.png) 50% repeat-x;
- clear: both;
-}
-
-
-body br
-{
- clear:both;
-}
-
-div#top {
- margin-top: 8px;
-}
-
-.nav_path
-{
- color: #81664b;
- margin-left: 15px;
-}
-.nav_path a
-{
- color: white;
- text-decoration:none;
-}
-
-.footer,
-.footer *
-{
- color: #000000;
- font-size: 0.9em;
- vertical-align: middle;
-}
-
-.widget
-{
- float:left;
- width:48%;
- margin: .2em;
- padding: 0.3em;
- /* border:yellow 1px solid; */
- border-color: #020202;
- border-style: solid;
- border-width: 2px 0px 0px 2px;
- -moz-border-radius: 8px;
- -webkit-border-radius: 8px;
- border-radius: 8px;
- min-height: 2em;
- background-color: #101010;
-}
-
-.text > div,
-.link > a {
- float:left;
- text-align:left;
- padding-left: 1em;
-}
-
-.widget .label,
-.widget.info .actor,
-.text > div,
-.link > a {
- line-height: 2em;
-}
-
-.widget .label
-{
- float:left;
- width:49%;
-/* color:red; */
-/* padding-right:0.25em; */
- text-align:left;
- padding-left: 1em;
-/* border:blue 1px solid; */
-}
-.widget .actor
-{
- float:left;
- margin-left:1em;
- text-align:left;
-}
-.widget .actor div
-{
- float:left;
- white-space: pre-wrap;
-}
-
-
-.green.switchPressed div, .green.switchUnpressed div{
- background: transparent url(images/dot_green.png) no-repeat center center;
- color: white !important;
-}
-.red.switchPressed div, .red.switchUnpressed div{
- background: transparent url(images/dot_red.png) no-repeat center center;
- color: white !important;
-}
-
-
-.red
-{
- color:#f44;
- font-weight:bold;
-}
-
-.green
-{
- color:#4f4;
-}
-
-.blue
-{
- color:#44f;
-}
-
-.purple
-{
- color:#f4f;
-}
-
-.link a
-{
- color: #81664b;
- width: 49%;
-}
-
-.page
-{
- float:left;
- width: 900px;
- overflow: auto;
- position: relative;
-}
-
-.switchPressed, .switchUnpressed {
- border-style: solid;
- -moz-border-radius: 12px;
- -webkit-border-radius: 12px;
- border-radius: 12px;
- padding: 1px;
- background: url(images/button_bg.png) #171717 repeat-x;
-}
-
-.switchUnpressed
-{
- border-width: 1px 2px 2px 1px;
- border-color: #282828 #010101 #010101 #282828;
- margin-top: 0px;
- background-color: #3A3A3A;
- background-position: center +2px;
-}
-.switchUnpressed div, .switchPressed div
-{
- padding: 5px;
- width: 5em;
- float: left;
- background: transparent;
- text-align: center;
- cursor: pointer;
-}
-
-.switchPressed
-{
- border-width: 2px 1px 1px 2px;
- border-color: #010101 #282828 #282828 #010101;
- margin-top: 1px;
- background-position: center -2px;
-}
-
-.switchUnpressed div {
- margin-left: -1px;
-}
-
-.switchPressed div {
- margin-top: -1px;
-}
-
-.ui-slider { position: relative; text-align: left; }
-.ui-slider .ui-slider-handle { position: absolute; z-index: 2; width: 1.6em; height: 1.6em; cursor: default; }
-.ui-slider .ui-slider-range { position: absolute; z-index: 1; font-size: .7em; display: block; border: 0; background-position: 0 0; }
-
-.ui-slider-horizontal { height: .8em; }
-.ui-slider-horizontal .ui-slider-handle { top: -.5em; margin-left: -.8em; }
-.ui-slider-horizontal .ui-slider-range { top: 0; height: 100%; }
-.ui-slider-horizontal .ui-slider-range-min { left: 0; }
-.ui-slider-horizontal .ui-slider-range-max { right: 0; }
-
-.ui-slider-vertical { width: .8em; height: 100px; }
-.ui-slider-vertical .ui-slider-handle { left: -.3em; margin-left: 0; margin-bottom: -.6em; }
-.ui-slider-vertical .ui-slider-range { left: 0; width: 100%; }
-.ui-slider-vertical .ui-slider-range-min { bottom: 0; }
-.ui-slider-vertical .ui-slider-range-max { top: 0; }
-.ui-widget-content { border: 1px solid #dddddd; background: #000 ; color: #000; }
-.ui-widget-content a { color: #333333; }
-.ui-state-default, .ui-widget-content .ui-state-default, .ui-widget-header .ui-state-default { border: 1px solid #cccccc; background: #000 ; font-weight: bold; color: #1c94c4; }
-.ui-state-default a, .ui-state-default a:link, .ui-state-default a:visited { color: #1c94c4; text-decoration: none; }
-.ui-corner-all { -moz-border-radius: 4px; -webkit-border-radius: 4px; border-radius: 4px; }
-
-.dim .actor
-{
- width: 3em;
-}
-.widget .ui-slider
-{
- width: 30%;
- float: left;
- margin-left: 10px;
- margin-left: 1em;
- margin-top: 0.5em;
- border-color: #010101 #282828 #282828 #010101;
- background: url(images/gradient.png) #a7a7a7 repeat-y;
-}
-
-.widget .ui-slider-handle
-{
- border-style: solid;
- -moz-border-radius: 12px;
- -webkit-border-radius: 12px;
- border-radius: 12px;
- padding: 1px;
- background: url(images/button_bg.png) #171717 repeat-x;
- border-width: 1px 2px 2px 1px;
- border-color: #282828 #010101 #010101 #282828;
-}
-/* Clearfix */
-.clearfix:after {
- content: ".";
- display: block;
- clear: both;
- visibility: hidden;
- line-height: 0;
- height: 0;
-}
-
-.clearfix {
- display: inline-block;
-}
-
-html[xmlns] .clearfix {
- display: block;
-}
-
-*:first-child+html .clearfix {
- min-height: 0;
-}
-
-* html .clearfix {
- height: 1%;
-}
-
-* html>body .clearfix {
- display: inline-block;
- width: 100%;
-}
-
-* html .clearfix {
- /* Hides from IE-mac \*/
- height: 1%;
- /* End hide from IE-mac */
-}
Deleted: CometVisu/trunk/visu/style_orange.css
===================================================================
--- CometVisu/trunk/visu/style_orange.css 2010-11-12 20:59:33 UTC (rev 114)
+++ CometVisu/trunk/visu/style_orange.css 2010-11-12 21:11:21 UTC (rev 115)
@@ -1,253 +0,0 @@
-body
-{
- background-color: black;
- color: white;
- font-family: Verdana, Helvetica, sans-serif;
- font-family: 'URW Gothic L','Century Gothic','Apple Gothic',Arial,sans-serif;
- font-size: 6mm;
- overflow: hidden;
- margin:0;
-}
-
-h1
-{
- font-size: 2em;
-}
-
-body hr
-{
- clear:both;
- color: #ff8000;
- background-color: #ff8000;
- height: 1px;
- border:none;
- padding:0px;
- margin:0.1em;
-}
-
-body br
-{
- clear:both;
-}
-
-.nav_path
-{
- color: #ff8000;
-}
-.nav_path a
-{
- color: white;
- text-decoration:none;
-}
-
-.footer,
-.footer *
-{
- color: #ff8000;
- font-size: 0.9em;
- vertical-align: middle;
-}
-
-.widget
-{
- float:left;
- width:48%;
- margin:0.10em;
- padding:0.1em;
- /* border:yellow 1px solid; */
- border: 1px solid #444;
- -moz-border-radius: 5px;
- -webkit-border-radius: 5px;
- border-radius: 5px;
- min-height: 2em;
-}
-
-.widget .label
-{
- float:left;
- width:49%;
-/* color:red; */
-/* padding-right:0.25em; */
- text-align:right;
-/* border:blue 1px solid; */
-}
-.widget .actor
-{
- float:left;
- margin-left:1em;
- /*width:49%;*/
- text-align:left;
-/* color:green; */
-/* border:blue 1px solid; */
-}
-.widget .actor div
-{
- float:left;
- white-space: pre-wrap;
-}
-
-.red
-{
- color:#f44;
- font-weight:bold;
-}
-
-.green
-{
- color:#4f4;
-}
-
-.blue
-{
- color:#44f;
-}
-
-.purple
-{
- color:#f4f;
-}
-
-.link a
-{
- color: #ff8000;
- text-align: right;
- width: 49%;
-}
-
-.page
-{
- float:left;
- width: 900px;
- overflow: auto;
- position: relative;
-}
-
-.switchUnpressed
-{
- border-style: solid;
- border-width: 1px;
- border-color: #666 #444 #444 #666;
- -moz-border-radius: 7px;
- -webkit-border-radius: 7px;
- border-radius: 7px;
- padding: 1px;
-}
-.switchUnpressed div
-{
- border-style: solid;
- border-width: 1px;
- border-color: #fff #666 #666 #fff;
- padding: 5px;
- width: 5em;
- float: left;
- -moz-border-radius: 5px;
- -webkit-border-radius: 5px;
- border-radius: 5px;
-}
-
-.switchPressed
-{
- border-top: 1px solid #666;
- border-left: 1px solid #666;
- border-right: 1px solid #ccc;
- border-bottom: 1px solid #ccc;
-}
-.switchPressed
-{
- border-style: solid;
- border-width: 1px;
- border-color: #666 #fff #fff #666;
- -moz-border-radius: 7px;
- -webkit-border-radius: 7px;
- border-radius: 7px;
- padding: 1px;
-}
-.switchPressed div
-{
- border-style: solid;
- border-width: 1px;
- border-color: #444 #666 #666 #444;
- padding: 5px;
- width: 5em;
- float: left;
- -moz-border-radius: 5px;
- -webkit-border-radius: 5px;
- border-radius: 5px;
-}
-
-
-.ui-slider { position: relative; text-align: left; }
-.ui-slider .ui-slider-handle { position: absolute; z-index: 2; width: 1.6em; height: 1.6em; cursor: default; }
-.ui-slider .ui-slider-range { position: absolute; z-index: 1; font-size: .7em; display: block; border: 0; background-position: 0 0; }
-
-.ui-slider-horizontal { height: .8em; }
-.ui-slider-horizontal .ui-slider-handle { top: -.5em; margin-left: -.8em; }
-.ui-slider-horizontal .ui-slider-range { top: 0; height: 100%; }
-.ui-slider-horizontal .ui-slider-range-min { left: 0; }
-.ui-slider-horizontal .ui-slider-range-max { right: 0; }
-
-.ui-slider-vertical { width: .8em; height: 100px; }
-.ui-slider-vertical .ui-slider-handle { left: -.3em; margin-left: 0; margin-bottom: -.6em; }
-.ui-slider-vertical .ui-slider-range { left: 0; width: 100%; }
-.ui-slider-vertical .ui-slider-range-min { bottom: 0; }
-.ui-slider-vertical .ui-slider-range-max { top: 0; }
-.ui-widget-content { border: 1px solid #dddddd; background: #000 ; color: #000; }
-.ui-widget-content a { color: #333333; }
-.ui-state-default, .ui-widget-content .ui-state-default, .ui-widget-header .ui-state-default { border: 1px solid #cccccc; background: #000 ; font-weight: bold; color: #1c94c4; }
-.ui-state-default a, .ui-state-default a:link, .ui-state-default a:visited { color: #1c94c4; text-decoration: none; }
-.ui-corner-all { -moz-border-radius: 4px; -webkit-border-radius: 4px; border-radius: 4px; }
-
-.dim .actor
-{
- width: 3em;
-}
-.widget .ui-slider
-{
- width: 30%;
- float: left;
- margin-left: 10px;
- margin-left: 1em;
- margin-top: 0.2em;
- border-color: #666 #fff #fff #666;
-}
-
-.widget .ui-slider-handle
-{
- border-color: #fff #666 #666 #fff;
-}
-/* Clearfix */
-.clearfix:after {
- content: ".";
- display: block;
- clear: both;
- visibility: hidden;
- line-height: 0;
- height: 0;
-}
-
-.clearfix {
- display: inline-block;
-}
-
-html[xmlns] .clearfix {
- display: block;
-}
-
-*:first-child+html .clearfix {
- min-height: 0;
-}
-
-* html .clearfix {
- height: 1%;
-}
-
-* html>body .clearfix {
- display: inline-block;
- width: 100%;
-}
-
-* html .clearfix {
- /* Hides from IE-mac \*/
- height: 1%;
- /* End hide from IE-mac */
-}
Deleted: CometVisu/trunk/visu/style_orange_mobile.css
===================================================================
--- CometVisu/trunk/visu/style_orange_mobile.css 2010-11-12 20:59:33 UTC (rev 114)
+++ CometVisu/trunk/visu/style_orange_mobile.css 2010-11-12 21:11:21 UTC (rev 115)
@@ -1,12 +0,0 @@
-.widget
-{
- width:98%;
-}
-
-#bottom {
- display: none;
-}
-
-.page {
- overflow: visible;
-}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ma...@us...> - 2010-11-12 20:59:39
|
Revision: 114
http://openautomation.svn.sourceforge.net/openautomation/?rev=114&view=rev
Author: mayerch
Date: 2010-11-12 20:59:33 +0000 (Fri, 12 Nov 2010)
Log Message:
-----------
new directory structure for designs
Added Paths:
-----------
CometVisu/trunk/visu/designs/
CometVisu/trunk/visu/designs/discreet/
CometVisu/trunk/visu/designs/pure/
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ma...@us...> - 2010-11-12 20:56:18
|
Revision: 113
http://openautomation.svn.sourceforge.net/openautomation/?rev=113&view=rev
Author: mayerch
Date: 2010-11-12 20:56:09 +0000 (Fri, 12 Nov 2010)
Log Message:
-----------
Initial support for configurable designs
Modified Paths:
--------------
CometVisu/trunk/visu/visu_config.xml
CometVisu/trunk/visu/visu_config.xsd
Modified: CometVisu/trunk/visu/visu_config.xml
===================================================================
--- CometVisu/trunk/visu/visu_config.xml 2010-11-12 10:33:27 UTC (rev 112)
+++ CometVisu/trunk/visu/visu_config.xml 2010-11-12 20:56:09 UTC (rev 113)
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
-<pages>
+<pages design="pure">
<mappings>
<mapping name="OpenClose">
<entry value="0">zu</entry>
@@ -30,9 +30,9 @@
<entry range_min="0" range_max="100">red</entry>
</style>
</styles>
- <page name="Übersicht">
+ <page name="Übersicht" flavour="orange">
<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>
+ <toggle address="1/0/2" datatype="1.001" response_address="1/0/2" mapping="OnOff" style="RedGreen" >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>
<trigger address="2/2/5" datatype="5.001" value="0" >Rolladen Licht 0</trigger>
@@ -53,7 +53,7 @@
<image src="http://www.yr.no/place/Germany/Bavaria/Holzkirchen~2899676/meteogram.png" refresh="1800" />
<line />
<info address="1/0/41" datatype="1.000" mapping="OnOff">Treppenlicht</info>
- <page name="Fenster Kontakte">
+ <page name="Fenster Kontakte" flavour="blue">
<info address="4/3/10" datatype="1" mapping="OpenClose" style="GreenRed">Bad EG Reed Fenster</info>
<info address="4/3/20" datatype="1.001" mapping="OpenClose" style="GreenRed">WC Reed Fenster</info>
<info address="4/3/30" datatype="1" mapping="OpenClose" style="GreenRed">Schlafen Reed Fenster links</info>
@@ -76,7 +76,7 @@
<info address="4/3/210" datatype="1.001">Lueftung Filter</info>
<info address="4/3/250" datatype="1.001" mapping="OnOff">Rauchmelder</info>
</page>
- <page name="Temperaturen">
+ <page name="Temperaturen" flavour="red">
<info address="4/0/10" datatype="9.001" pre="ca. " post=" °C">Bad EG Boden Temperatur</info>
<info address="4/0/11" datatype="9.001" pre="ca. " post=" °C">Bad EG Luft Temperatur</info>
<info address="4/0/15" datatype="9.001" pre="ca. " post=" °C">Bad EG Dusche Temperatur</info>
@@ -101,7 +101,7 @@
<info address="4/0/203" datatype="9.001" pre="ca. " post=" °C">Kaltwasser Temperatur</info>
<info address="4/0/205" datatype="9.001" pre="ca. " post=" °C">Warmwasser UG Temperatur</info>
</page>
- <page name="Rollläden">
+ <page name="Rollläden" flavour="green">
<shade address="2/4/0" datatype="5.001">Rollladen Bad</shade>
<shade address="2/4/1" datatype="5.001">Rollladen Schlafen Fenster</shade>
<shade address="2/4/2" datatype="5.001">Rollladen Schlafen Türe</shade>
Modified: CometVisu/trunk/visu/visu_config.xsd
===================================================================
--- CometVisu/trunk/visu/visu_config.xsd 2010-11-12 10:33:27 UTC (rev 112)
+++ CometVisu/trunk/visu/visu_config.xsd 2010-11-12 20:56:09 UTC (rev 113)
@@ -51,6 +51,7 @@
<xsd:element ref="styles" />
<xsd:element ref="page" minOccurs="1" />
</xsd:choice>
+ <xsd:attribute name="design" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
@@ -108,6 +109,7 @@
<xsd:element ref="page" />
</xsd:choice>
<xsd:attribute name="name" type="xsd:string" use="required" />
+ <xsd:attribute name="flavour" type="xsd:string" />
</xsd:complexType>
</xsd:element>
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ni...@us...> - 2010-11-12 10:33:40
|
Revision: 112
http://openautomation.svn.sourceforge.net/openautomation/?rev=112&view=rev
Author: nilss1
Date: 2010-11-12 10:33:27 +0000 (Fri, 12 Nov 2010)
Log Message:
-----------
changed datastore cycles to apscheduler
Modified Paths:
--------------
PyWireGate/trunk/WireGate.py
PyWireGate/trunk/datastore.py
Modified: PyWireGate/trunk/WireGate.py
===================================================================
--- PyWireGate/trunk/WireGate.py 2010-11-12 08:59:20 UTC (rev 111)
+++ PyWireGate/trunk/WireGate.py 2010-11-12 10:33:27 UTC (rev 112)
@@ -23,8 +23,8 @@
import traceback
import daemon
import log
+import re
-
import ConfigParser
import datastore
@@ -41,7 +41,7 @@
self.REDIRECTIO = REDIRECTIO
## Get the path of this script
- self.scriptpath = str(datastore).split( )[3][1:-15]
+ self.scriptpath = re.findall("from \x27(.*)\x2F",str(datastore))[0]
self.readWireGateConfig()
Modified: PyWireGate/trunk/datastore.py
===================================================================
--- PyWireGate/trunk/datastore.py 2010-11-12 08:59:20 UTC (rev 111)
+++ PyWireGate/trunk/datastore.py 2010-11-12 10:33:27 UTC (rev 112)
@@ -15,6 +15,14 @@
sys.exit(1)
+try:
+ from apscheduler.scheduler import Scheduler as apscheduler
+except ImportError:
+ print >> sys.stderr, "apt-get install python-apscheduler"
+ sys.exit(1)
+
+
+
class datastore:
"""
Datastore Instance
@@ -34,8 +42,8 @@
self.DBLOADED = False
self.dataobjects = {}
- self.cycleThreadLock = threading.RLock()
- self.cycleThreads = {}
+ self.CYCLER = apscheduler()
+ self.CYCLER.start()
self.locked = threading.RLock()
self.locked.acquire()
@@ -85,7 +93,7 @@
except KeyError:
## create a new one if it don't exist
self.dataobjects[id] = dataObject(self,id)
- if connector:
+ if hasattr(connector,'get_ds_defaults'):
self.dataobjects[id].config = connector.get_ds_defaults(id)
## return it
self.locked.release()
@@ -143,34 +151,8 @@
dbfile.close()
- def attachThread(self,obj,threadObj=False):
- try:
- self.cycleThreadLock.acquire()
- ## check only
- if not threadObj:
- return obj in self.cycleThreads
- self.cycleThreads[obj] = threadObj
- finally:
- self.cycleThreadLock.release()
-
- return self.cycleThreads[obj]
-
-
- def removeThread(self,obj):
- self.cycleThreadLock.acquire()
- del self.cycleThreads[obj]
- self.cycleThreadLock.release()
-
-
def shutdown(self):
- self.cycleThreadLock.acquire()
- for obj in self.cycleThreads.keys():
- try:
- self.cycleThreads[obj].cancel()
- self.cycleThreads[obj].join()
- except:
- pass
- self.cycleThreadLock.release()
+ self.CYCLER.shutdown()
self.save()
@@ -193,9 +175,7 @@
class dataObject:
def __init__(self,parent,id,name=False):
self._parent = parent
- if parent:
- self.WG = parent.WG
-
+ self.WG = parent.WG
## Threadlocking
self.write_mutex = threading.RLock()
self.read_mutex = threading.RLock()
@@ -220,7 +200,7 @@
## guess that non unicode is iso8859
self.name = name.decode("iso-8859-15")
## some defaults
- self.value = u""
+ self.value = None
self.lastupdate = 0
self.id = id
@@ -231,6 +211,7 @@
self.config = {}
self.cyclestore = []
+ self._cyclejob = False
## connected Logics, communication objects ... goes here
self.connected = []
@@ -249,17 +230,23 @@
self.write_mutex.release()
def setValue(self,val,send=False):
- if 'sendcycle' in self.config:
- if not self.WG.DATASTORE.attachThread(self):
+ if 'sendcycle' in self.config and self.value <> None:
+ if not self._cyclejob:
self._parent.debug("start Cycle ID: %s" % self.id)
cycletime = float(self.config['sendcycle']) + self.lastupdate - time.time()
if cycletime < 0.0:
cycletime = 0
+
+ ## add value to List
self.cyclestore.append(val)
- ## FIXME: create global cycling Thread like in cycle.py
- _cyclethread = self.WG.DATASTORE.attachThread(self,threading.Timer(cycletime,self._cycle))
- #_cyclethread.setDaemon(1)
- _cyclethread.start()
+
+ ##
+ repeat = 1
+ if 'always' in self.config['sendcycleoption'].split(","):
+ repeat = 0
+ self.write_mutex.acquire()
+ self._cyclejob = self.WG.DATASTORE.CYCLER.add_interval_job(self._cycle,seconds=cycletime,repeat=repeat)
+ self.write_mutex.release()
else:
self._parent.debug("ignore Cycle ID: %s" % self.id)
self.cyclestore.append(val)
@@ -293,9 +280,9 @@
try:
self.WG.DATASTORE.dataobjects[attached].setValue(val,True)
except:
- print "FAILED %s" % attached
- __import__('traceback').print_exc(file=__import__('sys').stdout)
- pass
+ self.WG.log("sendconnected failed for %s" % attached,'error')
+ #__import__('traceback').print_exc(file=__import__('sys').stdout)
+
def getValue(self):
@@ -308,17 +295,36 @@
self.read_mutex.release()
def _cycle(self):
- self._parent.debug("execute Cycle ID: %s" % self.id)
- self.WG.DATASTORE.removeThread(self)
- val = self.getValue()
+ self._parent.debug("----------------------execute Cycle ID: %s" % self.id)
+ val = None
+ cycleopts = []
if 'sendcycleoption' in self.config:
- if self.config['sendcycleoption'] == 'average' and type(self.cyclestore[0]) in (int,float):
- val = type(self.cyclestore[0])(0)
- for i in self.cyclestore:
- val += i
- val = val / len(self.cyclestore)
- self._parent.debug("Cycle ID: %s average: %f (%r)" % (self.id, val, self.cyclestore ))
- self.cyclestore = []
+ cycleopts = self.config['sendcycleoption'].split(",")
+ ## average only possible with data in cyclesotre else DivisionByZero
+ if len(self.cyclestore) > 0:
+ ## Average/Min/Max only possible with int and float
+ if type(self.value) in (int,float):
+ val = type(self.value)(0)
+ if 'average' in cycleopts:
+ for i in self.cyclestore:
+ val += i
+ val = val / len(self.cyclestore)
+ self._parent.debug("Cycle ID: %s average: %f (%r)" % (self.id, val, self.cyclestore ))
+ ## default use last
+ else:
+ val = self.cyclestore.pop()
+ else:
+ val = self.cyclestore.pop()
+
+ if 'always' in cycleopts:
+ if val == None:
+ val = self.getValue()
else:
- val = self.cyclestore.pop()
- self._real_setValue(val,False)
+ self.write_mutex.acquire()
+ self._cyclejob = False
+ self.write_mutex.release()
+
+ ## reset cyclestore
+ self.cyclestore = []
+ if val <> None:
+ self._real_setValue(val,False)
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ni...@us...> - 2010-11-12 08:59:33
|
Revision: 111
http://openautomation.svn.sourceforge.net/openautomation/?rev=111&view=rev
Author: nilss1
Date: 2010-11-12 08:59:20 +0000 (Fri, 12 Nov 2010)
Log Message:
-----------
set loglevel for failed reads to info
Modified Paths:
--------------
PyWireGate/trunk/owfs_connector/OWFS_Connector.py
PyWireGate/trunk/owfs_connector/connection.py
Modified: PyWireGate/trunk/owfs_connector/OWFS_Connector.py
===================================================================
--- PyWireGate/trunk/owfs_connector/OWFS_Connector.py 2010-11-11 17:37:13 UTC (rev 110)
+++ PyWireGate/trunk/owfs_connector/OWFS_Connector.py 2010-11-12 08:59:20 UTC (rev 111)
@@ -24,7 +24,7 @@
class owfs_connector(Connector):
CONNECTOR_NAME = 'OWFS Connector'
- CONNECTOR_VERSION = 0.1
+ CONNECTOR_VERSION = 0.2
CONNECTOR_LOGNAME = 'owfs_connector'
def __init__(self,parent, instanceName):
self._parent = parent
@@ -51,7 +51,7 @@
self.issensor = re.compile(r"[0-9][0-9]\x2E[0-9a-fA-F]+")
self.isbus = re.compile(r"\x2Fbus\x2E([0-9])+$", re.MULTILINE)
- owfsdir = str(connection).split( )[3][1:-17]
+ owfsdir = re.findall("from \x27(.*)\x2F",str(connection))[0]
## Sensors and their interfaces
self.debug("Read ini file from %s" % owfsdir+"/sensors.ini")
sensorconfig = self.WG.readConfig(owfsdir+"/sensors.ini")
@@ -225,19 +225,21 @@
owfspath = "/uncached/%s/%s%s" % (sensor,get,resolution)
self.debug("Reading from path %s" % owfspath)
+ data = False
try:
## read uncached and put into local-list
data = self.owfs.read(owfspath)
- try:
- self.mutex.acquire()
- self.busmaster[busname]['sensors'][sensor][get] = data
- finally:
- self.mutex.release()
except:
## ignore all OWFS Errors
- self.WG.errorlog("Reading from path %s failed" % owfspath)
+ #self.WG.errorlog("Reading from path %s failed" % owfspath)
+ self.log("Reading from path %s failed" % owfspath)
+
+ try:
+ self.mutex.acquire()
+ self.busmaster[busname]['sensors'][sensor][get] = data
+ finally:
+ self.mutex.release()
## make an id for the sensor (OW:28.043242a32_temperature
-
try:
## only if there is any Data update it in the DATASTORE
if self.busmaster[busname]['sensors'][sensor][get]:
Modified: PyWireGate/trunk/owfs_connector/connection.py
===================================================================
--- PyWireGate/trunk/owfs_connector/connection.py 2010-11-11 17:37:13 UTC (rev 110)
+++ PyWireGate/trunk/owfs_connector/connection.py 2010-11-12 08:59:20 UTC (rev 111)
@@ -152,7 +152,6 @@
if payload_len >= 0:
data = s.recv(payload_len)
return self.toNumber(data[:data_len])
- break
else:
# ping response
return None
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ma...@us...> - 2010-11-11 17:37:19
|
Revision: 110
http://openautomation.svn.sourceforge.net/openautomation/?rev=110&view=rev
Author: makki1
Date: 2010-11-11 17:37:13 +0000 (Thu, 11 Nov 2010)
Log Message:
-----------
filled in some 1-wire devices to owfs/sensors.ini
Modified Paths:
--------------
PyWireGate/trunk/owfs_connector/sensors.ini
Modified: PyWireGate/trunk/owfs_connector/sensors.ini
===================================================================
--- PyWireGate/trunk/owfs_connector/sensors.ini 2010-11-11 15:56:02 UTC (rev 109)
+++ PyWireGate/trunk/owfs_connector/sensors.ini 2010-11-11 17:37:13 UTC (rev 110)
@@ -1,14 +1,70 @@
[DS1420]
+# ROM id-chip
+interfaces = present
-
[DS18B20]
+# Temperature with resolution, family 28
cycle = 15
interfaces = temperature,power
config_temperature_resolution = 10
config_temperature_sendcycle = 60
config_temperature_sendcycleoption = average
+[DS18S20]
+# Temperature with fixed resolution, family 10
+cycle = 15
+interfaces = temperature,power
+config_temperature_sendcycle = 60
+config_temperature_sendcycleoption = average
+[DS1990]
+# ROM iButtons, family 01
+cycle = 1
+interfaces = present
+# save parent busmaster-id/serial in DS to distinguish presence on different busmasters
+config_present_busmaster = true
+
[DS2438]
+# Battery-monitor with Vxx and current, family 26
+# /pages/page.3 conatins type: 0x19 or 0xF1 = TH, 0xF2 = THS
+# FIXME: several more (not widely used) to be added
cycle = 60
-interfaces = temperature,humidity,vis,VDD
+interfaces = temperature,HIH4000/humidity,vis,VAD,VDD
+
+[DS2406]
+# dual switch / IO, family 12
+# PIO.[A|B] if used as output
+# sensed.[A|B] if used as input
+# latch contains changed pin if alarming, must be reset after read
+# owread /uncached/$key/latch.ALL; owwrite /$key/latch.BYTE 0; owwrite /$key/set_alarm 311
+# latch returns CSV 0,1 if B changed
+cycle = 1
+interfaces = PIO.A,PIO.B,sensed.A,sensed.B,latch.ALL,latch.BYTE,set_alarm
+
+[DS2408]
+# 8x switch / IO, family 29
+# PIO.[0-7] if used as output
+# FIXME: sensed.[0-7] if used as input / latch not supported yet
+cycle = 1
+interfaces = PIO.0,PIO.1,PIO.2,PIO.3,PIO.4,PIO.5,PIO.6,PIO.7
+
+[DS2423]
+# Dual-counter, family 1D
+interfaces = counters.A,counters.B
+
+[DS2760]
+# battery-monitor, family 30
+# used for soil-moisture
+cycle = 60
+interfaces = temperature,current
+# values need to be calibrated for each sensor
+config_current_low = 0.14
+config_current_high = 0.14
+
+[DS9490]
+# USB-Busmaster, family 81
+# no interfaces but bus-specific statistics
+# /interface/statistics/errors
+# /interface/statistics/search_errors/error_pass_1
+# etc.
+
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ni...@us...> - 2010-11-11 15:56:08
|
Revision: 109
http://openautomation.svn.sourceforge.net/openautomation/?rev=109&view=rev
Author: nilss1
Date: 2010-11-11 15:56:02 +0000 (Thu, 11 Nov 2010)
Log Message:
-----------
Fix date in DPT_Types.py * Fix parent error for DSupdate in datastore.py * change print to debug in scheduler.py
Modified Paths:
--------------
PyWireGate/trunk/datastore.py
PyWireGate/trunk/knx_connector/DPT_Types.py
PyWireGate/trunk/scheduler.py
Modified: PyWireGate/trunk/datastore.py
===================================================================
--- PyWireGate/trunk/datastore.py 2010-11-11 14:49:01 UTC (rev 108)
+++ PyWireGate/trunk/datastore.py 2010-11-11 15:56:02 UTC (rev 109)
@@ -193,7 +193,8 @@
class dataObject:
def __init__(self,parent,id,name=False):
self._parent = parent
- self.WG = parent.WG
+ if parent:
+ self.WG = parent.WG
## Threadlocking
self.write_mutex = threading.RLock()
Modified: PyWireGate/trunk/knx_connector/DPT_Types.py
===================================================================
--- PyWireGate/trunk/knx_connector/DPT_Types.py 2010-11-11 14:49:01 UTC (rev 108)
+++ PyWireGate/trunk/knx_connector/DPT_Types.py 2010-11-11 15:56:02 UTC (rev 109)
@@ -361,9 +361,11 @@
def encodeDPT11(self,val):
## make time struct accesible
+ utime=[]
if type(val) in [float, int]:
- utime = [v for v in time.localtime(tval)]
- else:
+ if val > 0:
+ utime = [v for v in time.localtime(val)]
+ if utime == []:
utime = [v for v in time.localtime()]
if type(val) == str:
Modified: PyWireGate/trunk/scheduler.py
===================================================================
--- PyWireGate/trunk/scheduler.py 2010-11-11 14:49:01 UTC (rev 108)
+++ PyWireGate/trunk/scheduler.py 2010-11-11 15:56:02 UTC (rev 109)
@@ -47,12 +47,12 @@
for uoption in obj.config['cron'].keys():
kwargs[str(uoption)] = str(obj.config['cron'][uoption])
- print "Adding %s - %r" % (shed,obj)
+ self.debug("Adding %s - %r" % (shed,obj))
setattr(obj.sendConnected.im_func,'__name__',"%s" % shed.encode('UTF-8'))
self.SCHEDULER.add_cron_job(self.WG.DATASTORE.dataobjects[shed].sendConnected,**kwargs)
def shutdown(self):
- print self.SCHEDULER.dump_jobs()
+ self.debug("shutdown Scheduler\n%s" % self.SCHEDULER.dump_jobs())
self.SCHEDULER.shutdown()
def debug(self,msg):
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ni...@us...> - 2010-11-11 14:49:08
|
Revision: 108
http://openautomation.svn.sourceforge.net/openautomation/?rev=108&view=rev
Author: nilss1
Date: 2010-11-11 14:49:01 +0000 (Thu, 11 Nov 2010)
Log Message:
-----------
add scheduler support
Modified Paths:
--------------
PyWireGate/trunk/WireGate.py
Added Paths:
-----------
PyWireGate/trunk/scheduler.py
Modified: PyWireGate/trunk/WireGate.py
===================================================================
--- PyWireGate/trunk/WireGate.py 2010-11-11 14:48:26 UTC (rev 107)
+++ PyWireGate/trunk/WireGate.py 2010-11-11 14:49:01 UTC (rev 108)
@@ -28,7 +28,9 @@
import ConfigParser
import datastore
+import scheduler
+
class WireGate(daemon.Daemon):
def __init__(self,REDIRECTIO=False):
self._parent = self
@@ -47,7 +49,6 @@
## Start the Datastore
self.DATASTORE = datastore.datastore(self)
-
## Start the Daemon
daemon.Daemon.__init__(self,self.config['WireGate']['pidfile'],REDIRECTIO)
@@ -138,6 +139,10 @@
except:
self.WG.errorlog(connector)
pass
+
+ ## Start the Sheduler
+ self.SCHEDULER = scheduler.scheduler(self)
+ self.SCHEDULER.start()
if os.getuid() == 0:
import pwd
@@ -186,6 +191,8 @@
#for dobj in self.DATASTORE.dataobjects.keys():
# print dobj+": "+str(self.DATASTORE.dataobjects[dobj].getValue())
self.log("### Shutdown WireGated ###")
+
+ self.SCHEDULER.shutdown()
for instance in self.connectors.keys():
try:
self.connectors[instance].shutdown()
Added: PyWireGate/trunk/scheduler.py
===================================================================
--- PyWireGate/trunk/scheduler.py (rev 0)
+++ PyWireGate/trunk/scheduler.py 2010-11-11 14:49:01 UTC (rev 108)
@@ -0,0 +1,88 @@
+# -*- coding: iso8859-1 -*-
+## -----------------------------------------------------
+## Cycler
+## -----------------------------------------------------
+## Copyright (c) 2010, knx-user-forum e.V, All rights reserved.
+##
+## This program is free software; you can redistribute it and/or modify it under the terms
+## of the GNU General Public License as published by the Free Software Foundation; either
+## version 3 of the License, or (at your option) any later version.
+##
+## This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
+## without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+## See the GNU General Public License for more details.
+##
+## You should have received a copy of the GNU General Public License along with this program;
+## if not, see <http://www.gnu.de/documents/gpl-3.0.de.html>.
+
+import time
+import sys
+from datetime import datetime
+try:
+ from apscheduler.scheduler import Scheduler as apscheduler
+except ImportError:
+ print >> sys.stderr, "apt-get install python-apscheduler"
+ sys.exit(1)
+
+
+
+class scheduler:
+ def __init__(self,parent):
+ self._parent = parent
+ if parent:
+ self.WG = parent.WG
+ self.SCHEDULER = apscheduler()
+
+ def start(self):
+ self.load()
+ self.log("SCHEDULER starting up")
+ self.SCHEDULER.start()
+
+ def load(self):
+ schedules = filter(lambda x: x.startswith("SCHEDULER:"),self.WG.DATASTORE.dataobjects.keys())
+ for shed in schedules:
+ obj = self.WG.DATASTORE.dataobjects[shed]
+ if 'cron' in obj.config:
+ kwargs = {}
+ for uoption in obj.config['cron'].keys():
+ kwargs[str(uoption)] = str(obj.config['cron'][uoption])
+
+ print "Adding %s - %r" % (shed,obj)
+ setattr(obj.sendConnected.im_func,'__name__',"%s" % shed.encode('UTF-8'))
+ self.SCHEDULER.add_cron_job(self.WG.DATASTORE.dataobjects[shed].sendConnected,**kwargs)
+
+ def shutdown(self):
+ print self.SCHEDULER.dump_jobs()
+ self.SCHEDULER.shutdown()
+
+ def debug(self,msg):
+ self.log(msg,'debug')
+
+
+ ## Central logging
+ def log(self,msg,severity='info',instance=False):
+ self.WG.log(msg,severity,"scheduler")
+
+
+if __name__ == '__main__':
+ s = scheduler(False)
+ time.sleep(155)
+ s.shutdown()
+
+
+## "SHEDULER:cron_job-001": {
+## "config": {
+## "cron" : {
+## "day_of_week" : "mon-fri",
+## "hour" : "8",
+## "minute" : "30"
+## }
+##
+## },
+## "connected": [ "KNX:14/1/50" ],
+## "id": "cron_job-001",
+## "lastupdate": 0,
+## "name": "Test Cronjob weekday 8:30",
+## "value": 1
+## }
+
\ 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-11 14:48:32
|
Revision: 107
http://openautomation.svn.sourceforge.net/openautomation/?rev=107&view=rev
Author: nilss1
Date: 2010-11-11 14:48:26 +0000 (Thu, 11 Nov 2010)
Log Message:
-----------
seperate sendConnected to be called from scheduler * get initial Value from datastore.db
Modified Paths:
--------------
PyWireGate/trunk/datastore.py
Modified: PyWireGate/trunk/datastore.py
===================================================================
--- PyWireGate/trunk/datastore.py 2010-11-11 14:45:53 UTC (rev 106)
+++ PyWireGate/trunk/datastore.py 2010-11-11 14:48:26 UTC (rev 107)
@@ -64,14 +64,7 @@
##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
-
+ obj.sendConnected()
## return the object for additional updates
return obj
@@ -110,6 +103,7 @@
self.dataobjects[name].lastupdate = obj['lastupdate']
self.dataobjects[name].config = obj['config']
self.dataobjects[name].connected = obj['connected']
+ self.dataobjects[name].value = obj['value']
self.debug("%d entries loaded in DATASTORE" % len(self.dataobjects))
self.DBLOADED = True
except IOError:
@@ -220,6 +214,7 @@
else:
self.name = name
+ ## set Name to function for Scheduler
if type(self.name) <> unicode:
## guess that non unicode is iso8859
self.name = name.decode("iso-8859-15")
@@ -239,6 +234,8 @@
## connected Logics, communication objects ... goes here
self.connected = []
+ def __repr__(self):
+ return "%s - %s" % (self.id,self.name)
def _setValue(self,refered_self):
## self override
## override with connector send function
@@ -258,6 +255,7 @@
if cycletime < 0.0:
cycletime = 0
self.cyclestore.append(val)
+ ## FIXME: create global cycling Thread like in cycle.py
_cyclethread = self.WG.DATASTORE.attachThread(self,threading.Timer(cycletime,self._cycle))
#_cyclethread.setDaemon(1)
_cyclethread.start()
@@ -286,6 +284,18 @@
self.write_mutex.release()
self.read_mutex.release()
+ def sendConnected(self):
+ self.read_mutex.acquire()
+ val = self.getValue()
+ self.read_mutex.release()
+ for attached in self.connected:
+ try:
+ self.WG.DATASTORE.dataobjects[attached].setValue(val,True)
+ except:
+ print "FAILED %s" % attached
+ __import__('traceback').print_exc(file=__import__('sys').stdout)
+ pass
+
def getValue(self):
try:
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ni...@us...> - 2010-11-11 14:46:00
|
Revision: 106
http://openautomation.svn.sourceforge.net/openautomation/?rev=106&view=rev
Author: nilss1
Date: 2010-11-11 14:45:53 +0000 (Thu, 11 Nov 2010)
Log Message:
-----------
Fixed time and date for val 0 send current
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-11 14:37:02 UTC (rev 105)
+++ PyWireGate/trunk/knx_connector/DPT_Types.py 2010-11-11 14:45:53 UTC (rev 106)
@@ -21,6 +21,7 @@
### sondern als LIST mit den dezimalen Werten ist das decode hier ein bischen angepasst
import struct
+import time
class dpt_type:
def __init__(self,parent):
@@ -325,7 +326,11 @@
if len(timeval) == 3:
sec = int(timeval[2])
elif type(val) in [float, int]:
- now = time.localtime(val)
+ if val == 0:
+ ## current Time
+ now = time.localtime()
+ else:
+ now = time.localtime(val)
weekday = now[6]
hour = now[3]
min = now[4]
@@ -355,12 +360,12 @@
return u"%02d.%02d.%04d" % (day,mon,year)
def encodeDPT11(self,val):
+ ## make time struct accesible
if type(val) in [float, int]:
- tval = val
+ utime = [v for v in time.localtime(tval)]
else:
- tval =0
- ## make time struct accesible
- utime = [v for v in time.localtime(tval)]
+ utime = [v for v in time.localtime()]
+
if type(val) == str:
datestr = val.split(".")
if len(datestr) == 2:
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|