def __init__(self,componentId,xmlname): Component.generic.__init__(self,componentId) self.configuration=XmlDict.loadXml(xmlname) self.xmlname=xmlname #self.configuration=XmlDict.loadXml("global.xml") # Load Configuration for reading (input) self.modbus_ip=self.configuration["ip"]; self.modbus_period=1/float(self.configuration["update_frequency"]) self.modbus_read_adres=int(self.configuration["input"]["modbus_adres"]) self.modbus_read_size=int(self.configuration["input"]["modbus_register_count"]) self.modbus_read_type=[''] * self.modbus_read_size self.modbus_read_analog_threshold=[''] * self.modbus_read_size self.modbus_read_analog_scale=[''] * self.modbus_read_size self.modbus_read_event=[] # Load Configuration for writing (output) self.modbus_write_adres=int(self.configuration["output"]["modbus_adres"]) self.modbus_write_size=int(self.configuration["output"]["modbus_register_count"]) self.modbus_write_dict={} self.modbus_write_image=[0] * self.modbus_write_size self.modbus_write_event=[] self.prepareInputs() self.prepareOutputs() self.state_read_old = [0] * self.modbus_read_size self.state_read_new = [0] * self.modbus_read_size self.state_write = [0] * self.modbus_write_size self.state_write_changed=True
def __init__(self,componentId,xmlname): Component.generic.__init__(self,componentId) self.configuration=XmlDict.loadXml(xmlname) self.xmlname=xmlname # Load Configuration for reading (input) self.rfid_serial_dev=self.configuration["serial_device"]; self.rfid_serial_timeout=int(self.configuration["serial_timeout"]);
def __getXMLDict(self, xml, encoding="latin9"): """ parse xml into dict @param xml: xml data @type xml: string """ tree = ElementTree.XML(xml.decode(encoding).encode('utf-8')) return XmlDict.XmlDict(tree)
def load_config(): # logger.info("Loading Config...") global conf conf=XmlDict.loadXml("global.xml")
def load_config(): logger.info("Loading Config...") conf=XmlDict.loadXml("config/global.xml") GlobalObjects.config_webinterface = conf["webinterface"] GlobalObjects.config_model = conf["componentModel"]
#!/usr/bin/python import sys,os from email.Utils import COMMASPACE, formatdate from email.MIMEMultipart import MIMEMultipart from email.MIMEText import MIMEText from email.MIMEImage import MIMEImage from email.MIMEImage import MIMEImage from email.MIMEBase import MIMEBase from email import Encoders import smtplib import XmlDict function=sys.argv[1] user=sys.argv[2] filename=sys.argv[3] conf = XmlDict.loadXml("global.xml") for option in conf["menu"]["option"]: if ((option["type"].lower()==function.lower()) and (option["name"]==user)): option_selected = option msg = MIMEMultipart() msg['Subject'] = conf["subject"] msg['From'] = conf["source"] msg['To'] = COMMASPACE.join([option_selected["config"]]) msg['Date'] = formatdate(localtime=True) text = "Your scanner happely delivered this pdf to your mailbox.\n" msg.attach( MIMEText(text) )