예제 #1
0
    def __init__(self, hostname=None, bt=0, daemon=True, *args, **kwargs):
        if hostname is None:
            hostname = getHostname()

        self.omron = OmronEnvSensor(hostname, bt)
        self.omron.on_message = self.callback

        super(EnvTread, self).__init__(daemon=daemon, *args, **kwargs)
예제 #2
0
def main():
    sys.stdout.write(csv_header())
    sys.stdout.write("\r\n")

    before_seq = None
    o = OmronEnvSensor(getHostname(), BLUETHOOTH_DEVICEID)

    def callback(beacon):
        sys.stdout.write(beacon.csv_format())
        sys.stdout.write("\r\n")

    o.on_message = callback
    o.init()
    o.loop()
예제 #3
0
def main():
    import logging
    logger.setLevel(logging.INFO)
    logger.addHandler(logging.StreamHandler(stream=sys.stdout))

    before_seq = None
    o = OmronEnvSensor(getHostname(), BLUETHOOTH_DEVICEID)

    def callback(beacon):
        beacon.debug_print(logger)
        # logger.info(beacon.bt_address)

    o.on_message = callback
    o.init()
    o.loop()