def edit_video(self): Command(Video_Comm['MORE']).start() time.sleep(2) Command(Video_Comm['EDITOR']).start() time.sleep(1) Command(Video_Comm['CHOICCE']).start() time.sleep(1)
def main(): Command('sudo chmod 777 /dev/ttyRelayCard').start() #close devices relay_devices=Relayed_device('/dev/ttyRelayCard','65') relay_devices.power_off() relay_devices.write('6E') relay_devices.close() time.sleep(20) #start relycard relay_devices=Relayed_device('/dev/ttyRelayCard','65','69') #enter in dnx model relay_devices.enter_dnx() relay_devices.close() #close relay ports relay_devices=Relayed_device('/dev/ttyRelayCard','6f','73') relay_devices.close_dnx() relay_devices.close() #copy flash file # flashfile = Flashfile(path) # flashfile.extract_flash_file(os.path.join(path,'flash.zip')) #flash devices os.chdir(path) for i in cmd_list: print(i) Command(i).start(80) time.sleep(200) plugin_set() set_up() swtich_ARP()
def check_info(self): Command('adb -host shell input longtap 60 180').start() status = checkfile.check_stauts('text="详细信息"') if status == True: time.sleep(2) Command('adb -host shell input tap 100 630').start() logger.info('check the wlan info')
def seek_video(self,count): i = 0 while i < count: Command(Video_Comm['SEEK_START_LOCAL']).start() status,output,error=Command(Video_Comm['SEEK_RETURN_LOCAL']).start() BaseAPI().check_adb_command('ret = true',output) i+=1 logger.info("seek the video try: %d" %(i))
def play_video(self): time.sleep(5) Command(Video_Comm['PLAYVIDEO']).start() status = checkfile.check_stauts('resource-id="playerView"') if status == True: Command('adb -host shell input tap 500 600').start() logger.info('play video is success') else: raise Exception('play video is failed')
def click_adapter_name(self): try: checkfile.check_stauts('text="点击更改设备名称"') Command(BT_Comm['CHANGE_ADAPTER_NAME']).start() time.sleep(1) Command(BT_Comm['DEVICE_NAME']).start() BaseAPI().longpress_delete() except Exception, msg: logger.debug('Exception:%s' % msg) exit(1)
def camera_button(self): check_status = Command(Camera_Comm['CLICK']).start() logger.info(check_status) time.sleep(1) Command(Camera_Comm['CAMERA_FILE']).start() time.sleep(2) status = checkfile.check_stauts('page://gallery.yunos.com/Gallery') if status == True: logger.debug('take picture is successed') else: raise Exception('take picture is failed')
def delete_recorder(self): self.launch_recor_package() status = checkfile.check_stauts('text="录音列表"') if status == False: count = 3 else: count = 2 for i in range(count): Command(Recorder_Comm['RECORDER_LIST']).start() Command(Recorder_Comm['DELETE']).start() checkfile.click('text="确定"')
def swtich_ap_connect(self,args): checkfile.click(args) time.sleep(2) Command(WIFI_Comm['PASSWORD']).start() time.sleep(2) Command(WIFI_Comm['SELECT_RITHT']).start() time.sleep(10) status=checkfile.check_stauts('text="已连接"') if status == False: raise Exception('connect the wifi is failed') else: logger.info('connect the wifi is success')
def launch_wifi(self): base.find_setting() Command(WIFI_Comm['LANCH_WIFI']).start() time.sleep(1) status = checkfile.check_stauts('checked="true"') if status == False: Command(WIFI_Comm['SWITCH_WIFI_STATUS']).start() time.sleep(2) new_stauts = checkfile.check_stauts('text="WLAN 列表"') if new_stauts == False: raise Exception('launch wifi is failed') else: logger.info('launch wifi is success')
def delete_recorder(self): self.launch_recor_package() status = checkfile.check_stauts('text="录音列表"') if status == False: count = 3 else: count = 2 for i in range(count): Command(Recorder_Comm['RECORDER_LIST']).start() Command(Recorder_Comm['DELETE']).start() status, output, error = Command( Recorder_Comm['CONFRIM_DELETE']).start() BaseAPI().check_adb_command('ret = true', output)
def revert_adapter_name(self): try: self.click_adapter_name() Command('adb -host shell input text Peacock').start() time.sleep(1) Command(BT_Comm['ENSURE_CHANGENAME_BUTTON']).start() time.sleep(1) stauts = checkfile.check_stauts('text="Peacock"') if stauts == True: logger.info('SUCESS:finished the revert adapter name') else: raise Exception('FAIL:revert the adapter occur with issue') except Exception, msg: logger.debug('Exception:%s' % msg) exit(1)
def start_address_4(self,count): i = 0 while i < count: Command(GFX_Comm['START_4']).start() time.sleep(60) i+=1 logger.info('start times is %d'%i)
def check_singal(self,args): Command('adb -host shell input longtap 60 180').start() status = checkfile.check_stauts(args) if status == False: raise Exception('show signal strength is failed') else: logger.info('show signal strength is success')
def play_video(self): Command(Video_Comm['PLAYVIDEO']).start() status =checkfile.check_stauts('resource-id="playerView"') if status == True: logger.info('play video is success') else: raise Exception('play video is failed')
def delete_audio_file(self): Command(Audio_Comm['DELETE_CHOICE']).start() time.sleep(1) Command(Audio_Comm['DELETE_CLICK']).start() Command(Audio_Comm['DELETE_AUDIO']).start() time.sleep(1) Command(Audio_Comm['CONFIRM_DELETE']).start() BaseAPI().back() status = checkfile.check_stauts('text="无音乐"') time.sleep(2) if status == True: logger.info('Delete the audio file is success') return True else: logger.debug('Delete the audio file is failed') return False
def check_ifconfig(self): Command('adb -host shell input longtap 60 180').start() status = checkfile.check_stauts('text="192.168.1.100"') if status == True: logger.info('ifconfig changed is success') else: raise Exception('ifconfig changed is failed')
def add_hidden_ssd(self): Command('adb -host shell input swipe 900 700 900 100').start() checkfile.click('text="添加网络"') time.sleep(1) Command('adb -host shell input text "ITFLEX_YUNOS_H"').start() time.sleep(1) checkfile.click('text="安全性"') time.sleep(1) checkfile.click('text="PSK"') time.sleep(1) Command('adb -host shell input tap 600 300').start() Command('adb -host shell input text 12345678').start() Command(WIFI_Comm['SELECT_RITHT']).start() time.sleep(10) base.back() self.check_connect_enable()
def push_audiofile(self): try: Command(Audio_Comm['PUSHAUDIO']).start() logger.info('push audio file in devices') except Exception, msg: logger.debug('Exception:%s' % msg) exit(1)
def delete_video_file(self): self.launch_video() Command(Video_Comm['MORE']).start() time.sleep(1) Command(Video_Comm['EDITOR']).start() Command(Video_Comm['CHOICCE']).start() time.sleep(1) Command(Video_Comm['DELETE_OPTION']).start() Command(Video_Comm['CONFRIM_DELETE']).start() status = checkfile.check_stauts('text="暂无视频"') if status == True: logger.info('Delete the video file is success') return True else: logger.debug('Delete the video file is failed') return False
def launch_video(self): Command(Video_Comm['OPENVIDEO']).start() time.sleep(2) status=checkfile.check_stauts('page://videoplayer.yunos.com/videoplayer') if status == True: logger.info('open the video app is success') else: raise Exception("Launch video player is failed")
def pause_resume(self, count): i = 0 while i < count: status, output, error = Command(Video_Comm['PAUSE_RESUME']).start() BaseAPI().check_adb_command('ret = true', output) time.sleep(1) i += 1 logger.info('pause and play video try: %d' % (i))
def video_button(self, seconds): time.sleep(1) Command(Camera_Comm['SWTICH_STATUS']).start() time.sleep(1) logger.info('switch to video mode') i = 0 while i < 2: try: time.sleep(2) Command(Camera_Comm['CLICK']).start() logger.info('click the video button') time.sleep(seconds) i += 1 seconds = 0 except Exception, msg: logger.debug("Exception: %s" % msg) exit(1)
def play_all(self): Command(Audio_Comm['PLAY_ALL']).start() time.sleep(3) status = checkfile.check_stauts('text="00:03/01:00"') if status == True: logger.info('Play audio is success') else: logger.error('Play audio is failed')
def change_adapter_name(self, *args): try: for i in args: self.click_adapter_name() Command('adb -host shell input text {0}'.format(i)).start() # Command(BT_Comm['KEYIN_DEVICENAME']).start() Command(BT_Comm['ENSURE_CHANGENAME_BUTTON']).start() time.sleep(1) stauts = checkfile.check_stauts('text="{0}"'.format(i)) if stauts == True: logger.info('SUCESS:finished the change adapter name') else: raise Exception('FAIL:change the adapter occur with issue') except Exception, msg: logger.debug('Exception:%s' % msg) exit(1)
def check_connect_enable(self): Command(WIFI_Comm['LANCH_WIFI']).start() time.sleep(2) status = checkfile.check_stauts('text="已连接"') if status == True: logger.info('enable connect is success') base.back() else: raise Exception('enable connect is failed')
def push_video_file(self,*args): try: for i in args: Command('adb -host push {0} {1}'.format(os.path.join(path_local,i),path_devcices)).start() time.sleep(5) logger.info('push video file in devices') except Exception,msg: logger.debug('Exception:%s'%msg) exit(1)
def delete_audio_file(self): checkfile.click('管理') time.sleep(2) Command(Audio_Comm['DELETE_CLICK']).start() time.sleep(2) Command(Audio_Comm['DELETE_AUDIO']).start() time.sleep(1) Command('adb -host shell input tap 700 450').start() time.sleep(2) BaseAPI().back() status = checkfile.check_stauts('text="暂无音乐"') time.sleep(2) if status == True: logger.info('Delete the audio file is success') return True else: logger.debug('Delete the audio file is failed') return False
def seek_player_mid(self): Command(Audio_Comm['SEEK_MID']).start() time.sleep(3) status = checkfile.check_stauts('text="00:34/01:00"') if status == True: logger.info('Seek the audio to middle is success') else: logger.error('Seek the audio to middle is failed') exit(1)
def open_audio(self): Command(Audio_Comm['OPENAUDIO']).start() status = checkfile.check_stauts('text="音乐"') if status == True: logger.info('SUCCESS:open audio package is success') else: logger.debug('Failed:open audio package is failed') exit(1)