def startService(self): """Initiates the bluetooth sockets and listen for a connection""" self.serverSocket = bt.socket(bt.AF_BT,bt.SOCK_STREAM) #Gets a free channel for communication self.channel = bt.bt_rfcomm_get_available_server_channel(self.serverSocket) #Binds the socket to that channel and listen for connection self.serverSocket.bind(("",self.channel)) bt.bt_advertise_service( self.serviceName, self.serverSocket, True, bt.RFCOMM ) bt.set_security(self.serverSocket, bt.AUTHOR | bt.AUTH ) self.serverSocket.listen(1) #Forking into the background appswitch.switch_to_fg(u'PythonScriptShell') ui.note(u"SmsConsole: Waiting for connections","info") appswitch.switch_to_bg(u'PythonScriptShell') self.clientConn,self.clientAddr = self.serverSocket.accept() appswitch.switch_to_fg(u'PythonScriptShell') ui.note(u"Client %s Connected" % (self.clientAddr), "info") appswitch.switch_to_bg(u'PythonScriptShell')
def sendData(self): """docstring for sendData""" if len(self.data) == 4 and self.data[3] == "1": appswitch.switch_to_fg(u'PythonScriptShell') ui.note(u"Sending msg: %s" % (self.data[1]),"info") appswitch.switch_to_bg(u'PythonScriptShell') self.sms.name = u"%s" % (self.data[2]) self.sms.msg = u"%s" % (self.data[1]) self.sms.number = u"%s" % (self.data[0]) self.sms.sendMsg()
def run(self): self.app_lock = e32.Ao_lock() appuifw.app.title = APPNAME appswitch.switch_to_bg(APPNAME) appuifw.app.body = appuifw.Text() appuifw.app.menu = self.createMenu() appuifw.app.exit_key_handler=self.quit self.app_lock.wait()
def balik(): global coba if coba == 0: switch_to_bg(application_list(1)[0])
x1 = 0 else: x1 += 1 X = x1 * axy Y = y1 * axy pos = (w + X + margin_x, h + Y + margin_y) im.blit(point, mask=tomask(point), target=(pos[0], pos[1])) del y1 if kode == openn: note(u'Unlocked!', 'conf') vpos = [] kode = [] tmp = [] sc = 0 coba = 0 switch_to_bg(apname) else: if aps not in [apname]: switch_to_fg(apname) if len(kode) >= len(openn): note(u'Wrong pattern\nPlease Try Again', 'error') vpos = [] kode = [] tmp = [] sc = 0 y1 = 0 for j in range(9): if j % 3 == 0: y1 += 1 x1 = 0 else: