def __init__(self, bif=None, dbfile=DBFILE): """ create a new BaseLogger and connect it to the sensor source (bif) and the database (dbfile). """ self.engine = create_engine(dbfile, echo=False) init_model(self.engine) self.metadata = Base.metadata if bif is None: self.bif = BaseIF("sf@localhost:9002") else: self.bif = bif
def __init__(self, bif=None, dbfile=DBFILE): """ create a new BaseLogger and connect it to the sensor source (bif) and the database (dbfile). """ self.engine = create_engine(dbfile, echo=False) #init_model(self.engine) models.initialise_sql(self.engine) #self.metadata = Base.metadata if bif is None: self.bif = BaseIF("sf@localhost:9002") else: self.bif = bif self.log = logging.getLogger("baselogger") self.running = True
default="info", metavar="LEVEL") (options, args) = parser.parse_args() if len(args) != 0: parser.error("incorrect number of arguments") LEVEL_MAP = { "debug": logging.DEBUG, "info": logging.INFO, "warning": logging.WARNING, "error": logging.ERROR, "critical": logging.CRITICAL } if options.log_level not in LEVEL_MAP: parser.error("invalid LEVEL: " + options.log_level) bif = BaseIF("sf@localhost:9002") seq = 0 time.sleep(2) while True: seq = 1 print "sending ack" send_ack(bif=bif, seq=seq, dest=19) #seq = 1 #if seq > 255: # seq = 0 time.sleep(2)