# Path: LoggingUtils.py
# def log(msg):
#     tnow = datetime.now()
#     logging.info('%s' % msg)


import socket
import logging
    import logging
from zeroconf import ServiceInfo, Zeroconf
from twisted.internet import reactor
from twisted.internet.task import LoopingCall
from LoggingUtils import log
    from twisted.internet import stdio
    from twisted.protocols import basic
        from os import linesep as delimiter



class ZeroConfServer:
    def __init__(self, portNumber):
        self.portNumber = portNumber
        self.loop = LoopingCall(self.searchForIpAddress)
        self.loop.start(2)

    def registerService(self, ip):
        info = ServiceInfo("_http._tcp.local.",
                           "Raspberry Pi Sleep Monitor._http._tcp.local.",
                           socket.inet_aton(ip), self.portNumber, 0, 0,
                           {}, "sleepmonitor.local.")

        zeroconf = Zeroconf()
        log("Registering zeroconf service...")
        zeroconf.register_service(info)

        def unregisterService():

# Path: LoggingUtils.py
# def log(msg):
#     tnow = datetime.now()
#     logging.info('%s' % msg)


# Path: ZeroConfUtils.py
import socket
import logging
    import logging
from zeroconf import ServiceInfo, Zeroconf
from twisted.internet import reactor
from twisted.internet.task import LoopingCall
from LoggingUtils import log
    from twisted.internet import stdio
    from twisted.protocols import basic
        from os import linesep as delimiter




class ZeroConfServer:
    def __init__(self, portNumber):
        self.portNumber = portNumber
        self.loop = LoopingCall(self.searchForIpAddress)
        self.loop.start(2)

    def registerService(self, ip):
        info = ServiceInfo("_http._tcp.local.",
                           "Raspberry Pi Sleep Monitor._http._tcp.local.",
                           socket.inet_aton(ip), self.portNumber, 0, 0,
                           {}, "sleepmonitor.local.")

        zeroconf = Zeroconf()
        log("Registering zeroconf service...")
        zeroconf.register_service(info)

        def unregisterService():

            log("Unregistering zeroconf service...")