示例#1
0
 def ConnectToLogger(self):
     Log("viewer", "Application::ConnectToLogger()")
     e32.ao_sleep(3)
     appswitch.switch_to_fg(u"MapViewer")
     self.position = LoggerProperty(EKeyPosition, self.OnPosition)
     self.trackpoint = LoggerProperty(EKeyTrackPoint, self.OnTrackPoint)
     self.course = LoggerProperty(EKeyCourse, self.OnCourse)
示例#2
0
 def ConnectToLogger(self):
     Log("viewer","Application::ConnectToLogger()")
     e32.ao_sleep(3)
     appswitch.switch_to_fg(u"MapViewer")
     self.position = LoggerProperty(EKeyPosition,self.OnPosition)
     self.trackpoint = LoggerProperty(EKeyTrackPoint,self.OnTrackPoint)
     self.course = LoggerProperty(EKeyCourse,self.OnCourse)
示例#3
0
	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')
示例#4
0
	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()
示例#5
0
def handle_sel():
    global entries
    global lb

    sel=appuifw.popup_menu([u'Switch',u'Kill'])
    if sel==0:#switch
        appswitch.switch_to_fg(entries[lb.current()][0])
    elif sel==1:#kill
        appswitch.kill_app(entries[lb.current()][0])
        display()    
    else:
        pass #cancel
示例#6
0
 def zj(cz):
     li = m.current()
     for ii in range(0, len(list_2)):
         if li == ii:
             if cz == 0: appswitch.switch_to_fg(list_2[ii])
             if cz == 1:
                 if A.query(cn("确认关闭吗?\n线程:") + list_2[ii], "query"):
                     try:
                         appswitch.end_app(list_2[ii])
                     except:
                         appswitch.kill_app(list_2[ii])
             page2()
 def select(mode='s'):
     index=a.current()
     cur=list[index]
     if mode=='s':
         appswitch.switch_to_fg(cur)
     elif mode=='c':
         appswitch.end_app(cur)
         if index==0:
             return self.tasks()
         else:
             return self.tasks(index-1)
     elif mode=='k':
         appswitch.kill_app(cur)
         if index==0:
             return self.tasks()
         else:
             return self.tasks(index-1)
     else:
         return 1
示例#8
0
def read_sms():
    ##############################à
    sms_text="#REC#START" # DEBUG*********
    ##############################à
    e32.ao_sleep(0.1)
    #i=inbox.Inbox() #DEBUG
    #sms_text=i.content(id) #DEBUG
    appuifw.note(u"Messaggio da elaborare: " + sms_text, "info")

    # Execute different actions depending on SMS contents:
    if sms_text[0:5] == '#REC#':
      print 'Message received'
      if appswitch.switch_to_fg(APPLICATION_NAME) == 1:
        e32.ao_sleep(1)
        keypress.simulate_key(53,53)
        keypress.simulate_key(54,54)
        keypress.simulate_key(55,55)
        keypress.simulate_key(63495,63495)
        keypress.simulate_key(63495,63495)
        keypress.simulate_key(52,52)
      else:
        print "ERROR: Couldnt bring " + APPLICATION_NAME + " to foreground."  
示例#9
0
    if i.startswith('E'):
        key.append(eval('key_codes' + '.' + i))
rung = 1


class Key:
    def __init__(s):
        s.press = keycapture.KeyCapturer(s.key_callback)
        s.press.keys = (key)

    def start(s):
        s.press.start()

    def key_callback(s, key):
        global rung
        print key
        if key == 8:
            rung = 0
            print 'Exit'
            s.press.stop()


k = Key()
k.start()
print 'Press "C " Key Exit'
while rung:
    if appswitch.application_list(0)[0] != (appname):
        e32.ao_sleep(0.2)
        appswitch.switch_to_fg(appname)
    e32.ao_sleep(0.1)
示例#10
0
    global coba
    coba = 0
    rest()
    app.exit_key_handler = balik


while run:
    aps = application_list(1)[0]

    if coba == 0:
        im.clear(0xd8d8d8)
        im.text((0, c.size[1]), u'Menu', 0x333333, (u'normal', (18)))
        app.menu = [(u'Change pattern', newcode), (u'Exit', quit)]
        if aps in [u'akncapserver']:
            if LockStatus() == 1:
                switch_to_fg(apname)
                try:
                    Unlock()
                except:
                    pass
                coba = 1
        else:
            pass

    if coba == 1:
        app.menu = [(u'Refresh pattern', rest)]
        im.blit(ss)
        y1 = 0
        for j in range(9):
            if j % 3 == 0:
                y1 += 1