コード例 #1
0
ファイル: navigator.py プロジェクト: AlexKano/pmax
def waitforOnIPMP(channel, string, timeout= 100,num= 1):
	for k in range(timeout*100):
		rl, wl, xl = select.select([channel],[],[],0.0)
		if len(rl) > 0:
			# Must be stdout
			str1 = channel.recv(1024)
			str_split = str1.split("\n")
			L = len (str_split)
			for l in range (L):
				out.prnt(str1,"ipmp")
				#print str1
				data = string.split('***')
				lens = len(data)
				res = 1
				for i in range(lens) :
					if (data[i] in str_split[l]) ==0 : res = 0
				if res == 1:
				
					#out.prnt(str(num) + " Event " + string + " is received on IPMP")
					strlog = str_split[l].split("(D)")
					
					if len (strlog) > 1 :out.prnt(str(num)+" " + strlog[0][:15]+"->" + strlog[1])
					else : out.prnt (str_split)
					return 1
		time.sleep(0.01)
		
	out.prnt ("Time out "+str(timeout)+" s","all+error")
	out.prnt ("no possible to find "+ string+ "----------ERRORIPMP------------","all+error")
	#strlcd = read()	
	#out.prnt("LCD display: "+strlcd)
	return 0
コード例 #2
0
ファイル: navigator.py プロジェクト: AlexKano/pmax
def search_menu(menu, maxsearch = 100):
    LCD = read()

    if menu in LCD: 
        time.sleep(0.1)
    	return 1
    for k in range(maxsearch):
        send_key('next',0.1)
        LCD = read()
        #out.prnt (LCD + " "+ str(k))  
	if menu in LCD: 
		#time.sleep(0.1)
		return 1
    out.prnt ("Not found menu " + menu 	)
    return 0
コード例 #3
0
ファイル: devices.py プロジェクト: AlexKano/pmax
def GenEvent(typeofdevice,num,event,timebefore = 5):
	typeofdevicenum = typeofdevice+str(num)
	time.sleep(timebefore)
	flag = 0
	f = open ("Modules"+SEPARATOR +"devices"+SEPARATOR +"devices.info","r")
	for line in f:
		data= line.split(',')
		#print data[0]
		#print "\ndfsdfsd"
		if data[0] == typeofdevicenum:
			navigator.dev(event +" "+data[1]+" "+data[2])
			flag = 1
			break
	if flag == 0:
		out.prnt("Warning: NO found virtual device: "+typeofdevicenum+"\n")
コード例 #4
0
ファイル: navigator.py プロジェクト: AlexKano/pmax
def waitfor1(string1,string2,string3,timeout=60,string4 = "afdfasdf"):
	for k in range(timeout*3):
		LCD1 = read()
		#out.prnt(LCD1)
		res1 = string1 in LCD1 
		res2 = string2 in LCD1 
		res3 = string3 in LCD1 
		res4 = string4 in LCD1 
		res = res1 or res2 or res3 or res4
		if res == True:
			print (LCD1+" contains "+string1+" or "+string2+" or "+string3+" or ")
			return 1
		time.sleep(0.33)
	#out.prnt ("Time out "+str(timeout)+" s","all+error")
	out.prnt ("not found "+ string1+ ".Trying again ","all")
	strlcd = read()	
	out.prnt("LCD display: "+strlcd)
	return 0
コード例 #5
0
ファイル: devices.py プロジェクト: AlexKano/pmax
def UpdateDev(typeofdevice = "all", num = 1,time_sleep = 1):
	if typeofdevice != "all":
		typeofdevicenum = typeofdevice+str(num)
		flag = 0
		f = open ("Modules"+SEPARATOR +"devices"+SEPARATOR +"devices.info","r")
		for line in f:
			time.sleep(time_sleep)	
			data= line.split(',')
			#print data[0]
			#print "\ndfsdfsd"
			if data[0] == typeofdevicenum:
				navigator.dev("update " +data[1]+" "+data[2])
				flag = 1
				break
		if flag == 0:
			out.prnt("Warning: NO found virtual device: "+typeofdevicenum+"\n")
	if typeofdevice == "all":
		f = open ("Modules"+SEPARATOR +"devices"+SEPARATOR +"devices.info","r")
		for line in f:
			time.sleep(time_sleep)
			data= line.split(',')
			navigator.dev("update " +data[1]+" "+data[2])
コード例 #6
0
ファイル: navigator.py プロジェクト: AlexKano/pmax
def send_key(key,tm = 0.4):
    i = 0
    for i in range (5):
    	    tm = 0.06
	    lcd = ""
	    lcdafter = "1"
	    time.sleep(tm)
	    lcd = read()
	    time.sleep(tm)		
	    send_key_fast(key,tm = 0)
	    if key == "ok":    time.sleep(tm)
	    else :   time.sleep(tm)
	    lcdafter = read()
	    if lcdafter != lcd :
	    	#out.prnt("OK")
	    	break
	    time.sleep(3)	
	    lcdafter = read()
	    if lcdafter != lcd :
	    	out.prnt("OK3")
	    	break	
	    out.prnt("Trying to retry " + str(i+1))	
    time.sleep(tm)	    
コード例 #7
0
ファイル: navigator.py プロジェクト: AlexKano/pmax
def waitfor(string1,timeout=60):
	for k in range(timeout*3):
		LCD1 = read()
		#out.prnt(LCD1)
		res = string1 in LCD1 
		if res == True:
			print (LCD1+" contains "+string1)
			return 
		time.sleep(0.33)
	out.prnt ("Time out "+str(timeout)+" s","all+error")
	out.prnt ("no possible to find "+ string1+ "----------ERROR------------","all+error")
	strlcd = read()	
	out.prnt("LCD display: "+strlcd)
コード例 #8
0
ファイル: navigator.py プロジェクト: AlexKano/pmax
def WaitFor(List,timeout=60):
	for k in range(timeout*3):
		LCD1 = read()
		#out.prnt(LCD1)
		
		for c in List:
			res = c in LCD1 
			if res == True:
				print (LCD1+" contains "+c)
				return 1
		time.sleep(0.33)
	out.prnt ("Time out "+str(timeout)+" s","all+error")
	sep = ","
	out.prnt ("no possible to find "+ sep.join(List) + "----------ERROR------------","all+error")
	strlcd = read()	
	out.prnt("LCD display: "+strlcd)
	return 0
コード例 #9
0
ファイル: navigator.py プロジェクト: AlexKano/pmax
def waitforany(string1,timeout=60):
	res=False
	for k in range(timeout*3):
		LCD1 = read()
		#out.prnt(LCD1)
		for i in string1:
			if i in LCD1:
				res=True
				string2=i
				break
		if res == True:
			print (LCD1+" contains "+string2)
			return 
		time.sleep(0.33)
	out.prnt ("Time out "+str(timeout)+" s","all+error")
	out.prnt ("no possible to find any string----------ERROR------------","all+error")
	strlcd = read()	
	out.prnt("LCD display: "+strlcd)