'''configuration'''
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 test'''
'''start initialization'''
# adbwrapper1.initialization()
# dut[0].initialize(androiddevicebt2.commandfile)
# dut[0].startstop(androiddevicebt2.commandfile)
# adbwrapper1.adbpush(dut[0].deviceid,dut[0].commandfile,androiddevicebt2.objectpath)
result=tcpwrapper1.serverreceive(1,utils.enums.noticeevent.advertising.value,'',utils.enums.Tcpport.port3.value)
if result:
	dut[0].scanforname1(1,androiddevicebt2.advname,addrflag=1)
	time.sleep(5)
	if dut[0].remoteaddr:
		print(len(dut[0].remoteaddr))
		dut[0].removecommandfile(dut[0].commandfile)
		dut[0].createcommandfile2(dut[0].commandfile)
		dut[0].turnonLE()
		command1=dut[0].scanandconnect(1,dut[0].remoteaddr,androiddevicebt2.datalength)
		dut[0].startstop(androiddevicebt2.commandfile)
		adbwrapper1.adbpush(dut[0].deviceid,dut[0].commandfile,androiddevicebt2.objectpath)
result1=dut[0].verifycommands(androiddevicebt2.objectpath,androiddevicebt2.commandfile,androiddevicebt2.resultfile,androiddevicebt2.outputfile)
if result1[0]:
	tcpwrapper1.sendverify(utils.enums.Hostname.BTTESTWS2.value,utils.enums.noticeevent.notificaitoninterval.value,utils.enums.Tcpport.port4.value)
            bt=True,
            btle=True,
            sequence=(devicelist.index(device) + 1),
            commandfile=androiddevicebt2.commandfile,
            objectpath=androiddevicebt2.objectpath,
        )
    )


"""start initialization"""
# adbwrapper1.initialization()
# dut[0].initialize(androiddevicebt2.commandfile)
# numberlist=1
# for i in range(numberlist):
# 	dut[0].advertising(serial=1,instance=i+1,advmode=utils.enums.Advertisingmode.lowlatency.value,advpower=utils.enums.Advertisingpower.highpower.value,connectable=utils.enums.Connectable.connectable.value,timeout=0,datalength=251,name=androiddevicebt2.advname,remotehost='WCONNECT-BT-39')
# dut[0].startstop(androiddevicebt2.commandfile)
# adbwrapper1.adbpush(dut[0].deviceid,dut[0].commandfile,androiddevicebt2.objectpath)
# result=dut[0].verifycommands(androiddevicebt2.objectpath,androiddevicebt2.commandfile,androiddevicebt2.resultfile,androiddevicebt2.outputfile)
# if dut[0].verifycommandpass(result[1]):
# 	tcpwrapper1.connect1(utils.enums.Hostname.WCONNECTBT39.value,utils.enums.Tcpport.port3.value)
# 	tcpwrapper1.senddata(utils.enums.noticeevent.advertising.value)

tcpwrapper1.connect1(utils.enums.Hostname.WCONNECTBT39.value, utils.enums.Tcpport.port3.value)
tcpwrapper1.senddata(utils.enums.noticeevent.advertising.value)
time.sleep(1)
result = tcpwrapper1.serverreceive(
    1, utils.enums.noticeevent.notificaitoninterval.value, "", utils.enums.Tcpport.port4.value
)
if result:
    print("going to execute the change inteval")
示例#3
0
#!/usr/bin env python 3.4

import os
import subprocess 
import androiddevicebt2
from utils.tcpwrapper import Tcpwrapper
from androiddevicebt2 import Androiddevicebt2
from utils.adbwrapper import adbwrapper
import sendcommand,subprocess
import test,time,datetime
import utils.enums
import androiddevicebt
from Basetest import Basetest
import loggingv1,sys

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))


tcpwrapper1.serverreceive(1,enums.noticeevent.advertising.value,'',enums.Tcpport.port3.value)
if(dut[0].scanforname1(1,androiddevicebt2.advname)):
	dut[0].createcommandfile2(dut[0].commandfile)
	command1=dut[0].scanandconnect(1,dut[0].remoteaddr,androiddevicebt2.datalength)
tcpwrapper1.sendverify(utils.enums.BTTESTWS2.value,enums.noticeevent.notificaitoninterval.value,enums.Tcpport.port4.value)
dut[0].writedescriptor(1,enums.UUID16bit.UUID0.value,enums.Characteristic.CID0.value,enums.Descriptor.DES0.value,enums.readwriteoperation.operationwrite.value,writedata=enums.writedata.notification.value)