def __init__ (self, port=defaultCacheListenerPort, cacheLocation=defaultCacheLocation): super(CacheListener, self).__init__() self.PORT = port self.cacheLocation = cacheLocation self.s = socket.socket(socket.AF_INET, socket.SOCK_STREAM) self.kill_received = False self.children = [] self.cache = shelve.open(get_absolute_path(cacheLocation)) logger.info("Cache at " + self.cacheLocation + ":" + str(self.PORT) + " opened.")
def __init__(self, port=defaultCacheListenerPort, cacheLocation=defaultCacheLocation): super(CacheListener, self).__init__() self.PORT = port self.cacheLocation = cacheLocation self.s = socket.socket(socket.AF_INET, socket.SOCK_STREAM) self.kill_received = False self.children = [] self.cache = shelve.open(get_absolute_path(cacheLocation)) logger.info("Cache at " + self.cacheLocation + ":" + str(self.PORT) + " opened.")
from EnvUtils import isTestEnvironment from ConfUtils import getNodeName,isSiren,isMotion,isDoorWindow,getUserId,setLocalIp from SensorUtils import getSensorState from SirenUtils import getSirenState from CacheUtils import CacheListener import traceback from pymongo import MongoClient from Notification import fromDict logger = setupNotificationHandlerLogger() ListenerPort = 55555 userid = getUserId() if userid == None: usrHomeFolder = get_absolute_path('~/.raspwave') else: usrHomeFolder = os.path.join('/home', userid, '.raspwave') usrHomeRobotsFolder = os.path.join(usrHomeFolder, 'robots') usrHomeScriptsFolder = os.path.join(usrHomeFolder, 'scripts') if isTestEnvironment(): raspscptLocation = get_absolute_path('~/raspwave/sh/raspscpt') etcRobotsFolder = get_absolute_path('~/raspwave/robots') else: raspscptLocation = '/usr/local/bin/raspscpt' etcRobotsFolder = '/etc/raspwave/robots' class Node: def __init__(self, nodeId = None): self.nodeId = nodeId
def getConfig(): config = ConfigParser.ConfigParser() myConfFile = get_absolute_path(confFile) config.read(myConfFile) return config
from LoggerUtils import setupNotificationHandlerLogger, getNotificationHandlerLogger from Notification import Notification, ValueNotification, BatteryValueNotification, NodeEventNotification, ValueChangeNotification, WakeupNotification from Utils import get_absolute_path from EnvUtils import isTestEnvironment from ConfUtils import getNodeName, isSiren, isMotion, isDoorWindow, getUserId, setLocalIp from SensorUtils import getSensorState from SirenUtils import getSirenState from CacheUtils import CacheListener logger = setupNotificationHandlerLogger() ListenerPort = 55555 userid = getUserId() if userid == None: usrHomeFolder = get_absolute_path('~/.raspwave') else: usrHomeFolder = os.path.join('/home', userid, '.raspwave') usrHomeRobotsFolder = os.path.join(usrHomeFolder, 'robots') usrHomeScriptsFolder = os.path.join(usrHomeFolder, 'scripts') if isTestEnvironment(): raspscptLocation = get_absolute_path('~/raspwave/sh/raspscpt') etcRobotsFolder = get_absolute_path('~/raspwave/robots') nhShelfLocation = get_absolute_path('~/raspwave/db/nh.shelf') else: raspscptLocation = '/usr/local/bin/raspscpt' etcRobotsFolder = '/etc/raspwave/robots' nhShelfLocation = '/etc/raspwave/db/nh.shelf'