''' self.seq += 1 self.freq = round(self.freq + random.uniform(-1, 1), 3) self.mag = round(self.mag + random.uniform(-0.5, 0.5), 2) self.tamb = round(self.tamb + random.uniform(-2, 2), 1) self.tsky = self.tamb - 30 self.tstamp = datetime.datetime.utcnow().strftime(TSTAMP_FORMAT) #self.tstamp = (datetime.datetime.utcnow() + datetime.timedelta(minutes=1)).strftime(TSTAMP_FORMAT) return { 'seq': self.seq, 'name': NAME, 'freq': self.freq, 'mag': self.mag, 'tamb': self.tamb, 'tsky': self.tsky, 'rev': PROTOCOL_REVISION, 'tstamp': self.tstamp, } log = Logger() startLogging() setLogLevel(namespace=None, levelStr='debug') factory = MQTTFactory(profile=MQTTFactory.PUBLISHER) point = TCP4ClientEndpoint(reactor, "test.mosquitto.org", 1883) tess = TESS() point.connect(factory).addCallback(tess.gotProtocol) reactor.run()
from tessdb.config import VERSION_STRING, cmdline, loadCfgFile from tessdb.tessdb import TESSDBService from tessdb.dbservice import DBaseService from tessdb.mqttservice import MQTTService from tessdb.filterservice import FilterService # Read the command line arguments and config file options cmdline_opts = cmdline() config_file = cmdline_opts.config if config_file: options = loadCfgFile(config_file) else: options = None # Start the logging subsystem startLogging(console=cmdline_opts.console, filepath=cmdline_opts.log_file) # ------------------------------------------------ # Assemble application from its service components # ------------------------------------------------ application = Application("TESSDB") tessdbService = TESSDBService(options['tessdb'], config_file) tessdbService.setName(TESSDBService.NAME) tessdbService.setServiceParent(application) dbaseService = DBaseService(options['dbase']) dbaseService.setName(DBaseService.NAME) dbaseService.setServiceParent(tessdbService)
self.seq += 1 self.freq = round(self.freq + random.uniform(-1,1), 3) self.mag = round(self.mag + random.uniform(-0.5,0.5), 2) self.tamb = round(self.tamb + random.uniform(-2,2), 1) self.tsky = self.tamb - 30 self.tstamp = datetime.datetime.utcnow().strftime(TSTAMP_FORMAT) #self.tstamp = (datetime.datetime.utcnow() + datetime.timedelta(minutes=1)).strftime(TSTAMP_FORMAT) return { 'seq': self.seq, 'name' : NAME, 'freq' : self.freq, 'mag' : self.mag, 'tamb' : self.tamb, 'tsky' : self.tsky, 'rev' : PROTOCOL_REVISION, 'tstamp': self.tstamp, } log = Logger() startLogging() setLogLevel(namespace=None, levelStr='debug') factory = MQTTFactory(profile=MQTTFactory.PUBLISHER) point = TCP4ClientEndpoint(reactor, "test.mosquitto.org", 1883) tess = TESS() point.connect(factory).addCallback(tess.gotProtocol) reactor.run()
from tessdb.tessdb import TESSDBService from tessdb.dbservice import DBaseService from tessdb.mqttservice import MQTTService # Read the command line arguments and config file options cmdline_opts = cmdline() config_file = cmdline_opts.config if config_file: options = loadCfgFile(config_file) else: options = None # Start the logging subsystem log_file = options['tessdb']['log_file'] startLogging(console=cmdline_opts.console, filepath=log_file) # ------------------------------------------------ # Assemble application from its service components # ------------------------------------------------ application = Application("TESSDB") tessdbService = TESSDBService(options['tessdb'], config_file) tessdbService.setName(TESSDBService.NAME) tessdbService.setServiceParent(application) dbaseService = DBaseService(options['dbase']) dbaseService.setName(DBaseService.NAME) dbaseService.setServiceParent(tessdbService)