def executing1(self,command,addrflag=0): adbwrapper1=adbwrapper() self.removecommandfile(self.commandfile) self.createcommandfile2(self.commandfile) self.onecommmand(command,self.commandfile) adbwrapper1.adbpush(self.deviceid,self.commandfile,self.objectpath) result=self.verifycommands(self.objectpath,self.commandfile,resultfile,outputfile) if result[0]: self.logger.info("Command executing pass") else: self.logger.info("Command executing fail") if addrflag==1: addr=self.getadvtiseraddress(result[1]) if addr!=-1: self.remoteaddr=addr return True; else: return False else: for line in result[1]: if 'PASS' in line: return True else: return False
sys.path.insert(0,'C:\\Users\\asiaynrf\\Documents\\GitHub\\Workspace\\lib') import utils.tcpwrapper import utils.adbwrapper from utils.adbwrapper import adbwrapper from utils.tcpwrapper import Tcpwrapper import subprocess import enums,test,time,datetime import androiddevicebt2 from androiddevicebt2 import Androiddevicebt2 import loggingv1 '''device initiliazation''' #devicelist=adbmodule.initialization() testname="MA 6 instances" instancenumber=input("Please input the number of advertising instance you want to advertise:") adbwrapper1=adbwrapper() tcpwrapper1=Tcpwrapper() devicelist=adbwrapper1.adbdevice() dut=[] for device in devicelist: dut.append(Androiddevicebt2(deviceid=device,bt=True,btle=True,sequence=(devicelist.index(device)+1),commandfile=androiddevicebt2.commandfile,objectpath=androiddevicebt2.objectpath)) '''start initialization''' adbwrapper1.initialization() dut[0].initialize(androiddevicebt2.commandfile) dut[0].setname(1,androiddevicebt2.advname) numberlist=int(instancenumber) for i in range(numberlist): dut[0].advertising(serial=1,instance=i+1,advmode=enums.Advertisingmode.lowlatency.value,advpower=enums.Advertisingpower.highpower.value,connectable=enums.Connectable.notconnectable.value,timeout=0,datalength=251) dut[0].startstop(androiddevicebt2.commandfile) adbwrapper1.adbpush(dut[0].deviceid,dut[0].commandfile,androiddevicebt2.objectpath)