def show(self): self.battery = Battery() self.wifi = Wifi() self.url = QUrl("qt.html") self.web = QWebView() self.web.loadFinished.connect(self.onLoad) self.web.load(self.url) self.web.show()
class PresenceReader(object): def __init__(self, known_devices: typing.Dict[typing.Text, typing.Any]) -> None: self.wifi = Wifi(known_devices) def name(self) -> typing.Text: return 'presence' def fields(self) -> typing.List[typing.Text]: return ['Count'] def readValues(self) -> typing.Dict[typing.Text, typing.Any]: presence_count = self.wifi.read_presence_count() return {'Count': presence_count}
def __init__(self): # Load configuration values & initialize class variables self.disableLogging = config.general['disableLogging'] self.mediaRendererModelName = config.general['mediaRendererModelName'] self.lastRFIDCard = '' self.initializeWifi = False # Set up logging self.logger = logging.getLogger('DigitaleKassette') self.logger.setLevel(logging.DEBUG) ch = logging.StreamHandler() ch.setLevel(logging.DEBUG) formatter = logging.Formatter('%(asctime)s - %(name)s - %(levelname)s - %(message)s') ch.setFormatter(formatter) self.logger.addHandler(ch) self.logger.disabled = self.disableLogging os.system('gmediarender start &') time.sleep(5) # Initialize UPnP connection and discover devices self.uPNPController = UPNPController() self.uPNPController.discoverDevices() self.uPNPController.getDeviceInformation() self.uPNPController.getDeviceByModelName('MediaRenderer', self.mediaRendererModelName) self.uPNPController.getDevicesByDeviceType('urn:schemas-upnp-org:device:MediaServer:1', 'MediaServer') # Initialize ActionDB self.actionData = ActionData() # Initialize RFID-Reader self.reader = RFIDReader(True) # Initialize JukeBox self.jb = JukeBox(self.uPNPController, self.actionData) # Initalize Wifi self.wifi = Wifi() if not self.wifi.isConnected(): self.initializeWifi = True self.wifi.startAccessPoint() # Initialize WebApp self.webApp = WebApp(self.uPNPController, self.actionData, self, self.wifi, self.initializeWifi)
class DigitaleKassette(threading.Thread): def __init__(self): # Load configuration values & initialize class variables self.disableLogging = config.general['disableLogging'] self.mediaRendererModelName = config.general['mediaRendererModelName'] self.lastRFIDCard = '' self.initializeWifi = False # Set up logging self.logger = logging.getLogger('DigitaleKassette') self.logger.setLevel(logging.DEBUG) ch = logging.StreamHandler() ch.setLevel(logging.DEBUG) formatter = logging.Formatter('%(asctime)s - %(name)s - %(levelname)s - %(message)s') ch.setFormatter(formatter) self.logger.addHandler(ch) self.logger.disabled = self.disableLogging os.system('gmediarender start &') time.sleep(5) # Initialize UPnP connection and discover devices self.uPNPController = UPNPController() self.uPNPController.discoverDevices() self.uPNPController.getDeviceInformation() self.uPNPController.getDeviceByModelName('MediaRenderer', self.mediaRendererModelName) self.uPNPController.getDevicesByDeviceType('urn:schemas-upnp-org:device:MediaServer:1', 'MediaServer') # Initialize ActionDB self.actionData = ActionData() # Initialize RFID-Reader self.reader = RFIDReader(True) # Initialize JukeBox self.jb = JukeBox(self.uPNPController, self.actionData) # Initalize Wifi self.wifi = Wifi() if not self.wifi.isConnected(): self.initializeWifi = True self.wifi.startAccessPoint() # Initialize WebApp self.webApp = WebApp(self.uPNPController, self.actionData, self, self.wifi, self.initializeWifi) def onNewConnection(self): os.system('gmediarender start &') time.sleep(5) self.uPNPController.discoverDevices() self.uPNPController.getDeviceInformation() self.uPNPController.getDeviceByModelName('MediaRenderer', self.mediaRendererModelName) self.uPNPController.getDevicesByDeviceType('urn:schemas-upnp-org:device:MediaServer:1', 'MediaServer') #os.system('sudo fuser -k 80/tcp') #self.webApp = WebApp(self.uPNPController, self.actionData, self, self.wifi, False) #Ready: make some noise os.system('mpg321 audio/beep.mp3 &') def lockRFID(self): if(self.jb.rfidIsLocked == False): self.jb.rfidIsLocked = True time.sleep(self.jb.rfidLockIntervall) self.jb.rfidIsLocked = False #hide last card from Jukebox self.reader.lastID = '' return True else: self.logger.error('RFIDReader is already locked...') return False
from Wifi import Wifi print "\033[32m" + " _ ___ _____ ______ __ " print " | | / (_) __(_)_ __/___ / / ____ _ _____ _____ " print " | | /| / / / /_/ / / / / __ \/ / / __ \ | /| / / _ \/ ___/ " print " | |/ |/ / / __/ / / / / /_/ / /___/ /_/ / |/ |/ / __/ / " print " |__/|__/_/_/ /_/ /_/ \____/_____/\____/|__/|__/\___/_/ " print " " print " by An0n " + "\033[0;0m" print "\n " bssid = raw_input("Insira o BSSID: ") channel = raw_input("Insira o Canal: ") interfaceRede = raw_input("Insira sua interface de rede: ") opc = 0 wifi = Wifi(bssid, channel, interfaceRede) while opc != 6: opc = input( "\n 1 - Iniciar Modo Monitor \n 2 - Parar Modo Monitor \n 3 - Encontrar Redes Proximas \n 4 - Monitorar Rede Alvo \n 5 - Derrubar Rede \n 6 - Sair \n >> " ) if opc == 1: wifi.iniciarModoMonitor() elif opc == 2: wifi.pararModoMonitor() elif opc == 3: wifi.scannerRedes() elif opc == 4:
def __init__(self, known_devices: typing.Dict[typing.Text, typing.Any]) -> None: self.wifi = Wifi(known_devices)