예제 #1
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")
예제 #2
0
파일: devices.py 프로젝트: AlexKano/pmax
def EnrollDev(typedev,LongID):
	navigator.dev("enroll "+typedev+" "+str(LongID))

	print navigator.read()
	f = open ("Modules"+SEPARATOR +"ShortID.txt","r")
	line = f.readline()
	f.close
	line_split = line.split(",")
	typenumdev = line_split[1]+str(int(line_split[2]))
	ShortID = line_split[0]
	time.sleep(3)
	navigator.dev("update "+str(ShortID)+" " +str(LongID))
	print line
	print typenumdev
	print ShortID
	f = open ("Modules"+SEPARATOR +"devices"+SEPARATOR +"devices.info","a")
	f.write (typenumdev+","+ShortID+ "," + str(LongID)+ "," + typedev + "," )
	f.write ("\n")
	f.close
예제 #3
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])